id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 51 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
243,300 | mottosso/Qt.py | membership.py | compare | def compare(dicts):
"""Compare by iteration"""
common_members = {}
common_keys = reduce(lambda x, y: x & y, map(dict.keys, dicts))
for k in common_keys:
common_members[k] = list(
reduce(lambda x, y: x & y, [set(d[k]) for d in dicts]))
return common_members | python | def compare(dicts):
common_members = {}
common_keys = reduce(lambda x, y: x & y, map(dict.keys, dicts))
for k in common_keys:
common_members[k] = list(
reduce(lambda x, y: x & y, [set(d[k]) for d in dicts]))
return common_members | [
"def",
"compare",
"(",
"dicts",
")",
":",
"common_members",
"=",
"{",
"}",
"common_keys",
"=",
"reduce",
"(",
"lambda",
"x",
",",
"y",
":",
"x",
"&",
"y",
",",
"map",
"(",
"dict",
".",
"keys",
",",
"dicts",
")",
")",
"for",
"k",
"in",
"common_key... | Compare by iteration | [
"Compare",
"by",
"iteration"
] | d88a0c1762ad90d1965008cc14c53504bbcc0061 | https://github.com/mottosso/Qt.py/blob/d88a0c1762ad90d1965008cc14c53504bbcc0061/membership.py#L42-L51 |
243,301 | mottosso/Qt.py | membership.py | sort_common_members | def sort_common_members():
"""Sorts the keys and members"""
filename = PREFIX + '/common_members.json'
sorted_json_data = {}
json_data = read_json(filename)
all_keys = []
for key, value in json_data.items():
all_keys.append(key)
sorted_keys = sorted(all_keys)
for key in sorted... | python | def sort_common_members():
filename = PREFIX + '/common_members.json'
sorted_json_data = {}
json_data = read_json(filename)
all_keys = []
for key, value in json_data.items():
all_keys.append(key)
sorted_keys = sorted(all_keys)
for key in sorted_keys:
if len(json_data[key]) ... | [
"def",
"sort_common_members",
"(",
")",
":",
"filename",
"=",
"PREFIX",
"+",
"'/common_members.json'",
"sorted_json_data",
"=",
"{",
"}",
"json_data",
"=",
"read_json",
"(",
"filename",
")",
"all_keys",
"=",
"[",
"]",
"for",
"key",
",",
"value",
"in",
"json_... | Sorts the keys and members | [
"Sorts",
"the",
"keys",
"and",
"members"
] | d88a0c1762ad90d1965008cc14c53504bbcc0061 | https://github.com/mottosso/Qt.py/blob/d88a0c1762ad90d1965008cc14c53504bbcc0061/membership.py#L77-L96 |
243,302 | mottosso/Qt.py | membership.py | generate_common_members | def generate_common_members():
"""Generate JSON with commonly shared members"""
pyside = read_json(PREFIX + '/PySide.json')
pyside2 = read_json(PREFIX + '/PySide2.json')
pyqt4 = read_json(PREFIX + '/PyQt4.json')
pyqt5 = read_json(PREFIX + '/PyQt5.json')
dicts = [pyside, pyside2, pyqt4, pyqt5]
... | python | def generate_common_members():
pyside = read_json(PREFIX + '/PySide.json')
pyside2 = read_json(PREFIX + '/PySide2.json')
pyqt4 = read_json(PREFIX + '/PyQt4.json')
pyqt5 = read_json(PREFIX + '/PyQt5.json')
dicts = [pyside, pyside2, pyqt4, pyqt5]
common_members = compare(dicts)
write_json(com... | [
"def",
"generate_common_members",
"(",
")",
":",
"pyside",
"=",
"read_json",
"(",
"PREFIX",
"+",
"'/PySide.json'",
")",
"pyside2",
"=",
"read_json",
"(",
"PREFIX",
"+",
"'/PySide2.json'",
")",
"pyqt4",
"=",
"read_json",
"(",
"PREFIX",
"+",
"'/PyQt4.json'",
")"... | Generate JSON with commonly shared members | [
"Generate",
"JSON",
"with",
"commonly",
"shared",
"members"
] | d88a0c1762ad90d1965008cc14c53504bbcc0061 | https://github.com/mottosso/Qt.py/blob/d88a0c1762ad90d1965008cc14c53504bbcc0061/membership.py#L99-L109 |
243,303 | mottosso/Qt.py | caveats.py | parse | def parse(fname):
"""Return blocks of code as list of dicts
Arguments:
fname (str): Relative name of caveats file
"""
blocks = list()
with io.open(fname, "r", encoding="utf-8") as f:
in_block = False
current_block = None
current_header = ""
for line in f:
... | python | def parse(fname):
blocks = list()
with io.open(fname, "r", encoding="utf-8") as f:
in_block = False
current_block = None
current_header = ""
for line in f:
# Doctests are within a quadruple hashtag header.
if line.startswith("#### "):
cur... | [
"def",
"parse",
"(",
"fname",
")",
":",
"blocks",
"=",
"list",
"(",
")",
"with",
"io",
".",
"open",
"(",
"fname",
",",
"\"r\"",
",",
"encoding",
"=",
"\"utf-8\"",
")",
"as",
"f",
":",
"in_block",
"=",
"False",
"current_block",
"=",
"None",
"current_h... | Return blocks of code as list of dicts
Arguments:
fname (str): Relative name of caveats file | [
"Return",
"blocks",
"of",
"code",
"as",
"list",
"of",
"dicts"
] | d88a0c1762ad90d1965008cc14c53504bbcc0061 | https://github.com/mottosso/Qt.py/blob/d88a0c1762ad90d1965008cc14c53504bbcc0061/caveats.py#L6-L82 |
243,304 | mottosso/Qt.py | Qt.py | _qInstallMessageHandler | def _qInstallMessageHandler(handler):
"""Install a message handler that works in all bindings
Args:
handler: A function that takes 3 arguments, or None
"""
def messageOutputHandler(*args):
# In Qt4 bindings, message handlers are passed 2 arguments
# In Qt5 bindings, message hand... | python | def _qInstallMessageHandler(handler):
def messageOutputHandler(*args):
# In Qt4 bindings, message handlers are passed 2 arguments
# In Qt5 bindings, message handlers are passed 3 arguments
# The first argument is a QtMsgType
# The last argument is the message to be printed
# ... | [
"def",
"_qInstallMessageHandler",
"(",
"handler",
")",
":",
"def",
"messageOutputHandler",
"(",
"*",
"args",
")",
":",
"# In Qt4 bindings, message handlers are passed 2 arguments",
"# In Qt5 bindings, message handlers are passed 3 arguments",
"# The first argument is a QtMsgType",
"#... | Install a message handler that works in all bindings
Args:
handler: A function that takes 3 arguments, or None | [
"Install",
"a",
"message",
"handler",
"that",
"works",
"in",
"all",
"bindings"
] | d88a0c1762ad90d1965008cc14c53504bbcc0061 | https://github.com/mottosso/Qt.py/blob/d88a0c1762ad90d1965008cc14c53504bbcc0061/Qt.py#L683-L716 |
243,305 | mottosso/Qt.py | Qt.py | _import_sub_module | def _import_sub_module(module, name):
"""import_sub_module will mimic the function of importlib.import_module"""
module = __import__(module.__name__ + "." + name)
for level in name.split("."):
module = getattr(module, level)
return module | python | def _import_sub_module(module, name):
module = __import__(module.__name__ + "." + name)
for level in name.split("."):
module = getattr(module, level)
return module | [
"def",
"_import_sub_module",
"(",
"module",
",",
"name",
")",
":",
"module",
"=",
"__import__",
"(",
"module",
".",
"__name__",
"+",
"\".\"",
"+",
"name",
")",
"for",
"level",
"in",
"name",
".",
"split",
"(",
"\".\"",
")",
":",
"module",
"=",
"getattr"... | import_sub_module will mimic the function of importlib.import_module | [
"import_sub_module",
"will",
"mimic",
"the",
"function",
"of",
"importlib",
".",
"import_module"
] | d88a0c1762ad90d1965008cc14c53504bbcc0061 | https://github.com/mottosso/Qt.py/blob/d88a0c1762ad90d1965008cc14c53504bbcc0061/Qt.py#L1191-L1196 |
243,306 | mottosso/Qt.py | Qt.py | _setup | def _setup(module, extras):
"""Install common submodules"""
Qt.__binding__ = module.__name__
for name in list(_common_members) + extras:
try:
submodule = _import_sub_module(
module, name)
except ImportError:
try:
# For extra modules l... | python | def _setup(module, extras):
Qt.__binding__ = module.__name__
for name in list(_common_members) + extras:
try:
submodule = _import_sub_module(
module, name)
except ImportError:
try:
# For extra modules like sip and shiboken that may not be
... | [
"def",
"_setup",
"(",
"module",
",",
"extras",
")",
":",
"Qt",
".",
"__binding__",
"=",
"module",
".",
"__name__",
"for",
"name",
"in",
"list",
"(",
"_common_members",
")",
"+",
"extras",
":",
"try",
":",
"submodule",
"=",
"_import_sub_module",
"(",
"mod... | Install common submodules | [
"Install",
"common",
"submodules"
] | d88a0c1762ad90d1965008cc14c53504bbcc0061 | https://github.com/mottosso/Qt.py/blob/d88a0c1762ad90d1965008cc14c53504bbcc0061/Qt.py#L1199-L1222 |
243,307 | mottosso/Qt.py | Qt.py | _build_compatibility_members | def _build_compatibility_members(binding, decorators=None):
"""Apply `binding` to QtCompat
Arguments:
binding (str): Top level binding in _compatibility_members.
decorators (dict, optional): Provides the ability to decorate the
original Qt methods when needed by a binding. This can ... | python | def _build_compatibility_members(binding, decorators=None):
decorators = decorators or dict()
# Allow optional site-level customization of the compatibility members.
# This method does not need to be implemented in QtSiteConfig.
try:
import QtSiteConfig
except ImportError:
pass
... | [
"def",
"_build_compatibility_members",
"(",
"binding",
",",
"decorators",
"=",
"None",
")",
":",
"decorators",
"=",
"decorators",
"or",
"dict",
"(",
")",
"# Allow optional site-level customization of the compatibility members.",
"# This method does not need to be implemented in Q... | Apply `binding` to QtCompat
Arguments:
binding (str): Top level binding in _compatibility_members.
decorators (dict, optional): Provides the ability to decorate the
original Qt methods when needed by a binding. This can be used
to change the returned value to a standard valu... | [
"Apply",
"binding",
"to",
"QtCompat"
] | d88a0c1762ad90d1965008cc14c53504bbcc0061 | https://github.com/mottosso/Qt.py/blob/d88a0c1762ad90d1965008cc14c53504bbcc0061/Qt.py#L1297-L1355 |
243,308 | mottosso/Qt.py | Qt.py | _convert | def _convert(lines):
"""Convert compiled .ui file from PySide2 to Qt.py
Arguments:
lines (list): Each line of of .ui file
Usage:
>> with open("myui.py") as f:
.. lines = _convert(f.readlines())
"""
def parse(line):
line = line.replace("from PySide2 import", "fro... | python | def _convert(lines):
def parse(line):
line = line.replace("from PySide2 import", "from Qt import QtCompat,")
line = line.replace("QtWidgets.QApplication.translate",
"QtCompat.translate")
if "QtCore.SIGNAL" in line:
raise NotImplementedError("QtCore.SIG... | [
"def",
"_convert",
"(",
"lines",
")",
":",
"def",
"parse",
"(",
"line",
")",
":",
"line",
"=",
"line",
".",
"replace",
"(",
"\"from PySide2 import\"",
",",
"\"from Qt import QtCompat,\"",
")",
"line",
"=",
"line",
".",
"replace",
"(",
"\"QtWidgets.QApplication... | Convert compiled .ui file from PySide2 to Qt.py
Arguments:
lines (list): Each line of of .ui file
Usage:
>> with open("myui.py") as f:
.. lines = _convert(f.readlines()) | [
"Convert",
"compiled",
".",
"ui",
"file",
"from",
"PySide2",
"to",
"Qt",
".",
"py"
] | d88a0c1762ad90d1965008cc14c53504bbcc0061 | https://github.com/mottosso/Qt.py/blob/d88a0c1762ad90d1965008cc14c53504bbcc0061/Qt.py#L1595-L1623 |
243,309 | mottosso/Qt.py | examples/QtSiteConfig/QtSiteConfig.py | update_compatibility_decorators | def update_compatibility_decorators(binding, decorators):
""" This optional function is called by Qt.py to modify the decorators
applied to QtCompat namespace objects.
Arguments:
binding (str): The Qt binding being wrapped by Qt.py
decorators (dict): Maps specific decorator functions to
... | python | def update_compatibility_decorators(binding, decorators):
def _widgetDecorator(some_function):
def wrapper(*args, **kwargs):
ret = some_function(*args, **kwargs)
# Modifies the returned value so we can test that the
# decorator works.
return "Test: {}".format(... | [
"def",
"update_compatibility_decorators",
"(",
"binding",
",",
"decorators",
")",
":",
"def",
"_widgetDecorator",
"(",
"some_function",
")",
":",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"some_function",
"(",
"*",
... | This optional function is called by Qt.py to modify the decorators
applied to QtCompat namespace objects.
Arguments:
binding (str): The Qt binding being wrapped by Qt.py
decorators (dict): Maps specific decorator functions to
QtCompat namespace methods. See Qt._build_compatibility_m... | [
"This",
"optional",
"function",
"is",
"called",
"by",
"Qt",
".",
"py",
"to",
"modify",
"the",
"decorators",
"applied",
"to",
"QtCompat",
"namespace",
"objects",
"."
] | d88a0c1762ad90d1965008cc14c53504bbcc0061 | https://github.com/mottosso/Qt.py/blob/d88a0c1762ad90d1965008cc14c53504bbcc0061/examples/QtSiteConfig/QtSiteConfig.py#L53-L91 |
243,310 | mottosso/Qt.py | examples/loadUi/baseinstance2.py | load_ui_type | def load_ui_type(uifile):
"""Pyside equivalent for the loadUiType function in PyQt.
From the PyQt4 documentation:
Load a Qt Designer .ui file and return a tuple of the generated form
class and the Qt base class. These can then be used to create any
number of instances of the user interf... | python | def load_ui_type(uifile):
import pysideuic
import xml.etree.ElementTree as ElementTree
from cStringIO import StringIO
parsed = ElementTree.parse(uifile)
widget_class = parsed.find('widget').get('class')
form_class = parsed.find('class').text
with open(uifile, 'r') as f:
o = StringI... | [
"def",
"load_ui_type",
"(",
"uifile",
")",
":",
"import",
"pysideuic",
"import",
"xml",
".",
"etree",
".",
"ElementTree",
"as",
"ElementTree",
"from",
"cStringIO",
"import",
"StringIO",
"parsed",
"=",
"ElementTree",
".",
"parse",
"(",
"uifile",
")",
"widget_cl... | Pyside equivalent for the loadUiType function in PyQt.
From the PyQt4 documentation:
Load a Qt Designer .ui file and return a tuple of the generated form
class and the Qt base class. These can then be used to create any
number of instances of the user interface without having to parse the
... | [
"Pyside",
"equivalent",
"for",
"the",
"loadUiType",
"function",
"in",
"PyQt",
"."
] | d88a0c1762ad90d1965008cc14c53504bbcc0061 | https://github.com/mottosso/Qt.py/blob/d88a0c1762ad90d1965008cc14c53504bbcc0061/examples/loadUi/baseinstance2.py#L10-L51 |
243,311 | mottosso/Qt.py | examples/loadUi/baseinstance2.py | pyside_load_ui | def pyside_load_ui(uifile, base_instance=None):
"""Provide PyQt4.uic.loadUi functionality to PySide
Args:
uifile (str): Absolute path to .ui file
base_instance (QWidget): The widget into which UI widgets are loaded
Note:
pysideuic is required for this to work with PySide.
... | python | def pyside_load_ui(uifile, base_instance=None):
form_class, base_class = load_ui_type(uifile)
if not base_instance:
typeName = form_class.__name__
finalType = type(typeName,
(form_class, base_class),
{})
base_instance = finalType()
el... | [
"def",
"pyside_load_ui",
"(",
"uifile",
",",
"base_instance",
"=",
"None",
")",
":",
"form_class",
",",
"base_class",
"=",
"load_ui_type",
"(",
"uifile",
")",
"if",
"not",
"base_instance",
":",
"typeName",
"=",
"form_class",
".",
"__name__",
"finalType",
"=",
... | Provide PyQt4.uic.loadUi functionality to PySide
Args:
uifile (str): Absolute path to .ui file
base_instance (QWidget): The widget into which UI widgets are loaded
Note:
pysideuic is required for this to work with PySide.
This seems to work correctly in Maya as well as outsid... | [
"Provide",
"PyQt4",
".",
"uic",
".",
"loadUi",
"functionality",
"to",
"PySide"
] | d88a0c1762ad90d1965008cc14c53504bbcc0061 | https://github.com/mottosso/Qt.py/blob/d88a0c1762ad90d1965008cc14c53504bbcc0061/examples/loadUi/baseinstance2.py#L54-L89 |
243,312 | Azure/azure-cosmos-python | samples/IndexManagement/Program.py | ExplicitlyExcludeFromIndex | def ExplicitlyExcludeFromIndex(client, database_id):
""" The default index policy on a DocumentContainer will AUTOMATICALLY index ALL documents added.
There may be scenarios where you want to exclude a specific doc from the index even though all other
documents are being indexed automatically.
... | python | def ExplicitlyExcludeFromIndex(client, database_id):
try:
DeleteContainerIfExists(client, database_id, COLLECTION_ID)
database_link = GetDatabaseLink(database_id)
# collections = Query_Entities(client, 'collection', parent_link = database_link)
# print(collections)
# Create ... | [
"def",
"ExplicitlyExcludeFromIndex",
"(",
"client",
",",
"database_id",
")",
":",
"try",
":",
"DeleteContainerIfExists",
"(",
"client",
",",
"database_id",
",",
"COLLECTION_ID",
")",
"database_link",
"=",
"GetDatabaseLink",
"(",
"database_id",
")",
"# collections = Qu... | The default index policy on a DocumentContainer will AUTOMATICALLY index ALL documents added.
There may be scenarios where you want to exclude a specific doc from the index even though all other
documents are being indexed automatically.
This method demonstrates how to use an index directive t... | [
"The",
"default",
"index",
"policy",
"on",
"a",
"DocumentContainer",
"will",
"AUTOMATICALLY",
"index",
"ALL",
"documents",
"added",
".",
"There",
"may",
"be",
"scenarios",
"where",
"you",
"want",
"to",
"exclude",
"a",
"specific",
"doc",
"from",
"the",
"index",... | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/samples/IndexManagement/Program.py#L171-L231 |
243,313 | Azure/azure-cosmos-python | samples/IndexManagement/Program.py | ExcludePathsFromIndex | def ExcludePathsFromIndex(client, database_id):
"""The default behavior is for Cosmos to index every attribute in every document automatically.
There are times when a document contains large amounts of information, in deeply nested structures
that you know you will never search on. In extreme cases li... | python | def ExcludePathsFromIndex(client, database_id):
try:
DeleteContainerIfExists(client, database_id, COLLECTION_ID)
database_link = GetDatabaseLink(database_id)
# collections = Query_Entities(client, 'collection', parent_link = database_link)
# print(collections)
doc_with_neste... | [
"def",
"ExcludePathsFromIndex",
"(",
"client",
",",
"database_id",
")",
":",
"try",
":",
"DeleteContainerIfExists",
"(",
"client",
",",
"database_id",
",",
"COLLECTION_ID",
")",
"database_link",
"=",
"GetDatabaseLink",
"(",
"database_id",
")",
"# collections = Query_E... | The default behavior is for Cosmos to index every attribute in every document automatically.
There are times when a document contains large amounts of information, in deeply nested structures
that you know you will never search on. In extreme cases like this, you can exclude paths from the
index t... | [
"The",
"default",
"behavior",
"is",
"for",
"Cosmos",
"to",
"index",
"every",
"attribute",
"in",
"every",
"document",
"automatically",
".",
"There",
"are",
"times",
"when",
"a",
"document",
"contains",
"large",
"amounts",
"of",
"information",
"in",
"deeply",
"n... | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/samples/IndexManagement/Program.py#L294-L367 |
243,314 | Azure/azure-cosmos-python | samples/IndexManagement/Program.py | UseRangeIndexesOnStrings | def UseRangeIndexesOnStrings(client, database_id):
"""Showing how range queries can be performed even on strings.
"""
try:
DeleteContainerIfExists(client, database_id, COLLECTION_ID)
database_link = GetDatabaseLink(database_id)
# collections = Query_Entities(client, 'collection', pa... | python | def UseRangeIndexesOnStrings(client, database_id):
try:
DeleteContainerIfExists(client, database_id, COLLECTION_ID)
database_link = GetDatabaseLink(database_id)
# collections = Query_Entities(client, 'collection', parent_link = database_link)
# print(collections)
# Use range... | [
"def",
"UseRangeIndexesOnStrings",
"(",
"client",
",",
"database_id",
")",
":",
"try",
":",
"DeleteContainerIfExists",
"(",
"client",
",",
"database_id",
",",
"COLLECTION_ID",
")",
"database_link",
"=",
"GetDatabaseLink",
"(",
"database_id",
")",
"# collections = Quer... | Showing how range queries can be performed even on strings. | [
"Showing",
"how",
"range",
"queries",
"can",
"be",
"performed",
"even",
"on",
"strings",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/samples/IndexManagement/Program.py#L428-L512 |
243,315 | Azure/azure-cosmos-python | azure/cosmos/range_partition_resolver.py | RangePartitionResolver.ResolveForCreate | def ResolveForCreate(self, document):
"""Resolves the collection for creating the document based on the partition key.
:param dict document:
The document to be created.
:return:
Collection Self link or Name based link which should handle the Create operation.
:r... | python | def ResolveForCreate(self, document):
if document is None:
raise ValueError("document is None.")
partition_key = self.partition_key_extractor(document)
containing_range = self._GetContainingRange(partition_key)
if containing_range is None:
raise ValueErr... | [
"def",
"ResolveForCreate",
"(",
"self",
",",
"document",
")",
":",
"if",
"document",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"document is None.\"",
")",
"partition_key",
"=",
"self",
".",
"partition_key_extractor",
"(",
"document",
")",
"containing_range"... | Resolves the collection for creating the document based on the partition key.
:param dict document:
The document to be created.
:return:
Collection Self link or Name based link which should handle the Create operation.
:rtype:
str | [
"Resolves",
"the",
"collection",
"for",
"creating",
"the",
"document",
"based",
"on",
"the",
"partition",
"key",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/range_partition_resolver.py#L46-L66 |
243,316 | Azure/azure-cosmos-python | azure/cosmos/range_partition_resolver.py | RangePartitionResolver._GetContainingRange | def _GetContainingRange(self, partition_key):
"""Gets the containing range based on the partition key.
"""
for keyrange in self.partition_map.keys():
if keyrange.Contains(partition_key):
return keyrange
return None | python | def _GetContainingRange(self, partition_key):
for keyrange in self.partition_map.keys():
if keyrange.Contains(partition_key):
return keyrange
return None | [
"def",
"_GetContainingRange",
"(",
"self",
",",
"partition_key",
")",
":",
"for",
"keyrange",
"in",
"self",
".",
"partition_map",
".",
"keys",
"(",
")",
":",
"if",
"keyrange",
".",
"Contains",
"(",
"partition_key",
")",
":",
"return",
"keyrange",
"return",
... | Gets the containing range based on the partition key. | [
"Gets",
"the",
"containing",
"range",
"based",
"on",
"the",
"partition",
"key",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/range_partition_resolver.py#L87-L94 |
243,317 | Azure/azure-cosmos-python | azure/cosmos/range_partition_resolver.py | RangePartitionResolver._GetIntersectingRanges | def _GetIntersectingRanges(self, partition_key):
"""Gets the intersecting ranges based on the partition key.
"""
partitionkey_ranges = set()
intersecting_ranges = set()
if partition_key is None:
return list(self.partition_map.keys())
if isinstance(partition_... | python | def _GetIntersectingRanges(self, partition_key):
partitionkey_ranges = set()
intersecting_ranges = set()
if partition_key is None:
return list(self.partition_map.keys())
if isinstance(partition_key, prange.Range):
partitionkey_ranges.add(partition_key)
e... | [
"def",
"_GetIntersectingRanges",
"(",
"self",
",",
"partition_key",
")",
":",
"partitionkey_ranges",
"=",
"set",
"(",
")",
"intersecting_ranges",
"=",
"set",
"(",
")",
"if",
"partition_key",
"is",
"None",
":",
"return",
"list",
"(",
"self",
".",
"partition_map... | Gets the intersecting ranges based on the partition key. | [
"Gets",
"the",
"intersecting",
"ranges",
"based",
"on",
"the",
"partition",
"key",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/range_partition_resolver.py#L96-L123 |
243,318 | Azure/azure-cosmos-python | azure/cosmos/query_iterable.py | QueryIterable._create_execution_context | def _create_execution_context(self):
"""instantiates the internal query execution context based.
"""
if hasattr(self, '_database_link'):
# client side partitioning query
return base_execution_context._MultiCollectionQueryExecutionContext(self._client, self._options, self.... | python | def _create_execution_context(self):
if hasattr(self, '_database_link'):
# client side partitioning query
return base_execution_context._MultiCollectionQueryExecutionContext(self._client, self._options, self._database_link, self._query, self._partition_key)
else:
#
... | [
"def",
"_create_execution_context",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'_database_link'",
")",
":",
"# client side partitioning query",
"return",
"base_execution_context",
".",
"_MultiCollectionQueryExecutionContext",
"(",
"self",
".",
"_client",
... | instantiates the internal query execution context based. | [
"instantiates",
"the",
"internal",
"query",
"execution",
"context",
"based",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/query_iterable.py#L87-L95 |
243,319 | Azure/azure-cosmos-python | azure/cosmos/retry_utility.py | _Execute | def _Execute(client, global_endpoint_manager, function, *args, **kwargs):
"""Exectutes the function with passed parameters applying all retry policies
:param object client:
Document client instance
:param object global_endpoint_manager:
Instance of _GlobalEndpointManager class
:param fu... | python | def _Execute(client, global_endpoint_manager, function, *args, **kwargs):
# instantiate all retry policies here to be applied for each request execution
endpointDiscovery_retry_policy = endpoint_discovery_retry_policy._EndpointDiscoveryRetryPolicy(client.connection_policy, global_endpoint_manager, *args)
r... | [
"def",
"_Execute",
"(",
"client",
",",
"global_endpoint_manager",
",",
"function",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# instantiate all retry policies here to be applied for each request execution",
"endpointDiscovery_retry_policy",
"=",
"endpoint_discovery... | Exectutes the function with passed parameters applying all retry policies
:param object client:
Document client instance
:param object global_endpoint_manager:
Instance of _GlobalEndpointManager class
:param function function:
Function to be called wrapped with retries
:param (n... | [
"Exectutes",
"the",
"function",
"with",
"passed",
"parameters",
"applying",
"all",
"retry",
"policies"
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/retry_utility.py#L34-L95 |
243,320 | Azure/azure-cosmos-python | azure/cosmos/global_endpoint_manager.py | _GlobalEndpointManager._GetDatabaseAccount | def _GetDatabaseAccount(self):
"""Gets the database account first by using the default endpoint, and if that doesn't returns
use the endpoints for the preferred locations in the order they are specified to get
the database account.
"""
try:
database_account = s... | python | def _GetDatabaseAccount(self):
try:
database_account = self._GetDatabaseAccountStub(self.DefaultEndpoint)
return database_account
# If for any reason(non-globaldb related), we are not able to get the database account from the above call to GetDatabaseAccount,
# we would t... | [
"def",
"_GetDatabaseAccount",
"(",
"self",
")",
":",
"try",
":",
"database_account",
"=",
"self",
".",
"_GetDatabaseAccountStub",
"(",
"self",
".",
"DefaultEndpoint",
")",
"return",
"database_account",
"# If for any reason(non-globaldb related), we are not able to get the dat... | Gets the database account first by using the default endpoint, and if that doesn't returns
use the endpoints for the preferred locations in the order they are specified to get
the database account. | [
"Gets",
"the",
"database",
"account",
"first",
"by",
"using",
"the",
"default",
"endpoint",
"and",
"if",
"that",
"doesn",
"t",
"returns",
"use",
"the",
"endpoints",
"for",
"the",
"preferred",
"locations",
"in",
"the",
"order",
"they",
"are",
"specified",
"to... | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/global_endpoint_manager.py#L104-L124 |
243,321 | Azure/azure-cosmos-python | azure/cosmos/partition.py | _Partition.CompareTo | def CompareTo(self, other_hash_value):
"""Compares the passed hash value with the hash value of this object
"""
if len(self.hash_value) != len(other_hash_value):
raise ValueError("Length of hashes doesn't match.")
# The hash byte array that is returned from ComputeHash metho... | python | def CompareTo(self, other_hash_value):
if len(self.hash_value) != len(other_hash_value):
raise ValueError("Length of hashes doesn't match.")
# The hash byte array that is returned from ComputeHash method has the MSB at the end of the array
# so comparing the bytes from the end for c... | [
"def",
"CompareTo",
"(",
"self",
",",
"other_hash_value",
")",
":",
"if",
"len",
"(",
"self",
".",
"hash_value",
")",
"!=",
"len",
"(",
"other_hash_value",
")",
":",
"raise",
"ValueError",
"(",
"\"Length of hashes doesn't match.\"",
")",
"# The hash byte array tha... | Compares the passed hash value with the hash value of this object | [
"Compares",
"the",
"passed",
"hash",
"value",
"with",
"the",
"hash",
"value",
"of",
"this",
"object"
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/partition.py#L48-L61 |
243,322 | Azure/azure-cosmos-python | azure/cosmos/murmur_hash.py | _MurmurHash.ComputeHash | def ComputeHash(self, key):
"""
Computes the hash of the value passed using MurmurHash3 algorithm.
:param bytearray key:
Byte array representing the key to be hashed.
:return:
32 bit hash value.
:rtype: int
"""
if key is None:
... | python | def ComputeHash(self, key):
if key is None:
raise ValueError("key is None.")
hash_value = self._ComputeHash(key)
return bytearray(pack('I', hash_value)) | [
"def",
"ComputeHash",
"(",
"self",
",",
"key",
")",
":",
"if",
"key",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"key is None.\"",
")",
"hash_value",
"=",
"self",
".",
"_ComputeHash",
"(",
"key",
")",
"return",
"bytearray",
"(",
"pack",
"(",
"'I'",... | Computes the hash of the value passed using MurmurHash3 algorithm.
:param bytearray key:
Byte array representing the key to be hashed.
:return:
32 bit hash value.
:rtype: int | [
"Computes",
"the",
"hash",
"of",
"the",
"value",
"passed",
"using",
"MurmurHash3",
"algorithm",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/murmur_hash.py#L49-L64 |
243,323 | Azure/azure-cosmos-python | azure/cosmos/murmur_hash.py | _MurmurHash._ComputeHash | def _ComputeHash( key, seed = 0x0 ):
"""Computes the hash of the value passed using MurmurHash3 algorithm with the seed value.
"""
def fmix( h ):
h ^= h >> 16
h = ( h * 0x85ebca6b ) & 0xFFFFFFFF
h ^= h >> 13
h = ( h * 0xc2b2ae35 ) & 0xFFFFFFFF
... | python | def _ComputeHash( key, seed = 0x0 ):
def fmix( h ):
h ^= h >> 16
h = ( h * 0x85ebca6b ) & 0xFFFFFFFF
h ^= h >> 13
h = ( h * 0xc2b2ae35 ) & 0xFFFFFFFF
h ^= h >> 16
return h
length = len( key )
nblocks = int( length / 4 )
... | [
"def",
"_ComputeHash",
"(",
"key",
",",
"seed",
"=",
"0x0",
")",
":",
"def",
"fmix",
"(",
"h",
")",
":",
"h",
"^=",
"h",
">>",
"16",
"h",
"=",
"(",
"h",
"*",
"0x85ebca6b",
")",
"&",
"0xFFFFFFFF",
"h",
"^=",
"h",
">>",
"13",
"h",
"=",
"(",
"... | Computes the hash of the value passed using MurmurHash3 algorithm with the seed value. | [
"Computes",
"the",
"hash",
"of",
"the",
"value",
"passed",
"using",
"MurmurHash3",
"algorithm",
"with",
"the",
"seed",
"value",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/murmur_hash.py#L67-L119 |
243,324 | Azure/azure-cosmos-python | azure/cosmos/vector_session_token.py | VectorSessionToken.create | def create(cls, session_token):
""" Parses session token and creates the vector session token
:param str session_token:
:return:
A Vector session Token
:rtype: VectorSessionToken
"""
version = None
global_lsn = None
local_lsn_by_region = {}... | python | def create(cls, session_token):
version = None
global_lsn = None
local_lsn_by_region = {}
if not session_token:
return None
segments = session_token.split(cls.segment_separator)
if len(segments) < 2:
return None
try:
... | [
"def",
"create",
"(",
"cls",
",",
"session_token",
")",
":",
"version",
"=",
"None",
"global_lsn",
"=",
"None",
"local_lsn_by_region",
"=",
"{",
"}",
"if",
"not",
"session_token",
":",
"return",
"None",
"segments",
"=",
"session_token",
".",
"split",
"(",
... | Parses session token and creates the vector session token
:param str session_token:
:return:
A Vector session Token
:rtype: VectorSessionToken | [
"Parses",
"session",
"token",
"and",
"creates",
"the",
"vector",
"session",
"token"
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/vector_session_token.py#L53-L99 |
243,325 | Azure/azure-cosmos-python | azure/cosmos/consistent_hash_ring.py | _ConsistentHashRing._ConstructPartitions | def _ConstructPartitions(self, collection_links, partitions_per_node):
"""Constructs the partitions in the consistent ring by assigning them to collection nodes
using the hashing algorithm and then finally sorting the partitions based on the hash value.
"""
collections_node_count = len(c... | python | def _ConstructPartitions(self, collection_links, partitions_per_node):
collections_node_count = len(collection_links)
partitions = [partition._Partition() for _ in xrange(0, partitions_per_node * collections_node_count)]
index = 0
for collection_node in collection_links:
has... | [
"def",
"_ConstructPartitions",
"(",
"self",
",",
"collection_links",
",",
"partitions_per_node",
")",
":",
"collections_node_count",
"=",
"len",
"(",
"collection_links",
")",
"partitions",
"=",
"[",
"partition",
".",
"_Partition",
"(",
")",
"for",
"_",
"in",
"xr... | Constructs the partitions in the consistent ring by assigning them to collection nodes
using the hashing algorithm and then finally sorting the partitions based on the hash value. | [
"Constructs",
"the",
"partitions",
"in",
"the",
"consistent",
"ring",
"by",
"assigning",
"them",
"to",
"collection",
"nodes",
"using",
"the",
"hashing",
"algorithm",
"and",
"then",
"finally",
"sorting",
"the",
"partitions",
"based",
"on",
"the",
"hash",
"value",... | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/consistent_hash_ring.py#L75-L91 |
243,326 | Azure/azure-cosmos-python | azure/cosmos/consistent_hash_ring.py | _ConsistentHashRing._FindPartition | def _FindPartition(self, key):
"""Finds the partition from the byte array representation of the partition key.
"""
hash_value = self.hash_generator.ComputeHash(key)
return self._LowerBoundSearch(self.partitions, hash_value) | python | def _FindPartition(self, key):
hash_value = self.hash_generator.ComputeHash(key)
return self._LowerBoundSearch(self.partitions, hash_value) | [
"def",
"_FindPartition",
"(",
"self",
",",
"key",
")",
":",
"hash_value",
"=",
"self",
".",
"hash_generator",
".",
"ComputeHash",
"(",
"key",
")",
"return",
"self",
".",
"_LowerBoundSearch",
"(",
"self",
".",
"partitions",
",",
"hash_value",
")"
] | Finds the partition from the byte array representation of the partition key. | [
"Finds",
"the",
"partition",
"from",
"the",
"byte",
"array",
"representation",
"of",
"the",
"partition",
"key",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/consistent_hash_ring.py#L93-L97 |
243,327 | Azure/azure-cosmos-python | azure/cosmos/consistent_hash_ring.py | _ConsistentHashRing._GetSerializedPartitionList | def _GetSerializedPartitionList(self):
"""Gets the serialized version of the ConsistentRing.
Added this helper for the test code.
"""
partition_list = list()
for part in self.partitions:
partition_list.append((part.node, unpack("<L", part.hash_value)[0]))
... | python | def _GetSerializedPartitionList(self):
partition_list = list()
for part in self.partitions:
partition_list.append((part.node, unpack("<L", part.hash_value)[0]))
return partition_list | [
"def",
"_GetSerializedPartitionList",
"(",
"self",
")",
":",
"partition_list",
"=",
"list",
"(",
")",
"for",
"part",
"in",
"self",
".",
"partitions",
":",
"partition_list",
".",
"append",
"(",
"(",
"part",
".",
"node",
",",
"unpack",
"(",
"\"<L\"",
",",
... | Gets the serialized version of the ConsistentRing.
Added this helper for the test code. | [
"Gets",
"the",
"serialized",
"version",
"of",
"the",
"ConsistentRing",
".",
"Added",
"this",
"helper",
"for",
"the",
"test",
"code",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/consistent_hash_ring.py#L99-L108 |
243,328 | Azure/azure-cosmos-python | azure/cosmos/consistent_hash_ring.py | _ConsistentHashRing._GetBytes | def _GetBytes(partition_key):
"""Gets the bytes representing the value of the partition key.
"""
if isinstance(partition_key, six.string_types):
return bytearray(partition_key, encoding='utf-8')
else:
raise ValueError("Unsupported " + str(type(partition_key)) + " ... | python | def _GetBytes(partition_key):
if isinstance(partition_key, six.string_types):
return bytearray(partition_key, encoding='utf-8')
else:
raise ValueError("Unsupported " + str(type(partition_key)) + " for partitionKey.") | [
"def",
"_GetBytes",
"(",
"partition_key",
")",
":",
"if",
"isinstance",
"(",
"partition_key",
",",
"six",
".",
"string_types",
")",
":",
"return",
"bytearray",
"(",
"partition_key",
",",
"encoding",
"=",
"'utf-8'",
")",
"else",
":",
"raise",
"ValueError",
"(... | Gets the bytes representing the value of the partition key. | [
"Gets",
"the",
"bytes",
"representing",
"the",
"value",
"of",
"the",
"partition",
"key",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/consistent_hash_ring.py#L111-L117 |
243,329 | Azure/azure-cosmos-python | azure/cosmos/consistent_hash_ring.py | _ConsistentHashRing._LowerBoundSearch | def _LowerBoundSearch(partitions, hash_value):
"""Searches the partition in the partition array using hashValue.
"""
for i in xrange(0, len(partitions) - 1):
if partitions[i].CompareTo(hash_value) <= 0 and partitions[i+1].CompareTo(hash_value) > 0:
return i
r... | python | def _LowerBoundSearch(partitions, hash_value):
for i in xrange(0, len(partitions) - 1):
if partitions[i].CompareTo(hash_value) <= 0 and partitions[i+1].CompareTo(hash_value) > 0:
return i
return len(partitions) - 1 | [
"def",
"_LowerBoundSearch",
"(",
"partitions",
",",
"hash_value",
")",
":",
"for",
"i",
"in",
"xrange",
"(",
"0",
",",
"len",
"(",
"partitions",
")",
"-",
"1",
")",
":",
"if",
"partitions",
"[",
"i",
"]",
".",
"CompareTo",
"(",
"hash_value",
")",
"<=... | Searches the partition in the partition array using hashValue. | [
"Searches",
"the",
"partition",
"in",
"the",
"partition",
"array",
"using",
"hashValue",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/consistent_hash_ring.py#L120-L127 |
243,330 | Azure/azure-cosmos-python | azure/cosmos/execution_context/base_execution_context.py | _QueryExecutionContextBase._fetch_items_helper_no_retries | def _fetch_items_helper_no_retries(self, fetch_function):
"""Fetches more items and doesn't retry on failure
:return:
List of fetched items.
:rtype: list
"""
fetched_items = []
# Continues pages till finds a non empty page or all results are exhausted
... | python | def _fetch_items_helper_no_retries(self, fetch_function):
fetched_items = []
# Continues pages till finds a non empty page or all results are exhausted
while self._continuation or not self._has_started:
if not self._has_started:
self._has_started = True
s... | [
"def",
"_fetch_items_helper_no_retries",
"(",
"self",
",",
"fetch_function",
")",
":",
"fetched_items",
"=",
"[",
"]",
"# Continues pages till finds a non empty page or all results are exhausted",
"while",
"self",
".",
"_continuation",
"or",
"not",
"self",
".",
"_has_starte... | Fetches more items and doesn't retry on failure
:return:
List of fetched items.
:rtype: list | [
"Fetches",
"more",
"items",
"and",
"doesn",
"t",
"retry",
"on",
"failure"
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/execution_context/base_execution_context.py#L110-L137 |
243,331 | Azure/azure-cosmos-python | azure/cosmos/execution_context/base_execution_context.py | _MultiCollectionQueryExecutionContext._fetch_next_block | def _fetch_next_block(self):
"""Fetches the next block of query results.
This iterates fetches the next block of results from the current collection link.
Once the current collection results were exhausted. It moves to the next collection link.
:return:
List of ... | python | def _fetch_next_block(self):
# Fetch next block of results by executing the query against the current document collection
fetched_items = self._fetch_items_helper_with_retries(self._fetch_function)
# If there are multiple document collections to query for(in case of partitioning), keep loop... | [
"def",
"_fetch_next_block",
"(",
"self",
")",
":",
"# Fetch next block of results by executing the query against the current document collection",
"fetched_items",
"=",
"self",
".",
"_fetch_items_helper_with_retries",
"(",
"self",
".",
"_fetch_function",
")",
"# If there are multip... | Fetches the next block of query results.
This iterates fetches the next block of results from the current collection link.
Once the current collection results were exhausted. It moves to the next collection link.
:return:
List of fetched items.
:rtype: list | [
"Fetches",
"the",
"next",
"block",
"of",
"query",
"results",
".",
"This",
"iterates",
"fetches",
"the",
"next",
"block",
"of",
"results",
"from",
"the",
"current",
"collection",
"link",
".",
"Once",
"the",
"current",
"collection",
"results",
"were",
"exhausted... | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/execution_context/base_execution_context.py#L227-L263 |
243,332 | Azure/azure-cosmos-python | azure/cosmos/range.py | Range.Contains | def Contains(self, other):
"""Checks if the passed parameter is in the range of this object.
"""
if other is None:
raise ValueError("other is None.")
if isinstance(other, Range):
if other.low >= self.low and other.high <= self.high:
return True
... | python | def Contains(self, other):
if other is None:
raise ValueError("other is None.")
if isinstance(other, Range):
if other.low >= self.low and other.high <= self.high:
return True
return False
else:
return self.Contains(Range(other, oth... | [
"def",
"Contains",
"(",
"self",
",",
"other",
")",
":",
"if",
"other",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"other is None.\"",
")",
"if",
"isinstance",
"(",
"other",
",",
"Range",
")",
":",
"if",
"other",
".",
"low",
">=",
"self",
".",
"... | Checks if the passed parameter is in the range of this object. | [
"Checks",
"if",
"the",
"passed",
"parameter",
"is",
"in",
"the",
"range",
"of",
"this",
"object",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/range.py#L57-L68 |
243,333 | Azure/azure-cosmos-python | azure/cosmos/range.py | Range.Intersect | def Intersect(self, other):
"""Checks if the passed parameter intersects the range of this object.
"""
if isinstance(other, Range):
max_low = self.low if (self.low >= other.low) else other.low
min_high = self.high if (self.high <= other.high) else other.high
... | python | def Intersect(self, other):
if isinstance(other, Range):
max_low = self.low if (self.low >= other.low) else other.low
min_high = self.high if (self.high <= other.high) else other.high
if max_low <= min_high:
return True
return False | [
"def",
"Intersect",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"Range",
")",
":",
"max_low",
"=",
"self",
".",
"low",
"if",
"(",
"self",
".",
"low",
">=",
"other",
".",
"low",
")",
"else",
"other",
".",
"low",
"mi... | Checks if the passed parameter intersects the range of this object. | [
"Checks",
"if",
"the",
"passed",
"parameter",
"intersects",
"the",
"range",
"of",
"this",
"object",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/range.py#L70-L80 |
243,334 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.RegisterPartitionResolver | def RegisterPartitionResolver(self, database_link, partition_resolver):
"""Registers the partition resolver associated with the database link
:param str database_link:
Database Self Link or ID based link.
:param object partition_resolver:
An instance of PartitionResolver... | python | def RegisterPartitionResolver(self, database_link, partition_resolver):
if not database_link:
raise ValueError("database_link is None or empty.")
if partition_resolver is None:
raise ValueError("partition_resolver is None.")
self.partition_resolvers = {base.TrimBeginnin... | [
"def",
"RegisterPartitionResolver",
"(",
"self",
",",
"database_link",
",",
"partition_resolver",
")",
":",
"if",
"not",
"database_link",
":",
"raise",
"ValueError",
"(",
"\"database_link is None or empty.\"",
")",
"if",
"partition_resolver",
"is",
"None",
":",
"raise... | Registers the partition resolver associated with the database link
:param str database_link:
Database Self Link or ID based link.
:param object partition_resolver:
An instance of PartitionResolver. | [
"Registers",
"the",
"partition",
"resolver",
"associated",
"with",
"the",
"database",
"link"
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L180-L195 |
243,335 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.GetPartitionResolver | def GetPartitionResolver(self, database_link):
"""Gets the partition resolver associated with the database link
:param str database_link:
Database self link or ID based link.
:return:
An instance of PartitionResolver.
:rtype: object
"""
if not d... | python | def GetPartitionResolver(self, database_link):
if not database_link:
raise ValueError("database_link is None or empty.")
return self.partition_resolvers.get(base.TrimBeginningAndEndingSlashes(database_link)) | [
"def",
"GetPartitionResolver",
"(",
"self",
",",
"database_link",
")",
":",
"if",
"not",
"database_link",
":",
"raise",
"ValueError",
"(",
"\"database_link is None or empty.\"",
")",
"return",
"self",
".",
"partition_resolvers",
".",
"get",
"(",
"base",
".",
"Trim... | Gets the partition resolver associated with the database link
:param str database_link:
Database self link or ID based link.
:return:
An instance of PartitionResolver.
:rtype: object | [
"Gets",
"the",
"partition",
"resolver",
"associated",
"with",
"the",
"database",
"link"
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L198-L212 |
243,336 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.CreateDatabase | def CreateDatabase(self, database, options=None):
"""Creates a database.
:param dict database:
The Azure Cosmos database to create.
:param dict options:
The request options for the request.
:return:
The Database that was created.
:rtype: dict... | python | def CreateDatabase(self, database, options=None):
if options is None:
options = {}
CosmosClient.__ValidateResource(database)
path = '/dbs'
return self.Create(database, path, 'dbs', None, None, options) | [
"def",
"CreateDatabase",
"(",
"self",
",",
"database",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"CosmosClient",
".",
"__ValidateResource",
"(",
"database",
")",
"path",
"=",
"'/dbs'",
"return",
... | Creates a database.
:param dict database:
The Azure Cosmos database to create.
:param dict options:
The request options for the request.
:return:
The Database that was created.
:rtype: dict | [
"Creates",
"a",
"database",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L215-L233 |
243,337 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReadDatabase | def ReadDatabase(self, database_link, options=None):
"""Reads a database.
:param str database_link:
The link to the database.
:param dict options:
The request options for the request.
:return:
The Database that was read.
:rtype: dict
... | python | def ReadDatabase(self, database_link, options=None):
if options is None:
options = {}
path = base.GetPathFromLink(database_link)
database_id = base.GetResourceIdOrFullNameFromLink(database_link)
return self.Read(path, 'dbs', database_id, None, options) | [
"def",
"ReadDatabase",
"(",
"self",
",",
"database_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"database_link",
")",
"database_id",
"=",
"ba... | Reads a database.
:param str database_link:
The link to the database.
:param dict options:
The request options for the request.
:return:
The Database that was read.
:rtype: dict | [
"Reads",
"a",
"database",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L235-L253 |
243,338 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.QueryDatabases | def QueryDatabases(self, query, options=None):
"""Queries databases.
:param (str or dict) query:
:param dict options:
The request options for the request.
:return: Query Iterable of Databases.
:rtype:
query_iterable.QueryIterable
"""
if ... | python | def QueryDatabases(self, query, options=None):
if options is None:
options = {}
def fetch_fn(options):
return self.__QueryFeed('/dbs',
'dbs',
'',
lambda r: r['Databases'],... | [
"def",
"QueryDatabases",
"(",
"self",
",",
"query",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"def",
"fetch_fn",
"(",
"options",
")",
":",
"return",
"self",
".",
"__QueryFeed",
"(",
"'/dbs'",
... | Queries databases.
:param (str or dict) query:
:param dict options:
The request options for the request.
:return: Query Iterable of Databases.
:rtype:
query_iterable.QueryIterable | [
"Queries",
"databases",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L272-L295 |
243,339 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReadContainers | def ReadContainers(self, database_link, options=None):
"""Reads all collections in a database.
:param str database_link:
The link to the database.
:param dict options:
The request options for the request.
:return: Query Iterable of Collections.
... | python | def ReadContainers(self, database_link, options=None):
if options is None:
options = {}
return self.QueryContainers(database_link, None, options) | [
"def",
"ReadContainers",
"(",
"self",
",",
"database_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"return",
"self",
".",
"QueryContainers",
"(",
"database_link",
",",
"None",
",",
"options",
... | Reads all collections in a database.
:param str database_link:
The link to the database.
:param dict options:
The request options for the request.
:return: Query Iterable of Collections.
:rtype:
query_iterable.QueryIterable | [
"Reads",
"all",
"collections",
"in",
"a",
"database",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L297-L313 |
243,340 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.CreateContainer | def CreateContainer(self, database_link, collection, options=None):
"""Creates a collection in a database.
:param str database_link:
The link to the database.
:param dict collection:
The Azure Cosmos collection to create.
:param dict options:
The requ... | python | def CreateContainer(self, database_link, collection, options=None):
if options is None:
options = {}
CosmosClient.__ValidateResource(collection)
path = base.GetPathFromLink(database_link, 'colls')
database_id = base.GetResourceIdOrFullNameFromLink(database_link)
retu... | [
"def",
"CreateContainer",
"(",
"self",
",",
"database_link",
",",
"collection",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"CosmosClient",
".",
"__ValidateResource",
"(",
"collection",
")",
"path",
... | Creates a collection in a database.
:param str database_link:
The link to the database.
:param dict collection:
The Azure Cosmos collection to create.
:param dict options:
The request options for the request.
:return: The Collection that was created.... | [
"Creates",
"a",
"collection",
"in",
"a",
"database",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L344-L369 |
243,341 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReplaceContainer | def ReplaceContainer(self, collection_link, collection, options=None):
"""Replaces a collection and return it.
:param str collection_link:
The link to the collection entity.
:param dict collection:
The collection to be used.
:param dict options:
The ... | python | def ReplaceContainer(self, collection_link, collection, options=None):
if options is None:
options = {}
CosmosClient.__ValidateResource(collection)
path = base.GetPathFromLink(collection_link)
collection_id = base.GetResourceIdOrFullNameFromLink(collection_link)
retu... | [
"def",
"ReplaceContainer",
"(",
"self",
",",
"collection_link",
",",
"collection",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"CosmosClient",
".",
"__ValidateResource",
"(",
"collection",
")",
"path",... | Replaces a collection and return it.
:param str collection_link:
The link to the collection entity.
:param dict collection:
The collection to be used.
:param dict options:
The request options for the request.
:return:
The new Collection.... | [
"Replaces",
"a",
"collection",
"and",
"return",
"it",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L371-L398 |
243,342 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReadContainer | def ReadContainer(self, collection_link, options=None):
"""Reads a collection.
:param str collection_link:
The link to the document collection.
:param dict options:
The request options for the request.
:return:
The read Collection.
:rtype:
... | python | def ReadContainer(self, collection_link, options=None):
if options is None:
options = {}
path = base.GetPathFromLink(collection_link)
collection_id = base.GetResourceIdOrFullNameFromLink(collection_link)
return self.Read(path,
'colls',
... | [
"def",
"ReadContainer",
"(",
"self",
",",
"collection_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"collection_link",
")",
"collection_id",
"="... | Reads a collection.
:param str collection_link:
The link to the document collection.
:param dict options:
The request options for the request.
:return:
The read Collection.
:rtype:
dict | [
"Reads",
"a",
"collection",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L400-L423 |
243,343 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.UpsertUser | def UpsertUser(self, database_link, user, options=None):
"""Upserts a user.
:param str database_link:
The link to the database.
:param dict user:
The Azure Cosmos user to upsert.
:param dict options:
The request options for the request.
:retu... | python | def UpsertUser(self, database_link, user, options=None):
if options is None:
options = {}
database_id, path = self._GetDatabaseIdWithPathForUser(database_link, user)
return self.Upsert(user,
path,
'users',
... | [
"def",
"UpsertUser",
"(",
"self",
",",
"database_link",
",",
"user",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"database_id",
",",
"path",
"=",
"self",
".",
"_GetDatabaseIdWithPathForUser",
"(",
... | Upserts a user.
:param str database_link:
The link to the database.
:param dict user:
The Azure Cosmos user to upsert.
:param dict options:
The request options for the request.
:return:
The upserted User.
:rtype: dict | [
"Upserts",
"a",
"user",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L452-L475 |
243,344 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReadUser | def ReadUser(self, user_link, options=None):
"""Reads a user.
:param str user_link:
The link to the user entity.
:param dict options:
The request options for the request.
:return:
The read User.
:rtype:
dict
"""
i... | python | def ReadUser(self, user_link, options=None):
if options is None:
options = {}
path = base.GetPathFromLink(user_link)
user_id = base.GetResourceIdOrFullNameFromLink(user_link)
return self.Read(path, 'users', user_id, None, options) | [
"def",
"ReadUser",
"(",
"self",
",",
"user_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"user_link",
")",
"user_id",
"=",
"base",
".",
"G... | Reads a user.
:param str user_link:
The link to the user entity.
:param dict options:
The request options for the request.
:return:
The read User.
:rtype:
dict | [
"Reads",
"a",
"user",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L484-L503 |
243,345 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReadUsers | def ReadUsers(self, database_link, options=None):
"""Reads all users in a database.
:params str database_link:
The link to the database.
:params dict options:
The request options for the request.
:return:
Query iterable of Users.
:rtype:
... | python | def ReadUsers(self, database_link, options=None):
if options is None:
options = {}
return self.QueryUsers(database_link, None, options) | [
"def",
"ReadUsers",
"(",
"self",
",",
"database_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"return",
"self",
".",
"QueryUsers",
"(",
"database_link",
",",
"None",
",",
"options",
")"
] | Reads all users in a database.
:params str database_link:
The link to the database.
:params dict options:
The request options for the request.
:return:
Query iterable of Users.
:rtype:
query_iterable.QueryIterable | [
"Reads",
"all",
"users",
"in",
"a",
"database",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L505-L521 |
243,346 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.QueryUsers | def QueryUsers(self, database_link, query, options=None):
"""Queries users in a database.
:param str database_link:
The link to the database.
:param (str or dict) query:
:param dict options:
The request options for the request.
:return:
Query... | python | def QueryUsers(self, database_link, query, options=None):
if options is None:
options = {}
path = base.GetPathFromLink(database_link, 'users')
database_id = base.GetResourceIdOrFullNameFromLink(database_link)
def fetch_fn(options):
return self.__QueryFeed(path,
... | [
"def",
"QueryUsers",
"(",
"self",
",",
"database_link",
",",
"query",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"database_link",
",",
"'users'",
... | Queries users in a database.
:param str database_link:
The link to the database.
:param (str or dict) query:
:param dict options:
The request options for the request.
:return:
Query Iterable of Users.
:rtype:
query_iterable.Que... | [
"Queries",
"users",
"in",
"a",
"database",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L523-L551 |
243,347 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.DeleteDatabase | def DeleteDatabase(self, database_link, options=None):
"""Deletes a database.
:param str database_link:
The link to the database.
:param dict options:
The request options for the request.
:return:
The deleted Database.
:rtype:
dic... | python | def DeleteDatabase(self, database_link, options=None):
if options is None:
options = {}
path = base.GetPathFromLink(database_link)
database_id = base.GetResourceIdOrFullNameFromLink(database_link)
return self.DeleteResource(path,
'dbs',
... | [
"def",
"DeleteDatabase",
"(",
"self",
",",
"database_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"database_link",
")",
"database_id",
"=",
"... | Deletes a database.
:param str database_link:
The link to the database.
:param dict options:
The request options for the request.
:return:
The deleted Database.
:rtype:
dict | [
"Deletes",
"a",
"database",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L553-L576 |
243,348 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.CreatePermission | def CreatePermission(self, user_link, permission, options=None):
"""Creates a permission for a user.
:param str user_link:
The link to the user entity.
:param dict permission:
The Azure Cosmos user permission to create.
:param dict options:
The reques... | python | def CreatePermission(self, user_link, permission, options=None):
if options is None:
options = {}
path, user_id = self._GetUserIdWithPathForPermission(permission, user_link)
return self.Create(permission,
path,
'permissions',
... | [
"def",
"CreatePermission",
"(",
"self",
",",
"user_link",
",",
"permission",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"path",
",",
"user_id",
"=",
"self",
".",
"_GetUserIdWithPathForPermission",
"... | Creates a permission for a user.
:param str user_link:
The link to the user entity.
:param dict permission:
The Azure Cosmos user permission to create.
:param dict options:
The request options for the request.
:return:
The created Permiss... | [
"Creates",
"a",
"permission",
"for",
"a",
"user",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L578-L603 |
243,349 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.UpsertPermission | def UpsertPermission(self, user_link, permission, options=None):
"""Upserts a permission for a user.
:param str user_link:
The link to the user entity.
:param dict permission:
The Azure Cosmos user permission to upsert.
:param dict options:
The reques... | python | def UpsertPermission(self, user_link, permission, options=None):
if options is None:
options = {}
path, user_id = self._GetUserIdWithPathForPermission(permission, user_link)
return self.Upsert(permission,
path,
'permissions',
... | [
"def",
"UpsertPermission",
"(",
"self",
",",
"user_link",
",",
"permission",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"path",
",",
"user_id",
"=",
"self",
".",
"_GetUserIdWithPathForPermission",
"... | Upserts a permission for a user.
:param str user_link:
The link to the user entity.
:param dict permission:
The Azure Cosmos user permission to upsert.
:param dict options:
The request options for the request.
:return:
The upserted permis... | [
"Upserts",
"a",
"permission",
"for",
"a",
"user",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L605-L630 |
243,350 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReadPermission | def ReadPermission(self, permission_link, options=None):
"""Reads a permission.
:param str permission_link:
The link to the permission.
:param dict options:
The request options for the request.
:return:
The read permission.
:rtype:
... | python | def ReadPermission(self, permission_link, options=None):
if options is None:
options = {}
path = base.GetPathFromLink(permission_link)
permission_id = base.GetResourceIdOrFullNameFromLink(permission_link)
return self.Read(path,
'permissions',
... | [
"def",
"ReadPermission",
"(",
"self",
",",
"permission_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"permission_link",
")",
"permission_id",
"=... | Reads a permission.
:param str permission_link:
The link to the permission.
:param dict options:
The request options for the request.
:return:
The read permission.
:rtype:
dict | [
"Reads",
"a",
"permission",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L639-L662 |
243,351 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReadPermissions | def ReadPermissions(self, user_link, options=None):
"""Reads all permissions for a user.
:param str user_link:
The link to the user entity.
:param dict options:
The request options for the request.
:return:
Query Iterable of Permissions.
:rty... | python | def ReadPermissions(self, user_link, options=None):
if options is None:
options = {}
return self.QueryPermissions(user_link, None, options) | [
"def",
"ReadPermissions",
"(",
"self",
",",
"user_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"return",
"self",
".",
"QueryPermissions",
"(",
"user_link",
",",
"None",
",",
"options",
")"
] | Reads all permissions for a user.
:param str user_link:
The link to the user entity.
:param dict options:
The request options for the request.
:return:
Query Iterable of Permissions.
:rtype:
query_iterable.QueryIterable | [
"Reads",
"all",
"permissions",
"for",
"a",
"user",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L664-L681 |
243,352 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.QueryPermissions | def QueryPermissions(self, user_link, query, options=None):
"""Queries permissions for a user.
:param str user_link:
The link to the user entity.
:param (str or dict) query:
:param dict options:
The request options for the request.
:return:
Q... | python | def QueryPermissions(self, user_link, query, options=None):
if options is None:
options = {}
path = base.GetPathFromLink(user_link, 'permissions')
user_id = base.GetResourceIdOrFullNameFromLink(user_link)
def fetch_fn(options):
return self.__QueryFeed(path,
... | [
"def",
"QueryPermissions",
"(",
"self",
",",
"user_link",
",",
"query",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"user_link",
",",
"'permissions... | Queries permissions for a user.
:param str user_link:
The link to the user entity.
:param (str or dict) query:
:param dict options:
The request options for the request.
:return:
Query Iterable of Permissions.
:rtype:
query_iterabl... | [
"Queries",
"permissions",
"for",
"a",
"user",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L683-L711 |
243,353 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReplaceUser | def ReplaceUser(self, user_link, user, options=None):
"""Replaces a user and return it.
:param str user_link:
The link to the user entity.
:param dict user:
:param dict options:
The request options for the request.
:return:
The new User.
... | python | def ReplaceUser(self, user_link, user, options=None):
if options is None:
options = {}
CosmosClient.__ValidateResource(user)
path = base.GetPathFromLink(user_link)
user_id = base.GetResourceIdOrFullNameFromLink(user_link)
return self.Replace(user,
... | [
"def",
"ReplaceUser",
"(",
"self",
",",
"user_link",
",",
"user",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"CosmosClient",
".",
"__ValidateResource",
"(",
"user",
")",
"path",
"=",
"base",
"."... | Replaces a user and return it.
:param str user_link:
The link to the user entity.
:param dict user:
:param dict options:
The request options for the request.
:return:
The new User.
:rtype:
dict | [
"Replaces",
"a",
"user",
"and",
"return",
"it",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L713-L739 |
243,354 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.DeleteUser | def DeleteUser(self, user_link, options=None):
"""Deletes a user.
:param str user_link:
The link to the user entity.
:param dict options:
The request options for the request.
:return:
The deleted user.
:rtype:
dict
"""
... | python | def DeleteUser(self, user_link, options=None):
if options is None:
options = {}
path = base.GetPathFromLink(user_link)
user_id = base.GetResourceIdOrFullNameFromLink(user_link)
return self.DeleteResource(path,
'users',
... | [
"def",
"DeleteUser",
"(",
"self",
",",
"user_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"user_link",
")",
"user_id",
"=",
"base",
".",
... | Deletes a user.
:param str user_link:
The link to the user entity.
:param dict options:
The request options for the request.
:return:
The deleted user.
:rtype:
dict | [
"Deletes",
"a",
"user",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L741-L764 |
243,355 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReplacePermission | def ReplacePermission(self, permission_link, permission, options=None):
"""Replaces a permission and return it.
:param str permission_link:
The link to the permission.
:param dict permission:
:param dict options:
The request options for the request.
:ret... | python | def ReplacePermission(self, permission_link, permission, options=None):
if options is None:
options = {}
CosmosClient.__ValidateResource(permission)
path = base.GetPathFromLink(permission_link)
permission_id = base.GetResourceIdOrFullNameFromLink(permission_link)
ret... | [
"def",
"ReplacePermission",
"(",
"self",
",",
"permission_link",
",",
"permission",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"CosmosClient",
".",
"__ValidateResource",
"(",
"permission",
")",
"path"... | Replaces a permission and return it.
:param str permission_link:
The link to the permission.
:param dict permission:
:param dict options:
The request options for the request.
:return:
The new Permission.
:rtype:
dict | [
"Replaces",
"a",
"permission",
"and",
"return",
"it",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L766-L792 |
243,356 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.DeletePermission | def DeletePermission(self, permission_link, options=None):
"""Deletes a permission.
:param str permission_link:
The link to the permission.
:param dict options:
The request options for the request.
:return:
The deleted Permission.
:rtype:
... | python | def DeletePermission(self, permission_link, options=None):
if options is None:
options = {}
path = base.GetPathFromLink(permission_link)
permission_id = base.GetResourceIdOrFullNameFromLink(permission_link)
return self.DeleteResource(path,
... | [
"def",
"DeletePermission",
"(",
"self",
",",
"permission_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"permission_link",
")",
"permission_id",
... | Deletes a permission.
:param str permission_link:
The link to the permission.
:param dict options:
The request options for the request.
:return:
The deleted Permission.
:rtype:
dict | [
"Deletes",
"a",
"permission",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L794-L817 |
243,357 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReadItems | def ReadItems(self, collection_link, feed_options=None):
"""Reads all documents in a collection.
:param str collection_link:
The link to the document collection.
:param dict feed_options:
:return:
Query Iterable of Documents.
:rtype:
query_it... | python | def ReadItems(self, collection_link, feed_options=None):
if feed_options is None:
feed_options = {}
return self.QueryItems(collection_link, None, feed_options) | [
"def",
"ReadItems",
"(",
"self",
",",
"collection_link",
",",
"feed_options",
"=",
"None",
")",
":",
"if",
"feed_options",
"is",
"None",
":",
"feed_options",
"=",
"{",
"}",
"return",
"self",
".",
"QueryItems",
"(",
"collection_link",
",",
"None",
",",
"fee... | Reads all documents in a collection.
:param str collection_link:
The link to the document collection.
:param dict feed_options:
:return:
Query Iterable of Documents.
:rtype:
query_iterable.QueryIterable | [
"Reads",
"all",
"documents",
"in",
"a",
"collection",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L819-L835 |
243,358 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.QueryItems | def QueryItems(self, database_or_Container_link, query, options=None, partition_key=None):
"""Queries documents in a collection.
:param str database_or_Container_link:
The link to the database when using partitioning, otherwise link to the document collection.
:param (str or dict) q... | python | def QueryItems(self, database_or_Container_link, query, options=None, partition_key=None):
database_or_Container_link = base.TrimBeginningAndEndingSlashes(database_or_Container_link)
if options is None:
options = {}
if(base.IsDatabaseLink(database_or_Container_link)):
#... | [
"def",
"QueryItems",
"(",
"self",
",",
"database_or_Container_link",
",",
"query",
",",
"options",
"=",
"None",
",",
"partition_key",
"=",
"None",
")",
":",
"database_or_Container_link",
"=",
"base",
".",
"TrimBeginningAndEndingSlashes",
"(",
"database_or_Container_li... | Queries documents in a collection.
:param str database_or_Container_link:
The link to the database when using partitioning, otherwise link to the document collection.
:param (str or dict) query:
:param dict options:
The request options for the request.
:param str... | [
"Queries",
"documents",
"in",
"a",
"collection",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L837-L873 |
243,359 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.QueryItemsChangeFeed | def QueryItemsChangeFeed(self, collection_link, options=None):
"""Queries documents change feed in a collection.
:param str collection_link:
The link to the document collection.
:param dict options:
The request options for the request.
options may also specif... | python | def QueryItemsChangeFeed(self, collection_link, options=None):
partition_key_range_id = None
if options is not None and 'partitionKeyRangeId' in options:
partition_key_range_id = options['partitionKeyRangeId']
return self._QueryChangeFeed(collection_link, "Documents" , options, part... | [
"def",
"QueryItemsChangeFeed",
"(",
"self",
",",
"collection_link",
",",
"options",
"=",
"None",
")",
":",
"partition_key_range_id",
"=",
"None",
"if",
"options",
"is",
"not",
"None",
"and",
"'partitionKeyRangeId'",
"in",
"options",
":",
"partition_key_range_id",
... | Queries documents change feed in a collection.
:param str collection_link:
The link to the document collection.
:param dict options:
The request options for the request.
options may also specify partition key range id.
:return:
Query Iterable of ... | [
"Queries",
"documents",
"change",
"feed",
"in",
"a",
"collection",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L875-L895 |
243,360 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient._QueryChangeFeed | def _QueryChangeFeed(self, collection_link, resource_type, options=None, partition_key_range_id=None):
"""Queries change feed of a resource in a collection.
:param str collection_link:
The link to the document collection.
:param str resource_type:
The type of the resourc... | python | def _QueryChangeFeed(self, collection_link, resource_type, options=None, partition_key_range_id=None):
if options is None:
options = {}
options['changeFeed'] = True
resource_key_map = {'Documents' : 'docs'}
# For now, change feed only supports Documents and Partition Key Ra... | [
"def",
"_QueryChangeFeed",
"(",
"self",
",",
"collection_link",
",",
"resource_type",
",",
"options",
"=",
"None",
",",
"partition_key_range_id",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"options",
"[",
"'changeFee... | Queries change feed of a resource in a collection.
:param str collection_link:
The link to the document collection.
:param str resource_type:
The type of the resource.
:param dict options:
The request options for the request.
:param str partition_key_... | [
"Queries",
"change",
"feed",
"of",
"a",
"resource",
"in",
"a",
"collection",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L897-L937 |
243,361 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient._ReadPartitionKeyRanges | def _ReadPartitionKeyRanges(self, collection_link, feed_options=None):
"""Reads Partition Key Ranges.
:param str collection_link:
The link to the document collection.
:param dict feed_options:
:return:
Query Iterable of PartitionKeyRanges.
:rtype:
... | python | def _ReadPartitionKeyRanges(self, collection_link, feed_options=None):
if feed_options is None:
feed_options = {}
return self._QueryPartitionKeyRanges(collection_link, None, feed_options) | [
"def",
"_ReadPartitionKeyRanges",
"(",
"self",
",",
"collection_link",
",",
"feed_options",
"=",
"None",
")",
":",
"if",
"feed_options",
"is",
"None",
":",
"feed_options",
"=",
"{",
"}",
"return",
"self",
".",
"_QueryPartitionKeyRanges",
"(",
"collection_link",
... | Reads Partition Key Ranges.
:param str collection_link:
The link to the document collection.
:param dict feed_options:
:return:
Query Iterable of PartitionKeyRanges.
:rtype:
query_iterable.QueryIterable | [
"Reads",
"Partition",
"Key",
"Ranges",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L939-L955 |
243,362 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.CreateItem | def CreateItem(self, database_or_Container_link, document, options=None):
"""Creates a document in a collection.
:param str database_or_Container_link:
The link to the database when using partitioning, otherwise link to the document collection.
:param dict document:
The ... | python | def CreateItem(self, database_or_Container_link, document, options=None):
# Python's default arguments are evaluated once when the function is defined, not each time the function is called (like it is in say, Ruby).
# This means that if you use a mutable default argument and mutate it, you will and hav... | [
"def",
"CreateItem",
"(",
"self",
",",
"database_or_Container_link",
",",
"document",
",",
"options",
"=",
"None",
")",
":",
"# Python's default arguments are evaluated once when the function is defined, not each time the function is called (like it is in say, Ruby). ",
"# This means t... | Creates a document in a collection.
:param str database_or_Container_link:
The link to the database when using partitioning, otherwise link to the document collection.
:param dict document:
The Azure Cosmos document to create.
:param dict options:
The request... | [
"Creates",
"a",
"document",
"in",
"a",
"collection",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L987-L1023 |
243,363 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.UpsertItem | def UpsertItem(self, database_or_Container_link, document, options=None):
"""Upserts a document in a collection.
:param str database_or_Container_link:
The link to the database when using partitioning, otherwise link to the document collection.
:param dict document:
The ... | python | def UpsertItem(self, database_or_Container_link, document, options=None):
# Python's default arguments are evaluated once when the function is defined, not each time the function is called (like it is in say, Ruby).
# This means that if you use a mutable default argument and mutate it, you will and hav... | [
"def",
"UpsertItem",
"(",
"self",
",",
"database_or_Container_link",
",",
"document",
",",
"options",
"=",
"None",
")",
":",
"# Python's default arguments are evaluated once when the function is defined, not each time the function is called (like it is in say, Ruby). ",
"# This means t... | Upserts a document in a collection.
:param str database_or_Container_link:
The link to the database when using partitioning, otherwise link to the document collection.
:param dict document:
The Azure Cosmos document to upsert.
:param dict options:
The request... | [
"Upserts",
"a",
"document",
"in",
"a",
"collection",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1025-L1061 |
243,364 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReadItem | def ReadItem(self, document_link, options=None):
"""Reads a document.
:param str document_link:
The link to the document.
:param dict options:
The request options for the request.
:return:
The read Document.
:rtype:
dict
... | python | def ReadItem(self, document_link, options=None):
if options is None:
options = {}
path = base.GetPathFromLink(document_link)
document_id = base.GetResourceIdOrFullNameFromLink(document_link)
return self.Read(path,
'docs',
doc... | [
"def",
"ReadItem",
"(",
"self",
",",
"document_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"document_link",
")",
"document_id",
"=",
"base",... | Reads a document.
:param str document_link:
The link to the document.
:param dict options:
The request options for the request.
:return:
The read Document.
:rtype:
dict | [
"Reads",
"a",
"document",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1094-L1117 |
243,365 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReadTriggers | def ReadTriggers(self, collection_link, options=None):
"""Reads all triggers in a collection.
:param str collection_link:
The link to the document collection.
:param dict options:
The request options for the request.
:return:
Query Iterable of Trigge... | python | def ReadTriggers(self, collection_link, options=None):
if options is None:
options = {}
return self.QueryTriggers(collection_link, None, options) | [
"def",
"ReadTriggers",
"(",
"self",
",",
"collection_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"return",
"self",
".",
"QueryTriggers",
"(",
"collection_link",
",",
"None",
",",
"options",
... | Reads all triggers in a collection.
:param str collection_link:
The link to the document collection.
:param dict options:
The request options for the request.
:return:
Query Iterable of Triggers.
:rtype:
query_iterable.QueryIterable | [
"Reads",
"all",
"triggers",
"in",
"a",
"collection",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1119-L1136 |
243,366 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.CreateTrigger | def CreateTrigger(self, collection_link, trigger, options=None):
"""Creates a trigger in a collection.
:param str collection_link:
The link to the document collection.
:param dict trigger:
:param dict options:
The request options for the request.
:return... | python | def CreateTrigger(self, collection_link, trigger, options=None):
if options is None:
options = {}
collection_id, path, trigger = self._GetContainerIdWithPathForTrigger(collection_link, trigger)
return self.Create(trigger,
path,
'... | [
"def",
"CreateTrigger",
"(",
"self",
",",
"collection_link",
",",
"trigger",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"collection_id",
",",
"path",
",",
"trigger",
"=",
"self",
".",
"_GetContain... | Creates a trigger in a collection.
:param str collection_link:
The link to the document collection.
:param dict trigger:
:param dict options:
The request options for the request.
:return:
The created Trigger.
:rtype:
dict | [
"Creates",
"a",
"trigger",
"in",
"a",
"collection",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1168-L1192 |
243,367 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.UpsertTrigger | def UpsertTrigger(self, collection_link, trigger, options=None):
"""Upserts a trigger in a collection.
:param str collection_link:
The link to the document collection.
:param dict trigger:
:param dict options:
The request options for the request.
:return... | python | def UpsertTrigger(self, collection_link, trigger, options=None):
if options is None:
options = {}
collection_id, path, trigger = self._GetContainerIdWithPathForTrigger(collection_link, trigger)
return self.Upsert(trigger,
path,
'... | [
"def",
"UpsertTrigger",
"(",
"self",
",",
"collection_link",
",",
"trigger",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"collection_id",
",",
"path",
",",
"trigger",
"=",
"self",
".",
"_GetContain... | Upserts a trigger in a collection.
:param str collection_link:
The link to the document collection.
:param dict trigger:
:param dict options:
The request options for the request.
:return:
The upserted Trigger.
:rtype:
dict | [
"Upserts",
"a",
"trigger",
"in",
"a",
"collection",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1194-L1218 |
243,368 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReadTrigger | def ReadTrigger(self, trigger_link, options=None):
"""Reads a trigger.
:param str trigger_link:
The link to the trigger.
:param dict options:
The request options for the request.
:return:
The read Trigger.
:rtype:
dict
""... | python | def ReadTrigger(self, trigger_link, options=None):
if options is None:
options = {}
path = base.GetPathFromLink(trigger_link)
trigger_id = base.GetResourceIdOrFullNameFromLink(trigger_link)
return self.Read(path, 'triggers', trigger_id, None, options) | [
"def",
"ReadTrigger",
"(",
"self",
",",
"trigger_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"trigger_link",
")",
"trigger_id",
"=",
"base",... | Reads a trigger.
:param str trigger_link:
The link to the trigger.
:param dict options:
The request options for the request.
:return:
The read Trigger.
:rtype:
dict | [
"Reads",
"a",
"trigger",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1233-L1252 |
243,369 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReadUserDefinedFunctions | def ReadUserDefinedFunctions(self, collection_link, options=None):
"""Reads all user defined functions in a collection.
:param str collection_link:
The link to the document collection.
:param dict options:
The request options for the request.
:return:
... | python | def ReadUserDefinedFunctions(self, collection_link, options=None):
if options is None:
options = {}
return self.QueryUserDefinedFunctions(collection_link, None, options) | [
"def",
"ReadUserDefinedFunctions",
"(",
"self",
",",
"collection_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"return",
"self",
".",
"QueryUserDefinedFunctions",
"(",
"collection_link",
",",
"None"... | Reads all user defined functions in a collection.
:param str collection_link:
The link to the document collection.
:param dict options:
The request options for the request.
:return:
Query Iterable of UDFs.
:rtype:
query_iterable.QueryIter... | [
"Reads",
"all",
"user",
"defined",
"functions",
"in",
"a",
"collection",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1254-L1271 |
243,370 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.QueryUserDefinedFunctions | def QueryUserDefinedFunctions(self, collection_link, query, options=None):
"""Queries user defined functions in a collection.
:param str collection_link:
The link to the collection.
:param (str or dict) query:
:param dict options:
The request options for the requ... | python | def QueryUserDefinedFunctions(self, collection_link, query, options=None):
if options is None:
options = {}
path = base.GetPathFromLink(collection_link, 'udfs')
collection_id = base.GetResourceIdOrFullNameFromLink(collection_link)
def fetch_fn(options):
return se... | [
"def",
"QueryUserDefinedFunctions",
"(",
"self",
",",
"collection_link",
",",
"query",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"collection_link",
... | Queries user defined functions in a collection.
:param str collection_link:
The link to the collection.
:param (str or dict) query:
:param dict options:
The request options for the request.
:return:
Query Iterable of UDFs.
:rtype:
... | [
"Queries",
"user",
"defined",
"functions",
"in",
"a",
"collection",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1273-L1301 |
243,371 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.CreateUserDefinedFunction | def CreateUserDefinedFunction(self, collection_link, udf, options=None):
"""Creates a user defined function in a collection.
:param str collection_link:
The link to the collection.
:param str udf:
:param dict options:
The request options for the request.
... | python | def CreateUserDefinedFunction(self, collection_link, udf, options=None):
if options is None:
options = {}
collection_id, path, udf = self._GetContainerIdWithPathForUDF(collection_link, udf)
return self.Create(udf,
path,
'udfs',
... | [
"def",
"CreateUserDefinedFunction",
"(",
"self",
",",
"collection_link",
",",
"udf",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"collection_id",
",",
"path",
",",
"udf",
"=",
"self",
".",
"_GetCon... | Creates a user defined function in a collection.
:param str collection_link:
The link to the collection.
:param str udf:
:param dict options:
The request options for the request.
:return:
The created UDF.
:rtype:
dict | [
"Creates",
"a",
"user",
"defined",
"function",
"in",
"a",
"collection",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1303-L1327 |
243,372 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.UpsertUserDefinedFunction | def UpsertUserDefinedFunction(self, collection_link, udf, options=None):
"""Upserts a user defined function in a collection.
:param str collection_link:
The link to the collection.
:param str udf:
:param dict options:
The request options for the request.
... | python | def UpsertUserDefinedFunction(self, collection_link, udf, options=None):
if options is None:
options = {}
collection_id, path, udf = self._GetContainerIdWithPathForUDF(collection_link, udf)
return self.Upsert(udf,
path,
'udfs',
... | [
"def",
"UpsertUserDefinedFunction",
"(",
"self",
",",
"collection_link",
",",
"udf",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"collection_id",
",",
"path",
",",
"udf",
"=",
"self",
".",
"_GetCon... | Upserts a user defined function in a collection.
:param str collection_link:
The link to the collection.
:param str udf:
:param dict options:
The request options for the request.
:return:
The upserted UDF.
:rtype:
dict | [
"Upserts",
"a",
"user",
"defined",
"function",
"in",
"a",
"collection",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1329-L1353 |
243,373 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReadUserDefinedFunction | def ReadUserDefinedFunction(self, udf_link, options=None):
"""Reads a user defined function.
:param str udf_link:
The link to the user defined function.
:param dict options:
The request options for the request.
:return:
The read UDF.
:rtype:
... | python | def ReadUserDefinedFunction(self, udf_link, options=None):
if options is None:
options = {}
path = base.GetPathFromLink(udf_link)
udf_id = base.GetResourceIdOrFullNameFromLink(udf_link)
return self.Read(path, 'udfs', udf_id, None, options) | [
"def",
"ReadUserDefinedFunction",
"(",
"self",
",",
"udf_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"udf_link",
")",
"udf_id",
"=",
"base",... | Reads a user defined function.
:param str udf_link:
The link to the user defined function.
:param dict options:
The request options for the request.
:return:
The read UDF.
:rtype:
dict | [
"Reads",
"a",
"user",
"defined",
"function",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1368-L1387 |
243,374 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReadStoredProcedures | def ReadStoredProcedures(self, collection_link, options=None):
"""Reads all store procedures in a collection.
:param str collection_link:
The link to the document collection.
:param dict options:
The request options for the request.
:return:
Query It... | python | def ReadStoredProcedures(self, collection_link, options=None):
if options is None:
options = {}
return self.QueryStoredProcedures(collection_link, None, options) | [
"def",
"ReadStoredProcedures",
"(",
"self",
",",
"collection_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"return",
"self",
".",
"QueryStoredProcedures",
"(",
"collection_link",
",",
"None",
",",... | Reads all store procedures in a collection.
:param str collection_link:
The link to the document collection.
:param dict options:
The request options for the request.
:return:
Query Iterable of Stored Procedures.
:rtype:
query_iterable.Qu... | [
"Reads",
"all",
"store",
"procedures",
"in",
"a",
"collection",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1389-L1406 |
243,375 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.CreateStoredProcedure | def CreateStoredProcedure(self, collection_link, sproc, options=None):
"""Creates a stored procedure in a collection.
:param str collection_link:
The link to the document collection.
:param str sproc:
:param dict options:
The request options for the request.
... | python | def CreateStoredProcedure(self, collection_link, sproc, options=None):
if options is None:
options = {}
collection_id, path, sproc = self._GetContainerIdWithPathForSproc(collection_link, sproc)
return self.Create(sproc,
path,
'sp... | [
"def",
"CreateStoredProcedure",
"(",
"self",
",",
"collection_link",
",",
"sproc",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"collection_id",
",",
"path",
",",
"sproc",
"=",
"self",
".",
"_GetCon... | Creates a stored procedure in a collection.
:param str collection_link:
The link to the document collection.
:param str sproc:
:param dict options:
The request options for the request.
:return:
The created Stored Procedure.
:rtype:
... | [
"Creates",
"a",
"stored",
"procedure",
"in",
"a",
"collection",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1438-L1462 |
243,376 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.UpsertStoredProcedure | def UpsertStoredProcedure(self, collection_link, sproc, options=None):
"""Upserts a stored procedure in a collection.
:param str collection_link:
The link to the document collection.
:param str sproc:
:param dict options:
The request options for the request.
... | python | def UpsertStoredProcedure(self, collection_link, sproc, options=None):
if options is None:
options = {}
collection_id, path, sproc = self._GetContainerIdWithPathForSproc(collection_link, sproc)
return self.Upsert(sproc,
path,
'sp... | [
"def",
"UpsertStoredProcedure",
"(",
"self",
",",
"collection_link",
",",
"sproc",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"collection_id",
",",
"path",
",",
"sproc",
"=",
"self",
".",
"_GetCon... | Upserts a stored procedure in a collection.
:param str collection_link:
The link to the document collection.
:param str sproc:
:param dict options:
The request options for the request.
:return:
The upserted Stored Procedure.
:rtype:
... | [
"Upserts",
"a",
"stored",
"procedure",
"in",
"a",
"collection",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1464-L1488 |
243,377 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReadStoredProcedure | def ReadStoredProcedure(self, sproc_link, options=None):
"""Reads a stored procedure.
:param str sproc_link:
The link to the stored procedure.
:param dict options:
The request options for the request.
:return:
The read Stored Procedure.
:rtyp... | python | def ReadStoredProcedure(self, sproc_link, options=None):
if options is None:
options = {}
path = base.GetPathFromLink(sproc_link)
sproc_id = base.GetResourceIdOrFullNameFromLink(sproc_link)
return self.Read(path, 'sprocs', sproc_id, None, options) | [
"def",
"ReadStoredProcedure",
"(",
"self",
",",
"sproc_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"sproc_link",
")",
"sproc_id",
"=",
"base... | Reads a stored procedure.
:param str sproc_link:
The link to the stored procedure.
:param dict options:
The request options for the request.
:return:
The read Stored Procedure.
:rtype:
dict | [
"Reads",
"a",
"stored",
"procedure",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1502-L1521 |
243,378 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReadConflicts | def ReadConflicts(self, collection_link, feed_options=None):
"""Reads conflicts.
:param str collection_link:
The link to the document collection.
:param dict feed_options:
:return:
Query Iterable of Conflicts.
:rtype:
query_iterable.QueryIter... | python | def ReadConflicts(self, collection_link, feed_options=None):
if feed_options is None:
feed_options = {}
return self.QueryConflicts(collection_link, None, feed_options) | [
"def",
"ReadConflicts",
"(",
"self",
",",
"collection_link",
",",
"feed_options",
"=",
"None",
")",
":",
"if",
"feed_options",
"is",
"None",
":",
"feed_options",
"=",
"{",
"}",
"return",
"self",
".",
"QueryConflicts",
"(",
"collection_link",
",",
"None",
","... | Reads conflicts.
:param str collection_link:
The link to the document collection.
:param dict feed_options:
:return:
Query Iterable of Conflicts.
:rtype:
query_iterable.QueryIterable | [
"Reads",
"conflicts",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1523-L1539 |
243,379 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReadConflict | def ReadConflict(self, conflict_link, options=None):
"""Reads a conflict.
:param str conflict_link:
The link to the conflict.
:param dict options:
:return:
The read Conflict.
:rtype:
dict
"""
if options is None:
o... | python | def ReadConflict(self, conflict_link, options=None):
if options is None:
options = {}
path = base.GetPathFromLink(conflict_link)
conflict_id = base.GetResourceIdOrFullNameFromLink(conflict_link)
return self.Read(path,
'conflicts',
... | [
"def",
"ReadConflict",
"(",
"self",
",",
"conflict_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"conflict_link",
")",
"conflict_id",
"=",
"ba... | Reads a conflict.
:param str conflict_link:
The link to the conflict.
:param dict options:
:return:
The read Conflict.
:rtype:
dict | [
"Reads",
"a",
"conflict",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1571-L1593 |
243,380 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.DeleteContainer | def DeleteContainer(self, collection_link, options=None):
"""Deletes a collection.
:param str collection_link:
The link to the document collection.
:param dict options:
The request options for the request.
:return:
The deleted Collection.
:rt... | python | def DeleteContainer(self, collection_link, options=None):
if options is None:
options = {}
path = base.GetPathFromLink(collection_link)
collection_id = base.GetResourceIdOrFullNameFromLink(collection_link)
return self.DeleteResource(path,
'... | [
"def",
"DeleteContainer",
"(",
"self",
",",
"collection_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"collection_link",
")",
"collection_id",
"... | Deletes a collection.
:param str collection_link:
The link to the document collection.
:param dict options:
The request options for the request.
:return:
The deleted Collection.
:rtype:
dict | [
"Deletes",
"a",
"collection",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1595-L1618 |
243,381 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReplaceItem | def ReplaceItem(self, document_link, new_document, options=None):
"""Replaces a document and returns it.
:param str document_link:
The link to the document.
:param dict new_document:
:param dict options:
The request options for the request.
:return:
... | python | def ReplaceItem(self, document_link, new_document, options=None):
CosmosClient.__ValidateResource(new_document)
path = base.GetPathFromLink(document_link)
document_id = base.GetResourceIdOrFullNameFromLink(document_link)
# Python's default arguments are evaluated once when the f... | [
"def",
"ReplaceItem",
"(",
"self",
",",
"document_link",
",",
"new_document",
",",
"options",
"=",
"None",
")",
":",
"CosmosClient",
".",
"__ValidateResource",
"(",
"new_document",
")",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"document_link",
")",
"d... | Replaces a document and returns it.
:param str document_link:
The link to the document.
:param dict new_document:
:param dict options:
The request options for the request.
:return:
The new Document.
:rtype:
dict | [
"Replaces",
"a",
"document",
"and",
"returns",
"it",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1620-L1655 |
243,382 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.CreateAttachment | def CreateAttachment(self, document_link, attachment, options=None):
"""Creates an attachment in a document.
:param str document_link:
The link to the document.
:param dict attachment:
The Azure Cosmos attachment to create.
:param dict options:
The re... | python | def CreateAttachment(self, document_link, attachment, options=None):
if options is None:
options = {}
document_id, path = self._GetItemIdWithPathForAttachment(attachment, document_link)
return self.Create(attachment,
path,
'attac... | [
"def",
"CreateAttachment",
"(",
"self",
",",
"document_link",
",",
"attachment",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"document_id",
",",
"path",
"=",
"self",
".",
"_GetItemIdWithPathForAttachme... | Creates an attachment in a document.
:param str document_link:
The link to the document.
:param dict attachment:
The Azure Cosmos attachment to create.
:param dict options:
The request options for the request.
:return:
The created Attachm... | [
"Creates",
"an",
"attachment",
"in",
"a",
"document",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1682-L1707 |
243,383 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.UpsertAttachment | def UpsertAttachment(self, document_link, attachment, options=None):
"""Upserts an attachment in a document.
:param str document_link:
The link to the document.
:param dict attachment:
The Azure Cosmos attachment to upsert.
:param dict options:
The re... | python | def UpsertAttachment(self, document_link, attachment, options=None):
if options is None:
options = {}
document_id, path = self._GetItemIdWithPathForAttachment(attachment, document_link)
return self.Upsert(attachment,
path,
'attac... | [
"def",
"UpsertAttachment",
"(",
"self",
",",
"document_link",
",",
"attachment",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"document_id",
",",
"path",
"=",
"self",
".",
"_GetItemIdWithPathForAttachme... | Upserts an attachment in a document.
:param str document_link:
The link to the document.
:param dict attachment:
The Azure Cosmos attachment to upsert.
:param dict options:
The request options for the request.
:return:
The upserted Attach... | [
"Upserts",
"an",
"attachment",
"in",
"a",
"document",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1709-L1734 |
243,384 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.CreateAttachmentAndUploadMedia | def CreateAttachmentAndUploadMedia(self,
document_link,
readable_stream,
options=None):
"""Creates an attachment and upload media.
:param str document_link:
The link to the d... | python | def CreateAttachmentAndUploadMedia(self,
document_link,
readable_stream,
options=None):
if options is None:
options = {}
document_id, initial_headers, path = self._GetItemIdW... | [
"def",
"CreateAttachmentAndUploadMedia",
"(",
"self",
",",
"document_link",
",",
"readable_stream",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"document_id",
",",
"initial_headers",
",",
"path",
"=",
... | Creates an attachment and upload media.
:param str document_link:
The link to the document.
:param (file-like stream object) readable_stream:
:param dict options:
The request options for the request.
:return:
The created Attachment.
:rtype:
... | [
"Creates",
"an",
"attachment",
"and",
"upload",
"media",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1742-L1769 |
243,385 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.UpsertAttachmentAndUploadMedia | def UpsertAttachmentAndUploadMedia(self,
document_link,
readable_stream,
options=None):
"""Upserts an attachment and upload media.
:param str document_link:
The link to the d... | python | def UpsertAttachmentAndUploadMedia(self,
document_link,
readable_stream,
options=None):
if options is None:
options = {}
document_id, initial_headers, path = self._GetItemIdW... | [
"def",
"UpsertAttachmentAndUploadMedia",
"(",
"self",
",",
"document_link",
",",
"readable_stream",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"document_id",
",",
"initial_headers",
",",
"path",
"=",
... | Upserts an attachment and upload media.
:param str document_link:
The link to the document.
:param (file-like stream object) readable_stream:
:param dict options:
The request options for the request.
:return:
The upserted Attachment.
:rtype:
... | [
"Upserts",
"an",
"attachment",
"and",
"upload",
"media",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1771-L1798 |
243,386 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReadAttachment | def ReadAttachment(self, attachment_link, options=None):
"""Reads an attachment.
:param str attachment_link:
The link to the attachment.
:param dict options:
The request options for the request.
:return:
The read Attachment.
:rtype:
... | python | def ReadAttachment(self, attachment_link, options=None):
if options is None:
options = {}
path = base.GetPathFromLink(attachment_link)
attachment_id = base.GetResourceIdOrFullNameFromLink(attachment_link)
return self.Read(path,
'attachments',
... | [
"def",
"ReadAttachment",
"(",
"self",
",",
"attachment_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"attachment_link",
")",
"attachment_id",
"=... | Reads an attachment.
:param str attachment_link:
The link to the attachment.
:param dict options:
The request options for the request.
:return:
The read Attachment.
:rtype:
dict | [
"Reads",
"an",
"attachment",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1819-L1842 |
243,387 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReadAttachments | def ReadAttachments(self, document_link, options=None):
"""Reads all attachments in a document.
:param str document_link:
The link to the document.
:param dict options:
The request options for the request.
:return:
Query Iterable of Attachments.
... | python | def ReadAttachments(self, document_link, options=None):
if options is None:
options = {}
return self.QueryAttachments(document_link, None, options) | [
"def",
"ReadAttachments",
"(",
"self",
",",
"document_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"return",
"self",
".",
"QueryAttachments",
"(",
"document_link",
",",
"None",
",",
"options",
... | Reads all attachments in a document.
:param str document_link:
The link to the document.
:param dict options:
The request options for the request.
:return:
Query Iterable of Attachments.
:rtype:
query_iterable.QueryIterable | [
"Reads",
"all",
"attachments",
"in",
"a",
"document",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1844-L1861 |
243,388 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.QueryAttachments | def QueryAttachments(self, document_link, query, options=None):
"""Queries attachments in a document.
:param str document_link:
The link to the document.
:param (str or dict) query:
:param dict options:
The request options for the request.
:return:
... | python | def QueryAttachments(self, document_link, query, options=None):
if options is None:
options = {}
path = base.GetPathFromLink(document_link, 'attachments')
document_id = base.GetResourceIdOrFullNameFromLink(document_link)
def fetch_fn(options):
return self.__Quer... | [
"def",
"QueryAttachments",
"(",
"self",
",",
"document_link",
",",
"query",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"document_link",
",",
"'att... | Queries attachments in a document.
:param str document_link:
The link to the document.
:param (str or dict) query:
:param dict options:
The request options for the request.
:return:
Query Iterable of Attachments.
:rtype:
query_ite... | [
"Queries",
"attachments",
"in",
"a",
"document",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1863-L1892 |
243,389 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReadMedia | def ReadMedia(self, media_link):
"""Reads a media.
When self.connection_policy.MediaReadMode ==
documents.MediaReadMode.Streamed, returns a file-like stream object;
otherwise, returns a str.
:param str media_link:
The link to the media.
:return:
... | python | def ReadMedia(self, media_link):
default_headers = self.default_headers
path = base.GetPathFromLink(media_link)
media_id = base.GetResourceIdOrFullNameFromLink(media_link)
attachment_id = base.GetAttachmentIdFromMediaId(media_id)
headers = base.GetHeaders(self,
... | [
"def",
"ReadMedia",
"(",
"self",
",",
"media_link",
")",
":",
"default_headers",
"=",
"self",
".",
"default_headers",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"media_link",
")",
"media_id",
"=",
"base",
".",
"GetResourceIdOrFullNameFromLink",
"(",
"medi... | Reads a media.
When self.connection_policy.MediaReadMode ==
documents.MediaReadMode.Streamed, returns a file-like stream object;
otherwise, returns a str.
:param str media_link:
The link to the media.
:return:
The read Media.
:rtype:
... | [
"Reads",
"a",
"media",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1895-L1929 |
243,390 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.UpdateMedia | def UpdateMedia(self, media_link, readable_stream, options=None):
"""Updates a media and returns it.
:param str media_link:
The link to the media.
:param (file-like stream object) readable_stream:
:param dict options:
The request options for the request.
... | python | def UpdateMedia(self, media_link, readable_stream, options=None):
if options is None:
options = {}
initial_headers = dict(self.default_headers)
# Add required headers slug and content-type in case the body is a stream
if options.get('slug'):
initial_headers[http... | [
"def",
"UpdateMedia",
"(",
"self",
",",
"media_link",
",",
"readable_stream",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"initial_headers",
"=",
"dict",
"(",
"self",
".",
"default_headers",
")",
"... | Updates a media and returns it.
:param str media_link:
The link to the media.
:param (file-like stream object) readable_stream:
:param dict options:
The request options for the request.
:return:
The updated Media.
:rtype:
str or f... | [
"Updates",
"a",
"media",
"and",
"returns",
"it",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1931-L1981 |
243,391 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReplaceAttachment | def ReplaceAttachment(self, attachment_link, attachment, options=None):
"""Replaces an attachment and returns it.
:param str attachment_link:
The link to the attachment.
:param dict attachment:
:param dict options:
The request options for the request.
:r... | python | def ReplaceAttachment(self, attachment_link, attachment, options=None):
if options is None:
options = {}
CosmosClient.__ValidateResource(attachment)
path = base.GetPathFromLink(attachment_link)
attachment_id = base.GetResourceIdOrFullNameFromLink(attachment_link)
ret... | [
"def",
"ReplaceAttachment",
"(",
"self",
",",
"attachment_link",
",",
"attachment",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"CosmosClient",
".",
"__ValidateResource",
"(",
"attachment",
")",
"path"... | Replaces an attachment and returns it.
:param str attachment_link:
The link to the attachment.
:param dict attachment:
:param dict options:
The request options for the request.
:return:
The replaced Attachment
:rtype:
dict | [
"Replaces",
"an",
"attachment",
"and",
"returns",
"it",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1983-L2009 |
243,392 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.DeleteAttachment | def DeleteAttachment(self, attachment_link, options=None):
"""Deletes an attachment.
:param str attachment_link:
The link to the attachment.
:param dict options:
The request options for the request.
:return:
The deleted Attachment.
:rtype:
... | python | def DeleteAttachment(self, attachment_link, options=None):
if options is None:
options = {}
path = base.GetPathFromLink(attachment_link)
attachment_id = base.GetResourceIdOrFullNameFromLink(attachment_link)
return self.DeleteResource(path,
... | [
"def",
"DeleteAttachment",
"(",
"self",
",",
"attachment_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"attachment_link",
")",
"attachment_id",
... | Deletes an attachment.
:param str attachment_link:
The link to the attachment.
:param dict options:
The request options for the request.
:return:
The deleted Attachment.
:rtype:
dict | [
"Deletes",
"an",
"attachment",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L2011-L2034 |
243,393 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReplaceTrigger | def ReplaceTrigger(self, trigger_link, trigger, options=None):
"""Replaces a trigger and returns it.
:param str trigger_link:
The link to the trigger.
:param dict trigger:
:param dict options:
The request options for the request.
:return:
The... | python | def ReplaceTrigger(self, trigger_link, trigger, options=None):
if options is None:
options = {}
CosmosClient.__ValidateResource(trigger)
trigger = trigger.copy()
if trigger.get('serverScript'):
trigger['body'] = str(trigger['serverScript'])
elif trigger.g... | [
"def",
"ReplaceTrigger",
"(",
"self",
",",
"trigger_link",
",",
"trigger",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"CosmosClient",
".",
"__ValidateResource",
"(",
"trigger",
")",
"trigger",
"=",
... | Replaces a trigger and returns it.
:param str trigger_link:
The link to the trigger.
:param dict trigger:
:param dict options:
The request options for the request.
:return:
The replaced Trigger.
:rtype:
dict | [
"Replaces",
"a",
"trigger",
"and",
"returns",
"it",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L2036-L2068 |
243,394 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.DeleteTrigger | def DeleteTrigger(self, trigger_link, options=None):
"""Deletes a trigger.
:param str trigger_link:
The link to the trigger.
:param dict options:
The request options for the request.
:return:
The deleted Trigger.
:rtype:
dict
... | python | def DeleteTrigger(self, trigger_link, options=None):
if options is None:
options = {}
path = base.GetPathFromLink(trigger_link)
trigger_id = base.GetResourceIdOrFullNameFromLink(trigger_link)
return self.DeleteResource(path,
'triggers',
... | [
"def",
"DeleteTrigger",
"(",
"self",
",",
"trigger_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"trigger_link",
")",
"trigger_id",
"=",
"base... | Deletes a trigger.
:param str trigger_link:
The link to the trigger.
:param dict options:
The request options for the request.
:return:
The deleted Trigger.
:rtype:
dict | [
"Deletes",
"a",
"trigger",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L2070-L2093 |
243,395 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReplaceUserDefinedFunction | def ReplaceUserDefinedFunction(self, udf_link, udf, options=None):
"""Replaces a user defined function and returns it.
:param str udf_link:
The link to the user defined function.
:param dict udf:
:param dict options:
The request options for the request.
... | python | def ReplaceUserDefinedFunction(self, udf_link, udf, options=None):
if options is None:
options = {}
CosmosClient.__ValidateResource(udf)
udf = udf.copy()
if udf.get('serverScript'):
udf['body'] = str(udf['serverScript'])
elif udf.get('body'):
... | [
"def",
"ReplaceUserDefinedFunction",
"(",
"self",
",",
"udf_link",
",",
"udf",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"CosmosClient",
".",
"__ValidateResource",
"(",
"udf",
")",
"udf",
"=",
"u... | Replaces a user defined function and returns it.
:param str udf_link:
The link to the user defined function.
:param dict udf:
:param dict options:
The request options for the request.
:return:
The new UDF.
:rtype:
dict | [
"Replaces",
"a",
"user",
"defined",
"function",
"and",
"returns",
"it",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L2095-L2127 |
243,396 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.DeleteUserDefinedFunction | def DeleteUserDefinedFunction(self, udf_link, options=None):
"""Deletes a user defined function.
:param str udf_link:
The link to the user defined function.
:param dict options:
The request options for the request.
:return:
The deleted UDF.
:... | python | def DeleteUserDefinedFunction(self, udf_link, options=None):
if options is None:
options = {}
path = base.GetPathFromLink(udf_link)
udf_id = base.GetResourceIdOrFullNameFromLink(udf_link)
return self.DeleteResource(path,
'udfs',
... | [
"def",
"DeleteUserDefinedFunction",
"(",
"self",
",",
"udf_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"udf_link",
")",
"udf_id",
"=",
"base... | Deletes a user defined function.
:param str udf_link:
The link to the user defined function.
:param dict options:
The request options for the request.
:return:
The deleted UDF.
:rtype:
dict | [
"Deletes",
"a",
"user",
"defined",
"function",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L2129-L2152 |
243,397 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ExecuteStoredProcedure | def ExecuteStoredProcedure(self, sproc_link, params, options=None):
"""Executes a store procedure.
:param str sproc_link:
The link to the stored procedure.
:param dict params:
List or None
:param dict options:
The request options for the request.
... | python | def ExecuteStoredProcedure(self, sproc_link, params, options=None):
if options is None:
options = {}
initial_headers = dict(self.default_headers)
initial_headers.update({
http_constants.HttpHeaders.Accept: (
runtime_constants.MediaTypes.Json)
})
... | [
"def",
"ExecuteStoredProcedure",
"(",
"self",
",",
"sproc_link",
",",
"params",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"initial_headers",
"=",
"dict",
"(",
"self",
".",
"default_headers",
")",
... | Executes a store procedure.
:param str sproc_link:
The link to the stored procedure.
:param dict params:
List or None
:param dict options:
The request options for the request.
:return:
The Stored Procedure response.
:rtype:
... | [
"Executes",
"a",
"store",
"procedure",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L2154-L2198 |
243,398 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReplaceStoredProcedure | def ReplaceStoredProcedure(self, sproc_link, sproc, options=None):
"""Replaces a stored procedure and returns it.
:param str sproc_link:
The link to the stored procedure.
:param dict sproc:
:param dict options:
The request options for the request.
:retur... | python | def ReplaceStoredProcedure(self, sproc_link, sproc, options=None):
if options is None:
options = {}
CosmosClient.__ValidateResource(sproc)
sproc = sproc.copy()
if sproc.get('serverScript'):
sproc['body'] = str(sproc['serverScript'])
elif sproc.get('body')... | [
"def",
"ReplaceStoredProcedure",
"(",
"self",
",",
"sproc_link",
",",
"sproc",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"CosmosClient",
".",
"__ValidateResource",
"(",
"sproc",
")",
"sproc",
"=",
... | Replaces a stored procedure and returns it.
:param str sproc_link:
The link to the stored procedure.
:param dict sproc:
:param dict options:
The request options for the request.
:return:
The replaced Stored Procedure.
:rtype:
dict | [
"Replaces",
"a",
"stored",
"procedure",
"and",
"returns",
"it",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L2200-L2232 |
243,399 | Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.DeleteStoredProcedure | def DeleteStoredProcedure(self, sproc_link, options=None):
"""Deletes a stored procedure.
:param str sproc_link:
The link to the stored procedure.
:param dict options:
The request options for the request.
:return:
The deleted Stored Procedure.
... | python | def DeleteStoredProcedure(self, sproc_link, options=None):
if options is None:
options = {}
path = base.GetPathFromLink(sproc_link)
sproc_id = base.GetResourceIdOrFullNameFromLink(sproc_link)
return self.DeleteResource(path,
'sprocs',
... | [
"def",
"DeleteStoredProcedure",
"(",
"self",
",",
"sproc_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"sproc_link",
")",
"sproc_id",
"=",
"ba... | Deletes a stored procedure.
:param str sproc_link:
The link to the stored procedure.
:param dict options:
The request options for the request.
:return:
The deleted Stored Procedure.
:rtype:
dict | [
"Deletes",
"a",
"stored",
"procedure",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L2234-L2257 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.