Skip to content

Commit 6f91006

Browse files
committed
fix: Resolve mypy type checking errors for Sentinel plugin
1 parent e9c77d5 commit 6f91006

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

graphistry/client_session.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from . import util
1010
from .plugins_types.spanner_types import SpannerConfig
1111
from .plugins_types.kusto_types import KustoConfig
12+
from .plugins_types.sentinel_types import SentinelConfig
1213

1314

1415

@@ -85,6 +86,7 @@ def __init__(self) -> None:
8586
# NOTE: These are dataclasses, so we shallow copy them
8687
self.kusto: Optional[KustoConfig] = None
8788
self.spanner: Optional[SpannerConfig] = None
89+
self.sentinel: Optional[SentinelConfig] = None
8890

8991
# TODO: Migrate to a pattern like Kusto or Spanner
9092
self._bolt_driver: Optional[Any] = None

graphistry/plugins/sentinel.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
import time
22
import pandas as pd
3-
from typing import Any, List, Optional, TYPE_CHECKING, Union, overload, Literal
3+
from typing import Any, List, Optional, TYPE_CHECKING, Union, overload, Literal, Tuple
44
from datetime import datetime, timedelta
55

66
if TYPE_CHECKING:
77
from azure.monitor.query import LogsQueryClient
88
from azure.core.credentials import TokenCredential
9+
from azure.core.exceptions import HttpResponseError
10+
from azure.identity import DefaultAzureCredential, ClientSecretCredential, DeviceCodeCredential
911
else:
1012
LogsQueryClient = Any
1113
TokenCredential = Any
14+
HttpResponseError = Any
15+
DefaultAzureCredential = Any
16+
ClientSecretCredential = Any
17+
DeviceCodeCredential = Any
1218

1319
from graphistry.Plottable import Plottable
1420
from graphistry.util import setup_logger
@@ -228,7 +234,7 @@ def kql(
228234
self,
229235
query: str,
230236
*,
231-
timespan: Optional[Union[timedelta, tuple[datetime, datetime]]] = None,
237+
timespan: Optional[Union[timedelta, Tuple[datetime, datetime]]] = None,
232238
unwrap_nested: Optional[bool] = None,
233239
single_table: Literal[True] = True,
234240
include_statistics: bool = False
@@ -240,7 +246,7 @@ def kql(
240246
self,
241247
query: str,
242248
*,
243-
timespan: Optional[Union[timedelta, tuple[datetime, datetime]]] = None,
249+
timespan: Optional[Union[timedelta, Tuple[datetime, datetime]]] = None,
244250
unwrap_nested: Optional[bool] = None,
245251
single_table: Literal[False],
246252
include_statistics: bool = False
@@ -252,7 +258,7 @@ def kql(
252258
self,
253259
query: str,
254260
*,
255-
timespan: Optional[Union[timedelta, tuple[datetime, datetime]]] = None,
261+
timespan: Optional[Union[timedelta, Tuple[datetime, datetime]]] = None,
256262
unwrap_nested: Optional[bool] = None,
257263
single_table: bool = True,
258264
include_statistics: bool = False
@@ -263,7 +269,7 @@ def kql(
263269
self,
264270
query: str,
265271
*,
266-
timespan: Optional[Union[timedelta, tuple[datetime, datetime]]] = None,
272+
timespan: Optional[Union[timedelta, Tuple[datetime, datetime]]] = None,
267273
unwrap_nested: Optional[bool] = None,
268274
single_table: bool = True,
269275
include_statistics: bool = False
@@ -479,7 +485,7 @@ def sentinel_schema(self, table: str) -> pd.DataFrame:
479485
def _sentinel_query(
480486
self,
481487
query: str,
482-
timespan: Optional[Union[timedelta, tuple[datetime, datetime]]] = None
488+
timespan: Optional[Union[timedelta, Tuple[datetime, datetime]]] = None
483489
) -> List[SentinelQueryResult]:
484490
"""Execute KQL query and return raw results.
485491

mypy.ini

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,5 +110,14 @@ ignore_missing_imports = True
110110
[mypy-azure.kusto.*]
111111
ignore_missing_imports = True
112112

113+
[mypy-azure.monitor.*]
114+
ignore_missing_imports = True
115+
116+
[mypy-azure.identity.*]
117+
ignore_missing_imports = True
118+
119+
[mypy-azure.core.*]
120+
ignore_missing_imports = True
121+
113122
[mypy-requests.*]
114123
ignore_missing_imports = True

0 commit comments

Comments
 (0)