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 | PrometheusCheck._submit_rate | Submit a metric as a rate, additional tags provided will be added to
the ones from the label provided via the metrics object.
`custom_tags` is an array of 'tag:value' that will be added to the
metric when sending the rate to Datadog. | datadog_checks_base/datadog_checks/base/checks/prometheus/prometheus_base.py | def _submit_rate(self, metric_name, val, metric, custom_tags=None, hostname=None):
"""
Submit a metric as a rate, additional tags provided will be added to
the ones from the label provided via the metrics object.
`custom_tags` is an array of 'tag:value' that will be added to the
... | def _submit_rate(self, metric_name, val, metric, custom_tags=None, hostname=None):
"""
Submit a metric as a rate, additional tags provided will be added to
the ones from the label provided via the metrics object.
`custom_tags` is an array of 'tag:value' that will be added to the
... | [
"Submit",
"a",
"metric",
"as",
"a",
"rate",
"additional",
"tags",
"provided",
"will",
"be",
"added",
"to",
"the",
"ones",
"from",
"the",
"label",
"provided",
"via",
"the",
"metrics",
"object",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/checks/prometheus/prometheus_base.py#L38-L47 | [
"def",
"_submit_rate",
"(",
"self",
",",
"metric_name",
",",
"val",
",",
"metric",
",",
"custom_tags",
"=",
"None",
",",
"hostname",
"=",
"None",
")",
":",
"_tags",
"=",
"self",
".",
"_metric_tags",
"(",
"metric_name",
",",
"val",
",",
"metric",
",",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | PrometheusCheck._submit_monotonic_count | Submit a metric as a monotonic count, additional tags provided will be added to
the ones from the label provided via the metrics object.
`custom_tags` is an array of 'tag:value' that will be added to the
metric when sending the monotonic count to Datadog. | datadog_checks_base/datadog_checks/base/checks/prometheus/prometheus_base.py | def _submit_monotonic_count(self, metric_name, val, metric, custom_tags=None, hostname=None):
"""
Submit a metric as a monotonic count, additional tags provided will be added to
the ones from the label provided via the metrics object.
`custom_tags` is an array of 'tag:value' that will b... | def _submit_monotonic_count(self, metric_name, val, metric, custom_tags=None, hostname=None):
"""
Submit a metric as a monotonic count, additional tags provided will be added to
the ones from the label provided via the metrics object.
`custom_tags` is an array of 'tag:value' that will b... | [
"Submit",
"a",
"metric",
"as",
"a",
"monotonic",
"count",
"additional",
"tags",
"provided",
"will",
"be",
"added",
"to",
"the",
"ones",
"from",
"the",
"label",
"provided",
"via",
"the",
"metrics",
"object",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/checks/prometheus/prometheus_base.py#L49-L59 | [
"def",
"_submit_monotonic_count",
"(",
"self",
",",
"metric_name",
",",
"val",
",",
"metric",
",",
"custom_tags",
"=",
"None",
",",
"hostname",
"=",
"None",
")",
":",
"_tags",
"=",
"self",
".",
"_metric_tags",
"(",
"metric_name",
",",
"val",
",",
"metric",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | GoExpvar.parse_expvar_data | Report all the metrics based on the configuration in instance
If a metric is not well configured or is not present in the payload,
continue processing metrics but log the information to the info page | go_expvar/datadog_checks/go_expvar/go_expvar.py | def parse_expvar_data(self, data, tags, metrics, max_metrics, namespace):
'''
Report all the metrics based on the configuration in instance
If a metric is not well configured or is not present in the payload,
continue processing metrics but log the information to the info page
''... | def parse_expvar_data(self, data, tags, metrics, max_metrics, namespace):
'''
Report all the metrics based on the configuration in instance
If a metric is not well configured or is not present in the payload,
continue processing metrics but log the information to the info page
''... | [
"Report",
"all",
"the",
"metrics",
"based",
"on",
"the",
"configuration",
"in",
"instance",
"If",
"a",
"metric",
"is",
"not",
"well",
"configured",
"or",
"is",
"not",
"present",
"in",
"the",
"payload",
"continue",
"processing",
"metrics",
"but",
"log",
"the"... | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/go_expvar/datadog_checks/go_expvar/go_expvar.py#L141-L192 | [
"def",
"parse_expvar_data",
"(",
"self",
",",
"data",
",",
"tags",
",",
"metrics",
",",
"max_metrics",
",",
"namespace",
")",
":",
"count",
"=",
"0",
"for",
"metric",
"in",
"metrics",
":",
"path",
"=",
"metric",
".",
"get",
"(",
"PATH",
")",
"metric_ty... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | GoExpvar.deep_get | Allow to retrieve content nested inside a several layers deep dict/list
Examples: -content: {
"key1": {
"key2" : [
{
"name" : "object1",
... | go_expvar/datadog_checks/go_expvar/go_expvar.py | def deep_get(self, content, keys, traversed_path=None):
'''
Allow to retrieve content nested inside a several layers deep dict/list
Examples: -content: {
"key1": {
"key2" : [
{
... | def deep_get(self, content, keys, traversed_path=None):
'''
Allow to retrieve content nested inside a several layers deep dict/list
Examples: -content: {
"key1": {
"key2" : [
{
... | [
"Allow",
"to",
"retrieve",
"content",
"nested",
"inside",
"a",
"several",
"layers",
"deep",
"dict",
"/",
"list"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/go_expvar/datadog_checks/go_expvar/go_expvar.py#L194-L241 | [
"def",
"deep_get",
"(",
"self",
",",
"content",
",",
"keys",
",",
"traversed_path",
"=",
"None",
")",
":",
"if",
"traversed_path",
"is",
"None",
":",
"traversed_path",
"=",
"[",
"]",
"if",
"keys",
"==",
"[",
"]",
":",
"return",
"[",
"(",
"traversed_pat... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | partition_node | Split a host:port string into (host, int(port)) pair. | tokumx/datadog_checks/tokumx/vendor/pymongo/common.py | def partition_node(node):
"""Split a host:port string into (host, int(port)) pair."""
host = node
port = 27017
idx = node.rfind(':')
if idx != -1:
host, port = node[:idx], int(node[idx + 1:])
if host.startswith('['):
host = host[1:-1]
return host, port | def partition_node(node):
"""Split a host:port string into (host, int(port)) pair."""
host = node
port = 27017
idx = node.rfind(':')
if idx != -1:
host, port = node[:idx], int(node[idx + 1:])
if host.startswith('['):
host = host[1:-1]
return host, port | [
"Split",
"a",
"host",
":",
"port",
"string",
"into",
"(",
"host",
"int",
"(",
"port",
"))",
"pair",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/common.py#L91-L100 | [
"def",
"partition_node",
"(",
"node",
")",
":",
"host",
"=",
"node",
"port",
"=",
"27017",
"idx",
"=",
"node",
".",
"rfind",
"(",
"':'",
")",
"if",
"idx",
"!=",
"-",
"1",
":",
"host",
",",
"port",
"=",
"node",
"[",
":",
"idx",
"]",
",",
"int",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | validate_boolean_or_string | Validates that value is True, False, 'true', or 'false'. | tokumx/datadog_checks/tokumx/vendor/pymongo/common.py | def validate_boolean_or_string(option, value):
"""Validates that value is True, False, 'true', or 'false'."""
if isinstance(value, string_type):
if value not in ('true', 'false'):
raise ValueError("The value of %s must be "
"'true' or 'false'" % (option,))
... | def validate_boolean_or_string(option, value):
"""Validates that value is True, False, 'true', or 'false'."""
if isinstance(value, string_type):
if value not in ('true', 'false'):
raise ValueError("The value of %s must be "
"'true' or 'false'" % (option,))
... | [
"Validates",
"that",
"value",
"is",
"True",
"False",
"true",
"or",
"false",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/common.py#L135-L142 | [
"def",
"validate_boolean_or_string",
"(",
"option",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"string_type",
")",
":",
"if",
"value",
"not",
"in",
"(",
"'true'",
",",
"'false'",
")",
":",
"raise",
"ValueError",
"(",
"\"The value of %s mu... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | validate_positive_integer | Validate that 'value' is a positive integer, which does not include 0. | tokumx/datadog_checks/tokumx/vendor/pymongo/common.py | def validate_positive_integer(option, value):
"""Validate that 'value' is a positive integer, which does not include 0.
"""
val = validate_integer(option, value)
if val <= 0:
raise ValueError("The value of %s must be "
"a positive integer" % (option,))
return val | def validate_positive_integer(option, value):
"""Validate that 'value' is a positive integer, which does not include 0.
"""
val = validate_integer(option, value)
if val <= 0:
raise ValueError("The value of %s must be "
"a positive integer" % (option,))
return val | [
"Validate",
"that",
"value",
"is",
"a",
"positive",
"integer",
"which",
"does",
"not",
"include",
"0",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/common.py#L158-L165 | [
"def",
"validate_positive_integer",
"(",
"option",
",",
"value",
")",
":",
"val",
"=",
"validate_integer",
"(",
"option",
",",
"value",
")",
"if",
"val",
"<=",
"0",
":",
"raise",
"ValueError",
"(",
"\"The value of %s must be \"",
"\"a positive integer\"",
"%",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | validate_non_negative_integer | Validate that 'value' is a positive integer or 0. | tokumx/datadog_checks/tokumx/vendor/pymongo/common.py | def validate_non_negative_integer(option, value):
"""Validate that 'value' is a positive integer or 0.
"""
val = validate_integer(option, value)
if val < 0:
raise ValueError("The value of %s must be "
"a non negative integer" % (option,))
return val | def validate_non_negative_integer(option, value):
"""Validate that 'value' is a positive integer or 0.
"""
val = validate_integer(option, value)
if val < 0:
raise ValueError("The value of %s must be "
"a non negative integer" % (option,))
return val | [
"Validate",
"that",
"value",
"is",
"a",
"positive",
"integer",
"or",
"0",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/common.py#L168-L175 | [
"def",
"validate_non_negative_integer",
"(",
"option",
",",
"value",
")",
":",
"val",
"=",
"validate_integer",
"(",
"option",
",",
"value",
")",
"if",
"val",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"\"The value of %s must be \"",
"\"a non negative integer\"",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | validate_readable | Validates that 'value' is file-like and readable. | tokumx/datadog_checks/tokumx/vendor/pymongo/common.py | def validate_readable(option, value):
"""Validates that 'value' is file-like and readable.
"""
if value is None:
return value
# First make sure its a string py3.3 open(True, 'r') succeeds
# Used in ssl cert checking due to poor ssl module error reporting
value = validate_string(option, v... | def validate_readable(option, value):
"""Validates that 'value' is file-like and readable.
"""
if value is None:
return value
# First make sure its a string py3.3 open(True, 'r') succeeds
# Used in ssl cert checking due to poor ssl module error reporting
value = validate_string(option, v... | [
"Validates",
"that",
"value",
"is",
"file",
"-",
"like",
"and",
"readable",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/common.py#L178-L187 | [
"def",
"validate_readable",
"(",
"option",
",",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"return",
"value",
"# First make sure its a string py3.3 open(True, 'r') succeeds",
"# Used in ssl cert checking due to poor ssl module error reporting",
"value",
"=",
"validate... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | validate_string | Validates that 'value' is an instance of `basestring` for Python 2
or `str` for Python 3. | tokumx/datadog_checks/tokumx/vendor/pymongo/common.py | def validate_string(option, value):
"""Validates that 'value' is an instance of `basestring` for Python 2
or `str` for Python 3.
"""
if isinstance(value, string_type):
return value
raise TypeError("Wrong type for %s, value must be "
"an instance of %s" % (option, string_t... | def validate_string(option, value):
"""Validates that 'value' is an instance of `basestring` for Python 2
or `str` for Python 3.
"""
if isinstance(value, string_type):
return value
raise TypeError("Wrong type for %s, value must be "
"an instance of %s" % (option, string_t... | [
"Validates",
"that",
"value",
"is",
"an",
"instance",
"of",
"basestring",
"for",
"Python",
"2",
"or",
"str",
"for",
"Python",
"3",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/common.py#L206-L213 | [
"def",
"validate_string",
"(",
"option",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"string_type",
")",
":",
"return",
"value",
"raise",
"TypeError",
"(",
"\"Wrong type for %s, value must be \"",
"\"an instance of %s\"",
"%",
"(",
"option",
","... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | validate_positive_float | Validates that 'value' is a float, or can be converted to one, and is
positive. | tokumx/datadog_checks/tokumx/vendor/pymongo/common.py | def validate_positive_float(option, value):
"""Validates that 'value' is a float, or can be converted to one, and is
positive.
"""
errmsg = "%s must be an integer or float" % (option,)
try:
value = float(value)
except ValueError:
raise ValueError(errmsg)
except TypeError:
... | def validate_positive_float(option, value):
"""Validates that 'value' is a float, or can be converted to one, and is
positive.
"""
errmsg = "%s must be an integer or float" % (option,)
try:
value = float(value)
except ValueError:
raise ValueError(errmsg)
except TypeError:
... | [
"Validates",
"that",
"value",
"is",
"a",
"float",
"or",
"can",
"be",
"converted",
"to",
"one",
"and",
"is",
"positive",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/common.py#L237-L254 | [
"def",
"validate_positive_float",
"(",
"option",
",",
"value",
")",
":",
"errmsg",
"=",
"\"%s must be an integer or float\"",
"%",
"(",
"option",
",",
")",
"try",
":",
"value",
"=",
"float",
"(",
"value",
")",
"except",
"ValueError",
":",
"raise",
"ValueError"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | validate_timeout_or_zero | Validates a timeout specified in milliseconds returning
a value in floating point seconds for the case where None is an error
and 0 is valid. Setting the timeout to nothing in the URI string is a
config error. | tokumx/datadog_checks/tokumx/vendor/pymongo/common.py | def validate_timeout_or_zero(option, value):
"""Validates a timeout specified in milliseconds returning
a value in floating point seconds for the case where None is an error
and 0 is valid. Setting the timeout to nothing in the URI string is a
config error.
"""
if value is None:
raise Co... | def validate_timeout_or_zero(option, value):
"""Validates a timeout specified in milliseconds returning
a value in floating point seconds for the case where None is an error
and 0 is valid. Setting the timeout to nothing in the URI string is a
config error.
"""
if value is None:
raise Co... | [
"Validates",
"a",
"timeout",
"specified",
"in",
"milliseconds",
"returning",
"a",
"value",
"in",
"floating",
"point",
"seconds",
"for",
"the",
"case",
"where",
"None",
"is",
"an",
"error",
"and",
"0",
"is",
"valid",
".",
"Setting",
"the",
"timeout",
"to",
... | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/common.py#L275-L285 | [
"def",
"validate_timeout_or_zero",
"(",
"option",
",",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"raise",
"ConfigurationError",
"(",
"\"%s cannot be None\"",
"%",
"(",
"option",
",",
")",
")",
"if",
"value",
"==",
"0",
"or",
"value",
"==",
"\"0\... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | validate_auth_mechanism | Validate the authMechanism URI option. | tokumx/datadog_checks/tokumx/vendor/pymongo/common.py | def validate_auth_mechanism(option, value):
"""Validate the authMechanism URI option.
"""
# CRAM-MD5 is for server testing only. Undocumented,
# unsupported, may be removed at any time. You have
# been warned.
if value not in MECHANISMS and value != 'CRAM-MD5':
raise ValueError("%s must ... | def validate_auth_mechanism(option, value):
"""Validate the authMechanism URI option.
"""
# CRAM-MD5 is for server testing only. Undocumented,
# unsupported, may be removed at any time. You have
# been warned.
if value not in MECHANISMS and value != 'CRAM-MD5':
raise ValueError("%s must ... | [
"Validate",
"the",
"authMechanism",
"URI",
"option",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/common.py#L316-L324 | [
"def",
"validate_auth_mechanism",
"(",
"option",
",",
"value",
")",
":",
"# CRAM-MD5 is for server testing only. Undocumented,",
"# unsupported, may be removed at any time. You have",
"# been warned.",
"if",
"value",
"not",
"in",
"MECHANISMS",
"and",
"value",
"!=",
"'CRAM-MD5'"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | validate_uuid_representation | Validate the uuid representation option selected in the URI. | tokumx/datadog_checks/tokumx/vendor/pymongo/common.py | def validate_uuid_representation(dummy, value):
"""Validate the uuid representation option selected in the URI.
"""
try:
return _UUID_REPRESENTATIONS[value]
except KeyError:
raise ValueError("%s is an invalid UUID representation. "
"Must be one of "
... | def validate_uuid_representation(dummy, value):
"""Validate the uuid representation option selected in the URI.
"""
try:
return _UUID_REPRESENTATIONS[value]
except KeyError:
raise ValueError("%s is an invalid UUID representation. "
"Must be one of "
... | [
"Validate",
"the",
"uuid",
"representation",
"option",
"selected",
"in",
"the",
"URI",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/common.py#L327-L335 | [
"def",
"validate_uuid_representation",
"(",
"dummy",
",",
"value",
")",
":",
"try",
":",
"return",
"_UUID_REPRESENTATIONS",
"[",
"value",
"]",
"except",
"KeyError",
":",
"raise",
"ValueError",
"(",
"\"%s is an invalid UUID representation. \"",
"\"Must be one of \"",
"\"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | validate_read_preference_tags | Parse readPreferenceTags if passed as a client kwarg. | tokumx/datadog_checks/tokumx/vendor/pymongo/common.py | def validate_read_preference_tags(name, value):
"""Parse readPreferenceTags if passed as a client kwarg.
"""
if not isinstance(value, list):
value = [value]
tag_sets = []
for tag_set in value:
if tag_set == '':
tag_sets.append({})
continue
try:
... | def validate_read_preference_tags(name, value):
"""Parse readPreferenceTags if passed as a client kwarg.
"""
if not isinstance(value, list):
value = [value]
tag_sets = []
for tag_set in value:
if tag_set == '':
tag_sets.append({})
continue
try:
... | [
"Parse",
"readPreferenceTags",
"if",
"passed",
"as",
"a",
"client",
"kwarg",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/common.py#L338-L355 | [
"def",
"validate_read_preference_tags",
"(",
"name",
",",
"value",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"value",
"=",
"[",
"value",
"]",
"tag_sets",
"=",
"[",
"]",
"for",
"tag_set",
"in",
"value",
":",
"if",
"tag_se... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | validate_auth_mechanism_properties | Validate authMechanismProperties. | tokumx/datadog_checks/tokumx/vendor/pymongo/common.py | def validate_auth_mechanism_properties(option, value):
"""Validate authMechanismProperties."""
value = validate_string(option, value)
props = {}
for opt in value.split(','):
try:
key, val = opt.split(':')
except ValueError:
raise ValueError("auth mechanism propert... | def validate_auth_mechanism_properties(option, value):
"""Validate authMechanismProperties."""
value = validate_string(option, value)
props = {}
for opt in value.split(','):
try:
key, val = opt.split(':')
except ValueError:
raise ValueError("auth mechanism propert... | [
"Validate",
"authMechanismProperties",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/common.py#L363-L383 | [
"def",
"validate_auth_mechanism_properties",
"(",
"option",
",",
"value",
")",
":",
"value",
"=",
"validate_string",
"(",
"option",
",",
"value",
")",
"props",
"=",
"{",
"}",
"for",
"opt",
"in",
"value",
".",
"split",
"(",
"','",
")",
":",
"try",
":",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | validate_document_class | Validate the document_class option. | tokumx/datadog_checks/tokumx/vendor/pymongo/common.py | def validate_document_class(option, value):
"""Validate the document_class option."""
if not issubclass(value, (collections.MutableMapping, RawBSONDocument)):
raise TypeError("%s must be dict, bson.son.SON, "
"bson.raw_bson.RawBSONDocument, or a "
"sublass... | def validate_document_class(option, value):
"""Validate the document_class option."""
if not issubclass(value, (collections.MutableMapping, RawBSONDocument)):
raise TypeError("%s must be dict, bson.son.SON, "
"bson.raw_bson.RawBSONDocument, or a "
"sublass... | [
"Validate",
"the",
"document_class",
"option",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/common.py#L386-L392 | [
"def",
"validate_document_class",
"(",
"option",
",",
"value",
")",
":",
"if",
"not",
"issubclass",
"(",
"value",
",",
"(",
"collections",
".",
"MutableMapping",
",",
"RawBSONDocument",
")",
")",
":",
"raise",
"TypeError",
"(",
"\"%s must be dict, bson.son.SON, \"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | validate_is_document_type | Validate the type of method arguments that expect a MongoDB document. | tokumx/datadog_checks/tokumx/vendor/pymongo/common.py | def validate_is_document_type(option, value):
"""Validate the type of method arguments that expect a MongoDB document."""
if not isinstance(value, (collections.MutableMapping, RawBSONDocument)):
raise TypeError("%s must be an instance of dict, bson.son.SON, "
"bson.raw_bson.RawBS... | def validate_is_document_type(option, value):
"""Validate the type of method arguments that expect a MongoDB document."""
if not isinstance(value, (collections.MutableMapping, RawBSONDocument)):
raise TypeError("%s must be an instance of dict, bson.son.SON, "
"bson.raw_bson.RawBS... | [
"Validate",
"the",
"type",
"of",
"method",
"arguments",
"that",
"expect",
"a",
"MongoDB",
"document",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/common.py#L403-L409 | [
"def",
"validate_is_document_type",
"(",
"option",
",",
"value",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"(",
"collections",
".",
"MutableMapping",
",",
"RawBSONDocument",
")",
")",
":",
"raise",
"TypeError",
"(",
"\"%s must be an instance of dict,... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | validate_appname_or_none | Validate the appname option. | tokumx/datadog_checks/tokumx/vendor/pymongo/common.py | def validate_appname_or_none(option, value):
"""Validate the appname option."""
if value is None:
return value
validate_string(option, value)
# We need length in bytes, so encode utf8 first.
if len(value.encode('utf-8')) > 128:
raise ValueError("%s must be <= 128 bytes" % (option,))
... | def validate_appname_or_none(option, value):
"""Validate the appname option."""
if value is None:
return value
validate_string(option, value)
# We need length in bytes, so encode utf8 first.
if len(value.encode('utf-8')) > 128:
raise ValueError("%s must be <= 128 bytes" % (option,))
... | [
"Validate",
"the",
"appname",
"option",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/common.py#L412-L420 | [
"def",
"validate_appname_or_none",
"(",
"option",
",",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"return",
"value",
"validate_string",
"(",
"option",
",",
"value",
")",
"# We need length in bytes, so encode utf8 first.",
"if",
"len",
"(",
"value",
".",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | validate_ok_for_replace | Validate a replacement document. | tokumx/datadog_checks/tokumx/vendor/pymongo/common.py | def validate_ok_for_replace(replacement):
"""Validate a replacement document."""
validate_is_mapping("replacement", replacement)
# Replacement can be {}
if replacement and not isinstance(replacement, RawBSONDocument):
first = next(iter(replacement))
if first.startswith('$'):
... | def validate_ok_for_replace(replacement):
"""Validate a replacement document."""
validate_is_mapping("replacement", replacement)
# Replacement can be {}
if replacement and not isinstance(replacement, RawBSONDocument):
first = next(iter(replacement))
if first.startswith('$'):
... | [
"Validate",
"a",
"replacement",
"document",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/common.py#L423-L430 | [
"def",
"validate_ok_for_replace",
"(",
"replacement",
")",
":",
"validate_is_mapping",
"(",
"\"replacement\"",
",",
"replacement",
")",
"# Replacement can be {}",
"if",
"replacement",
"and",
"not",
"isinstance",
"(",
"replacement",
",",
"RawBSONDocument",
")",
":",
"f... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | validate_ok_for_update | Validate an update document. | tokumx/datadog_checks/tokumx/vendor/pymongo/common.py | def validate_ok_for_update(update):
"""Validate an update document."""
validate_is_mapping("update", update)
# Update can not be {}
if not update:
raise ValueError('update only works with $ operators')
first = next(iter(update))
if not first.startswith('$'):
raise ValueError('upd... | def validate_ok_for_update(update):
"""Validate an update document."""
validate_is_mapping("update", update)
# Update can not be {}
if not update:
raise ValueError('update only works with $ operators')
first = next(iter(update))
if not first.startswith('$'):
raise ValueError('upd... | [
"Validate",
"an",
"update",
"document",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/common.py#L433-L441 | [
"def",
"validate_ok_for_update",
"(",
"update",
")",
":",
"validate_is_mapping",
"(",
"\"update\"",
",",
"update",
")",
"# Update can not be {}",
"if",
"not",
"update",
":",
"raise",
"ValueError",
"(",
"'update only works with $ operators'",
")",
"first",
"=",
"next",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | validate_unicode_decode_error_handler | Validate the Unicode decode error handler option of CodecOptions. | tokumx/datadog_checks/tokumx/vendor/pymongo/common.py | def validate_unicode_decode_error_handler(dummy, value):
"""Validate the Unicode decode error handler option of CodecOptions.
"""
if value not in _UNICODE_DECODE_ERROR_HANDLERS:
raise ValueError("%s is an invalid Unicode decode error handler. "
"Must be one of "
... | def validate_unicode_decode_error_handler(dummy, value):
"""Validate the Unicode decode error handler option of CodecOptions.
"""
if value not in _UNICODE_DECODE_ERROR_HANDLERS:
raise ValueError("%s is an invalid Unicode decode error handler. "
"Must be one of "
... | [
"Validate",
"the",
"Unicode",
"decode",
"error",
"handler",
"option",
"of",
"CodecOptions",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/common.py#L447-L454 | [
"def",
"validate_unicode_decode_error_handler",
"(",
"dummy",
",",
"value",
")",
":",
"if",
"value",
"not",
"in",
"_UNICODE_DECODE_ERROR_HANDLERS",
":",
"raise",
"ValueError",
"(",
"\"%s is an invalid Unicode decode error handler. \"",
"\"Must be one of \"",
"\"%s\"",
"%",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | validate_tzinfo | Validate the tzinfo option | tokumx/datadog_checks/tokumx/vendor/pymongo/common.py | def validate_tzinfo(dummy, value):
"""Validate the tzinfo option
"""
if value is not None and not isinstance(value, datetime.tzinfo):
raise TypeError("%s must be an instance of datetime.tzinfo" % value)
return value | def validate_tzinfo(dummy, value):
"""Validate the tzinfo option
"""
if value is not None and not isinstance(value, datetime.tzinfo):
raise TypeError("%s must be an instance of datetime.tzinfo" % value)
return value | [
"Validate",
"the",
"tzinfo",
"option"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/common.py#L457-L462 | [
"def",
"validate_tzinfo",
"(",
"dummy",
",",
"value",
")",
":",
"if",
"value",
"is",
"not",
"None",
"and",
"not",
"isinstance",
"(",
"value",
",",
"datetime",
".",
"tzinfo",
")",
":",
"raise",
"TypeError",
"(",
"\"%s must be an instance of datetime.tzinfo\"",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | validate_auth_option | Validate optional authentication parameters. | tokumx/datadog_checks/tokumx/vendor/pymongo/common.py | def validate_auth_option(option, value):
"""Validate optional authentication parameters.
"""
lower, value = validate(option, value)
if lower not in _AUTH_OPTIONS:
raise ConfigurationError('Unknown '
'authentication option: %s' % (option,))
return lower, value | def validate_auth_option(option, value):
"""Validate optional authentication parameters.
"""
lower, value = validate(option, value)
if lower not in _AUTH_OPTIONS:
raise ConfigurationError('Unknown '
'authentication option: %s' % (option,))
return lower, value | [
"Validate",
"optional",
"authentication",
"parameters",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/common.py#L528-L535 | [
"def",
"validate_auth_option",
"(",
"option",
",",
"value",
")",
":",
"lower",
",",
"value",
"=",
"validate",
"(",
"option",
",",
"value",
")",
"if",
"lower",
"not",
"in",
"_AUTH_OPTIONS",
":",
"raise",
"ConfigurationError",
"(",
"'Unknown '",
"'authentication... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | validate | Generic validation function. | tokumx/datadog_checks/tokumx/vendor/pymongo/common.py | def validate(option, value):
"""Generic validation function.
"""
lower = option.lower()
validator = VALIDATORS.get(lower, raise_config_error)
value = validator(option, value)
return lower, value | def validate(option, value):
"""Generic validation function.
"""
lower = option.lower()
validator = VALIDATORS.get(lower, raise_config_error)
value = validator(option, value)
return lower, value | [
"Generic",
"validation",
"function",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/common.py#L538-L544 | [
"def",
"validate",
"(",
"option",
",",
"value",
")",
":",
"lower",
"=",
"option",
".",
"lower",
"(",
")",
"validator",
"=",
"VALIDATORS",
".",
"get",
"(",
"lower",
",",
"raise_config_error",
")",
"value",
"=",
"validator",
"(",
"option",
",",
"value",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | get_validated_options | Validate each entry in options and raise a warning if it is not valid.
Returns a copy of options with invalid entries removed | tokumx/datadog_checks/tokumx/vendor/pymongo/common.py | def get_validated_options(options, warn=True):
"""Validate each entry in options and raise a warning if it is not valid.
Returns a copy of options with invalid entries removed
"""
validated_options = {}
for opt, value in iteritems(options):
lower = opt.lower()
try:
valida... | def get_validated_options(options, warn=True):
"""Validate each entry in options and raise a warning if it is not valid.
Returns a copy of options with invalid entries removed
"""
validated_options = {}
for opt, value in iteritems(options):
lower = opt.lower()
try:
valida... | [
"Validate",
"each",
"entry",
"in",
"options",
"and",
"raise",
"a",
"warning",
"if",
"it",
"is",
"not",
"valid",
".",
"Returns",
"a",
"copy",
"of",
"options",
"with",
"invalid",
"entries",
"removed"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/common.py#L547-L564 | [
"def",
"get_validated_options",
"(",
"options",
",",
"warn",
"=",
"True",
")",
":",
"validated_options",
"=",
"{",
"}",
"for",
"opt",
",",
"value",
"in",
"iteritems",
"(",
"options",
")",
":",
"lower",
"=",
"opt",
".",
"lower",
"(",
")",
"try",
":",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Redis._parse_dict_string | Take from a more recent redis.py, parse_info | redisdb/datadog_checks/redisdb/redisdb.py | def _parse_dict_string(self, string, key, default):
"""Take from a more recent redis.py, parse_info"""
try:
for item in string.split(','):
k, v = item.rsplit('=', 1)
if k == key:
try:
return int(v)
... | def _parse_dict_string(self, string, key, default):
"""Take from a more recent redis.py, parse_info"""
try:
for item in string.split(','):
k, v = item.rsplit('=', 1)
if k == key:
try:
return int(v)
... | [
"Take",
"from",
"a",
"more",
"recent",
"redis",
".",
"py",
"parse_info"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/redisdb/datadog_checks/redisdb/redisdb.py#L96-L109 | [
"def",
"_parse_dict_string",
"(",
"self",
",",
"string",
",",
"key",
",",
"default",
")",
":",
"try",
":",
"for",
"item",
"in",
"string",
".",
"split",
"(",
"','",
")",
":",
"k",
",",
"v",
"=",
"item",
".",
"rsplit",
"(",
"'='",
",",
"1",
")",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Redis._check_key_lengths | Compute the length of the configured keys across all the databases | redisdb/datadog_checks/redisdb/redisdb.py | def _check_key_lengths(self, conn, instance, tags):
"""
Compute the length of the configured keys across all the databases
"""
key_list = instance.get('keys')
if key_list is None:
return
if not isinstance(key_list, list) or len(key_list) == 0:
se... | def _check_key_lengths(self, conn, instance, tags):
"""
Compute the length of the configured keys across all the databases
"""
key_list = instance.get('keys')
if key_list is None:
return
if not isinstance(key_list, list) or len(key_list) == 0:
se... | [
"Compute",
"the",
"length",
"of",
"the",
"configured",
"keys",
"across",
"all",
"the",
"databases"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/redisdb/datadog_checks/redisdb/redisdb.py#L234-L336 | [
"def",
"_check_key_lengths",
"(",
"self",
",",
"conn",
",",
"instance",
",",
"tags",
")",
":",
"key_list",
"=",
"instance",
".",
"get",
"(",
"'keys'",
")",
"if",
"key_list",
"is",
"None",
":",
"return",
"if",
"not",
"isinstance",
"(",
"key_list",
",",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Redis._check_slowlog | Retrieve length and entries from Redis' SLOWLOG
This will parse through all entries of the SLOWLOG and select ones
within the time range between the last seen entries and now | redisdb/datadog_checks/redisdb/redisdb.py | def _check_slowlog(self, instance, custom_tags):
"""Retrieve length and entries from Redis' SLOWLOG
This will parse through all entries of the SLOWLOG and select ones
within the time range between the last seen entries and now
"""
conn = self._get_conn(instance)
tags =... | def _check_slowlog(self, instance, custom_tags):
"""Retrieve length and entries from Redis' SLOWLOG
This will parse through all entries of the SLOWLOG and select ones
within the time range between the last seen entries and now
"""
conn = self._get_conn(instance)
tags =... | [
"Retrieve",
"length",
"and",
"entries",
"from",
"Redis",
"SLOWLOG"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/redisdb/datadog_checks/redisdb/redisdb.py#L365-L424 | [
"def",
"_check_slowlog",
"(",
"self",
",",
"instance",
",",
"custom_tags",
")",
":",
"conn",
"=",
"self",
".",
"_get_conn",
"(",
"instance",
")",
"tags",
"=",
"self",
".",
"_get_tags",
"(",
"custom_tags",
",",
"instance",
")",
"if",
"not",
"instance",
".... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Redis._check_command_stats | Get command-specific statistics from redis' INFO COMMANDSTATS command | redisdb/datadog_checks/redisdb/redisdb.py | def _check_command_stats(self, conn, tags):
"""Get command-specific statistics from redis' INFO COMMANDSTATS command
"""
try:
command_stats = conn.info("commandstats")
except Exception:
self.warning('Could not retrieve command stats from Redis. INFO COMMANDSTATS o... | def _check_command_stats(self, conn, tags):
"""Get command-specific statistics from redis' INFO COMMANDSTATS command
"""
try:
command_stats = conn.info("commandstats")
except Exception:
self.warning('Could not retrieve command stats from Redis. INFO COMMANDSTATS o... | [
"Get",
"command",
"-",
"specific",
"statistics",
"from",
"redis",
"INFO",
"COMMANDSTATS",
"command"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/redisdb/datadog_checks/redisdb/redisdb.py#L426-L444 | [
"def",
"_check_command_stats",
"(",
"self",
",",
"conn",
",",
"tags",
")",
":",
"try",
":",
"command_stats",
"=",
"conn",
".",
"info",
"(",
"\"commandstats\"",
")",
"except",
"Exception",
":",
"self",
".",
"warning",
"(",
"'Could not retrieve command stats from ... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | CoreDNSCheck.create_generic_instances | Transform each CoreDNS instance into a OpenMetricsBaseCheck instance | coredns/datadog_checks/coredns/coredns.py | def create_generic_instances(self, instances):
"""
Transform each CoreDNS instance into a OpenMetricsBaseCheck instance
"""
generic_instances = []
for instance in instances:
transformed_instance = self._create_core_dns_instance(instance)
generic_instances.... | def create_generic_instances(self, instances):
"""
Transform each CoreDNS instance into a OpenMetricsBaseCheck instance
"""
generic_instances = []
for instance in instances:
transformed_instance = self._create_core_dns_instance(instance)
generic_instances.... | [
"Transform",
"each",
"CoreDNS",
"instance",
"into",
"a",
"OpenMetricsBaseCheck",
"instance"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/coredns/datadog_checks/coredns/coredns.py#L73-L82 | [
"def",
"create_generic_instances",
"(",
"self",
",",
"instances",
")",
":",
"generic_instances",
"=",
"[",
"]",
"for",
"instance",
"in",
"instances",
":",
"transformed_instance",
"=",
"self",
".",
"_create_core_dns_instance",
"(",
"instance",
")",
"generic_instances... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | CoreDNSCheck._create_core_dns_instance | Set up coredns instance so it can be used in OpenMetricsBaseCheck | coredns/datadog_checks/coredns/coredns.py | def _create_core_dns_instance(self, instance):
"""
Set up coredns instance so it can be used in OpenMetricsBaseCheck
"""
endpoint = instance.get('prometheus_url')
if endpoint is None:
raise ConfigurationError("Unable to find prometheus endpoint in config file.")
... | def _create_core_dns_instance(self, instance):
"""
Set up coredns instance so it can be used in OpenMetricsBaseCheck
"""
endpoint = instance.get('prometheus_url')
if endpoint is None:
raise ConfigurationError("Unable to find prometheus endpoint in config file.")
... | [
"Set",
"up",
"coredns",
"instance",
"so",
"it",
"can",
"be",
"used",
"in",
"OpenMetricsBaseCheck"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/coredns/datadog_checks/coredns/coredns.py#L84-L97 | [
"def",
"_create_core_dns_instance",
"(",
"self",
",",
"instance",
")",
":",
"endpoint",
"=",
"instance",
".",
"get",
"(",
"'prometheus_url'",
")",
"if",
"endpoint",
"is",
"None",
":",
"raise",
"ConfigurationError",
"(",
"\"Unable to find prometheus endpoint in config ... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | clean | Removes a project's build artifacts.
If `check` is not specified, the current working directory will be used.
All `*.pyc`/`*.pyd`/`*.pyo`/`*.whl` files and `__pycache__` directories will be
removed. Additionally, the following patterns will be removed from the root of
the path: `.cache`, `.coverage`, ... | datadog_checks_dev/datadog_checks/dev/tooling/commands/clean.py | def clean(ctx, check, compiled_only, all_matches, force, verbose):
"""Removes a project's build artifacts.
If `check` is not specified, the current working directory will be used.
All `*.pyc`/`*.pyd`/`*.pyo`/`*.whl` files and `__pycache__` directories will be
removed. Additionally, the following patte... | def clean(ctx, check, compiled_only, all_matches, force, verbose):
"""Removes a project's build artifacts.
If `check` is not specified, the current working directory will be used.
All `*.pyc`/`*.pyd`/`*.pyo`/`*.whl` files and `__pycache__` directories will be
removed. Additionally, the following patte... | [
"Removes",
"a",
"project",
"s",
"build",
"artifacts",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/clean.py#L41-L89 | [
"def",
"clean",
"(",
"ctx",
",",
"check",
",",
"compiled_only",
",",
"all_matches",
",",
"force",
",",
"verbose",
")",
":",
"force_clean_root",
"=",
"False",
"if",
"check",
":",
"path",
"=",
"resolve_path",
"(",
"os",
".",
"path",
".",
"join",
"(",
"ge... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | CouchDb.get | Hit a given URL and return the parsed json | couch/datadog_checks/couch/couch.py | def get(self, url, instance, service_check_tags, run_check=False):
"Hit a given URL and return the parsed json"
self.log.debug('Fetching CouchDB stats at url: %s' % url)
auth = None
if 'user' in instance and 'password' in instance:
auth = (instance['user'], instance['passwor... | def get(self, url, instance, service_check_tags, run_check=False):
"Hit a given URL and return the parsed json"
self.log.debug('Fetching CouchDB stats at url: %s' % url)
auth = None
if 'user' in instance and 'password' in instance:
auth = (instance['user'], instance['passwor... | [
"Hit",
"a",
"given",
"URL",
"and",
"return",
"the",
"parsed",
"json"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/couch/datadog_checks/couch/couch.py#L30-L68 | [
"def",
"get",
"(",
"self",
",",
"url",
",",
"instance",
",",
"service_check_tags",
",",
"run_check",
"=",
"False",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'Fetching CouchDB stats at url: %s'",
"%",
"url",
")",
"auth",
"=",
"None",
"if",
"'user'",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | SON.to_dict | Convert a SON document to a normal Python dictionary instance.
This is trickier than just *dict(...)* because it needs to be
recursive. | tokumx/datadog_checks/tokumx/vendor/bson/son.py | def to_dict(self):
"""Convert a SON document to a normal Python dictionary instance.
This is trickier than just *dict(...)* because it needs to be
recursive.
"""
def transform_value(value):
if isinstance(value, list):
return [transform_value(v) for v... | def to_dict(self):
"""Convert a SON document to a normal Python dictionary instance.
This is trickier than just *dict(...)* because it needs to be
recursive.
"""
def transform_value(value):
if isinstance(value, list):
return [transform_value(v) for v... | [
"Convert",
"a",
"SON",
"document",
"to",
"a",
"normal",
"Python",
"dictionary",
"instance",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/son.py#L220-L237 | [
"def",
"to_dict",
"(",
"self",
")",
":",
"def",
"transform_value",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"return",
"[",
"transform_value",
"(",
"v",
")",
"for",
"v",
"in",
"value",
"]",
"elif",
"isinstance",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | MongoClient._cache_credentials | Save a set of authentication credentials.
The credentials are used to login a socket whenever one is created.
If `connect` is True, verify the credentials on the server first. | tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py | def _cache_credentials(self, source, credentials, connect=False):
"""Save a set of authentication credentials.
The credentials are used to login a socket whenever one is created.
If `connect` is True, verify the credentials on the server first.
"""
# Don't let other threads affe... | def _cache_credentials(self, source, credentials, connect=False):
"""Save a set of authentication credentials.
The credentials are used to login a socket whenever one is created.
If `connect` is True, verify the credentials on the server first.
"""
# Don't let other threads affe... | [
"Save",
"a",
"set",
"of",
"authentication",
"credentials",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py#L524-L550 | [
"def",
"_cache_credentials",
"(",
"self",
",",
"source",
",",
"credentials",
",",
"connect",
"=",
"False",
")",
":",
"# Don't let other threads affect this call's data.",
"all_credentials",
"=",
"self",
".",
"__all_credentials",
".",
"copy",
"(",
")",
"if",
"source"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | MongoClient._cached | Test if `index` is cached. | tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py | def _cached(self, dbname, coll, index):
"""Test if `index` is cached."""
cache = self.__index_cache
now = datetime.datetime.utcnow()
with self.__index_cache_lock:
return (dbname in cache and
coll in cache[dbname] and
index in cache[dbna... | def _cached(self, dbname, coll, index):
"""Test if `index` is cached."""
cache = self.__index_cache
now = datetime.datetime.utcnow()
with self.__index_cache_lock:
return (dbname in cache and
coll in cache[dbname] and
index in cache[dbna... | [
"Test",
"if",
"index",
"is",
"cached",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py#L556-L564 | [
"def",
"_cached",
"(",
"self",
",",
"dbname",
",",
"coll",
",",
"index",
")",
":",
"cache",
"=",
"self",
".",
"__index_cache",
"now",
"=",
"datetime",
".",
"datetime",
".",
"utcnow",
"(",
")",
"with",
"self",
".",
"__index_cache_lock",
":",
"return",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | MongoClient._purge_index | Purge an index from the index cache.
If `index_name` is None purge an entire collection.
If `collection_name` is None purge an entire database. | tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py | def _purge_index(self, database_name,
collection_name=None, index_name=None):
"""Purge an index from the index cache.
If `index_name` is None purge an entire collection.
If `collection_name` is None purge an entire database.
"""
with self.__index_cache_lock... | def _purge_index(self, database_name,
collection_name=None, index_name=None):
"""Purge an index from the index cache.
If `index_name` is None purge an entire collection.
If `collection_name` is None purge an entire database.
"""
with self.__index_cache_lock... | [
"Purge",
"an",
"index",
"from",
"the",
"index",
"cache",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py#L584-L608 | [
"def",
"_purge_index",
"(",
"self",
",",
"database_name",
",",
"collection_name",
"=",
"None",
",",
"index_name",
"=",
"None",
")",
":",
"with",
"self",
".",
"__index_cache_lock",
":",
"if",
"not",
"database_name",
"in",
"self",
".",
"__index_cache",
":",
"r... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | MongoClient._server_property | An attribute of the current server's description.
If the client is not connected, this will block until a connection is
established or raise ServerSelectionTimeoutError if no server is
available.
Not threadsafe if used multiple times in a single method, since
the server may cha... | tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py | def _server_property(self, attr_name):
"""An attribute of the current server's description.
If the client is not connected, this will block until a connection is
established or raise ServerSelectionTimeoutError if no server is
available.
Not threadsafe if used multiple times in... | def _server_property(self, attr_name):
"""An attribute of the current server's description.
If the client is not connected, this will block until a connection is
established or raise ServerSelectionTimeoutError if no server is
available.
Not threadsafe if used multiple times in... | [
"An",
"attribute",
"of",
"the",
"current",
"server",
"s",
"description",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py#L610-L624 | [
"def",
"_server_property",
"(",
"self",
",",
"attr_name",
")",
":",
"server",
"=",
"self",
".",
"_topology",
".",
"select_server",
"(",
"writable_server_selector",
")",
"return",
"getattr",
"(",
"server",
".",
"description",
",",
"attr_name",
")"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | MongoClient.address | (host, port) of the current standalone, primary, or mongos, or None.
Accessing :attr:`address` raises :exc:`~.errors.InvalidOperation` if
the client is load-balancing among mongoses, since there is no single
address. Use :attr:`nodes` instead.
If the client is not connected, this will ... | tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py | def address(self):
"""(host, port) of the current standalone, primary, or mongos, or None.
Accessing :attr:`address` raises :exc:`~.errors.InvalidOperation` if
the client is load-balancing among mongoses, since there is no single
address. Use :attr:`nodes` instead.
If the clien... | def address(self):
"""(host, port) of the current standalone, primary, or mongos, or None.
Accessing :attr:`address` raises :exc:`~.errors.InvalidOperation` if
the client is load-balancing among mongoses, since there is no single
address. Use :attr:`nodes` instead.
If the clien... | [
"(",
"host",
"port",
")",
"of",
"the",
"current",
"standalone",
"primary",
"or",
"mongos",
"or",
"None",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py#L635-L656 | [
"def",
"address",
"(",
"self",
")",
":",
"topology_type",
"=",
"self",
".",
"_topology",
".",
"_description",
".",
"topology_type",
"if",
"topology_type",
"==",
"TOPOLOGY_TYPE",
".",
"Sharded",
":",
"raise",
"InvalidOperation",
"(",
"'Cannot use \"address\" property... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | MongoClient.nodes | Set of all currently connected servers.
.. warning:: When connected to a replica set the value of :attr:`nodes`
can change over time as :class:`MongoClient`'s view of the replica
set changes. :attr:`nodes` can also be an empty set when
:class:`MongoClient` is first instantiated an... | tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py | def nodes(self):
"""Set of all currently connected servers.
.. warning:: When connected to a replica set the value of :attr:`nodes`
can change over time as :class:`MongoClient`'s view of the replica
set changes. :attr:`nodes` can also be an empty set when
:class:`MongoClie... | def nodes(self):
"""Set of all currently connected servers.
.. warning:: When connected to a replica set the value of :attr:`nodes`
can change over time as :class:`MongoClient`'s view of the replica
set changes. :attr:`nodes` can also be an empty set when
:class:`MongoClie... | [
"Set",
"of",
"all",
"currently",
"connected",
"servers",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py#L746-L757 | [
"def",
"nodes",
"(",
"self",
")",
":",
"description",
"=",
"self",
".",
"_topology",
".",
"description",
"return",
"frozenset",
"(",
"s",
".",
"address",
"for",
"s",
"in",
"description",
".",
"known_servers",
")"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | MongoClient._is_writable | Attempt to connect to a writable server, or return False. | tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py | def _is_writable(self):
"""Attempt to connect to a writable server, or return False.
"""
topology = self._get_topology() # Starts monitors if necessary.
try:
svr = topology.select_server(writable_server_selector)
# When directly connected to a secondary, arbiter... | def _is_writable(self):
"""Attempt to connect to a writable server, or return False.
"""
topology = self._get_topology() # Starts monitors if necessary.
try:
svr = topology.select_server(writable_server_selector)
# When directly connected to a secondary, arbiter... | [
"Attempt",
"to",
"connect",
"to",
"a",
"writable",
"server",
"or",
"return",
"False",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py#L802-L814 | [
"def",
"_is_writable",
"(",
"self",
")",
":",
"topology",
"=",
"self",
".",
"_get_topology",
"(",
")",
"# Starts monitors if necessary.",
"try",
":",
"svr",
"=",
"topology",
".",
"select_server",
"(",
"writable_server_selector",
")",
"# When directly connected to a se... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | MongoClient.set_cursor_manager | DEPRECATED - Set this client's cursor manager.
Raises :class:`TypeError` if `manager_class` is not a subclass of
:class:`~pymongo.cursor_manager.CursorManager`. A cursor manager
handles closing cursors. Different managers can implement different
policies in terms of when to actually kil... | tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py | def set_cursor_manager(self, manager_class):
"""DEPRECATED - Set this client's cursor manager.
Raises :class:`TypeError` if `manager_class` is not a subclass of
:class:`~pymongo.cursor_manager.CursorManager`. A cursor manager
handles closing cursors. Different managers can implement dif... | def set_cursor_manager(self, manager_class):
"""DEPRECATED - Set this client's cursor manager.
Raises :class:`TypeError` if `manager_class` is not a subclass of
:class:`~pymongo.cursor_manager.CursorManager`. A cursor manager
handles closing cursors. Different managers can implement dif... | [
"DEPRECATED",
"-",
"Set",
"this",
"client",
"s",
"cursor",
"manager",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py#L828-L855 | [
"def",
"set_cursor_manager",
"(",
"self",
",",
"manager_class",
")",
":",
"warnings",
".",
"warn",
"(",
"\"set_cursor_manager is Deprecated\"",
",",
"DeprecationWarning",
",",
"stacklevel",
"=",
"2",
")",
"manager",
"=",
"manager_class",
"(",
"self",
")",
"if",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | MongoClient._send_message_with_response | Send a message to MongoDB and return a Response.
:Parameters:
- `operation`: a _Query or _GetMore object.
- `read_preference` (optional): A ReadPreference.
- `exhaust` (optional): If True, the socket used stays checked out.
It is returned along with its Pool in the Res... | tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py | def _send_message_with_response(self, operation, read_preference=None,
exhaust=False, address=None):
"""Send a message to MongoDB and return a Response.
:Parameters:
- `operation`: a _Query or _GetMore object.
- `read_preference` (optional): A Rea... | def _send_message_with_response(self, operation, read_preference=None,
exhaust=False, address=None):
"""Send a message to MongoDB and return a Response.
:Parameters:
- `operation`: a _Query or _GetMore object.
- `read_preference` (optional): A Rea... | [
"Send",
"a",
"message",
"to",
"MongoDB",
"and",
"return",
"a",
"Response",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py#L909-L950 | [
"def",
"_send_message_with_response",
"(",
"self",
",",
"operation",
",",
"read_preference",
"=",
"None",
",",
"exhaust",
"=",
"False",
",",
"address",
"=",
"None",
")",
":",
"with",
"self",
".",
"__lock",
":",
"# If needed, restart kill-cursors thread after a fork.... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | MongoClient._reset_on_error | Execute an operation. Reset the server on network error.
Returns fn()'s return value on success. On error, clears the server's
pool and marks the server Unknown.
Re-raises any exception thrown by fn(). | tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py | def _reset_on_error(self, server, func, *args, **kwargs):
"""Execute an operation. Reset the server on network error.
Returns fn()'s return value on success. On error, clears the server's
pool and marks the server Unknown.
Re-raises any exception thrown by fn().
"""
try... | def _reset_on_error(self, server, func, *args, **kwargs):
"""Execute an operation. Reset the server on network error.
Returns fn()'s return value on success. On error, clears the server's
pool and marks the server Unknown.
Re-raises any exception thrown by fn().
"""
try... | [
"Execute",
"an",
"operation",
".",
"Reset",
"the",
"server",
"on",
"network",
"error",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py#L952-L967 | [
"def",
"_reset_on_error",
"(",
"self",
",",
"server",
",",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"return",
"func",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"except",
"NetworkTimeout",
":",
"# The socket has bee... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | MongoClient.close_cursor | Send a kill cursors message soon with the given id.
Raises :class:`TypeError` if `cursor_id` is not an instance of
``(int, long)``. What closing the cursor actually means
depends on this client's cursor manager.
This method may be called from a :class:`~pymongo.cursor.Cursor`
d... | tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py | def close_cursor(self, cursor_id, address=None):
"""Send a kill cursors message soon with the given id.
Raises :class:`TypeError` if `cursor_id` is not an instance of
``(int, long)``. What closing the cursor actually means
depends on this client's cursor manager.
This method ma... | def close_cursor(self, cursor_id, address=None):
"""Send a kill cursors message soon with the given id.
Raises :class:`TypeError` if `cursor_id` is not an instance of
``(int, long)``. What closing the cursor actually means
depends on this client's cursor manager.
This method ma... | [
"Send",
"a",
"kill",
"cursors",
"message",
"soon",
"with",
"the",
"given",
"id",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py#L1044-L1071 | [
"def",
"close_cursor",
"(",
"self",
",",
"cursor_id",
",",
"address",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"cursor_id",
",",
"integer_types",
")",
":",
"raise",
"TypeError",
"(",
"\"cursor_id must be an instance of (int, long)\"",
")",
"if",
"s... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | MongoClient._close_cursor_now | Send a kill cursors message with the given id.
What closing the cursor actually means depends on this client's
cursor manager. If there is none, the cursor is closed synchronously
on the current thread. | tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py | def _close_cursor_now(self, cursor_id, address=None):
"""Send a kill cursors message with the given id.
What closing the cursor actually means depends on this client's
cursor manager. If there is none, the cursor is closed synchronously
on the current thread.
"""
if not ... | def _close_cursor_now(self, cursor_id, address=None):
"""Send a kill cursors message with the given id.
What closing the cursor actually means depends on this client's
cursor manager. If there is none, the cursor is closed synchronously
on the current thread.
"""
if not ... | [
"Send",
"a",
"kill",
"cursors",
"message",
"with",
"the",
"given",
"id",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py#L1073-L1086 | [
"def",
"_close_cursor_now",
"(",
"self",
",",
"cursor_id",
",",
"address",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"cursor_id",
",",
"integer_types",
")",
":",
"raise",
"TypeError",
"(",
"\"cursor_id must be an instance of (int, long)\"",
")",
"if",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | MongoClient.kill_cursors | DEPRECATED - Send a kill cursors message soon with the given ids.
Raises :class:`TypeError` if `cursor_ids` is not an instance of
``list``.
:Parameters:
- `cursor_ids`: list of cursor ids to kill
- `address` (optional): (host, port) pair of the cursor's server.
... | tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py | def kill_cursors(self, cursor_ids, address=None):
"""DEPRECATED - Send a kill cursors message soon with the given ids.
Raises :class:`TypeError` if `cursor_ids` is not an instance of
``list``.
:Parameters:
- `cursor_ids`: list of cursor ids to kill
- `address` (opti... | def kill_cursors(self, cursor_ids, address=None):
"""DEPRECATED - Send a kill cursors message soon with the given ids.
Raises :class:`TypeError` if `cursor_ids` is not an instance of
``list``.
:Parameters:
- `cursor_ids`: list of cursor ids to kill
- `address` (opti... | [
"DEPRECATED",
"-",
"Send",
"a",
"kill",
"cursors",
"message",
"soon",
"with",
"the",
"given",
"ids",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py#L1088-L1117 | [
"def",
"kill_cursors",
"(",
"self",
",",
"cursor_ids",
",",
"address",
"=",
"None",
")",
":",
"warnings",
".",
"warn",
"(",
"\"kill_cursors is deprecated.\"",
",",
"DeprecationWarning",
",",
"stacklevel",
"=",
"2",
")",
"if",
"not",
"isinstance",
"(",
"cursor_... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | MongoClient.drop_database | Drop a database.
Raises :class:`TypeError` if `name_or_database` is not an instance of
:class:`basestring` (:class:`str` in python 3) or
:class:`~pymongo.database.Database`.
:Parameters:
- `name_or_database`: the name of a database to drop, or a
:class:`~pymongo.d... | tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py | def drop_database(self, name_or_database):
"""Drop a database.
Raises :class:`TypeError` if `name_or_database` is not an instance of
:class:`basestring` (:class:`str` in python 3) or
:class:`~pymongo.database.Database`.
:Parameters:
- `name_or_database`: the name of a... | def drop_database(self, name_or_database):
"""Drop a database.
Raises :class:`TypeError` if `name_or_database` is not an instance of
:class:`basestring` (:class:`str` in python 3) or
:class:`~pymongo.database.Database`.
:Parameters:
- `name_or_database`: the name of a... | [
"Drop",
"a",
"database",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py#L1215-L1253 | [
"def",
"drop_database",
"(",
"self",
",",
"name_or_database",
")",
":",
"name",
"=",
"name_or_database",
"if",
"isinstance",
"(",
"name",
",",
"database",
".",
"Database",
")",
":",
"name",
"=",
"name",
".",
"name",
"if",
"not",
"isinstance",
"(",
"name",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | MongoClient.get_default_database | DEPRECATED - Get the database named in the MongoDB connection URI.
>>> uri = 'mongodb://host/my_database'
>>> client = MongoClient(uri)
>>> db = client.get_default_database()
>>> assert db.name == 'my_database'
>>> db = client.get_database()
>>> assert db.name == 'my_dat... | tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py | def get_default_database(self):
"""DEPRECATED - Get the database named in the MongoDB connection URI.
>>> uri = 'mongodb://host/my_database'
>>> client = MongoClient(uri)
>>> db = client.get_default_database()
>>> assert db.name == 'my_database'
>>> db = client.get_datab... | def get_default_database(self):
"""DEPRECATED - Get the database named in the MongoDB connection URI.
>>> uri = 'mongodb://host/my_database'
>>> client = MongoClient(uri)
>>> db = client.get_default_database()
>>> assert db.name == 'my_database'
>>> db = client.get_datab... | [
"DEPRECATED",
"-",
"Get",
"the",
"database",
"named",
"in",
"the",
"MongoDB",
"connection",
"URI",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py#L1255-L1276 | [
"def",
"get_default_database",
"(",
"self",
")",
":",
"warnings",
".",
"warn",
"(",
"\"get_default_database is deprecated. Use get_database \"",
"\"instead.\"",
",",
"DeprecationWarning",
",",
"stacklevel",
"=",
"2",
")",
"if",
"self",
".",
"__default_database_name",
"i... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | MongoClient.get_database | Get a :class:`~pymongo.database.Database` with the given name and
options.
Useful for creating a :class:`~pymongo.database.Database` with
different codec options, read preference, and/or write concern from
this :class:`MongoClient`.
>>> client.read_preference
Primar... | tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py | def get_database(self, name=None, codec_options=None, read_preference=None,
write_concern=None, read_concern=None):
"""Get a :class:`~pymongo.database.Database` with the given name and
options.
Useful for creating a :class:`~pymongo.database.Database` with
different... | def get_database(self, name=None, codec_options=None, read_preference=None,
write_concern=None, read_concern=None):
"""Get a :class:`~pymongo.database.Database` with the given name and
options.
Useful for creating a :class:`~pymongo.database.Database` with
different... | [
"Get",
"a",
":",
"class",
":",
"~pymongo",
".",
"database",
".",
"Database",
"with",
"the",
"given",
"name",
"and",
"options",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py#L1278-L1330 | [
"def",
"get_database",
"(",
"self",
",",
"name",
"=",
"None",
",",
"codec_options",
"=",
"None",
",",
"read_preference",
"=",
"None",
",",
"write_concern",
"=",
"None",
",",
"read_concern",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"if",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | MongoClient.fsync | Flush all pending writes to datafiles.
:Parameters:
Optional parameters can be passed as keyword arguments:
- `lock`: If True lock the server to disallow writes.
- `async`: If True don't block while synchronizing.
.. warning:: `async` and `lock` can not be use... | tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py | def fsync(self, **kwargs):
"""Flush all pending writes to datafiles.
:Parameters:
Optional parameters can be passed as keyword arguments:
- `lock`: If True lock the server to disallow writes.
- `async`: If True don't block while synchronizing.
.. warni... | def fsync(self, **kwargs):
"""Flush all pending writes to datafiles.
:Parameters:
Optional parameters can be passed as keyword arguments:
- `lock`: If True lock the server to disallow writes.
- `async`: If True don't block while synchronizing.
.. warni... | [
"Flush",
"all",
"pending",
"writes",
"to",
"datafiles",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py#L1348-L1365 | [
"def",
"fsync",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"admin",
".",
"command",
"(",
"\"fsync\"",
",",
"read_preference",
"=",
"ReadPreference",
".",
"PRIMARY",
",",
"*",
"*",
"kwargs",
")"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | MongoClient.unlock | Unlock a previously locked server. | tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py | def unlock(self):
"""Unlock a previously locked server.
"""
cmd = {"fsyncUnlock": 1}
with self._socket_for_writes() as sock_info:
if sock_info.max_wire_version >= 4:
try:
sock_info.command("admin", cmd)
except OperationFailu... | def unlock(self):
"""Unlock a previously locked server.
"""
cmd = {"fsyncUnlock": 1}
with self._socket_for_writes() as sock_info:
if sock_info.max_wire_version >= 4:
try:
sock_info.command("admin", cmd)
except OperationFailu... | [
"Unlock",
"a",
"previously",
"locked",
"server",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/mongo_client.py#L1367-L1382 | [
"def",
"unlock",
"(",
"self",
")",
":",
"cmd",
"=",
"{",
"\"fsyncUnlock\"",
":",
"1",
"}",
"with",
"self",
".",
"_socket_for_writes",
"(",
")",
"as",
"sock_info",
":",
"if",
"sock_info",
".",
"max_wire_version",
">=",
"4",
":",
"try",
":",
"sock_info",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | GUnicornCheck.check | Collect metrics for the given gunicorn instance. | gunicorn/datadog_checks/gunicorn/gunicorn.py | def check(self, instance):
""" Collect metrics for the given gunicorn instance. """
self.log.debug("Running instance: %s", instance)
custom_tags = instance.get('tags', [])
# Validate the config.
if not instance or self.PROC_NAME not in instance:
raise GUnicornCheckEr... | def check(self, instance):
""" Collect metrics for the given gunicorn instance. """
self.log.debug("Running instance: %s", instance)
custom_tags = instance.get('tags', [])
# Validate the config.
if not instance or self.PROC_NAME not in instance:
raise GUnicornCheckEr... | [
"Collect",
"metrics",
"for",
"the",
"given",
"gunicorn",
"instance",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/gunicorn/datadog_checks/gunicorn/gunicorn.py#L36-L63 | [
"def",
"check",
"(",
"self",
",",
"instance",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"\"Running instance: %s\"",
",",
"instance",
")",
"custom_tags",
"=",
"instance",
".",
"get",
"(",
"'tags'",
",",
"[",
"]",
")",
"# Validate the config.",
"if",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | GUnicornCheck._get_master_proc_by_name | Return a psutil process for the master gunicorn process with the given name. | gunicorn/datadog_checks/gunicorn/gunicorn.py | def _get_master_proc_by_name(self, name, tags):
""" Return a psutil process for the master gunicorn process with the given name. """
master_name = GUnicornCheck._get_master_proc_name(name)
master_procs = [p for p in psutil.process_iter() if p.cmdline() and p.cmdline()[0] == master_name]
... | def _get_master_proc_by_name(self, name, tags):
""" Return a psutil process for the master gunicorn process with the given name. """
master_name = GUnicornCheck._get_master_proc_name(name)
master_procs = [p for p in psutil.process_iter() if p.cmdline() and p.cmdline()[0] == master_name]
... | [
"Return",
"a",
"psutil",
"process",
"for",
"the",
"master",
"gunicorn",
"process",
"with",
"the",
"given",
"name",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/gunicorn/datadog_checks/gunicorn/gunicorn.py#L111-L126 | [
"def",
"_get_master_proc_by_name",
"(",
"self",
",",
"name",
",",
"tags",
")",
":",
"master_name",
"=",
"GUnicornCheck",
".",
"_get_master_proc_name",
"(",
"name",
")",
"master_procs",
"=",
"[",
"p",
"for",
"p",
"in",
"psutil",
".",
"process_iter",
"(",
")",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | CommandCursor.batch_size | Limits the number of documents returned in one batch. Each batch
requires a round trip to the server. It can be adjusted to optimize
performance and limit data transfer.
.. note:: batch_size can not override MongoDB's internal limits on the
amount of data it will return to the client... | tokumx/datadog_checks/tokumx/vendor/pymongo/command_cursor.py | def batch_size(self, batch_size):
"""Limits the number of documents returned in one batch. Each batch
requires a round trip to the server. It can be adjusted to optimize
performance and limit data transfer.
.. note:: batch_size can not override MongoDB's internal limits on the
... | def batch_size(self, batch_size):
"""Limits the number of documents returned in one batch. Each batch
requires a round trip to the server. It can be adjusted to optimize
performance and limit data transfer.
.. note:: batch_size can not override MongoDB's internal limits on the
... | [
"Limits",
"the",
"number",
"of",
"documents",
"returned",
"in",
"one",
"batch",
".",
"Each",
"batch",
"requires",
"a",
"round",
"trip",
"to",
"the",
"server",
".",
"It",
"can",
"be",
"adjusted",
"to",
"optimize",
"performance",
"and",
"limit",
"data",
"tra... | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/command_cursor.py#L70-L92 | [
"def",
"batch_size",
"(",
"self",
",",
"batch_size",
")",
":",
"if",
"not",
"isinstance",
"(",
"batch_size",
",",
"integer_types",
")",
":",
"raise",
"TypeError",
"(",
"\"batch_size must be an integer\"",
")",
"if",
"batch_size",
"<",
"0",
":",
"raise",
"Value... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | CommandCursor.__send_message | Send a getmore message and handle the response. | tokumx/datadog_checks/tokumx/vendor/pymongo/command_cursor.py | def __send_message(self, operation):
"""Send a getmore message and handle the response.
"""
client = self.__collection.database.client
listeners = client._event_listeners
publish = listeners.enabled_for_commands
try:
response = client._send_message_with_respon... | def __send_message(self, operation):
"""Send a getmore message and handle the response.
"""
client = self.__collection.database.client
listeners = client._event_listeners
publish = listeners.enabled_for_commands
try:
response = client._send_message_with_respon... | [
"Send",
"a",
"getmore",
"message",
"and",
"handle",
"the",
"response",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/command_cursor.py#L94-L175 | [
"def",
"__send_message",
"(",
"self",
",",
"operation",
")",
":",
"client",
"=",
"self",
".",
"__collection",
".",
"database",
".",
"client",
"listeners",
"=",
"client",
".",
"_event_listeners",
"publish",
"=",
"listeners",
".",
"enabled_for_commands",
"try",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | CommandCursor._refresh | Refreshes the cursor with more data from the server.
Returns the length of self.__data after refresh. Will exit early if
self.__data is already non-empty. Raises OperationFailure when the
cursor cannot be refreshed due to an error on the query. | tokumx/datadog_checks/tokumx/vendor/pymongo/command_cursor.py | def _refresh(self):
"""Refreshes the cursor with more data from the server.
Returns the length of self.__data after refresh. Will exit early if
self.__data is already non-empty. Raises OperationFailure when the
cursor cannot be refreshed due to an error on the query.
"""
... | def _refresh(self):
"""Refreshes the cursor with more data from the server.
Returns the length of self.__data after refresh. Will exit early if
self.__data is already non-empty. Raises OperationFailure when the
cursor cannot be refreshed due to an error on the query.
"""
... | [
"Refreshes",
"the",
"cursor",
"with",
"more",
"data",
"from",
"the",
"server",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/command_cursor.py#L178-L200 | [
"def",
"_refresh",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"__data",
")",
"or",
"self",
".",
"__killed",
":",
"return",
"len",
"(",
"self",
".",
"__data",
")",
"if",
"self",
".",
"__id",
":",
"# Get More",
"dbname",
",",
"collname",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | CommandCursor.next | Advance the cursor. | tokumx/datadog_checks/tokumx/vendor/pymongo/command_cursor.py | def next(self):
"""Advance the cursor."""
if len(self.__data) or self._refresh():
coll = self.__collection
return coll.database._fix_outgoing(self.__data.popleft(), coll)
else:
raise StopIteration | def next(self):
"""Advance the cursor."""
if len(self.__data) or self._refresh():
coll = self.__collection
return coll.database._fix_outgoing(self.__data.popleft(), coll)
else:
raise StopIteration | [
"Advance",
"the",
"cursor",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/command_cursor.py#L235-L241 | [
"def",
"next",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"__data",
")",
"or",
"self",
".",
"_refresh",
"(",
")",
":",
"coll",
"=",
"self",
".",
"__collection",
"return",
"coll",
".",
"database",
".",
"_fix_outgoing",
"(",
"self",
".",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Disk._exclude_disk | Return True for disks we don't want or that match regex in the config file | disk/datadog_checks/disk/disk.py | def _exclude_disk(self, device, file_system, mount_point):
"""
Return True for disks we don't want or that match regex in the config file
"""
self.log.debug('_exclude_disk: {}, {}, {}'.format(device, file_system, mount_point))
if not device or device == 'none':
devic... | def _exclude_disk(self, device, file_system, mount_point):
"""
Return True for disks we don't want or that match regex in the config file
"""
self.log.debug('_exclude_disk: {}, {}, {}'.format(device, file_system, mount_point))
if not device or device == 'none':
devic... | [
"Return",
"True",
"for",
"disks",
"we",
"don",
"t",
"want",
"or",
"that",
"match",
"regex",
"in",
"the",
"config",
"file"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/disk/datadog_checks/disk/disk.py#L165-L186 | [
"def",
"_exclude_disk",
"(",
"self",
",",
"device",
",",
"file_system",
",",
"mount_point",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'_exclude_disk: {}, {}, {}'",
".",
"format",
"(",
"device",
",",
"file_system",
",",
"mount_point",
")",
")",
"if",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Disk._list_devices | Given raw output for the df command, transform it into a normalized
list devices. A 'device' is a list with fields corresponding to the
output of df output on each platform. | disk/datadog_checks/disk/disk.py | def _list_devices(self, df_output):
"""
Given raw output for the df command, transform it into a normalized
list devices. A 'device' is a list with fields corresponding to the
output of df output on each platform.
"""
all_devices = [l.strip().split() for l in df_output.sp... | def _list_devices(self, df_output):
"""
Given raw output for the df command, transform it into a normalized
list devices. A 'device' is a list with fields corresponding to the
output of df output on each platform.
"""
all_devices = [l.strip().split() for l in df_output.sp... | [
"Given",
"raw",
"output",
"for",
"the",
"df",
"command",
"transform",
"it",
"into",
"a",
"normalized",
"list",
"devices",
".",
"A",
"device",
"is",
"a",
"list",
"with",
"fields",
"corresponding",
"to",
"the",
"output",
"of",
"df",
"output",
"on",
"each",
... | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/disk/datadog_checks/disk/disk.py#L362-L377 | [
"def",
"_list_devices",
"(",
"self",
",",
"df_output",
")",
":",
"all_devices",
"=",
"[",
"l",
".",
"strip",
"(",
")",
".",
"split",
"(",
")",
"for",
"l",
"in",
"df_output",
".",
"splitlines",
"(",
")",
"]",
"# Skip the header row and empty lines.",
"raw_d... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Disk._compile_tag_re | Compile regex strings from device_tag_re option and return list of compiled regex/tag pairs | disk/datadog_checks/disk/disk.py | def _compile_tag_re(self):
"""
Compile regex strings from device_tag_re option and return list of compiled regex/tag pairs
"""
device_tag_list = []
for regex_str, tags in iteritems(self._device_tag_re):
try:
device_tag_list.append([re.compile(regex_str... | def _compile_tag_re(self):
"""
Compile regex strings from device_tag_re option and return list of compiled regex/tag pairs
"""
device_tag_list = []
for regex_str, tags in iteritems(self._device_tag_re):
try:
device_tag_list.append([re.compile(regex_str... | [
"Compile",
"regex",
"strings",
"from",
"device_tag_re",
"option",
"and",
"return",
"list",
"of",
"compiled",
"regex",
"/",
"tag",
"pairs"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/disk/datadog_checks/disk/disk.py#L447-L457 | [
"def",
"_compile_tag_re",
"(",
"self",
")",
":",
"device_tag_list",
"=",
"[",
"]",
"for",
"regex_str",
",",
"tags",
"in",
"iteritems",
"(",
"self",
".",
"_device_tag_re",
")",
":",
"try",
":",
"device_tag_list",
".",
"append",
"(",
"[",
"re",
".",
"compi... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | ObjectsQueue.fill | Set a dict mapping (resouce_type --> objects[]) for a given key | vsphere/datadog_checks/vsphere/objects_queue.py | def fill(self, key, mor_dict):
"""
Set a dict mapping (resouce_type --> objects[]) for a given key
"""
with self._objects_queue_lock:
self._objects_queue[key] = mor_dict | def fill(self, key, mor_dict):
"""
Set a dict mapping (resouce_type --> objects[]) for a given key
"""
with self._objects_queue_lock:
self._objects_queue[key] = mor_dict | [
"Set",
"a",
"dict",
"mapping",
"(",
"resouce_type",
"--",
">",
"objects",
"[]",
")",
"for",
"a",
"given",
"key"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/objects_queue.py#L18-L23 | [
"def",
"fill",
"(",
"self",
",",
"key",
",",
"mor_dict",
")",
":",
"with",
"self",
".",
"_objects_queue_lock",
":",
"self",
".",
"_objects_queue",
"[",
"key",
"]",
"=",
"mor_dict"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | ObjectsQueue.size | Return the size of the queue for a given key and resource type.
If the key is not in the cache, this will raise a KeyError. | vsphere/datadog_checks/vsphere/objects_queue.py | def size(self, key, resource_type):
"""
Return the size of the queue for a given key and resource type.
If the key is not in the cache, this will raise a KeyError.
"""
with self._objects_queue_lock:
return len(self._objects_queue[key].get(resource_type, [])) | def size(self, key, resource_type):
"""
Return the size of the queue for a given key and resource type.
If the key is not in the cache, this will raise a KeyError.
"""
with self._objects_queue_lock:
return len(self._objects_queue[key].get(resource_type, [])) | [
"Return",
"the",
"size",
"of",
"the",
"queue",
"for",
"a",
"given",
"key",
"and",
"resource",
"type",
".",
"If",
"the",
"key",
"is",
"not",
"in",
"the",
"cache",
"this",
"will",
"raise",
"a",
"KeyError",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/objects_queue.py#L29-L35 | [
"def",
"size",
"(",
"self",
",",
"key",
",",
"resource_type",
")",
":",
"with",
"self",
".",
"_objects_queue_lock",
":",
"return",
"len",
"(",
"self",
".",
"_objects_queue",
"[",
"key",
"]",
".",
"get",
"(",
"resource_type",
",",
"[",
"]",
")",
")"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | ObjectsQueue.pop | Extract an object from the list.
If the key is not in the cache, this will raise a KeyError.
If the list is empty, method will return None | vsphere/datadog_checks/vsphere/objects_queue.py | def pop(self, key, resource_type):
"""
Extract an object from the list.
If the key is not in the cache, this will raise a KeyError.
If the list is empty, method will return None
"""
with self._objects_queue_lock:
objects = self._objects_queue[key].get(resource... | def pop(self, key, resource_type):
"""
Extract an object from the list.
If the key is not in the cache, this will raise a KeyError.
If the list is empty, method will return None
"""
with self._objects_queue_lock:
objects = self._objects_queue[key].get(resource... | [
"Extract",
"an",
"object",
"from",
"the",
"list",
".",
"If",
"the",
"key",
"is",
"not",
"in",
"the",
"cache",
"this",
"will",
"raise",
"a",
"KeyError",
".",
"If",
"the",
"list",
"is",
"empty",
"method",
"will",
"return",
"None"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/vsphere/datadog_checks/vsphere/objects_queue.py#L37-L45 | [
"def",
"pop",
"(",
"self",
",",
"key",
",",
"resource_type",
")",
":",
"with",
"self",
".",
"_objects_queue_lock",
":",
"objects",
"=",
"self",
".",
"_objects_queue",
"[",
"key",
"]",
".",
"get",
"(",
"resource_type",
",",
"[",
"]",
")",
"return",
"obj... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _ipaddress_match | Exact matching of IP addresses.
RFC 6125 explicitly doesn't define an algorithm for this
(section 1.7.2 - "Out of Scope"). | tokumx/datadog_checks/tokumx/vendor/pymongo/ssl_match_hostname.py | def _ipaddress_match(ipname, host_ip):
"""Exact matching of IP addresses.
RFC 6125 explicitly doesn't define an algorithm for this
(section 1.7.2 - "Out of Scope").
"""
# OpenSSL may add a trailing newline to a subjectAltName's IP address
ip = ip_address(_unicode(ipname).rstrip())
return ip... | def _ipaddress_match(ipname, host_ip):
"""Exact matching of IP addresses.
RFC 6125 explicitly doesn't define an algorithm for this
(section 1.7.2 - "Out of Scope").
"""
# OpenSSL may add a trailing newline to a subjectAltName's IP address
ip = ip_address(_unicode(ipname).rstrip())
return ip... | [
"Exact",
"matching",
"of",
"IP",
"addresses",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/ssl_match_hostname.py#L75-L83 | [
"def",
"_ipaddress_match",
"(",
"ipname",
",",
"host_ip",
")",
":",
"# OpenSSL may add a trailing newline to a subjectAltName's IP address",
"ip",
"=",
"ip_address",
"(",
"_unicode",
"(",
"ipname",
")",
".",
"rstrip",
"(",
")",
")",
"return",
"ip",
"==",
"host_ip"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | OpenLDAP._get_tls_object | Return a TLS object to establish a secure connection to a server | openldap/datadog_checks/openldap/openldap.py | def _get_tls_object(self, ssl_params):
"""
Return a TLS object to establish a secure connection to a server
"""
if ssl_params is None:
return None
if not ssl_params["verify"] and ssl_params["ca_certs"]:
self.warning(
"Incorrect configurati... | def _get_tls_object(self, ssl_params):
"""
Return a TLS object to establish a secure connection to a server
"""
if ssl_params is None:
return None
if not ssl_params["verify"] and ssl_params["ca_certs"]:
self.warning(
"Incorrect configurati... | [
"Return",
"a",
"TLS",
"object",
"to",
"establish",
"a",
"secure",
"connection",
"to",
"a",
"server"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/openldap/datadog_checks/openldap/openldap.py#L58-L94 | [
"def",
"_get_tls_object",
"(",
"self",
",",
"ssl_params",
")",
":",
"if",
"ssl_params",
"is",
"None",
":",
"return",
"None",
"if",
"not",
"ssl_params",
"[",
"\"verify\"",
"]",
"and",
"ssl_params",
"[",
"\"ca_certs\"",
"]",
":",
"self",
".",
"warning",
"(",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | OpenLDAP._get_instance_params | Parse instance configuration and perform minimal verification | openldap/datadog_checks/openldap/openldap.py | def _get_instance_params(cls, instance):
"""
Parse instance configuration and perform minimal verification
"""
url = instance.get("url")
if url is None:
raise ConfigurationError("You must specify a url for your instance in `conf.yaml`")
username = instance.get... | def _get_instance_params(cls, instance):
"""
Parse instance configuration and perform minimal verification
"""
url = instance.get("url")
if url is None:
raise ConfigurationError("You must specify a url for your instance in `conf.yaml`")
username = instance.get... | [
"Parse",
"instance",
"configuration",
"and",
"perform",
"minimal",
"verification"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/openldap/datadog_checks/openldap/openldap.py#L97-L118 | [
"def",
"_get_instance_params",
"(",
"cls",
",",
"instance",
")",
":",
"url",
"=",
"instance",
".",
"get",
"(",
"\"url\"",
")",
"if",
"url",
"is",
"None",
":",
"raise",
"ConfigurationError",
"(",
"\"You must specify a url for your instance in `conf.yaml`\"",
")",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | OpenLDAP._collect_monitor_metrics | Collect metrics from the monitor backend | openldap/datadog_checks/openldap/openldap.py | def _collect_monitor_metrics(self, conn, tags):
"""
Collect metrics from the monitor backend
"""
for entry in conn.entries:
# Get metrics from monitor backend
dn = entry.entry_dn.lower()
if dn.endswith(self.CONNECTIONS_METRICS_DN):
self... | def _collect_monitor_metrics(self, conn, tags):
"""
Collect metrics from the monitor backend
"""
for entry in conn.entries:
# Get metrics from monitor backend
dn = entry.entry_dn.lower()
if dn.endswith(self.CONNECTIONS_METRICS_DN):
self... | [
"Collect",
"metrics",
"from",
"the",
"monitor",
"backend"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/openldap/datadog_checks/openldap/openldap.py#L120-L138 | [
"def",
"_collect_monitor_metrics",
"(",
"self",
",",
"conn",
",",
"tags",
")",
":",
"for",
"entry",
"in",
"conn",
".",
"entries",
":",
"# Get metrics from monitor backend",
"dn",
"=",
"entry",
".",
"entry_dn",
".",
"lower",
"(",
")",
"if",
"dn",
".",
"ends... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | OpenLDAP._perform_custom_queries | Perform custom queries to collect additional metrics like number of result and duration of the query | openldap/datadog_checks/openldap/openldap.py | def _perform_custom_queries(self, conn, custom_queries, tags, instance):
"""
Perform custom queries to collect additional metrics like number of result and duration of the query
"""
for query in custom_queries:
name = query.get("name")
if name is None:
... | def _perform_custom_queries(self, conn, custom_queries, tags, instance):
"""
Perform custom queries to collect additional metrics like number of result and duration of the query
"""
for query in custom_queries:
name = query.get("name")
if name is None:
... | [
"Perform",
"custom",
"queries",
"to",
"collect",
"additional",
"metrics",
"like",
"number",
"of",
"result",
"and",
"duration",
"of",
"the",
"query"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/openldap/datadog_checks/openldap/openldap.py#L140-L194 | [
"def",
"_perform_custom_queries",
"(",
"self",
",",
"conn",
",",
"custom_queries",
",",
"tags",
",",
"instance",
")",
":",
"for",
"query",
"in",
"custom_queries",
":",
"name",
"=",
"query",
".",
"get",
"(",
"\"name\"",
")",
"if",
"name",
"is",
"None",
":... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | OpenLDAP._extract_common_name | extract first common name (cn) from DN that looks like "cn=max file descriptors,cn=connections,cn=monitor" | openldap/datadog_checks/openldap/openldap.py | def _extract_common_name(cls, dn):
"""
extract first common name (cn) from DN that looks like "cn=max file descriptors,cn=connections,cn=monitor"
"""
dn = dn.lower().replace(" ", "_")
return dn.split(",")[0].split("=")[1] | def _extract_common_name(cls, dn):
"""
extract first common name (cn) from DN that looks like "cn=max file descriptors,cn=connections,cn=monitor"
"""
dn = dn.lower().replace(" ", "_")
return dn.split(",")[0].split("=")[1] | [
"extract",
"first",
"common",
"name",
"(",
"cn",
")",
"from",
"DN",
"that",
"looks",
"like",
"cn",
"=",
"max",
"file",
"descriptors",
"cn",
"=",
"connections",
"cn",
"=",
"monitor"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/openldap/datadog_checks/openldap/openldap.py#L250-L255 | [
"def",
"_extract_common_name",
"(",
"cls",
",",
"dn",
")",
":",
"dn",
"=",
"dn",
".",
"lower",
"(",
")",
".",
"replace",
"(",
"\" \"",
",",
"\"_\"",
")",
"return",
"dn",
".",
"split",
"(",
"\",\"",
")",
"[",
"0",
"]",
".",
"split",
"(",
"\"=\"",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Couchbase._process_cluster_health_data | Process and send cluster health data (i.e. cluster membership status and node health | couchbase/datadog_checks/couchbase/couchbase.py | def _process_cluster_health_data(self, node_name, node_stats, tags):
"""
Process and send cluster health data (i.e. cluster membership status and node health
"""
# Tags for service check
cluster_health_tags = list(tags) + ['node:{}'.format(node_name)]
# Get the membersh... | def _process_cluster_health_data(self, node_name, node_stats, tags):
"""
Process and send cluster health data (i.e. cluster membership status and node health
"""
# Tags for service check
cluster_health_tags = list(tags) + ['node:{}'.format(node_name)]
# Get the membersh... | [
"Process",
"and",
"send",
"cluster",
"health",
"data",
"(",
"i",
".",
"e",
".",
"cluster",
"membership",
"status",
"and",
"node",
"health"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/couchbase/datadog_checks/couchbase/couchbase.py#L353-L369 | [
"def",
"_process_cluster_health_data",
"(",
"self",
",",
"node_name",
",",
"node_stats",
",",
"tags",
")",
":",
"# Tags for service check",
"cluster_health_tags",
"=",
"list",
"(",
"tags",
")",
"+",
"[",
"'node:{}'",
".",
"format",
"(",
"node_name",
")",
"]",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Couchbase._create_event | Create an event object | couchbase/datadog_checks/couchbase/couchbase.py | def _create_event(self, alert_type, msg_title, msg, server, tags=None):
"""
Create an event object
"""
msg_title = 'Couchbase {}: {}'.format(server, msg_title)
msg = 'Couchbase instance {} {}'.format(server, msg)
return {
'timestamp': int(time.time()),
... | def _create_event(self, alert_type, msg_title, msg, server, tags=None):
"""
Create an event object
"""
msg_title = 'Couchbase {}: {}'.format(server, msg_title)
msg = 'Couchbase instance {} {}'.format(server, msg)
return {
'timestamp': int(time.time()),
... | [
"Create",
"an",
"event",
"object"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/couchbase/datadog_checks/couchbase/couchbase.py#L371-L387 | [
"def",
"_create_event",
"(",
"self",
",",
"alert_type",
",",
"msg_title",
",",
"msg",
",",
"server",
",",
"tags",
"=",
"None",
")",
":",
"msg_title",
"=",
"'Couchbase {}: {}'",
".",
"format",
"(",
"server",
",",
"msg_title",
")",
"msg",
"=",
"'Couchbase in... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Couchbase._get_stats | Hit a given URL and return the parsed json. | couchbase/datadog_checks/couchbase/couchbase.py | def _get_stats(self, url, instance):
"""
Hit a given URL and return the parsed json.
"""
self.log.debug('Fetching Couchbase stats at url: {}'.format(url))
ssl_verify = instance.get('ssl_verify', True)
timeout = float(instance.get('timeout', DEFAULT_TIMEOUT))
au... | def _get_stats(self, url, instance):
"""
Hit a given URL and return the parsed json.
"""
self.log.debug('Fetching Couchbase stats at url: {}'.format(url))
ssl_verify = instance.get('ssl_verify', True)
timeout = float(instance.get('timeout', DEFAULT_TIMEOUT))
au... | [
"Hit",
"a",
"given",
"URL",
"and",
"return",
"the",
"parsed",
"json",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/couchbase/datadog_checks/couchbase/couchbase.py#L389-L405 | [
"def",
"_get_stats",
"(",
"self",
",",
"url",
",",
"instance",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'Fetching Couchbase stats at url: {}'",
".",
"format",
"(",
"url",
")",
")",
"ssl_verify",
"=",
"instance",
".",
"get",
"(",
"'ssl_verify'",
",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | TUFDownloader.__update_in_toto_layout_pubkeys | NOTE: We assume that all the public keys needed to verify any in-toto
root layout, or sublayout, metadata file has been directly signed by
the top-level TUF targets role using *OFFLINE* keys. This is a
reasonable assumption, as TUF does not offer meaningful security
guarantees if _ALL_ t... | datadog_checks_downloader/datadog_checks/downloader/download.py | def __update_in_toto_layout_pubkeys(self):
'''
NOTE: We assume that all the public keys needed to verify any in-toto
root layout, or sublayout, metadata file has been directly signed by
the top-level TUF targets role using *OFFLINE* keys. This is a
reasonable assumption, as TUF d... | def __update_in_toto_layout_pubkeys(self):
'''
NOTE: We assume that all the public keys needed to verify any in-toto
root layout, or sublayout, metadata file has been directly signed by
the top-level TUF targets role using *OFFLINE* keys. This is a
reasonable assumption, as TUF d... | [
"NOTE",
":",
"We",
"assume",
"that",
"all",
"the",
"public",
"keys",
"needed",
"to",
"verify",
"any",
"in",
"-",
"toto",
"root",
"layout",
"or",
"sublayout",
"metadata",
"file",
"has",
"been",
"directly",
"signed",
"by",
"the",
"top",
"-",
"level",
"TUF"... | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_downloader/datadog_checks/downloader/download.py#L149-L172 | [
"def",
"__update_in_toto_layout_pubkeys",
"(",
"self",
")",
":",
"target_relpaths",
"=",
"[",
"]",
"targets",
"=",
"self",
".",
"__updater",
".",
"targets_of_role",
"(",
"'targets'",
")",
"for",
"target",
"in",
"targets",
":",
"target_relpath",
"=",
"target",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | TUFDownloader.download | Returns:
If download over TUF and in-toto is successful, this function will
return the complete filepath to the desired target. | datadog_checks_downloader/datadog_checks/downloader/download.py | def download(self, target_relpath, download_in_toto_metadata=True):
'''
Returns:
If download over TUF and in-toto is successful, this function will
return the complete filepath to the desired target.
'''
return self.__get_target(target_relpath, download_in_toto_me... | def download(self, target_relpath, download_in_toto_metadata=True):
'''
Returns:
If download over TUF and in-toto is successful, this function will
return the complete filepath to the desired target.
'''
return self.__get_target(target_relpath, download_in_toto_me... | [
"Returns",
":",
"If",
"download",
"over",
"TUF",
"and",
"in",
"-",
"toto",
"is",
"successful",
"this",
"function",
"will",
"return",
"the",
"complete",
"filepath",
"to",
"the",
"desired",
"target",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_downloader/datadog_checks/downloader/download.py#L262-L268 | [
"def",
"download",
"(",
"self",
",",
"target_relpath",
",",
"download_in_toto_metadata",
"=",
"True",
")",
":",
"return",
"self",
".",
"__get_target",
"(",
"target_relpath",
",",
"download_in_toto_metadata",
"=",
"download_in_toto_metadata",
")"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | WMICheck.check | Fetch WMI metrics. | wmi_check/datadog_checks/wmi_check/wmi_check.py | def check(self, instance):
"""
Fetch WMI metrics.
"""
# Connection information
host = instance.get('host', "localhost")
namespace = instance.get('namespace', "root\\cimv2")
provider = instance.get('provider')
username = instance.get('username', "")
... | def check(self, instance):
"""
Fetch WMI metrics.
"""
# Connection information
host = instance.get('host', "localhost")
namespace = instance.get('namespace', "root\\cimv2")
provider = instance.get('provider')
username = instance.get('username', "")
... | [
"Fetch",
"WMI",
"metrics",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/wmi_check/datadog_checks/wmi_check/wmi_check.py#L23-L81 | [
"def",
"check",
"(",
"self",
",",
"instance",
")",
":",
"# Connection information",
"host",
"=",
"instance",
".",
"get",
"(",
"'host'",
",",
"\"localhost\"",
")",
"namespace",
"=",
"instance",
".",
"get",
"(",
"'namespace'",
",",
"\"root\\\\cimv2\"",
")",
"p... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | prune | Remove all configuration for environments. | datadog_checks_dev/datadog_checks/dev/tooling/commands/env/prune.py | def prune(force):
"""Remove all configuration for environments."""
if not force:
echo_warning(
'Removing configuration of environments that may be in use will leave '
'them in a potentially unusable state. If you wish to proceed (e.g. you '
'have just restarted your m... | def prune(force):
"""Remove all configuration for environments."""
if not force:
echo_warning(
'Removing configuration of environments that may be in use will leave '
'them in a potentially unusable state. If you wish to proceed (e.g. you '
'have just restarted your m... | [
"Remove",
"all",
"configuration",
"for",
"environments",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/env/prune.py#L12-L33 | [
"def",
"prune",
"(",
"force",
")",
":",
"if",
"not",
"force",
":",
"echo_warning",
"(",
"'Removing configuration of environments that may be in use will leave '",
"'them in a potentially unusable state. If you wish to proceed (e.g. you '",
"'have just restarted your machine), you may use... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | KubeletCheck._create_kubelet_prometheus_instance | Create a copy of the instance and set default values.
This is so the base class can create a scraper_config with the proper values. | kubelet/datadog_checks/kubelet/kubelet.py | def _create_kubelet_prometheus_instance(self, instance):
"""
Create a copy of the instance and set default values.
This is so the base class can create a scraper_config with the proper values.
"""
kubelet_instance = deepcopy(instance)
kubelet_instance.update(
... | def _create_kubelet_prometheus_instance(self, instance):
"""
Create a copy of the instance and set default values.
This is so the base class can create a scraper_config with the proper values.
"""
kubelet_instance = deepcopy(instance)
kubelet_instance.update(
... | [
"Create",
"a",
"copy",
"of",
"the",
"instance",
"and",
"set",
"default",
"values",
".",
"This",
"is",
"so",
"the",
"base",
"class",
"can",
"create",
"a",
"scraper_config",
"with",
"the",
"proper",
"values",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubelet/datadog_checks/kubelet/kubelet.py#L139-L173 | [
"def",
"_create_kubelet_prometheus_instance",
"(",
"self",
",",
"instance",
")",
":",
"kubelet_instance",
"=",
"deepcopy",
"(",
"instance",
")",
"kubelet_instance",
".",
"update",
"(",
"{",
"'namespace'",
":",
"self",
".",
"NAMESPACE",
",",
"# We need to specify a p... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | KubeletCheck.perform_kubelet_query | Perform and return a GET request against kubelet. Support auth and TLS validation. | kubelet/datadog_checks/kubelet/kubelet.py | def perform_kubelet_query(self, url, verbose=True, timeout=10, stream=False):
"""
Perform and return a GET request against kubelet. Support auth and TLS validation.
"""
return requests.get(
url,
timeout=timeout,
verify=self.kubelet_credentials.verify()... | def perform_kubelet_query(self, url, verbose=True, timeout=10, stream=False):
"""
Perform and return a GET request against kubelet. Support auth and TLS validation.
"""
return requests.get(
url,
timeout=timeout,
verify=self.kubelet_credentials.verify()... | [
"Perform",
"and",
"return",
"a",
"GET",
"request",
"against",
"kubelet",
".",
"Support",
"auth",
"and",
"TLS",
"validation",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubelet/datadog_checks/kubelet/kubelet.py#L239-L251 | [
"def",
"perform_kubelet_query",
"(",
"self",
",",
"url",
",",
"verbose",
"=",
"True",
",",
"timeout",
"=",
"10",
",",
"stream",
"=",
"False",
")",
":",
"return",
"requests",
".",
"get",
"(",
"url",
",",
"timeout",
"=",
"timeout",
",",
"verify",
"=",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | KubeletCheck._compute_pod_expiration_datetime | Looks up the agent's kubernetes_pod_expiration_duration option and returns either:
- None if expiration is disabled (set to 0)
- A (timezone aware) datetime object to compare against | kubelet/datadog_checks/kubelet/kubelet.py | def _compute_pod_expiration_datetime():
"""
Looks up the agent's kubernetes_pod_expiration_duration option and returns either:
- None if expiration is disabled (set to 0)
- A (timezone aware) datetime object to compare against
"""
try:
seconds = int(get_co... | def _compute_pod_expiration_datetime():
"""
Looks up the agent's kubernetes_pod_expiration_duration option and returns either:
- None if expiration is disabled (set to 0)
- A (timezone aware) datetime object to compare against
"""
try:
seconds = int(get_co... | [
"Looks",
"up",
"the",
"agent",
"s",
"kubernetes_pod_expiration_duration",
"option",
"and",
"returns",
"either",
":",
"-",
"None",
"if",
"expiration",
"is",
"disabled",
"(",
"set",
"to",
"0",
")",
"-",
"A",
"(",
"timezone",
"aware",
")",
"datetime",
"object",... | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubelet/datadog_checks/kubelet/kubelet.py#L276-L288 | [
"def",
"_compute_pod_expiration_datetime",
"(",
")",
":",
"try",
":",
"seconds",
"=",
"int",
"(",
"get_config",
"(",
"\"kubernetes_pod_expiration_duration\"",
")",
")",
"if",
"seconds",
"==",
"0",
":",
"# Expiration disabled",
"return",
"None",
"return",
"datetime",... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | KubeletCheck._report_pods_running | Reports the number of running pods on this node and the running
containers in pods, tagged by service and creator.
:param pods: pod list object
:param instance_tags: list of tags | kubelet/datadog_checks/kubelet/kubelet.py | def _report_pods_running(self, pods, instance_tags):
"""
Reports the number of running pods on this node and the running
containers in pods, tagged by service and creator.
:param pods: pod list object
:param instance_tags: list of tags
"""
pods_tag_counter = defa... | def _report_pods_running(self, pods, instance_tags):
"""
Reports the number of running pods on this node and the running
containers in pods, tagged by service and creator.
:param pods: pod list object
:param instance_tags: list of tags
"""
pods_tag_counter = defa... | [
"Reports",
"the",
"number",
"of",
"running",
"pods",
"on",
"this",
"node",
"and",
"the",
"running",
"containers",
"in",
"pods",
"tagged",
"by",
"service",
"and",
"creator",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubelet/datadog_checks/kubelet/kubelet.py#L347-L391 | [
"def",
"_report_pods_running",
"(",
"self",
",",
"pods",
",",
"instance_tags",
")",
":",
"pods_tag_counter",
"=",
"defaultdict",
"(",
"int",
")",
"containers_tag_counter",
"=",
"defaultdict",
"(",
"int",
")",
"for",
"pod",
"in",
"pods",
"[",
"'items'",
"]",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | KubeletCheck._report_container_spec_metrics | Reports pod requests & limits by looking at pod specs. | kubelet/datadog_checks/kubelet/kubelet.py | def _report_container_spec_metrics(self, pod_list, instance_tags):
"""Reports pod requests & limits by looking at pod specs."""
for pod in pod_list['items']:
pod_name = pod.get('metadata', {}).get('name')
pod_phase = pod.get('status', {}).get('phase')
if self._should_... | def _report_container_spec_metrics(self, pod_list, instance_tags):
"""Reports pod requests & limits by looking at pod specs."""
for pod in pod_list['items']:
pod_name = pod.get('metadata', {}).get('name')
pod_phase = pod.get('status', {}).get('phase')
if self._should_... | [
"Reports",
"pod",
"requests",
"&",
"limits",
"by",
"looking",
"at",
"pod",
"specs",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubelet/datadog_checks/kubelet/kubelet.py#L393-L433 | [
"def",
"_report_container_spec_metrics",
"(",
"self",
",",
"pod_list",
",",
"instance_tags",
")",
":",
"for",
"pod",
"in",
"pod_list",
"[",
"'items'",
"]",
":",
"pod_name",
"=",
"pod",
".",
"get",
"(",
"'metadata'",
",",
"{",
"}",
")",
".",
"get",
"(",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | KubeletCheck._report_container_state_metrics | Reports container state & reasons by looking at container statuses | kubelet/datadog_checks/kubelet/kubelet.py | def _report_container_state_metrics(self, pod_list, instance_tags):
"""Reports container state & reasons by looking at container statuses"""
if pod_list.get('expired_count'):
self.gauge(self.NAMESPACE + '.pods.expired', pod_list.get('expired_count'), tags=instance_tags)
for pod in p... | def _report_container_state_metrics(self, pod_list, instance_tags):
"""Reports container state & reasons by looking at container statuses"""
if pod_list.get('expired_count'):
self.gauge(self.NAMESPACE + '.pods.expired', pod_list.get('expired_count'), tags=instance_tags)
for pod in p... | [
"Reports",
"container",
"state",
"&",
"reasons",
"by",
"looking",
"at",
"container",
"statuses"
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubelet/datadog_checks/kubelet/kubelet.py#L435-L466 | [
"def",
"_report_container_state_metrics",
"(",
"self",
",",
"pod_list",
",",
"instance_tags",
")",
":",
"if",
"pod_list",
".",
"get",
"(",
"'expired_count'",
")",
":",
"self",
".",
"gauge",
"(",
"self",
".",
"NAMESPACE",
"+",
"'.pods.expired'",
",",
"pod_list"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | KubeletCheck.parse_quantity | Parse quantity allows to convert the value in the resources spec like:
resources:
requests:
cpu: "100m"
memory": "200Mi"
limits:
memory: "300Mi"
:param string: str
:return: float | kubelet/datadog_checks/kubelet/kubelet.py | def parse_quantity(string):
"""
Parse quantity allows to convert the value in the resources spec like:
resources:
requests:
cpu: "100m"
memory": "200Mi"
limits:
memory: "300Mi"
:param string: str
:return: float
"""
... | def parse_quantity(string):
"""
Parse quantity allows to convert the value in the resources spec like:
resources:
requests:
cpu: "100m"
memory": "200Mi"
limits:
memory: "300Mi"
:param string: str
:return: float
"""
... | [
"Parse",
"quantity",
"allows",
"to",
"convert",
"the",
"value",
"in",
"the",
"resources",
"spec",
"like",
":",
"resources",
":",
"requests",
":",
"cpu",
":",
"100m",
"memory",
":",
"200Mi",
"limits",
":",
"memory",
":",
"300Mi",
":",
"param",
"string",
"... | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubelet/datadog_checks/kubelet/kubelet.py#L484-L502 | [
"def",
"parse_quantity",
"(",
"string",
")",
":",
"number",
",",
"unit",
"=",
"''",
",",
"''",
"for",
"char",
"in",
"string",
":",
"if",
"char",
".",
"isdigit",
"(",
")",
"or",
"char",
"==",
"'.'",
":",
"number",
"+=",
"char",
"else",
":",
"unit",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _raise_connection_failure | Convert a socket.error to ConnectionFailure and raise it. | tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py | def _raise_connection_failure(address, error):
"""Convert a socket.error to ConnectionFailure and raise it."""
host, port = address
# If connecting to a Unix socket, port will be None.
if port is not None:
msg = '%s:%d: %s' % (host, port, error)
else:
msg = '%s: %s' % (host, error)
... | def _raise_connection_failure(address, error):
"""Convert a socket.error to ConnectionFailure and raise it."""
host, port = address
# If connecting to a Unix socket, port will be None.
if port is not None:
msg = '%s:%d: %s' % (host, port, error)
else:
msg = '%s: %s' % (host, error)
... | [
"Convert",
"a",
"socket",
".",
"error",
"to",
"ConnectionFailure",
"and",
"raise",
"it",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py#L250-L269 | [
"def",
"_raise_connection_failure",
"(",
"address",
",",
"error",
")",
":",
"host",
",",
"port",
"=",
"address",
"# If connecting to a Unix socket, port will be None.",
"if",
"port",
"is",
"not",
"None",
":",
"msg",
"=",
"'%s:%d: %s'",
"%",
"(",
"host",
",",
"po... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _create_connection | Given (host, port) and PoolOptions, connect and return a socket object.
Can raise socket.error.
This is a modified version of create_connection from CPython >= 2.6. | tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py | def _create_connection(address, options):
"""Given (host, port) and PoolOptions, connect and return a socket object.
Can raise socket.error.
This is a modified version of create_connection from CPython >= 2.6.
"""
host, port = address
# Check if dealing with a unix domain socket
if host.e... | def _create_connection(address, options):
"""Given (host, port) and PoolOptions, connect and return a socket object.
Can raise socket.error.
This is a modified version of create_connection from CPython >= 2.6.
"""
host, port = address
# Check if dealing with a unix domain socket
if host.e... | [
"Given",
"(",
"host",
"port",
")",
"and",
"PoolOptions",
"connect",
"and",
"return",
"a",
"socket",
"object",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py#L629-L695 | [
"def",
"_create_connection",
"(",
"address",
",",
"options",
")",
":",
"host",
",",
"port",
"=",
"address",
"# Check if dealing with a unix domain socket",
"if",
"host",
".",
"endswith",
"(",
"'.sock'",
")",
":",
"if",
"not",
"hasattr",
"(",
"socket",
",",
"\"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | _configured_socket | Given (host, port) and PoolOptions, return a configured socket.
Can raise socket.error, ConnectionFailure, or CertificateError.
Sets socket's SSL and timeout options. | tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py | def _configured_socket(address, options):
"""Given (host, port) and PoolOptions, return a configured socket.
Can raise socket.error, ConnectionFailure, or CertificateError.
Sets socket's SSL and timeout options.
"""
sock = _create_connection(address, options)
ssl_context = options.ssl_context
... | def _configured_socket(address, options):
"""Given (host, port) and PoolOptions, return a configured socket.
Can raise socket.error, ConnectionFailure, or CertificateError.
Sets socket's SSL and timeout options.
"""
sock = _create_connection(address, options)
ssl_context = options.ssl_context
... | [
"Given",
"(",
"host",
"port",
")",
"and",
"PoolOptions",
"return",
"a",
"configured",
"socket",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py#L698-L728 | [
"def",
"_configured_socket",
"(",
"address",
",",
"options",
")",
":",
"sock",
"=",
"_create_connection",
"(",
"address",
",",
"options",
")",
"ssl_context",
"=",
"options",
".",
"ssl_context",
"if",
"ssl_context",
"is",
"not",
"None",
":",
"host",
"=",
"add... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | SocketInfo.command | Execute a command or raise ConnectionFailure or OperationFailure.
:Parameters:
- `dbname`: name of the database on which to run the command
- `spec`: a command document as a dict, SON, or mapping object
- `slave_ok`: whether to set the SlaveOkay wire protocol bit
- `read... | tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py | def command(self, dbname, spec, slave_ok=False,
read_preference=ReadPreference.PRIMARY,
codec_options=DEFAULT_CODEC_OPTIONS, check=True,
allowable_errors=None, check_keys=False,
read_concern=DEFAULT_READ_CONCERN,
write_concern=None,
... | def command(self, dbname, spec, slave_ok=False,
read_preference=ReadPreference.PRIMARY,
codec_options=DEFAULT_CODEC_OPTIONS, check=True,
allowable_errors=None, check_keys=False,
read_concern=DEFAULT_READ_CONCERN,
write_concern=None,
... | [
"Execute",
"a",
"command",
"or",
"raise",
"ConnectionFailure",
"or",
"OperationFailure",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py#L431-L482 | [
"def",
"command",
"(",
"self",
",",
"dbname",
",",
"spec",
",",
"slave_ok",
"=",
"False",
",",
"read_preference",
"=",
"ReadPreference",
".",
"PRIMARY",
",",
"codec_options",
"=",
"DEFAULT_CODEC_OPTIONS",
",",
"check",
"=",
"True",
",",
"allowable_errors",
"="... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | SocketInfo.send_message | Send a raw BSON message or raise ConnectionFailure.
If a network exception is raised, the socket is closed. | tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py | def send_message(self, message, max_doc_size):
"""Send a raw BSON message or raise ConnectionFailure.
If a network exception is raised, the socket is closed.
"""
if (self.max_bson_size is not None
and max_doc_size > self.max_bson_size):
raise DocumentTooLarge... | def send_message(self, message, max_doc_size):
"""Send a raw BSON message or raise ConnectionFailure.
If a network exception is raised, the socket is closed.
"""
if (self.max_bson_size is not None
and max_doc_size > self.max_bson_size):
raise DocumentTooLarge... | [
"Send",
"a",
"raw",
"BSON",
"message",
"or",
"raise",
"ConnectionFailure",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py#L484-L499 | [
"def",
"send_message",
"(",
"self",
",",
"message",
",",
"max_doc_size",
")",
":",
"if",
"(",
"self",
".",
"max_bson_size",
"is",
"not",
"None",
"and",
"max_doc_size",
">",
"self",
".",
"max_bson_size",
")",
":",
"raise",
"DocumentTooLarge",
"(",
"\"BSON doc... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | SocketInfo.receive_message | Receive a raw BSON message or raise ConnectionFailure.
If any exception is raised, the socket is closed. | tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py | def receive_message(self, operation, request_id):
"""Receive a raw BSON message or raise ConnectionFailure.
If any exception is raised, the socket is closed.
"""
try:
return receive_message(
self.sock, operation, request_id, self.max_message_size)
exc... | def receive_message(self, operation, request_id):
"""Receive a raw BSON message or raise ConnectionFailure.
If any exception is raised, the socket is closed.
"""
try:
return receive_message(
self.sock, operation, request_id, self.max_message_size)
exc... | [
"Receive",
"a",
"raw",
"BSON",
"message",
"or",
"raise",
"ConnectionFailure",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py#L501-L510 | [
"def",
"receive_message",
"(",
"self",
",",
"operation",
",",
"request_id",
")",
":",
"try",
":",
"return",
"receive_message",
"(",
"self",
".",
"sock",
",",
"operation",
",",
"request_id",
",",
"self",
".",
"max_message_size",
")",
"except",
"BaseException",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | SocketInfo.legacy_write | Send OP_INSERT, etc., optionally returning response as a dict.
Can raise ConnectionFailure or OperationFailure.
:Parameters:
- `request_id`: an int.
- `msg`: bytes, an OP_INSERT, OP_UPDATE, or OP_DELETE message,
perhaps with a getlasterror command appended.
- ... | tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py | def legacy_write(self, request_id, msg, max_doc_size, with_last_error):
"""Send OP_INSERT, etc., optionally returning response as a dict.
Can raise ConnectionFailure or OperationFailure.
:Parameters:
- `request_id`: an int.
- `msg`: bytes, an OP_INSERT, OP_UPDATE, or OP_DEL... | def legacy_write(self, request_id, msg, max_doc_size, with_last_error):
"""Send OP_INSERT, etc., optionally returning response as a dict.
Can raise ConnectionFailure or OperationFailure.
:Parameters:
- `request_id`: an int.
- `msg`: bytes, an OP_INSERT, OP_UPDATE, or OP_DEL... | [
"Send",
"OP_INSERT",
"etc",
".",
"optionally",
"returning",
"response",
"as",
"a",
"dict",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py#L512-L531 | [
"def",
"legacy_write",
"(",
"self",
",",
"request_id",
",",
"msg",
",",
"max_doc_size",
",",
"with_last_error",
")",
":",
"if",
"not",
"with_last_error",
"and",
"not",
"self",
".",
"is_writable",
":",
"# Write won't succeed, bail as if we'd done a getlasterror.",
"rai... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | SocketInfo.write_command | Send "insert" etc. command, returning response as a dict.
Can raise ConnectionFailure or OperationFailure.
:Parameters:
- `request_id`: an int.
- `msg`: bytes, the command message. | tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py | def write_command(self, request_id, msg):
"""Send "insert" etc. command, returning response as a dict.
Can raise ConnectionFailure or OperationFailure.
:Parameters:
- `request_id`: an int.
- `msg`: bytes, the command message.
"""
self.send_message(msg, 0)
... | def write_command(self, request_id, msg):
"""Send "insert" etc. command, returning response as a dict.
Can raise ConnectionFailure or OperationFailure.
:Parameters:
- `request_id`: an int.
- `msg`: bytes, the command message.
"""
self.send_message(msg, 0)
... | [
"Send",
"insert",
"etc",
".",
"command",
"returning",
"response",
"as",
"a",
"dict",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py#L533-L549 | [
"def",
"write_command",
"(",
"self",
",",
"request_id",
",",
"msg",
")",
":",
"self",
".",
"send_message",
"(",
"msg",
",",
"0",
")",
"response",
"=",
"helpers",
".",
"_unpack_response",
"(",
"self",
".",
"receive_message",
"(",
"1",
",",
"request_id",
"... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | SocketInfo.check_auth | Update this socket's authentication.
Log in or out to bring this socket's credentials up to date with
those provided. Can raise ConnectionFailure or OperationFailure.
:Parameters:
- `all_credentials`: dict, maps auth source to MongoCredential. | tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py | def check_auth(self, all_credentials):
"""Update this socket's authentication.
Log in or out to bring this socket's credentials up to date with
those provided. Can raise ConnectionFailure or OperationFailure.
:Parameters:
- `all_credentials`: dict, maps auth source to MongoCr... | def check_auth(self, all_credentials):
"""Update this socket's authentication.
Log in or out to bring this socket's credentials up to date with
those provided. Can raise ConnectionFailure or OperationFailure.
:Parameters:
- `all_credentials`: dict, maps auth source to MongoCr... | [
"Update",
"this",
"socket",
"s",
"authentication",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py#L551-L571 | [
"def",
"check_auth",
"(",
"self",
",",
"all_credentials",
")",
":",
"if",
"all_credentials",
"or",
"self",
".",
"authset",
":",
"cached",
"=",
"set",
"(",
"itervalues",
"(",
"all_credentials",
")",
")",
"authset",
"=",
"self",
".",
"authset",
".",
"copy",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | SocketInfo.authenticate | Log in to the server and store these credentials in `authset`.
Can raise ConnectionFailure or OperationFailure.
:Parameters:
- `credentials`: A MongoCredential. | tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py | def authenticate(self, credentials):
"""Log in to the server and store these credentials in `authset`.
Can raise ConnectionFailure or OperationFailure.
:Parameters:
- `credentials`: A MongoCredential.
"""
auth.authenticate(credentials, self)
self.authset.add(c... | def authenticate(self, credentials):
"""Log in to the server and store these credentials in `authset`.
Can raise ConnectionFailure or OperationFailure.
:Parameters:
- `credentials`: A MongoCredential.
"""
auth.authenticate(credentials, self)
self.authset.add(c... | [
"Log",
"in",
"to",
"the",
"server",
"and",
"store",
"these",
"credentials",
"in",
"authset",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py#L573-L582 | [
"def",
"authenticate",
"(",
"self",
",",
"credentials",
")",
":",
"auth",
".",
"authenticate",
"(",
"credentials",
",",
"self",
")",
"self",
".",
"authset",
".",
"add",
"(",
"credentials",
")"
] | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Pool.connect | Connect to Mongo and return a new SocketInfo.
Can raise ConnectionFailure or CertificateError.
Note that the pool does not keep a reference to the socket -- you
must call return_socket() when you're done with it. | tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py | def connect(self):
"""Connect to Mongo and return a new SocketInfo.
Can raise ConnectionFailure or CertificateError.
Note that the pool does not keep a reference to the socket -- you
must call return_socket() when you're done with it.
"""
sock = None
try:
... | def connect(self):
"""Connect to Mongo and return a new SocketInfo.
Can raise ConnectionFailure or CertificateError.
Note that the pool does not keep a reference to the socket -- you
must call return_socket() when you're done with it.
"""
sock = None
try:
... | [
"Connect",
"to",
"Mongo",
"and",
"return",
"a",
"new",
"SocketInfo",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py#L793-L823 | [
"def",
"connect",
"(",
"self",
")",
":",
"sock",
"=",
"None",
"try",
":",
"sock",
"=",
"_configured_socket",
"(",
"self",
".",
"address",
",",
"self",
".",
"opts",
")",
"if",
"self",
".",
"handshake",
":",
"cmd",
"=",
"SON",
"(",
"[",
"(",
"'ismast... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Pool.get_socket | Get a socket from the pool. Use with a "with" statement.
Returns a :class:`SocketInfo` object wrapping a connected
:class:`socket.socket`.
This method should always be used in a with-statement::
with pool.get_socket(credentials, checkout) as socket_info:
socket_inf... | tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py | def get_socket(self, all_credentials, checkout=False):
"""Get a socket from the pool. Use with a "with" statement.
Returns a :class:`SocketInfo` object wrapping a connected
:class:`socket.socket`.
This method should always be used in a with-statement::
with pool.get_socket... | def get_socket(self, all_credentials, checkout=False):
"""Get a socket from the pool. Use with a "with" statement.
Returns a :class:`SocketInfo` object wrapping a connected
:class:`socket.socket`.
This method should always be used in a with-statement::
with pool.get_socket... | [
"Get",
"a",
"socket",
"from",
"the",
"pool",
".",
"Use",
"with",
"a",
"with",
"statement",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py#L826-L860 | [
"def",
"get_socket",
"(",
"self",
",",
"all_credentials",
",",
"checkout",
"=",
"False",
")",
":",
"# First get a socket, then attempt authentication. Simplifies",
"# semaphore management in the face of network errors during auth.",
"sock_info",
"=",
"self",
".",
"_get_socket_no_... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Pool._get_socket_no_auth | Get or create a SocketInfo. Can raise ConnectionFailure. | tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py | def _get_socket_no_auth(self):
"""Get or create a SocketInfo. Can raise ConnectionFailure."""
# We use the pid here to avoid issues with fork / multiprocessing.
# See test.test_client:TestClient.test_fork for an example of
# what could go wrong otherwise
if self.pid != os.getpid(... | def _get_socket_no_auth(self):
"""Get or create a SocketInfo. Can raise ConnectionFailure."""
# We use the pid here to avoid issues with fork / multiprocessing.
# See test.test_client:TestClient.test_fork for an example of
# what could go wrong otherwise
if self.pid != os.getpid(... | [
"Get",
"or",
"create",
"a",
"SocketInfo",
".",
"Can",
"raise",
"ConnectionFailure",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py#L862-L897 | [
"def",
"_get_socket_no_auth",
"(",
"self",
")",
":",
"# We use the pid here to avoid issues with fork / multiprocessing.",
"# See test.test_client:TestClient.test_fork for an example of",
"# what could go wrong otherwise",
"if",
"self",
".",
"pid",
"!=",
"os",
".",
"getpid",
"(",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Pool.return_socket | Return the socket to the pool, or if it's closed discard it. | tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py | def return_socket(self, sock_info):
"""Return the socket to the pool, or if it's closed discard it."""
if self.pid != os.getpid():
self.reset()
else:
if sock_info.pool_id != self.pool_id:
sock_info.close()
elif not sock_info.closed:
... | def return_socket(self, sock_info):
"""Return the socket to the pool, or if it's closed discard it."""
if self.pid != os.getpid():
self.reset()
else:
if sock_info.pool_id != self.pool_id:
sock_info.close()
elif not sock_info.closed:
... | [
"Return",
"the",
"socket",
"to",
"the",
"pool",
"or",
"if",
"it",
"s",
"closed",
"discard",
"it",
"."
] | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py#L899-L913 | [
"def",
"return_socket",
"(",
"self",
",",
"sock_info",
")",
":",
"if",
"self",
".",
"pid",
"!=",
"os",
".",
"getpid",
"(",
")",
":",
"self",
".",
"reset",
"(",
")",
"else",
":",
"if",
"sock_info",
".",
"pool_id",
"!=",
"self",
".",
"pool_id",
":",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
train | Pool._check | This side-effecty function checks if this socket has been idle for
for longer than the max idle time, or if the socket has been closed by
some external network error, and if so, attempts to create a new
socket. If this connection attempt fails we raise the
ConnectionFailure.
Che... | tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py | def _check(self, sock_info):
"""This side-effecty function checks if this socket has been idle for
for longer than the max idle time, or if the socket has been closed by
some external network error, and if so, attempts to create a new
socket. If this connection attempt fails we raise the... | def _check(self, sock_info):
"""This side-effecty function checks if this socket has been idle for
for longer than the max idle time, or if the socket has been closed by
some external network error, and if so, attempts to create a new
socket. If this connection attempt fails we raise the... | [
"This",
"side",
"-",
"effecty",
"function",
"checks",
"if",
"this",
"socket",
"has",
"been",
"idle",
"for",
"for",
"longer",
"than",
"the",
"max",
"idle",
"time",
"or",
"if",
"the",
"socket",
"has",
"been",
"closed",
"by",
"some",
"external",
"network",
... | DataDog/integrations-core | python | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py#L915-L944 | [
"def",
"_check",
"(",
"self",
",",
"sock_info",
")",
":",
"# How long since socket was last checked in.",
"idle_time_seconds",
"=",
"_time",
"(",
")",
"-",
"sock_info",
".",
"last_checkin",
"# If socket is idle, open a new one.",
"if",
"(",
"self",
".",
"opts",
".",
... | ebd41c873cf9f97a8c51bf9459bc6a7536af8acd |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.