Skip to content

Commit b0b18b4

Browse files
simorenohannatischgahl-levytjprescott
authored andcommitted
[Cosmos] remove double signatures on container methods (Azure#23727)
* initial commit * Client Constructor (Azure#20310) * Removed some stuff * Looking at constructors * Updated request * Added client close * working client creation Co-authored-by: simorenoh <[email protected]> * read database database read works, but ignored exception is returned: Fatal error on SSL transport NoneType has no attribute 'send' (_loop._proactor.send) RuntimeError: Event loop is closed Unclosed connector/ connection * Update simon_testfile.py * with coroutine Added methods needed to use async with when initializing client, but logs output "Exception ignored... Runtime Error: Event loop is closed" * Update simon_testfile.py * small changes * async with returns no exceptions * async read container * async item read * cleaning up * create item/ database methods * item delete working * docs replace functionality missing upsert and other resources * upsert functionality missing read_all_items and both query methods for container class * missing query methods * CRUD for udf, sproc, triggers * initial query logic + container methods * missing some execution logic and tests * oops * fully working queries * small fix to query_items() also fixed README and added examples_async * Update _cosmos_client_connection_async.py * Update _cosmos_client_connection.py * documentation update * updated MIT dates and get_user_client() description * Update CHANGELOG.md * Delete simon_testfile.py * leftover retry utility * Update README.md * docs and removed six package * changes based on comments still missing discussion resolution on SSL verification and tests for async functionality under test module (apart from samples which are basically end to end tests) * small change in type hints * updated readme * fixes based on conversations * added missing type comments * update changelog for ci pipeline * added typehints, moved params into keywords, added decorators, made _connection_policy private * changes based on sync with central sdk * remove is_system_key from scripts (only used in execute_sproc) is_system_key verifies that an empty partition key is properly dealt with if ['partitionKey']['systemKey'] exists in the container options - however, we do not allow containers to be created with empty partition key values in the python sdk, so the functionality is needless * Revert "remove is_system_key from scripts (only used in execute_sproc)" Reverting last commit, will find way to init is_system_key for now * async script proxy using composition * pylint * capitalized constants * Apply suggestions from code review Clarifying comments for README Co-authored-by: Gahl Levy <[email protected]> * closing python code snippet * last doc updates * Update sdk/cosmos/azure-cosmos/CHANGELOG.md Co-authored-by: Simon Moreno <[email protected]> * version update * cosmos updates for release * fix connection string comma * Update CHANGELOG.md * fixing extra await keyword in sample * Update CHANGELOG.md * Update CHANGELOG.md * removed double signatures Co-authored-by: annatisch <[email protected]> Co-authored-by: Gahl Levy <[email protected]> Co-authored-by: Travis Prescott <[email protected]>
1 parent ace96dd commit b0b18b4

File tree

1 file changed

+12
-24
lines changed

1 file changed

+12
-24
lines changed

sdk/cosmos/azure-cosmos/azure/cosmos/aio/container.py

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ async def read(
117117
populate_partition_key_range_statistics=None, # type: Optional[bool]
118118
populate_quota_info=None, # type: Optional[bool]
119119
**kwargs # type: Any
120-
):
121-
# type: (...) -> Dict[str, Any]
120+
) -> Dict[str, Any]:
122121
"""Read the container properties.
123122
124123
:param populate_partition_key_range_statistics: Enable returning partition key
@@ -154,8 +153,7 @@ async def create_item(
154153
self,
155154
body, # type: Dict[str, Any]
156155
**kwargs # type: Any
157-
):
158-
# type: (...) -> Dict[str, Any]
156+
) -> Dict[str, Any]:
159157
"""Create an item in the container.
160158
161159
To update or replace an existing item, use the
@@ -203,8 +201,7 @@ async def read_item(
203201
item, # type: Union[str, Dict[str, Any]]
204202
partition_key, # type: Any
205203
**kwargs # type: Any
206-
):
207-
# type: (...) -> Dict[str, Any]
204+
) -> Dict[str, Any]:
208205
"""Get the item identified by `item`.
209206
210207
:param item: The ID (name) or dict representing item to retrieve.
@@ -251,8 +248,7 @@ def read_all_items(
251248
self,
252249
max_item_count=None, # type: Optional[int]
253250
**kwargs # type: Any
254-
):
255-
# type: (...) -> AsyncItemPaged[Dict[str, Any]]
251+
) -> AsyncItemPaged[Dict[str, Any]]:
256252
"""List all the items in the container.
257253
258254
:param max_item_count: Max number of items to be returned in the enumeration operation.
@@ -296,8 +292,7 @@ def query_items(
296292
enable_scan_in_query=None, # type: Optional[bool]
297293
populate_query_metrics=None, # type: Optional[bool]
298294
**kwargs # type: Any
299-
):
300-
# type: (...) -> AsyncItemPaged[Dict[str, Any]]
295+
) -> AsyncItemPaged[Dict[str, Any]]:
301296
"""Return all results matching the given `query`.
302297
303298
You can use any value for the container name in the FROM clause, but
@@ -384,8 +379,7 @@ def query_items_change_feed(
384379
continuation=None, # type: Optional[str]
385380
max_item_count=None, # type: Optional[int]
386381
**kwargs # type: Any
387-
):
388-
# type: (...) -> AsyncItemPaged[Dict[str, Any]]
382+
) -> AsyncItemPaged[Dict[str, Any]]:
389383
"""Get a sorted list of items that were changed, in the order in which they were modified.
390384
391385
:param partition_key_range_id: ChangeFeed requests can be executed against specific partition key ranges.
@@ -430,8 +424,7 @@ async def upsert_item(
430424
pre_trigger_include=None, # type: Optional[str]
431425
post_trigger_include=None, # type: Optional[str]
432426
**kwargs # type: Any
433-
):
434-
# type: (...) -> Dict[str, Any]
427+
) -> Dict[str, Any]:
435428
"""Insert or update the specified item.
436429
437430
If the item already exists in the container, it is replaced. If the item
@@ -476,8 +469,7 @@ async def replace_item(
476469
pre_trigger_include=None, # type: Optional[str]
477470
post_trigger_include=None, # type: Optional[str]
478471
**kwargs # type: Any
479-
):
480-
# type: (...) -> Dict[str, Any]
472+
) -> Dict[str, Any]:
481473
"""Replaces the specified item if it exists in the container.
482474
483475
If the item does not already exist in the container, an exception is raised.
@@ -521,8 +513,7 @@ async def delete_item(
521513
pre_trigger_include=None, # type: Optional[str]
522514
post_trigger_include=None, # type: Optional[str]
523515
**kwargs # type: Any
524-
):
525-
# type: (...) -> None
516+
) -> None:
526517
"""Delete the specified item from the container.
527518
528519
If the item does not already exist in the container, an exception is raised.
@@ -651,8 +642,7 @@ def query_conflicts(
651642
partition_key=None, # type: Optional[Any]
652643
max_item_count=None, # type: Optional[int]
653644
**kwargs # type: Any
654-
):
655-
# type: (...) -> AsyncItemPaged[Dict[str, Any]]
645+
) -> AsyncItemPaged[Dict[str, Any]]:
656646
"""Return all conflicts matching a given `query`.
657647
658648
:param query: The Azure Cosmos DB SQL query to execute.
@@ -689,8 +679,7 @@ async def read_conflict(
689679
conflict, # type: Union[str, Dict[str, Any]]
690680
partition_key, # type: Any
691681
**kwargs # type: Any
692-
):
693-
# type: (Union[str, Dict[str, Any]], Any, Any) -> Dict[str, Any]
682+
) -> Dict[str, Any]:
694683
"""Get the conflict identified by `conflict`.
695684
696685
:param conflict: The ID (name) or dict representing the conflict to retrieve.
@@ -718,8 +707,7 @@ async def delete_conflict(
718707
conflict, # type: Union[str, Dict[str, Any]]
719708
partition_key, # type: Any
720709
**kwargs # type: Any
721-
):
722-
# type: (Union[str, Dict[str, Any]], Any, Any) -> None
710+
) -> None:
723711
"""Delete a specified conflict from the container.
724712
725713
If the conflict does not already exist in the container, an exception is raised.

0 commit comments

Comments
 (0)