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 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
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):
"""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 ... | [
"def",
"CreateItem",
"(",
"self",
",",
"database_or_Container_link",
",",
"document",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"if",
"(",
"base",
".",
"IsItemContainerLink",
"(",
"database_or_Contai... | 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 | train |
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):
"""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 ... | [
"def",
"UpsertItem",
"(",
"self",
",",
"database_or_Container_link",
",",
"document",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"if",
"(",
"base",
".",
"IsItemContainerLink",
"(",
"database_or_Contai... | 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 | train |
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):
"""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
... | [
"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 | train |
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):
"""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... | [
"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 | train |
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):
"""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... | [
"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 | train |
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):
"""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... | [
"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 | train |
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):
"""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
""... | [
"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 | train |
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):
"""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:
... | [
"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 | train |
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):
"""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... | [
"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 | train |
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):
"""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.
... | [
"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 | train |
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):
"""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.
... | [
"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 | train |
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):
"""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:
... | [
"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 | train |
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):
"""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... | [
"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 | train |
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):
"""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.
... | [
"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 | train |
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):
"""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.
... | [
"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 | train |
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):
"""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... | [
"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 | train |
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):
"""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... | [
"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 | train |
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):
"""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... | [
"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 | train |
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):
"""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... | [
"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 | train |
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):
"""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:
... | [
"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 | train |
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):
"""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... | [
"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 | train |
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):
"""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... | [
"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 | train |
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):
"""Creates an attachment and upload media.
:param str document_link:
The link to the d... | [
"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 | train |
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):
"""Upserts an attachment and upload media.
:param str document_link:
The link to the d... | [
"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 | train |
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):
"""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:
... | [
"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 | train |
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):
"""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.
... | [
"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 | train |
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):
"""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:
... | [
"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 | train |
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):
"""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:
... | [
"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 | train |
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):
"""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.
... | [
"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 | train |
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):
"""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... | [
"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 | train |
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):
"""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:
... | [
"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 | train |
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):
"""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... | [
"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 | train |
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):
"""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
... | [
"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 | train |
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):
"""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.
... | [
"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 | train |
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):
"""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.
:... | [
"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 | train |
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):
"""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.
... | [
"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 | train |
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):
"""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... | [
"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 | train |
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):
"""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.
... | [
"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 | train |
Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.DeleteConflict | def DeleteConflict(self, conflict_link, options=None):
"""Deletes a conflict.
:param str conflict_link:
The link to the conflict.
:param dict options:
The request options for the request.
:return:
The deleted Conflict.
:rtype:
dic... | python | def DeleteConflict(self, conflict_link, options=None):
"""Deletes a conflict.
:param str conflict_link:
The link to the conflict.
:param dict options:
The request options for the request.
:return:
The deleted Conflict.
:rtype:
dic... | [
"def",
"DeleteConflict",
"(",
"self",
",",
"conflict_link",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"conflict_link",
")",
"conflict_id",
"=",
"... | Deletes a conflict.
:param str conflict_link:
The link to the conflict.
:param dict options:
The request options for the request.
:return:
The deleted Conflict.
:rtype:
dict | [
"Deletes",
"a",
"conflict",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L2259-L2282 | train |
Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReplaceOffer | def ReplaceOffer(self, offer_link, offer):
"""Replaces an offer and returns it.
:param str offer_link:
The link to the offer.
:param dict offer:
:return:
The replaced Offer.
:rtype:
dict
"""
CosmosClient.__ValidateResource(of... | python | def ReplaceOffer(self, offer_link, offer):
"""Replaces an offer and returns it.
:param str offer_link:
The link to the offer.
:param dict offer:
:return:
The replaced Offer.
:rtype:
dict
"""
CosmosClient.__ValidateResource(of... | [
"def",
"ReplaceOffer",
"(",
"self",
",",
"offer_link",
",",
"offer",
")",
":",
"CosmosClient",
".",
"__ValidateResource",
"(",
"offer",
")",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"offer_link",
")",
"offer_id",
"=",
"base",
".",
"GetResourceIdOrFull... | Replaces an offer and returns it.
:param str offer_link:
The link to the offer.
:param dict offer:
:return:
The replaced Offer.
:rtype:
dict | [
"Replaces",
"an",
"offer",
"and",
"returns",
"it",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L2284-L2300 | train |
Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.ReadOffer | def ReadOffer(self, offer_link):
"""Reads an offer.
:param str offer_link:
The link to the offer.
:return:
The read Offer.
:rtype:
dict
"""
path = base.GetPathFromLink(offer_link)
offer_id = base.GetResourceIdOrFullNameFromLi... | python | def ReadOffer(self, offer_link):
"""Reads an offer.
:param str offer_link:
The link to the offer.
:return:
The read Offer.
:rtype:
dict
"""
path = base.GetPathFromLink(offer_link)
offer_id = base.GetResourceIdOrFullNameFromLi... | [
"def",
"ReadOffer",
"(",
"self",
",",
"offer_link",
")",
":",
"path",
"=",
"base",
".",
"GetPathFromLink",
"(",
"offer_link",
")",
"offer_id",
"=",
"base",
".",
"GetResourceIdOrFullNameFromLink",
"(",
"offer_link",
")",
"return",
"self",
".",
"Read",
"(",
"p... | Reads an offer.
:param str offer_link:
The link to the offer.
:return:
The read Offer.
:rtype:
dict | [
"Reads",
"an",
"offer",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L2302-L2316 | train |
Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.GetDatabaseAccount | def GetDatabaseAccount(self, url_connection=None):
"""Gets database account info.
:return:
The Database Account.
:rtype:
documents.DatabaseAccount
"""
if url_connection is None:
url_connection = self.url_connection
initial_headers = ... | python | def GetDatabaseAccount(self, url_connection=None):
"""Gets database account info.
:return:
The Database Account.
:rtype:
documents.DatabaseAccount
"""
if url_connection is None:
url_connection = self.url_connection
initial_headers = ... | [
"def",
"GetDatabaseAccount",
"(",
"self",
",",
"url_connection",
"=",
"None",
")",
":",
"if",
"url_connection",
"is",
"None",
":",
"url_connection",
"=",
"self",
".",
"url_connection",
"initial_headers",
"=",
"dict",
"(",
"self",
".",
"default_headers",
")",
"... | Gets database account info.
:return:
The Database Account.
:rtype:
documents.DatabaseAccount | [
"Gets",
"database",
"account",
"info",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L2361-L2410 | train |
Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.Create | def Create(self, body, path, type, id, initial_headers, options=None):
"""Creates a Azure Cosmos resource and returns it.
:param dict body:
:param str path:
:param str type:
:param str id:
:param dict initial_headers:
:param dict options:
The request ... | python | def Create(self, body, path, type, id, initial_headers, options=None):
"""Creates a Azure Cosmos resource and returns it.
:param dict body:
:param str path:
:param str type:
:param str id:
:param dict initial_headers:
:param dict options:
The request ... | [
"def",
"Create",
"(",
"self",
",",
"body",
",",
"path",
",",
"type",
",",
"id",
",",
"initial_headers",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"initial_headers",
"=",
"initial_headers",
"or"... | Creates a Azure Cosmos resource and returns it.
:param dict body:
:param str path:
:param str type:
:param str id:
:param dict initial_headers:
:param dict options:
The request options for the request.
:return:
The created Azure Cosmos re... | [
"Creates",
"a",
"Azure",
"Cosmos",
"resource",
"and",
"returns",
"it",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L2412-L2450 | train |
Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.Replace | def Replace(self, resource, path, type, id, initial_headers, options=None):
"""Replaces a Azure Cosmos resource and returns it.
:param dict resource:
:param str path:
:param str type:
:param str id:
:param dict initial_headers:
:param dict options:
Th... | python | def Replace(self, resource, path, type, id, initial_headers, options=None):
"""Replaces a Azure Cosmos resource and returns it.
:param dict resource:
:param str path:
:param str type:
:param str id:
:param dict initial_headers:
:param dict options:
Th... | [
"def",
"Replace",
"(",
"self",
",",
"resource",
",",
"path",
",",
"type",
",",
"id",
",",
"initial_headers",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"initial_headers",
"=",
"initial_headers",
... | Replaces a Azure Cosmos resource and returns it.
:param dict resource:
:param str path:
:param str type:
:param str id:
:param dict initial_headers:
:param dict options:
The request options for the request.
:return:
The new Azure Cosmos r... | [
"Replaces",
"a",
"Azure",
"Cosmos",
"resource",
"and",
"returns",
"it",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L2493-L2530 | train |
Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.Read | def Read(self, path, type, id, initial_headers, options=None):
"""Reads a Azure Cosmos resource and returns it.
:param str path:
:param str type:
:param str id:
:param dict initial_headers:
:param dict options:
The request options for the request.
:r... | python | def Read(self, path, type, id, initial_headers, options=None):
"""Reads a Azure Cosmos resource and returns it.
:param str path:
:param str type:
:param str id:
:param dict initial_headers:
:param dict options:
The request options for the request.
:r... | [
"def",
"Read",
"(",
"self",
",",
"path",
",",
"type",
",",
"id",
",",
"initial_headers",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"initial_headers",
"=",
"initial_headers",
"or",
"self",
".",
... | Reads a Azure Cosmos resource and returns it.
:param str path:
:param str type:
:param str id:
:param dict initial_headers:
:param dict options:
The request options for the request.
:return:
The upserted Azure Cosmos resource.
:rtype:
... | [
"Reads",
"a",
"Azure",
"Cosmos",
"resource",
"and",
"returns",
"it",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L2532-L2564 | train |
Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.DeleteResource | def DeleteResource(self, path, type, id, initial_headers, options=None):
"""Deletes a Azure Cosmos resource and returns it.
:param str path:
:param str type:
:param str id:
:param dict initial_headers:
:param dict options:
The request options for the request.... | python | def DeleteResource(self, path, type, id, initial_headers, options=None):
"""Deletes a Azure Cosmos resource and returns it.
:param str path:
:param str type:
:param str id:
:param dict initial_headers:
:param dict options:
The request options for the request.... | [
"def",
"DeleteResource",
"(",
"self",
",",
"path",
",",
"type",
",",
"id",
",",
"initial_headers",
",",
"options",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"{",
"}",
"initial_headers",
"=",
"initial_headers",
"or",
"self... | Deletes a Azure Cosmos resource and returns it.
:param str path:
:param str type:
:param str id:
:param dict initial_headers:
:param dict options:
The request options for the request.
:return:
The deleted Azure Cosmos resource.
:rtype:
... | [
"Deletes",
"a",
"Azure",
"Cosmos",
"resource",
"and",
"returns",
"it",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L2566-L2603 | train |
Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.__Get | def __Get(self, path, request, headers):
"""Azure Cosmos 'GET' http request.
:params str url:
:params str path:
:params dict headers:
:return:
Tuple of (result, headers).
:rtype:
tuple of (dict, dict)
"""
return synchronized_requ... | python | def __Get(self, path, request, headers):
"""Azure Cosmos 'GET' http request.
:params str url:
:params str path:
:params dict headers:
:return:
Tuple of (result, headers).
:rtype:
tuple of (dict, dict)
"""
return synchronized_requ... | [
"def",
"__Get",
"(",
"self",
",",
"path",
",",
"request",
",",
"headers",
")",
":",
"return",
"synchronized_request",
".",
"SynchronizedRequest",
"(",
"self",
",",
"request",
",",
"self",
".",
"_global_endpoint_manager",
",",
"self",
".",
"connection_policy",
... | Azure Cosmos 'GET' http request.
:params str url:
:params str path:
:params dict headers:
:return:
Tuple of (result, headers).
:rtype:
tuple of (dict, dict) | [
"Azure",
"Cosmos",
"GET",
"http",
"request",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L2605-L2627 | train |
Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.__Post | def __Post(self, path, request, body, headers):
"""Azure Cosmos 'POST' http request.
:params str url:
:params str path:
:params (str, unicode, dict) body:
:params dict headers:
:return:
Tuple of (result, headers).
:rtype:
tuple of (dict, ... | python | def __Post(self, path, request, body, headers):
"""Azure Cosmos 'POST' http request.
:params str url:
:params str path:
:params (str, unicode, dict) body:
:params dict headers:
:return:
Tuple of (result, headers).
:rtype:
tuple of (dict, ... | [
"def",
"__Post",
"(",
"self",
",",
"path",
",",
"request",
",",
"body",
",",
"headers",
")",
":",
"return",
"synchronized_request",
".",
"SynchronizedRequest",
"(",
"self",
",",
"request",
",",
"self",
".",
"_global_endpoint_manager",
",",
"self",
".",
"conn... | Azure Cosmos 'POST' http request.
:params str url:
:params str path:
:params (str, unicode, dict) body:
:params dict headers:
:return:
Tuple of (result, headers).
:rtype:
tuple of (dict, dict) | [
"Azure",
"Cosmos",
"POST",
"http",
"request",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L2629-L2652 | train |
Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.__Delete | def __Delete(self, path, request, headers):
"""Azure Cosmos 'DELETE' http request.
:params str url:
:params str path:
:params dict headers:
:return:
Tuple of (result, headers).
:rtype:
tuple of (dict, dict)
"""
return synchronize... | python | def __Delete(self, path, request, headers):
"""Azure Cosmos 'DELETE' http request.
:params str url:
:params str path:
:params dict headers:
:return:
Tuple of (result, headers).
:rtype:
tuple of (dict, dict)
"""
return synchronize... | [
"def",
"__Delete",
"(",
"self",
",",
"path",
",",
"request",
",",
"headers",
")",
":",
"return",
"synchronized_request",
".",
"SynchronizedRequest",
"(",
"self",
",",
"request",
",",
"self",
".",
"_global_endpoint_manager",
",",
"self",
".",
"connection_policy",... | Azure Cosmos 'DELETE' http request.
:params str url:
:params str path:
:params dict headers:
:return:
Tuple of (result, headers).
:rtype:
tuple of (dict, dict) | [
"Azure",
"Cosmos",
"DELETE",
"http",
"request",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L2679-L2701 | train |
Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.QueryFeed | def QueryFeed(self, path, collection_id, query, options, partition_key_range_id = None):
"""Query Feed for Document Collection resource.
:param str path:
Path to the document collection.
:param str collection_id:
Id of the document collection.
:param (str or dict... | python | def QueryFeed(self, path, collection_id, query, options, partition_key_range_id = None):
"""Query Feed for Document Collection resource.
:param str path:
Path to the document collection.
:param str collection_id:
Id of the document collection.
:param (str or dict... | [
"def",
"QueryFeed",
"(",
"self",
",",
"path",
",",
"collection_id",
",",
"query",
",",
"options",
",",
"partition_key_range_id",
"=",
"None",
")",
":",
"return",
"self",
".",
"__QueryFeed",
"(",
"path",
",",
"'docs'",
",",
"collection_id",
",",
"lambda",
"... | Query Feed for Document Collection resource.
:param str path:
Path to the document collection.
:param str collection_id:
Id of the document collection.
:param (str or dict) query:
:param dict options:
The request options for the request.
:para... | [
"Query",
"Feed",
"for",
"Document",
"Collection",
"resource",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L2703-L2726 | train |
Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.__QueryFeed | def __QueryFeed(self,
path,
type,
id,
result_fn,
create_fn,
query,
options=None,
partition_key_range_id=None):
"""Query for more than one Azure Cosmos r... | python | def __QueryFeed(self,
path,
type,
id,
result_fn,
create_fn,
query,
options=None,
partition_key_range_id=None):
"""Query for more than one Azure Cosmos r... | [
"def",
"__QueryFeed",
"(",
"self",
",",
"path",
",",
"type",
",",
"id",
",",
"result_fn",
",",
"create_fn",
",",
"query",
",",
"options",
"=",
"None",
",",
"partition_key_range_id",
"=",
"None",
")",
":",
"if",
"options",
"is",
"None",
":",
"options",
... | Query for more than one Azure Cosmos resources.
:param str path:
:param str type:
:param str id:
:param function result_fn:
:param function create_fn:
:param (str or dict) query:
:param dict options:
The request options for the request.
:param... | [
"Query",
"for",
"more",
"than",
"one",
"Azure",
"Cosmos",
"resources",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L2728-L2814 | train |
Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient.__CheckAndUnifyQueryFormat | def __CheckAndUnifyQueryFormat(self, query_body):
"""Checks and unifies the format of the query body.
:raises TypeError: If query_body is not of expected type (depending on the query compatibility mode).
:raises ValueError: If query_body is a dict but doesn\'t have valid query text.
:ra... | python | def __CheckAndUnifyQueryFormat(self, query_body):
"""Checks and unifies the format of the query body.
:raises TypeError: If query_body is not of expected type (depending on the query compatibility mode).
:raises ValueError: If query_body is a dict but doesn\'t have valid query text.
:ra... | [
"def",
"__CheckAndUnifyQueryFormat",
"(",
"self",
",",
"query_body",
")",
":",
"if",
"(",
"self",
".",
"_query_compatibility_mode",
"==",
"CosmosClient",
".",
"_QueryCompatibilityMode",
".",
"Default",
"or",
"self",
".",
"_query_compatibility_mode",
"==",
"CosmosClien... | Checks and unifies the format of the query body.
:raises TypeError: If query_body is not of expected type (depending on the query compatibility mode).
:raises ValueError: If query_body is a dict but doesn\'t have valid query text.
:raises SystemError: If the query compatibility mode is undefine... | [
"Checks",
"and",
"unifies",
"the",
"format",
"of",
"the",
"query",
"body",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L2816-L2844 | train |
Azure/azure-cosmos-python | azure/cosmos/cosmos_client.py | CosmosClient._UpdateSessionIfRequired | def _UpdateSessionIfRequired(self, request_headers, response_result, response_headers):
"""
Updates session if necessary.
:param dict response_result:
:param dict response_headers:
:param dict response_headers
:return:
None, but updates the client sessio... | python | def _UpdateSessionIfRequired(self, request_headers, response_result, response_headers):
"""
Updates session if necessary.
:param dict response_result:
:param dict response_headers:
:param dict response_headers
:return:
None, but updates the client sessio... | [
"def",
"_UpdateSessionIfRequired",
"(",
"self",
",",
"request_headers",
",",
"response_result",
",",
"response_headers",
")",
":",
"if",
"response_result",
"is",
"None",
"or",
"response_headers",
"is",
"None",
":",
"return",
"is_session_consistency",
"=",
"False",
"... | Updates session if necessary.
:param dict response_result:
:param dict response_headers:
:param dict response_headers
:return:
None, but updates the client session if necessary. | [
"Updates",
"session",
"if",
"necessary",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L2912-L2938 | train |
Azure/azure-cosmos-python | azure/cosmos/base.py | GetResourceIdOrFullNameFromLink | def GetResourceIdOrFullNameFromLink(resource_link):
"""Gets resource id or full name from resource link.
:param str resource_link:
:return:
The resource id or full name from the resource link.
:rtype: str
"""
# For named based, the resource link is the full name
if IsNameBased(reso... | python | def GetResourceIdOrFullNameFromLink(resource_link):
"""Gets resource id or full name from resource link.
:param str resource_link:
:return:
The resource id or full name from the resource link.
:rtype: str
"""
# For named based, the resource link is the full name
if IsNameBased(reso... | [
"def",
"GetResourceIdOrFullNameFromLink",
"(",
"resource_link",
")",
":",
"if",
"IsNameBased",
"(",
"resource_link",
")",
":",
"return",
"TrimBeginningAndEndingSlashes",
"(",
"resource_link",
")",
"if",
"resource_link",
"[",
"-",
"1",
"]",
"!=",
"'/'",
":",
"resou... | Gets resource id or full name from resource link.
:param str resource_link:
:return:
The resource id or full name from the resource link.
:rtype: str | [
"Gets",
"resource",
"id",
"or",
"full",
"name",
"from",
"resource",
"link",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/base.py#L217-L252 | train |
Azure/azure-cosmos-python | azure/cosmos/base.py | GetAttachmentIdFromMediaId | def GetAttachmentIdFromMediaId(media_id):
"""Gets attachment id from media id.
:param str media_id:
:return:
The attachment id from the media id.
:rtype: str
"""
altchars = '+-'
if not six.PY2:
altchars = altchars.encode('utf-8')
# altchars for '+' and '/'. We keep '+' ... | python | def GetAttachmentIdFromMediaId(media_id):
"""Gets attachment id from media id.
:param str media_id:
:return:
The attachment id from the media id.
:rtype: str
"""
altchars = '+-'
if not six.PY2:
altchars = altchars.encode('utf-8')
# altchars for '+' and '/'. We keep '+' ... | [
"def",
"GetAttachmentIdFromMediaId",
"(",
"media_id",
")",
":",
"altchars",
"=",
"'+-'",
"if",
"not",
"six",
".",
"PY2",
":",
"altchars",
"=",
"altchars",
".",
"encode",
"(",
"'utf-8'",
")",
"buffer",
"=",
"base64",
".",
"b64decode",
"(",
"str",
"(",
"me... | Gets attachment id from media id.
:param str media_id:
:return:
The attachment id from the media id.
:rtype: str | [
"Gets",
"attachment",
"id",
"from",
"media",
"id",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/base.py#L255-L279 | train |
Azure/azure-cosmos-python | azure/cosmos/base.py | GetPathFromLink | def GetPathFromLink(resource_link, resource_type=''):
"""Gets path from resource link with optional resource type
:param str resource_link:
:param str resource_type:
:return:
Path from resource link with resource type appended (if provided).
:rtype: str
"""
resource_link = TrimBegi... | python | def GetPathFromLink(resource_link, resource_type=''):
"""Gets path from resource link with optional resource type
:param str resource_link:
:param str resource_type:
:return:
Path from resource link with resource type appended (if provided).
:rtype: str
"""
resource_link = TrimBegi... | [
"def",
"GetPathFromLink",
"(",
"resource_link",
",",
"resource_type",
"=",
"''",
")",
":",
"resource_link",
"=",
"TrimBeginningAndEndingSlashes",
"(",
"resource_link",
")",
"if",
"IsNameBased",
"(",
"resource_link",
")",
":",
"resource_link",
"=",
"urllib_quote",
"(... | Gets path from resource link with optional resource type
:param str resource_link:
:param str resource_type:
:return:
Path from resource link with resource type appended (if provided).
:rtype: str | [
"Gets",
"path",
"from",
"resource",
"link",
"with",
"optional",
"resource",
"type"
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/base.py#L294-L315 | train |
Azure/azure-cosmos-python | azure/cosmos/base.py | IsNameBased | def IsNameBased(link):
"""Finds whether the link is name based or not
:param str link:
:return:
True if link is name-based; otherwise, False.
:rtype: boolean
"""
if not link:
return False
# trimming the leading "/"
if link.startswith('/') and len(link) > 1:
lin... | python | def IsNameBased(link):
"""Finds whether the link is name based or not
:param str link:
:return:
True if link is name-based; otherwise, False.
:rtype: boolean
"""
if not link:
return False
# trimming the leading "/"
if link.startswith('/') and len(link) > 1:
lin... | [
"def",
"IsNameBased",
"(",
"link",
")",
":",
"if",
"not",
"link",
":",
"return",
"False",
"if",
"link",
".",
"startswith",
"(",
"'/'",
")",
"and",
"len",
"(",
"link",
")",
">",
"1",
":",
"link",
"=",
"link",
"[",
"1",
":",
"]",
"parts",
"=",
"l... | Finds whether the link is name based or not
:param str link:
:return:
True if link is name-based; otherwise, False.
:rtype: boolean | [
"Finds",
"whether",
"the",
"link",
"is",
"name",
"based",
"or",
"not"
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/base.py#L317-L351 | train |
Azure/azure-cosmos-python | azure/cosmos/base.py | IsDatabaseLink | def IsDatabaseLink(link):
"""Finds whether the link is a database Self Link or a database ID based link
:param str link:
Link to analyze
:return:
True or False.
:rtype: boolean
"""
if not link:
return False
# trimming the leading and trailing "/" from the input str... | python | def IsDatabaseLink(link):
"""Finds whether the link is a database Self Link or a database ID based link
:param str link:
Link to analyze
:return:
True or False.
:rtype: boolean
"""
if not link:
return False
# trimming the leading and trailing "/" from the input str... | [
"def",
"IsDatabaseLink",
"(",
"link",
")",
":",
"if",
"not",
"link",
":",
"return",
"False",
"link",
"=",
"TrimBeginningAndEndingSlashes",
"(",
"link",
")",
"parts",
"=",
"link",
".",
"split",
"(",
"'/'",
")",
"if",
"len",
"(",
"parts",
")",
"!=",
"2",... | Finds whether the link is a database Self Link or a database ID based link
:param str link:
Link to analyze
:return:
True or False.
:rtype: boolean | [
"Finds",
"whether",
"the",
"link",
"is",
"a",
"database",
"Self",
"Link",
"or",
"a",
"database",
"ID",
"based",
"link"
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/base.py#L363-L393 | train |
Azure/azure-cosmos-python | azure/cosmos/base.py | GetItemContainerInfo | def GetItemContainerInfo(self_link, alt_content_path, id_from_response):
""" Given the self link and alt_content_path from the reponse header and result
extract the collection name and collection id
Ever response header has alt-content-path that is the
owner's path in ascii. For document c... | python | def GetItemContainerInfo(self_link, alt_content_path, id_from_response):
""" Given the self link and alt_content_path from the reponse header and result
extract the collection name and collection id
Ever response header has alt-content-path that is the
owner's path in ascii. For document c... | [
"def",
"GetItemContainerInfo",
"(",
"self_link",
",",
"alt_content_path",
",",
"id_from_response",
")",
":",
"self_link",
"=",
"TrimBeginningAndEndingSlashes",
"(",
"self_link",
")",
"+",
"'/'",
"index",
"=",
"IndexOfNth",
"(",
"self_link",
",",
"'/'",
",",
"4",
... | Given the self link and alt_content_path from the reponse header and result
extract the collection name and collection id
Ever response header has alt-content-path that is the
owner's path in ascii. For document create / update requests, this can be used
to get the collection name, but... | [
"Given",
"the",
"self",
"link",
"and",
"alt_content_path",
"from",
"the",
"reponse",
"header",
"and",
"result",
"extract",
"the",
"collection",
"name",
"and",
"collection",
"id"
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/base.py#L435-L477 | train |
Azure/azure-cosmos-python | azure/cosmos/base.py | GetItemContainerLink | def GetItemContainerLink(link):
"""Gets the document collection link
:param str link:
Resource link
:return:
Document collection link.
:rtype: str
"""
link = TrimBeginningAndEndingSlashes(link) + '/'
index = IndexOfNth(link, '/', 4)
if index != -1:
return... | python | def GetItemContainerLink(link):
"""Gets the document collection link
:param str link:
Resource link
:return:
Document collection link.
:rtype: str
"""
link = TrimBeginningAndEndingSlashes(link) + '/'
index = IndexOfNth(link, '/', 4)
if index != -1:
return... | [
"def",
"GetItemContainerLink",
"(",
"link",
")",
":",
"link",
"=",
"TrimBeginningAndEndingSlashes",
"(",
"link",
")",
"+",
"'/'",
"index",
"=",
"IndexOfNth",
"(",
"link",
",",
"'/'",
",",
"4",
")",
"if",
"index",
"!=",
"-",
"1",
":",
"return",
"link",
... | Gets the document collection link
:param str link:
Resource link
:return:
Document collection link.
:rtype: str | [
"Gets",
"the",
"document",
"collection",
"link"
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/base.py#L479-L497 | train |
Azure/azure-cosmos-python | azure/cosmos/base.py | IndexOfNth | def IndexOfNth(s, value, n):
"""Gets the index of Nth occurance of a given character in a string
:param str s:
Input string
:param char value:
Input char to be searched.
:param int n:
Nth occurrence of char to be searched.
:return:
Index of the Nth occurrence in the... | python | def IndexOfNth(s, value, n):
"""Gets the index of Nth occurance of a given character in a string
:param str s:
Input string
:param char value:
Input char to be searched.
:param int n:
Nth occurrence of char to be searched.
:return:
Index of the Nth occurrence in the... | [
"def",
"IndexOfNth",
"(",
"s",
",",
"value",
",",
"n",
")",
":",
"remaining",
"=",
"n",
"for",
"i",
"in",
"xrange",
"(",
"0",
",",
"len",
"(",
"s",
")",
")",
":",
"if",
"s",
"[",
"i",
"]",
"==",
"value",
":",
"remaining",
"-=",
"1",
"if",
"... | Gets the index of Nth occurance of a given character in a string
:param str s:
Input string
:param char value:
Input char to be searched.
:param int n:
Nth occurrence of char to be searched.
:return:
Index of the Nth occurrence in the string.
:rtype: int | [
"Gets",
"the",
"index",
"of",
"Nth",
"occurance",
"of",
"a",
"given",
"character",
"in",
"a",
"string"
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/base.py#L499-L520 | train |
Azure/azure-cosmos-python | azure/cosmos/base.py | TrimBeginningAndEndingSlashes | def TrimBeginningAndEndingSlashes(path):
"""Trims beginning and ending slashes
:param str path:
:return:
Path with beginning and ending slashes trimmed.
:rtype: str
"""
if path.startswith('/'):
# Returns substring starting from index 1 to end of the string
path = path[1... | python | def TrimBeginningAndEndingSlashes(path):
"""Trims beginning and ending slashes
:param str path:
:return:
Path with beginning and ending slashes trimmed.
:rtype: str
"""
if path.startswith('/'):
# Returns substring starting from index 1 to end of the string
path = path[1... | [
"def",
"TrimBeginningAndEndingSlashes",
"(",
"path",
")",
":",
"if",
"path",
".",
"startswith",
"(",
"'/'",
")",
":",
"path",
"=",
"path",
"[",
"1",
":",
"]",
"if",
"path",
".",
"endswith",
"(",
"'/'",
")",
":",
"path",
"=",
"path",
"[",
":",
"-",
... | Trims beginning and ending slashes
:param str path:
:return:
Path with beginning and ending slashes trimmed.
:rtype: str | [
"Trims",
"beginning",
"and",
"ending",
"slashes"
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/base.py#L546-L563 | train |
Azure/azure-cosmos-python | azure/cosmos/synchronized_request.py | _RequestBodyFromData | def _RequestBodyFromData(data):
"""Gets request body from data.
When `data` is dict and list into unicode string; otherwise return `data`
without making any change.
:param (str, unicode, file-like stream object, dict, list or None) data:
:rtype:
str, unicode, file-like stream object, or N... | python | def _RequestBodyFromData(data):
"""Gets request body from data.
When `data` is dict and list into unicode string; otherwise return `data`
without making any change.
:param (str, unicode, file-like stream object, dict, list or None) data:
:rtype:
str, unicode, file-like stream object, or N... | [
"def",
"_RequestBodyFromData",
"(",
"data",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"six",
".",
"string_types",
")",
"or",
"_IsReadableStream",
"(",
"data",
")",
":",
"return",
"data",
"elif",
"isinstance",
"(",
"data",
",",
"(",
"dict",
",",
"li... | Gets request body from data.
When `data` is dict and list into unicode string; otherwise return `data`
without making any change.
:param (str, unicode, file-like stream object, dict, list or None) data:
:rtype:
str, unicode, file-like stream object, or None | [
"Gets",
"request",
"body",
"from",
"data",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/synchronized_request.py#L47-L69 | train |
Azure/azure-cosmos-python | azure/cosmos/synchronized_request.py | _Request | def _Request(global_endpoint_manager, request, connection_policy, requests_session, path, request_options, request_body):
"""Makes one http request using the requests module.
:param _GlobalEndpointManager global_endpoint_manager:
:param dict request:
contains the resourceType, operationType, endpoi... | python | def _Request(global_endpoint_manager, request, connection_policy, requests_session, path, request_options, request_body):
"""Makes one http request using the requests module.
:param _GlobalEndpointManager global_endpoint_manager:
:param dict request:
contains the resourceType, operationType, endpoi... | [
"def",
"_Request",
"(",
"global_endpoint_manager",
",",
"request",
",",
"connection_policy",
",",
"requests_session",
",",
"path",
",",
"request_options",
",",
"request_body",
")",
":",
"is_media",
"=",
"request_options",
"[",
"'path'",
"]",
".",
"find",
"(",
"'... | Makes one http request using the requests module.
:param _GlobalEndpointManager global_endpoint_manager:
:param dict request:
contains the resourceType, operationType, endpointOverride,
useWriteEndpoint, useAlternateWriteEndpoint information
:param documents.ConnectionPolicy connection_poli... | [
"Makes",
"one",
"http",
"request",
"using",
"the",
"requests",
"module",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/synchronized_request.py#L72-L171 | train |
Azure/azure-cosmos-python | azure/cosmos/synchronized_request.py | SynchronizedRequest | def SynchronizedRequest(client,
request,
global_endpoint_manager,
connection_policy,
requests_session,
method,
path,
request_data,
... | python | def SynchronizedRequest(client,
request,
global_endpoint_manager,
connection_policy,
requests_session,
method,
path,
request_data,
... | [
"def",
"SynchronizedRequest",
"(",
"client",
",",
"request",
",",
"global_endpoint_manager",
",",
"connection_policy",
",",
"requests_session",
",",
"method",
",",
"path",
",",
"request_data",
",",
"query_params",
",",
"headers",
")",
":",
"request_body",
"=",
"No... | Performs one synchronized http request according to the parameters.
:param object client:
Document client instance
:param dict request:
:param _GlobalEndpointManager global_endpoint_manager:
:param documents.ConnectionPolicy connection_policy:
:param requests.Session requests_session:
... | [
"Performs",
"one",
"synchronized",
"http",
"request",
"according",
"to",
"the",
"parameters",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/synchronized_request.py#L173-L227 | train |
Azure/azure-cosmos-python | azure/cosmos/routing/collection_routing_map.py | _CollectionRoutingMap.get_range_by_effective_partition_key | def get_range_by_effective_partition_key(self, effective_partition_key_value):
"""Gets the range containing the given partition key
:param str effective_partition_key_value:
The partition key value.
:return:
The partition key range.
:rtype: dict
"""
... | python | def get_range_by_effective_partition_key(self, effective_partition_key_value):
"""Gets the range containing the given partition key
:param str effective_partition_key_value:
The partition key value.
:return:
The partition key range.
:rtype: dict
"""
... | [
"def",
"get_range_by_effective_partition_key",
"(",
"self",
",",
"effective_partition_key_value",
")",
":",
"if",
"_CollectionRoutingMap",
".",
"MinimumInclusiveEffectivePartitionKey",
"==",
"effective_partition_key_value",
":",
"return",
"self",
".",
"_orderedPartitionKeyRanges"... | Gets the range containing the given partition key
:param str effective_partition_key_value:
The partition key value.
:return:
The partition key range.
:rtype: dict | [
"Gets",
"the",
"range",
"containing",
"the",
"given",
"partition",
"key"
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/routing/collection_routing_map.py#L74-L94 | train |
Azure/azure-cosmos-python | azure/cosmos/routing/collection_routing_map.py | _CollectionRoutingMap.get_range_by_partition_key_range_id | def get_range_by_partition_key_range_id(self, partition_key_range_id):
"""Gets the partition key range given the partition key range id
:param str partition_key_range_id:
The partition key range id.
:return:
The partition key range.
:rtype: dict
"""
... | python | def get_range_by_partition_key_range_id(self, partition_key_range_id):
"""Gets the partition key range given the partition key range id
:param str partition_key_range_id:
The partition key range id.
:return:
The partition key range.
:rtype: dict
"""
... | [
"def",
"get_range_by_partition_key_range_id",
"(",
"self",
",",
"partition_key_range_id",
")",
":",
"t",
"=",
"self",
".",
"_rangeById",
".",
"get",
"(",
"partition_key_range_id",
")",
"if",
"t",
"is",
"None",
":",
"return",
"None",
"return",
"t",
"[",
"0",
... | Gets the partition key range given the partition key range id
:param str partition_key_range_id:
The partition key range id.
:return:
The partition key range.
:rtype: dict | [
"Gets",
"the",
"partition",
"key",
"range",
"given",
"the",
"partition",
"key",
"range",
"id"
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/routing/collection_routing_map.py#L96-L109 | train |
Azure/azure-cosmos-python | azure/cosmos/routing/collection_routing_map.py | _CollectionRoutingMap.get_overlapping_ranges | def get_overlapping_ranges(self, provided_partition_key_ranges):
"""Gets the partition key ranges overlapping the provided ranges
:param list provided_partition_key_ranges:
List of partition key ranges.
:return:
List of partition key ranges, where each is a dict.
... | python | def get_overlapping_ranges(self, provided_partition_key_ranges):
"""Gets the partition key ranges overlapping the provided ranges
:param list provided_partition_key_ranges:
List of partition key ranges.
:return:
List of partition key ranges, where each is a dict.
... | [
"def",
"get_overlapping_ranges",
"(",
"self",
",",
"provided_partition_key_ranges",
")",
":",
"if",
"isinstance",
"(",
"provided_partition_key_ranges",
",",
"routing_range",
".",
"_Range",
")",
":",
"return",
"self",
".",
"get_overlapping_ranges",
"(",
"[",
"provided_... | Gets the partition key ranges overlapping the provided ranges
:param list provided_partition_key_ranges:
List of partition key ranges.
:return:
List of partition key ranges, where each is a dict.
:rtype: list | [
"Gets",
"the",
"partition",
"key",
"ranges",
"overlapping",
"the",
"provided",
"ranges"
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/routing/collection_routing_map.py#L111-L147 | train |
Azure/azure-cosmos-python | azure/cosmos/auth.py | GetAuthorizationHeader | def GetAuthorizationHeader(cosmos_client,
verb,
path,
resource_id_or_fullname,
is_name_based,
resource_type,
headers):
"""Gets the authorization header.
... | python | def GetAuthorizationHeader(cosmos_client,
verb,
path,
resource_id_or_fullname,
is_name_based,
resource_type,
headers):
"""Gets the authorization header.
... | [
"def",
"GetAuthorizationHeader",
"(",
"cosmos_client",
",",
"verb",
",",
"path",
",",
"resource_id_or_fullname",
",",
"is_name_based",
",",
"resource_type",
",",
"headers",
")",
":",
"if",
"resource_id_or_fullname",
"is",
"not",
"None",
"and",
"not",
"is_name_based"... | Gets the authorization header.
:param cosmos_client.CosmosClient cosmos_client:
:param str verb:
:param str path:
:param str resource_id_or_fullname:
:param str resource_type:
:param dict headers:
:return:
The authorization headers.
:rtype: dict | [
"Gets",
"the",
"authorization",
"header",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/auth.py#L31-L64 | train |
Azure/azure-cosmos-python | azure/cosmos/auth.py | __GetAuthorizationTokenUsingMasterKey | def __GetAuthorizationTokenUsingMasterKey(verb,
resource_id_or_fullname,
resource_type,
headers,
master_key):
"""Gets the authorization token using `mas... | python | def __GetAuthorizationTokenUsingMasterKey(verb,
resource_id_or_fullname,
resource_type,
headers,
master_key):
"""Gets the authorization token using `mas... | [
"def",
"__GetAuthorizationTokenUsingMasterKey",
"(",
"verb",
",",
"resource_id_or_fullname",
",",
"resource_type",
",",
"headers",
",",
"master_key",
")",
":",
"key",
"=",
"base64",
".",
"b64decode",
"(",
"master_key",
")",
"text",
"=",
"'{verb}\\n{resource_type}\\n{r... | Gets the authorization token using `master_key.
:param str verb:
:param str resource_id_or_fullname:
:param str resource_type:
:param dict headers:
:param str master_key:
:return:
The authorization token.
:rtype: dict | [
"Gets",
"the",
"authorization",
"token",
"using",
"master_key",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/auth.py#L69-L114 | train |
Azure/azure-cosmos-python | azure/cosmos/auth.py | __GetAuthorizationTokenUsingResourceTokens | def __GetAuthorizationTokenUsingResourceTokens(resource_tokens,
path,
resource_id_or_fullname):
"""Get the authorization token using `resource_tokens`.
:param dict resource_tokens:
:param str path:
:param str re... | python | def __GetAuthorizationTokenUsingResourceTokens(resource_tokens,
path,
resource_id_or_fullname):
"""Get the authorization token using `resource_tokens`.
:param dict resource_tokens:
:param str path:
:param str re... | [
"def",
"__GetAuthorizationTokenUsingResourceTokens",
"(",
"resource_tokens",
",",
"path",
",",
"resource_id_or_fullname",
")",
":",
"if",
"resource_tokens",
"and",
"len",
"(",
"resource_tokens",
")",
">",
"0",
":",
"if",
"not",
"path",
"and",
"not",
"resource_id_or_... | Get the authorization token using `resource_tokens`.
:param dict resource_tokens:
:param str path:
:param str resource_id_or_fullname:
:return:
The authorization token.
:rtype: dict | [
"Get",
"the",
"authorization",
"token",
"using",
"resource_tokens",
"."
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/auth.py#L116-L149 | train |
Azure/azure-cosmos-python | azure/cosmos/session.py | SessionContainer.parse_session_token | def parse_session_token(response_headers):
""" Extracts session token from response headers and parses
:param dict response_headers:
:return:
A dictionary of partition id to session lsn
for given collection
:rtype: dict
"""
# extract sessio... | python | def parse_session_token(response_headers):
""" Extracts session token from response headers and parses
:param dict response_headers:
:return:
A dictionary of partition id to session lsn
for given collection
:rtype: dict
"""
# extract sessio... | [
"def",
"parse_session_token",
"(",
"response_headers",
")",
":",
"session_token",
"=",
"''",
"if",
"http_constants",
".",
"HttpHeaders",
".",
"SessionToken",
"in",
"response_headers",
":",
"session_token",
"=",
"response_headers",
"[",
"http_constants",
".",
"HttpHead... | Extracts session token from response headers and parses
:param dict response_headers:
:return:
A dictionary of partition id to session lsn
for given collection
:rtype: dict | [
"Extracts",
"session",
"token",
"from",
"response",
"headers",
"and",
"parses"
] | dd01b3c5d308c6da83cfcaa0ab7083351a476353 | https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/session.py#L169-L198 | train |
mapbox/mapboxgl-jupyter | mapboxgl/viz.py | VectorMixin.generate_vector_color_map | def generate_vector_color_map(self):
"""Generate color stops array for use with match expression in mapbox template"""
vector_stops = []
# if join data specified as filename or URL, parse JSON to list of Python dicts
if type(self.data) == str:
self.data = geojson_to_dict_lis... | python | def generate_vector_color_map(self):
"""Generate color stops array for use with match expression in mapbox template"""
vector_stops = []
# if join data specified as filename or URL, parse JSON to list of Python dicts
if type(self.data) == str:
self.data = geojson_to_dict_lis... | [
"def",
"generate_vector_color_map",
"(",
"self",
")",
":",
"vector_stops",
"=",
"[",
"]",
"if",
"type",
"(",
"self",
".",
"data",
")",
"==",
"str",
":",
"self",
".",
"data",
"=",
"geojson_to_dict_list",
"(",
"self",
".",
"data",
")",
"for",
"row",
"in"... | Generate color stops array for use with match expression in mapbox template | [
"Generate",
"color",
"stops",
"array",
"for",
"use",
"with",
"match",
"expression",
"in",
"mapbox",
"template"
] | f6e403c13eaa910e70659c7d179e8e32ce95ae34 | https://github.com/mapbox/mapboxgl-jupyter/blob/f6e403c13eaa910e70659c7d179e8e32ce95ae34/mapboxgl/viz.py#L20-L37 | train |
mapbox/mapboxgl-jupyter | mapboxgl/viz.py | VectorMixin.generate_vector_numeric_map | def generate_vector_numeric_map(self, numeric_property):
"""Generate stops array for use with match expression in mapbox template"""
vector_stops = []
function_type = getattr(self, '{}_function_type'.format(numeric_property))
lookup_property = getattr(self, '{}_property'.format(... | python | def generate_vector_numeric_map(self, numeric_property):
"""Generate stops array for use with match expression in mapbox template"""
vector_stops = []
function_type = getattr(self, '{}_function_type'.format(numeric_property))
lookup_property = getattr(self, '{}_property'.format(... | [
"def",
"generate_vector_numeric_map",
"(",
"self",
",",
"numeric_property",
")",
":",
"vector_stops",
"=",
"[",
"]",
"function_type",
"=",
"getattr",
"(",
"self",
",",
"'{}_function_type'",
".",
"format",
"(",
"numeric_property",
")",
")",
"lookup_property",
"=",
... | Generate stops array for use with match expression in mapbox template | [
"Generate",
"stops",
"array",
"for",
"use",
"with",
"match",
"expression",
"in",
"mapbox",
"template"
] | f6e403c13eaa910e70659c7d179e8e32ce95ae34 | https://github.com/mapbox/mapboxgl-jupyter/blob/f6e403c13eaa910e70659c7d179e8e32ce95ae34/mapboxgl/viz.py#L39-L63 | train |
mapbox/mapboxgl-jupyter | mapboxgl/viz.py | VectorMixin.check_vector_template | def check_vector_template(self):
"""Determines if features are defined as vector source based on MapViz arguments."""
if self.vector_url is not None and self.vector_layer_name is not None:
self.template = 'vector_' + self.template
self.vector_source = True
else:
... | python | def check_vector_template(self):
"""Determines if features are defined as vector source based on MapViz arguments."""
if self.vector_url is not None and self.vector_layer_name is not None:
self.template = 'vector_' + self.template
self.vector_source = True
else:
... | [
"def",
"check_vector_template",
"(",
"self",
")",
":",
"if",
"self",
".",
"vector_url",
"is",
"not",
"None",
"and",
"self",
".",
"vector_layer_name",
"is",
"not",
"None",
":",
"self",
".",
"template",
"=",
"'vector_'",
"+",
"self",
".",
"template",
"self",... | Determines if features are defined as vector source based on MapViz arguments. | [
"Determines",
"if",
"features",
"are",
"defined",
"as",
"vector",
"source",
"based",
"on",
"MapViz",
"arguments",
"."
] | f6e403c13eaa910e70659c7d179e8e32ce95ae34 | https://github.com/mapbox/mapboxgl-jupyter/blob/f6e403c13eaa910e70659c7d179e8e32ce95ae34/mapboxgl/viz.py#L65-L72 | train |
mapbox/mapboxgl-jupyter | mapboxgl/viz.py | MapViz.as_iframe | def as_iframe(self, html_data):
"""Build the HTML representation for the mapviz."""
srcdoc = html_data.replace('"', "'")
return ('<iframe id="{div_id}", srcdoc="{srcdoc}" style="width: {width}; '
'height: {height};"></iframe>'.format(
div_id=self.div_id,
... | python | def as_iframe(self, html_data):
"""Build the HTML representation for the mapviz."""
srcdoc = html_data.replace('"', "'")
return ('<iframe id="{div_id}", srcdoc="{srcdoc}" style="width: {width}; '
'height: {height};"></iframe>'.format(
div_id=self.div_id,
... | [
"def",
"as_iframe",
"(",
"self",
",",
"html_data",
")",
":",
"srcdoc",
"=",
"html_data",
".",
"replace",
"(",
"'\"'",
",",
"\"'\"",
")",
"return",
"(",
"'<iframe id=\"{div_id}\", srcdoc=\"{srcdoc}\" style=\"width: {width}; '",
"'height: {height};\"></iframe>'",
".",
"fo... | Build the HTML representation for the mapviz. | [
"Build",
"the",
"HTML",
"representation",
"for",
"the",
"mapviz",
"."
] | f6e403c13eaa910e70659c7d179e8e32ce95ae34 | https://github.com/mapbox/mapboxgl-jupyter/blob/f6e403c13eaa910e70659c7d179e8e32ce95ae34/mapboxgl/viz.py#L244-L253 | train |
mapbox/mapboxgl-jupyter | mapboxgl/viz.py | CircleViz.add_unique_template_variables | def add_unique_template_variables(self, options):
"""Update map template variables specific to circle visual"""
options.update(dict(
geojson_data=json.dumps(self.data, ensure_ascii=False),
colorProperty=self.color_property,
colorType=self.color_function_type,
... | python | def add_unique_template_variables(self, options):
"""Update map template variables specific to circle visual"""
options.update(dict(
geojson_data=json.dumps(self.data, ensure_ascii=False),
colorProperty=self.color_property,
colorType=self.color_function_type,
... | [
"def",
"add_unique_template_variables",
"(",
"self",
",",
"options",
")",
":",
"options",
".",
"update",
"(",
"dict",
"(",
"geojson_data",
"=",
"json",
".",
"dumps",
"(",
"self",
".",
"data",
",",
"ensure_ascii",
"=",
"False",
")",
",",
"colorProperty",
"=... | Update map template variables specific to circle visual | [
"Update",
"map",
"template",
"variables",
"specific",
"to",
"circle",
"visual"
] | f6e403c13eaa910e70659c7d179e8e32ce95ae34 | https://github.com/mapbox/mapboxgl-jupyter/blob/f6e403c13eaa910e70659c7d179e8e32ce95ae34/mapboxgl/viz.py#L403-L418 | train |
mapbox/mapboxgl-jupyter | mapboxgl/viz.py | GraduatedCircleViz.add_unique_template_variables | def add_unique_template_variables(self, options):
"""Update map template variables specific to graduated circle visual"""
options.update(dict(
colorProperty=self.color_property,
colorStops=self.color_stops,
colorType=self.color_function_type,
radiusType=se... | python | def add_unique_template_variables(self, options):
"""Update map template variables specific to graduated circle visual"""
options.update(dict(
colorProperty=self.color_property,
colorStops=self.color_stops,
colorType=self.color_function_type,
radiusType=se... | [
"def",
"add_unique_template_variables",
"(",
"self",
",",
"options",
")",
":",
"options",
".",
"update",
"(",
"dict",
"(",
"colorProperty",
"=",
"self",
".",
"color_property",
",",
"colorStops",
"=",
"self",
".",
"color_stops",
",",
"colorType",
"=",
"self",
... | Update map template variables specific to graduated circle visual | [
"Update",
"map",
"template",
"variables",
"specific",
"to",
"graduated",
"circle",
"visual"
] | f6e403c13eaa910e70659c7d179e8e32ce95ae34 | https://github.com/mapbox/mapboxgl-jupyter/blob/f6e403c13eaa910e70659c7d179e8e32ce95ae34/mapboxgl/viz.py#L473-L491 | train |
mapbox/mapboxgl-jupyter | mapboxgl/viz.py | ClusteredCircleViz.add_unique_template_variables | def add_unique_template_variables(self, options):
"""Update map template variables specific to a clustered circle visual"""
options.update(dict(
colorStops=self.color_stops,
colorDefault=self.color_default,
radiusStops=self.radius_stops,
clusterRadius=self... | python | def add_unique_template_variables(self, options):
"""Update map template variables specific to a clustered circle visual"""
options.update(dict(
colorStops=self.color_stops,
colorDefault=self.color_default,
radiusStops=self.radius_stops,
clusterRadius=self... | [
"def",
"add_unique_template_variables",
"(",
"self",
",",
"options",
")",
":",
"options",
".",
"update",
"(",
"dict",
"(",
"colorStops",
"=",
"self",
".",
"color_stops",
",",
"colorDefault",
"=",
"self",
".",
"color_default",
",",
"radiusStops",
"=",
"self",
... | Update map template variables specific to a clustered circle visual | [
"Update",
"map",
"template",
"variables",
"specific",
"to",
"a",
"clustered",
"circle",
"visual"
] | f6e403c13eaa910e70659c7d179e8e32ce95ae34 | https://github.com/mapbox/mapboxgl-jupyter/blob/f6e403c13eaa910e70659c7d179e8e32ce95ae34/mapboxgl/viz.py#L608-L620 | train |
mapbox/mapboxgl-jupyter | mapboxgl/viz.py | ImageViz.add_unique_template_variables | def add_unique_template_variables(self, options):
"""Update map template variables specific to image visual"""
options.update(dict(
image=self.image,
coordinates=self.coordinates)) | python | def add_unique_template_variables(self, options):
"""Update map template variables specific to image visual"""
options.update(dict(
image=self.image,
coordinates=self.coordinates)) | [
"def",
"add_unique_template_variables",
"(",
"self",
",",
"options",
")",
":",
"options",
".",
"update",
"(",
"dict",
"(",
"image",
"=",
"self",
".",
"image",
",",
"coordinates",
"=",
"self",
".",
"coordinates",
")",
")"
] | Update map template variables specific to image visual | [
"Update",
"map",
"template",
"variables",
"specific",
"to",
"image",
"visual"
] | f6e403c13eaa910e70659c7d179e8e32ce95ae34 | https://github.com/mapbox/mapboxgl-jupyter/blob/f6e403c13eaa910e70659c7d179e8e32ce95ae34/mapboxgl/viz.py#L760-L764 | train |
mapbox/mapboxgl-jupyter | mapboxgl/viz.py | RasterTilesViz.add_unique_template_variables | def add_unique_template_variables(self, options):
"""Update map template variables specific to a raster visual"""
options.update(dict(
tiles_url=self.tiles_url,
tiles_size=self.tiles_size,
tiles_minzoom=self.tiles_minzoom,
tiles_maxzoom=self.tiles_maxzoom,... | python | def add_unique_template_variables(self, options):
"""Update map template variables specific to a raster visual"""
options.update(dict(
tiles_url=self.tiles_url,
tiles_size=self.tiles_size,
tiles_minzoom=self.tiles_minzoom,
tiles_maxzoom=self.tiles_maxzoom,... | [
"def",
"add_unique_template_variables",
"(",
"self",
",",
"options",
")",
":",
"options",
".",
"update",
"(",
"dict",
"(",
"tiles_url",
"=",
"self",
".",
"tiles_url",
",",
"tiles_size",
"=",
"self",
".",
"tiles_size",
",",
"tiles_minzoom",
"=",
"self",
".",
... | Update map template variables specific to a raster visual | [
"Update",
"map",
"template",
"variables",
"specific",
"to",
"a",
"raster",
"visual"
] | f6e403c13eaa910e70659c7d179e8e32ce95ae34 | https://github.com/mapbox/mapboxgl-jupyter/blob/f6e403c13eaa910e70659c7d179e8e32ce95ae34/mapboxgl/viz.py#L798-L805 | train |
mapbox/mapboxgl-jupyter | mapboxgl/viz.py | LinestringViz.add_unique_template_variables | def add_unique_template_variables(self, options):
"""Update map template variables specific to linestring visual"""
# set line stroke dash interval based on line_stroke property
if self.line_stroke in ["dashed", "--"]:
self.line_dash_array = [6, 4]
elif self.line_stroke in [... | python | def add_unique_template_variables(self, options):
"""Update map template variables specific to linestring visual"""
# set line stroke dash interval based on line_stroke property
if self.line_stroke in ["dashed", "--"]:
self.line_dash_array = [6, 4]
elif self.line_stroke in [... | [
"def",
"add_unique_template_variables",
"(",
"self",
",",
"options",
")",
":",
"if",
"self",
".",
"line_stroke",
"in",
"[",
"\"dashed\"",
",",
"\"--\"",
"]",
":",
"self",
".",
"line_dash_array",
"=",
"[",
"6",
",",
"4",
"]",
"elif",
"self",
".",
"line_st... | Update map template variables specific to linestring visual | [
"Update",
"map",
"template",
"variables",
"specific",
"to",
"linestring",
"visual"
] | f6e403c13eaa910e70659c7d179e8e32ce95ae34 | https://github.com/mapbox/mapboxgl-jupyter/blob/f6e403c13eaa910e70659c7d179e8e32ce95ae34/mapboxgl/viz.py#L861-L908 | train |
mapbox/mapboxgl-jupyter | mapboxgl/utils.py | row_to_geojson | def row_to_geojson(row, lon, lat, precision, date_format='epoch'):
"""Convert a pandas dataframe row to a geojson format object. Converts all datetimes to epoch seconds.
"""
# Let pandas handle json serialization
row_json = json.loads(row.to_json(date_format=date_format, date_unit='s'))
return geo... | python | def row_to_geojson(row, lon, lat, precision, date_format='epoch'):
"""Convert a pandas dataframe row to a geojson format object. Converts all datetimes to epoch seconds.
"""
# Let pandas handle json serialization
row_json = json.loads(row.to_json(date_format=date_format, date_unit='s'))
return geo... | [
"def",
"row_to_geojson",
"(",
"row",
",",
"lon",
",",
"lat",
",",
"precision",
",",
"date_format",
"=",
"'epoch'",
")",
":",
"row_json",
"=",
"json",
".",
"loads",
"(",
"row",
".",
"to_json",
"(",
"date_format",
"=",
"date_format",
",",
"date_unit",
"=",... | Convert a pandas dataframe row to a geojson format object. Converts all datetimes to epoch seconds. | [
"Convert",
"a",
"pandas",
"dataframe",
"row",
"to",
"a",
"geojson",
"format",
"object",
".",
"Converts",
"all",
"datetimes",
"to",
"epoch",
"seconds",
"."
] | f6e403c13eaa910e70659c7d179e8e32ce95ae34 | https://github.com/mapbox/mapboxgl-jupyter/blob/f6e403c13eaa910e70659c7d179e8e32ce95ae34/mapboxgl/utils.py#L17-L24 | train |
mapbox/mapboxgl-jupyter | mapboxgl/utils.py | scale_between | def scale_between(minval, maxval, numStops):
""" Scale a min and max value to equal interval domain with
numStops discrete values
"""
scale = []
if numStops < 2:
return [minval, maxval]
elif maxval < minval:
raise ValueError()
else:
domain = maxval - minval
... | python | def scale_between(minval, maxval, numStops):
""" Scale a min and max value to equal interval domain with
numStops discrete values
"""
scale = []
if numStops < 2:
return [minval, maxval]
elif maxval < minval:
raise ValueError()
else:
domain = maxval - minval
... | [
"def",
"scale_between",
"(",
"minval",
",",
"maxval",
",",
"numStops",
")",
":",
"scale",
"=",
"[",
"]",
"if",
"numStops",
"<",
"2",
":",
"return",
"[",
"minval",
",",
"maxval",
"]",
"elif",
"maxval",
"<",
"minval",
":",
"raise",
"ValueError",
"(",
"... | Scale a min and max value to equal interval domain with
numStops discrete values | [
"Scale",
"a",
"min",
"and",
"max",
"value",
"to",
"equal",
"interval",
"domain",
"with",
"numStops",
"discrete",
"values"
] | f6e403c13eaa910e70659c7d179e8e32ce95ae34 | https://github.com/mapbox/mapboxgl-jupyter/blob/f6e403c13eaa910e70659c7d179e8e32ce95ae34/mapboxgl/utils.py#L138-L154 | train |
mapbox/mapboxgl-jupyter | mapboxgl/utils.py | create_radius_stops | def create_radius_stops(breaks, min_radius, max_radius):
"""Convert a data breaks into a radius ramp
"""
num_breaks = len(breaks)
radius_breaks = scale_between(min_radius, max_radius, num_breaks)
stops = []
for i, b in enumerate(breaks):
stops.append([b, radius_breaks[i]])
return st... | python | def create_radius_stops(breaks, min_radius, max_radius):
"""Convert a data breaks into a radius ramp
"""
num_breaks = len(breaks)
radius_breaks = scale_between(min_radius, max_radius, num_breaks)
stops = []
for i, b in enumerate(breaks):
stops.append([b, radius_breaks[i]])
return st... | [
"def",
"create_radius_stops",
"(",
"breaks",
",",
"min_radius",
",",
"max_radius",
")",
":",
"num_breaks",
"=",
"len",
"(",
"breaks",
")",
"radius_breaks",
"=",
"scale_between",
"(",
"min_radius",
",",
"max_radius",
",",
"num_breaks",
")",
"stops",
"=",
"[",
... | Convert a data breaks into a radius ramp | [
"Convert",
"a",
"data",
"breaks",
"into",
"a",
"radius",
"ramp"
] | f6e403c13eaa910e70659c7d179e8e32ce95ae34 | https://github.com/mapbox/mapboxgl-jupyter/blob/f6e403c13eaa910e70659c7d179e8e32ce95ae34/mapboxgl/utils.py#L157-L166 | train |
mapbox/mapboxgl-jupyter | mapboxgl/utils.py | create_weight_stops | def create_weight_stops(breaks):
"""Convert data breaks into a heatmap-weight ramp
"""
num_breaks = len(breaks)
weight_breaks = scale_between(0, 1, num_breaks)
stops = []
for i, b in enumerate(breaks):
stops.append([b, weight_breaks[i]])
return stops | python | def create_weight_stops(breaks):
"""Convert data breaks into a heatmap-weight ramp
"""
num_breaks = len(breaks)
weight_breaks = scale_between(0, 1, num_breaks)
stops = []
for i, b in enumerate(breaks):
stops.append([b, weight_breaks[i]])
return stops | [
"def",
"create_weight_stops",
"(",
"breaks",
")",
":",
"num_breaks",
"=",
"len",
"(",
"breaks",
")",
"weight_breaks",
"=",
"scale_between",
"(",
"0",
",",
"1",
",",
"num_breaks",
")",
"stops",
"=",
"[",
"]",
"for",
"i",
",",
"b",
"in",
"enumerate",
"("... | Convert data breaks into a heatmap-weight ramp | [
"Convert",
"data",
"breaks",
"into",
"a",
"heatmap",
"-",
"weight",
"ramp"
] | f6e403c13eaa910e70659c7d179e8e32ce95ae34 | https://github.com/mapbox/mapboxgl-jupyter/blob/f6e403c13eaa910e70659c7d179e8e32ce95ae34/mapboxgl/utils.py#L169-L178 | train |
mapbox/mapboxgl-jupyter | mapboxgl/utils.py | create_color_stops | def create_color_stops(breaks, colors='RdYlGn', color_ramps=color_ramps):
"""Convert a list of breaks into color stops using colors from colorBrewer
or a custom list of color values in RGB, RGBA, HSL, CSS text, or HEX format.
See www.colorbrewer2.org for a list of color options to pass
"""
num_brea... | python | def create_color_stops(breaks, colors='RdYlGn', color_ramps=color_ramps):
"""Convert a list of breaks into color stops using colors from colorBrewer
or a custom list of color values in RGB, RGBA, HSL, CSS text, or HEX format.
See www.colorbrewer2.org for a list of color options to pass
"""
num_brea... | [
"def",
"create_color_stops",
"(",
"breaks",
",",
"colors",
"=",
"'RdYlGn'",
",",
"color_ramps",
"=",
"color_ramps",
")",
":",
"num_breaks",
"=",
"len",
"(",
"breaks",
")",
"stops",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"colors",
",",
"list",
")",
":",
... | Convert a list of breaks into color stops using colors from colorBrewer
or a custom list of color values in RGB, RGBA, HSL, CSS text, or HEX format.
See www.colorbrewer2.org for a list of color options to pass | [
"Convert",
"a",
"list",
"of",
"breaks",
"into",
"color",
"stops",
"using",
"colors",
"from",
"colorBrewer",
"or",
"a",
"custom",
"list",
"of",
"color",
"values",
"in",
"RGB",
"RGBA",
"HSL",
"CSS",
"text",
"or",
"HEX",
"format",
".",
"See",
"www",
".",
... | f6e403c13eaa910e70659c7d179e8e32ce95ae34 | https://github.com/mapbox/mapboxgl-jupyter/blob/f6e403c13eaa910e70659c7d179e8e32ce95ae34/mapboxgl/utils.py#L188-L228 | train |
mapbox/mapboxgl-jupyter | mapboxgl/utils.py | numeric_map | def numeric_map(lookup, numeric_stops, default=0.0):
"""Return a number value interpolated from given numeric_stops
"""
# if no numeric_stops, use default
if len(numeric_stops) == 0:
return default
# dictionary to lookup value from match-type numeric_stops
match_map = dict((x, y) fo... | python | def numeric_map(lookup, numeric_stops, default=0.0):
"""Return a number value interpolated from given numeric_stops
"""
# if no numeric_stops, use default
if len(numeric_stops) == 0:
return default
# dictionary to lookup value from match-type numeric_stops
match_map = dict((x, y) fo... | [
"def",
"numeric_map",
"(",
"lookup",
",",
"numeric_stops",
",",
"default",
"=",
"0.0",
")",
":",
"if",
"len",
"(",
"numeric_stops",
")",
"==",
"0",
":",
"return",
"default",
"match_map",
"=",
"dict",
"(",
"(",
"x",
",",
"y",
")",
"for",
"(",
"x",
"... | Return a number value interpolated from given numeric_stops | [
"Return",
"a",
"number",
"value",
"interpolated",
"from",
"given",
"numeric_stops"
] | f6e403c13eaa910e70659c7d179e8e32ce95ae34 | https://github.com/mapbox/mapboxgl-jupyter/blob/f6e403c13eaa910e70659c7d179e8e32ce95ae34/mapboxgl/utils.py#L321-L380 | train |
marshmallow-code/apispec | src/apispec/yaml_utils.py | load_yaml_from_docstring | def load_yaml_from_docstring(docstring):
"""Loads YAML from docstring."""
split_lines = trim_docstring(docstring).split("\n")
# Cut YAML from rest of docstring
for index, line in enumerate(split_lines):
line = line.strip()
if line.startswith("---"):
cut_from = index
... | python | def load_yaml_from_docstring(docstring):
"""Loads YAML from docstring."""
split_lines = trim_docstring(docstring).split("\n")
# Cut YAML from rest of docstring
for index, line in enumerate(split_lines):
line = line.strip()
if line.startswith("---"):
cut_from = index
... | [
"def",
"load_yaml_from_docstring",
"(",
"docstring",
")",
":",
"split_lines",
"=",
"trim_docstring",
"(",
"docstring",
")",
".",
"split",
"(",
"\"\\n\"",
")",
"for",
"index",
",",
"line",
"in",
"enumerate",
"(",
"split_lines",
")",
":",
"line",
"=",
"line",
... | Loads YAML from docstring. | [
"Loads",
"YAML",
"from",
"docstring",
"."
] | e92ceffd12b2e392b8d199ed314bd2a7e6512dff | https://github.com/marshmallow-code/apispec/blob/e92ceffd12b2e392b8d199ed314bd2a7e6512dff/src/apispec/yaml_utils.py#L32-L47 | train |
marshmallow-code/apispec | src/apispec/yaml_utils.py | load_operations_from_docstring | def load_operations_from_docstring(docstring):
"""Return a dictionary of OpenAPI operations parsed from a
a docstring.
"""
doc_data = load_yaml_from_docstring(docstring)
return {
key: val
for key, val in iteritems(doc_data)
if key in PATH_KEYS or key.startswith("x-")
} | python | def load_operations_from_docstring(docstring):
"""Return a dictionary of OpenAPI operations parsed from a
a docstring.
"""
doc_data = load_yaml_from_docstring(docstring)
return {
key: val
for key, val in iteritems(doc_data)
if key in PATH_KEYS or key.startswith("x-")
} | [
"def",
"load_operations_from_docstring",
"(",
"docstring",
")",
":",
"doc_data",
"=",
"load_yaml_from_docstring",
"(",
"docstring",
")",
"return",
"{",
"key",
":",
"val",
"for",
"key",
",",
"val",
"in",
"iteritems",
"(",
"doc_data",
")",
"if",
"key",
"in",
"... | Return a dictionary of OpenAPI operations parsed from a
a docstring. | [
"Return",
"a",
"dictionary",
"of",
"OpenAPI",
"operations",
"parsed",
"from",
"a",
"a",
"docstring",
"."
] | e92ceffd12b2e392b8d199ed314bd2a7e6512dff | https://github.com/marshmallow-code/apispec/blob/e92ceffd12b2e392b8d199ed314bd2a7e6512dff/src/apispec/yaml_utils.py#L53-L62 | train |
marshmallow-code/apispec | src/apispec/ext/marshmallow/common.py | get_fields | def get_fields(schema, exclude_dump_only=False):
"""Return fields from schema
:param Schema schema: A marshmallow Schema instance or a class object
:param bool exclude_dump_only: whether to filter fields in Meta.dump_only
:rtype: dict, of field name field object pairs
"""
if hasattr(schema, "fi... | python | def get_fields(schema, exclude_dump_only=False):
"""Return fields from schema
:param Schema schema: A marshmallow Schema instance or a class object
:param bool exclude_dump_only: whether to filter fields in Meta.dump_only
:rtype: dict, of field name field object pairs
"""
if hasattr(schema, "fi... | [
"def",
"get_fields",
"(",
"schema",
",",
"exclude_dump_only",
"=",
"False",
")",
":",
"if",
"hasattr",
"(",
"schema",
",",
"\"fields\"",
")",
":",
"fields",
"=",
"schema",
".",
"fields",
"elif",
"hasattr",
"(",
"schema",
",",
"\"_declared_fields\"",
")",
"... | Return fields from schema
:param Schema schema: A marshmallow Schema instance or a class object
:param bool exclude_dump_only: whether to filter fields in Meta.dump_only
:rtype: dict, of field name field object pairs | [
"Return",
"fields",
"from",
"schema"
] | e92ceffd12b2e392b8d199ed314bd2a7e6512dff | https://github.com/marshmallow-code/apispec/blob/e92ceffd12b2e392b8d199ed314bd2a7e6512dff/src/apispec/ext/marshmallow/common.py#L52-L69 | train |
marshmallow-code/apispec | src/apispec/ext/marshmallow/common.py | warn_if_fields_defined_in_meta | def warn_if_fields_defined_in_meta(fields, Meta):
"""Warns user that fields defined in Meta.fields or Meta.additional will
be ignored
:param dict fields: A dictionary of fields name field object pairs
:param Meta: the schema's Meta class
"""
if getattr(Meta, "fields", None) or getattr(Meta, "ad... | python | def warn_if_fields_defined_in_meta(fields, Meta):
"""Warns user that fields defined in Meta.fields or Meta.additional will
be ignored
:param dict fields: A dictionary of fields name field object pairs
:param Meta: the schema's Meta class
"""
if getattr(Meta, "fields", None) or getattr(Meta, "ad... | [
"def",
"warn_if_fields_defined_in_meta",
"(",
"fields",
",",
"Meta",
")",
":",
"if",
"getattr",
"(",
"Meta",
",",
"\"fields\"",
",",
"None",
")",
"or",
"getattr",
"(",
"Meta",
",",
"\"additional\"",
",",
"None",
")",
":",
"declared_fields",
"=",
"set",
"("... | Warns user that fields defined in Meta.fields or Meta.additional will
be ignored
:param dict fields: A dictionary of fields name field object pairs
:param Meta: the schema's Meta class | [
"Warns",
"user",
"that",
"fields",
"defined",
"in",
"Meta",
".",
"fields",
"or",
"Meta",
".",
"additional",
"will",
"be",
"ignored"
] | e92ceffd12b2e392b8d199ed314bd2a7e6512dff | https://github.com/marshmallow-code/apispec/blob/e92ceffd12b2e392b8d199ed314bd2a7e6512dff/src/apispec/ext/marshmallow/common.py#L72-L88 | train |
marshmallow-code/apispec | src/apispec/ext/marshmallow/common.py | filter_excluded_fields | def filter_excluded_fields(fields, Meta, exclude_dump_only):
"""Filter fields that should be ignored in the OpenAPI spec
:param dict fields: A dictionary of fields name field object pairs
:param Meta: the schema's Meta class
:param bool exclude_dump_only: whether to filter fields in Meta.dump_only
... | python | def filter_excluded_fields(fields, Meta, exclude_dump_only):
"""Filter fields that should be ignored in the OpenAPI spec
:param dict fields: A dictionary of fields name field object pairs
:param Meta: the schema's Meta class
:param bool exclude_dump_only: whether to filter fields in Meta.dump_only
... | [
"def",
"filter_excluded_fields",
"(",
"fields",
",",
"Meta",
",",
"exclude_dump_only",
")",
":",
"exclude",
"=",
"list",
"(",
"getattr",
"(",
"Meta",
",",
"\"exclude\"",
",",
"[",
"]",
")",
")",
"if",
"exclude_dump_only",
":",
"exclude",
".",
"extend",
"("... | Filter fields that should be ignored in the OpenAPI spec
:param dict fields: A dictionary of fields name field object pairs
:param Meta: the schema's Meta class
:param bool exclude_dump_only: whether to filter fields in Meta.dump_only | [
"Filter",
"fields",
"that",
"should",
"be",
"ignored",
"in",
"the",
"OpenAPI",
"spec"
] | e92ceffd12b2e392b8d199ed314bd2a7e6512dff | https://github.com/marshmallow-code/apispec/blob/e92ceffd12b2e392b8d199ed314bd2a7e6512dff/src/apispec/ext/marshmallow/common.py#L91-L106 | train |
marshmallow-code/apispec | src/apispec/ext/marshmallow/common.py | get_unique_schema_name | def get_unique_schema_name(components, name, counter=0):
"""Function to generate a unique name based on the provided name and names
already in the spec. Will append a number to the name to make it unique if
the name is already in the spec.
:param Components components: instance of the components of th... | python | def get_unique_schema_name(components, name, counter=0):
"""Function to generate a unique name based on the provided name and names
already in the spec. Will append a number to the name to make it unique if
the name is already in the spec.
:param Components components: instance of the components of th... | [
"def",
"get_unique_schema_name",
"(",
"components",
",",
"name",
",",
"counter",
"=",
"0",
")",
":",
"if",
"name",
"not",
"in",
"components",
".",
"_schemas",
":",
"return",
"name",
"if",
"not",
"counter",
":",
"warnings",
".",
"warn",
"(",
"\"Multiple sch... | Function to generate a unique name based on the provided name and names
already in the spec. Will append a number to the name to make it unique if
the name is already in the spec.
:param Components components: instance of the components of the spec
:param string name: the name to use as a basis for th... | [
"Function",
"to",
"generate",
"a",
"unique",
"name",
"based",
"on",
"the",
"provided",
"name",
"and",
"names",
"already",
"in",
"the",
"spec",
".",
"Will",
"append",
"a",
"number",
"to",
"the",
"name",
"to",
"make",
"it",
"unique",
"if",
"the",
"name",
... | e92ceffd12b2e392b8d199ed314bd2a7e6512dff | https://github.com/marshmallow-code/apispec/blob/e92ceffd12b2e392b8d199ed314bd2a7e6512dff/src/apispec/ext/marshmallow/common.py#L128-L150 | train |
marshmallow-code/apispec | src/apispec/utils.py | build_reference | def build_reference(component_type, openapi_major_version, component_name):
"""Return path to reference
:param str component_type: Component type (schema, parameter, response, security_scheme)
:param int openapi_major_version: OpenAPI major version (2 or 3)
:param str component_name: Name of component ... | python | def build_reference(component_type, openapi_major_version, component_name):
"""Return path to reference
:param str component_type: Component type (schema, parameter, response, security_scheme)
:param int openapi_major_version: OpenAPI major version (2 or 3)
:param str component_name: Name of component ... | [
"def",
"build_reference",
"(",
"component_type",
",",
"openapi_major_version",
",",
"component_name",
")",
":",
"return",
"{",
"\"$ref\"",
":",
"\"#/{}{}/{}\"",
".",
"format",
"(",
"\"components/\"",
"if",
"openapi_major_version",
">=",
"3",
"else",
"\"\"",
",",
"... | Return path to reference
:param str component_type: Component type (schema, parameter, response, security_scheme)
:param int openapi_major_version: OpenAPI major version (2 or 3)
:param str component_name: Name of component to reference | [
"Return",
"path",
"to",
"reference"
] | e92ceffd12b2e392b8d199ed314bd2a7e6512dff | https://github.com/marshmallow-code/apispec/blob/e92ceffd12b2e392b8d199ed314bd2a7e6512dff/src/apispec/utils.py#L29-L42 | train |
marshmallow-code/apispec | src/apispec/utils.py | deepupdate | def deepupdate(original, update):
"""Recursively update a dict.
Subdict's won't be overwritten but also updated.
"""
for key, value in original.items():
if key not in update:
update[key] = value
elif isinstance(value, dict):
deepupdate(value, update[key])
ret... | python | def deepupdate(original, update):
"""Recursively update a dict.
Subdict's won't be overwritten but also updated.
"""
for key, value in original.items():
if key not in update:
update[key] = value
elif isinstance(value, dict):
deepupdate(value, update[key])
ret... | [
"def",
"deepupdate",
"(",
"original",
",",
"update",
")",
":",
"for",
"key",
",",
"value",
"in",
"original",
".",
"items",
"(",
")",
":",
"if",
"key",
"not",
"in",
"update",
":",
"update",
"[",
"key",
"]",
"=",
"value",
"elif",
"isinstance",
"(",
"... | Recursively update a dict.
Subdict's won't be overwritten but also updated. | [
"Recursively",
"update",
"a",
"dict",
"."
] | e92ceffd12b2e392b8d199ed314bd2a7e6512dff | https://github.com/marshmallow-code/apispec/blob/e92ceffd12b2e392b8d199ed314bd2a7e6512dff/src/apispec/utils.py#L162-L172 | train |
marshmallow-code/apispec | src/apispec/ext/marshmallow/openapi.py | OpenAPIConverter._observed_name | def _observed_name(field, name):
"""Adjust field name to reflect `dump_to` and `load_from` attributes.
:param Field field: A marshmallow field.
:param str name: Field name
:rtype: str
"""
if MARSHMALLOW_VERSION_INFO[0] < 3:
# use getattr in case we're running... | python | def _observed_name(field, name):
"""Adjust field name to reflect `dump_to` and `load_from` attributes.
:param Field field: A marshmallow field.
:param str name: Field name
:rtype: str
"""
if MARSHMALLOW_VERSION_INFO[0] < 3:
# use getattr in case we're running... | [
"def",
"_observed_name",
"(",
"field",
",",
"name",
")",
":",
"if",
"MARSHMALLOW_VERSION_INFO",
"[",
"0",
"]",
"<",
"3",
":",
"dump_to",
"=",
"getattr",
"(",
"field",
",",
"\"dump_to\"",
",",
"None",
")",
"load_from",
"=",
"getattr",
"(",
"field",
",",
... | Adjust field name to reflect `dump_to` and `load_from` attributes.
:param Field field: A marshmallow field.
:param str name: Field name
:rtype: str | [
"Adjust",
"field",
"name",
"to",
"reflect",
"dump_to",
"and",
"load_from",
"attributes",
"."
] | e92ceffd12b2e392b8d199ed314bd2a7e6512dff | https://github.com/marshmallow-code/apispec/blob/e92ceffd12b2e392b8d199ed314bd2a7e6512dff/src/apispec/ext/marshmallow/openapi.py#L124-L136 | train |
marshmallow-code/apispec | src/apispec/ext/marshmallow/openapi.py | OpenAPIConverter.map_to_openapi_type | def map_to_openapi_type(self, *args):
"""Decorator to set mapping for custom fields.
``*args`` can be:
- a pair of the form ``(type, format)``
- a core marshmallow field type (in which case we reuse that type's mapping)
"""
if len(args) == 1 and args[0] in self.field_ma... | python | def map_to_openapi_type(self, *args):
"""Decorator to set mapping for custom fields.
``*args`` can be:
- a pair of the form ``(type, format)``
- a core marshmallow field type (in which case we reuse that type's mapping)
"""
if len(args) == 1 and args[0] in self.field_ma... | [
"def",
"map_to_openapi_type",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"1",
"and",
"args",
"[",
"0",
"]",
"in",
"self",
".",
"field_mapping",
":",
"openapi_type_field",
"=",
"self",
".",
"field_mapping",
"[",
"args"... | Decorator to set mapping for custom fields.
``*args`` can be:
- a pair of the form ``(type, format)``
- a core marshmallow field type (in which case we reuse that type's mapping) | [
"Decorator",
"to",
"set",
"mapping",
"for",
"custom",
"fields",
"."
] | e92ceffd12b2e392b8d199ed314bd2a7e6512dff | https://github.com/marshmallow-code/apispec/blob/e92ceffd12b2e392b8d199ed314bd2a7e6512dff/src/apispec/ext/marshmallow/openapi.py#L138-L157 | train |
marshmallow-code/apispec | src/apispec/ext/marshmallow/openapi.py | OpenAPIConverter.field2type_and_format | def field2type_and_format(self, field):
"""Return the dictionary of OpenAPI type and format based on the field
type
:param Field field: A marshmallow field.
:rtype: dict
"""
# If this type isn't directly in the field mapping then check the
# hierarchy until we fi... | python | def field2type_and_format(self, field):
"""Return the dictionary of OpenAPI type and format based on the field
type
:param Field field: A marshmallow field.
:rtype: dict
"""
# If this type isn't directly in the field mapping then check the
# hierarchy until we fi... | [
"def",
"field2type_and_format",
"(",
"self",
",",
"field",
")",
":",
"for",
"field_class",
"in",
"type",
"(",
"field",
")",
".",
"__mro__",
":",
"if",
"field_class",
"in",
"self",
".",
"field_mapping",
":",
"type_",
",",
"fmt",
"=",
"self",
".",
"field_m... | Return the dictionary of OpenAPI type and format based on the field
type
:param Field field: A marshmallow field.
:rtype: dict | [
"Return",
"the",
"dictionary",
"of",
"OpenAPI",
"type",
"and",
"format",
"based",
"on",
"the",
"field",
"type"
] | e92ceffd12b2e392b8d199ed314bd2a7e6512dff | https://github.com/marshmallow-code/apispec/blob/e92ceffd12b2e392b8d199ed314bd2a7e6512dff/src/apispec/ext/marshmallow/openapi.py#L159-L186 | train |
marshmallow-code/apispec | src/apispec/ext/marshmallow/openapi.py | OpenAPIConverter.field2default | def field2default(self, field):
"""Return the dictionary containing the field's default value
Will first look for a `doc_default` key in the field's metadata and then
fall back on the field's `missing` parameter. A callable passed to the
field's missing parameter will be ignored.
... | python | def field2default(self, field):
"""Return the dictionary containing the field's default value
Will first look for a `doc_default` key in the field's metadata and then
fall back on the field's `missing` parameter. A callable passed to the
field's missing parameter will be ignored.
... | [
"def",
"field2default",
"(",
"self",
",",
"field",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"\"doc_default\"",
"in",
"field",
".",
"metadata",
":",
"ret",
"[",
"\"default\"",
"]",
"=",
"field",
".",
"metadata",
"[",
"\"doc_default\"",
"]",
"else",
":",
"d... | Return the dictionary containing the field's default value
Will first look for a `doc_default` key in the field's metadata and then
fall back on the field's `missing` parameter. A callable passed to the
field's missing parameter will be ignored.
:param Field field: A marshmallow field.... | [
"Return",
"the",
"dictionary",
"containing",
"the",
"field",
"s",
"default",
"value"
] | e92ceffd12b2e392b8d199ed314bd2a7e6512dff | https://github.com/marshmallow-code/apispec/blob/e92ceffd12b2e392b8d199ed314bd2a7e6512dff/src/apispec/ext/marshmallow/openapi.py#L188-L206 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.