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 | BulkOperationBuilder.execute | Execute all provided operations.
:Parameters:
- write_concern (optional): the write concern for this bulk
execution. | tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py | def execute(self, write_concern=None):
"""Execute all provided operations.
:Parameters:
- write_concern (optional): the write concern for this bulk
execution.
"""
if write_concern is not None:
validate_is_mapping("write_concern", write_concern)
... | def execute(self, write_concern=None):
"""Execute all provided operations.
:Parameters:
- write_concern (optional): the write concern for this bulk
execution.
"""
if write_concern is not None:
validate_is_mapping("write_concern", write_concern)
... | [
"Execute",
"all",
"provided",
"operations",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/bulk.py#L666-L675 | [
"def",
"execute",
"(",
"self",
",",
"write_concern",
"=",
"None",
")",
":",
"if",
"write_concern",
"is",
"not",
"None",
":",
"validate_is_mapping",
"(",
"\"write_concern\"",
",",
"write_concern",
")",
"return",
"self",
".",
"__bulk",
".",
"execute",
"(",
"wr... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Topology.select_servers | Return a list of Servers matching selector, or time out.
:Parameters:
- `selector`: function that takes a list of Servers and returns
a subset of them.
- `server_selection_timeout` (optional): maximum seconds to wait.
If not provided, the default value common.SERVER_... | tokumx/datadog_checks/tokumx/vendor/pymongo/topology.py | def select_servers(self,
selector,
server_selection_timeout=None,
address=None):
"""Return a list of Servers matching selector, or time out.
:Parameters:
- `selector`: function that takes a list of Servers and returns
... | def select_servers(self,
selector,
server_selection_timeout=None,
address=None):
"""Return a list of Servers matching selector, or time out.
:Parameters:
- `selector`: function that takes a list of Servers and returns
... | [
"Return",
"a",
"list",
"of",
"Servers",
"matching",
"selector",
"or",
"time",
"out",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/topology.py#L153-L205 | [
"def",
"select_servers",
"(",
"self",
",",
"selector",
",",
"server_selection_timeout",
"=",
"None",
",",
"address",
"=",
"None",
")",
":",
"if",
"server_selection_timeout",
"is",
"None",
":",
"server_timeout",
"=",
"self",
".",
"_settings",
".",
"server_selecti... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Topology.select_server | Like select_servers, but choose a random server if several match. | tokumx/datadog_checks/tokumx/vendor/pymongo/topology.py | def select_server(self,
selector,
server_selection_timeout=None,
address=None):
"""Like select_servers, but choose a random server if several match."""
return random.choice(self.select_servers(selector,
... | def select_server(self,
selector,
server_selection_timeout=None,
address=None):
"""Like select_servers, but choose a random server if several match."""
return random.choice(self.select_servers(selector,
... | [
"Like",
"select_servers",
"but",
"choose",
"a",
"random",
"server",
"if",
"several",
"match",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/topology.py#L207-L214 | [
"def",
"select_server",
"(",
"self",
",",
"selector",
",",
"server_selection_timeout",
"=",
"None",
",",
"address",
"=",
"None",
")",
":",
"return",
"random",
".",
"choice",
"(",
"self",
".",
"select_servers",
"(",
"selector",
",",
"server_selection_timeout",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Topology.on_change | Process a new ServerDescription after an ismaster call completes. | tokumx/datadog_checks/tokumx/vendor/pymongo/topology.py | def on_change(self, server_description):
"""Process a new ServerDescription after an ismaster call completes."""
# We do no I/O holding the lock.
with self._lock:
# Any monitored server was definitely in the topology description
# once. Check if it's still in the descript... | def on_change(self, server_description):
"""Process a new ServerDescription after an ismaster call completes."""
# We do no I/O holding the lock.
with self._lock:
# Any monitored server was definitely in the topology description
# once. Check if it's still in the descript... | [
"Process",
"a",
"new",
"ServerDescription",
"after",
"an",
"ismaster",
"call",
"completes",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/topology.py#L239-L268 | [
"def",
"on_change",
"(",
"self",
",",
"server_description",
")",
":",
"# We do no I/O holding the lock.",
"with",
"self",
".",
"_lock",
":",
"# Any monitored server was definitely in the topology description",
"# once. Check if it's still in the description or if some state-",
"# cha... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Topology.get_primary | Return primary's address or None. | tokumx/datadog_checks/tokumx/vendor/pymongo/topology.py | def get_primary(self):
"""Return primary's address or None."""
# Implemented here in Topology instead of MongoClient, so it can lock.
with self._lock:
topology_type = self._description.topology_type
if topology_type != TOPOLOGY_TYPE.ReplicaSetWithPrimary:
... | def get_primary(self):
"""Return primary's address or None."""
# Implemented here in Topology instead of MongoClient, so it can lock.
with self._lock:
topology_type = self._description.topology_type
if topology_type != TOPOLOGY_TYPE.ReplicaSetWithPrimary:
... | [
"Return",
"primary",
"s",
"address",
"or",
"None",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/topology.py#L283-L291 | [
"def",
"get_primary",
"(",
"self",
")",
":",
"# Implemented here in Topology instead of MongoClient, so it can lock.",
"with",
"self",
".",
"_lock",
":",
"topology_type",
"=",
"self",
".",
"_description",
".",
"topology_type",
"if",
"topology_type",
"!=",
"TOPOLOGY_TYPE",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Topology._get_replica_set_members | Return set of replica set member addresses. | tokumx/datadog_checks/tokumx/vendor/pymongo/topology.py | def _get_replica_set_members(self, selector):
"""Return set of replica set member addresses."""
# Implemented here in Topology instead of MongoClient, so it can lock.
with self._lock:
topology_type = self._description.topology_type
if topology_type not in (TOPOLOGY_TYPE.R... | def _get_replica_set_members(self, selector):
"""Return set of replica set member addresses."""
# Implemented here in Topology instead of MongoClient, so it can lock.
with self._lock:
topology_type = self._description.topology_type
if topology_type not in (TOPOLOGY_TYPE.R... | [
"Return",
"set",
"of",
"replica",
"set",
"member",
"addresses",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/topology.py#L293-L302 | [
"def",
"_get_replica_set_members",
"(",
"self",
",",
"selector",
")",
":",
"# Implemented here in Topology instead of MongoClient, so it can lock.",
"with",
"self",
".",
"_lock",
":",
"topology_type",
"=",
"self",
".",
"_description",
".",
"topology_type",
"if",
"topology... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Topology.request_check_all | Wake all monitors, wait for at least one to check its server. | tokumx/datadog_checks/tokumx/vendor/pymongo/topology.py | def request_check_all(self, wait_time=5):
"""Wake all monitors, wait for at least one to check its server."""
with self._lock:
self._request_check_all()
self._condition.wait(wait_time) | def request_check_all(self, wait_time=5):
"""Wake all monitors, wait for at least one to check its server."""
with self._lock:
self._request_check_all()
self._condition.wait(wait_time) | [
"Wake",
"all",
"monitors",
"wait",
"for",
"at",
"least",
"one",
"to",
"check",
"its",
"server",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/topology.py#L312-L316 | [
"def",
"request_check_all",
"(",
"self",
",",
"wait_time",
"=",
"5",
")",
":",
"with",
"self",
".",
"_lock",
":",
"self",
".",
"_request_check_all",
"(",
")",
"self",
".",
"_condition",
".",
"wait",
"(",
"wait_time",
")"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Topology.reset_server_and_request_check | Clear our pool for a server, mark it Unknown, and check it soon. | tokumx/datadog_checks/tokumx/vendor/pymongo/topology.py | def reset_server_and_request_check(self, address):
"""Clear our pool for a server, mark it Unknown, and check it soon."""
with self._lock:
self._reset_server(address)
self._request_check(address) | def reset_server_and_request_check(self, address):
"""Clear our pool for a server, mark it Unknown, and check it soon."""
with self._lock:
self._reset_server(address)
self._request_check(address) | [
"Clear",
"our",
"pool",
"for",
"a",
"server",
"mark",
"it",
"Unknown",
"and",
"check",
"it",
"soon",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/topology.py#L332-L336 | [
"def",
"reset_server_and_request_check",
"(",
"self",
",",
"address",
")",
":",
"with",
"self",
".",
"_lock",
":",
"self",
".",
"_reset_server",
"(",
"address",
")",
"self",
".",
"_request_check",
"(",
"address",
")"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Topology.close | Clear pools and terminate monitors. Topology reopens on demand. | tokumx/datadog_checks/tokumx/vendor/pymongo/topology.py | def close(self):
"""Clear pools and terminate monitors. Topology reopens on demand."""
with self._lock:
for server in self._servers.values():
server.close()
# Mark all servers Unknown.
self._description = self._description.reset()
self._up... | def close(self):
"""Clear pools and terminate monitors. Topology reopens on demand."""
with self._lock:
for server in self._servers.values():
server.close()
# Mark all servers Unknown.
self._description = self._description.reset()
self._up... | [
"Clear",
"pools",
"and",
"terminate",
"monitors",
".",
"Topology",
"reopens",
"on",
"demand",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/topology.py#L344-L360 | [
"def",
"close",
"(",
"self",
")",
":",
"with",
"self",
".",
"_lock",
":",
"for",
"server",
"in",
"self",
".",
"_servers",
".",
"values",
"(",
")",
":",
"server",
".",
"close",
"(",
")",
"# Mark all servers Unknown.",
"self",
".",
"_description",
"=",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Topology._reset_server | Clear our pool for a server and mark it Unknown.
Hold the lock when calling this. Does *not* request an immediate check. | tokumx/datadog_checks/tokumx/vendor/pymongo/topology.py | def _reset_server(self, address):
"""Clear our pool for a server and mark it Unknown.
Hold the lock when calling this. Does *not* request an immediate check.
"""
server = self._servers.get(address)
# "server" is None if another thread removed it from the topology.
if se... | def _reset_server(self, address):
"""Clear our pool for a server and mark it Unknown.
Hold the lock when calling this. Does *not* request an immediate check.
"""
server = self._servers.get(address)
# "server" is None if another thread removed it from the topology.
if se... | [
"Clear",
"our",
"pool",
"for",
"a",
"server",
"and",
"mark",
"it",
"Unknown",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/topology.py#L390-L403 | [
"def",
"_reset_server",
"(",
"self",
",",
"address",
")",
":",
"server",
"=",
"self",
".",
"_servers",
".",
"get",
"(",
"address",
")",
"# \"server\" is None if another thread removed it from the topology.",
"if",
"server",
":",
"server",
".",
"reset",
"(",
")",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Topology._request_check | Wake one monitor. Hold the lock when calling this. | tokumx/datadog_checks/tokumx/vendor/pymongo/topology.py | def _request_check(self, address):
"""Wake one monitor. Hold the lock when calling this."""
server = self._servers.get(address)
# "server" is None if another thread removed it from the topology.
if server:
server.request_check() | def _request_check(self, address):
"""Wake one monitor. Hold the lock when calling this."""
server = self._servers.get(address)
# "server" is None if another thread removed it from the topology.
if server:
server.request_check() | [
"Wake",
"one",
"monitor",
".",
"Hold",
"the",
"lock",
"when",
"calling",
"this",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/topology.py#L405-L411 | [
"def",
"_request_check",
"(",
"self",
",",
"address",
")",
":",
"server",
"=",
"self",
".",
"_servers",
".",
"get",
"(",
"address",
")",
"# \"server\" is None if another thread removed it from the topology.",
"if",
"server",
":",
"server",
".",
"request_check",
"(",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Topology._update_servers | Sync our Servers from TopologyDescription.server_descriptions.
Hold the lock while calling this. | tokumx/datadog_checks/tokumx/vendor/pymongo/topology.py | def _update_servers(self):
"""Sync our Servers from TopologyDescription.server_descriptions.
Hold the lock while calling this.
"""
for address, sd in self._description.server_descriptions().items():
if address not in self._servers:
monitor = self._settings.mo... | def _update_servers(self):
"""Sync our Servers from TopologyDescription.server_descriptions.
Hold the lock while calling this.
"""
for address, sd in self._description.server_descriptions().items():
if address not in self._servers:
monitor = self._settings.mo... | [
"Sync",
"our",
"Servers",
"from",
"TopologyDescription",
".",
"server_descriptions",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/topology.py#L418-L450 | [
"def",
"_update_servers",
"(",
"self",
")",
":",
"for",
"address",
",",
"sd",
"in",
"self",
".",
"_description",
".",
"server_descriptions",
"(",
")",
".",
"items",
"(",
")",
":",
"if",
"address",
"not",
"in",
"self",
".",
"_servers",
":",
"monitor",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Topology._error_message | Format an error message if server selection fails.
Hold the lock when calling this. | tokumx/datadog_checks/tokumx/vendor/pymongo/topology.py | def _error_message(self, selector):
"""Format an error message if server selection fails.
Hold the lock when calling this.
"""
is_replica_set = self._description.topology_type in (
TOPOLOGY_TYPE.ReplicaSetWithPrimary,
TOPOLOGY_TYPE.ReplicaSetNoPrimary)
i... | def _error_message(self, selector):
"""Format an error message if server selection fails.
Hold the lock when calling this.
"""
is_replica_set = self._description.topology_type in (
TOPOLOGY_TYPE.ReplicaSetWithPrimary,
TOPOLOGY_TYPE.ReplicaSetNoPrimary)
i... | [
"Format",
"an",
"error",
"message",
"if",
"server",
"selection",
"fails",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/topology.py#L472-L527 | [
"def",
"_error_message",
"(",
"self",
",",
"selector",
")",
":",
"is_replica_set",
"=",
"self",
".",
"_description",
".",
"topology_type",
"in",
"(",
"TOPOLOGY_TYPE",
".",
"ReplicaSetWithPrimary",
",",
"TOPOLOGY_TYPE",
".",
"ReplicaSetNoPrimary",
")",
"if",
"is_re... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | MorCache.init_instance | Create an empty instance if it doesn't exist.
If the instance already exists, this is a noop. | vsphere/datadog_checks/vsphere/mor_cache.py | def init_instance(self, key):
"""
Create an empty instance if it doesn't exist.
If the instance already exists, this is a noop.
"""
with self._mor_lock:
if key not in self._mor:
self._mor[key] = {} | def init_instance(self, key):
"""
Create an empty instance if it doesn't exist.
If the instance already exists, this is a noop.
"""
with self._mor_lock:
if key not in self._mor:
self._mor[key] = {} | [
"Create",
"an",
"empty",
"instance",
"if",
"it",
"doesn",
"t",
"exist",
".",
"If",
"the",
"instance",
"already",
"exists",
"this",
"is",
"a",
"noop",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/mor_cache.py#L24-L31 | [
"def",
"init_instance",
"(",
"self",
",",
"key",
")",
":",
"with",
"self",
".",
"_mor_lock",
":",
"if",
"key",
"not",
"in",
"self",
".",
"_mor",
":",
"self",
".",
"_mor",
"[",
"key",
"]",
"=",
"{",
"}"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | MorCache.set_mor | Store a Mor object in the cache with the given name.
If the key is not in the cache, raises a KeyError. | vsphere/datadog_checks/vsphere/mor_cache.py | def set_mor(self, key, name, mor):
"""
Store a Mor object in the cache with the given name.
If the key is not in the cache, raises a KeyError.
"""
with self._mor_lock:
self._mor[key][name] = mor
self._mor[key][name]['creation_time'] = time.time() | def set_mor(self, key, name, mor):
"""
Store a Mor object in the cache with the given name.
If the key is not in the cache, raises a KeyError.
"""
with self._mor_lock:
self._mor[key][name] = mor
self._mor[key][name]['creation_time'] = time.time() | [
"Store",
"a",
"Mor",
"object",
"in",
"the",
"cache",
"with",
"the",
"given",
"name",
".",
"If",
"the",
"key",
"is",
"not",
"in",
"the",
"cache",
"raises",
"a",
"KeyError",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/mor_cache.py#L48-L55 | [
"def",
"set_mor",
"(",
"self",
",",
"key",
",",
"name",
",",
"mor",
")",
":",
"with",
"self",
".",
"_mor_lock",
":",
"self",
".",
"_mor",
"[",
"key",
"]",
"[",
"name",
"]",
"=",
"mor",
"self",
".",
"_mor",
"[",
"key",
"]",
"[",
"name",
"]",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | MorCache.get_mor | Return the Mor object identified by `name` for the given instance key.
If the key is not in the cache, raises a KeyError.
If there's no Mor with the given name, raises a MorNotFoundError. | vsphere/datadog_checks/vsphere/mor_cache.py | def get_mor(self, key, name):
"""
Return the Mor object identified by `name` for the given instance key.
If the key is not in the cache, raises a KeyError.
If there's no Mor with the given name, raises a MorNotFoundError.
"""
with self._mor_lock:
mors = self._... | def get_mor(self, key, name):
"""
Return the Mor object identified by `name` for the given instance key.
If the key is not in the cache, raises a KeyError.
If there's no Mor with the given name, raises a MorNotFoundError.
"""
with self._mor_lock:
mors = self._... | [
"Return",
"the",
"Mor",
"object",
"identified",
"by",
"name",
"for",
"the",
"given",
"instance",
"key",
".",
"If",
"the",
"key",
"is",
"not",
"in",
"the",
"cache",
"raises",
"a",
"KeyError",
".",
"If",
"there",
"s",
"no",
"Mor",
"with",
"the",
"given",... | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/mor_cache.py#L57-L68 | [
"def",
"get_mor",
"(",
"self",
",",
"key",
",",
"name",
")",
":",
"with",
"self",
".",
"_mor_lock",
":",
"mors",
"=",
"self",
".",
"_mor",
"[",
"key",
"]",
"try",
":",
"return",
"mors",
"[",
"name",
"]",
"except",
"KeyError",
":",
"raise",
"MorNotF... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | MorCache.set_metrics | Store a list of metric identifiers for the given instance key and Mor
object name.
If the key is not in the cache, raises a KeyError.
If the Mor object is not in the cache, raises a MorNotFoundError | vsphere/datadog_checks/vsphere/mor_cache.py | def set_metrics(self, key, name, metrics):
"""
Store a list of metric identifiers for the given instance key and Mor
object name.
If the key is not in the cache, raises a KeyError.
If the Mor object is not in the cache, raises a MorNotFoundError
"""
with self._mor... | def set_metrics(self, key, name, metrics):
"""
Store a list of metric identifiers for the given instance key and Mor
object name.
If the key is not in the cache, raises a KeyError.
If the Mor object is not in the cache, raises a MorNotFoundError
"""
with self._mor... | [
"Store",
"a",
"list",
"of",
"metric",
"identifiers",
"for",
"the",
"given",
"instance",
"key",
"and",
"Mor",
"object",
"name",
".",
"If",
"the",
"key",
"is",
"not",
"in",
"the",
"cache",
"raises",
"a",
"KeyError",
".",
"If",
"the",
"Mor",
"object",
"is... | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/mor_cache.py#L70-L81 | [
"def",
"set_metrics",
"(",
"self",
",",
"key",
",",
"name",
",",
"metrics",
")",
":",
"with",
"self",
".",
"_mor_lock",
":",
"mor",
"=",
"self",
".",
"_mor",
"[",
"key",
"]",
".",
"get",
"(",
"name",
")",
"if",
"mor",
"is",
"None",
":",
"raise",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | MorCache.mors | Generator returning all the mors in the cache for the given instance key. | vsphere/datadog_checks/vsphere/mor_cache.py | def mors(self, key):
"""
Generator returning all the mors in the cache for the given instance key.
"""
with self._mor_lock:
for k, v in iteritems(self._mor.get(key, {})):
yield k, v | def mors(self, key):
"""
Generator returning all the mors in the cache for the given instance key.
"""
with self._mor_lock:
for k, v in iteritems(self._mor.get(key, {})):
yield k, v | [
"Generator",
"returning",
"all",
"the",
"mors",
"in",
"the",
"cache",
"for",
"the",
"given",
"instance",
"key",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/mor_cache.py#L83-L89 | [
"def",
"mors",
"(",
"self",
",",
"key",
")",
":",
"with",
"self",
".",
"_mor_lock",
":",
"for",
"k",
",",
"v",
"in",
"iteritems",
"(",
"self",
".",
"_mor",
".",
"get",
"(",
"key",
",",
"{",
"}",
")",
")",
":",
"yield",
"k",
",",
"v"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | MorCache.mors_batch | Generator returning as many dictionaries containing `batch_size` Mor
objects as needed to iterate all the content of the cache. This has
to be iterated twice, like:
for batch in cache.mors_batch('key', 100):
for name, mor in batch:
# use the Mor object he... | vsphere/datadog_checks/vsphere/mor_cache.py | def mors_batch(self, key, batch_size):
"""
Generator returning as many dictionaries containing `batch_size` Mor
objects as needed to iterate all the content of the cache. This has
to be iterated twice, like:
for batch in cache.mors_batch('key', 100):
for name... | def mors_batch(self, key, batch_size):
"""
Generator returning as many dictionaries containing `batch_size` Mor
objects as needed to iterate all the content of the cache. This has
to be iterated twice, like:
for batch in cache.mors_batch('key', 100):
for name... | [
"Generator",
"returning",
"as",
"many",
"dictionaries",
"containing",
"batch_size",
"Mor",
"objects",
"as",
"needed",
"to",
"iterate",
"all",
"the",
"content",
"of",
"the",
"cache",
".",
"This",
"has",
"to",
"be",
"iterated",
"twice",
"like",
":"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/mor_cache.py#L91-L111 | [
"def",
"mors_batch",
"(",
"self",
",",
"key",
",",
"batch_size",
")",
":",
"with",
"self",
".",
"_mor_lock",
":",
"mors_dict",
"=",
"self",
".",
"_mor",
".",
"get",
"(",
"key",
")",
"if",
"mors_dict",
"is",
"None",
":",
"yield",
"{",
"}",
"mor_names"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | MorCache.purge | Remove all the items in the cache for the given key that are older than
ttl seconds.
If the key is not in the cache, raises a KeyError. | vsphere/datadog_checks/vsphere/mor_cache.py | def purge(self, key, ttl):
"""
Remove all the items in the cache for the given key that are older than
ttl seconds.
If the key is not in the cache, raises a KeyError.
"""
mors_to_purge = []
now = time.time()
with self._mor_lock:
# Don't change ... | def purge(self, key, ttl):
"""
Remove all the items in the cache for the given key that are older than
ttl seconds.
If the key is not in the cache, raises a KeyError.
"""
mors_to_purge = []
now = time.time()
with self._mor_lock:
# Don't change ... | [
"Remove",
"all",
"the",
"items",
"in",
"the",
"cache",
"for",
"the",
"given",
"key",
"that",
"are",
"older",
"than",
"ttl",
"seconds",
".",
"If",
"the",
"key",
"is",
"not",
"in",
"the",
"cache",
"raises",
"a",
"KeyError",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/mor_cache.py#L113-L131 | [
"def",
"purge",
"(",
"self",
",",
"key",
",",
"ttl",
")",
":",
"mors_to_purge",
"=",
"[",
"]",
"now",
"=",
"time",
".",
"time",
"(",
")",
"with",
"self",
".",
"_mor_lock",
":",
"# Don't change the dict during iteration!",
"# First collect the names of the Mors t... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | parse_metric | Takes a metric formatted by Envoy and splits it into a unique
metric name. Returns the unique metric name, a list of tags, and
the name of the submission method.
Example:
'listener.0.0.0.0_80.downstream_cx_total' ->
('listener.downstream_cx_total', ['address:0.0.0.0_80'], 'count') | envoy/datadog_checks/envoy/parser.py | def parse_metric(metric, metric_mapping=METRIC_TREE):
"""Takes a metric formatted by Envoy and splits it into a unique
metric name. Returns the unique metric name, a list of tags, and
the name of the submission method.
Example:
'listener.0.0.0.0_80.downstream_cx_total' ->
('listener.dow... | def parse_metric(metric, metric_mapping=METRIC_TREE):
"""Takes a metric formatted by Envoy and splits it into a unique
metric name. Returns the unique metric name, a list of tags, and
the name of the submission method.
Example:
'listener.0.0.0.0_80.downstream_cx_total' ->
('listener.dow... | [
"Takes",
"a",
"metric",
"formatted",
"by",
"Envoy",
"and",
"splits",
"it",
"into",
"a",
"unique",
"metric",
"name",
".",
"Returns",
"the",
"unique",
"metric",
"name",
"a",
"list",
"of",
"tags",
"and",
"the",
"name",
"of",
"the",
"submission",
"method",
"... | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/envoy/datadog_checks/envoy/parser.py#L23-L88 | [
"def",
"parse_metric",
"(",
"metric",
",",
"metric_mapping",
"=",
"METRIC_TREE",
")",
":",
"metric_parts",
"=",
"[",
"]",
"tag_names",
"=",
"[",
"]",
"tag_values",
"=",
"[",
"]",
"tag_builder",
"=",
"[",
"]",
"unknown_tags",
"=",
"[",
"]",
"num_tags",
"=... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | parse_histogram | Iterates over histogram data, yielding metric-value pairs. | envoy/datadog_checks/envoy/parser.py | def parse_histogram(metric, histogram):
"""Iterates over histogram data, yielding metric-value pairs."""
for match in HISTOGRAM.finditer(histogram):
percentile, value = match.groups()
value = float(value)
if not isnan(value):
try:
yield metric + PERCENTILE_SU... | def parse_histogram(metric, histogram):
"""Iterates over histogram data, yielding metric-value pairs."""
for match in HISTOGRAM.finditer(histogram):
percentile, value = match.groups()
value = float(value)
if not isnan(value):
try:
yield metric + PERCENTILE_SU... | [
"Iterates",
"over",
"histogram",
"data",
"yielding",
"metric",
"-",
"value",
"pairs",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/envoy/datadog_checks/envoy/parser.py#L106-L118 | [
"def",
"parse_histogram",
"(",
"metric",
",",
"histogram",
")",
":",
"for",
"match",
"in",
"HISTOGRAM",
".",
"finditer",
"(",
"histogram",
")",
":",
"percentile",
",",
"value",
"=",
"match",
".",
"groups",
"(",
")",
"value",
"=",
"float",
"(",
"value",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | GridFS.put | Put data in GridFS as a new file.
Equivalent to doing::
try:
f = new_file(**kwargs)
f.write(data)
finally:
f.close()
`data` can be either an instance of :class:`str` (:class:`bytes`
in python 3) or a file-like object providing a :m... | tokumx/datadog_checks/tokumx/vendor/gridfs/__init__.py | def put(self, data, **kwargs):
"""Put data in GridFS as a new file.
Equivalent to doing::
try:
f = new_file(**kwargs)
f.write(data)
finally:
f.close()
`data` can be either an instance of :class:`str` (:class:`bytes`
in pyth... | def put(self, data, **kwargs):
"""Put data in GridFS as a new file.
Equivalent to doing::
try:
f = new_file(**kwargs)
f.write(data)
finally:
f.close()
`data` can be either an instance of :class:`str` (:class:`bytes`
in pyth... | [
"Put",
"data",
"in",
"GridFS",
"as",
"a",
"new",
"file",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/gridfs/__init__.py#L89-L126 | [
"def",
"put",
"(",
"self",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"grid_file",
"=",
"GridIn",
"(",
"self",
".",
"__collection",
",",
"*",
"*",
"kwargs",
")",
"try",
":",
"grid_file",
".",
"write",
"(",
"data",
")",
"finally",
":",
"grid_fi... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | GridFS.delete | Delete a file from GridFS by ``"_id"``.
Deletes all data belonging to the file with ``"_id"``:
`file_id`.
.. warning:: Any processes/threads reading from the file while
this method is executing will likely see an invalid/corrupt
file. Care should be taken to avoid concurr... | tokumx/datadog_checks/tokumx/vendor/gridfs/__init__.py | def delete(self, file_id):
"""Delete a file from GridFS by ``"_id"``.
Deletes all data belonging to the file with ``"_id"``:
`file_id`.
.. warning:: Any processes/threads reading from the file while
this method is executing will likely see an invalid/corrupt
file.... | def delete(self, file_id):
"""Delete a file from GridFS by ``"_id"``.
Deletes all data belonging to the file with ``"_id"``:
`file_id`.
.. warning:: Any processes/threads reading from the file while
this method is executing will likely see an invalid/corrupt
file.... | [
"Delete",
"a",
"file",
"from",
"GridFS",
"by",
"_id",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/gridfs/__init__.py#L203-L224 | [
"def",
"delete",
"(",
"self",
",",
"file_id",
")",
":",
"self",
".",
"__files",
".",
"delete_one",
"(",
"{",
"\"_id\"",
":",
"file_id",
"}",
")",
"self",
".",
"__chunks",
".",
"delete_many",
"(",
"{",
"\"files_id\"",
":",
"file_id",
"}",
")"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | GridFS.find_one | Get a single file from gridfs.
All arguments to :meth:`find` are also valid arguments for
:meth:`find_one`, although any `limit` argument will be
ignored. Returns a single :class:`~gridfs.grid_file.GridOut`,
or ``None`` if no matching file is found. For example::
file = fs.... | tokumx/datadog_checks/tokumx/vendor/gridfs/__init__.py | def find_one(self, filter=None, *args, **kwargs):
"""Get a single file from gridfs.
All arguments to :meth:`find` are also valid arguments for
:meth:`find_one`, although any `limit` argument will be
ignored. Returns a single :class:`~gridfs.grid_file.GridOut`,
or ``None`` if no ... | def find_one(self, filter=None, *args, **kwargs):
"""Get a single file from gridfs.
All arguments to :meth:`find` are also valid arguments for
:meth:`find_one`, although any `limit` argument will be
ignored. Returns a single :class:`~gridfs.grid_file.GridOut`,
or ``None`` if no ... | [
"Get",
"a",
"single",
"file",
"from",
"gridfs",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/gridfs/__init__.py#L239-L264 | [
"def",
"find_one",
"(",
"self",
",",
"filter",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"filter",
"is",
"not",
"None",
"and",
"not",
"isinstance",
"(",
"filter",
",",
"Mapping",
")",
":",
"filter",
"=",
"{",
"\"_id\""... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | GridFS.exists | Check if a file exists in this instance of :class:`GridFS`.
The file to check for can be specified by the value of its
``_id`` key, or by passing in a query document. A query
document can be passed in as dictionary, or by using keyword
arguments. Thus, the following three calls are equi... | tokumx/datadog_checks/tokumx/vendor/gridfs/__init__.py | def exists(self, document_or_id=None, **kwargs):
"""Check if a file exists in this instance of :class:`GridFS`.
The file to check for can be specified by the value of its
``_id`` key, or by passing in a query document. A query
document can be passed in as dictionary, or by using keyword... | def exists(self, document_or_id=None, **kwargs):
"""Check if a file exists in this instance of :class:`GridFS`.
The file to check for can be specified by the value of its
``_id`` key, or by passing in a query document. A query
document can be passed in as dictionary, or by using keyword... | [
"Check",
"if",
"a",
"file",
"exists",
"in",
"this",
"instance",
"of",
":",
"class",
":",
"GridFS",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/gridfs/__init__.py#L323-L358 | [
"def",
"exists",
"(",
"self",
",",
"document_or_id",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"kwargs",
":",
"return",
"self",
".",
"__files",
".",
"find_one",
"(",
"kwargs",
",",
"[",
"\"_id\"",
"]",
")",
"is",
"not",
"None",
"return",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | GridFSBucket.open_upload_stream | Opens a Stream that the application can write the contents of the
file to.
The user must specify the filename, and can choose to add any
additional information in the metadata field of the file document or
modify the chunk size.
For example::
my_db = MongoClient().tes... | tokumx/datadog_checks/tokumx/vendor/gridfs/__init__.py | def open_upload_stream(self, filename, chunk_size_bytes=None,
metadata=None):
"""Opens a Stream that the application can write the contents of the
file to.
The user must specify the filename, and can choose to add any
additional information in the metadata fie... | def open_upload_stream(self, filename, chunk_size_bytes=None,
metadata=None):
"""Opens a Stream that the application can write the contents of the
file to.
The user must specify the filename, and can choose to add any
additional information in the metadata fie... | [
"Opens",
"a",
"Stream",
"that",
"the",
"application",
"can",
"write",
"the",
"contents",
"of",
"the",
"file",
"to",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/gridfs/__init__.py#L411-L451 | [
"def",
"open_upload_stream",
"(",
"self",
",",
"filename",
",",
"chunk_size_bytes",
"=",
"None",
",",
"metadata",
"=",
"None",
")",
":",
"validate_string",
"(",
"\"filename\"",
",",
"filename",
")",
"opts",
"=",
"{",
"\"filename\"",
":",
"filename",
",",
"\"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | GridFSBucket.open_upload_stream_with_id | Opens a Stream that the application can write the contents of the
file to.
The user must specify the file id and filename, and can choose to add
any additional information in the metadata field of the file document
or modify the chunk size.
For example::
my_db = Mongo... | tokumx/datadog_checks/tokumx/vendor/gridfs/__init__.py | def open_upload_stream_with_id(
self, file_id, filename, chunk_size_bytes=None, metadata=None):
"""Opens a Stream that the application can write the contents of the
file to.
The user must specify the file id and filename, and can choose to add
any additional information in t... | def open_upload_stream_with_id(
self, file_id, filename, chunk_size_bytes=None, metadata=None):
"""Opens a Stream that the application can write the contents of the
file to.
The user must specify the file id and filename, and can choose to add
any additional information in t... | [
"Opens",
"a",
"Stream",
"that",
"the",
"application",
"can",
"write",
"the",
"contents",
"of",
"the",
"file",
"to",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/gridfs/__init__.py#L453-L498 | [
"def",
"open_upload_stream_with_id",
"(",
"self",
",",
"file_id",
",",
"filename",
",",
"chunk_size_bytes",
"=",
"None",
",",
"metadata",
"=",
"None",
")",
":",
"validate_string",
"(",
"\"filename\"",
",",
"filename",
")",
"opts",
"=",
"{",
"\"_id\"",
":",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | GridFSBucket.upload_from_stream_with_id | Uploads a user file to a GridFS bucket with a custom file id.
Reads the contents of the user file from `source` and uploads
it to the file `filename`. Source can be a string or file-like object.
For example::
my_db = MongoClient().test
fs = GridFSBucket(my_db)
fil... | tokumx/datadog_checks/tokumx/vendor/gridfs/__init__.py | def upload_from_stream_with_id(self, file_id, filename, source,
chunk_size_bytes=None, metadata=None):
"""Uploads a user file to a GridFS bucket with a custom file id.
Reads the contents of the user file from `source` and uploads
it to the file `filename`. Sou... | def upload_from_stream_with_id(self, file_id, filename, source,
chunk_size_bytes=None, metadata=None):
"""Uploads a user file to a GridFS bucket with a custom file id.
Reads the contents of the user file from `source` and uploads
it to the file `filename`. Sou... | [
"Uploads",
"a",
"user",
"file",
"to",
"a",
"GridFS",
"bucket",
"with",
"a",
"custom",
"file",
"id",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/gridfs/__init__.py#L538-L573 | [
"def",
"upload_from_stream_with_id",
"(",
"self",
",",
"file_id",
",",
"filename",
",",
"source",
",",
"chunk_size_bytes",
"=",
"None",
",",
"metadata",
"=",
"None",
")",
":",
"with",
"self",
".",
"open_upload_stream_with_id",
"(",
"file_id",
",",
"filename",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | GridFSBucket.open_download_stream | Opens a Stream from which the application can read the contents of
the stored file specified by file_id.
For example::
my_db = MongoClient().test
fs = GridFSBucket(my_db)
# get _id of file to read.
file_id = fs.upload_from_stream("test_file", "data I want to sto... | tokumx/datadog_checks/tokumx/vendor/gridfs/__init__.py | def open_download_stream(self, file_id):
"""Opens a Stream from which the application can read the contents of
the stored file specified by file_id.
For example::
my_db = MongoClient().test
fs = GridFSBucket(my_db)
# get _id of file to read.
file_id = fs... | def open_download_stream(self, file_id):
"""Opens a Stream from which the application can read the contents of
the stored file specified by file_id.
For example::
my_db = MongoClient().test
fs = GridFSBucket(my_db)
# get _id of file to read.
file_id = fs... | [
"Opens",
"a",
"Stream",
"from",
"which",
"the",
"application",
"can",
"read",
"the",
"contents",
"of",
"the",
"stored",
"file",
"specified",
"by",
"file_id",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/gridfs/__init__.py#L575-L599 | [
"def",
"open_download_stream",
"(",
"self",
",",
"file_id",
")",
":",
"gout",
"=",
"GridOut",
"(",
"self",
".",
"_collection",
",",
"file_id",
")",
"# Raise NoFile now, instead of on first attribute access.",
"gout",
".",
"_ensure_file",
"(",
")",
"return",
"gout"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | GridFSBucket.download_to_stream | Downloads the contents of the stored file specified by file_id and
writes the contents to `destination`.
For example::
my_db = MongoClient().test
fs = GridFSBucket(my_db)
# Get _id of file to read
file_id = fs.upload_from_stream("test_file", "data I want to stor... | tokumx/datadog_checks/tokumx/vendor/gridfs/__init__.py | def download_to_stream(self, file_id, destination):
"""Downloads the contents of the stored file specified by file_id and
writes the contents to `destination`.
For example::
my_db = MongoClient().test
fs = GridFSBucket(my_db)
# Get _id of file to read
fi... | def download_to_stream(self, file_id, destination):
"""Downloads the contents of the stored file specified by file_id and
writes the contents to `destination`.
For example::
my_db = MongoClient().test
fs = GridFSBucket(my_db)
# Get _id of file to read
fi... | [
"Downloads",
"the",
"contents",
"of",
"the",
"stored",
"file",
"specified",
"by",
"file_id",
"and",
"writes",
"the",
"contents",
"to",
"destination",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/gridfs/__init__.py#L601-L625 | [
"def",
"download_to_stream",
"(",
"self",
",",
"file_id",
",",
"destination",
")",
":",
"gout",
"=",
"self",
".",
"open_download_stream",
"(",
"file_id",
")",
"for",
"chunk",
"in",
"gout",
":",
"destination",
".",
"write",
"(",
"chunk",
")"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | GridFSBucket.delete | Given an file_id, delete this stored file's files collection document
and associated chunks from a GridFS bucket.
For example::
my_db = MongoClient().test
fs = GridFSBucket(my_db)
# Get _id of file to delete
file_id = fs.upload_from_stream("test_file", "data I w... | tokumx/datadog_checks/tokumx/vendor/gridfs/__init__.py | def delete(self, file_id):
"""Given an file_id, delete this stored file's files collection document
and associated chunks from a GridFS bucket.
For example::
my_db = MongoClient().test
fs = GridFSBucket(my_db)
# Get _id of file to delete
file_id = fs.upl... | def delete(self, file_id):
"""Given an file_id, delete this stored file's files collection document
and associated chunks from a GridFS bucket.
For example::
my_db = MongoClient().test
fs = GridFSBucket(my_db)
# Get _id of file to delete
file_id = fs.upl... | [
"Given",
"an",
"file_id",
"delete",
"this",
"stored",
"file",
"s",
"files",
"collection",
"document",
"and",
"associated",
"chunks",
"from",
"a",
"GridFS",
"bucket",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/gridfs/__init__.py#L627-L648 | [
"def",
"delete",
"(",
"self",
",",
"file_id",
")",
":",
"res",
"=",
"self",
".",
"_files",
".",
"delete_one",
"(",
"{",
"\"_id\"",
":",
"file_id",
"}",
")",
"self",
".",
"_chunks",
".",
"delete_many",
"(",
"{",
"\"files_id\"",
":",
"file_id",
"}",
")... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | GridFSBucket.open_download_stream_by_name | Opens a Stream from which the application can read the contents of
`filename` and optional `revision`.
For example::
my_db = MongoClient().test
fs = GridFSBucket(my_db)
grid_out = fs.open_download_stream_by_name("test_file")
contents = grid_out.read()
R... | tokumx/datadog_checks/tokumx/vendor/gridfs/__init__.py | def open_download_stream_by_name(self, filename, revision=-1):
"""Opens a Stream from which the application can read the contents of
`filename` and optional `revision`.
For example::
my_db = MongoClient().test
fs = GridFSBucket(my_db)
grid_out = fs.open_download_s... | def open_download_stream_by_name(self, filename, revision=-1):
"""Opens a Stream from which the application can read the contents of
`filename` and optional `revision`.
For example::
my_db = MongoClient().test
fs = GridFSBucket(my_db)
grid_out = fs.open_download_s... | [
"Opens",
"a",
"Stream",
"from",
"which",
"the",
"application",
"can",
"read",
"the",
"contents",
"of",
"filename",
"and",
"optional",
"revision",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/gridfs/__init__.py#L694-L742 | [
"def",
"open_download_stream_by_name",
"(",
"self",
",",
"filename",
",",
"revision",
"=",
"-",
"1",
")",
":",
"validate_string",
"(",
"\"filename\"",
",",
"filename",
")",
"query",
"=",
"{",
"\"filename\"",
":",
"filename",
"}",
"cursor",
"=",
"self",
".",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | ls | List active or available environments. | datadog_checks_dev/datadog_checks/dev/tooling/commands/env/ls.py | def ls(checks):
"""List active or available environments."""
if checks:
checks = sorted(get_testable_checks() & set(checks))
for check in checks:
envs = get_available_tox_envs(check, e2e_only=True)
if envs:
echo_success('{}:'.format(check))
... | def ls(checks):
"""List active or available environments."""
if checks:
checks = sorted(get_testable_checks() & set(checks))
for check in checks:
envs = get_available_tox_envs(check, e2e_only=True)
if envs:
echo_success('{}:'.format(check))
... | [
"List",
"active",
"or",
"available",
"environments",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/env/ls.py#L14-L34 | [
"def",
"ls",
"(",
"checks",
")",
":",
"if",
"checks",
":",
"checks",
"=",
"sorted",
"(",
"get_testable_checks",
"(",
")",
"&",
"set",
"(",
"checks",
")",
")",
"for",
"check",
"in",
"checks",
":",
"envs",
"=",
"get_available_tox_envs",
"(",
"check",
","... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | HAProxy._fetch_url_data | Hit a given http url and return the stats lines | haproxy/datadog_checks/haproxy/haproxy.py | def _fetch_url_data(self, url, username, password, verify, custom_headers):
''' Hit a given http url and return the stats lines '''
# Try to fetch data from the stats URL
auth = (username, password)
url = "%s%s" % (url, STATS_URL)
custom_headers.update(headers(self.agentConfig))... | def _fetch_url_data(self, url, username, password, verify, custom_headers):
''' Hit a given http url and return the stats lines '''
# Try to fetch data from the stats URL
auth = (username, password)
url = "%s%s" % (url, STATS_URL)
custom_headers.update(headers(self.agentConfig))... | [
"Hit",
"a",
"given",
"http",
"url",
"and",
"return",
"the",
"stats",
"lines"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/haproxy/datadog_checks/haproxy/haproxy.py#L163-L191 | [
"def",
"_fetch_url_data",
"(",
"self",
",",
"url",
",",
"username",
",",
"password",
",",
"verify",
",",
"custom_headers",
")",
":",
"# Try to fetch data from the stats URL",
"auth",
"=",
"(",
"username",
",",
"password",
")",
"url",
"=",
"\"%s%s\"",
"%",
"(",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | HAProxy._fetch_socket_data | Hit a given stats socket and return the stats lines | haproxy/datadog_checks/haproxy/haproxy.py | def _fetch_socket_data(self, parsed_url):
''' Hit a given stats socket and return the stats lines '''
self.log.debug("Fetching haproxy stats from socket: %s" % parsed_url.geturl())
if parsed_url.scheme == 'tcp':
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s... | def _fetch_socket_data(self, parsed_url):
''' Hit a given stats socket and return the stats lines '''
self.log.debug("Fetching haproxy stats from socket: %s" % parsed_url.geturl())
if parsed_url.scheme == 'tcp':
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s... | [
"Hit",
"a",
"given",
"stats",
"socket",
"and",
"return",
"the",
"stats",
"lines"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/haproxy/datadog_checks/haproxy/haproxy.py#L193-L217 | [
"def",
"_fetch_socket_data",
"(",
"self",
",",
"parsed_url",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"\"Fetching haproxy stats from socket: %s\"",
"%",
"parsed_url",
".",
"geturl",
"(",
")",
")",
"if",
"parsed_url",
".",
"scheme",
"==",
"'tcp'",
":",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | HAProxy._process_data | Main data-processing loop. For each piece of useful data, we'll
either save a metric, save an event or both. | haproxy/datadog_checks/haproxy/haproxy.py | def _process_data(
self,
data,
collect_aggregates_only,
process_events,
url=None,
collect_status_metrics=False,
collect_status_metrics_by_host=False,
tag_service_check_by_host=False,
services_incl_filter=None,
services_excl_filter=None,
... | def _process_data(
self,
data,
collect_aggregates_only,
process_events,
url=None,
collect_status_metrics=False,
collect_status_metrics_by_host=False,
tag_service_check_by_host=False,
services_incl_filter=None,
services_excl_filter=None,
... | [
"Main",
"data",
"-",
"processing",
"loop",
".",
"For",
"each",
"piece",
"of",
"useful",
"data",
"we",
"ll",
"either",
"save",
"a",
"metric",
"save",
"an",
"event",
"or",
"both",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/haproxy/datadog_checks/haproxy/haproxy.py#L219-L339 | [
"def",
"_process_data",
"(",
"self",
",",
"data",
",",
"collect_aggregates_only",
",",
"process_events",
",",
"url",
"=",
"None",
",",
"collect_status_metrics",
"=",
"False",
",",
"collect_status_metrics_by_host",
"=",
"False",
",",
"tag_service_check_by_host",
"=",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | HAProxy._update_data_dict | Adds spct if relevant, adds service | haproxy/datadog_checks/haproxy/haproxy.py | def _update_data_dict(self, data_dict, back_or_front):
"""
Adds spct if relevant, adds service
"""
data_dict['back_or_front'] = back_or_front
# The percentage of used sessions based on 'scur' and 'slim'
if 'slim' in data_dict and 'scur' in data_dict:
try:
... | def _update_data_dict(self, data_dict, back_or_front):
"""
Adds spct if relevant, adds service
"""
data_dict['back_or_front'] = back_or_front
# The percentage of used sessions based on 'scur' and 'slim'
if 'slim' in data_dict and 'scur' in data_dict:
try:
... | [
"Adds",
"spct",
"if",
"relevant",
"adds",
"service"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/haproxy/datadog_checks/haproxy/haproxy.py#L401-L411 | [
"def",
"_update_data_dict",
"(",
"self",
",",
"data_dict",
",",
"back_or_front",
")",
":",
"data_dict",
"[",
"'back_or_front'",
"]",
"=",
"back_or_front",
"# The percentage of used sessions based on 'scur' and 'slim'",
"if",
"'slim'",
"in",
"data_dict",
"and",
"'scur'",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | HAProxy._should_process | if collect_aggregates_only, we process only the aggregates
else we process all except Services.BACKEND | haproxy/datadog_checks/haproxy/haproxy.py | def _should_process(self, data_dict, collect_aggregates_only):
"""
if collect_aggregates_only, we process only the aggregates
else we process all except Services.BACKEND
"""
if collect_aggregates_only:
if self._is_aggregate(data_dict):
return T... | def _should_process(self, data_dict, collect_aggregates_only):
"""
if collect_aggregates_only, we process only the aggregates
else we process all except Services.BACKEND
"""
if collect_aggregates_only:
if self._is_aggregate(data_dict):
return T... | [
"if",
"collect_aggregates_only",
"we",
"process",
"only",
"the",
"aggregates",
"else",
"we",
"process",
"all",
"except",
"Services",
".",
"BACKEND"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/haproxy/datadog_checks/haproxy/haproxy.py#L428-L439 | [
"def",
"_should_process",
"(",
"self",
",",
"data_dict",
",",
"collect_aggregates_only",
")",
":",
"if",
"collect_aggregates_only",
":",
"if",
"self",
".",
"_is_aggregate",
"(",
"data_dict",
")",
":",
"return",
"True",
"return",
"False",
"elif",
"data_dict",
"["... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | HAProxy._tag_from_regex | Use a named regexp on the current service_name to create extra tags
Example HAProxy service name: be_edge_http_sre-prod_elk
Example named regexp: be_edge_http_(?P<team>[a-z]+)\\-(?P<env>[a-z]+)_(?P<app>.*)
Resulting tags: ['team:sre','env:prod','app:elk'] | haproxy/datadog_checks/haproxy/haproxy.py | def _tag_from_regex(self, tags_regex, service_name):
"""
Use a named regexp on the current service_name to create extra tags
Example HAProxy service name: be_edge_http_sre-prod_elk
Example named regexp: be_edge_http_(?P<team>[a-z]+)\\-(?P<env>[a-z]+)_(?P<app>.*)
Resulting tags: [... | def _tag_from_regex(self, tags_regex, service_name):
"""
Use a named regexp on the current service_name to create extra tags
Example HAProxy service name: be_edge_http_sre-prod_elk
Example named regexp: be_edge_http_(?P<team>[a-z]+)\\-(?P<env>[a-z]+)_(?P<app>.*)
Resulting tags: [... | [
"Use",
"a",
"named",
"regexp",
"on",
"the",
"current",
"service_name",
"to",
"create",
"extra",
"tags",
"Example",
"HAProxy",
"service",
"name",
":",
"be_edge_http_sre",
"-",
"prod_elk",
"Example",
"named",
"regexp",
":",
"be_edge_http_",
"(",
"?P<team",
">",
... | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/haproxy/datadog_checks/haproxy/haproxy.py#L456-L473 | [
"def",
"_tag_from_regex",
"(",
"self",
",",
"tags_regex",
",",
"service_name",
")",
":",
"if",
"not",
"tags_regex",
"or",
"not",
"service_name",
":",
"return",
"[",
"]",
"match",
"=",
"re",
".",
"compile",
"(",
"tags_regex",
")",
".",
"match",
"(",
"serv... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | HAProxy._normalize_status | Try to normalize the HAProxy status as one of the statuses defined in `ALL_STATUSES`,
if it can't be matched return the status as-is in a tag-friendly format
ex: 'UP 1/2' -> 'up'
'no check' -> 'no_check' | haproxy/datadog_checks/haproxy/haproxy.py | def _normalize_status(status):
"""
Try to normalize the HAProxy status as one of the statuses defined in `ALL_STATUSES`,
if it can't be matched return the status as-is in a tag-friendly format
ex: 'UP 1/2' -> 'up'
'no check' -> 'no_check'
"""
formatted_status ... | def _normalize_status(status):
"""
Try to normalize the HAProxy status as one of the statuses defined in `ALL_STATUSES`,
if it can't be matched return the status as-is in a tag-friendly format
ex: 'UP 1/2' -> 'up'
'no check' -> 'no_check'
"""
formatted_status ... | [
"Try",
"to",
"normalize",
"the",
"HAProxy",
"status",
"as",
"one",
"of",
"the",
"statuses",
"defined",
"in",
"ALL_STATUSES",
"if",
"it",
"can",
"t",
"be",
"matched",
"return",
"the",
"status",
"as",
"-",
"is",
"in",
"a",
"tag",
"-",
"friendly",
"format",... | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/haproxy/datadog_checks/haproxy/haproxy.py#L476-L487 | [
"def",
"_normalize_status",
"(",
"status",
")",
":",
"formatted_status",
"=",
"status",
".",
"lower",
"(",
")",
".",
"replace",
"(",
"\" \"",
",",
"\"_\"",
")",
"for",
"normalized_status",
"in",
"Services",
".",
"ALL_STATUSES",
":",
"if",
"formatted_status",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | HAProxy._process_metrics | Data is a dictionary related to one host
(one line) extracted from the csv.
It should look like:
{'pxname':'dogweb', 'svname':'i-4562165', 'scur':'42', ...} | haproxy/datadog_checks/haproxy/haproxy.py | def _process_metrics(
self, data, url, services_incl_filter=None, services_excl_filter=None, custom_tags=None, active_tag=None
):
"""
Data is a dictionary related to one host
(one line) extracted from the csv.
It should look like:
{'pxname':'dogweb', 'svname':'i-45621... | def _process_metrics(
self, data, url, services_incl_filter=None, services_excl_filter=None, custom_tags=None, active_tag=None
):
"""
Data is a dictionary related to one host
(one line) extracted from the csv.
It should look like:
{'pxname':'dogweb', 'svname':'i-45621... | [
"Data",
"is",
"a",
"dictionary",
"related",
"to",
"one",
"host",
"(",
"one",
"line",
")",
"extracted",
"from",
"the",
"csv",
".",
"It",
"should",
"look",
"like",
":",
"{",
"pxname",
":",
"dogweb",
"svname",
":",
"i",
"-",
"4562165",
"scur",
":",
"42"... | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/haproxy/datadog_checks/haproxy/haproxy.py#L601-L637 | [
"def",
"_process_metrics",
"(",
"self",
",",
"data",
",",
"url",
",",
"services_incl_filter",
"=",
"None",
",",
"services_excl_filter",
"=",
"None",
",",
"custom_tags",
"=",
"None",
",",
"active_tag",
"=",
"None",
")",
":",
"hostname",
"=",
"data",
"[",
"'... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | HAProxy._process_event | Main event processing loop. An event will be created for a service
status change.
Service checks on the server side can be used to provide the same functionality | haproxy/datadog_checks/haproxy/haproxy.py | def _process_event(self, data, url, services_incl_filter=None, services_excl_filter=None, custom_tags=None):
'''
Main event processing loop. An event will be created for a service
status change.
Service checks on the server side can be used to provide the same functionality
'''
... | def _process_event(self, data, url, services_incl_filter=None, services_excl_filter=None, custom_tags=None):
'''
Main event processing loop. An event will be created for a service
status change.
Service checks on the server side can be used to provide the same functionality
'''
... | [
"Main",
"event",
"processing",
"loop",
".",
"An",
"event",
"will",
"be",
"created",
"for",
"a",
"service",
"status",
"change",
".",
"Service",
"checks",
"on",
"the",
"server",
"side",
"can",
"be",
"used",
"to",
"provide",
"the",
"same",
"functionality"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/haproxy/datadog_checks/haproxy/haproxy.py#L639-L673 | [
"def",
"_process_event",
"(",
"self",
",",
"data",
",",
"url",
",",
"services_incl_filter",
"=",
"None",
",",
"services_excl_filter",
"=",
"None",
",",
"custom_tags",
"=",
"None",
")",
":",
"hostname",
"=",
"data",
"[",
"'svname'",
"]",
"service_name",
"=",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | HAProxy._process_service_check | Report a service check, tagged by the service and the backend.
Statuses are defined in `STATUS_TO_SERVICE_CHECK` mapping. | haproxy/datadog_checks/haproxy/haproxy.py | def _process_service_check(
self, data, url, tag_by_host=False, services_incl_filter=None, services_excl_filter=None, custom_tags=None
):
''' Report a service check, tagged by the service and the backend.
Statuses are defined in `STATUS_TO_SERVICE_CHECK` mapping.
'''
cust... | def _process_service_check(
self, data, url, tag_by_host=False, services_incl_filter=None, services_excl_filter=None, custom_tags=None
):
''' Report a service check, tagged by the service and the backend.
Statuses are defined in `STATUS_TO_SERVICE_CHECK` mapping.
'''
cust... | [
"Report",
"a",
"service",
"check",
"tagged",
"by",
"the",
"service",
"and",
"the",
"backend",
".",
"Statuses",
"are",
"defined",
"in",
"STATUS_TO_SERVICE_CHECK",
"mapping",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/haproxy/datadog_checks/haproxy/haproxy.py#L703-L729 | [
"def",
"_process_service_check",
"(",
"self",
",",
"data",
",",
"url",
",",
"tag_by_host",
"=",
"False",
",",
"services_incl_filter",
"=",
"None",
",",
"services_excl_filter",
"=",
"None",
",",
"custom_tags",
"=",
"None",
")",
":",
"custom_tags",
"=",
"[",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | apply_single_tag_set | All servers matching one tag set.
A tag set is a dict. A server matches if its tags are a superset:
A server tagged {'a': '1', 'b': '2'} matches the tag set {'a': '1'}.
The empty tag set {} matches any server. | tokumx/datadog_checks/tokumx/vendor/pymongo/server_selectors.py | def apply_single_tag_set(tag_set, selection):
"""All servers matching one tag set.
A tag set is a dict. A server matches if its tags are a superset:
A server tagged {'a': '1', 'b': '2'} matches the tag set {'a': '1'}.
The empty tag set {} matches any server.
"""
def tags_match(server_tags):
... | def apply_single_tag_set(tag_set, selection):
"""All servers matching one tag set.
A tag set is a dict. A server matches if its tags are a superset:
A server tagged {'a': '1', 'b': '2'} matches the tag set {'a': '1'}.
The empty tag set {} matches any server.
"""
def tags_match(server_tags):
... | [
"All",
"servers",
"matching",
"one",
"tag",
"set",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/server_selectors.py#L113-L129 | [
"def",
"apply_single_tag_set",
"(",
"tag_set",
",",
"selection",
")",
":",
"def",
"tags_match",
"(",
"server_tags",
")",
":",
"for",
"key",
",",
"value",
"in",
"tag_set",
".",
"items",
"(",
")",
":",
"if",
"key",
"not",
"in",
"server_tags",
"or",
"server... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | apply_tag_sets | All servers match a list of tag sets.
tag_sets is a list of dicts. The empty tag set {} matches any server,
and may be provided at the end of the list as a fallback. So
[{'a': 'value'}, {}] expresses a preference for servers tagged
{'a': 'value'}, but accepts any server if none matches the first
pr... | tokumx/datadog_checks/tokumx/vendor/pymongo/server_selectors.py | def apply_tag_sets(tag_sets, selection):
"""All servers match a list of tag sets.
tag_sets is a list of dicts. The empty tag set {} matches any server,
and may be provided at the end of the list as a fallback. So
[{'a': 'value'}, {}] expresses a preference for servers tagged
{'a': 'value'}, but acc... | def apply_tag_sets(tag_sets, selection):
"""All servers match a list of tag sets.
tag_sets is a list of dicts. The empty tag set {} matches any server,
and may be provided at the end of the list as a fallback. So
[{'a': 'value'}, {}] expresses a preference for servers tagged
{'a': 'value'}, but acc... | [
"All",
"servers",
"match",
"a",
"list",
"of",
"tag",
"sets",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/server_selectors.py#L132-L146 | [
"def",
"apply_tag_sets",
"(",
"tag_sets",
",",
"selection",
")",
":",
"for",
"tag_set",
"in",
"tag_sets",
":",
"with_tag_set",
"=",
"apply_single_tag_set",
"(",
"tag_set",
",",
"selection",
")",
"if",
"with_tag_set",
":",
"return",
"with_tag_set",
"return",
"sel... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | metadata | Validates metadata.csv files
If `check` is specified, only the check will be validated,
otherwise all metadata files in the repo will be. | datadog_checks_dev/datadog_checks/dev/tooling/commands/validate/metadata.py | def metadata(check):
"""Validates metadata.csv files
If `check` is specified, only the check will be validated,
otherwise all metadata files in the repo will be.
"""
metric_sources = get_metric_sources()
if check:
if check not in metric_sources:
abort('Metadata file `{}` do... | def metadata(check):
"""Validates metadata.csv files
If `check` is specified, only the check will be validated,
otherwise all metadata files in the repo will be.
"""
metric_sources = get_metric_sources()
if check:
if check not in metric_sources:
abort('Metadata file `{}` do... | [
"Validates",
"metadata",
".",
"csv",
"files"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/validate/metadata.py#L172-L313 | [
"def",
"metadata",
"(",
"check",
")",
":",
"metric_sources",
"=",
"get_metric_sources",
"(",
")",
"if",
"check",
":",
"if",
"check",
"not",
"in",
"metric_sources",
":",
"abort",
"(",
"'Metadata file `{}` does not exist.'",
".",
"format",
"(",
"get_metadata_file",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _build_credentials_tuple | Build and return a mechanism specific credentials tuple. | tokumx/datadog_checks/tokumx/vendor/pymongo/auth.py | def _build_credentials_tuple(mech, source, user, passwd, extra):
"""Build and return a mechanism specific credentials tuple.
"""
user = _unicode(user) if user is not None else None
password = passwd if passwd is None else _unicode(passwd)
if mech == 'GSSAPI':
properties = extra.get('authmech... | def _build_credentials_tuple(mech, source, user, passwd, extra):
"""Build and return a mechanism specific credentials tuple.
"""
user = _unicode(user) if user is not None else None
password = passwd if passwd is None else _unicode(passwd)
if mech == 'GSSAPI':
properties = extra.get('authmech... | [
"Build",
"and",
"return",
"a",
"mechanism",
"specific",
"credentials",
"tuple",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/auth.py#L66-L87 | [
"def",
"_build_credentials_tuple",
"(",
"mech",
",",
"source",
",",
"user",
",",
"passwd",
",",
"extra",
")",
":",
"user",
"=",
"_unicode",
"(",
"user",
")",
"if",
"user",
"is",
"not",
"None",
"else",
"None",
"password",
"=",
"passwd",
"if",
"passwd",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _parse_scram_response | Split a scram response into key, value pairs. | tokumx/datadog_checks/tokumx/vendor/pymongo/auth.py | def _parse_scram_response(response):
"""Split a scram response into key, value pairs."""
return dict(item.split(b"=", 1) for item in response.split(b",")) | def _parse_scram_response(response):
"""Split a scram response into key, value pairs."""
return dict(item.split(b"=", 1) for item in response.split(b",")) | [
"Split",
"a",
"scram",
"response",
"into",
"key",
"value",
"pairs",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/auth.py#L185-L187 | [
"def",
"_parse_scram_response",
"(",
"response",
")",
":",
"return",
"dict",
"(",
"item",
".",
"split",
"(",
"b\"=\"",
",",
"1",
")",
"for",
"item",
"in",
"response",
".",
"split",
"(",
"b\",\"",
")",
")"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _authenticate_scram_sha1 | Authenticate using SCRAM-SHA-1. | tokumx/datadog_checks/tokumx/vendor/pymongo/auth.py | def _authenticate_scram_sha1(credentials, sock_info):
"""Authenticate using SCRAM-SHA-1."""
username = credentials.username
password = credentials.password
source = credentials.source
# Make local
_hmac = hmac.HMAC
_sha1 = sha1
user = username.encode("utf-8").replace(b"=", b"=3D").repl... | def _authenticate_scram_sha1(credentials, sock_info):
"""Authenticate using SCRAM-SHA-1."""
username = credentials.username
password = credentials.password
source = credentials.source
# Make local
_hmac = hmac.HMAC
_sha1 = sha1
user = username.encode("utf-8").replace(b"=", b"=3D").repl... | [
"Authenticate",
"using",
"SCRAM",
"-",
"SHA",
"-",
"1",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/auth.py#L190-L251 | [
"def",
"_authenticate_scram_sha1",
"(",
"credentials",
",",
"sock_info",
")",
":",
"username",
"=",
"credentials",
".",
"username",
"password",
"=",
"credentials",
".",
"password",
"source",
"=",
"credentials",
".",
"source",
"# Make local",
"_hmac",
"=",
"hmac",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _authenticate_gssapi | Authenticate using GSSAPI. | tokumx/datadog_checks/tokumx/vendor/pymongo/auth.py | def _authenticate_gssapi(credentials, sock_info):
"""Authenticate using GSSAPI.
"""
if not HAVE_KERBEROS:
raise ConfigurationError('The "kerberos" module must be '
'installed to use GSSAPI authentication.')
try:
username = credentials.username
pa... | def _authenticate_gssapi(credentials, sock_info):
"""Authenticate using GSSAPI.
"""
if not HAVE_KERBEROS:
raise ConfigurationError('The "kerberos" module must be '
'installed to use GSSAPI authentication.')
try:
username = credentials.username
pa... | [
"Authenticate",
"using",
"GSSAPI",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/auth.py#L282-L389 | [
"def",
"_authenticate_gssapi",
"(",
"credentials",
",",
"sock_info",
")",
":",
"if",
"not",
"HAVE_KERBEROS",
":",
"raise",
"ConfigurationError",
"(",
"'The \"kerberos\" module must be '",
"'installed to use GSSAPI authentication.'",
")",
"try",
":",
"username",
"=",
"cred... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _authenticate_plain | Authenticate using SASL PLAIN (RFC 4616) | tokumx/datadog_checks/tokumx/vendor/pymongo/auth.py | def _authenticate_plain(credentials, sock_info):
"""Authenticate using SASL PLAIN (RFC 4616)
"""
source = credentials.source
username = credentials.username
password = credentials.password
payload = ('\x00%s\x00%s' % (username, password)).encode('utf-8')
cmd = SON([('saslStart', 1),
... | def _authenticate_plain(credentials, sock_info):
"""Authenticate using SASL PLAIN (RFC 4616)
"""
source = credentials.source
username = credentials.username
password = credentials.password
payload = ('\x00%s\x00%s' % (username, password)).encode('utf-8')
cmd = SON([('saslStart', 1),
... | [
"Authenticate",
"using",
"SASL",
"PLAIN",
"(",
"RFC",
"4616",
")"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/auth.py#L392-L403 | [
"def",
"_authenticate_plain",
"(",
"credentials",
",",
"sock_info",
")",
":",
"source",
"=",
"credentials",
".",
"source",
"username",
"=",
"credentials",
".",
"username",
"password",
"=",
"credentials",
".",
"password",
"payload",
"=",
"(",
"'\\x00%s\\x00%s'",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _authenticate_cram_md5 | Authenticate using CRAM-MD5 (RFC 2195) | tokumx/datadog_checks/tokumx/vendor/pymongo/auth.py | def _authenticate_cram_md5(credentials, sock_info):
"""Authenticate using CRAM-MD5 (RFC 2195)
"""
source = credentials.source
username = credentials.username
password = credentials.password
# The password used as the mac key is the
# same as what we use for MONGODB-CR
passwd = _password_... | def _authenticate_cram_md5(credentials, sock_info):
"""Authenticate using CRAM-MD5 (RFC 2195)
"""
source = credentials.source
username = credentials.username
password = credentials.password
# The password used as the mac key is the
# same as what we use for MONGODB-CR
passwd = _password_... | [
"Authenticate",
"using",
"CRAM",
"-",
"MD5",
"(",
"RFC",
"2195",
")"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/auth.py#L406-L428 | [
"def",
"_authenticate_cram_md5",
"(",
"credentials",
",",
"sock_info",
")",
":",
"source",
"=",
"credentials",
".",
"source",
"username",
"=",
"credentials",
".",
"username",
"password",
"=",
"credentials",
".",
"password",
"# The password used as the mac key is the",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _authenticate_x509 | Authenticate using MONGODB-X509. | tokumx/datadog_checks/tokumx/vendor/pymongo/auth.py | def _authenticate_x509(credentials, sock_info):
"""Authenticate using MONGODB-X509.
"""
query = SON([('authenticate', 1),
('mechanism', 'MONGODB-X509')])
if credentials.username is not None:
query['user'] = credentials.username
elif sock_info.max_wire_version < 5:
ra... | def _authenticate_x509(credentials, sock_info):
"""Authenticate using MONGODB-X509.
"""
query = SON([('authenticate', 1),
('mechanism', 'MONGODB-X509')])
if credentials.username is not None:
query['user'] = credentials.username
elif sock_info.max_wire_version < 5:
ra... | [
"Authenticate",
"using",
"MONGODB",
"-",
"X509",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/auth.py#L431-L442 | [
"def",
"_authenticate_x509",
"(",
"credentials",
",",
"sock_info",
")",
":",
"query",
"=",
"SON",
"(",
"[",
"(",
"'authenticate'",
",",
"1",
")",
",",
"(",
"'mechanism'",
",",
"'MONGODB-X509'",
")",
"]",
")",
"if",
"credentials",
".",
"username",
"is",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _authenticate_mongo_cr | Authenticate using MONGODB-CR. | tokumx/datadog_checks/tokumx/vendor/pymongo/auth.py | def _authenticate_mongo_cr(credentials, sock_info):
"""Authenticate using MONGODB-CR.
"""
source = credentials.source
username = credentials.username
password = credentials.password
# Get a nonce
response = sock_info.command(source, {'getnonce': 1})
nonce = response['nonce']
key = _a... | def _authenticate_mongo_cr(credentials, sock_info):
"""Authenticate using MONGODB-CR.
"""
source = credentials.source
username = credentials.username
password = credentials.password
# Get a nonce
response = sock_info.command(source, {'getnonce': 1})
nonce = response['nonce']
key = _a... | [
"Authenticate",
"using",
"MONGODB",
"-",
"CR",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/auth.py#L445-L461 | [
"def",
"_authenticate_mongo_cr",
"(",
"credentials",
",",
"sock_info",
")",
":",
"source",
"=",
"credentials",
".",
"source",
"username",
"=",
"credentials",
".",
"username",
"password",
"=",
"credentials",
".",
"password",
"# Get a nonce",
"response",
"=",
"sock_... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | authenticate | Authenticate sock_info. | tokumx/datadog_checks/tokumx/vendor/pymongo/auth.py | def authenticate(credentials, sock_info):
"""Authenticate sock_info."""
mechanism = credentials.mechanism
auth_func = _AUTH_MAP.get(mechanism)
auth_func(credentials, sock_info) | def authenticate(credentials, sock_info):
"""Authenticate sock_info."""
mechanism = credentials.mechanism
auth_func = _AUTH_MAP.get(mechanism)
auth_func(credentials, sock_info) | [
"Authenticate",
"sock_info",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/auth.py#L482-L486 | [
"def",
"authenticate",
"(",
"credentials",
",",
"sock_info",
")",
":",
"mechanism",
"=",
"credentials",
".",
"mechanism",
"auth_func",
"=",
"_AUTH_MAP",
".",
"get",
"(",
"mechanism",
")",
"auth_func",
"(",
"credentials",
",",
"sock_info",
")"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | OpenMetricsScraperMixin.parse_metric_family | Parse the MetricFamily from a valid requests.Response object to provide a MetricFamily object (see [0])
The text format uses iter_lines() generator.
:param response: requests.Response
:return: core.Metric | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | def parse_metric_family(self, response, scraper_config):
"""
Parse the MetricFamily from a valid requests.Response object to provide a MetricFamily object (see [0])
The text format uses iter_lines() generator.
:param response: requests.Response
:return: core.Metric
"""
... | def parse_metric_family(self, response, scraper_config):
"""
Parse the MetricFamily from a valid requests.Response object to provide a MetricFamily object (see [0])
The text format uses iter_lines() generator.
:param response: requests.Response
:return: core.Metric
"""
... | [
"Parse",
"the",
"MetricFamily",
"from",
"a",
"valid",
"requests",
".",
"Response",
"object",
"to",
"provide",
"a",
"MetricFamily",
"object",
"(",
"see",
"[",
"0",
"]",
")",
"The",
"text",
"format",
"uses",
"iter_lines",
"()",
"generator",
".",
":",
"param"... | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py#L225-L241 | [
"def",
"parse_metric_family",
"(",
"self",
",",
"response",
",",
"scraper_config",
")",
":",
"input_gen",
"=",
"response",
".",
"iter_lines",
"(",
"chunk_size",
"=",
"self",
".",
"REQUESTS_CHUNK_SIZE",
",",
"decode_unicode",
"=",
"True",
")",
"if",
"scraper_conf... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | OpenMetricsScraperMixin._text_filter_input | Filters out the text input line by line to avoid parsing and processing
metrics we know we don't want to process. This only works on `text/plain`
payloads, and is an INTERNAL FEATURE implemented for the kubelet check
:param input_get: line generator
:output: generator of filtered lines | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | def _text_filter_input(self, input_gen, scraper_config):
"""
Filters out the text input line by line to avoid parsing and processing
metrics we know we don't want to process. This only works on `text/plain`
payloads, and is an INTERNAL FEATURE implemented for the kubelet check
:p... | def _text_filter_input(self, input_gen, scraper_config):
"""
Filters out the text input line by line to avoid parsing and processing
metrics we know we don't want to process. This only works on `text/plain`
payloads, and is an INTERNAL FEATURE implemented for the kubelet check
:p... | [
"Filters",
"out",
"the",
"text",
"input",
"line",
"by",
"line",
"to",
"avoid",
"parsing",
"and",
"processing",
"metrics",
"we",
"know",
"we",
"don",
"t",
"want",
"to",
"process",
".",
"This",
"only",
"works",
"on",
"text",
"/",
"plain",
"payloads",
"and"... | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py#L243-L257 | [
"def",
"_text_filter_input",
"(",
"self",
",",
"input_gen",
",",
"scraper_config",
")",
":",
"for",
"line",
"in",
"input_gen",
":",
"for",
"item",
"in",
"scraper_config",
"[",
"'_text_filter_blacklist'",
"]",
":",
"if",
"item",
"in",
"line",
":",
"break",
"e... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | OpenMetricsScraperMixin.scrape_metrics | Poll the data from prometheus and return the metrics as a generator. | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | def scrape_metrics(self, scraper_config):
"""
Poll the data from prometheus and return the metrics as a generator.
"""
response = self.poll(scraper_config)
try:
# no dry run if no label joins
if not scraper_config['label_joins']:
scraper_co... | def scrape_metrics(self, scraper_config):
"""
Poll the data from prometheus and return the metrics as a generator.
"""
response = self.poll(scraper_config)
try:
# no dry run if no label joins
if not scraper_config['label_joins']:
scraper_co... | [
"Poll",
"the",
"data",
"from",
"prometheus",
"and",
"return",
"the",
"metrics",
"as",
"a",
"generator",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py#L263-L289 | [
"def",
"scrape_metrics",
"(",
"self",
",",
"scraper_config",
")",
":",
"response",
"=",
"self",
".",
"poll",
"(",
"scraper_config",
")",
"try",
":",
"# no dry run if no label joins",
"if",
"not",
"scraper_config",
"[",
"'label_joins'",
"]",
":",
"scraper_config",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | OpenMetricsScraperMixin.process | Polls the data from prometheus and pushes them as gauges
`endpoint` is the metrics endpoint to use to poll metrics from Prometheus
Note that if the instance has a 'tags' attribute, it will be pushed
automatically as additional custom tags and added to the metrics | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | def process(self, scraper_config, metric_transformers=None):
"""
Polls the data from prometheus and pushes them as gauges
`endpoint` is the metrics endpoint to use to poll metrics from Prometheus
Note that if the instance has a 'tags' attribute, it will be pushed
automatically a... | def process(self, scraper_config, metric_transformers=None):
"""
Polls the data from prometheus and pushes them as gauges
`endpoint` is the metrics endpoint to use to poll metrics from Prometheus
Note that if the instance has a 'tags' attribute, it will be pushed
automatically a... | [
"Polls",
"the",
"data",
"from",
"prometheus",
"and",
"pushes",
"them",
"as",
"gauges",
"endpoint",
"is",
"the",
"metrics",
"endpoint",
"to",
"use",
"to",
"poll",
"metrics",
"from",
"Prometheus"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py#L291-L300 | [
"def",
"process",
"(",
"self",
",",
"scraper_config",
",",
"metric_transformers",
"=",
"None",
")",
":",
"for",
"metric",
"in",
"self",
".",
"scrape_metrics",
"(",
"scraper_config",
")",
":",
"self",
".",
"process_metric",
"(",
"metric",
",",
"scraper_config",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | OpenMetricsScraperMixin.process_metric | Handle a prometheus metric according to the following flow:
- search scraper_config['metrics_mapper'] for a prometheus.metric <--> datadog.metric mapping
- call check method with the same name as the metric
- log some info if none of the above worked
`metric_transformers` is... | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | def process_metric(self, metric, scraper_config, metric_transformers=None):
"""
Handle a prometheus metric according to the following flow:
- search scraper_config['metrics_mapper'] for a prometheus.metric <--> datadog.metric mapping
- call check method with the same name as the ... | def process_metric(self, metric, scraper_config, metric_transformers=None):
"""
Handle a prometheus metric according to the following flow:
- search scraper_config['metrics_mapper'] for a prometheus.metric <--> datadog.metric mapping
- call check method with the same name as the ... | [
"Handle",
"a",
"prometheus",
"metric",
"according",
"to",
"the",
"following",
"flow",
":",
"-",
"search",
"scraper_config",
"[",
"metrics_mapper",
"]",
"for",
"a",
"prometheus",
".",
"metric",
"<",
"--",
">",
"datadog",
".",
"metric",
"mapping",
"-",
"call",... | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py#L348-L393 | [
"def",
"process_metric",
"(",
"self",
",",
"metric",
",",
"scraper_config",
",",
"metric_transformers",
"=",
"None",
")",
":",
"# If targeted metric, store labels",
"self",
".",
"_store_labels",
"(",
"metric",
",",
"scraper_config",
")",
"if",
"metric",
".",
"name... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | OpenMetricsScraperMixin.poll | Custom headers can be added to the default headers.
Returns a valid requests.Response, raise requests.HTTPError if the status code of the requests.Response
isn't valid - see response.raise_for_status()
The caller needs to close the requests.Response
:param endpoint: string url endpoin... | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | def poll(self, scraper_config, headers=None):
"""
Custom headers can be added to the default headers.
Returns a valid requests.Response, raise requests.HTTPError if the status code of the requests.Response
isn't valid - see response.raise_for_status()
The caller needs to close ... | def poll(self, scraper_config, headers=None):
"""
Custom headers can be added to the default headers.
Returns a valid requests.Response, raise requests.HTTPError if the status code of the requests.Response
isn't valid - see response.raise_for_status()
The caller needs to close ... | [
"Custom",
"headers",
"can",
"be",
"added",
"to",
"the",
"default",
"headers",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py#L395-L434 | [
"def",
"poll",
"(",
"self",
",",
"scraper_config",
",",
"headers",
"=",
"None",
")",
":",
"endpoint",
"=",
"scraper_config",
".",
"get",
"(",
"'prometheus_url'",
")",
"# Should we send a service check for when we make a request",
"health_service_check",
"=",
"scraper_co... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | OpenMetricsScraperMixin.submit_openmetric | For each sample in the metric, report it as a gauge with all labels as tags
except if a labels dict is passed, in which case keys are label names we'll extract
and corresponding values are tag names we'll use (eg: {'node': 'node'}).
Histograms generate a set of values instead of a unique metric... | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | def submit_openmetric(self, metric_name, metric, scraper_config, hostname=None):
"""
For each sample in the metric, report it as a gauge with all labels as tags
except if a labels dict is passed, in which case keys are label names we'll extract
and corresponding values are tag names we'l... | def submit_openmetric(self, metric_name, metric, scraper_config, hostname=None):
"""
For each sample in the metric, report it as a gauge with all labels as tags
except if a labels dict is passed, in which case keys are label names we'll extract
and corresponding values are tag names we'l... | [
"For",
"each",
"sample",
"in",
"the",
"metric",
"report",
"it",
"as",
"a",
"gauge",
"with",
"all",
"labels",
"as",
"tags",
"except",
"if",
"a",
"labels",
"dict",
"is",
"passed",
"in",
"which",
"case",
"keys",
"are",
"label",
"names",
"we",
"ll",
"extra... | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py#L483-L517 | [
"def",
"submit_openmetric",
"(",
"self",
",",
"metric_name",
",",
"metric",
",",
"scraper_config",
",",
"hostname",
"=",
"None",
")",
":",
"if",
"metric",
".",
"type",
"in",
"[",
"\"gauge\"",
",",
"\"counter\"",
",",
"\"rate\"",
"]",
":",
"metric_name_with_n... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | OpenMetricsScraperMixin._get_hostname | If hostname is None, look at label_to_hostname setting | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | def _get_hostname(self, hostname, sample, scraper_config):
"""
If hostname is None, look at label_to_hostname setting
"""
if (
hostname is None
and scraper_config['label_to_hostname'] is not None
and scraper_config['label_to_hostname'] in sample[self.S... | def _get_hostname(self, hostname, sample, scraper_config):
"""
If hostname is None, look at label_to_hostname setting
"""
if (
hostname is None
and scraper_config['label_to_hostname'] is not None
and scraper_config['label_to_hostname'] in sample[self.S... | [
"If",
"hostname",
"is",
"None",
"look",
"at",
"label_to_hostname",
"setting"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py#L519-L533 | [
"def",
"_get_hostname",
"(",
"self",
",",
"hostname",
",",
"sample",
",",
"scraper_config",
")",
":",
"if",
"(",
"hostname",
"is",
"None",
"and",
"scraper_config",
"[",
"'label_to_hostname'",
"]",
"is",
"not",
"None",
"and",
"scraper_config",
"[",
"'label_to_h... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | OpenMetricsScraperMixin._submit_gauges_from_histogram | Extracts metrics from a prometheus histogram and sends them as gauges | datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py | def _submit_gauges_from_histogram(self, metric_name, metric, scraper_config, hostname=None):
"""
Extracts metrics from a prometheus histogram and sends them as gauges
"""
for sample in metric.samples:
val = sample[self.SAMPLE_VALUE]
if not self._is_value_valid(val... | def _submit_gauges_from_histogram(self, metric_name, metric, scraper_config, hostname=None):
"""
Extracts metrics from a prometheus histogram and sends them as gauges
"""
for sample in metric.samples:
val = sample[self.SAMPLE_VALUE]
if not self._is_value_valid(val... | [
"Extracts",
"metrics",
"from",
"a",
"prometheus",
"histogram",
"and",
"sends",
"them",
"as",
"gauges"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py#L571-L609 | [
"def",
"_submit_gauges_from_histogram",
"(",
"self",
",",
"metric_name",
",",
"metric",
",",
"scraper_config",
",",
"hostname",
"=",
"None",
")",
":",
"for",
"sample",
"in",
"metric",
".",
"samples",
":",
"val",
"=",
"sample",
"[",
"self",
".",
"SAMPLE_VALUE... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | ZookeeperCheck.parse_stat | `buf` is a readable file-like object
returns a tuple: (metrics, tags, mode, version) | zk/datadog_checks/zk/zk.py | def parse_stat(self, buf):
"""
`buf` is a readable file-like object
returns a tuple: (metrics, tags, mode, version)
"""
metrics = []
buf.seek(0)
# Check the version line to make sure we parse the rest of the
# body correctly. Particularly, the Connections... | def parse_stat(self, buf):
"""
`buf` is a readable file-like object
returns a tuple: (metrics, tags, mode, version)
"""
metrics = []
buf.seek(0)
# Check the version line to make sure we parse the rest of the
# body correctly. Particularly, the Connections... | [
"buf",
"is",
"a",
"readable",
"file",
"-",
"like",
"object",
"returns",
"a",
"tuple",
":",
"(",
"metrics",
"tags",
"mode",
"version",
")"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/zk/datadog_checks/zk/zk.py#L250-L338 | [
"def",
"parse_stat",
"(",
"self",
",",
"buf",
")",
":",
"metrics",
"=",
"[",
"]",
"buf",
".",
"seek",
"(",
"0",
")",
"# Check the version line to make sure we parse the rest of the",
"# body correctly. Particularly, the Connections val was added in",
"# >= 3.4.4.",
"start_l... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | ZookeeperCheck.parse_mntr | Parse `mntr` command's content.
`buf` is a readable file-like object
Returns: a tuple (metrics, mode)
if mode == 'inactive', metrics will be None | zk/datadog_checks/zk/zk.py | def parse_mntr(self, buf):
"""
Parse `mntr` command's content.
`buf` is a readable file-like object
Returns: a tuple (metrics, mode)
if mode == 'inactive', metrics will be None
"""
buf.seek(0)
first = buf.readline() # First is version string or error
... | def parse_mntr(self, buf):
"""
Parse `mntr` command's content.
`buf` is a readable file-like object
Returns: a tuple (metrics, mode)
if mode == 'inactive', metrics will be None
"""
buf.seek(0)
first = buf.readline() # First is version string or error
... | [
"Parse",
"mntr",
"command",
"s",
"content",
".",
"buf",
"is",
"a",
"readable",
"file",
"-",
"like",
"object"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/zk/datadog_checks/zk/zk.py#L340-L377 | [
"def",
"parse_mntr",
"(",
"self",
",",
"buf",
")",
":",
"buf",
".",
"seek",
"(",
"0",
")",
"first",
"=",
"buf",
".",
"readline",
"(",
")",
"# First is version string or error",
"if",
"first",
"==",
"'This ZooKeeper instance is not currently serving requests'",
":"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Ceph._osd_pct_used | Take a single health check string, return (OSD name, percentage used) | ceph/datadog_checks/ceph/ceph.py | def _osd_pct_used(self, health):
"""Take a single health check string, return (OSD name, percentage used)"""
# Full string looks like: osd.2 is full at 95%
# Near full string: osd.1 is near full at 94%
pct = re.compile(r'\d+%').findall(health)
osd = re.compile(r'osd.\d+').findall... | def _osd_pct_used(self, health):
"""Take a single health check string, return (OSD name, percentage used)"""
# Full string looks like: osd.2 is full at 95%
# Near full string: osd.1 is near full at 94%
pct = re.compile(r'\d+%').findall(health)
osd = re.compile(r'osd.\d+').findall... | [
"Take",
"a",
"single",
"health",
"check",
"string",
"return",
"(",
"OSD",
"name",
"percentage",
"used",
")"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/ceph/datadog_checks/ceph/ceph.py#L249-L258 | [
"def",
"_osd_pct_used",
"(",
"self",
",",
"health",
")",
":",
"# Full string looks like: osd.2 is full at 95%",
"# Near full string: osd.1 is near full at 94%",
"pct",
"=",
"re",
".",
"compile",
"(",
"r'\\d+%'",
")",
".",
"findall",
"(",
"health",
")",
"osd",
"=",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database.add_son_manipulator | Add a new son manipulator to this database.
**DEPRECATED** - `add_son_manipulator` is deprecated.
.. versionchanged:: 3.0
Deprecated add_son_manipulator. | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def add_son_manipulator(self, manipulator):
"""Add a new son manipulator to this database.
**DEPRECATED** - `add_son_manipulator` is deprecated.
.. versionchanged:: 3.0
Deprecated add_son_manipulator.
"""
warnings.warn("add_son_manipulator is deprecated",
... | def add_son_manipulator(self, manipulator):
"""Add a new son manipulator to this database.
**DEPRECATED** - `add_son_manipulator` is deprecated.
.. versionchanged:: 3.0
Deprecated add_son_manipulator.
"""
warnings.warn("add_son_manipulator is deprecated",
... | [
"Add",
"a",
"new",
"son",
"manipulator",
"to",
"this",
"database",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L116-L141 | [
"def",
"add_son_manipulator",
"(",
"self",
",",
"manipulator",
")",
":",
"warnings",
".",
"warn",
"(",
"\"add_son_manipulator is deprecated\"",
",",
"DeprecationWarning",
",",
"stacklevel",
"=",
"2",
")",
"base",
"=",
"SONManipulator",
"(",
")",
"def",
"method_ove... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database.incoming_manipulators | **DEPRECATED**: All incoming SON manipulators.
.. versionchanged:: 3.5
Deprecated.
.. versionadded:: 2.0 | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def incoming_manipulators(self):
"""**DEPRECATED**: All incoming SON manipulators.
.. versionchanged:: 3.5
Deprecated.
.. versionadded:: 2.0
"""
warnings.warn("Database.incoming_manipulators() is deprecated",
DeprecationWarning, stacklevel=2)
... | def incoming_manipulators(self):
"""**DEPRECATED**: All incoming SON manipulators.
.. versionchanged:: 3.5
Deprecated.
.. versionadded:: 2.0
"""
warnings.warn("Database.incoming_manipulators() is deprecated",
DeprecationWarning, stacklevel=2)
... | [
"**",
"DEPRECATED",
"**",
":",
"All",
"incoming",
"SON",
"manipulators",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L162-L174 | [
"def",
"incoming_manipulators",
"(",
"self",
")",
":",
"warnings",
".",
"warn",
"(",
"\"Database.incoming_manipulators() is deprecated\"",
",",
"DeprecationWarning",
",",
"stacklevel",
"=",
"2",
")",
"return",
"[",
"manipulator",
".",
"__class__",
".",
"__name__",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database.incoming_copying_manipulators | **DEPRECATED**: All incoming SON copying manipulators.
.. versionchanged:: 3.5
Deprecated.
.. versionadded:: 2.0 | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def incoming_copying_manipulators(self):
"""**DEPRECATED**: All incoming SON copying manipulators.
.. versionchanged:: 3.5
Deprecated.
.. versionadded:: 2.0
"""
warnings.warn("Database.incoming_copying_manipulators() is deprecated",
DeprecationWa... | def incoming_copying_manipulators(self):
"""**DEPRECATED**: All incoming SON copying manipulators.
.. versionchanged:: 3.5
Deprecated.
.. versionadded:: 2.0
"""
warnings.warn("Database.incoming_copying_manipulators() is deprecated",
DeprecationWa... | [
"**",
"DEPRECATED",
"**",
":",
"All",
"incoming",
"SON",
"copying",
"manipulators",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L177-L189 | [
"def",
"incoming_copying_manipulators",
"(",
"self",
")",
":",
"warnings",
".",
"warn",
"(",
"\"Database.incoming_copying_manipulators() is deprecated\"",
",",
"DeprecationWarning",
",",
"stacklevel",
"=",
"2",
")",
"return",
"[",
"manipulator",
".",
"__class__",
".",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database.outgoing_manipulators | **DEPRECATED**: All outgoing SON manipulators.
.. versionchanged:: 3.5
Deprecated.
.. versionadded:: 2.0 | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def outgoing_manipulators(self):
"""**DEPRECATED**: All outgoing SON manipulators.
.. versionchanged:: 3.5
Deprecated.
.. versionadded:: 2.0
"""
warnings.warn("Database.outgoing_manipulators() is deprecated",
DeprecationWarning, stacklevel=2)
... | def outgoing_manipulators(self):
"""**DEPRECATED**: All outgoing SON manipulators.
.. versionchanged:: 3.5
Deprecated.
.. versionadded:: 2.0
"""
warnings.warn("Database.outgoing_manipulators() is deprecated",
DeprecationWarning, stacklevel=2)
... | [
"**",
"DEPRECATED",
"**",
":",
"All",
"outgoing",
"SON",
"manipulators",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L192-L204 | [
"def",
"outgoing_manipulators",
"(",
"self",
")",
":",
"warnings",
".",
"warn",
"(",
"\"Database.outgoing_manipulators() is deprecated\"",
",",
"DeprecationWarning",
",",
"stacklevel",
"=",
"2",
")",
"return",
"[",
"manipulator",
".",
"__class__",
".",
"__name__",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database.outgoing_copying_manipulators | **DEPRECATED**: All outgoing SON copying manipulators.
.. versionchanged:: 3.5
Deprecated.
.. versionadded:: 2.0 | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def outgoing_copying_manipulators(self):
"""**DEPRECATED**: All outgoing SON copying manipulators.
.. versionchanged:: 3.5
Deprecated.
.. versionadded:: 2.0
"""
warnings.warn("Database.outgoing_copying_manipulators() is deprecated",
DeprecationWa... | def outgoing_copying_manipulators(self):
"""**DEPRECATED**: All outgoing SON copying manipulators.
.. versionchanged:: 3.5
Deprecated.
.. versionadded:: 2.0
"""
warnings.warn("Database.outgoing_copying_manipulators() is deprecated",
DeprecationWa... | [
"**",
"DEPRECATED",
"**",
":",
"All",
"outgoing",
"SON",
"copying",
"manipulators",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L207-L219 | [
"def",
"outgoing_copying_manipulators",
"(",
"self",
")",
":",
"warnings",
".",
"warn",
"(",
"\"Database.outgoing_copying_manipulators() is deprecated\"",
",",
"DeprecationWarning",
",",
"stacklevel",
"=",
"2",
")",
"return",
"[",
"manipulator",
".",
"__class__",
".",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database.get_collection | Get a :class:`~pymongo.collection.Collection` with the given name
and options.
Useful for creating a :class:`~pymongo.collection.Collection` with
different codec options, read preference, and/or write concern from
this :class:`Database`.
>>> db.read_preference
Prima... | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def get_collection(self, name, codec_options=None, read_preference=None,
write_concern=None, read_concern=None):
"""Get a :class:`~pymongo.collection.Collection` with the given name
and options.
Useful for creating a :class:`~pymongo.collection.Collection` with
di... | def get_collection(self, name, codec_options=None, read_preference=None,
write_concern=None, read_concern=None):
"""Get a :class:`~pymongo.collection.Collection` with the given name
and options.
Useful for creating a :class:`~pymongo.collection.Collection` with
di... | [
"Get",
"a",
":",
"class",
":",
"~pymongo",
".",
"collection",
".",
"Collection",
"with",
"the",
"given",
"name",
"and",
"options",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L257-L298 | [
"def",
"get_collection",
"(",
"self",
",",
"name",
",",
"codec_options",
"=",
"None",
",",
"read_preference",
"=",
"None",
",",
"write_concern",
"=",
"None",
",",
"read_concern",
"=",
"None",
")",
":",
"return",
"Collection",
"(",
"self",
",",
"name",
",",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database._collection_default_options | Get a Collection instance with the default settings. | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def _collection_default_options(self, name, **kargs):
"""Get a Collection instance with the default settings."""
wc = (self.write_concern
if self.write_concern.acknowledged else WriteConcern())
return self.get_collection(
name, codec_options=DEFAULT_CODEC_OPTIONS,
... | def _collection_default_options(self, name, **kargs):
"""Get a Collection instance with the default settings."""
wc = (self.write_concern
if self.write_concern.acknowledged else WriteConcern())
return self.get_collection(
name, codec_options=DEFAULT_CODEC_OPTIONS,
... | [
"Get",
"a",
"Collection",
"instance",
"with",
"the",
"default",
"settings",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L300-L307 | [
"def",
"_collection_default_options",
"(",
"self",
",",
"name",
",",
"*",
"*",
"kargs",
")",
":",
"wc",
"=",
"(",
"self",
".",
"write_concern",
"if",
"self",
".",
"write_concern",
".",
"acknowledged",
"else",
"WriteConcern",
"(",
")",
")",
"return",
"self"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database.create_collection | Create a new :class:`~pymongo.collection.Collection` in this
database.
Normally collection creation is automatic. This method should
only be used to specify options on
creation. :class:`~pymongo.errors.CollectionInvalid` will be
raised if the collection already exists.
... | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def create_collection(self, name, codec_options=None,
read_preference=None, write_concern=None,
read_concern=None, **kwargs):
"""Create a new :class:`~pymongo.collection.Collection` in this
database.
Normally collection creation is automatic. ... | def create_collection(self, name, codec_options=None,
read_preference=None, write_concern=None,
read_concern=None, **kwargs):
"""Create a new :class:`~pymongo.collection.Collection` in this
database.
Normally collection creation is automatic. ... | [
"Create",
"a",
"new",
":",
"class",
":",
"~pymongo",
".",
"collection",
".",
"Collection",
"in",
"this",
"database",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L309-L368 | [
"def",
"create_collection",
"(",
"self",
",",
"name",
",",
"codec_options",
"=",
"None",
",",
"read_preference",
"=",
"None",
",",
"write_concern",
"=",
"None",
",",
"read_concern",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"name",
"in",
"sel... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database._apply_incoming_manipulators | Apply incoming manipulators to `son`. | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def _apply_incoming_manipulators(self, son, collection):
"""Apply incoming manipulators to `son`."""
for manipulator in self.__incoming_manipulators:
son = manipulator.transform_incoming(son, collection)
return son | def _apply_incoming_manipulators(self, son, collection):
"""Apply incoming manipulators to `son`."""
for manipulator in self.__incoming_manipulators:
son = manipulator.transform_incoming(son, collection)
return son | [
"Apply",
"incoming",
"manipulators",
"to",
"son",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L370-L374 | [
"def",
"_apply_incoming_manipulators",
"(",
"self",
",",
"son",
",",
"collection",
")",
":",
"for",
"manipulator",
"in",
"self",
".",
"__incoming_manipulators",
":",
"son",
"=",
"manipulator",
".",
"transform_incoming",
"(",
"son",
",",
"collection",
")",
"retur... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database._apply_incoming_copying_manipulators | Apply incoming copying manipulators to `son`. | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def _apply_incoming_copying_manipulators(self, son, collection):
"""Apply incoming copying manipulators to `son`."""
for manipulator in self.__incoming_copying_manipulators:
son = manipulator.transform_incoming(son, collection)
return son | def _apply_incoming_copying_manipulators(self, son, collection):
"""Apply incoming copying manipulators to `son`."""
for manipulator in self.__incoming_copying_manipulators:
son = manipulator.transform_incoming(son, collection)
return son | [
"Apply",
"incoming",
"copying",
"manipulators",
"to",
"son",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L376-L380 | [
"def",
"_apply_incoming_copying_manipulators",
"(",
"self",
",",
"son",
",",
"collection",
")",
":",
"for",
"manipulator",
"in",
"self",
".",
"__incoming_copying_manipulators",
":",
"son",
"=",
"manipulator",
".",
"transform_incoming",
"(",
"son",
",",
"collection",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database._fix_incoming | Apply manipulators to an incoming SON object before it gets stored.
:Parameters:
- `son`: the son object going into the database
- `collection`: the collection the son object is being saved in | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def _fix_incoming(self, son, collection):
"""Apply manipulators to an incoming SON object before it gets stored.
:Parameters:
- `son`: the son object going into the database
- `collection`: the collection the son object is being saved in
"""
son = self._apply_incomin... | def _fix_incoming(self, son, collection):
"""Apply manipulators to an incoming SON object before it gets stored.
:Parameters:
- `son`: the son object going into the database
- `collection`: the collection the son object is being saved in
"""
son = self._apply_incomin... | [
"Apply",
"manipulators",
"to",
"an",
"incoming",
"SON",
"object",
"before",
"it",
"gets",
"stored",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L382-L391 | [
"def",
"_fix_incoming",
"(",
"self",
",",
"son",
",",
"collection",
")",
":",
"son",
"=",
"self",
".",
"_apply_incoming_manipulators",
"(",
"son",
",",
"collection",
")",
"son",
"=",
"self",
".",
"_apply_incoming_copying_manipulators",
"(",
"son",
",",
"collec... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database._fix_outgoing | Apply manipulators to a SON object as it comes out of the database.
:Parameters:
- `son`: the son object coming out of the database
- `collection`: the collection the son object was saved in | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def _fix_outgoing(self, son, collection):
"""Apply manipulators to a SON object as it comes out of the database.
:Parameters:
- `son`: the son object coming out of the database
- `collection`: the collection the son object was saved in
"""
for manipulator in reversed... | def _fix_outgoing(self, son, collection):
"""Apply manipulators to a SON object as it comes out of the database.
:Parameters:
- `son`: the son object coming out of the database
- `collection`: the collection the son object was saved in
"""
for manipulator in reversed... | [
"Apply",
"manipulators",
"to",
"a",
"SON",
"object",
"as",
"it",
"comes",
"out",
"of",
"the",
"database",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L393-L404 | [
"def",
"_fix_outgoing",
"(",
"self",
",",
"son",
",",
"collection",
")",
":",
"for",
"manipulator",
"in",
"reversed",
"(",
"self",
".",
"__outgoing_manipulators",
")",
":",
"son",
"=",
"manipulator",
".",
"transform_outgoing",
"(",
"son",
",",
"collection",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database._command | Internal command helper. | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def _command(self, sock_info, command, slave_ok=False, value=1, check=True,
allowable_errors=None, read_preference=ReadPreference.PRIMARY,
codec_options=DEFAULT_CODEC_OPTIONS,
write_concern=None,
parse_write_concern_error=False, **kwargs):
"""I... | def _command(self, sock_info, command, slave_ok=False, value=1, check=True,
allowable_errors=None, read_preference=ReadPreference.PRIMARY,
codec_options=DEFAULT_CODEC_OPTIONS,
write_concern=None,
parse_write_concern_error=False, **kwargs):
"""I... | [
"Internal",
"command",
"helper",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L406-L428 | [
"def",
"_command",
"(",
"self",
",",
"sock_info",
",",
"command",
",",
"slave_ok",
"=",
"False",
",",
"value",
"=",
"1",
",",
"check",
"=",
"True",
",",
"allowable_errors",
"=",
"None",
",",
"read_preference",
"=",
"ReadPreference",
".",
"PRIMARY",
",",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database.command | Issue a MongoDB command.
Send command `command` to the database and return the
response. If `command` is an instance of :class:`basestring`
(:class:`str` in python 3) then the command {`command`: `value`}
will be sent. Otherwise, `command` must be an instance of
:class:`dict` an... | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def command(self, command, value=1, check=True,
allowable_errors=None, read_preference=ReadPreference.PRIMARY,
codec_options=DEFAULT_CODEC_OPTIONS, **kwargs):
"""Issue a MongoDB command.
Send command `command` to the database and return the
response. If `command`... | def command(self, command, value=1, check=True,
allowable_errors=None, read_preference=ReadPreference.PRIMARY,
codec_options=DEFAULT_CODEC_OPTIONS, **kwargs):
"""Issue a MongoDB command.
Send command `command` to the database and return the
response. If `command`... | [
"Issue",
"a",
"MongoDB",
"command",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L430-L516 | [
"def",
"command",
"(",
"self",
",",
"command",
",",
"value",
"=",
"1",
",",
"check",
"=",
"True",
",",
"allowable_errors",
"=",
"None",
",",
"read_preference",
"=",
"ReadPreference",
".",
"PRIMARY",
",",
"codec_options",
"=",
"DEFAULT_CODEC_OPTIONS",
",",
"*... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database._list_collections | Internal listCollections helper. | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def _list_collections(self, sock_info, slave_okay, criteria=None):
"""Internal listCollections helper."""
criteria = criteria or {}
cmd = SON([("listCollections", 1), ("cursor", {})])
if criteria:
cmd["filter"] = criteria
if sock_info.max_wire_version > 2:
... | def _list_collections(self, sock_info, slave_okay, criteria=None):
"""Internal listCollections helper."""
criteria = criteria or {}
cmd = SON([("listCollections", 1), ("cursor", {})])
if criteria:
cmd["filter"] = criteria
if sock_info.max_wire_version > 2:
... | [
"Internal",
"listCollections",
"helper",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L518-L542 | [
"def",
"_list_collections",
"(",
"self",
",",
"sock_info",
",",
"slave_okay",
",",
"criteria",
"=",
"None",
")",
":",
"criteria",
"=",
"criteria",
"or",
"{",
"}",
"cmd",
"=",
"SON",
"(",
"[",
"(",
"\"listCollections\"",
",",
"1",
")",
",",
"(",
"\"curs... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database.collection_names | Get a list of all the collection names in this database.
:Parameters:
- `include_system_collections` (optional): if ``False`` list
will not include system collections (e.g ``system.indexes``) | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def collection_names(self, include_system_collections=True):
"""Get a list of all the collection names in this database.
:Parameters:
- `include_system_collections` (optional): if ``False`` list
will not include system collections (e.g ``system.indexes``)
"""
with ... | def collection_names(self, include_system_collections=True):
"""Get a list of all the collection names in this database.
:Parameters:
- `include_system_collections` (optional): if ``False`` list
will not include system collections (e.g ``system.indexes``)
"""
with ... | [
"Get",
"a",
"list",
"of",
"all",
"the",
"collection",
"names",
"in",
"this",
"database",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L544-L569 | [
"def",
"collection_names",
"(",
"self",
",",
"include_system_collections",
"=",
"True",
")",
":",
"with",
"self",
".",
"__client",
".",
"_socket_for_reads",
"(",
"ReadPreference",
".",
"PRIMARY",
")",
"as",
"(",
"sock_info",
",",
"slave_okay",
")",
":",
"wire_... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database.drop_collection | Drop a collection.
:Parameters:
- `name_or_collection`: the name of a collection to drop or the
collection object itself
.. note:: The :attr:`~pymongo.database.Database.write_concern` of
this database is automatically applied to this operation when using
Mon... | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def drop_collection(self, name_or_collection):
"""Drop a collection.
:Parameters:
- `name_or_collection`: the name of a collection to drop or the
collection object itself
.. note:: The :attr:`~pymongo.database.Database.write_concern` of
this database is automat... | def drop_collection(self, name_or_collection):
"""Drop a collection.
:Parameters:
- `name_or_collection`: the name of a collection to drop or the
collection object itself
.. note:: The :attr:`~pymongo.database.Database.write_concern` of
this database is automat... | [
"Drop",
"a",
"collection",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L571-L603 | [
"def",
"drop_collection",
"(",
"self",
",",
"name_or_collection",
")",
":",
"name",
"=",
"name_or_collection",
"if",
"isinstance",
"(",
"name",
",",
"Collection",
")",
":",
"name",
"=",
"name",
".",
"name",
"if",
"not",
"isinstance",
"(",
"name",
",",
"str... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database.current_op | Get information on operations currently running.
:Parameters:
- `include_all` (optional): if ``True`` also list currently
idle operations in the result | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def current_op(self, include_all=False):
"""Get information on operations currently running.
:Parameters:
- `include_all` (optional): if ``True`` also list currently
idle operations in the result
"""
cmd = SON([("currentOp", 1), ("$all", include_all)])
with... | def current_op(self, include_all=False):
"""Get information on operations currently running.
:Parameters:
- `include_all` (optional): if ``True`` also list currently
idle operations in the result
"""
cmd = SON([("currentOp", 1), ("$all", include_all)])
with... | [
"Get",
"information",
"on",
"operations",
"currently",
"running",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L660-L676 | [
"def",
"current_op",
"(",
"self",
",",
"include_all",
"=",
"False",
")",
":",
"cmd",
"=",
"SON",
"(",
"[",
"(",
"\"currentOp\"",
",",
"1",
")",
",",
"(",
"\"$all\"",
",",
"include_all",
")",
"]",
")",
"with",
"self",
".",
"__client",
".",
"_socket_fo... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database.error | **DEPRECATED**: Get the error if one occurred on the last operation.
This method is obsolete: all MongoDB write operations (insert, update,
remove, and so on) use the write concern ``w=1`` and report their
errors by default.
.. versionchanged:: 2.8
Deprecated. | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def error(self):
"""**DEPRECATED**: Get the error if one occurred on the last operation.
This method is obsolete: all MongoDB write operations (insert, update,
remove, and so on) use the write concern ``w=1`` and report their
errors by default.
.. versionchanged:: 2.8
... | def error(self):
"""**DEPRECATED**: Get the error if one occurred on the last operation.
This method is obsolete: all MongoDB write operations (insert, update,
remove, and so on) use the write concern ``w=1`` and report their
errors by default.
.. versionchanged:: 2.8
... | [
"**",
"DEPRECATED",
"**",
":",
"Get",
"the",
"error",
"if",
"one",
"occurred",
"on",
"the",
"last",
"operation",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L737-L760 | [
"def",
"error",
"(",
"self",
")",
":",
"warnings",
".",
"warn",
"(",
"\"Database.error() is deprecated\"",
",",
"DeprecationWarning",
",",
"stacklevel",
"=",
"2",
")",
"error",
"=",
"self",
".",
"command",
"(",
"\"getlasterror\"",
")",
"error_msg",
"=",
"error... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database.previous_error | **DEPRECATED**: Get the most recent error on this database.
This method is obsolete: all MongoDB write operations (insert, update,
remove, and so on) use the write concern ``w=1`` and report their
errors by default.
Only returns errors that have occurred since the last call to
... | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def previous_error(self):
"""**DEPRECATED**: Get the most recent error on this database.
This method is obsolete: all MongoDB write operations (insert, update,
remove, and so on) use the write concern ``w=1`` and report their
errors by default.
Only returns errors that have occ... | def previous_error(self):
"""**DEPRECATED**: Get the most recent error on this database.
This method is obsolete: all MongoDB write operations (insert, update,
remove, and so on) use the write concern ``w=1`` and report their
errors by default.
Only returns errors that have occ... | [
"**",
"DEPRECATED",
"**",
":",
"Get",
"the",
"most",
"recent",
"error",
"on",
"this",
"database",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L779-L799 | [
"def",
"previous_error",
"(",
"self",
")",
":",
"warnings",
".",
"warn",
"(",
"\"previous_error() is deprecated\"",
",",
"DeprecationWarning",
",",
"stacklevel",
"=",
"2",
")",
"error",
"=",
"self",
".",
"command",
"(",
"\"getpreverror\"",
")",
"if",
"error",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database._create_or_update_user | Use a command to create (if create=True) or modify a user. | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def _create_or_update_user(
self, create, name, password, read_only, **kwargs):
"""Use a command to create (if create=True) or modify a user.
"""
opts = {}
if read_only or (create and "roles" not in kwargs):
warnings.warn("Creating a user with the read_only option... | def _create_or_update_user(
self, create, name, password, read_only, **kwargs):
"""Use a command to create (if create=True) or modify a user.
"""
opts = {}
if read_only or (create and "roles" not in kwargs):
warnings.warn("Creating a user with the read_only option... | [
"Use",
"a",
"command",
"to",
"create",
"(",
"if",
"create",
"=",
"True",
")",
"or",
"modify",
"a",
"user",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L840-L876 | [
"def",
"_create_or_update_user",
"(",
"self",
",",
"create",
",",
"name",
",",
"password",
",",
"read_only",
",",
"*",
"*",
"kwargs",
")",
":",
"opts",
"=",
"{",
"}",
"if",
"read_only",
"or",
"(",
"create",
"and",
"\"roles\"",
"not",
"in",
"kwargs",
")... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database._legacy_add_user | Uses v1 system to add users, i.e. saving to system.users. | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def _legacy_add_user(self, name, password, read_only, **kwargs):
"""Uses v1 system to add users, i.e. saving to system.users.
"""
# Use a Collection with the default codec_options.
system_users = self._collection_default_options('system.users')
user = system_users.find_one({"user... | def _legacy_add_user(self, name, password, read_only, **kwargs):
"""Uses v1 system to add users, i.e. saving to system.users.
"""
# Use a Collection with the default codec_options.
system_users = self._collection_default_options('system.users')
user = system_users.find_one({"user... | [
"Uses",
"v1",
"system",
"to",
"add",
"users",
"i",
".",
"e",
".",
"saving",
"to",
"system",
".",
"users",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L878-L906 | [
"def",
"_legacy_add_user",
"(",
"self",
",",
"name",
",",
"password",
",",
"read_only",
",",
"*",
"*",
"kwargs",
")",
":",
"# Use a Collection with the default codec_options.",
"system_users",
"=",
"self",
".",
"_collection_default_options",
"(",
"'system.users'",
")"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database.add_user | Create user `name` with password `password`.
Add a new user with permissions for this :class:`Database`.
.. note:: Will change the password if user `name` already exists.
:Parameters:
- `name`: the name of the user to create
- `password` (optional): the password of the use... | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def add_user(self, name, password=None, read_only=None, **kwargs):
"""Create user `name` with password `password`.
Add a new user with permissions for this :class:`Database`.
.. note:: Will change the password if user `name` already exists.
:Parameters:
- `name`: the name of... | def add_user(self, name, password=None, read_only=None, **kwargs):
"""Create user `name` with password `password`.
Add a new user with permissions for this :class:`Database`.
.. note:: Will change the password if user `name` already exists.
:Parameters:
- `name`: the name of... | [
"Create",
"user",
"name",
"with",
"password",
"password",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L908-L966 | [
"def",
"add_user",
"(",
"self",
",",
"name",
",",
"password",
"=",
"None",
",",
"read_only",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"name",
",",
"string_type",
")",
":",
"raise",
"TypeError",
"(",
"\"name must b... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database.remove_user | Remove user `name` from this :class:`Database`.
User `name` will no longer have permissions to access this
:class:`Database`.
:Parameters:
- `name`: the name of the user to remove | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def remove_user(self, name):
"""Remove user `name` from this :class:`Database`.
User `name` will no longer have permissions to access this
:class:`Database`.
:Parameters:
- `name`: the name of the user to remove
"""
try:
cmd = SON([("dropUser", nam... | def remove_user(self, name):
"""Remove user `name` from this :class:`Database`.
User `name` will no longer have permissions to access this
:class:`Database`.
:Parameters:
- `name`: the name of the user to remove
"""
try:
cmd = SON([("dropUser", nam... | [
"Remove",
"user",
"name",
"from",
"this",
":",
"class",
":",
"Database",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L968-L989 | [
"def",
"remove_user",
"(",
"self",
",",
"name",
")",
":",
"try",
":",
"cmd",
"=",
"SON",
"(",
"[",
"(",
"\"dropUser\"",
",",
"name",
")",
"]",
")",
"# Don't send {} as writeConcern.",
"if",
"self",
".",
"write_concern",
".",
"acknowledged",
"and",
"self",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database.authenticate | **DEPRECATED**: Authenticate to use this database.
Authentication lasts for the life of the underlying client
instance, or until :meth:`logout` is called.
Raises :class:`TypeError` if (required) `name`, (optional) `password`,
or (optional) `source` is not an instance of :class:`basestr... | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def authenticate(self, name=None, password=None,
source=None, mechanism='DEFAULT', **kwargs):
"""**DEPRECATED**: Authenticate to use this database.
Authentication lasts for the life of the underlying client
instance, or until :meth:`logout` is called.
Raises :class... | def authenticate(self, name=None, password=None,
source=None, mechanism='DEFAULT', **kwargs):
"""**DEPRECATED**: Authenticate to use this database.
Authentication lasts for the life of the underlying client
instance, or until :meth:`logout` is called.
Raises :class... | [
"**",
"DEPRECATED",
"**",
":",
"Authenticate",
"to",
"use",
"this",
"database",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L991-L1077 | [
"def",
"authenticate",
"(",
"self",
",",
"name",
"=",
"None",
",",
"password",
"=",
"None",
",",
"source",
"=",
"None",
",",
"mechanism",
"=",
"'DEFAULT'",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"name",
"is",
"not",
"None",
"and",
"not",
"isinstanc... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database.logout | **DEPRECATED**: Deauthorize use of this database. | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def logout(self):
"""**DEPRECATED**: Deauthorize use of this database."""
warnings.warn("Database.logout() is deprecated",
DeprecationWarning, stacklevel=2)
# Sockets will be deauthenticated as they are used.
self.client._purge_credentials(self.name) | def logout(self):
"""**DEPRECATED**: Deauthorize use of this database."""
warnings.warn("Database.logout() is deprecated",
DeprecationWarning, stacklevel=2)
# Sockets will be deauthenticated as they are used.
self.client._purge_credentials(self.name) | [
"**",
"DEPRECATED",
"**",
":",
"Deauthorize",
"use",
"of",
"this",
"database",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L1079-L1085 | [
"def",
"logout",
"(",
"self",
")",
":",
"warnings",
".",
"warn",
"(",
"\"Database.logout() is deprecated\"",
",",
"DeprecationWarning",
",",
"stacklevel",
"=",
"2",
")",
"# Sockets will be deauthenticated as they are used.",
"self",
".",
"client",
".",
"_purge_credentia... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Database.eval | **DEPRECATED**: Evaluate a JavaScript expression in MongoDB.
:Parameters:
- `code`: string representation of JavaScript code to be
evaluated
- `args` (optional): additional positional arguments are
passed to the `code` being evaluated
.. warning:: the eval c... | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def eval(self, code, *args):
"""**DEPRECATED**: Evaluate a JavaScript expression in MongoDB.
:Parameters:
- `code`: string representation of JavaScript code to be
evaluated
- `args` (optional): additional positional arguments are
passed to the `code` being ev... | def eval(self, code, *args):
"""**DEPRECATED**: Evaluate a JavaScript expression in MongoDB.
:Parameters:
- `code`: string representation of JavaScript code to be
evaluated
- `args` (optional): additional positional arguments are
passed to the `code` being ev... | [
"**",
"DEPRECATED",
"**",
":",
"Evaluate",
"a",
"JavaScript",
"expression",
"in",
"MongoDB",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L1111-L1130 | [
"def",
"eval",
"(",
"self",
",",
"code",
",",
"*",
"args",
")",
":",
"warnings",
".",
"warn",
"(",
"\"Database.eval() is deprecated\"",
",",
"DeprecationWarning",
",",
"stacklevel",
"=",
"2",
")",
"if",
"not",
"isinstance",
"(",
"code",
",",
"Code",
")",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | SystemJS.list | Get a list of the names of the functions stored in this database. | tokumx/datadog_checks/tokumx/vendor/pymongo/database.py | def list(self):
"""Get a list of the names of the functions stored in this database."""
return [x["_id"] for x in self._db.system.js.find(projection=["_id"])] | def list(self):
"""Get a list of the names of the functions stored in this database."""
return [x["_id"] for x in self._db.system.js.find(projection=["_id"])] | [
"Get",
"a",
"list",
"of",
"the",
"names",
"of",
"the",
"functions",
"stored",
"in",
"this",
"database",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/database.py#L1181-L1183 | [
"def",
"list",
"(",
"self",
")",
":",
"return",
"[",
"x",
"[",
"\"_id\"",
"]",
"for",
"x",
"in",
"self",
".",
"_db",
".",
"system",
".",
"js",
".",
"find",
"(",
"projection",
"=",
"[",
"\"_id\"",
"]",
")",
"]"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | ObjectIdShuffler.transform_incoming | Move _id to the front if it's there. | tokumx/datadog_checks/tokumx/vendor/pymongo/son_manipulator.py | def transform_incoming(self, son, collection):
"""Move _id to the front if it's there.
"""
if not "_id" in son:
return son
transformed = SON({"_id": son["_id"]})
transformed.update(son)
return transformed | def transform_incoming(self, son, collection):
"""Move _id to the front if it's there.
"""
if not "_id" in son:
return son
transformed = SON({"_id": son["_id"]})
transformed.update(son)
return transformed | [
"Move",
"_id",
"to",
"the",
"front",
"if",
"it",
"s",
"there",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/son_manipulator.py#L110-L117 | [
"def",
"transform_incoming",
"(",
"self",
",",
"son",
",",
"collection",
")",
":",
"if",
"not",
"\"_id\"",
"in",
"son",
":",
"return",
"son",
"transformed",
"=",
"SON",
"(",
"{",
"\"_id\"",
":",
"son",
"[",
"\"_id\"",
"]",
"}",
")",
"transformed",
".",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | AutoReference.transform_incoming | Replace embedded documents with DBRefs. | tokumx/datadog_checks/tokumx/vendor/pymongo/son_manipulator.py | def transform_incoming(self, son, collection):
"""Replace embedded documents with DBRefs.
"""
def transform_value(value):
if isinstance(value, collections.MutableMapping):
if "_id" in value and "_ns" in value:
return DBRef(value["_ns"], transform_... | def transform_incoming(self, son, collection):
"""Replace embedded documents with DBRefs.
"""
def transform_value(value):
if isinstance(value, collections.MutableMapping):
if "_id" in value and "_ns" in value:
return DBRef(value["_ns"], transform_... | [
"Replace",
"embedded",
"documents",
"with",
"DBRefs",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/son_manipulator.py#L153-L172 | [
"def",
"transform_incoming",
"(",
"self",
",",
"son",
",",
"collection",
")",
":",
"def",
"transform_value",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"collections",
".",
"MutableMapping",
")",
":",
"if",
"\"_id\"",
"in",
"value",
"and... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | run_command | This function provides a convenient API wrapping subprocess.Popen. Captured output
is guaranteed not to deadlock, but will still reside in memory in the end.
:param command: The command to run in a subprocess.
:type command: ``str`` or ``list`` of ``str``
:param capture: The method of output capture:
... | datadog_checks_dev/datadog_checks/dev/subprocess.py | def run_command(command, capture=None, check=False, encoding='utf-8', shell=False, env=None):
"""This function provides a convenient API wrapping subprocess.Popen. Captured output
is guaranteed not to deadlock, but will still reside in memory in the end.
:param command: The command to run in a subprocess.
... | def run_command(command, capture=None, check=False, encoding='utf-8', shell=False, env=None):
"""This function provides a convenient API wrapping subprocess.Popen. Captured output
is guaranteed not to deadlock, but will still reside in memory in the end.
:param command: The command to run in a subprocess.
... | [
"This",
"function",
"provides",
"a",
"convenient",
"API",
"wrapping",
"subprocess",
".",
"Popen",
".",
"Captured",
"output",
"is",
"guaranteed",
"not",
"to",
"deadlock",
"but",
"will",
"still",
"reside",
"in",
"memory",
"in",
"the",
"end",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/subprocess.py#L19-L81 | [
"def",
"run_command",
"(",
"command",
",",
"capture",
"=",
"None",
",",
"check",
"=",
"False",
",",
"encoding",
"=",
"'utf-8'",
",",
"shell",
"=",
"False",
",",
"env",
"=",
"None",
")",
":",
"if",
"shell",
"==",
"'detect'",
":",
"shell",
"=",
"NEED_S... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | HDFSNameNode._hdfs_namenode_metrics | Get HDFS namenode metrics from JMX | hdfs_namenode/datadog_checks/hdfs_namenode/hdfs_namenode.py | def _hdfs_namenode_metrics(self, beans, metrics, tags):
"""
Get HDFS namenode metrics from JMX
"""
bean = next(iter(beans))
bean_name = bean.get('name')
if bean_name != bean_name:
raise Exception("Unexpected bean name {}".format(bean_name))
for metri... | def _hdfs_namenode_metrics(self, beans, metrics, tags):
"""
Get HDFS namenode metrics from JMX
"""
bean = next(iter(beans))
bean_name = bean.get('name')
if bean_name != bean_name:
raise Exception("Unexpected bean name {}".format(bean_name))
for metri... | [
"Get",
"HDFS",
"namenode",
"metrics",
"from",
"JMX"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/hdfs_namenode/datadog_checks/hdfs_namenode/hdfs_namenode.py#L107-L129 | [
"def",
"_hdfs_namenode_metrics",
"(",
"self",
",",
"beans",
",",
"metrics",
",",
"tags",
")",
":",
"bean",
"=",
"next",
"(",
"iter",
"(",
"beans",
")",
")",
"bean_name",
"=",
"bean",
".",
"get",
"(",
"'name'",
")",
"if",
"bean_name",
"!=",
"bean_name",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.