Skip to content

Commit a32c175

Browse files
committed
fix formatting issues
1 parent 5598b7d commit a32c175

10 files changed

+58
-24
lines changed

src/msgraph_core/graph_client_factory.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ def _get_telemetry_handler(
9191
options"""
9292

9393
if options:
94-
graph_telemetry_options: GraphTelemetryHandlerOption = options.get(GraphTelemetryHandlerOption().get_key()) # type: ignore # Unable to down cast type
94+
graph_telemetry_options: GraphTelemetryHandlerOption = options.get(
95+
GraphTelemetryHandlerOption().get_key()
96+
) # type: ignore # Unable to down cast type
9597
if graph_telemetry_options:
9698
return GraphTelemetryHandler(options=graph_telemetry_options)
9799
return GraphTelemetryHandler()

src/msgraph_core/models/page_result.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,16 @@ def get_field_deserializers(self) -> Dict[str, Callable[[ParseNode], None]]:
4646
object where each entry is a property key with its deserialization callback.
4747
"""
4848
return {
49-
"@odata.nextLink": lambda x: setattr(self, "odata_next_link", x.get_str_value()),
50-
"value": lambda x: setattr(self, "value", x.get_collection_of_object_values(Parsable)) # type: ignore # Bug. Should get a collection of primitive dictionary objects
49+
"@odata.nextLink":
50+
lambda x: setattr(self, "odata_next_link", x.get_str_value()),
51+
"value":
52+
lambda x: setattr(
53+
self,
54+
"value",
55+
x.get_collection_of_object_values(
56+
Parsable # type: ignore # Bug. Should get a collection of primitive dictionary objects
57+
)
58+
)
5159
}
5260

5361
def serialize(self, writer: SerializationWriter) -> None:

src/msgraph_core/requests/batch_request_content.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,14 @@ def add_request(self, request_id: Optional[str], request: BatchRequestItem) -> N
6767
if hasattr(request, 'depends_on') and request.depends_on:
6868
for dependent_id in request.depends_on:
6969
if not self._request_by_id(dependent_id):
70-
raise ValueError(f"Request depends on request id: {dependent_id} which was not found in requests. Add request id: {dependent_id} first")
70+
raise ValueError(
71+
f"Request depends on request id: {dependent_id} which was not found in requests. Add request id: {dependent_id} first"
72+
)
7173
self._requests[request.id] = request
7274

73-
def add_request_information(self, request_information: RequestInformation, request_id: Optional[str] = None) -> None:
75+
def add_request_information(
76+
self, request_information: RequestInformation, request_id: Optional[str] = None
77+
) -> None:
7478
"""
7579
Adds a request to the batch request content.
7680
Args:

src/msgraph_core/requests/batch_request_content_collection.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,14 @@ def new_batch_with_failed_requests(self) -> Optional[BatchRequestContent]:
5353
batch_with_failed_responses: Optional[BatchRequestContent] = BatchRequestContent()
5454
for batch in self.batches:
5555
for request in batch.requests:
56-
if request.status_code not in [200, 201, 202, 203, 204, 205, 206, 207, 208, 226]: # type: ignore # Method should be deprecated
56+
if request.status_code not in [ # type: ignore # Method should be deprecated
57+
200, 201, 202, 203, 204, 205, 206, 207, 208, 226
58+
]:
5759
if batch_with_failed_responses is not None:
58-
batch_with_failed_responses.add_request(request.id, request) # type: ignore # Bug. Method should be deprecated
60+
batch_with_failed_responses.add_request(
61+
request.id, # type: ignore # Bug. Method should be deprecated
62+
request # type: ignore
63+
)
5964
else:
6065
raise ValueError("batch_with_failed_responses is None")
6166
return batch_with_failed_responses

src/msgraph_core/requests/batch_request_item.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,12 @@ def create_with_urllib_request(
7878
request_info.headers = RequestHeaders()
7979
for key, value in request.headers.items():
8080
request_info.headers.try_add(header_name=key, header_value=value)
81-
request_info.content = request.data # type: ignore
82-
return BatchRequestItem(request_info, id, depends_on) # type: ignore # union types not analysed correctly
81+
request_info.content = request.data # type: ignore
82+
return BatchRequestItem(
83+
request_info,
84+
id,
85+
depends_on # type: ignore # union types not analysed correctly
86+
)
8387

8488
def set_depends_on(self, requests: Optional[List[Union[str, 'BatchRequestItem']]]) -> None:
8589
"""
@@ -254,7 +258,10 @@ def serialize(self, writer: SerializationWriter) -> None:
254258
writer.write_str_value('method', self.method)
255259
writer.write_str_value('url', self.url)
256260
writer.write_collection_of_primitive_values('depends_on', self._depends_on)
257-
writer.write_collection_of_object_values('headers', self._headers) # type: ignore # need method to serialize dicts
261+
writer.write_collection_of_object_values(
262+
'headers',
263+
self._headers # type: ignore # need method to serialize dicts
264+
)
258265
if self._body:
259266
json_object = json.loads(self._body)
260267
is_json_string = json_object and isinstance(json_object, dict)

src/msgraph_core/requests/batch_response_content.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,7 @@ def set_responses(n: ParseNode):
149149
else:
150150
setattr(self, '_responses', {})
151151

152-
153-
return {
154-
'responses':
155-
lambda n: set_responses(n)
156-
}
152+
return {'responses': lambda n: set_responses(n)}
157153

158154
def serialize(self, writer: SerializationWriter) -> None:
159155
"""

src/msgraph_core/requests/batch_response_content_collection.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,8 @@ def get_field_deserializers(self) -> Dict[str, Callable[[ParseNode], None]]:
6666
"""
6767
return {
6868
'responses':
69-
lambda n: setattr(
70-
self, "_responses",
71-
n.get_collection_of_object_values(BatchResponseItem)
72-
)
69+
lambda n:
70+
setattr(self, "_responses", n.get_collection_of_object_values(BatchResponseItem))
7371
}
7472

7573
def serialize(self, writer: SerializationWriter) -> None:

src/msgraph_core/requests/batch_response_item.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,11 @@ def get_field_deserializers(self) -> Dict[str, Callable[[ParseNode], None]]:
142142
return {
143143
"id": lambda x: setattr(self, "id", x.get_str_value()),
144144
"status": lambda x: setattr(self, "status", x.get_int_value()),
145-
"headers": lambda x: setattr(self, "headers", x.try_get_anything(x._json_node)), # type: ignore # need interface to return a dictionary
145+
"headers": lambda x: setattr(
146+
self,
147+
"headers",
148+
x.try_get_anything(x._json_node) # type: ignore
149+
), # need interface to return a dictionary
146150
"body": lambda x: setattr(self, "body", x.get_bytes_value()),
147151
}
148152

@@ -153,7 +157,10 @@ def serialize(self, writer: SerializationWriter) -> None:
153157
writer.write_str_value('id', self._id)
154158
writer.write_str_value('atomicity_group', self._atomicity_group)
155159
writer.write_int_value('status', self._status)
156-
writer.write_collection_of_primitive_values('headers', self._headers) # type: ignore # need method to serialize dicts
160+
writer.write_collection_of_primitive_values(
161+
'headers',
162+
self._headers # type: ignore
163+
) # need method to serialize dicts
157164
if self._body:
158165
writer.write_bytes_value('body', self._body.getvalue())
159166
else:

src/msgraph_core/tasks/large_file_upload.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
T = TypeVar('T', bound=Parsable)
1818

19+
1920
# pylint: disable=too-many-instance-attributes
2021
class LargeFileUploadTask:
2122

@@ -145,7 +146,9 @@ def next_range(self):
145146
def next_range(self, value: Optional[str]) -> None:
146147
self._next_range = value
147148

148-
async def next_chunk(self, file: BytesIO, range_start: int = 0, range_end: int = 0) -> LargeFileUploadSession:
149+
async def next_chunk(
150+
self, file: BytesIO, range_start: int = 0, range_end: int = 0
151+
) -> LargeFileUploadSession:
149152
upload_url = self.get_validated_upload_url(self.upload_session)
150153
if not upload_url:
151154
raise ValueError('The upload session URL must not be empty.')

src/msgraph_core/tasks/page_iterator.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ async def next(self) -> Optional[PageResult]:
148148
if self.current_page is not None and not self.current_page.odata_next_link:
149149
return None
150150
response = await self.fetch_next_page()
151-
next_link = response.odata_next_link if response and hasattr(response, 'odata_next_link') else None
151+
next_link = response.odata_next_link if response and hasattr(
152+
response, 'odata_next_link'
153+
) else None
152154
value = response.value if response and hasattr(response, 'value') else None
153155
return PageResult(next_link, value)
154156

@@ -206,7 +208,9 @@ async def fetch_next_page(self) -> Optional[Union[T, PageResult]]:
206208
if self.request_options:
207209
request_info.add_request_options(*self.request_options)
208210
return await self.request_adapter.send_async(
209-
request_info, self.parsable_factory, self.error_mapping # type: ignore
211+
request_info,
212+
self.parsable_factory, # type: ignore
213+
self.error_mapping
210214
)
211215

212216
def enumerate(self, callback: Optional[Callable] = None) -> bool:

0 commit comments

Comments
 (0)