Document Class
An Azure Document.
Document objects are UserDict subclasses and behave like dicts.
Constructor
Document(dict=None, /, **kwargs)
Positional-Only Parameters
| Name | Description |
|---|---|
|
dict
|
Default value: None
|
Methods
| clear | |
| copy | |
| from_dict |
Create a Document from a dict object. |
| from_json |
Create a Document from a JSON string. |
| fromkeys | |
| get | |
| items | |
| keys | |
| pop |
If key is not found, d is returned if given, otherwise KeyError is raised. |
| popitem |
as a 2-tuple; but raise KeyError if D is empty. |
| setdefault | |
| to_dict |
Return the document as a dict - directly using self would also work
as Document is |
| to_json |
Return the JSON representation of the document. |
| update |
If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v |
| values |
clear
clear() -> None. Remove all items from D.
copy
copy()
from_dict
Create a Document from a dict object.
from_dict(dct: dict) -> Document
Parameters
| Name | Description |
|---|---|
|
dct
Required
|
|
from_json
Create a Document from a JSON string.
from_json(json_data: str) -> Document
Parameters
| Name | Description |
|---|---|
|
json_data
Required
|
|
fromkeys
fromkeys(iterable, value=None)
Parameters
| Name | Description |
|---|---|
|
iterable
Required
|
|
|
value
|
Default value: None
|
get
get(k, [d]) -> D[k] if k in D, else d. d defaults to None.
Parameters
| Name | Description |
|---|---|
|
key
Required
|
|
|
default
|
Default value: None
|
items
items() -> a set-like object providing a view on D's items
keys
keys() -> a set-like object providing a view on D's keys
pop
If key is not found, d is returned if given, otherwise KeyError is raised.
pop(k, [d]) -> v, remove specified key and return the corresponding value.
Parameters
| Name | Description |
|---|---|
|
key
Required
|
|
|
default
|
|
popitem
as a 2-tuple; but raise KeyError if D is empty.
popitem() -> (k, v), remove and return some (key, value) pair
setdefault
setdefault(k, [d]) -> D.get(k,d), also set D[k]=d if k not in D
Parameters
| Name | Description |
|---|---|
|
key
Required
|
|
|
default
|
Default value: None
|
to_dict
Return the document as a dict - directly using self would also work
as Document is UserDict subclass and behave like dict
to_dict() -> dict
to_json
Return the JSON representation of the document.
to_json() -> str
update
If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
update([E], **F) -> None. Update D from mapping/iterable E and F.
Positional-Only Parameters
| Name | Description |
|---|---|
|
other
|
Default value: ()
|
values
values() -> an object providing a view on D's values