Skip to content

Commit fc6c6b0

Browse files
authored
Merge branch 'dev' into evanroman/add-thread-local-context
2 parents bba8884 + 847f763 commit fc6c6b0

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

azure/functions/_abc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,10 @@ def __setitem__(self, key, value):
393393
def to_json(self) -> str:
394394
pass
395395

396+
@abc.abstractmethod
397+
def to_dict(self) -> dict:
398+
pass
399+
396400

397401
class DocumentList(abc.ABC):
398402
pass

azure/functions/_cosmosdb.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ def to_json(self) -> str:
2727
"""Return the JSON representation of the document."""
2828
return json.dumps(dict(self))
2929

30+
def to_dict(self) -> dict:
31+
"""Return the document as a dict - directly using self would also work
32+
as Document is ``UserDict`` subclass and behave like dict"""
33+
return dict(self)
34+
3035
def __getitem__(self, key):
3136
return collections.UserDict.__getitem__(self, key)
3237

0 commit comments

Comments
 (0)