Skip to content

Commit cfe6181

Browse files
committed
Fix issues raised by mypy and isort
1 parent d306e2e commit cfe6181

File tree

5 files changed

+12
-9
lines changed

5 files changed

+12
-9
lines changed

msgraphcore/graph_session.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
from msgraphcore.constants import BASE_URL, SDK_VERSION
77
from msgraphcore.middleware.abc_token_credential import TokenCredential
88
from msgraphcore.middleware.authorization import AuthorizationHandler
9-
from msgraphcore.middleware.middleware import (BaseMiddleware, MiddlewarePipeline)
9+
from msgraphcore.middleware.middleware import (BaseMiddleware,
10+
MiddlewarePipeline)
1011
from msgraphcore.middleware.options.middleware_control import \
1112
middleware_control
1213

@@ -19,7 +20,7 @@ class GraphSession(Session):
1920
def __init__(
2021
self,
2122
credential: TokenCredential,
22-
scopes: [str] = ['.default'],
23+
scopes: list[str] = ['.default'],
2324
middleware: list = [],
2425
api_version: str = 'v1.0'
2526
):
@@ -98,7 +99,7 @@ def _graph_url(self, url: str) -> str:
9899
"""
99100
return self._base_url + url if (url[0] == '/') else url
100101

101-
def _register(self, middleware: [BaseMiddleware]) -> None:
102+
def _register(self, middleware: list[BaseMiddleware]) -> None:
102103
"""Adds middleware to middleware_pipeline
103104
104105
:param middleware: list of middleware
@@ -118,7 +119,7 @@ def _append_sdk_version(self) -> None:
118119
self.headers.update(
119120
{
120121
'sdkVersion':
121-
'graph-python-' + SDK_VERSION + ', ' + self.headers.get('sdkVersion')
122+
'graph-python-' + SDK_VERSION + ', ' + str(self.headers.get('sdkVersion'))
122123
}
123124
)
124125
else:

msgraphcore/middleware/authorization.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
from ..constants import AUTH_MIDDLEWARE_OPTIONS
1+
from msgraphcore.constants import AUTH_MIDDLEWARE_OPTIONS
2+
23
from .abc_token_credential import TokenCredential
34
from .middleware import BaseMiddleware
45
from .options.middleware_control import middleware_control
56

67

78
class AuthorizationHandler(BaseMiddleware):
8-
def __init__(self, credential: TokenCredential, scopes: [str]):
9+
def __init__(self, credential: TokenCredential, scopes: list[str]):
910
super().__init__()
1011
self.credential = credential
1112
self.scopes = scopes
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
class AuthMiddlewareOptions:
2-
def __init__(self, scopes: [str]):
2+
def __init__(self, scopes: list[str]):
33
self.scopes = scopes

msgraphcore/middleware/options/middleware_control.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from msgraphcore.constants import AUTH_MIDDLEWARE_OPTIONS
22

3-
from ..options.auth_middleware_options import AuthMiddlewareOptions
3+
from .auth_middleware_options import AuthMiddlewareOptions
44

55

66
class MiddlewareControl:

tests/unit/test_middleware_pipeline.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from collections import OrderedDict
22
from unittest import TestCase
33

4-
from msgraphcore.middleware.middleware import (BaseMiddleware, MiddlewarePipeline)
4+
from msgraphcore.middleware.middleware import (BaseMiddleware,
5+
MiddlewarePipeline)
56

67

78
class MiddlewarePipelineTest(TestCase):

0 commit comments

Comments
 (0)