partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | Collection.find_one | Get a single document from the database.
All arguments to :meth:`find` are also valid arguments for
:meth:`find_one`, although any `limit` argument will be
ignored. Returns a single document, or ``None`` if no matching
document is found.
The :meth:`find_one` method obeys the :a... | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def find_one(self, filter=None, *args, **kwargs):
"""Get a single document from the database.
All arguments to :meth:`find` are also valid arguments for
:meth:`find_one`, although any `limit` argument will be
ignored. Returns a single document, or ``None`` if no matching
documen... | def find_one(self, filter=None, *args, **kwargs):
"""Get a single document from the database.
All arguments to :meth:`find` are also valid arguments for
:meth:`find_one`, although any `limit` argument will be
ignored. Returns a single document, or ``None`` if no matching
documen... | [
"Get",
"a",
"single",
"document",
"from",
"the",
"database",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L1079-L1111 | [
"def",
"find_one",
"(",
"self",
",",
"filter",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"(",
"filter",
"is",
"not",
"None",
"and",
"not",
"isinstance",
"(",
"filter",
",",
"collections",
".",
"Mapping",
")",
")",
":",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Collection.parallel_scan | Scan this entire collection in parallel.
Returns a list of up to ``num_cursors`` cursors that can be iterated
concurrently. As long as the collection is not modified during
scanning, each document appears once in one of the cursors result
sets.
For example, to process each docu... | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def parallel_scan(self, num_cursors, **kwargs):
"""Scan this entire collection in parallel.
Returns a list of up to ``num_cursors`` cursors that can be iterated
concurrently. As long as the collection is not modified during
scanning, each document appears once in one of the cursors resu... | def parallel_scan(self, num_cursors, **kwargs):
"""Scan this entire collection in parallel.
Returns a list of up to ``num_cursors`` cursors that can be iterated
concurrently. As long as the collection is not modified during
scanning, each document appears once in one of the cursors resu... | [
"Scan",
"this",
"entire",
"collection",
"in",
"parallel",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L1281-L1340 | [
"def",
"parallel_scan",
"(",
"self",
",",
"num_cursors",
",",
"*",
"*",
"kwargs",
")",
":",
"cmd",
"=",
"SON",
"(",
"[",
"(",
"'parallelCollectionScan'",
",",
"self",
".",
"__name",
")",
",",
"(",
"'numCursors'",
",",
"num_cursors",
")",
"]",
")",
"cmd... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Collection._count | Internal count helper. | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def _count(self, cmd, collation=None):
"""Internal count helper."""
with self._socket_for_reads() as (sock_info, slave_ok):
res = self._command(
sock_info, cmd, slave_ok,
allowable_errors=["ns missing"],
codec_options=self.__write_response_code... | def _count(self, cmd, collation=None):
"""Internal count helper."""
with self._socket_for_reads() as (sock_info, slave_ok):
res = self._command(
sock_info, cmd, slave_ok,
allowable_errors=["ns missing"],
codec_options=self.__write_response_code... | [
"Internal",
"count",
"helper",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L1342-L1353 | [
"def",
"_count",
"(",
"self",
",",
"cmd",
",",
"collation",
"=",
"None",
")",
":",
"with",
"self",
".",
"_socket_for_reads",
"(",
")",
"as",
"(",
"sock_info",
",",
"slave_ok",
")",
":",
"res",
"=",
"self",
".",
"_command",
"(",
"sock_info",
",",
"cmd... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Collection.count | Get the number of documents in this collection.
All optional count parameters should be passed as keyword arguments
to this method. Valid options include:
- `hint` (string or list of tuples): The index to use. Specify either
the index name as a string or the index specification a... | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def count(self, filter=None, **kwargs):
"""Get the number of documents in this collection.
All optional count parameters should be passed as keyword arguments
to this method. Valid options include:
- `hint` (string or list of tuples): The index to use. Specify either
the ... | def count(self, filter=None, **kwargs):
"""Get the number of documents in this collection.
All optional count parameters should be passed as keyword arguments
to this method. Valid options include:
- `hint` (string or list of tuples): The index to use. Specify either
the ... | [
"Get",
"the",
"number",
"of",
"documents",
"in",
"this",
"collection",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L1355-L1394 | [
"def",
"count",
"(",
"self",
",",
"filter",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cmd",
"=",
"SON",
"(",
"[",
"(",
"\"count\"",
",",
"self",
".",
"__name",
")",
"]",
")",
"if",
"filter",
"is",
"not",
"None",
":",
"if",
"\"query\"",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Collection.create_indexes | Create one or more indexes on this collection.
>>> from pymongo import IndexModel, ASCENDING, DESCENDING
>>> index1 = IndexModel([("hello", DESCENDING),
... ("world", ASCENDING)], name="hello_world")
>>> index2 = IndexModel([("goodbye", DESCENDING)])
... | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def create_indexes(self, indexes):
"""Create one or more indexes on this collection.
>>> from pymongo import IndexModel, ASCENDING, DESCENDING
>>> index1 = IndexModel([("hello", DESCENDING),
... ("world", ASCENDING)], name="hello_world")
>>> index2 =... | def create_indexes(self, indexes):
"""Create one or more indexes on this collection.
>>> from pymongo import IndexModel, ASCENDING, DESCENDING
>>> index1 = IndexModel([("hello", DESCENDING),
... ("world", ASCENDING)], name="hello_world")
>>> index2 =... | [
"Create",
"one",
"or",
"more",
"indexes",
"on",
"this",
"collection",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L1396-L1444 | [
"def",
"create_indexes",
"(",
"self",
",",
"indexes",
")",
":",
"if",
"not",
"isinstance",
"(",
"indexes",
",",
"list",
")",
":",
"raise",
"TypeError",
"(",
"\"indexes must be a list\"",
")",
"names",
"=",
"[",
"]",
"def",
"gen_indexes",
"(",
")",
":",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Collection.__create_index | Internal create index helper.
:Parameters:
- `keys`: a list of tuples [(key, type), (key, type), ...]
- `index_options`: a dict of index options. | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def __create_index(self, keys, index_options):
"""Internal create index helper.
:Parameters:
- `keys`: a list of tuples [(key, type), (key, type), ...]
- `index_options`: a dict of index options.
"""
index_doc = helpers._index_document(keys)
index = {"key": i... | def __create_index(self, keys, index_options):
"""Internal create index helper.
:Parameters:
- `keys`: a list of tuples [(key, type), (key, type), ...]
- `index_options`: a dict of index options.
"""
index_doc = helpers._index_document(keys)
index = {"key": i... | [
"Internal",
"create",
"index",
"helper",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L1446-L1481 | [
"def",
"__create_index",
"(",
"self",
",",
"keys",
",",
"index_options",
")",
":",
"index_doc",
"=",
"helpers",
".",
"_index_document",
"(",
"keys",
")",
"index",
"=",
"{",
"\"key\"",
":",
"index_doc",
"}",
"collation",
"=",
"validate_collation_or_none",
"(",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Collection.create_index | Creates an index on this collection.
Takes either a single key or a list of (key, direction) pairs.
The key(s) must be an instance of :class:`basestring`
(:class:`str` in python 3), and the direction(s) must be one of
(:data:`~pymongo.ASCENDING`, :data:`~pymongo.DESCENDING`,
:da... | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def create_index(self, keys, **kwargs):
"""Creates an index on this collection.
Takes either a single key or a list of (key, direction) pairs.
The key(s) must be an instance of :class:`basestring`
(:class:`str` in python 3), and the direction(s) must be one of
(:data:`~pymongo.A... | def create_index(self, keys, **kwargs):
"""Creates an index on this collection.
Takes either a single key or a list of (key, direction) pairs.
The key(s) must be an instance of :class:`basestring`
(:class:`str` in python 3), and the direction(s) must be one of
(:data:`~pymongo.A... | [
"Creates",
"an",
"index",
"on",
"this",
"collection",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L1483-L1572 | [
"def",
"create_index",
"(",
"self",
",",
"keys",
",",
"*",
"*",
"kwargs",
")",
":",
"keys",
"=",
"helpers",
".",
"_index_list",
"(",
"keys",
")",
"name",
"=",
"kwargs",
".",
"setdefault",
"(",
"\"name\"",
",",
"helpers",
".",
"_gen_index_name",
"(",
"k... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Collection.ensure_index | **DEPRECATED** - Ensures that an index exists on this collection.
.. versionchanged:: 3.0
**DEPRECATED** | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def ensure_index(self, key_or_list, cache_for=300, **kwargs):
"""**DEPRECATED** - Ensures that an index exists on this collection.
.. versionchanged:: 3.0
**DEPRECATED**
"""
warnings.warn("ensure_index is deprecated. Use create_index instead.",
Deprecat... | def ensure_index(self, key_or_list, cache_for=300, **kwargs):
"""**DEPRECATED** - Ensures that an index exists on this collection.
.. versionchanged:: 3.0
**DEPRECATED**
"""
warnings.warn("ensure_index is deprecated. Use create_index instead.",
Deprecat... | [
"**",
"DEPRECATED",
"**",
"-",
"Ensures",
"that",
"an",
"index",
"exists",
"on",
"this",
"collection",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L1574-L1608 | [
"def",
"ensure_index",
"(",
"self",
",",
"key_or_list",
",",
"cache_for",
"=",
"300",
",",
"*",
"*",
"kwargs",
")",
":",
"warnings",
".",
"warn",
"(",
"\"ensure_index is deprecated. Use create_index instead.\"",
",",
"DeprecationWarning",
",",
"stacklevel",
"=",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Collection.drop_indexes | Drops all indexes on this collection.
Can be used on non-existant collections or collections with no indexes.
Raises OperationFailure on an error.
.. note:: The :attr:`~pymongo.collection.Collection.write_concern` of
this collection is automatically applied to this operation when us... | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def drop_indexes(self):
"""Drops all indexes on this collection.
Can be used on non-existant collections or collections with no indexes.
Raises OperationFailure on an error.
.. note:: The :attr:`~pymongo.collection.Collection.write_concern` of
this collection is automaticall... | def drop_indexes(self):
"""Drops all indexes on this collection.
Can be used on non-existant collections or collections with no indexes.
Raises OperationFailure on an error.
.. note:: The :attr:`~pymongo.collection.Collection.write_concern` of
this collection is automaticall... | [
"Drops",
"all",
"indexes",
"on",
"this",
"collection",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L1610-L1626 | [
"def",
"drop_indexes",
"(",
"self",
")",
":",
"self",
".",
"__database",
".",
"client",
".",
"_purge_index",
"(",
"self",
".",
"__database",
".",
"name",
",",
"self",
".",
"__name",
")",
"self",
".",
"drop_index",
"(",
"\"*\"",
")"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Collection.drop_index | Drops the specified index on this collection.
Can be used on non-existant collections or collections with no
indexes. Raises OperationFailure on an error (e.g. trying to
drop an index that does not exist). `index_or_name`
can be either an index name (as returned by `create_index`),
... | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def drop_index(self, index_or_name):
"""Drops the specified index on this collection.
Can be used on non-existant collections or collections with no
indexes. Raises OperationFailure on an error (e.g. trying to
drop an index that does not exist). `index_or_name`
can be either an... | def drop_index(self, index_or_name):
"""Drops the specified index on this collection.
Can be used on non-existant collections or collections with no
indexes. Raises OperationFailure on an error (e.g. trying to
drop an index that does not exist). `index_or_name`
can be either an... | [
"Drops",
"the",
"specified",
"index",
"on",
"this",
"collection",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L1628-L1673 | [
"def",
"drop_index",
"(",
"self",
",",
"index_or_name",
")",
":",
"name",
"=",
"index_or_name",
"if",
"isinstance",
"(",
"index_or_name",
",",
"list",
")",
":",
"name",
"=",
"helpers",
".",
"_gen_index_name",
"(",
"index_or_name",
")",
"if",
"not",
"isinstan... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Collection.reindex | Rebuilds all indexes on this collection.
.. warning:: reindex blocks all other operations (indexes
are built in the foreground) and will be slow for large
collections.
.. versionchanged:: 3.4
Apply this collection's write concern automatically to this operation
... | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def reindex(self):
"""Rebuilds all indexes on this collection.
.. warning:: reindex blocks all other operations (indexes
are built in the foreground) and will be slow for large
collections.
.. versionchanged:: 3.4
Apply this collection's write concern automatic... | def reindex(self):
"""Rebuilds all indexes on this collection.
.. warning:: reindex blocks all other operations (indexes
are built in the foreground) and will be slow for large
collections.
.. versionchanged:: 3.4
Apply this collection's write concern automatic... | [
"Rebuilds",
"all",
"indexes",
"on",
"this",
"collection",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L1675-L1695 | [
"def",
"reindex",
"(",
"self",
")",
":",
"cmd",
"=",
"SON",
"(",
"[",
"(",
"\"reIndex\"",
",",
"self",
".",
"__name",
")",
"]",
")",
"with",
"self",
".",
"_socket_for_writes",
"(",
")",
"as",
"sock_info",
":",
"return",
"self",
".",
"_command",
"(",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Collection.list_indexes | Get a cursor over the index documents for this collection.
>>> for index in db.test.list_indexes():
... print(index)
...
SON([(u'v', 1), (u'key', SON([(u'_id', 1)])),
(u'name', u'_id_'), (u'ns', u'test.test')])
:Returns:
An instance of :clas... | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def list_indexes(self):
"""Get a cursor over the index documents for this collection.
>>> for index in db.test.list_indexes():
... print(index)
...
SON([(u'v', 1), (u'key', SON([(u'_id', 1)])),
(u'name', u'_id_'), (u'ns', u'test.test')])
:Retu... | def list_indexes(self):
"""Get a cursor over the index documents for this collection.
>>> for index in db.test.list_indexes():
... print(index)
...
SON([(u'v', 1), (u'key', SON([(u'_id', 1)])),
(u'name', u'_id_'), (u'ns', u'test.test')])
:Retu... | [
"Get",
"a",
"cursor",
"over",
"the",
"index",
"documents",
"for",
"this",
"collection",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L1697-L1744 | [
"def",
"list_indexes",
"(",
"self",
")",
":",
"codec_options",
"=",
"CodecOptions",
"(",
"SON",
")",
"coll",
"=",
"self",
".",
"with_options",
"(",
"codec_options",
")",
"with",
"self",
".",
"_socket_for_primary_reads",
"(",
")",
"as",
"(",
"sock_info",
",",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Collection.options | Get the options set on this collection.
Returns a dictionary of options and their values - see
:meth:`~pymongo.database.Database.create_collection` for more
information on the possible options. Returns an empty
dictionary if the collection has not been created yet. | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def options(self):
"""Get the options set on this collection.
Returns a dictionary of options and their values - see
:meth:`~pymongo.database.Database.create_collection` for more
information on the possible options. Returns an empty
dictionary if the collection has not been crea... | def options(self):
"""Get the options set on this collection.
Returns a dictionary of options and their values - see
:meth:`~pymongo.database.Database.create_collection` for more
information on the possible options. Returns an empty
dictionary if the collection has not been crea... | [
"Get",
"the",
"options",
"set",
"on",
"this",
"collection",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L1773-L1802 | [
"def",
"options",
"(",
"self",
")",
":",
"with",
"self",
".",
"_socket_for_primary_reads",
"(",
")",
"as",
"(",
"sock_info",
",",
"slave_ok",
")",
":",
"if",
"sock_info",
".",
"max_wire_version",
">",
"2",
":",
"criteria",
"=",
"{",
"\"name\"",
":",
"sel... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Collection.aggregate | Perform an aggregation using the aggregation framework on this
collection.
All optional aggregate parameters should be passed as keyword arguments
to this method. Valid options include, but are not limited to:
- `allowDiskUse` (bool): Enables writing to temporary files. When set
... | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def aggregate(self, pipeline, **kwargs):
"""Perform an aggregation using the aggregation framework on this
collection.
All optional aggregate parameters should be passed as keyword arguments
to this method. Valid options include, but are not limited to:
- `allowDiskUse` (bool... | def aggregate(self, pipeline, **kwargs):
"""Perform an aggregation using the aggregation framework on this
collection.
All optional aggregate parameters should be passed as keyword arguments
to this method. Valid options include, but are not limited to:
- `allowDiskUse` (bool... | [
"Perform",
"an",
"aggregation",
"using",
"the",
"aggregation",
"framework",
"on",
"this",
"collection",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L1804-L1934 | [
"def",
"aggregate",
"(",
"self",
",",
"pipeline",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"pipeline",
",",
"list",
")",
":",
"raise",
"TypeError",
"(",
"\"pipeline must be a list\"",
")",
"if",
"\"explain\"",
"in",
"kwargs",
":",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Collection.rename | Rename this collection.
If operating in auth mode, client must be authorized as an
admin to perform this operation. Raises :class:`TypeError` if
`new_name` is not an instance of :class:`basestring`
(:class:`str` in python 3). Raises :class:`~pymongo.errors.InvalidName`
if `new_n... | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def rename(self, new_name, **kwargs):
"""Rename this collection.
If operating in auth mode, client must be authorized as an
admin to perform this operation. Raises :class:`TypeError` if
`new_name` is not an instance of :class:`basestring`
(:class:`str` in python 3). Raises :clas... | def rename(self, new_name, **kwargs):
"""Rename this collection.
If operating in auth mode, client must be authorized as an
admin to perform this operation. Raises :class:`TypeError` if
`new_name` is not an instance of :class:`basestring`
(:class:`str` in python 3). Raises :clas... | [
"Rename",
"this",
"collection",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L1975-L2016 | [
"def",
"rename",
"(",
"self",
",",
"new_name",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"new_name",
",",
"string_type",
")",
":",
"raise",
"TypeError",
"(",
"\"new_name must be an \"",
"\"instance of %s\"",
"%",
"(",
"string_type",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Collection.distinct | Get a list of distinct values for `key` among all documents
in this collection.
Raises :class:`TypeError` if `key` is not an instance of
:class:`basestring` (:class:`str` in python 3).
All optional distinct parameters should be passed as keyword arguments
to this method. Valid ... | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def distinct(self, key, filter=None, **kwargs):
"""Get a list of distinct values for `key` among all documents
in this collection.
Raises :class:`TypeError` if `key` is not an instance of
:class:`basestring` (:class:`str` in python 3).
All optional distinct parameters should be... | def distinct(self, key, filter=None, **kwargs):
"""Get a list of distinct values for `key` among all documents
in this collection.
Raises :class:`TypeError` if `key` is not an instance of
:class:`basestring` (:class:`str` in python 3).
All optional distinct parameters should be... | [
"Get",
"a",
"list",
"of",
"distinct",
"values",
"for",
"key",
"among",
"all",
"documents",
"in",
"this",
"collection",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L2018-L2062 | [
"def",
"distinct",
"(",
"self",
",",
"key",
",",
"filter",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"key",
",",
"string_type",
")",
":",
"raise",
"TypeError",
"(",
"\"key must be an \"",
"\"instance of %s\"",
"%",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Collection.map_reduce | Perform a map/reduce operation on this collection.
If `full_response` is ``False`` (default) returns a
:class:`~pymongo.collection.Collection` instance containing
the results of the operation. Otherwise, returns the full
response from the server to the `map reduce command`_.
:P... | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def map_reduce(self, map, reduce, out, full_response=False, **kwargs):
"""Perform a map/reduce operation on this collection.
If `full_response` is ``False`` (default) returns a
:class:`~pymongo.collection.Collection` instance containing
the results of the operation. Otherwise, returns t... | def map_reduce(self, map, reduce, out, full_response=False, **kwargs):
"""Perform a map/reduce operation on this collection.
If `full_response` is ``False`` (default) returns a
:class:`~pymongo.collection.Collection` instance containing
the results of the operation. Otherwise, returns t... | [
"Perform",
"a",
"map",
"/",
"reduce",
"operation",
"on",
"this",
"collection",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L2064-L2151 | [
"def",
"map_reduce",
"(",
"self",
",",
"map",
",",
"reduce",
",",
"out",
",",
"full_response",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"out",
",",
"(",
"string_type",
",",
"collections",
".",
"Mapping",
")",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Collection.inline_map_reduce | Perform an inline map/reduce operation on this collection.
Perform the map/reduce operation on the server in RAM. A result
collection is not created. The result set is returned as a list
of documents.
If `full_response` is ``False`` (default) returns the
result documents in a l... | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def inline_map_reduce(self, map, reduce, full_response=False, **kwargs):
"""Perform an inline map/reduce operation on this collection.
Perform the map/reduce operation on the server in RAM. A result
collection is not created. The result set is returned as a list
of documents.
I... | def inline_map_reduce(self, map, reduce, full_response=False, **kwargs):
"""Perform an inline map/reduce operation on this collection.
Perform the map/reduce operation on the server in RAM. A result
collection is not created. The result set is returned as a list
of documents.
I... | [
"Perform",
"an",
"inline",
"map",
"/",
"reduce",
"operation",
"on",
"this",
"collection",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L2153-L2200 | [
"def",
"inline_map_reduce",
"(",
"self",
",",
"map",
",",
"reduce",
",",
"full_response",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"cmd",
"=",
"SON",
"(",
"[",
"(",
"\"mapreduce\"",
",",
"self",
".",
"__name",
")",
",",
"(",
"\"map\"",
",",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Collection.__find_and_modify | Internal findAndModify helper. | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def __find_and_modify(self, filter, projection, sort, upsert=None,
return_document=ReturnDocument.BEFORE, **kwargs):
"""Internal findAndModify helper."""
common.validate_is_mapping("filter", filter)
if not isinstance(return_document, bool):
raise ValueError(... | def __find_and_modify(self, filter, projection, sort, upsert=None,
return_document=ReturnDocument.BEFORE, **kwargs):
"""Internal findAndModify helper."""
common.validate_is_mapping("filter", filter)
if not isinstance(return_document, bool):
raise ValueError(... | [
"Internal",
"findAndModify",
"helper",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L2202-L2232 | [
"def",
"__find_and_modify",
"(",
"self",
",",
"filter",
",",
"projection",
",",
"sort",
",",
"upsert",
"=",
"None",
",",
"return_document",
"=",
"ReturnDocument",
".",
"BEFORE",
",",
"*",
"*",
"kwargs",
")",
":",
"common",
".",
"validate_is_mapping",
"(",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Collection.find_one_and_replace | Finds a single document and replaces it, returning either the
original or the replaced document.
The :meth:`find_one_and_replace` method differs from
:meth:`find_one_and_update` by replacing the document matched by
*filter*, rather than modifying the existing document.
>>> fo... | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def find_one_and_replace(self, filter, replacement,
projection=None, sort=None, upsert=False,
return_document=ReturnDocument.BEFORE, **kwargs):
"""Finds a single document and replaces it, returning either the
original or the replaced document.
... | def find_one_and_replace(self, filter, replacement,
projection=None, sort=None, upsert=False,
return_document=ReturnDocument.BEFORE, **kwargs):
"""Finds a single document and replaces it, returning either the
original or the replaced document.
... | [
"Finds",
"a",
"single",
"document",
"and",
"replaces",
"it",
"returning",
"either",
"the",
"original",
"or",
"the",
"replaced",
"document",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L2293-L2357 | [
"def",
"find_one_and_replace",
"(",
"self",
",",
"filter",
",",
"replacement",
",",
"projection",
"=",
"None",
",",
"sort",
"=",
"None",
",",
"upsert",
"=",
"False",
",",
"return_document",
"=",
"ReturnDocument",
".",
"BEFORE",
",",
"*",
"*",
"kwargs",
")"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Collection.find_one_and_update | Finds a single document and updates it, returning either the
original or the updated document.
>>> db.test.find_one_and_update(
... {'_id': 665}, {'$inc': {'count': 1}, '$set': {'done': True}})
{u'_id': 665, u'done': False, u'count': 25}}
By default :meth:`find_one_and... | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def find_one_and_update(self, filter, update,
projection=None, sort=None, upsert=False,
return_document=ReturnDocument.BEFORE, **kwargs):
"""Finds a single document and updates it, returning either the
original or the updated document.
>... | def find_one_and_update(self, filter, update,
projection=None, sort=None, upsert=False,
return_document=ReturnDocument.BEFORE, **kwargs):
"""Finds a single document and updates it, returning either the
original or the updated document.
>... | [
"Finds",
"a",
"single",
"document",
"and",
"updates",
"it",
"returning",
"either",
"the",
"original",
"or",
"the",
"updated",
"document",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L2359-L2454 | [
"def",
"find_one_and_update",
"(",
"self",
",",
"filter",
",",
"update",
",",
"projection",
"=",
"None",
",",
"sort",
"=",
"None",
",",
"upsert",
"=",
"False",
",",
"return_document",
"=",
"ReturnDocument",
".",
"BEFORE",
",",
"*",
"*",
"kwargs",
")",
":... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Collection.save | Save a document in this collection.
**DEPRECATED** - Use :meth:`insert_one` or :meth:`replace_one` instead.
.. versionchanged:: 3.0
Removed the `safe` parameter. Pass ``w=0`` for unacknowledged write
operations. | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def save(self, to_save, manipulate=True, check_keys=True, **kwargs):
"""Save a document in this collection.
**DEPRECATED** - Use :meth:`insert_one` or :meth:`replace_one` instead.
.. versionchanged:: 3.0
Removed the `safe` parameter. Pass ``w=0`` for unacknowledged write
... | def save(self, to_save, manipulate=True, check_keys=True, **kwargs):
"""Save a document in this collection.
**DEPRECATED** - Use :meth:`insert_one` or :meth:`replace_one` instead.
.. versionchanged:: 3.0
Removed the `safe` parameter. Pass ``w=0`` for unacknowledged write
... | [
"Save",
"a",
"document",
"in",
"this",
"collection",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L2456-L2482 | [
"def",
"save",
"(",
"self",
",",
"to_save",
",",
"manipulate",
"=",
"True",
",",
"check_keys",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"warnings",
".",
"warn",
"(",
"\"save is deprecated. Use insert_one or replace_one \"",
"\"instead\"",
",",
"Deprecatio... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Collection.insert | Insert a document(s) into this collection.
**DEPRECATED** - Use :meth:`insert_one` or :meth:`insert_many` instead.
.. versionchanged:: 3.0
Removed the `safe` parameter. Pass ``w=0`` for unacknowledged write
operations. | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def insert(self, doc_or_docs, manipulate=True,
check_keys=True, continue_on_error=False, **kwargs):
"""Insert a document(s) into this collection.
**DEPRECATED** - Use :meth:`insert_one` or :meth:`insert_many` instead.
.. versionchanged:: 3.0
Removed the `safe` paramet... | def insert(self, doc_or_docs, manipulate=True,
check_keys=True, continue_on_error=False, **kwargs):
"""Insert a document(s) into this collection.
**DEPRECATED** - Use :meth:`insert_one` or :meth:`insert_many` instead.
.. versionchanged:: 3.0
Removed the `safe` paramet... | [
"Insert",
"a",
"document",
"(",
"s",
")",
"into",
"this",
"collection",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L2484-L2501 | [
"def",
"insert",
"(",
"self",
",",
"doc_or_docs",
",",
"manipulate",
"=",
"True",
",",
"check_keys",
"=",
"True",
",",
"continue_on_error",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"warnings",
".",
"warn",
"(",
"\"insert is deprecated. Use insert_one o... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Collection.update | Update a document(s) in this collection.
**DEPRECATED** - Use :meth:`replace_one`, :meth:`update_one`, or
:meth:`update_many` instead.
.. versionchanged:: 3.0
Removed the `safe` parameter. Pass ``w=0`` for unacknowledged write
operations. | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def update(self, spec, document, upsert=False, manipulate=False,
multi=False, check_keys=True, **kwargs):
"""Update a document(s) in this collection.
**DEPRECATED** - Use :meth:`replace_one`, :meth:`update_one`, or
:meth:`update_many` instead.
.. versionchanged:: 3.0
... | def update(self, spec, document, upsert=False, manipulate=False,
multi=False, check_keys=True, **kwargs):
"""Update a document(s) in this collection.
**DEPRECATED** - Use :meth:`replace_one`, :meth:`update_one`, or
:meth:`update_many` instead.
.. versionchanged:: 3.0
... | [
"Update",
"a",
"document",
"(",
"s",
")",
"in",
"this",
"collection",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L2503-L2535 | [
"def",
"update",
"(",
"self",
",",
"spec",
",",
"document",
",",
"upsert",
"=",
"False",
",",
"manipulate",
"=",
"False",
",",
"multi",
"=",
"False",
",",
"check_keys",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"warnings",
".",
"warn",
"(",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Collection.remove | Remove a document(s) from this collection.
**DEPRECATED** - Use :meth:`delete_one` or :meth:`delete_many` instead.
.. versionchanged:: 3.0
Removed the `safe` parameter. Pass ``w=0`` for unacknowledged write
operations. | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def remove(self, spec_or_id=None, multi=True, **kwargs):
"""Remove a document(s) from this collection.
**DEPRECATED** - Use :meth:`delete_one` or :meth:`delete_many` instead.
.. versionchanged:: 3.0
Removed the `safe` parameter. Pass ``w=0`` for unacknowledged write
opera... | def remove(self, spec_or_id=None, multi=True, **kwargs):
"""Remove a document(s) from this collection.
**DEPRECATED** - Use :meth:`delete_one` or :meth:`delete_many` instead.
.. versionchanged:: 3.0
Removed the `safe` parameter. Pass ``w=0`` for unacknowledged write
opera... | [
"Remove",
"a",
"document",
"(",
"s",
")",
"from",
"this",
"collection",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L2537-L2558 | [
"def",
"remove",
"(",
"self",
",",
"spec_or_id",
"=",
"None",
",",
"multi",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"warnings",
".",
"warn",
"(",
"\"remove is deprecated. Use delete_one or delete_many \"",
"\"instead.\"",
",",
"DeprecationWarning",
",",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Collection.find_and_modify | Update and return an object.
**DEPRECATED** - Use :meth:`find_one_and_delete`,
:meth:`find_one_and_replace`, or :meth:`find_one_and_update` instead. | tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py | def find_and_modify(self, query={}, update=None,
upsert=False, sort=None, full_response=False,
manipulate=False, **kwargs):
"""Update and return an object.
**DEPRECATED** - Use :meth:`find_one_and_delete`,
:meth:`find_one_and_replace`, or :meth:`f... | def find_and_modify(self, query={}, update=None,
upsert=False, sort=None, full_response=False,
manipulate=False, **kwargs):
"""Update and return an object.
**DEPRECATED** - Use :meth:`find_one_and_delete`,
:meth:`find_one_and_replace`, or :meth:`f... | [
"Update",
"and",
"return",
"an",
"object",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/collection.py#L2560-L2634 | [
"def",
"find_and_modify",
"(",
"self",
",",
"query",
"=",
"{",
"}",
",",
"update",
"=",
"None",
",",
"upsert",
"=",
"False",
",",
"sort",
"=",
"None",
",",
"full_response",
"=",
"False",
",",
"manipulate",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Regex.from_native | Convert a Python regular expression into a ``Regex`` instance.
Note that in Python 3, a regular expression compiled from a
:class:`str` has the ``re.UNICODE`` flag set. If it is undesirable
to store this flag in a BSON regular expression, unset it first::
>>> pattern = re.compile('.*... | tokumx/datadog_checks/tokumx/vendor/bson/regex.py | def from_native(cls, regex):
"""Convert a Python regular expression into a ``Regex`` instance.
Note that in Python 3, a regular expression compiled from a
:class:`str` has the ``re.UNICODE`` flag set. If it is undesirable
to store this flag in a BSON regular expression, unset it first::... | def from_native(cls, regex):
"""Convert a Python regular expression into a ``Regex`` instance.
Note that in Python 3, a regular expression compiled from a
:class:`str` has the ``re.UNICODE`` flag set. If it is undesirable
to store this flag in a BSON regular expression, unset it first::... | [
"Convert",
"a",
"Python",
"regular",
"expression",
"into",
"a",
"Regex",
"instance",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/regex.py#L47-L76 | [
"def",
"from_native",
"(",
"cls",
",",
"regex",
")",
":",
"if",
"not",
"isinstance",
"(",
"regex",
",",
"RE_TYPE",
")",
":",
"raise",
"TypeError",
"(",
"\"regex must be a compiled regular expression, not %s\"",
"%",
"type",
"(",
"regex",
")",
")",
"return",
"R... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _get_int | Decode a BSON int32 to python int. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _get_int(data, position, dummy0, dummy1, dummy2):
"""Decode a BSON int32 to python int."""
end = position + 4
return _UNPACK_INT(data[position:end])[0], end | def _get_int(data, position, dummy0, dummy1, dummy2):
"""Decode a BSON int32 to python int."""
end = position + 4
return _UNPACK_INT(data[position:end])[0], end | [
"Decode",
"a",
"BSON",
"int32",
"to",
"python",
"int",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L105-L108 | [
"def",
"_get_int",
"(",
"data",
",",
"position",
",",
"dummy0",
",",
"dummy1",
",",
"dummy2",
")",
":",
"end",
"=",
"position",
"+",
"4",
"return",
"_UNPACK_INT",
"(",
"data",
"[",
"position",
":",
"end",
"]",
")",
"[",
"0",
"]",
",",
"end"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _get_float | Decode a BSON double to python float. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _get_float(data, position, dummy0, dummy1, dummy2):
"""Decode a BSON double to python float."""
end = position + 8
return _UNPACK_FLOAT(data[position:end])[0], end | def _get_float(data, position, dummy0, dummy1, dummy2):
"""Decode a BSON double to python float."""
end = position + 8
return _UNPACK_FLOAT(data[position:end])[0], end | [
"Decode",
"a",
"BSON",
"double",
"to",
"python",
"float",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L118-L121 | [
"def",
"_get_float",
"(",
"data",
",",
"position",
",",
"dummy0",
",",
"dummy1",
",",
"dummy2",
")",
":",
"end",
"=",
"position",
"+",
"8",
"return",
"_UNPACK_FLOAT",
"(",
"data",
"[",
"position",
":",
"end",
"]",
")",
"[",
"0",
"]",
",",
"end"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _get_object | Decode a BSON subdocument to opts.document_class or bson.dbref.DBRef. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _get_object(data, position, obj_end, opts, dummy):
"""Decode a BSON subdocument to opts.document_class or bson.dbref.DBRef."""
obj_size = _UNPACK_INT(data[position:position + 4])[0]
end = position + obj_size - 1
if data[end:position + obj_size] != b"\x00":
raise InvalidBSON("bad eoo")
if... | def _get_object(data, position, obj_end, opts, dummy):
"""Decode a BSON subdocument to opts.document_class or bson.dbref.DBRef."""
obj_size = _UNPACK_INT(data[position:position + 4])[0]
end = position + obj_size - 1
if data[end:position + obj_size] != b"\x00":
raise InvalidBSON("bad eoo")
if... | [
"Decode",
"a",
"BSON",
"subdocument",
"to",
"opts",
".",
"document_class",
"or",
"bson",
".",
"dbref",
".",
"DBRef",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L137-L155 | [
"def",
"_get_object",
"(",
"data",
",",
"position",
",",
"obj_end",
",",
"opts",
",",
"dummy",
")",
":",
"obj_size",
"=",
"_UNPACK_INT",
"(",
"data",
"[",
"position",
":",
"position",
"+",
"4",
"]",
")",
"[",
"0",
"]",
"end",
"=",
"position",
"+",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _get_array | Decode a BSON array to python list. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _get_array(data, position, obj_end, opts, element_name):
"""Decode a BSON array to python list."""
size = _UNPACK_INT(data[position:position + 4])[0]
end = position + size - 1
if data[end:end + 1] != b"\x00":
raise InvalidBSON("bad eoo")
position += 4
end -= 1
result = []
#... | def _get_array(data, position, obj_end, opts, element_name):
"""Decode a BSON array to python list."""
size = _UNPACK_INT(data[position:position + 4])[0]
end = position + size - 1
if data[end:end + 1] != b"\x00":
raise InvalidBSON("bad eoo")
position += 4
end -= 1
result = []
#... | [
"Decode",
"a",
"BSON",
"array",
"to",
"python",
"list",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L158-L187 | [
"def",
"_get_array",
"(",
"data",
",",
"position",
",",
"obj_end",
",",
"opts",
",",
"element_name",
")",
":",
"size",
"=",
"_UNPACK_INT",
"(",
"data",
"[",
"position",
":",
"position",
"+",
"4",
"]",
")",
"[",
"0",
"]",
"end",
"=",
"position",
"+",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _get_binary | Decode a BSON binary to bson.binary.Binary or python UUID. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _get_binary(data, position, obj_end, opts, dummy1):
"""Decode a BSON binary to bson.binary.Binary or python UUID."""
length, subtype = _UNPACK_LENGTH_SUBTYPE(data[position:position + 5])
position += 5
if subtype == 2:
length2 = _UNPACK_INT(data[position:position + 4])[0]
position += ... | def _get_binary(data, position, obj_end, opts, dummy1):
"""Decode a BSON binary to bson.binary.Binary or python UUID."""
length, subtype = _UNPACK_LENGTH_SUBTYPE(data[position:position + 5])
position += 5
if subtype == 2:
length2 = _UNPACK_INT(data[position:position + 4])[0]
position += ... | [
"Decode",
"a",
"BSON",
"binary",
"to",
"bson",
".",
"binary",
".",
"Binary",
"or",
"python",
"UUID",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L190-L221 | [
"def",
"_get_binary",
"(",
"data",
",",
"position",
",",
"obj_end",
",",
"opts",
",",
"dummy1",
")",
":",
"length",
",",
"subtype",
"=",
"_UNPACK_LENGTH_SUBTYPE",
"(",
"data",
"[",
"position",
":",
"position",
"+",
"5",
"]",
")",
"position",
"+=",
"5",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _get_oid | Decode a BSON ObjectId to bson.objectid.ObjectId. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _get_oid(data, position, dummy0, dummy1, dummy2):
"""Decode a BSON ObjectId to bson.objectid.ObjectId."""
end = position + 12
return ObjectId(data[position:end]), end | def _get_oid(data, position, dummy0, dummy1, dummy2):
"""Decode a BSON ObjectId to bson.objectid.ObjectId."""
end = position + 12
return ObjectId(data[position:end]), end | [
"Decode",
"a",
"BSON",
"ObjectId",
"to",
"bson",
".",
"objectid",
".",
"ObjectId",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L224-L227 | [
"def",
"_get_oid",
"(",
"data",
",",
"position",
",",
"dummy0",
",",
"dummy1",
",",
"dummy2",
")",
":",
"end",
"=",
"position",
"+",
"12",
"return",
"ObjectId",
"(",
"data",
"[",
"position",
":",
"end",
"]",
")",
",",
"end"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _get_boolean | Decode a BSON true/false to python True/False. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _get_boolean(data, position, dummy0, dummy1, dummy2):
"""Decode a BSON true/false to python True/False."""
end = position + 1
boolean_byte = data[position:end]
if boolean_byte == b'\x00':
return False, end
elif boolean_byte == b'\x01':
return True, end
raise InvalidBSON('inva... | def _get_boolean(data, position, dummy0, dummy1, dummy2):
"""Decode a BSON true/false to python True/False."""
end = position + 1
boolean_byte = data[position:end]
if boolean_byte == b'\x00':
return False, end
elif boolean_byte == b'\x01':
return True, end
raise InvalidBSON('inva... | [
"Decode",
"a",
"BSON",
"true",
"/",
"false",
"to",
"python",
"True",
"/",
"False",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L230-L238 | [
"def",
"_get_boolean",
"(",
"data",
",",
"position",
",",
"dummy0",
",",
"dummy1",
",",
"dummy2",
")",
":",
"end",
"=",
"position",
"+",
"1",
"boolean_byte",
"=",
"data",
"[",
"position",
":",
"end",
"]",
"if",
"boolean_byte",
"==",
"b'\\x00'",
":",
"r... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _get_date | Decode a BSON datetime to python datetime.datetime. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _get_date(data, position, dummy0, opts, dummy1):
"""Decode a BSON datetime to python datetime.datetime."""
end = position + 8
millis = _UNPACK_LONG(data[position:end])[0]
return _millis_to_datetime(millis, opts), end | def _get_date(data, position, dummy0, opts, dummy1):
"""Decode a BSON datetime to python datetime.datetime."""
end = position + 8
millis = _UNPACK_LONG(data[position:end])[0]
return _millis_to_datetime(millis, opts), end | [
"Decode",
"a",
"BSON",
"datetime",
"to",
"python",
"datetime",
".",
"datetime",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L241-L245 | [
"def",
"_get_date",
"(",
"data",
",",
"position",
",",
"dummy0",
",",
"opts",
",",
"dummy1",
")",
":",
"end",
"=",
"position",
"+",
"8",
"millis",
"=",
"_UNPACK_LONG",
"(",
"data",
"[",
"position",
":",
"end",
"]",
")",
"[",
"0",
"]",
"return",
"_m... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _get_code | Decode a BSON code to bson.code.Code. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _get_code(data, position, obj_end, opts, element_name):
"""Decode a BSON code to bson.code.Code."""
code, position = _get_string(data, position, obj_end, opts, element_name)
return Code(code), position | def _get_code(data, position, obj_end, opts, element_name):
"""Decode a BSON code to bson.code.Code."""
code, position = _get_string(data, position, obj_end, opts, element_name)
return Code(code), position | [
"Decode",
"a",
"BSON",
"code",
"to",
"bson",
".",
"code",
".",
"Code",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L248-L251 | [
"def",
"_get_code",
"(",
"data",
",",
"position",
",",
"obj_end",
",",
"opts",
",",
"element_name",
")",
":",
"code",
",",
"position",
"=",
"_get_string",
"(",
"data",
",",
"position",
",",
"obj_end",
",",
"opts",
",",
"element_name",
")",
"return",
"Cod... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _get_code_w_scope | Decode a BSON code_w_scope to bson.code.Code. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _get_code_w_scope(data, position, obj_end, opts, element_name):
"""Decode a BSON code_w_scope to bson.code.Code."""
code_end = position + _UNPACK_INT(data[position:position + 4])[0]
code, position = _get_string(
data, position + 4, code_end, opts, element_name)
scope, position = _get_object(... | def _get_code_w_scope(data, position, obj_end, opts, element_name):
"""Decode a BSON code_w_scope to bson.code.Code."""
code_end = position + _UNPACK_INT(data[position:position + 4])[0]
code, position = _get_string(
data, position + 4, code_end, opts, element_name)
scope, position = _get_object(... | [
"Decode",
"a",
"BSON",
"code_w_scope",
"to",
"bson",
".",
"code",
".",
"Code",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L254-L262 | [
"def",
"_get_code_w_scope",
"(",
"data",
",",
"position",
",",
"obj_end",
",",
"opts",
",",
"element_name",
")",
":",
"code_end",
"=",
"position",
"+",
"_UNPACK_INT",
"(",
"data",
"[",
"position",
":",
"position",
"+",
"4",
"]",
")",
"[",
"0",
"]",
"co... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _get_ref | Decode (deprecated) BSON DBPointer to bson.dbref.DBRef. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _get_ref(data, position, obj_end, opts, element_name):
"""Decode (deprecated) BSON DBPointer to bson.dbref.DBRef."""
collection, position = _get_string(
data, position, obj_end, opts, element_name)
oid, position = _get_oid(data, position, obj_end, opts, element_name)
return DBRef(collection,... | def _get_ref(data, position, obj_end, opts, element_name):
"""Decode (deprecated) BSON DBPointer to bson.dbref.DBRef."""
collection, position = _get_string(
data, position, obj_end, opts, element_name)
oid, position = _get_oid(data, position, obj_end, opts, element_name)
return DBRef(collection,... | [
"Decode",
"(",
"deprecated",
")",
"BSON",
"DBPointer",
"to",
"bson",
".",
"dbref",
".",
"DBRef",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L273-L278 | [
"def",
"_get_ref",
"(",
"data",
",",
"position",
",",
"obj_end",
",",
"opts",
",",
"element_name",
")",
":",
"collection",
",",
"position",
"=",
"_get_string",
"(",
"data",
",",
"position",
",",
"obj_end",
",",
"opts",
",",
"element_name",
")",
"oid",
",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _get_timestamp | Decode a BSON timestamp to bson.timestamp.Timestamp. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _get_timestamp(data, position, dummy0, dummy1, dummy2):
"""Decode a BSON timestamp to bson.timestamp.Timestamp."""
end = position + 8
inc, timestamp = _UNPACK_TIMESTAMP(data[position:end])
return Timestamp(timestamp, inc), end | def _get_timestamp(data, position, dummy0, dummy1, dummy2):
"""Decode a BSON timestamp to bson.timestamp.Timestamp."""
end = position + 8
inc, timestamp = _UNPACK_TIMESTAMP(data[position:end])
return Timestamp(timestamp, inc), end | [
"Decode",
"a",
"BSON",
"timestamp",
"to",
"bson",
".",
"timestamp",
".",
"Timestamp",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L281-L285 | [
"def",
"_get_timestamp",
"(",
"data",
",",
"position",
",",
"dummy0",
",",
"dummy1",
",",
"dummy2",
")",
":",
"end",
"=",
"position",
"+",
"8",
"inc",
",",
"timestamp",
"=",
"_UNPACK_TIMESTAMP",
"(",
"data",
"[",
"position",
":",
"end",
"]",
")",
"retu... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _get_int64 | Decode a BSON int64 to bson.int64.Int64. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _get_int64(data, position, dummy0, dummy1, dummy2):
"""Decode a BSON int64 to bson.int64.Int64."""
end = position + 8
return Int64(_UNPACK_LONG(data[position:end])[0]), end | def _get_int64(data, position, dummy0, dummy1, dummy2):
"""Decode a BSON int64 to bson.int64.Int64."""
end = position + 8
return Int64(_UNPACK_LONG(data[position:end])[0]), end | [
"Decode",
"a",
"BSON",
"int64",
"to",
"bson",
".",
"int64",
".",
"Int64",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L288-L291 | [
"def",
"_get_int64",
"(",
"data",
",",
"position",
",",
"dummy0",
",",
"dummy1",
",",
"dummy2",
")",
":",
"end",
"=",
"position",
"+",
"8",
"return",
"Int64",
"(",
"_UNPACK_LONG",
"(",
"data",
"[",
"position",
":",
"end",
"]",
")",
"[",
"0",
"]",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _get_decimal128 | Decode a BSON decimal128 to bson.decimal128.Decimal128. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _get_decimal128(data, position, dummy0, dummy1, dummy2):
"""Decode a BSON decimal128 to bson.decimal128.Decimal128."""
end = position + 16
return Decimal128.from_bid(data[position:end]), end | def _get_decimal128(data, position, dummy0, dummy1, dummy2):
"""Decode a BSON decimal128 to bson.decimal128.Decimal128."""
end = position + 16
return Decimal128.from_bid(data[position:end]), end | [
"Decode",
"a",
"BSON",
"decimal128",
"to",
"bson",
".",
"decimal128",
".",
"Decimal128",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L294-L297 | [
"def",
"_get_decimal128",
"(",
"data",
",",
"position",
",",
"dummy0",
",",
"dummy1",
",",
"dummy2",
")",
":",
"end",
"=",
"position",
"+",
"16",
"return",
"Decimal128",
".",
"from_bid",
"(",
"data",
"[",
"position",
":",
"end",
"]",
")",
",",
"end"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _element_to_dict | Decode a single key, value pair. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _element_to_dict(data, position, obj_end, opts):
"""Decode a single key, value pair."""
element_type = data[position:position + 1]
position += 1
element_name, position = _get_c_string(data, position, opts)
try:
value, position = _ELEMENT_GETTER[element_type](data, position,
... | def _element_to_dict(data, position, obj_end, opts):
"""Decode a single key, value pair."""
element_type = data[position:position + 1]
position += 1
element_name, position = _get_c_string(data, position, opts)
try:
value, position = _ELEMENT_GETTER[element_type](data, position,
... | [
"Decode",
"a",
"single",
"key",
"value",
"pair",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L329-L340 | [
"def",
"_element_to_dict",
"(",
"data",
",",
"position",
",",
"obj_end",
",",
"opts",
")",
":",
"element_type",
"=",
"data",
"[",
"position",
":",
"position",
"+",
"1",
"]",
"position",
"+=",
"1",
"element_name",
",",
"position",
"=",
"_get_c_string",
"(",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _elements_to_dict | Decode a BSON document. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _elements_to_dict(data, position, obj_end, opts):
"""Decode a BSON document."""
result = opts.document_class()
pos = position
for key, value, pos in _iterate_elements(data, position, obj_end, opts):
result[key] = value
if pos != obj_end:
raise InvalidBSON('bad object or element l... | def _elements_to_dict(data, position, obj_end, opts):
"""Decode a BSON document."""
result = opts.document_class()
pos = position
for key, value, pos in _iterate_elements(data, position, obj_end, opts):
result[key] = value
if pos != obj_end:
raise InvalidBSON('bad object or element l... | [
"Decode",
"a",
"BSON",
"document",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L352-L360 | [
"def",
"_elements_to_dict",
"(",
"data",
",",
"position",
",",
"obj_end",
",",
"opts",
")",
":",
"result",
"=",
"opts",
".",
"document_class",
"(",
")",
"pos",
"=",
"position",
"for",
"key",
",",
"value",
",",
"pos",
"in",
"_iterate_elements",
"(",
"data... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | gen_list_name | Generate "keys" for encoded lists in the sequence
b"0\x00", b"1\x00", b"2\x00", ...
The first 1000 keys are returned from a pre-built cache. All
subsequent keys are generated on the fly. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def gen_list_name():
"""Generate "keys" for encoded lists in the sequence
b"0\x00", b"1\x00", b"2\x00", ...
The first 1000 keys are returned from a pre-built cache. All
subsequent keys are generated on the fly.
"""
for name in _LIST_NAMES:
yield name
counter = itertools.count(1000)... | def gen_list_name():
"""Generate "keys" for encoded lists in the sequence
b"0\x00", b"1\x00", b"2\x00", ...
The first 1000 keys are returned from a pre-built cache. All
subsequent keys are generated on the fly.
"""
for name in _LIST_NAMES:
yield name
counter = itertools.count(1000)... | [
"Generate",
"keys",
"for",
"encoded",
"lists",
"in",
"the",
"sequence",
"b",
"0",
"\\",
"x00",
"b",
"1",
"\\",
"x00",
"b",
"2",
"\\",
"x00",
"..."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L395-L407 | [
"def",
"gen_list_name",
"(",
")",
":",
"for",
"name",
"in",
"_LIST_NAMES",
":",
"yield",
"name",
"counter",
"=",
"itertools",
".",
"count",
"(",
"1000",
")",
"while",
"True",
":",
"yield",
"b",
"(",
"str",
"(",
"next",
"(",
"counter",
")",
")",
")",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _make_c_string_check | Make a 'C' string, checking for embedded NUL characters. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _make_c_string_check(string):
"""Make a 'C' string, checking for embedded NUL characters."""
if isinstance(string, bytes):
if b"\x00" in string:
raise InvalidDocument("BSON keys / regex patterns must not "
"contain a NUL character")
try:
... | def _make_c_string_check(string):
"""Make a 'C' string, checking for embedded NUL characters."""
if isinstance(string, bytes):
if b"\x00" in string:
raise InvalidDocument("BSON keys / regex patterns must not "
"contain a NUL character")
try:
... | [
"Make",
"a",
"C",
"string",
"checking",
"for",
"embedded",
"NUL",
"characters",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L410-L426 | [
"def",
"_make_c_string_check",
"(",
"string",
")",
":",
"if",
"isinstance",
"(",
"string",
",",
"bytes",
")",
":",
"if",
"b\"\\x00\"",
"in",
"string",
":",
"raise",
"InvalidDocument",
"(",
"\"BSON keys / regex patterns must not \"",
"\"contain a NUL character\"",
")",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _make_c_string | Make a 'C' string. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _make_c_string(string):
"""Make a 'C' string."""
if isinstance(string, bytes):
try:
_utf_8_decode(string, None, True)
return string + b"\x00"
except UnicodeError:
raise InvalidStringData("strings in documents must be valid "
... | def _make_c_string(string):
"""Make a 'C' string."""
if isinstance(string, bytes):
try:
_utf_8_decode(string, None, True)
return string + b"\x00"
except UnicodeError:
raise InvalidStringData("strings in documents must be valid "
... | [
"Make",
"a",
"C",
"string",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L429-L439 | [
"def",
"_make_c_string",
"(",
"string",
")",
":",
"if",
"isinstance",
"(",
"string",
",",
"bytes",
")",
":",
"try",
":",
"_utf_8_decode",
"(",
"string",
",",
"None",
",",
"True",
")",
"return",
"string",
"+",
"b\"\\x00\"",
"except",
"UnicodeError",
":",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _encode_dbref | Encode bson.dbref.DBRef. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _encode_dbref(name, value, check_keys, opts):
"""Encode bson.dbref.DBRef."""
buf = bytearray(b"\x03" + name + b"\x00\x00\x00\x00")
begin = len(buf) - 4
buf += _name_value_to_bson(b"$ref\x00",
value.collection, check_keys, opts)
buf += _name_value_to_bson(b"$id\x00... | def _encode_dbref(name, value, check_keys, opts):
"""Encode bson.dbref.DBRef."""
buf = bytearray(b"\x03" + name + b"\x00\x00\x00\x00")
begin = len(buf) - 4
buf += _name_value_to_bson(b"$ref\x00",
value.collection, check_keys, opts)
buf += _name_value_to_bson(b"$id\x00... | [
"Encode",
"bson",
".",
"dbref",
".",
"DBRef",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L485-L502 | [
"def",
"_encode_dbref",
"(",
"name",
",",
"value",
",",
"check_keys",
",",
"opts",
")",
":",
"buf",
"=",
"bytearray",
"(",
"b\"\\x03\"",
"+",
"name",
"+",
"b\"\\x00\\x00\\x00\\x00\"",
")",
"begin",
"=",
"len",
"(",
"buf",
")",
"-",
"4",
"buf",
"+=",
"_... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _encode_list | Encode a list/tuple. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _encode_list(name, value, check_keys, opts):
"""Encode a list/tuple."""
lname = gen_list_name()
data = b"".join([_name_value_to_bson(next(lname), item,
check_keys, opts)
for item in value])
return b"\x04" + name + _PACK_INT(len(data) + 5)... | def _encode_list(name, value, check_keys, opts):
"""Encode a list/tuple."""
lname = gen_list_name()
data = b"".join([_name_value_to_bson(next(lname), item,
check_keys, opts)
for item in value])
return b"\x04" + name + _PACK_INT(len(data) + 5)... | [
"Encode",
"a",
"list",
"/",
"tuple",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L505-L511 | [
"def",
"_encode_list",
"(",
"name",
",",
"value",
",",
"check_keys",
",",
"opts",
")",
":",
"lname",
"=",
"gen_list_name",
"(",
")",
"data",
"=",
"b\"\"",
".",
"join",
"(",
"[",
"_name_value_to_bson",
"(",
"next",
"(",
"lname",
")",
",",
"item",
",",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _encode_text | Encode a python unicode (python 2.x) / str (python 3.x). | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _encode_text(name, value, dummy0, dummy1):
"""Encode a python unicode (python 2.x) / str (python 3.x)."""
value = _utf_8_encode(value)[0]
return b"\x02" + name + _PACK_INT(len(value) + 1) + value + b"\x00" | def _encode_text(name, value, dummy0, dummy1):
"""Encode a python unicode (python 2.x) / str (python 3.x)."""
value = _utf_8_encode(value)[0]
return b"\x02" + name + _PACK_INT(len(value) + 1) + value + b"\x00" | [
"Encode",
"a",
"python",
"unicode",
"(",
"python",
"2",
".",
"x",
")",
"/",
"str",
"(",
"python",
"3",
".",
"x",
")",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L514-L517 | [
"def",
"_encode_text",
"(",
"name",
",",
"value",
",",
"dummy0",
",",
"dummy1",
")",
":",
"value",
"=",
"_utf_8_encode",
"(",
"value",
")",
"[",
"0",
"]",
"return",
"b\"\\x02\"",
"+",
"name",
"+",
"_PACK_INT",
"(",
"len",
"(",
"value",
")",
"+",
"1",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _encode_binary | Encode bson.binary.Binary. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _encode_binary(name, value, dummy0, dummy1):
"""Encode bson.binary.Binary."""
subtype = value.subtype
if subtype == 2:
value = _PACK_INT(len(value)) + value
return b"\x05" + name + _PACK_LENGTH_SUBTYPE(len(value), subtype) + value | def _encode_binary(name, value, dummy0, dummy1):
"""Encode bson.binary.Binary."""
subtype = value.subtype
if subtype == 2:
value = _PACK_INT(len(value)) + value
return b"\x05" + name + _PACK_LENGTH_SUBTYPE(len(value), subtype) + value | [
"Encode",
"bson",
".",
"binary",
".",
"Binary",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L520-L525 | [
"def",
"_encode_binary",
"(",
"name",
",",
"value",
",",
"dummy0",
",",
"dummy1",
")",
":",
"subtype",
"=",
"value",
".",
"subtype",
"if",
"subtype",
"==",
"2",
":",
"value",
"=",
"_PACK_INT",
"(",
"len",
"(",
"value",
")",
")",
"+",
"value",
"return... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _encode_uuid | Encode uuid.UUID. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _encode_uuid(name, value, dummy, opts):
"""Encode uuid.UUID."""
uuid_representation = opts.uuid_representation
# Python Legacy Common Case
if uuid_representation == OLD_UUID_SUBTYPE:
return b"\x05" + name + b'\x10\x00\x00\x00\x03' + value.bytes
# Java Legacy
elif uuid_representation ... | def _encode_uuid(name, value, dummy, opts):
"""Encode uuid.UUID."""
uuid_representation = opts.uuid_representation
# Python Legacy Common Case
if uuid_representation == OLD_UUID_SUBTYPE:
return b"\x05" + name + b'\x10\x00\x00\x00\x03' + value.bytes
# Java Legacy
elif uuid_representation ... | [
"Encode",
"uuid",
".",
"UUID",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L528-L545 | [
"def",
"_encode_uuid",
"(",
"name",
",",
"value",
",",
"dummy",
",",
"opts",
")",
":",
"uuid_representation",
"=",
"opts",
".",
"uuid_representation",
"# Python Legacy Common Case",
"if",
"uuid_representation",
"==",
"OLD_UUID_SUBTYPE",
":",
"return",
"b\"\\x05\"",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _encode_bool | Encode a python boolean (True/False). | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _encode_bool(name, value, dummy0, dummy1):
"""Encode a python boolean (True/False)."""
return b"\x08" + name + (value and b"\x01" or b"\x00") | def _encode_bool(name, value, dummy0, dummy1):
"""Encode a python boolean (True/False)."""
return b"\x08" + name + (value and b"\x01" or b"\x00") | [
"Encode",
"a",
"python",
"boolean",
"(",
"True",
"/",
"False",
")",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L553-L555 | [
"def",
"_encode_bool",
"(",
"name",
",",
"value",
",",
"dummy0",
",",
"dummy1",
")",
":",
"return",
"b\"\\x08\"",
"+",
"name",
"+",
"(",
"value",
"and",
"b\"\\x01\"",
"or",
"b\"\\x00\"",
")"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _encode_datetime | Encode datetime.datetime. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _encode_datetime(name, value, dummy0, dummy1):
"""Encode datetime.datetime."""
millis = _datetime_to_millis(value)
return b"\x09" + name + _PACK_LONG(millis) | def _encode_datetime(name, value, dummy0, dummy1):
"""Encode datetime.datetime."""
millis = _datetime_to_millis(value)
return b"\x09" + name + _PACK_LONG(millis) | [
"Encode",
"datetime",
".",
"datetime",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L558-L561 | [
"def",
"_encode_datetime",
"(",
"name",
",",
"value",
",",
"dummy0",
",",
"dummy1",
")",
":",
"millis",
"=",
"_datetime_to_millis",
"(",
"value",
")",
"return",
"b\"\\x09\"",
"+",
"name",
"+",
"_PACK_LONG",
"(",
"millis",
")"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _encode_regex | Encode a python regex or bson.regex.Regex. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _encode_regex(name, value, dummy0, dummy1):
"""Encode a python regex or bson.regex.Regex."""
flags = value.flags
# Python 2 common case
if flags == 0:
return b"\x0B" + name + _make_c_string_check(value.pattern) + b"\x00"
# Python 3 common case
elif flags == re.UNICODE:
return... | def _encode_regex(name, value, dummy0, dummy1):
"""Encode a python regex or bson.regex.Regex."""
flags = value.flags
# Python 2 common case
if flags == 0:
return b"\x0B" + name + _make_c_string_check(value.pattern) + b"\x00"
# Python 3 common case
elif flags == re.UNICODE:
return... | [
"Encode",
"a",
"python",
"regex",
"or",
"bson",
".",
"regex",
".",
"Regex",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L569-L593 | [
"def",
"_encode_regex",
"(",
"name",
",",
"value",
",",
"dummy0",
",",
"dummy1",
")",
":",
"flags",
"=",
"value",
".",
"flags",
"# Python 2 common case",
"if",
"flags",
"==",
"0",
":",
"return",
"b\"\\x0B\"",
"+",
"name",
"+",
"_make_c_string_check",
"(",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _encode_int | Encode a python int. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _encode_int(name, value, dummy0, dummy1):
"""Encode a python int."""
if -2147483648 <= value <= 2147483647:
return b"\x10" + name + _PACK_INT(value)
else:
try:
return b"\x12" + name + _PACK_LONG(value)
except struct.error:
raise OverflowError("BSON can onl... | def _encode_int(name, value, dummy0, dummy1):
"""Encode a python int."""
if -2147483648 <= value <= 2147483647:
return b"\x10" + name + _PACK_INT(value)
else:
try:
return b"\x12" + name + _PACK_LONG(value)
except struct.error:
raise OverflowError("BSON can onl... | [
"Encode",
"a",
"python",
"int",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L607-L615 | [
"def",
"_encode_int",
"(",
"name",
",",
"value",
",",
"dummy0",
",",
"dummy1",
")",
":",
"if",
"-",
"2147483648",
"<=",
"value",
"<=",
"2147483647",
":",
"return",
"b\"\\x10\"",
"+",
"name",
"+",
"_PACK_INT",
"(",
"value",
")",
"else",
":",
"try",
":",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _encode_timestamp | Encode bson.timestamp.Timestamp. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _encode_timestamp(name, value, dummy0, dummy1):
"""Encode bson.timestamp.Timestamp."""
return b"\x11" + name + _PACK_TIMESTAMP(value.inc, value.time) | def _encode_timestamp(name, value, dummy0, dummy1):
"""Encode bson.timestamp.Timestamp."""
return b"\x11" + name + _PACK_TIMESTAMP(value.inc, value.time) | [
"Encode",
"bson",
".",
"timestamp",
".",
"Timestamp",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L618-L620 | [
"def",
"_encode_timestamp",
"(",
"name",
",",
"value",
",",
"dummy0",
",",
"dummy1",
")",
":",
"return",
"b\"\\x11\"",
"+",
"name",
"+",
"_PACK_TIMESTAMP",
"(",
"value",
".",
"inc",
",",
"value",
".",
"time",
")"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _encode_long | Encode a python long (python 2.x) | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _encode_long(name, value, dummy0, dummy1):
"""Encode a python long (python 2.x)"""
try:
return b"\x12" + name + _PACK_LONG(value)
except struct.error:
raise OverflowError("BSON can only handle up to 8-byte ints") | def _encode_long(name, value, dummy0, dummy1):
"""Encode a python long (python 2.x)"""
try:
return b"\x12" + name + _PACK_LONG(value)
except struct.error:
raise OverflowError("BSON can only handle up to 8-byte ints") | [
"Encode",
"a",
"python",
"long",
"(",
"python",
"2",
".",
"x",
")"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L623-L628 | [
"def",
"_encode_long",
"(",
"name",
",",
"value",
",",
"dummy0",
",",
"dummy1",
")",
":",
"try",
":",
"return",
"b\"\\x12\"",
"+",
"name",
"+",
"_PACK_LONG",
"(",
"value",
")",
"except",
"struct",
".",
"error",
":",
"raise",
"OverflowError",
"(",
"\"BSON... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _name_value_to_bson | Encode a single name, value pair. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _name_value_to_bson(name, value, check_keys, opts):
"""Encode a single name, value pair."""
# First see if the type is already cached. KeyError will only ever
# happen once per subtype.
try:
return _ENCODERS[type(value)](name, value, check_keys, opts)
except KeyError:
pass
... | def _name_value_to_bson(name, value, check_keys, opts):
"""Encode a single name, value pair."""
# First see if the type is already cached. KeyError will only ever
# happen once per subtype.
try:
return _ENCODERS[type(value)](name, value, check_keys, opts)
except KeyError:
pass
... | [
"Encode",
"a",
"single",
"name",
"value",
"pair",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L698-L728 | [
"def",
"_name_value_to_bson",
"(",
"name",
",",
"value",
",",
"check_keys",
",",
"opts",
")",
":",
"# First see if the type is already cached. KeyError will only ever",
"# happen once per subtype.",
"try",
":",
"return",
"_ENCODERS",
"[",
"type",
"(",
"value",
")",
"]",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _element_to_bson | Encode a single key, value pair. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _element_to_bson(key, value, check_keys, opts):
"""Encode a single key, value pair."""
if not isinstance(key, string_type):
raise InvalidDocument("documents must have only string keys, "
"key was %r" % (key,))
if check_keys:
if key.startswith("$"):
... | def _element_to_bson(key, value, check_keys, opts):
"""Encode a single key, value pair."""
if not isinstance(key, string_type):
raise InvalidDocument("documents must have only string keys, "
"key was %r" % (key,))
if check_keys:
if key.startswith("$"):
... | [
"Encode",
"a",
"single",
"key",
"value",
"pair",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L731-L743 | [
"def",
"_element_to_bson",
"(",
"key",
",",
"value",
",",
"check_keys",
",",
"opts",
")",
":",
"if",
"not",
"isinstance",
"(",
"key",
",",
"string_type",
")",
":",
"raise",
"InvalidDocument",
"(",
"\"documents must have only string keys, \"",
"\"key was %r\"",
"%"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _dict_to_bson | Encode a document to BSON. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _dict_to_bson(doc, check_keys, opts, top_level=True):
"""Encode a document to BSON."""
if _raw_document_class(doc):
return doc.raw
try:
elements = []
if top_level and "_id" in doc:
elements.append(_name_value_to_bson(b"_id\x00", doc["_id"],
... | def _dict_to_bson(doc, check_keys, opts, top_level=True):
"""Encode a document to BSON."""
if _raw_document_class(doc):
return doc.raw
try:
elements = []
if top_level and "_id" in doc:
elements.append(_name_value_to_bson(b"_id\x00", doc["_id"],
... | [
"Encode",
"a",
"document",
"to",
"BSON",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L746-L763 | [
"def",
"_dict_to_bson",
"(",
"doc",
",",
"check_keys",
",",
"opts",
",",
"top_level",
"=",
"True",
")",
":",
"if",
"_raw_document_class",
"(",
"doc",
")",
":",
"return",
"doc",
".",
"raw",
"try",
":",
"elements",
"=",
"[",
"]",
"if",
"top_level",
"and"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _millis_to_datetime | Convert milliseconds since epoch UTC to datetime. | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def _millis_to_datetime(millis, opts):
"""Convert milliseconds since epoch UTC to datetime."""
diff = ((millis % 1000) + 1000) % 1000
seconds = (millis - diff) / 1000
micros = diff * 1000
if opts.tz_aware:
dt = EPOCH_AWARE + datetime.timedelta(seconds=seconds,
... | def _millis_to_datetime(millis, opts):
"""Convert milliseconds since epoch UTC to datetime."""
diff = ((millis % 1000) + 1000) % 1000
seconds = (millis - diff) / 1000
micros = diff * 1000
if opts.tz_aware:
dt = EPOCH_AWARE + datetime.timedelta(seconds=seconds,
... | [
"Convert",
"milliseconds",
"since",
"epoch",
"UTC",
"to",
"datetime",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L768-L781 | [
"def",
"_millis_to_datetime",
"(",
"millis",
",",
"opts",
")",
":",
"diff",
"=",
"(",
"(",
"millis",
"%",
"1000",
")",
"+",
"1000",
")",
"%",
"1000",
"seconds",
"=",
"(",
"millis",
"-",
"diff",
")",
"/",
"1000",
"micros",
"=",
"diff",
"*",
"1000",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | decode_all | Decode BSON data to multiple documents.
`data` must be a string of concatenated, valid, BSON-encoded
documents.
:Parameters:
- `data`: BSON data
- `codec_options` (optional): An instance of
:class:`~bson.codec_options.CodecOptions`.
.. versionchanged:: 3.0
Removed `compile_... | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def decode_all(data, codec_options=DEFAULT_CODEC_OPTIONS):
"""Decode BSON data to multiple documents.
`data` must be a string of concatenated, valid, BSON-encoded
documents.
:Parameters:
- `data`: BSON data
- `codec_options` (optional): An instance of
:class:`~bson.codec_options.Co... | def decode_all(data, codec_options=DEFAULT_CODEC_OPTIONS):
"""Decode BSON data to multiple documents.
`data` must be a string of concatenated, valid, BSON-encoded
documents.
:Parameters:
- `data`: BSON data
- `codec_options` (optional): An instance of
:class:`~bson.codec_options.Co... | [
"Decode",
"BSON",
"data",
"to",
"multiple",
"documents",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L796-L856 | [
"def",
"decode_all",
"(",
"data",
",",
"codec_options",
"=",
"DEFAULT_CODEC_OPTIONS",
")",
":",
"if",
"not",
"isinstance",
"(",
"codec_options",
",",
"CodecOptions",
")",
":",
"raise",
"_CODEC_OPTIONS_TYPE_ERROR",
"docs",
"=",
"[",
"]",
"position",
"=",
"0",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | decode_iter | Decode BSON data to multiple documents as a generator.
Works similarly to the decode_all function, but yields one document at a
time.
`data` must be a string of concatenated, valid, BSON-encoded
documents.
:Parameters:
- `data`: BSON data
- `codec_options` (optional): An instance of
... | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def decode_iter(data, codec_options=DEFAULT_CODEC_OPTIONS):
"""Decode BSON data to multiple documents as a generator.
Works similarly to the decode_all function, but yields one document at a
time.
`data` must be a string of concatenated, valid, BSON-encoded
documents.
:Parameters:
- `da... | def decode_iter(data, codec_options=DEFAULT_CODEC_OPTIONS):
"""Decode BSON data to multiple documents as a generator.
Works similarly to the decode_all function, but yields one document at a
time.
`data` must be a string of concatenated, valid, BSON-encoded
documents.
:Parameters:
- `da... | [
"Decode",
"BSON",
"data",
"to",
"multiple",
"documents",
"as",
"a",
"generator",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L863-L893 | [
"def",
"decode_iter",
"(",
"data",
",",
"codec_options",
"=",
"DEFAULT_CODEC_OPTIONS",
")",
":",
"if",
"not",
"isinstance",
"(",
"codec_options",
",",
"CodecOptions",
")",
":",
"raise",
"_CODEC_OPTIONS_TYPE_ERROR",
"position",
"=",
"0",
"end",
"=",
"len",
"(",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | decode_file_iter | Decode bson data from a file to multiple documents as a generator.
Works similarly to the decode_all function, but reads from the file object
in chunks and parses bson in chunks, yielding one document at a time.
:Parameters:
- `file_obj`: A file object containing BSON data.
- `codec_options` (... | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def decode_file_iter(file_obj, codec_options=DEFAULT_CODEC_OPTIONS):
"""Decode bson data from a file to multiple documents as a generator.
Works similarly to the decode_all function, but reads from the file object
in chunks and parses bson in chunks, yielding one document at a time.
:Parameters:
... | def decode_file_iter(file_obj, codec_options=DEFAULT_CODEC_OPTIONS):
"""Decode bson data from a file to multiple documents as a generator.
Works similarly to the decode_all function, but reads from the file object
in chunks and parses bson in chunks, yielding one document at a time.
:Parameters:
... | [
"Decode",
"bson",
"data",
"from",
"a",
"file",
"to",
"multiple",
"documents",
"as",
"a",
"generator",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L896-L922 | [
"def",
"decode_file_iter",
"(",
"file_obj",
",",
"codec_options",
"=",
"DEFAULT_CODEC_OPTIONS",
")",
":",
"while",
"True",
":",
"# Read size of next object.",
"size_data",
"=",
"file_obj",
".",
"read",
"(",
"4",
")",
"if",
"len",
"(",
"size_data",
")",
"==",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | is_valid | Check that the given string represents valid :class:`BSON` data.
Raises :class:`TypeError` if `bson` is not an instance of
:class:`str` (:class:`bytes` in python 3). Returns ``True``
if `bson` is valid :class:`BSON`, ``False`` otherwise.
:Parameters:
- `bson`: the data to be validated | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def is_valid(bson):
"""Check that the given string represents valid :class:`BSON` data.
Raises :class:`TypeError` if `bson` is not an instance of
:class:`str` (:class:`bytes` in python 3). Returns ``True``
if `bson` is valid :class:`BSON`, ``False`` otherwise.
:Parameters:
- `bson`: the data... | def is_valid(bson):
"""Check that the given string represents valid :class:`BSON` data.
Raises :class:`TypeError` if `bson` is not an instance of
:class:`str` (:class:`bytes` in python 3). Returns ``True``
if `bson` is valid :class:`BSON`, ``False`` otherwise.
:Parameters:
- `bson`: the data... | [
"Check",
"that",
"the",
"given",
"string",
"represents",
"valid",
":",
"class",
":",
"BSON",
"data",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L925-L942 | [
"def",
"is_valid",
"(",
"bson",
")",
":",
"if",
"not",
"isinstance",
"(",
"bson",
",",
"bytes",
")",
":",
"raise",
"TypeError",
"(",
"\"BSON data must be an instance of a subclass of bytes\"",
")",
"try",
":",
"_bson_to_dict",
"(",
"bson",
",",
"DEFAULT_CODEC_OPTI... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | BSON.encode | Encode a document to a new :class:`BSON` instance.
A document can be any mapping type (like :class:`dict`).
Raises :class:`TypeError` if `document` is not a mapping type,
or contains keys that are not instances of
:class:`basestring` (:class:`str` in python 3). Raises
:class:`~... | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def encode(cls, document, check_keys=False,
codec_options=DEFAULT_CODEC_OPTIONS):
"""Encode a document to a new :class:`BSON` instance.
A document can be any mapping type (like :class:`dict`).
Raises :class:`TypeError` if `document` is not a mapping type,
or contains key... | def encode(cls, document, check_keys=False,
codec_options=DEFAULT_CODEC_OPTIONS):
"""Encode a document to a new :class:`BSON` instance.
A document can be any mapping type (like :class:`dict`).
Raises :class:`TypeError` if `document` is not a mapping type,
or contains key... | [
"Encode",
"a",
"document",
"to",
"a",
"new",
":",
"class",
":",
"BSON",
"instance",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L950-L976 | [
"def",
"encode",
"(",
"cls",
",",
"document",
",",
"check_keys",
"=",
"False",
",",
"codec_options",
"=",
"DEFAULT_CODEC_OPTIONS",
")",
":",
"if",
"not",
"isinstance",
"(",
"codec_options",
",",
"CodecOptions",
")",
":",
"raise",
"_CODEC_OPTIONS_TYPE_ERROR",
"re... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | BSON.decode | Decode this BSON data.
By default, returns a BSON document represented as a Python
:class:`dict`. To use a different :class:`MutableMapping` class,
configure a :class:`~bson.codec_options.CodecOptions`::
>>> import collections # From Python standard library.
>>> import... | tokumx/datadog_checks/tokumx/vendor/bson/__init__.py | def decode(self, codec_options=DEFAULT_CODEC_OPTIONS):
"""Decode this BSON data.
By default, returns a BSON document represented as a Python
:class:`dict`. To use a different :class:`MutableMapping` class,
configure a :class:`~bson.codec_options.CodecOptions`::
>>> import c... | def decode(self, codec_options=DEFAULT_CODEC_OPTIONS):
"""Decode this BSON data.
By default, returns a BSON document represented as a Python
:class:`dict`. To use a different :class:`MutableMapping` class,
configure a :class:`~bson.codec_options.CodecOptions`::
>>> import c... | [
"Decode",
"this",
"BSON",
"data",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L978-L1021 | [
"def",
"decode",
"(",
"self",
",",
"codec_options",
"=",
"DEFAULT_CODEC_OPTIONS",
")",
":",
"if",
"not",
"isinstance",
"(",
"codec_options",
",",
"CodecOptions",
")",
":",
"raise",
"_CODEC_OPTIONS_TYPE_ERROR",
"return",
"_bson_to_dict",
"(",
"self",
",",
"codec_op... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | subprocess_output | This is a stub to allow a check requiring `Popen` to run without an Agent (e.g. during tests or development),
it's not supposed to be used anywhere outside the `datadog_checks.utils` package. | datadog_checks_base/datadog_checks/base/stubs/_util.py | def subprocess_output(command, raise_on_empty_output):
"""
This is a stub to allow a check requiring `Popen` to run without an Agent (e.g. during tests or development),
it's not supposed to be used anywhere outside the `datadog_checks.utils` package.
"""
# Use tempfile, allowing a larger amount of ... | def subprocess_output(command, raise_on_empty_output):
"""
This is a stub to allow a check requiring `Popen` to run without an Agent (e.g. during tests or development),
it's not supposed to be used anywhere outside the `datadog_checks.utils` package.
"""
# Use tempfile, allowing a larger amount of ... | [
"This",
"is",
"a",
"stub",
"to",
"allow",
"a",
"check",
"requiring",
"Popen",
"to",
"run",
"without",
"an",
"Agent",
"(",
"e",
".",
"g",
".",
"during",
"tests",
"or",
"development",
")",
"it",
"s",
"not",
"supposed",
"to",
"be",
"used",
"anywhere",
"... | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/stubs/_util.py#L13-L33 | [
"def",
"subprocess_output",
"(",
"command",
",",
"raise_on_empty_output",
")",
":",
"# Use tempfile, allowing a larger amount of memory. The subprocess.Popen",
"# docs warn that the data read is buffered in memory. They suggest not to",
"# use subprocess.PIPE if the data size is large or unlimit... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _index_list | Helper to generate a list of (key, direction) pairs.
Takes such a list, or a single key, or a single key and direction. | tokumx/datadog_checks/tokumx/vendor/pymongo/helpers.py | def _index_list(key_or_list, direction=None):
"""Helper to generate a list of (key, direction) pairs.
Takes such a list, or a single key, or a single key and direction.
"""
if direction is not None:
return [(key_or_list, direction)]
else:
if isinstance(key_or_list, string_type):
... | def _index_list(key_or_list, direction=None):
"""Helper to generate a list of (key, direction) pairs.
Takes such a list, or a single key, or a single key and direction.
"""
if direction is not None:
return [(key_or_list, direction)]
else:
if isinstance(key_or_list, string_type):
... | [
"Helper",
"to",
"generate",
"a",
"list",
"of",
"(",
"key",
"direction",
")",
"pairs",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/helpers.py#L52-L65 | [
"def",
"_index_list",
"(",
"key_or_list",
",",
"direction",
"=",
"None",
")",
":",
"if",
"direction",
"is",
"not",
"None",
":",
"return",
"[",
"(",
"key_or_list",
",",
"direction",
")",
"]",
"else",
":",
"if",
"isinstance",
"(",
"key_or_list",
",",
"stri... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _unpack_response | Unpack a response from the database.
Check the response for errors and unpack, returning a dictionary
containing the response data.
Can raise CursorNotFound, NotMasterError, ExecutionTimeout, or
OperationFailure.
:Parameters:
- `response`: byte string as returned from the database
- `... | tokumx/datadog_checks/tokumx/vendor/pymongo/helpers.py | def _unpack_response(response,
cursor_id=None,
codec_options=_UNICODE_REPLACE_CODEC_OPTIONS):
"""Unpack a response from the database.
Check the response for errors and unpack, returning a dictionary
containing the response data.
Can raise CursorNotFound, NotMa... | def _unpack_response(response,
cursor_id=None,
codec_options=_UNICODE_REPLACE_CODEC_OPTIONS):
"""Unpack a response from the database.
Check the response for errors and unpack, returning a dictionary
containing the response data.
Can raise CursorNotFound, NotMa... | [
"Unpack",
"a",
"response",
"from",
"the",
"database",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/helpers.py#L95-L145 | [
"def",
"_unpack_response",
"(",
"response",
",",
"cursor_id",
"=",
"None",
",",
"codec_options",
"=",
"_UNICODE_REPLACE_CODEC_OPTIONS",
")",
":",
"response_flag",
"=",
"struct",
".",
"unpack",
"(",
"\"<i\"",
",",
"response",
"[",
":",
"4",
"]",
")",
"[",
"0"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _check_command_response | Check the response to a command for errors. | tokumx/datadog_checks/tokumx/vendor/pymongo/helpers.py | def _check_command_response(response, msg=None, allowable_errors=None,
parse_write_concern_error=False):
"""Check the response to a command for errors.
"""
if "ok" not in response:
# Server didn't recognize our message as a command.
raise OperationFailure(response... | def _check_command_response(response, msg=None, allowable_errors=None,
parse_write_concern_error=False):
"""Check the response to a command for errors.
"""
if "ok" not in response:
# Server didn't recognize our message as a command.
raise OperationFailure(response... | [
"Check",
"the",
"response",
"to",
"a",
"command",
"for",
"errors",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/helpers.py#L148-L210 | [
"def",
"_check_command_response",
"(",
"response",
",",
"msg",
"=",
"None",
",",
"allowable_errors",
"=",
"None",
",",
"parse_write_concern_error",
"=",
"False",
")",
":",
"if",
"\"ok\"",
"not",
"in",
"response",
":",
"# Server didn't recognize our message as a comman... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _first_batch | Simple query helper for retrieving a first (and possibly only) batch. | tokumx/datadog_checks/tokumx/vendor/pymongo/helpers.py | def _first_batch(sock_info, db, coll, query, ntoreturn,
slave_ok, codec_options, read_preference, cmd, listeners):
"""Simple query helper for retrieving a first (and possibly only) batch."""
query = _Query(
0, db, coll, 0, query, None, codec_options,
read_preference, ntoreturn, ... | def _first_batch(sock_info, db, coll, query, ntoreturn,
slave_ok, codec_options, read_preference, cmd, listeners):
"""Simple query helper for retrieving a first (and possibly only) batch."""
query = _Query(
0, db, coll, 0, query, None, codec_options,
read_preference, ntoreturn, ... | [
"Simple",
"query",
"helper",
"for",
"retrieving",
"a",
"first",
"(",
"and",
"possibly",
"only",
")",
"batch",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/helpers.py#L253-L294 | [
"def",
"_first_batch",
"(",
"sock_info",
",",
"db",
",",
"coll",
",",
"query",
",",
"ntoreturn",
",",
"slave_ok",
",",
"codec_options",
",",
"read_preference",
",",
"cmd",
",",
"listeners",
")",
":",
"query",
"=",
"_Query",
"(",
"0",
",",
"db",
",",
"c... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _check_write_command_response | Backward compatibility helper for write command error handling. | tokumx/datadog_checks/tokumx/vendor/pymongo/helpers.py | def _check_write_command_response(results):
"""Backward compatibility helper for write command error handling.
"""
errors = [res for res in results
if "writeErrors" in res[1] or "writeConcernError" in res[1]]
if errors:
# If multiple batches had errors
# raise from the last... | def _check_write_command_response(results):
"""Backward compatibility helper for write command error handling.
"""
errors = [res for res in results
if "writeErrors" in res[1] or "writeConcernError" in res[1]]
if errors:
# If multiple batches had errors
# raise from the last... | [
"Backward",
"compatibility",
"helper",
"for",
"write",
"command",
"error",
"handling",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/helpers.py#L297-L323 | [
"def",
"_check_write_command_response",
"(",
"results",
")",
":",
"errors",
"=",
"[",
"res",
"for",
"res",
"in",
"results",
"if",
"\"writeErrors\"",
"in",
"res",
"[",
"1",
"]",
"or",
"\"writeConcernError\"",
"in",
"res",
"[",
"1",
"]",
"]",
"if",
"errors",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _fields_list_to_dict | Takes a sequence of field names and returns a matching dictionary.
["a", "b"] becomes {"a": 1, "b": 1}
and
["a.b.c", "d", "a.c"] becomes {"a.b.c": 1, "d": 1, "a.c": 1} | tokumx/datadog_checks/tokumx/vendor/pymongo/helpers.py | def _fields_list_to_dict(fields, option_name):
"""Takes a sequence of field names and returns a matching dictionary.
["a", "b"] becomes {"a": 1, "b": 1}
and
["a.b.c", "d", "a.c"] becomes {"a.b.c": 1, "d": 1, "a.c": 1}
"""
if isinstance(fields, collections.Mapping):
return fields
... | def _fields_list_to_dict(fields, option_name):
"""Takes a sequence of field names and returns a matching dictionary.
["a", "b"] becomes {"a": 1, "b": 1}
and
["a.b.c", "d", "a.c"] becomes {"a.b.c": 1, "d": 1, "a.c": 1}
"""
if isinstance(fields, collections.Mapping):
return fields
... | [
"Takes",
"a",
"sequence",
"of",
"field",
"names",
"and",
"returns",
"a",
"matching",
"dictionary",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/helpers.py#L326-L346 | [
"def",
"_fields_list_to_dict",
"(",
"fields",
",",
"option_name",
")",
":",
"if",
"isinstance",
"(",
"fields",
",",
"collections",
".",
"Mapping",
")",
":",
"return",
"fields",
"if",
"isinstance",
"(",
"fields",
",",
"collections",
".",
"Sequence",
")",
":",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _handle_exception | Print exceptions raised by subscribers to stderr. | tokumx/datadog_checks/tokumx/vendor/pymongo/helpers.py | def _handle_exception():
"""Print exceptions raised by subscribers to stderr."""
# Heavily influenced by logging.Handler.handleError.
# See note here:
# https://docs.python.org/3.4/library/sys.html#sys.__stderr__
if sys.stderr:
einfo = sys.exc_info()
try:
traceback.print... | def _handle_exception():
"""Print exceptions raised by subscribers to stderr."""
# Heavily influenced by logging.Handler.handleError.
# See note here:
# https://docs.python.org/3.4/library/sys.html#sys.__stderr__
if sys.stderr:
einfo = sys.exc_info()
try:
traceback.print... | [
"Print",
"exceptions",
"raised",
"by",
"subscribers",
"to",
"stderr",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/helpers.py#L349-L363 | [
"def",
"_handle_exception",
"(",
")",
":",
"# Heavily influenced by logging.Handler.handleError.",
"# See note here:",
"# https://docs.python.org/3.4/library/sys.html#sys.__stderr__",
"if",
"sys",
".",
"stderr",
":",
"einfo",
"=",
"sys",
".",
"exc_info",
"(",
")",
"try",
":... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | KubernetesState._create_kubernetes_state_prometheus_instance | Set up the kubernetes_state instance so it can be used in OpenMetricsBaseCheck | kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py | def _create_kubernetes_state_prometheus_instance(self, instance):
"""
Set up the kubernetes_state instance so it can be used in OpenMetricsBaseCheck
"""
ksm_instance = deepcopy(instance)
endpoint = instance.get('kube_state_url')
if endpoint is None:
raise Chec... | def _create_kubernetes_state_prometheus_instance(self, instance):
"""
Set up the kubernetes_state instance so it can be used in OpenMetricsBaseCheck
"""
ksm_instance = deepcopy(instance)
endpoint = instance.get('kube_state_url')
if endpoint is None:
raise Chec... | [
"Set",
"up",
"the",
"kubernetes_state",
"instance",
"so",
"it",
"can",
"be",
"used",
"in",
"OpenMetricsBaseCheck"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py#L99-L271 | [
"def",
"_create_kubernetes_state_prometheus_instance",
"(",
"self",
",",
"instance",
")",
":",
"ksm_instance",
"=",
"deepcopy",
"(",
"instance",
")",
"endpoint",
"=",
"instance",
".",
"get",
"(",
"'kube_state_url'",
")",
"if",
"endpoint",
"is",
"None",
":",
"rai... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | KubernetesState._condition_to_service_check | Some metrics contains conditions, labels that have "condition" as name and "true", "false", or "unknown"
as value. The metric value is expected to be a gauge equal to 0 or 1 in this case.
For example:
metric {
label { name: "condition", value: "true"
}
# other labe... | kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py | def _condition_to_service_check(self, sample, sc_name, mapping, tags=None):
"""
Some metrics contains conditions, labels that have "condition" as name and "true", "false", or "unknown"
as value. The metric value is expected to be a gauge equal to 0 or 1 in this case.
For example:
... | def _condition_to_service_check(self, sample, sc_name, mapping, tags=None):
"""
Some metrics contains conditions, labels that have "condition" as name and "true", "false", or "unknown"
as value. The metric value is expected to be a gauge equal to 0 or 1 in this case.
For example:
... | [
"Some",
"metrics",
"contains",
"conditions",
"labels",
"that",
"have",
"condition",
"as",
"name",
"and",
"true",
"false",
"or",
"unknown",
"as",
"value",
".",
"The",
"metric",
"value",
"is",
"expected",
"to",
"be",
"a",
"gauge",
"equal",
"to",
"0",
"or",
... | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py#L273-L296 | [
"def",
"_condition_to_service_check",
"(",
"self",
",",
"sample",
",",
"sc_name",
",",
"mapping",
",",
"tags",
"=",
"None",
")",
":",
"if",
"bool",
"(",
"sample",
"[",
"self",
".",
"SAMPLE_VALUE",
"]",
")",
"is",
"False",
":",
"return",
"# Ignore if gauge ... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | KubernetesState._condition_to_tag_check | Metrics from kube-state-metrics have changed
For example:
kube_node_status_condition{condition="Ready",node="ip-172-33-39-189.eu-west-1.compute",status="true"} 1
kube_node_status_condition{condition="OutOfDisk",node="ip-172-33-57-130.eu-west-1.compute",status="false"} 1
metric {
... | kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py | def _condition_to_tag_check(self, sample, base_sc_name, mapping, scraper_config, tags=None):
"""
Metrics from kube-state-metrics have changed
For example:
kube_node_status_condition{condition="Ready",node="ip-172-33-39-189.eu-west-1.compute",status="true"} 1
kube_node_status_cond... | def _condition_to_tag_check(self, sample, base_sc_name, mapping, scraper_config, tags=None):
"""
Metrics from kube-state-metrics have changed
For example:
kube_node_status_condition{condition="Ready",node="ip-172-33-39-189.eu-west-1.compute",status="true"} 1
kube_node_status_cond... | [
"Metrics",
"from",
"kube",
"-",
"state",
"-",
"metrics",
"have",
"changed",
"For",
"example",
":",
"kube_node_status_condition",
"{",
"condition",
"=",
"Ready",
"node",
"=",
"ip",
"-",
"172",
"-",
"33",
"-",
"39",
"-",
"189",
".",
"eu",
"-",
"west",
"-... | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py#L298-L328 | [
"def",
"_condition_to_tag_check",
"(",
"self",
",",
"sample",
",",
"base_sc_name",
",",
"mapping",
",",
"scraper_config",
",",
"tags",
"=",
"None",
")",
":",
"if",
"bool",
"(",
"sample",
"[",
"self",
".",
"SAMPLE_VALUE",
"]",
")",
"is",
"False",
":",
"re... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | KubernetesState._format_tag | Lookups the labels_mapper table to see if replacing the tag name is
necessary, then returns a "name:value" tag string | kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py | def _format_tag(self, name, value, scraper_config):
"""
Lookups the labels_mapper table to see if replacing the tag name is
necessary, then returns a "name:value" tag string
"""
return '%s:%s' % (scraper_config['labels_mapper'].get(name, name), value) | def _format_tag(self, name, value, scraper_config):
"""
Lookups the labels_mapper table to see if replacing the tag name is
necessary, then returns a "name:value" tag string
"""
return '%s:%s' % (scraper_config['labels_mapper'].get(name, name), value) | [
"Lookups",
"the",
"labels_mapper",
"table",
"to",
"see",
"if",
"replacing",
"the",
"tag",
"name",
"is",
"necessary",
"then",
"returns",
"a",
"name",
":",
"value",
"tag",
"string"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py#L356-L361 | [
"def",
"_format_tag",
"(",
"self",
",",
"name",
",",
"value",
",",
"scraper_config",
")",
":",
"return",
"'%s:%s'",
"%",
"(",
"scraper_config",
"[",
"'labels_mapper'",
"]",
".",
"get",
"(",
"name",
",",
"name",
")",
",",
"value",
")"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | KubernetesState._label_to_tag | Search for `name` in labels name and returns corresponding tag string.
Tag name is label name if not specified.
Returns None if name was not found. | kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py | def _label_to_tag(self, name, labels, scraper_config, tag_name=None):
"""
Search for `name` in labels name and returns corresponding tag string.
Tag name is label name if not specified.
Returns None if name was not found.
"""
value = labels.get(name)
if value:
... | def _label_to_tag(self, name, labels, scraper_config, tag_name=None):
"""
Search for `name` in labels name and returns corresponding tag string.
Tag name is label name if not specified.
Returns None if name was not found.
"""
value = labels.get(name)
if value:
... | [
"Search",
"for",
"name",
"in",
"labels",
"name",
"and",
"returns",
"corresponding",
"tag",
"string",
".",
"Tag",
"name",
"is",
"label",
"name",
"if",
"not",
"specified",
".",
"Returns",
"None",
"if",
"name",
"was",
"not",
"found",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py#L363-L373 | [
"def",
"_label_to_tag",
"(",
"self",
",",
"name",
",",
"labels",
",",
"scraper_config",
",",
"tag_name",
"=",
"None",
")",
":",
"value",
"=",
"labels",
".",
"get",
"(",
"name",
")",
"if",
"value",
":",
"return",
"self",
".",
"_format_tag",
"(",
"tag_na... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | KubernetesState.kube_pod_status_phase | Phase a pod is in. | kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py | def kube_pod_status_phase(self, metric, scraper_config):
""" Phase a pod is in. """
metric_name = scraper_config['namespace'] + '.pod.status_phase'
status_phase_counter = Counter()
for sample in metric.samples:
# Counts aggregated cluster-wide to avoid no-data issues on pod ... | def kube_pod_status_phase(self, metric, scraper_config):
""" Phase a pod is in. """
metric_name = scraper_config['namespace'] + '.pod.status_phase'
status_phase_counter = Counter()
for sample in metric.samples:
# Counts aggregated cluster-wide to avoid no-data issues on pod ... | [
"Phase",
"a",
"pod",
"is",
"in",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py#L387-L402 | [
"def",
"kube_pod_status_phase",
"(",
"self",
",",
"metric",
",",
"scraper_config",
")",
":",
"metric_name",
"=",
"scraper_config",
"[",
"'namespace'",
"]",
"+",
"'.pod.status_phase'",
"status_phase_counter",
"=",
"Counter",
"(",
")",
"for",
"sample",
"in",
"metric... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | KubernetesState.kube_cronjob_next_schedule_time | Time until the next schedule | kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py | def kube_cronjob_next_schedule_time(self, metric, scraper_config):
""" Time until the next schedule """
# Used as a service check so that one can be alerted if the cronjob's next schedule is in the past
check_basename = scraper_config['namespace'] + '.cronjob.on_schedule_check'
curr_time... | def kube_cronjob_next_schedule_time(self, metric, scraper_config):
""" Time until the next schedule """
# Used as a service check so that one can be alerted if the cronjob's next schedule is in the past
check_basename = scraper_config['namespace'] + '.cronjob.on_schedule_check'
curr_time... | [
"Time",
"until",
"the",
"next",
"schedule"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py#L448-L466 | [
"def",
"kube_cronjob_next_schedule_time",
"(",
"self",
",",
"metric",
",",
"scraper_config",
")",
":",
"# Used as a service check so that one can be alerted if the cronjob's next schedule is in the past",
"check_basename",
"=",
"scraper_config",
"[",
"'namespace'",
"]",
"+",
"'.c... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | KubernetesState.kube_node_status_condition | The ready status of a cluster node. v1.0+ | kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py | def kube_node_status_condition(self, metric, scraper_config):
""" The ready status of a cluster node. v1.0+"""
base_check_name = scraper_config['namespace'] + '.node'
metric_name = scraper_config['namespace'] + '.nodes.by_condition'
by_condition_counter = Counter()
for sample in... | def kube_node_status_condition(self, metric, scraper_config):
""" The ready status of a cluster node. v1.0+"""
base_check_name = scraper_config['namespace'] + '.node'
metric_name = scraper_config['namespace'] + '.nodes.by_condition'
by_condition_counter = Counter()
for sample in... | [
"The",
"ready",
"status",
"of",
"a",
"cluster",
"node",
".",
"v1",
".",
"0",
"+"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py#L514-L539 | [
"def",
"kube_node_status_condition",
"(",
"self",
",",
"metric",
",",
"scraper_config",
")",
":",
"base_check_name",
"=",
"scraper_config",
"[",
"'namespace'",
"]",
"+",
"'.node'",
"metric_name",
"=",
"scraper_config",
"[",
"'namespace'",
"]",
"+",
"'.nodes.by_condi... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | KubernetesState.kube_node_status_ready | The ready status of a cluster node (legacy) | kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py | def kube_node_status_ready(self, metric, scraper_config):
""" The ready status of a cluster node (legacy)"""
service_check_name = scraper_config['namespace'] + '.node.ready'
for sample in metric.samples:
node_tag = self._label_to_tag("node", sample[self.SAMPLE_LABELS], scraper_config... | def kube_node_status_ready(self, metric, scraper_config):
""" The ready status of a cluster node (legacy)"""
service_check_name = scraper_config['namespace'] + '.node.ready'
for sample in metric.samples:
node_tag = self._label_to_tag("node", sample[self.SAMPLE_LABELS], scraper_config... | [
"The",
"ready",
"status",
"of",
"a",
"cluster",
"node",
"(",
"legacy",
")"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py#L541-L551 | [
"def",
"kube_node_status_ready",
"(",
"self",
",",
"metric",
",",
"scraper_config",
")",
":",
"service_check_name",
"=",
"scraper_config",
"[",
"'namespace'",
"]",
"+",
"'.node.ready'",
"for",
"sample",
"in",
"metric",
".",
"samples",
":",
"node_tag",
"=",
"self... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | KubernetesState.kube_node_status_network_unavailable | Whether the node is in a network unavailable state (legacy) | kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py | def kube_node_status_network_unavailable(self, metric, scraper_config):
""" Whether the node is in a network unavailable state (legacy)"""
service_check_name = scraper_config['namespace'] + '.node.network_unavailable'
for sample in metric.samples:
node_tag = self._label_to_tag("node"... | def kube_node_status_network_unavailable(self, metric, scraper_config):
""" Whether the node is in a network unavailable state (legacy)"""
service_check_name = scraper_config['namespace'] + '.node.network_unavailable'
for sample in metric.samples:
node_tag = self._label_to_tag("node"... | [
"Whether",
"the",
"node",
"is",
"in",
"a",
"network",
"unavailable",
"state",
"(",
"legacy",
")"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py#L589-L599 | [
"def",
"kube_node_status_network_unavailable",
"(",
"self",
",",
"metric",
",",
"scraper_config",
")",
":",
"service_check_name",
"=",
"scraper_config",
"[",
"'namespace'",
"]",
"+",
"'.node.network_unavailable'",
"for",
"sample",
"in",
"metric",
".",
"samples",
":",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | KubernetesState.kube_node_spec_unschedulable | Whether a node can schedule new pods. | kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py | def kube_node_spec_unschedulable(self, metric, scraper_config):
""" Whether a node can schedule new pods. """
metric_name = scraper_config['namespace'] + '.node.status'
statuses = ('schedulable', 'unschedulable')
if metric.type in METRIC_TYPES:
for sample in metric.samples:
... | def kube_node_spec_unschedulable(self, metric, scraper_config):
""" Whether a node can schedule new pods. """
metric_name = scraper_config['namespace'] + '.node.status'
statuses = ('schedulable', 'unschedulable')
if metric.type in METRIC_TYPES:
for sample in metric.samples:
... | [
"Whether",
"a",
"node",
"can",
"schedule",
"new",
"pods",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py#L601-L616 | [
"def",
"kube_node_spec_unschedulable",
"(",
"self",
",",
"metric",
",",
"scraper_config",
")",
":",
"metric_name",
"=",
"scraper_config",
"[",
"'namespace'",
"]",
"+",
"'.node.status'",
"statuses",
"=",
"(",
"'schedulable'",
",",
"'unschedulable'",
")",
"if",
"met... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | KubernetesState.kube_resourcequota | Quota and current usage by resource type. | kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py | def kube_resourcequota(self, metric, scraper_config):
""" Quota and current usage by resource type. """
metric_base_name = scraper_config['namespace'] + '.resourcequota.{}.{}'
suffixes = {'used': 'used', 'hard': 'limit'}
if metric.type in METRIC_TYPES:
for sample in metric.sa... | def kube_resourcequota(self, metric, scraper_config):
""" Quota and current usage by resource type. """
metric_base_name = scraper_config['namespace'] + '.resourcequota.{}.{}'
suffixes = {'used': 'used', 'hard': 'limit'}
if metric.type in METRIC_TYPES:
for sample in metric.sa... | [
"Quota",
"and",
"current",
"usage",
"by",
"resource",
"type",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py#L618-L632 | [
"def",
"kube_resourcequota",
"(",
"self",
",",
"metric",
",",
"scraper_config",
")",
":",
"metric_base_name",
"=",
"scraper_config",
"[",
"'namespace'",
"]",
"+",
"'.resourcequota.{}.{}'",
"suffixes",
"=",
"{",
"'used'",
":",
"'used'",
",",
"'hard'",
":",
"'limi... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | KubernetesState.kube_limitrange | Resource limits by consumer type. | kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py | def kube_limitrange(self, metric, scraper_config):
""" Resource limits by consumer type. """
# type's cardinality's low: https://github.com/kubernetes/kubernetes/blob/v1.6.1/pkg/api/v1/types.go#L3872-L3879
# idem for resource: https://github.com/kubernetes/kubernetes/blob/v1.6.1/pkg/api/v1/types... | def kube_limitrange(self, metric, scraper_config):
""" Resource limits by consumer type. """
# type's cardinality's low: https://github.com/kubernetes/kubernetes/blob/v1.6.1/pkg/api/v1/types.go#L3872-L3879
# idem for resource: https://github.com/kubernetes/kubernetes/blob/v1.6.1/pkg/api/v1/types... | [
"Resource",
"limits",
"by",
"consumer",
"type",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py#L634-L664 | [
"def",
"kube_limitrange",
"(",
"self",
",",
"metric",
",",
"scraper_config",
")",
":",
"# type's cardinality's low: https://github.com/kubernetes/kubernetes/blob/v1.6.1/pkg/api/v1/types.go#L3872-L3879",
"# idem for resource: https://github.com/kubernetes/kubernetes/blob/v1.6.1/pkg/api/v1/types... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | KubernetesState.count_objects_by_tags | Count objects by whitelisted tags and submit counts as gauges. | kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py | def count_objects_by_tags(self, metric, scraper_config):
""" Count objects by whitelisted tags and submit counts as gauges. """
config = self.object_count_params[metric.name]
metric_name = "{}.{}".format(scraper_config['namespace'], config['metric_name'])
object_counter = Counter()
... | def count_objects_by_tags(self, metric, scraper_config):
""" Count objects by whitelisted tags and submit counts as gauges. """
config = self.object_count_params[metric.name]
metric_name = "{}.{}".format(scraper_config['namespace'], config['metric_name'])
object_counter = Counter()
... | [
"Count",
"objects",
"by",
"whitelisted",
"tags",
"and",
"submit",
"counts",
"as",
"gauges",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubernetes_state/datadog_checks/kubernetes_state/kubernetes_state.py#L666-L679 | [
"def",
"count_objects_by_tags",
"(",
"self",
",",
"metric",
",",
"scraper_config",
")",
":",
"config",
"=",
"self",
".",
"object_count_params",
"[",
"metric",
".",
"name",
"]",
"metric_name",
"=",
"\"{}.{}\"",
".",
"format",
"(",
"scraper_config",
"[",
"'names... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | get_pod_by_uid | Searches for a pod uid in the podlist and returns the pod if found
:param uid: pod uid
:param podlist: podlist dict object
:return: pod dict object if found, None if not found | kubelet/datadog_checks/kubelet/common.py | def get_pod_by_uid(uid, podlist):
"""
Searches for a pod uid in the podlist and returns the pod if found
:param uid: pod uid
:param podlist: podlist dict object
:return: pod dict object if found, None if not found
"""
for pod in podlist.get("items", []):
try:
if pod["meta... | def get_pod_by_uid(uid, podlist):
"""
Searches for a pod uid in the podlist and returns the pod if found
:param uid: pod uid
:param podlist: podlist dict object
:return: pod dict object if found, None if not found
"""
for pod in podlist.get("items", []):
try:
if pod["meta... | [
"Searches",
"for",
"a",
"pod",
"uid",
"in",
"the",
"podlist",
"and",
"returns",
"the",
"pod",
"if",
"found",
":",
"param",
"uid",
":",
"pod",
"uid",
":",
"param",
"podlist",
":",
"podlist",
"dict",
"object",
":",
"return",
":",
"pod",
"dict",
"object",... | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubelet/datadog_checks/kubelet/common.py#L41-L54 | [
"def",
"get_pod_by_uid",
"(",
"uid",
",",
"podlist",
")",
":",
"for",
"pod",
"in",
"podlist",
".",
"get",
"(",
"\"items\"",
",",
"[",
"]",
")",
":",
"try",
":",
"if",
"pod",
"[",
"\"metadata\"",
"]",
"[",
"\"uid\"",
"]",
"==",
"uid",
":",
"return",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | is_static_pending_pod | Return if the pod is a static pending pod
See https://github.com/kubernetes/kubernetes/pull/57106
:param pod: dict
:return: bool | kubelet/datadog_checks/kubelet/common.py | def is_static_pending_pod(pod):
"""
Return if the pod is a static pending pod
See https://github.com/kubernetes/kubernetes/pull/57106
:param pod: dict
:return: bool
"""
try:
if pod["metadata"]["annotations"]["kubernetes.io/config.source"] == "api":
return False
p... | def is_static_pending_pod(pod):
"""
Return if the pod is a static pending pod
See https://github.com/kubernetes/kubernetes/pull/57106
:param pod: dict
:return: bool
"""
try:
if pod["metadata"]["annotations"]["kubernetes.io/config.source"] == "api":
return False
p... | [
"Return",
"if",
"the",
"pod",
"is",
"a",
"static",
"pending",
"pod",
"See",
"https",
":",
"//",
"github",
".",
"com",
"/",
"kubernetes",
"/",
"kubernetes",
"/",
"pull",
"/",
"57106",
":",
"param",
"pod",
":",
"dict",
":",
"return",
":",
"bool"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubelet/datadog_checks/kubelet/common.py#L57-L74 | [
"def",
"is_static_pending_pod",
"(",
"pod",
")",
":",
"try",
":",
"if",
"pod",
"[",
"\"metadata\"",
"]",
"[",
"\"annotations\"",
"]",
"[",
"\"kubernetes.io/config.source\"",
"]",
"==",
"\"api\"",
":",
"return",
"False",
"pod_status",
"=",
"pod",
"[",
"\"status... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | PodListUtils.is_excluded | Queries the agent6 container filter interface. It retrieves container
name + image from the podlist, so static pod filtering is not supported.
Result is cached between calls to avoid the python-go switching cost for
prometheus metrics (will be called once per metric)
:param cid: contain... | kubelet/datadog_checks/kubelet/common.py | def is_excluded(self, cid, pod_uid=None):
"""
Queries the agent6 container filter interface. It retrieves container
name + image from the podlist, so static pod filtering is not supported.
Result is cached between calls to avoid the python-go switching cost for
prometheus metric... | def is_excluded(self, cid, pod_uid=None):
"""
Queries the agent6 container filter interface. It retrieves container
name + image from the podlist, so static pod filtering is not supported.
Result is cached between calls to avoid the python-go switching cost for
prometheus metric... | [
"Queries",
"the",
"agent6",
"container",
"filter",
"interface",
".",
"It",
"retrieves",
"container",
"name",
"+",
"image",
"from",
"the",
"podlist",
"so",
"static",
"pod",
"filtering",
"is",
"not",
"supported",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubelet/datadog_checks/kubelet/common.py#L139-L172 | [
"def",
"is_excluded",
"(",
"self",
",",
"cid",
",",
"pod_uid",
"=",
"None",
")",
":",
"if",
"not",
"cid",
":",
"return",
"True",
"if",
"cid",
"in",
"self",
".",
"cache",
":",
"return",
"self",
".",
"cache",
"[",
"cid",
"]",
"if",
"pod_uid",
"and",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | KubeletCredentials.cert_pair | Returns the client certificates
:return: tuple (crt,key) or None | kubelet/datadog_checks/kubelet/common.py | def cert_pair(self):
"""
Returns the client certificates
:return: tuple (crt,key) or None
"""
if self._ssl_cert and self._ssl_private_key:
return (self._ssl_cert, self._ssl_private_key)
else:
return None | def cert_pair(self):
"""
Returns the client certificates
:return: tuple (crt,key) or None
"""
if self._ssl_cert and self._ssl_private_key:
return (self._ssl_cert, self._ssl_private_key)
else:
return None | [
"Returns",
"the",
"client",
"certificates",
":",
"return",
":",
"tuple",
"(",
"crt",
"key",
")",
"or",
"None"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubelet/datadog_checks/kubelet/common.py#L205-L213 | [
"def",
"cert_pair",
"(",
"self",
")",
":",
"if",
"self",
".",
"_ssl_cert",
"and",
"self",
".",
"_ssl_private_key",
":",
"return",
"(",
"self",
".",
"_ssl_cert",
",",
"self",
".",
"_ssl_private_key",
")",
"else",
":",
"return",
"None"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | KubeletCredentials.headers | Returns the https headers with credentials, if token is used and url is https
:param url: url to be queried, including scheme
:return: dict or None | kubelet/datadog_checks/kubelet/common.py | def headers(self, url):
"""
Returns the https headers with credentials, if token is used and url is https
:param url: url to be queried, including scheme
:return: dict or None
"""
if self._token and url.lower().startswith('https'):
return {'Authorization': 'Be... | def headers(self, url):
"""
Returns the https headers with credentials, if token is used and url is https
:param url: url to be queried, including scheme
:return: dict or None
"""
if self._token and url.lower().startswith('https'):
return {'Authorization': 'Be... | [
"Returns",
"the",
"https",
"headers",
"with",
"credentials",
"if",
"token",
"is",
"used",
"and",
"url",
"is",
"https",
":",
"param",
"url",
":",
"url",
"to",
"be",
"queried",
"including",
"scheme",
":",
"return",
":",
"dict",
"or",
"None"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubelet/datadog_checks/kubelet/common.py#L215-L224 | [
"def",
"headers",
"(",
"self",
",",
"url",
")",
":",
"if",
"self",
".",
"_token",
"and",
"url",
".",
"lower",
"(",
")",
".",
"startswith",
"(",
"'https'",
")",
":",
"return",
"{",
"'Authorization'",
":",
"'Bearer {}'",
".",
"format",
"(",
"self",
"."... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | KubeletCredentials.configure_scraper | Configures a PrometheusScaper object with query credentials
:param scraper: valid PrometheusScaper object
:param endpoint: url that will be scraped | kubelet/datadog_checks/kubelet/common.py | def configure_scraper(self, scraper_config):
"""
Configures a PrometheusScaper object with query credentials
:param scraper: valid PrometheusScaper object
:param endpoint: url that will be scraped
"""
endpoint = scraper_config['prometheus_url']
scraper_config.upda... | def configure_scraper(self, scraper_config):
"""
Configures a PrometheusScaper object with query credentials
:param scraper: valid PrometheusScaper object
:param endpoint: url that will be scraped
"""
endpoint = scraper_config['prometheus_url']
scraper_config.upda... | [
"Configures",
"a",
"PrometheusScaper",
"object",
"with",
"query",
"credentials",
":",
"param",
"scraper",
":",
"valid",
"PrometheusScaper",
"object",
":",
"param",
"endpoint",
":",
"url",
"that",
"will",
"be",
"scraped"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubelet/datadog_checks/kubelet/common.py#L233-L247 | [
"def",
"configure_scraper",
"(",
"self",
",",
"scraper_config",
")",
":",
"endpoint",
"=",
"scraper_config",
"[",
"'prometheus_url'",
"]",
"scraper_config",
".",
"update",
"(",
"{",
"'ssl_ca_cert'",
":",
"self",
".",
"_ssl_verify",
",",
"'ssl_cert'",
":",
"self"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | files_changed | Return the list of file changed in the current branch compared to `master` | datadog_checks_dev/datadog_checks/dev/tooling/git.py | def files_changed():
"""
Return the list of file changed in the current branch compared to `master`
"""
with chdir(get_root()):
result = run_command('git diff --name-only master...', capture='out')
changed_files = result.stdout.splitlines()
# Remove empty lines
return [f for f in ch... | def files_changed():
"""
Return the list of file changed in the current branch compared to `master`
"""
with chdir(get_root()):
result = run_command('git diff --name-only master...', capture='out')
changed_files = result.stdout.splitlines()
# Remove empty lines
return [f for f in ch... | [
"Return",
"the",
"list",
"of",
"file",
"changed",
"in",
"the",
"current",
"branch",
"compared",
"to",
"master"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/git.py#L22-L31 | [
"def",
"files_changed",
"(",
")",
":",
"with",
"chdir",
"(",
"get_root",
"(",
")",
")",
":",
"result",
"=",
"run_command",
"(",
"'git diff --name-only master...'",
",",
"capture",
"=",
"'out'",
")",
"changed_files",
"=",
"result",
".",
"stdout",
".",
"splitl... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | get_commits_since | Get the list of commits from `target_tag` to `HEAD` for the given check | datadog_checks_dev/datadog_checks/dev/tooling/git.py | def get_commits_since(check_name, target_tag=None):
"""
Get the list of commits from `target_tag` to `HEAD` for the given check
"""
root = get_root()
target_path = os.path.join(root, check_name)
command = 'git log --pretty=%s {}{}'.format('' if target_tag is None else '{}... '.format(target_tag)... | def get_commits_since(check_name, target_tag=None):
"""
Get the list of commits from `target_tag` to `HEAD` for the given check
"""
root = get_root()
target_path = os.path.join(root, check_name)
command = 'git log --pretty=%s {}{}'.format('' if target_tag is None else '{}... '.format(target_tag)... | [
"Get",
"the",
"list",
"of",
"commits",
"from",
"target_tag",
"to",
"HEAD",
"for",
"the",
"given",
"check"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/git.py#L34-L43 | [
"def",
"get_commits_since",
"(",
"check_name",
",",
"target_tag",
"=",
"None",
")",
":",
"root",
"=",
"get_root",
"(",
")",
"target_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"root",
",",
"check_name",
")",
"command",
"=",
"'git log --pretty=%s {}{}'",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | git_show_file | Return the contents of a file at a given tag | datadog_checks_dev/datadog_checks/dev/tooling/git.py | def git_show_file(path, ref):
"""
Return the contents of a file at a given tag
"""
root = get_root()
command = 'git show {}:{}'.format(ref, path)
with chdir(root):
return run_command(command, capture=True).stdout | def git_show_file(path, ref):
"""
Return the contents of a file at a given tag
"""
root = get_root()
command = 'git show {}:{}'.format(ref, path)
with chdir(root):
return run_command(command, capture=True).stdout | [
"Return",
"the",
"contents",
"of",
"a",
"file",
"at",
"a",
"given",
"tag"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/git.py#L46-L54 | [
"def",
"git_show_file",
"(",
"path",
",",
"ref",
")",
":",
"root",
"=",
"get_root",
"(",
")",
"command",
"=",
"'git show {}:{}'",
".",
"format",
"(",
"ref",
",",
"path",
")",
"with",
"chdir",
"(",
"root",
")",
":",
"return",
"run_command",
"(",
"comman... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | git_commit | Commit the changes for the given targets. | datadog_checks_dev/datadog_checks/dev/tooling/git.py | def git_commit(targets, message, force=False, sign=False):
"""
Commit the changes for the given targets.
"""
root = get_root()
target_paths = []
for t in targets:
target_paths.append(os.path.join(root, t))
with chdir(root):
result = run_command('git add{} {}'.format(' -f' if... | def git_commit(targets, message, force=False, sign=False):
"""
Commit the changes for the given targets.
"""
root = get_root()
target_paths = []
for t in targets:
target_paths.append(os.path.join(root, t))
with chdir(root):
result = run_command('git add{} {}'.format(' -f' if... | [
"Commit",
"the",
"changes",
"for",
"the",
"given",
"targets",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/git.py#L57-L71 | [
"def",
"git_commit",
"(",
"targets",
",",
"message",
",",
"force",
"=",
"False",
",",
"sign",
"=",
"False",
")",
":",
"root",
"=",
"get_root",
"(",
")",
"target_paths",
"=",
"[",
"]",
"for",
"t",
"in",
"targets",
":",
"target_paths",
".",
"append",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | git_tag | Tag the repo using an annotated tag. | datadog_checks_dev/datadog_checks/dev/tooling/git.py | def git_tag(tag_name, push=False):
"""
Tag the repo using an annotated tag.
"""
with chdir(get_root()):
result = run_command('git tag -a {} -m "{}"'.format(tag_name, tag_name), capture=True)
if push:
if result.code != 0:
return result
return run_c... | def git_tag(tag_name, push=False):
"""
Tag the repo using an annotated tag.
"""
with chdir(get_root()):
result = run_command('git tag -a {} -m "{}"'.format(tag_name, tag_name), capture=True)
if push:
if result.code != 0:
return result
return run_c... | [
"Tag",
"the",
"repo",
"using",
"an",
"annotated",
"tag",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/git.py#L74-L86 | [
"def",
"git_tag",
"(",
"tag_name",
",",
"push",
"=",
"False",
")",
":",
"with",
"chdir",
"(",
"get_root",
"(",
")",
")",
":",
"result",
"=",
"run_command",
"(",
"'git tag -a {} -m \"{}\"'",
".",
"format",
"(",
"tag_name",
",",
"tag_name",
")",
",",
"capt... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.