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 | _ElbService.find_usage | Determine the current usage for each limit of this service,
and update corresponding Limit via
:py:meth:`~.AwsLimit._add_current_usage`. | awslimitchecker/services/elb.py | def find_usage(self):
"""
Determine the current usage for each limit of this service,
and update corresponding Limit via
:py:meth:`~.AwsLimit._add_current_usage`.
"""
logger.debug("Checking usage for service %s", self.service_name)
for lim in self.limits.values():... | def find_usage(self):
"""
Determine the current usage for each limit of this service,
and update corresponding Limit via
:py:meth:`~.AwsLimit._add_current_usage`.
"""
logger.debug("Checking usage for service %s", self.service_name)
for lim in self.limits.values():... | [
"Determine",
"the",
"current",
"usage",
"for",
"each",
"limit",
"of",
"this",
"service",
"and",
"update",
"corresponding",
"Limit",
"via",
":",
"py",
":",
"meth",
":",
"~",
".",
"AwsLimit",
".",
"_add_current_usage",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/elb.py#L65-L82 | [
"def",
"find_usage",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Checking usage for service %s\"",
",",
"self",
".",
"service_name",
")",
"for",
"lim",
"in",
"self",
".",
"limits",
".",
"values",
"(",
")",
":",
"lim",
".",
"_reset_usage",
"(",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _ElbService._find_usage_elbv1 | Find usage for ELBv1 / Classic ELB and update the appropriate limits.
:returns: number of Classic ELBs in use
:rtype: int | awslimitchecker/services/elb.py | def _find_usage_elbv1(self):
"""
Find usage for ELBv1 / Classic ELB and update the appropriate limits.
:returns: number of Classic ELBs in use
:rtype: int
"""
logger.debug("Checking usage for ELBv1")
self.connect()
lbs = paginate_dict(
self.co... | def _find_usage_elbv1(self):
"""
Find usage for ELBv1 / Classic ELB and update the appropriate limits.
:returns: number of Classic ELBs in use
:rtype: int
"""
logger.debug("Checking usage for ELBv1")
self.connect()
lbs = paginate_dict(
self.co... | [
"Find",
"usage",
"for",
"ELBv1",
"/",
"Classic",
"ELB",
"and",
"update",
"the",
"appropriate",
"limits",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/elb.py#L84-L113 | [
"def",
"_find_usage_elbv1",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Checking usage for ELBv1\"",
")",
"self",
".",
"connect",
"(",
")",
"lbs",
"=",
"paginate_dict",
"(",
"self",
".",
"conn",
".",
"describe_load_balancers",
",",
"alc_marker_path",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _ElbService._find_usage_elbv2 | Find usage for ELBv2 / Application LB and update the appropriate limits.
:returns: number of Application LBs in use
:rtype: int | awslimitchecker/services/elb.py | def _find_usage_elbv2(self):
"""
Find usage for ELBv2 / Application LB and update the appropriate limits.
:returns: number of Application LBs in use
:rtype: int
"""
logger.debug('Checking usage for ELBv2')
conn2 = client(
'elbv2',
config=C... | def _find_usage_elbv2(self):
"""
Find usage for ELBv2 / Application LB and update the appropriate limits.
:returns: number of Application LBs in use
:rtype: int
"""
logger.debug('Checking usage for ELBv2')
conn2 = client(
'elbv2',
config=C... | [
"Find",
"usage",
"for",
"ELBv2",
"/",
"Application",
"LB",
"and",
"update",
"the",
"appropriate",
"limits",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/elb.py#L115-L169 | [
"def",
"_find_usage_elbv2",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"'Checking usage for ELBv2'",
")",
"conn2",
"=",
"client",
"(",
"'elbv2'",
",",
"config",
"=",
"Config",
"(",
"retries",
"=",
"{",
"'max_attempts'",
":",
"ELBV2_MAX_RETRY_ATTEMPTS",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _ElbService._update_usage_for_alb | Update usage for a single ALB.
:param conn: elbv2 API connection
:type conn: :py:class:`ElasticLoadBalancing.Client`
:param alb_arn: Load Balancer ARN
:type alb_arn: str
:param alb_name: Load Balancer Name
:type alb_name: str | awslimitchecker/services/elb.py | def _update_usage_for_alb(self, conn, alb_arn, alb_name):
"""
Update usage for a single ALB.
:param conn: elbv2 API connection
:type conn: :py:class:`ElasticLoadBalancing.Client`
:param alb_arn: Load Balancer ARN
:type alb_arn: str
:param alb_name: Load Balancer ... | def _update_usage_for_alb(self, conn, alb_arn, alb_name):
"""
Update usage for a single ALB.
:param conn: elbv2 API connection
:type conn: :py:class:`ElasticLoadBalancing.Client`
:param alb_arn: Load Balancer ARN
:type alb_arn: str
:param alb_name: Load Balancer ... | [
"Update",
"usage",
"for",
"a",
"single",
"ALB",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/elb.py#L171-L223 | [
"def",
"_update_usage_for_alb",
"(",
"self",
",",
"conn",
",",
"alb_arn",
",",
"alb_name",
")",
":",
"logger",
".",
"debug",
"(",
"'Updating usage for ALB %s'",
",",
"alb_arn",
")",
"listeners",
"=",
"paginate_dict",
"(",
"conn",
".",
"describe_listeners",
",",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _ElbService._update_usage_for_nlb | Update usage for a single NLB.
:param conn: elbv2 API connection
:type conn: :py:class:`ElasticLoadBalancing.Client`
:param nlb_arn: Load Balancer ARN
:type nlb_arn: str
:param nlb_name: Load Balancer Name
:type nlb_name: str | awslimitchecker/services/elb.py | def _update_usage_for_nlb(self, conn, nlb_arn, nlb_name):
"""
Update usage for a single NLB.
:param conn: elbv2 API connection
:type conn: :py:class:`ElasticLoadBalancing.Client`
:param nlb_arn: Load Balancer ARN
:type nlb_arn: str
:param nlb_name: Load Balancer ... | def _update_usage_for_nlb(self, conn, nlb_arn, nlb_name):
"""
Update usage for a single NLB.
:param conn: elbv2 API connection
:type conn: :py:class:`ElasticLoadBalancing.Client`
:param nlb_arn: Load Balancer ARN
:type nlb_arn: str
:param nlb_name: Load Balancer ... | [
"Update",
"usage",
"for",
"a",
"single",
"NLB",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/elb.py#L225-L249 | [
"def",
"_update_usage_for_nlb",
"(",
"self",
",",
"conn",
",",
"nlb_arn",
",",
"nlb_name",
")",
":",
"logger",
".",
"debug",
"(",
"'Updating usage for NLB %s'",
",",
"nlb_arn",
")",
"listeners",
"=",
"paginate_dict",
"(",
"conn",
".",
"describe_listeners",
",",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _ElbService._update_limits_from_api | Query ELB's DescribeAccountLimits API action, and update limits
with the quotas returned. Updates ``self.limits``. | awslimitchecker/services/elb.py | def _update_limits_from_api(self):
"""
Query ELB's DescribeAccountLimits API action, and update limits
with the quotas returned. Updates ``self.limits``.
"""
self.connect()
logger.debug("Querying ELB DescribeAccountLimits for limits")
attribs = self.conn.describe_... | def _update_limits_from_api(self):
"""
Query ELB's DescribeAccountLimits API action, and update limits
with the quotas returned. Updates ``self.limits``.
"""
self.connect()
logger.debug("Querying ELB DescribeAccountLimits for limits")
attribs = self.conn.describe_... | [
"Query",
"ELB",
"s",
"DescribeAccountLimits",
"API",
"action",
"and",
"update",
"limits",
"with",
"the",
"quotas",
"returned",
".",
"Updates",
"self",
".",
"limits",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/elb.py#L346-L390 | [
"def",
"_update_limits_from_api",
"(",
"self",
")",
":",
"self",
".",
"connect",
"(",
")",
"logger",
".",
"debug",
"(",
"\"Querying ELB DescribeAccountLimits for limits\"",
")",
"attribs",
"=",
"self",
".",
"conn",
".",
"describe_account_limits",
"(",
")",
"name_t... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | dict2cols | Take a dict of string keys and string values, and return a string with
them formatted as two columns separated by at least ``spaces`` number of
``separator`` characters.
:param d: dict of string keys, string values
:type d: dict
:param spaces: number of spaces to separate columns by
:type space... | awslimitchecker/utils.py | def dict2cols(d, spaces=2, separator=' '):
"""
Take a dict of string keys and string values, and return a string with
them formatted as two columns separated by at least ``spaces`` number of
``separator`` characters.
:param d: dict of string keys, string values
:type d: dict
:param spaces: ... | def dict2cols(d, spaces=2, separator=' '):
"""
Take a dict of string keys and string values, and return a string with
them formatted as two columns separated by at least ``spaces`` number of
``separator`` characters.
:param d: dict of string keys, string values
:type d: dict
:param spaces: ... | [
"Take",
"a",
"dict",
"of",
"string",
"keys",
"and",
"string",
"values",
"and",
"return",
"a",
"string",
"with",
"them",
"formatted",
"as",
"two",
"columns",
"separated",
"by",
"at",
"least",
"spaces",
"number",
"of",
"separator",
"characters",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/utils.py#L75-L98 | [
"def",
"dict2cols",
"(",
"d",
",",
"spaces",
"=",
"2",
",",
"separator",
"=",
"' '",
")",
":",
"if",
"len",
"(",
"d",
")",
"==",
"0",
":",
"return",
"''",
"s",
"=",
"''",
"maxlen",
"=",
"max",
"(",
"[",
"len",
"(",
"k",
")",
"for",
"k",
"in... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | paginate_dict | Paginate through a query that returns a dict result, and return the
combined result.
Note that this function requires some special kwargs to be passed in:
* __alc_marker_path__ - The dictionary path to the Marker for the next
result set. If this path does not exist, the raw result will be returned.
... | awslimitchecker/utils.py | def paginate_dict(function_ref, *argv, **kwargs):
"""
Paginate through a query that returns a dict result, and return the
combined result.
Note that this function requires some special kwargs to be passed in:
* __alc_marker_path__ - The dictionary path to the Marker for the next
result set. ... | def paginate_dict(function_ref, *argv, **kwargs):
"""
Paginate through a query that returns a dict result, and return the
combined result.
Note that this function requires some special kwargs to be passed in:
* __alc_marker_path__ - The dictionary path to the Marker for the next
result set. ... | [
"Paginate",
"through",
"a",
"query",
"that",
"returns",
"a",
"dict",
"result",
"and",
"return",
"the",
"combined",
"result",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/utils.py#L101-L167 | [
"def",
"paginate_dict",
"(",
"function_ref",
",",
"*",
"argv",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'alc_marker_path'",
"not",
"in",
"kwargs",
":",
"raise",
"Exception",
"(",
"\"alc_marker_path must be specified for queries \"",
"\"that return a dict.\"",
")",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _get_dict_value_by_path | Given a dict (``d``) and a list specifying the hierarchical path to a key
in that dict (``path``), return the value at that path or None if it does
not exist.
:param d: the dict to search in
:type d: dict
:param path: the path to the key in the dict
:type path: list | awslimitchecker/utils.py | def _get_dict_value_by_path(d, path):
"""
Given a dict (``d``) and a list specifying the hierarchical path to a key
in that dict (``path``), return the value at that path or None if it does
not exist.
:param d: the dict to search in
:type d: dict
:param path: the path to the key in the dict... | def _get_dict_value_by_path(d, path):
"""
Given a dict (``d``) and a list specifying the hierarchical path to a key
in that dict (``path``), return the value at that path or None if it does
not exist.
:param d: the dict to search in
:type d: dict
:param path: the path to the key in the dict... | [
"Given",
"a",
"dict",
"(",
"d",
")",
"and",
"a",
"list",
"specifying",
"the",
"hierarchical",
"path",
"to",
"a",
"key",
"in",
"that",
"dict",
"(",
"path",
")",
"return",
"the",
"value",
"at",
"that",
"path",
"or",
"None",
"if",
"it",
"does",
"not",
... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/utils.py#L170-L188 | [
"def",
"_get_dict_value_by_path",
"(",
"d",
",",
"path",
")",
":",
"tmp_path",
"=",
"deepcopy",
"(",
"path",
")",
"try",
":",
"while",
"len",
"(",
"tmp_path",
")",
">",
"0",
":",
"k",
"=",
"tmp_path",
".",
"pop",
"(",
"0",
")",
"d",
"=",
"d",
"["... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _set_dict_value_by_path | Given a dict (``d``), a value (``val``), and a list specifying the
hierarchical path to a key in that dict (``path``), set the value in ``d``
at ``path`` to ``val``.
:param d: the dict to search in
:type d: dict
:param path: the path to the key in the dict
:type path: list
:raises: TypeErr... | awslimitchecker/utils.py | def _set_dict_value_by_path(d, val, path):
"""
Given a dict (``d``), a value (``val``), and a list specifying the
hierarchical path to a key in that dict (``path``), set the value in ``d``
at ``path`` to ``val``.
:param d: the dict to search in
:type d: dict
:param path: the path to the ke... | def _set_dict_value_by_path(d, val, path):
"""
Given a dict (``d``), a value (``val``), and a list specifying the
hierarchical path to a key in that dict (``path``), set the value in ``d``
at ``path`` to ``val``.
:param d: the dict to search in
:type d: dict
:param path: the path to the ke... | [
"Given",
"a",
"dict",
"(",
"d",
")",
"a",
"value",
"(",
"val",
")",
"and",
"a",
"list",
"specifying",
"the",
"hierarchical",
"path",
"to",
"a",
"key",
"in",
"that",
"dict",
"(",
"path",
")",
"set",
"the",
"value",
"in",
"d",
"at",
"path",
"to",
"... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/utils.py#L191-L213 | [
"def",
"_set_dict_value_by_path",
"(",
"d",
",",
"val",
",",
"path",
")",
":",
"tmp_path",
"=",
"deepcopy",
"(",
"path",
")",
"tmp_d",
"=",
"deepcopy",
"(",
"d",
")",
"result",
"=",
"tmp_d",
"while",
"len",
"(",
"tmp_path",
")",
">",
"0",
":",
"if",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | AwsLimitChecker._boto_conn_kwargs | Generate keyword arguments for boto3 connection functions.
If ``self.account_id`` is defined, this will call
:py:meth:`~._get_sts_token` to get STS token credentials using
`boto3.STS.Client.assume_role <https://boto3.readthedocs.org/en/
latest/reference/services/sts.html#STS.Client.assu... | awslimitchecker/checker.py | def _boto_conn_kwargs(self):
"""
Generate keyword arguments for boto3 connection functions.
If ``self.account_id`` is defined, this will call
:py:meth:`~._get_sts_token` to get STS token credentials using
`boto3.STS.Client.assume_role <https://boto3.readthedocs.org/en/
l... | def _boto_conn_kwargs(self):
"""
Generate keyword arguments for boto3 connection functions.
If ``self.account_id`` is defined, this will call
:py:meth:`~._get_sts_token` to get STS token credentials using
`boto3.STS.Client.assume_role <https://boto3.readthedocs.org/en/
l... | [
"Generate",
"keyword",
"arguments",
"for",
"boto3",
"connection",
"functions",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/checker.py#L178-L214 | [
"def",
"_boto_conn_kwargs",
"(",
"self",
")",
":",
"kwargs",
"=",
"{",
"'region_name'",
":",
"self",
".",
"region",
"}",
"if",
"self",
".",
"account_id",
"is",
"not",
"None",
":",
"logger",
".",
"debug",
"(",
"\"Connecting for account %s role '%s' with STS \"",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | AwsLimitChecker.remove_services | Remove all service names specified in ``services_to_remove`` from
``self.services``. This allows explicitly removing certain services from
ever being checked or otherwise handled.
By default, the various methods that work on Services (i.e.
:py:meth:`~.get_limits`, :py:meth:`~.find_usage... | awslimitchecker/checker.py | def remove_services(self, services_to_remove=[]):
"""
Remove all service names specified in ``services_to_remove`` from
``self.services``. This allows explicitly removing certain services from
ever being checked or otherwise handled.
By default, the various methods that work on ... | def remove_services(self, services_to_remove=[]):
"""
Remove all service names specified in ``services_to_remove`` from
``self.services``. This allows explicitly removing certain services from
ever being checked or otherwise handled.
By default, the various methods that work on ... | [
"Remove",
"all",
"service",
"names",
"specified",
"in",
"services_to_remove",
"from",
"self",
".",
"services",
".",
"This",
"allows",
"explicitly",
"removing",
"certain",
"services",
"from",
"ever",
"being",
"checked",
"or",
"otherwise",
"handled",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/checker.py#L234-L253 | [
"def",
"remove_services",
"(",
"self",
",",
"services_to_remove",
"=",
"[",
"]",
")",
":",
"for",
"sname",
"in",
"services_to_remove",
":",
"logger",
".",
"warning",
"(",
"'Skipping service: %s'",
",",
"sname",
")",
"self",
".",
"services",
".",
"pop",
"(",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | AwsLimitChecker._get_sts_token | Assume a role via STS and return the credentials.
First connect to STS via :py:func:`boto3.client`, then
assume a role using `boto3.STS.Client.assume_role <https://boto3.readthe
docs.org/en/latest/reference/services/sts.html#STS.Client.assume_role>`_
using ``self.account_id`` and ``self... | awslimitchecker/checker.py | def _get_sts_token(self):
"""
Assume a role via STS and return the credentials.
First connect to STS via :py:func:`boto3.client`, then
assume a role using `boto3.STS.Client.assume_role <https://boto3.readthe
docs.org/en/latest/reference/services/sts.html#STS.Client.assume_role>`... | def _get_sts_token(self):
"""
Assume a role via STS and return the credentials.
First connect to STS via :py:func:`boto3.client`, then
assume a role using `boto3.STS.Client.assume_role <https://boto3.readthe
docs.org/en/latest/reference/services/sts.html#STS.Client.assume_role>`... | [
"Assume",
"a",
"role",
"via",
"STS",
"and",
"return",
"the",
"credentials",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/checker.py#L292-L328 | [
"def",
"_get_sts_token",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Connecting to STS in region %s\"",
",",
"self",
".",
"region",
")",
"sts",
"=",
"boto3",
".",
"client",
"(",
"'sts'",
",",
"region_name",
"=",
"self",
".",
"region",
")",
"arn"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | AwsLimitChecker.find_usage | For each limit in the specified service (or all services if
``service`` is ``None``), query the AWS API via ``boto3``
and find the current usage amounts for that limit.
This method updates the ``current_usage`` attribute of the
:py:class:`~.AwsLimit` objects for each service, which can
... | awslimitchecker/checker.py | def find_usage(self, service=None, use_ta=True):
"""
For each limit in the specified service (or all services if
``service`` is ``None``), query the AWS API via ``boto3``
and find the current usage amounts for that limit.
This method updates the ``current_usage`` attribute of th... | def find_usage(self, service=None, use_ta=True):
"""
For each limit in the specified service (or all services if
``service`` is ``None``), query the AWS API via ``boto3``
and find the current usage amounts for that limit.
This method updates the ``current_usage`` attribute of th... | [
"For",
"each",
"limit",
"in",
"the",
"specified",
"service",
"(",
"or",
"all",
"services",
"if",
"service",
"is",
"None",
")",
"query",
"the",
"AWS",
"API",
"via",
"boto3",
"and",
"find",
"the",
"current",
"usage",
"amounts",
"for",
"that",
"limit",
"."
... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/checker.py#L330-L355 | [
"def",
"find_usage",
"(",
"self",
",",
"service",
"=",
"None",
",",
"use_ta",
"=",
"True",
")",
":",
"to_get",
"=",
"self",
".",
"services",
"if",
"service",
"is",
"not",
"None",
":",
"to_get",
"=",
"dict",
"(",
"(",
"each",
",",
"self",
".",
"serv... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | AwsLimitChecker.set_limit_overrides | Set manual overrides on AWS service limits, i.e. if you
had limits increased by AWS support. This takes a dict in
the same form as that returned by :py:meth:`~.get_limits`,
i.e. service_name (str) keys to nested dict of limit_name
(str) to limit value (int) like:
::
... | awslimitchecker/checker.py | def set_limit_overrides(self, override_dict, override_ta=True):
"""
Set manual overrides on AWS service limits, i.e. if you
had limits increased by AWS support. This takes a dict in
the same form as that returned by :py:meth:`~.get_limits`,
i.e. service_name (str) keys to nested ... | def set_limit_overrides(self, override_dict, override_ta=True):
"""
Set manual overrides on AWS service limits, i.e. if you
had limits increased by AWS support. This takes a dict in
the same form as that returned by :py:meth:`~.get_limits`,
i.e. service_name (str) keys to nested ... | [
"Set",
"manual",
"overrides",
"on",
"AWS",
"service",
"limits",
"i",
".",
"e",
".",
"if",
"you",
"had",
"limits",
"increased",
"by",
"AWS",
"support",
".",
"This",
"takes",
"a",
"dict",
"in",
"the",
"same",
"form",
"as",
"that",
"returned",
"by",
":",
... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/checker.py#L357-L397 | [
"def",
"set_limit_overrides",
"(",
"self",
",",
"override_dict",
",",
"override_ta",
"=",
"True",
")",
":",
"for",
"svc_name",
"in",
"override_dict",
":",
"for",
"lim_name",
"in",
"override_dict",
"[",
"svc_name",
"]",
":",
"self",
".",
"services",
"[",
"svc... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | AwsLimitChecker.set_limit_override | Set a manual override on an AWS service limits, i.e. if you
had limits increased by AWS support.
This method calls :py:meth:`._AwsService.set_limit_override`
on the corresponding _AwsService instance.
Explicitly set limit overrides using this method will take
precedence over de... | awslimitchecker/checker.py | def set_limit_override(self, service_name, limit_name,
value, override_ta=True):
"""
Set a manual override on an AWS service limits, i.e. if you
had limits increased by AWS support.
This method calls :py:meth:`._AwsService.set_limit_override`
on the co... | def set_limit_override(self, service_name, limit_name,
value, override_ta=True):
"""
Set a manual override on an AWS service limits, i.e. if you
had limits increased by AWS support.
This method calls :py:meth:`._AwsService.set_limit_override`
on the co... | [
"Set",
"a",
"manual",
"override",
"on",
"an",
"AWS",
"service",
"limits",
"i",
".",
"e",
".",
"if",
"you",
"had",
"limits",
"increased",
"by",
"AWS",
"support",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/checker.py#L399-L429 | [
"def",
"set_limit_override",
"(",
"self",
",",
"service_name",
",",
"limit_name",
",",
"value",
",",
"override_ta",
"=",
"True",
")",
":",
"self",
".",
"services",
"[",
"service_name",
"]",
".",
"set_limit_override",
"(",
"limit_name",
",",
"value",
",",
"ov... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | AwsLimitChecker.set_threshold_overrides | Set manual overrides on the threshold (used for determining
warning/critical status) a dict of limits. See
:py:class:`~.AwsLimitChecker` for information on Warning and
Critical thresholds.
Dict is composed of service name keys (string) to dict of
limit names (string), to dict of... | awslimitchecker/checker.py | def set_threshold_overrides(self, override_dict):
"""
Set manual overrides on the threshold (used for determining
warning/critical status) a dict of limits. See
:py:class:`~.AwsLimitChecker` for information on Warning and
Critical thresholds.
Dict is composed of service ... | def set_threshold_overrides(self, override_dict):
"""
Set manual overrides on the threshold (used for determining
warning/critical status) a dict of limits. See
:py:class:`~.AwsLimitChecker` for information on Warning and
Critical thresholds.
Dict is composed of service ... | [
"Set",
"manual",
"overrides",
"on",
"the",
"threshold",
"(",
"used",
"for",
"determining",
"warning",
"/",
"critical",
"status",
")",
"a",
"dict",
"of",
"limits",
".",
"See",
":",
"py",
":",
"class",
":",
"~",
".",
"AwsLimitChecker",
"for",
"information",
... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/checker.py#L431-L484 | [
"def",
"set_threshold_overrides",
"(",
"self",
",",
"override_dict",
")",
":",
"for",
"svc_name",
"in",
"sorted",
"(",
"override_dict",
")",
":",
"for",
"lim_name",
"in",
"sorted",
"(",
"override_dict",
"[",
"svc_name",
"]",
")",
":",
"d",
"=",
"override_dic... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | AwsLimitChecker.set_threshold_override | Set a manual override on the threshold (used for determining
warning/critical status) for a specific limit. See
:py:class:`~.AwsLimitChecker` for information on Warning and
Critical thresholds.
See :py:meth:`.AwsLimit.set_threshold_override`.
:param service_name: the name of th... | awslimitchecker/checker.py | def set_threshold_override(self, service_name, limit_name,
warn_percent=None, warn_count=None,
crit_percent=None, crit_count=None):
"""
Set a manual override on the threshold (used for determining
warning/critical status) for a specif... | def set_threshold_override(self, service_name, limit_name,
warn_percent=None, warn_count=None,
crit_percent=None, crit_count=None):
"""
Set a manual override on the threshold (used for determining
warning/critical status) for a specif... | [
"Set",
"a",
"manual",
"override",
"on",
"the",
"threshold",
"(",
"used",
"for",
"determining",
"warning",
"/",
"critical",
"status",
")",
"for",
"a",
"specific",
"limit",
".",
"See",
":",
"py",
":",
"class",
":",
"~",
".",
"AwsLimitChecker",
"for",
"info... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/checker.py#L486-L516 | [
"def",
"set_threshold_override",
"(",
"self",
",",
"service_name",
",",
"limit_name",
",",
"warn_percent",
"=",
"None",
",",
"warn_count",
"=",
"None",
",",
"crit_percent",
"=",
"None",
",",
"crit_count",
"=",
"None",
")",
":",
"self",
".",
"services",
"[",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | AwsLimitChecker.check_thresholds | Check all limits and current usage against their specified thresholds;
return all :py:class:`~.AwsLimit` instances that have crossed
one or more of their thresholds.
If ``service`` is specified, the returned dict has one element,
the service name, whose value is a nested dict as describ... | awslimitchecker/checker.py | def check_thresholds(self, service=None, use_ta=True):
"""
Check all limits and current usage against their specified thresholds;
return all :py:class:`~.AwsLimit` instances that have crossed
one or more of their thresholds.
If ``service`` is specified, the returned dict has one... | def check_thresholds(self, service=None, use_ta=True):
"""
Check all limits and current usage against their specified thresholds;
return all :py:class:`~.AwsLimit` instances that have crossed
one or more of their thresholds.
If ``service`` is specified, the returned dict has one... | [
"Check",
"all",
"limits",
"and",
"current",
"usage",
"against",
"their",
"specified",
"thresholds",
";",
"return",
"all",
":",
"py",
":",
"class",
":",
"~",
".",
"AwsLimit",
"instances",
"that",
"have",
"crossed",
"one",
"or",
"more",
"of",
"their",
"thres... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/checker.py#L518-L557 | [
"def",
"check_thresholds",
"(",
"self",
",",
"service",
"=",
"None",
",",
"use_ta",
"=",
"True",
")",
":",
"res",
"=",
"{",
"}",
"to_get",
"=",
"self",
".",
"services",
"if",
"service",
"is",
"not",
"None",
":",
"to_get",
"=",
"dict",
"(",
"(",
"ea... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | AwsLimitChecker.get_required_iam_policy | Return an IAM policy granting all of the permissions needed for
awslimitchecker to fully function. This returns a dict suitable
for json serialization to a valid IAM policy.
Internally, this calls :py:meth:`~._AwsService.required_iam_permissions`
on each :py:class:`~._AwsService` instan... | awslimitchecker/checker.py | def get_required_iam_policy(self):
"""
Return an IAM policy granting all of the permissions needed for
awslimitchecker to fully function. This returns a dict suitable
for json serialization to a valid IAM policy.
Internally, this calls :py:meth:`~._AwsService.required_iam_permis... | def get_required_iam_policy(self):
"""
Return an IAM policy granting all of the permissions needed for
awslimitchecker to fully function. This returns a dict suitable
for json serialization to a valid IAM policy.
Internally, this calls :py:meth:`~._AwsService.required_iam_permis... | [
"Return",
"an",
"IAM",
"policy",
"granting",
"all",
"of",
"the",
"permissions",
"needed",
"for",
"awslimitchecker",
"to",
"fully",
"function",
".",
"This",
"returns",
"a",
"dict",
"suitable",
"for",
"json",
"serialization",
"to",
"a",
"valid",
"IAM",
"policy",... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/checker.py#L559-L586 | [
"def",
"get_required_iam_policy",
"(",
"self",
")",
":",
"required_actions",
"=",
"[",
"'support:*'",
",",
"'trustedadvisor:Describe*'",
",",
"'trustedadvisor:RefreshCheck'",
"]",
"for",
"cls",
"in",
"self",
".",
"services",
".",
"values",
"(",
")",
":",
"required... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _Route53Service._update_limits_from_api | Query Route53's GetHostedZoneLimit API action, and update limits
with the quotas returned. Updates ``self.limits``. | awslimitchecker/services/route53.py | def _update_limits_from_api(self):
"""
Query Route53's GetHostedZoneLimit API action, and update limits
with the quotas returned. Updates ``self.limits``.
"""
logger.info("Querying Route53 GetHostedZoneLimits for limits")
self.connect()
self._find_limit_hosted_zon... | def _update_limits_from_api(self):
"""
Query Route53's GetHostedZoneLimit API action, and update limits
with the quotas returned. Updates ``self.limits``.
"""
logger.info("Querying Route53 GetHostedZoneLimits for limits")
self.connect()
self._find_limit_hosted_zon... | [
"Query",
"Route53",
"s",
"GetHostedZoneLimit",
"API",
"action",
"and",
"update",
"limits",
"with",
"the",
"quotas",
"returned",
".",
"Updates",
"self",
".",
"limits",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/route53.py#L74-L82 | [
"def",
"_update_limits_from_api",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"\"Querying Route53 GetHostedZoneLimits for limits\"",
")",
"self",
".",
"connect",
"(",
")",
"self",
".",
"_find_limit_hosted_zone",
"(",
")",
"logger",
".",
"debug",
"(",
"'Done... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _Route53Service.get_limits | Return all known limits for this service, as a dict of their names
to :py:class:`~.AwsLimit` objects.
Limits from:
docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html
:returns: dict of limit names to :py:class:`~.AwsLimit` objects
:rtype: dict | awslimitchecker/services/route53.py | def get_limits(self):
"""
Return all known limits for this service, as a dict of their names
to :py:class:`~.AwsLimit` objects.
Limits from:
docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html
:returns: dict of limit names to :py:class:`~.AwsLimit` obj... | def get_limits(self):
"""
Return all known limits for this service, as a dict of their names
to :py:class:`~.AwsLimit` objects.
Limits from:
docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html
:returns: dict of limit names to :py:class:`~.AwsLimit` obj... | [
"Return",
"all",
"known",
"limits",
"for",
"this",
"service",
"as",
"a",
"dict",
"of",
"their",
"names",
"to",
":",
"py",
":",
"class",
":",
"~",
".",
"AwsLimit",
"objects",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/route53.py#L84-L109 | [
"def",
"get_limits",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"limits",
":",
"self",
".",
"limits",
"=",
"{",
"}",
"for",
"item",
"in",
"[",
"self",
".",
"MAX_RRSETS_BY_ZONE",
",",
"self",
".",
"MAX_VPCS_ASSOCIATED_BY_ZONE",
"]",
":",
"self",
"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _Route53Service._get_hosted_zones | Return all available hosted zones
:returns: dict of hosted zones
:rtype: dict | awslimitchecker/services/route53.py | def _get_hosted_zones(self):
"""
Return all available hosted zones
:returns: dict of hosted zones
:rtype: dict
"""
results = paginate_dict(
self.conn.list_hosted_zones,
alc_marker_path=['NextMarker'],
alc_data_path=['HostedZones'],
... | def _get_hosted_zones(self):
"""
Return all available hosted zones
:returns: dict of hosted zones
:rtype: dict
"""
results = paginate_dict(
self.conn.list_hosted_zones,
alc_marker_path=['NextMarker'],
alc_data_path=['HostedZones'],
... | [
"Return",
"all",
"available",
"hosted",
"zones"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/route53.py#L111-L125 | [
"def",
"_get_hosted_zones",
"(",
"self",
")",
":",
"results",
"=",
"paginate_dict",
"(",
"self",
".",
"conn",
".",
"list_hosted_zones",
",",
"alc_marker_path",
"=",
"[",
"'NextMarker'",
"]",
",",
"alc_data_path",
"=",
"[",
"'HostedZones'",
"]",
",",
"alc_marke... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _Route53Service._get_hosted_zone_limit | Return a hosted zone limit [recordsets|vpc_associations]
:rtype: dict | awslimitchecker/services/route53.py | def _get_hosted_zone_limit(self, limit_type, hosted_zone_id):
"""
Return a hosted zone limit [recordsets|vpc_associations]
:rtype: dict
"""
result = self.conn.get_hosted_zone_limit(
Type=limit_type,
HostedZoneId=hosted_zone_id
)
return r... | def _get_hosted_zone_limit(self, limit_type, hosted_zone_id):
"""
Return a hosted zone limit [recordsets|vpc_associations]
:rtype: dict
"""
result = self.conn.get_hosted_zone_limit(
Type=limit_type,
HostedZoneId=hosted_zone_id
)
return r... | [
"Return",
"a",
"hosted",
"zone",
"limit",
"[",
"recordsets|vpc_associations",
"]"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/route53.py#L127-L139 | [
"def",
"_get_hosted_zone_limit",
"(",
"self",
",",
"limit_type",
",",
"hosted_zone_id",
")",
":",
"result",
"=",
"self",
".",
"conn",
".",
"get_hosted_zone_limit",
"(",
"Type",
"=",
"limit_type",
",",
"HostedZoneId",
"=",
"hosted_zone_id",
")",
"return",
"result... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _Route53Service._find_limit_hosted_zone | Calculate the max recordsets and vpc associations and the current values
per hosted zone | awslimitchecker/services/route53.py | def _find_limit_hosted_zone(self):
"""
Calculate the max recordsets and vpc associations and the current values
per hosted zone
"""
for limit_type in [self.MAX_RRSETS_BY_ZONE,
self.MAX_VPCS_ASSOCIATED_BY_ZONE]:
self.limits[limit_type["name"]... | def _find_limit_hosted_zone(self):
"""
Calculate the max recordsets and vpc associations and the current values
per hosted zone
"""
for limit_type in [self.MAX_RRSETS_BY_ZONE,
self.MAX_VPCS_ASSOCIATED_BY_ZONE]:
self.limits[limit_type["name"]... | [
"Calculate",
"the",
"max",
"recordsets",
"and",
"vpc",
"associations",
"and",
"the",
"current",
"values",
"per",
"hosted",
"zone"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/route53.py#L141-L166 | [
"def",
"_find_limit_hosted_zone",
"(",
"self",
")",
":",
"for",
"limit_type",
"in",
"[",
"self",
".",
"MAX_RRSETS_BY_ZONE",
",",
"self",
".",
"MAX_VPCS_ASSOCIATED_BY_ZONE",
"]",
":",
"self",
".",
"limits",
"[",
"limit_type",
"[",
"\"name\"",
"]",
"]",
".",
"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | IntegrationIamPolicyUpdater.get_iam_policy | Return the current IAM policy as a json-serialized string | dev/update_integration_iam_policy.py | def get_iam_policy(self):
"""Return the current IAM policy as a json-serialized string"""
checker = AwsLimitChecker()
policy = checker.get_required_iam_policy()
return json.dumps(policy, sort_keys=True, indent=2) | def get_iam_policy(self):
"""Return the current IAM policy as a json-serialized string"""
checker = AwsLimitChecker()
policy = checker.get_required_iam_policy()
return json.dumps(policy, sort_keys=True, indent=2) | [
"Return",
"the",
"current",
"IAM",
"policy",
"as",
"a",
"json",
"-",
"serialized",
"string"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/dev/update_integration_iam_policy.py#L93-L97 | [
"def",
"get_iam_policy",
"(",
"self",
")",
":",
"checker",
"=",
"AwsLimitChecker",
"(",
")",
"policy",
"=",
"checker",
".",
"get_required_iam_policy",
"(",
")",
"return",
"json",
".",
"dumps",
"(",
"policy",
",",
"sort_keys",
"=",
"True",
",",
"indent",
"=... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _S3Service.find_usage | Determine the current usage for each limit of this service,
and update corresponding Limit via
:py:meth:`~.AwsLimit._add_current_usage`. | awslimitchecker/services/s3.py | def find_usage(self):
"""
Determine the current usage for each limit of this service,
and update corresponding Limit via
:py:meth:`~.AwsLimit._add_current_usage`.
"""
logger.debug("Checking usage for service %s", self.service_name)
self.connect_resource()
... | def find_usage(self):
"""
Determine the current usage for each limit of this service,
and update corresponding Limit via
:py:meth:`~.AwsLimit._add_current_usage`.
"""
logger.debug("Checking usage for service %s", self.service_name)
self.connect_resource()
... | [
"Determine",
"the",
"current",
"usage",
"for",
"each",
"limit",
"of",
"this",
"service",
"and",
"update",
"corresponding",
"Limit",
"via",
":",
"py",
":",
"meth",
":",
"~",
".",
"AwsLimit",
".",
"_add_current_usage",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/s3.py#L54-L71 | [
"def",
"find_usage",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Checking usage for service %s\"",
",",
"self",
".",
"service_name",
")",
"self",
".",
"connect_resource",
"(",
")",
"for",
"lim",
"in",
"self",
".",
"limits",
".",
"values",
"(",
"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | GithubReleaser.get_tag | Check GitHub for a release with the specified tag name. If present,
return a 2-tuple of the release name and release HTML URL. Otherwise,
return a 2-tuple of None, None (tag not present).
:param version: the tag name to check for
:type version: str
:return: 2-tuple of release na... | dev/github_releaser.py | def get_tag(self, version):
"""
Check GitHub for a release with the specified tag name. If present,
return a 2-tuple of the release name and release HTML URL. Otherwise,
return a 2-tuple of None, None (tag not present).
:param version: the tag name to check for
:type ver... | def get_tag(self, version):
"""
Check GitHub for a release with the specified tag name. If present,
return a 2-tuple of the release name and release HTML URL. Otherwise,
return a 2-tuple of None, None (tag not present).
:param version: the tag name to check for
:type ver... | [
"Check",
"GitHub",
"for",
"a",
"release",
"with",
"the",
"specified",
"tag",
"name",
".",
"If",
"present",
"return",
"a",
"2",
"-",
"tuple",
"of",
"the",
"release",
"name",
"and",
"release",
"HTML",
"URL",
".",
"Otherwise",
"return",
"a",
"2",
"-",
"tu... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/dev/github_releaser.py#L94-L109 | [
"def",
"get_tag",
"(",
"self",
",",
"version",
")",
":",
"for",
"rel",
"in",
"self",
".",
"_repo",
".",
"releases",
"(",
")",
":",
"if",
"rel",
".",
"tag_name",
"==",
"version",
":",
"return",
"rel",
".",
"name",
",",
"rel",
".",
"html_url",
"retur... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _SesService.find_usage | Determine the current usage for each limit of this service,
and update corresponding Limit via
:py:meth:`~.AwsLimit._add_current_usage`. | awslimitchecker/services/ses.py | def find_usage(self):
"""
Determine the current usage for each limit of this service,
and update corresponding Limit via
:py:meth:`~.AwsLimit._add_current_usage`.
"""
logger.debug("Checking usage for service %s", self.service_name)
for lim in self.limits.values():... | def find_usage(self):
"""
Determine the current usage for each limit of this service,
and update corresponding Limit via
:py:meth:`~.AwsLimit._add_current_usage`.
"""
logger.debug("Checking usage for service %s", self.service_name)
for lim in self.limits.values():... | [
"Determine",
"the",
"current",
"usage",
"for",
"each",
"limit",
"of",
"this",
"service",
"and",
"update",
"corresponding",
"Limit",
"via",
":",
"py",
":",
"meth",
":",
"~",
".",
"AwsLimit",
".",
"_add_current_usage",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/ses.py#L56-L80 | [
"def",
"find_usage",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Checking usage for service %s\"",
",",
"self",
".",
"service_name",
")",
"for",
"lim",
"in",
"self",
".",
"limits",
".",
"values",
"(",
")",
":",
"lim",
".",
"_reset_usage",
"(",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _SesService._update_limits_from_api | Call the service's API action to retrieve limit/quota information, and
update AwsLimit objects in ``self.limits`` with this information. | awslimitchecker/services/ses.py | def _update_limits_from_api(self):
"""
Call the service's API action to retrieve limit/quota information, and
update AwsLimit objects in ``self.limits`` with this information.
"""
try:
self.connect()
resp = self.conn.get_send_quota()
except Endpoin... | def _update_limits_from_api(self):
"""
Call the service's API action to retrieve limit/quota information, and
update AwsLimit objects in ``self.limits`` with this information.
"""
try:
self.connect()
resp = self.conn.get_send_quota()
except Endpoin... | [
"Call",
"the",
"service",
"s",
"API",
"action",
"to",
"retrieve",
"limit",
"/",
"quota",
"information",
"and",
"update",
"AwsLimit",
"objects",
"in",
"self",
".",
"limits",
"with",
"this",
"information",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/ses.py#L104-L120 | [
"def",
"_update_limits_from_api",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"connect",
"(",
")",
"resp",
"=",
"self",
".",
"conn",
".",
"get_send_quota",
"(",
")",
"except",
"EndpointConnectionError",
"as",
"ex",
":",
"logger",
".",
"warning",
"(",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | Connectable.connect | Connect to an AWS API via boto3 low-level client and set ``self.conn``
to the `boto3.client <https://boto3.readthed
ocs.org/en/latest/reference/core/boto3.html#boto3.client>`_ object
(a ``botocore.client.*`` instance). If ``self.conn`` is not None,
do nothing. This connects to the API na... | awslimitchecker/connectable.py | def connect(self):
"""
Connect to an AWS API via boto3 low-level client and set ``self.conn``
to the `boto3.client <https://boto3.readthed
ocs.org/en/latest/reference/core/boto3.html#boto3.client>`_ object
(a ``botocore.client.*`` instance). If ``self.conn`` is not None,
... | def connect(self):
"""
Connect to an AWS API via boto3 low-level client and set ``self.conn``
to the `boto3.client <https://boto3.readthed
ocs.org/en/latest/reference/core/boto3.html#boto3.client>`_ object
(a ``botocore.client.*`` instance). If ``self.conn`` is not None,
... | [
"Connect",
"to",
"an",
"AWS",
"API",
"via",
"boto3",
"low",
"-",
"level",
"client",
"and",
"set",
"self",
".",
"conn",
"to",
"the",
"boto3",
".",
"client",
"<https",
":",
"//",
"boto3",
".",
"readthed",
"ocs",
".",
"org",
"/",
"en",
"/",
"latest",
... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/connectable.py#L75-L90 | [
"def",
"connect",
"(",
"self",
")",
":",
"if",
"self",
".",
"conn",
"is",
"not",
"None",
":",
"return",
"kwargs",
"=",
"self",
".",
"_boto3_connection_kwargs",
"self",
".",
"conn",
"=",
"boto3",
".",
"client",
"(",
"self",
".",
"api_name",
",",
"*",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | Connectable.connect_resource | Connect to an AWS API via boto3 high-level resource connection and set
``self.resource_conn`` to the `boto3.resource <https://boto3.readthed
ocs.org/en/latest/reference/core/boto3.html#boto3.resource>`_ object
(a ``boto3.resources.factory.*.ServiceResource`` instance).
If ``self.resource... | awslimitchecker/connectable.py | def connect_resource(self):
"""
Connect to an AWS API via boto3 high-level resource connection and set
``self.resource_conn`` to the `boto3.resource <https://boto3.readthed
ocs.org/en/latest/reference/core/boto3.html#boto3.resource>`_ object
(a ``boto3.resources.factory.*.Service... | def connect_resource(self):
"""
Connect to an AWS API via boto3 high-level resource connection and set
``self.resource_conn`` to the `boto3.resource <https://boto3.readthed
ocs.org/en/latest/reference/core/boto3.html#boto3.resource>`_ object
(a ``boto3.resources.factory.*.Service... | [
"Connect",
"to",
"an",
"AWS",
"API",
"via",
"boto3",
"high",
"-",
"level",
"resource",
"connection",
"and",
"set",
"self",
".",
"resource_conn",
"to",
"the",
"boto3",
".",
"resource",
"<https",
":",
"//",
"boto3",
".",
"readthed",
"ocs",
".",
"org",
"/",... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/connectable.py#L92-L108 | [
"def",
"connect_resource",
"(",
"self",
")",
":",
"if",
"self",
".",
"resource_conn",
"is",
"not",
"None",
":",
"return",
"kwargs",
"=",
"self",
".",
"_boto3_connection_kwargs",
"self",
".",
"resource_conn",
"=",
"boto3",
".",
"resource",
"(",
"self",
".",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _DynamodbService.find_usage | Determine the current usage for each limit of this service,
and update corresponding Limit via
:py:meth:`~.AwsLimit._add_current_usage`. | awslimitchecker/services/dynamodb.py | def find_usage(self):
"""
Determine the current usage for each limit of this service,
and update corresponding Limit via
:py:meth:`~.AwsLimit._add_current_usage`.
"""
logger.debug("Checking usage for service %s", self.service_name)
self.connect_resource()
... | def find_usage(self):
"""
Determine the current usage for each limit of this service,
and update corresponding Limit via
:py:meth:`~.AwsLimit._add_current_usage`.
"""
logger.debug("Checking usage for service %s", self.service_name)
self.connect_resource()
... | [
"Determine",
"the",
"current",
"usage",
"for",
"each",
"limit",
"of",
"this",
"service",
"and",
"update",
"corresponding",
"Limit",
"via",
":",
"py",
":",
"meth",
":",
"~",
".",
"AwsLimit",
".",
"_add_current_usage",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/dynamodb.py#L54-L66 | [
"def",
"find_usage",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Checking usage for service %s\"",
",",
"self",
".",
"service_name",
")",
"self",
".",
"connect_resource",
"(",
")",
"for",
"lim",
"in",
"self",
".",
"limits",
".",
"values",
"(",
"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _DynamodbService._find_usage_dynamodb | calculates current usage for all DynamoDB limits | awslimitchecker/services/dynamodb.py | def _find_usage_dynamodb(self):
"""calculates current usage for all DynamoDB limits"""
table_count = 0
region_read_capacity = 0
region_write_capacity = 0
logger.debug("Getting usage for DynamoDB tables")
for table in self.resource_conn.tables.all():
table_cou... | def _find_usage_dynamodb(self):
"""calculates current usage for all DynamoDB limits"""
table_count = 0
region_read_capacity = 0
region_write_capacity = 0
logger.debug("Getting usage for DynamoDB tables")
for table in self.resource_conn.tables.all():
table_cou... | [
"calculates",
"current",
"usage",
"for",
"all",
"DynamoDB",
"limits"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/dynamodb.py#L68-L132 | [
"def",
"_find_usage_dynamodb",
"(",
"self",
")",
":",
"table_count",
"=",
"0",
"region_read_capacity",
"=",
"0",
"region_write_capacity",
"=",
"0",
"logger",
".",
"debug",
"(",
"\"Getting usage for DynamoDB tables\"",
")",
"for",
"table",
"in",
"self",
".",
"resou... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _DynamodbService.get_limits | Return all known limits for this service, as a dict of their names
to :py:class:`~.AwsLimit` objects.
:returns: dict of limit names to :py:class:`~.AwsLimit` objects
:rtype: dict | awslimitchecker/services/dynamodb.py | def get_limits(self):
"""
Return all known limits for this service, as a dict of their names
to :py:class:`~.AwsLimit` objects.
:returns: dict of limit names to :py:class:`~.AwsLimit` objects
:rtype: dict
"""
self.connect()
region_name = self.conn._client... | def get_limits(self):
"""
Return all known limits for this service, as a dict of their names
to :py:class:`~.AwsLimit` objects.
:returns: dict of limit names to :py:class:`~.AwsLimit` objects
:rtype: dict
"""
self.connect()
region_name = self.conn._client... | [
"Return",
"all",
"known",
"limits",
"for",
"this",
"service",
"as",
"a",
"dict",
"of",
"their",
"names",
"to",
":",
"py",
":",
"class",
":",
"~",
".",
"AwsLimit",
"objects",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/dynamodb.py#L134-L211 | [
"def",
"get_limits",
"(",
"self",
")",
":",
"self",
".",
"connect",
"(",
")",
"region_name",
"=",
"self",
".",
"conn",
".",
"_client_config",
".",
"region_name",
"if",
"self",
".",
"limits",
"!=",
"{",
"}",
":",
"return",
"self",
".",
"limits",
"limits... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _DynamodbService._update_limits_from_api | Query DynamoDB's DescribeLimits API action, and update limits
with the quotas returned. Updates ``self.limits``. | awslimitchecker/services/dynamodb.py | def _update_limits_from_api(self):
"""
Query DynamoDB's DescribeLimits API action, and update limits
with the quotas returned. Updates ``self.limits``.
"""
self.connect()
logger.info("Querying DynamoDB DescribeLimits for limits")
# no need to paginate
lims... | def _update_limits_from_api(self):
"""
Query DynamoDB's DescribeLimits API action, and update limits
with the quotas returned. Updates ``self.limits``.
"""
self.connect()
logger.info("Querying DynamoDB DescribeLimits for limits")
# no need to paginate
lims... | [
"Query",
"DynamoDB",
"s",
"DescribeLimits",
"API",
"action",
"and",
"update",
"limits",
"with",
"the",
"quotas",
"returned",
".",
"Updates",
"self",
".",
"limits",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/dynamodb.py#L213-L234 | [
"def",
"_update_limits_from_api",
"(",
"self",
")",
":",
"self",
".",
"connect",
"(",
")",
"logger",
".",
"info",
"(",
"\"Querying DynamoDB DescribeLimits for limits\"",
")",
"# no need to paginate",
"lims",
"=",
"self",
".",
"conn",
".",
"describe_limits",
"(",
"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _get_version_info | Returns the currently-installed awslimitchecker version, and a best-effort
attempt at finding the origin URL and commit/tag if installed from an
editable git clone.
:returns: awslimitchecker version
:rtype: str | awslimitchecker/version.py | def _get_version_info():
"""
Returns the currently-installed awslimitchecker version, and a best-effort
attempt at finding the origin URL and commit/tag if installed from an
editable git clone.
:returns: awslimitchecker version
:rtype: str
"""
if os.environ.get('VERSIONCHECK_DEBUG', '')... | def _get_version_info():
"""
Returns the currently-installed awslimitchecker version, and a best-effort
attempt at finding the origin URL and commit/tag if installed from an
editable git clone.
:returns: awslimitchecker version
:rtype: str
"""
if os.environ.get('VERSIONCHECK_DEBUG', '')... | [
"Returns",
"the",
"currently",
"-",
"installed",
"awslimitchecker",
"version",
"and",
"a",
"best",
"-",
"effort",
"attempt",
"at",
"finding",
"the",
"origin",
"URL",
"and",
"commit",
"/",
"tag",
"if",
"installed",
"from",
"an",
"editable",
"git",
"clone",
".... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/version.py#L105-L142 | [
"def",
"_get_version_info",
"(",
")",
":",
"if",
"os",
".",
"environ",
".",
"get",
"(",
"'VERSIONCHECK_DEBUG'",
",",
"''",
")",
"!=",
"'true'",
":",
"for",
"lname",
"in",
"[",
"'versionfinder'",
",",
"'pip'",
",",
"'git'",
"]",
":",
"l",
"=",
"logging"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | AWSLimitCheckerVersion.version_str | The version string for the currently-running awslimitchecker;
includes git branch and tag information.
:rtype: str | awslimitchecker/version.py | def version_str(self):
"""
The version string for the currently-running awslimitchecker;
includes git branch and tag information.
:rtype: str
"""
vs = str(self.release)
if self.tag is not None:
vs += '@{t}'.format(t=self.tag)
elif self.commit ... | def version_str(self):
"""
The version string for the currently-running awslimitchecker;
includes git branch and tag information.
:rtype: str
"""
vs = str(self.release)
if self.tag is not None:
vs += '@{t}'.format(t=self.tag)
elif self.commit ... | [
"The",
"version",
"string",
"for",
"the",
"currently",
"-",
"running",
"awslimitchecker",
";",
"includes",
"git",
"branch",
"and",
"tag",
"information",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/version.py#L64-L76 | [
"def",
"version_str",
"(",
"self",
")",
":",
"vs",
"=",
"str",
"(",
"self",
".",
"release",
")",
"if",
"self",
".",
"tag",
"is",
"not",
"None",
":",
"vs",
"+=",
"'@{t}'",
".",
"format",
"(",
"t",
"=",
"self",
".",
"tag",
")",
"elif",
"self",
".... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | Config._load_config | load configuration from config/ | docs/examples/multi-region_multi-account/alc_multi_account.py | def _load_config(self):
"""load configuration from config/"""
logger.debug(
'Listing per-account config subdirectories in %s', self._conf_dir
)
for acct_id in os.listdir(self._conf_dir):
path = os.path.join(self._conf_dir, acct_id)
# skip if not a dire... | def _load_config(self):
"""load configuration from config/"""
logger.debug(
'Listing per-account config subdirectories in %s', self._conf_dir
)
for acct_id in os.listdir(self._conf_dir):
path = os.path.join(self._conf_dir, acct_id)
# skip if not a dire... | [
"load",
"configuration",
"from",
"config",
"/"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/docs/examples/multi-region_multi-account/alc_multi_account.py#L77-L98 | [
"def",
"_load_config",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"'Listing per-account config subdirectories in %s'",
",",
"self",
".",
"_conf_dir",
")",
"for",
"acct_id",
"in",
"os",
".",
"listdir",
"(",
"self",
".",
"_conf_dir",
")",
":",
"path",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | Config._load_account | load configuration from one per-account subdirectory | docs/examples/multi-region_multi-account/alc_multi_account.py | def _load_account(self, acct_id, acct_dir_path):
"""load configuration from one per-account subdirectory"""
# setup a default config dict for the account
self._config[acct_id] = {
'name': None,
'role_name': DEFAULT_ROLE_NAME,
'regions': {}
}
# ... | def _load_account(self, acct_id, acct_dir_path):
"""load configuration from one per-account subdirectory"""
# setup a default config dict for the account
self._config[acct_id] = {
'name': None,
'role_name': DEFAULT_ROLE_NAME,
'regions': {}
}
# ... | [
"load",
"configuration",
"from",
"one",
"per",
"-",
"account",
"subdirectory"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/docs/examples/multi-region_multi-account/alc_multi_account.py#L100-L122 | [
"def",
"_load_account",
"(",
"self",
",",
"acct_id",
",",
"acct_dir_path",
")",
":",
"# setup a default config dict for the account",
"self",
".",
"_config",
"[",
"acct_id",
"]",
"=",
"{",
"'name'",
":",
"None",
",",
"'role_name'",
":",
"DEFAULT_ROLE_NAME",
",",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | Config._load_region | load config from a single per-region subdirectory of an account | docs/examples/multi-region_multi-account/alc_multi_account.py | def _load_region(self, acct_id, region_name, path):
"""load config from a single per-region subdirectory of an account"""
lim_path = os.path.join(path, 'limit_overrides.json')
thresh_path = os.path.join(path, 'threshold_overrides.json')
res = {'limit_overrides': {}, 'threshold_overrides'... | def _load_region(self, acct_id, region_name, path):
"""load config from a single per-region subdirectory of an account"""
lim_path = os.path.join(path, 'limit_overrides.json')
thresh_path = os.path.join(path, 'threshold_overrides.json')
res = {'limit_overrides': {}, 'threshold_overrides'... | [
"load",
"config",
"from",
"a",
"single",
"per",
"-",
"region",
"subdirectory",
"of",
"an",
"account"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/docs/examples/multi-region_multi-account/alc_multi_account.py#L124-L135 | [
"def",
"_load_region",
"(",
"self",
",",
"acct_id",
",",
"region_name",
",",
"path",
")",
":",
"lim_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"'limit_overrides.json'",
")",
"thresh_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"p... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | Config.get_account_config | Return a dictionary of account configuration for the account with the
specified ID or name.
:param id_or_name: ID or name of account
:type id_or_name: str
:return: configuration for specified account
:rtype: dict | docs/examples/multi-region_multi-account/alc_multi_account.py | def get_account_config(self, id_or_name):
"""
Return a dictionary of account configuration for the account with the
specified ID or name.
:param id_or_name: ID or name of account
:type id_or_name: str
:return: configuration for specified account
:rtype: dict
... | def get_account_config(self, id_or_name):
"""
Return a dictionary of account configuration for the account with the
specified ID or name.
:param id_or_name: ID or name of account
:type id_or_name: str
:return: configuration for specified account
:rtype: dict
... | [
"Return",
"a",
"dictionary",
"of",
"account",
"configuration",
"for",
"the",
"account",
"with",
"the",
"specified",
"ID",
"or",
"name",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/docs/examples/multi-region_multi-account/alc_multi_account.py#L137-L151 | [
"def",
"get_account_config",
"(",
"self",
",",
"id_or_name",
")",
":",
"if",
"id_or_name",
"in",
"self",
".",
"_config",
":",
"return",
"self",
".",
"_config",
"[",
"id_or_name",
"]",
"if",
"id_or_name",
"in",
"self",
".",
"_acct_name_to_id",
":",
"return",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | MultiAccountChecker.check_limits | Run the actual usage and limit check, with overrides, against a specific
account in a specific region, optionally assuming a role in the account
and optionally setting limit and/or threshold overrides.
Return a 2-tuple of lists, warning strings and critical strings.
see: http://awslimi... | docs/examples/multi-region_multi-account/alc_multi_account.py | def check_limits(self, acct_id, region_name, role_name=None,
limit_overrides={}, threshold_overrides={}):
"""
Run the actual usage and limit check, with overrides, against a specific
account in a specific region, optionally assuming a role in the account
and optional... | def check_limits(self, acct_id, region_name, role_name=None,
limit_overrides={}, threshold_overrides={}):
"""
Run the actual usage and limit check, with overrides, against a specific
account in a specific region, optionally assuming a role in the account
and optional... | [
"Run",
"the",
"actual",
"usage",
"and",
"limit",
"check",
"with",
"overrides",
"against",
"a",
"specific",
"account",
"in",
"a",
"specific",
"region",
"optionally",
"assuming",
"a",
"role",
"in",
"the",
"account",
"and",
"optionally",
"setting",
"limit",
"and"... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/docs/examples/multi-region_multi-account/alc_multi_account.py#L170-L225 | [
"def",
"check_limits",
"(",
"self",
",",
"acct_id",
",",
"region_name",
",",
"role_name",
"=",
"None",
",",
"limit_overrides",
"=",
"{",
"}",
",",
"threshold_overrides",
"=",
"{",
"}",
")",
":",
"# instantiate the class",
"if",
"role_name",
"is",
"not",
"Non... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | MultiAccountChecker.run | Main entry point. | docs/examples/multi-region_multi-account/alc_multi_account.py | def run(self, error_on_warning=False, region=None, accounts=[]):
"""
Main entry point.
"""
all_warnings = []
all_criticals = []
if len(accounts) == 0:
# if no accounts specified, run all of them
accounts = self._conf.list_account_ids
for ac... | def run(self, error_on_warning=False, region=None, accounts=[]):
"""
Main entry point.
"""
all_warnings = []
all_criticals = []
if len(accounts) == 0:
# if no accounts specified, run all of them
accounts = self._conf.list_account_ids
for ac... | [
"Main",
"entry",
"point",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/docs/examples/multi-region_multi-account/alc_multi_account.py#L227-L281 | [
"def",
"run",
"(",
"self",
",",
"error_on_warning",
"=",
"False",
",",
"region",
"=",
"None",
",",
"accounts",
"=",
"[",
"]",
")",
":",
"all_warnings",
"=",
"[",
"]",
"all_criticals",
"=",
"[",
"]",
"if",
"len",
"(",
"accounts",
")",
"==",
"0",
":"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _EbsService._find_usage_ebs | calculate usage for all EBS limits and update Limits | awslimitchecker/services/ebs.py | def _find_usage_ebs(self):
"""calculate usage for all EBS limits and update Limits"""
vols = 0
piops = 0
piops_gb = 0
gp_gb = 0
mag_gb = 0
st_gb = 0
sc_gb = 0
logger.debug("Getting usage for EBS volumes")
results = paginate_dict(
... | def _find_usage_ebs(self):
"""calculate usage for all EBS limits and update Limits"""
vols = 0
piops = 0
piops_gb = 0
gp_gb = 0
mag_gb = 0
st_gb = 0
sc_gb = 0
logger.debug("Getting usage for EBS volumes")
results = paginate_dict(
... | [
"calculate",
"usage",
"for",
"all",
"EBS",
"limits",
"and",
"update",
"Limits"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/ebs.py#L70-L138 | [
"def",
"_find_usage_ebs",
"(",
"self",
")",
":",
"vols",
"=",
"0",
"piops",
"=",
"0",
"piops_gb",
"=",
"0",
"gp_gb",
"=",
"0",
"mag_gb",
"=",
"0",
"st_gb",
"=",
"0",
"sc_gb",
"=",
"0",
"logger",
".",
"debug",
"(",
"\"Getting usage for EBS volumes\"",
"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _EbsService._find_usage_snapshots | find snapshot usage | awslimitchecker/services/ebs.py | def _find_usage_snapshots(self):
"""find snapshot usage"""
logger.debug("Getting usage for EBS snapshots")
snaps = paginate_dict(
self.conn.describe_snapshots,
OwnerIds=['self'],
alc_marker_path=['NextToken'],
alc_data_path=['Snapshots'],
... | def _find_usage_snapshots(self):
"""find snapshot usage"""
logger.debug("Getting usage for EBS snapshots")
snaps = paginate_dict(
self.conn.describe_snapshots,
OwnerIds=['self'],
alc_marker_path=['NextToken'],
alc_data_path=['Snapshots'],
... | [
"find",
"snapshot",
"usage"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/ebs.py#L140-L153 | [
"def",
"_find_usage_snapshots",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Getting usage for EBS snapshots\"",
")",
"snaps",
"=",
"paginate_dict",
"(",
"self",
".",
"conn",
".",
"describe_snapshots",
",",
"OwnerIds",
"=",
"[",
"'self'",
"]",
",",
"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _EbsService.get_limits | Return all known limits for this service, as a dict of their names
to :py:class:`~.AwsLimit` objects.
:returns: dict of limit names to :py:class:`~.AwsLimit` objects
:rtype: dict | awslimitchecker/services/ebs.py | def get_limits(self):
"""
Return all known limits for this service, as a dict of their names
to :py:class:`~.AwsLimit` objects.
:returns: dict of limit names to :py:class:`~.AwsLimit` objects
:rtype: dict
"""
if self.limits != {}:
return self.limits
... | def get_limits(self):
"""
Return all known limits for this service, as a dict of their names
to :py:class:`~.AwsLimit` objects.
:returns: dict of limit names to :py:class:`~.AwsLimit` objects
:rtype: dict
"""
if self.limits != {}:
return self.limits
... | [
"Return",
"all",
"known",
"limits",
"for",
"this",
"service",
"as",
"a",
"dict",
"of",
"their",
"names",
"to",
":",
"py",
":",
"class",
":",
"~",
".",
"AwsLimit",
"objects",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/ebs.py#L155-L168 | [
"def",
"get_limits",
"(",
"self",
")",
":",
"if",
"self",
".",
"limits",
"!=",
"{",
"}",
":",
"return",
"self",
".",
"limits",
"limits",
"=",
"{",
"}",
"limits",
".",
"update",
"(",
"self",
".",
"_get_limits_ebs",
"(",
")",
")",
"self",
".",
"limit... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _EbsService._get_limits_ebs | Return a dict of EBS-related limits only.
This method should only be used internally by
:py:meth:~.get_limits`.
:rtype: dict | awslimitchecker/services/ebs.py | def _get_limits_ebs(self):
"""
Return a dict of EBS-related limits only.
This method should only be used internally by
:py:meth:~.get_limits`.
:rtype: dict
"""
limits = {}
limits['Provisioned IOPS'] = AwsLimit(
'Provisioned IOPS',
... | def _get_limits_ebs(self):
"""
Return a dict of EBS-related limits only.
This method should only be used internally by
:py:meth:~.get_limits`.
:rtype: dict
"""
limits = {}
limits['Provisioned IOPS'] = AwsLimit(
'Provisioned IOPS',
... | [
"Return",
"a",
"dict",
"of",
"EBS",
"-",
"related",
"limits",
"only",
".",
"This",
"method",
"should",
"only",
"be",
"used",
"internally",
"by",
":",
"py",
":",
"meth",
":",
"~",
".",
"get_limits",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/ebs.py#L170-L251 | [
"def",
"_get_limits_ebs",
"(",
"self",
")",
":",
"limits",
"=",
"{",
"}",
"limits",
"[",
"'Provisioned IOPS'",
"]",
"=",
"AwsLimit",
"(",
"'Provisioned IOPS'",
",",
"self",
",",
"200000",
",",
"self",
".",
"warning_threshold",
",",
"self",
".",
"critical_thr... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | CheckAWSLimits.check_limits | Run the actual usage and limit check, with overrides.
see: http://awslimitchecker.readthedocs.org/en/latest/python_usage.html#ci-deployment-checks | docs/examples/check_aws_limits.py | def check_limits(self, verbose=False):
"""
Run the actual usage and limit check, with overrides.
see: http://awslimitchecker.readthedocs.org/en/latest/python_usage.html#ci-deployment-checks
"""
# instantiate the class
checker = AwsLimitChecker()
# set your overri... | def check_limits(self, verbose=False):
"""
Run the actual usage and limit check, with overrides.
see: http://awslimitchecker.readthedocs.org/en/latest/python_usage.html#ci-deployment-checks
"""
# instantiate the class
checker = AwsLimitChecker()
# set your overri... | [
"Run",
"the",
"actual",
"usage",
"and",
"limit",
"check",
"with",
"overrides",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/docs/examples/check_aws_limits.py#L89-L149 | [
"def",
"check_limits",
"(",
"self",
",",
"verbose",
"=",
"False",
")",
":",
"# instantiate the class",
"checker",
"=",
"AwsLimitChecker",
"(",
")",
"# set your overrides",
"checker",
".",
"set_threshold_overrides",
"(",
"AWS_THRESHOLD_OVERRIDES",
")",
"checker",
".",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | CheckAWSLimits.run | Main entry point. | docs/examples/check_aws_limits.py | def run(self, error_on_warning=False, verbose=False):
"""
Main entry point.
"""
warnings, criticals = self.check_limits(verbose=verbose)
# output
if len(warnings) > 0:
print("\nWARNING:\n")
for w in warnings:
print(w)
if len... | def run(self, error_on_warning=False, verbose=False):
"""
Main entry point.
"""
warnings, criticals = self.check_limits(verbose=verbose)
# output
if len(warnings) > 0:
print("\nWARNING:\n")
for w in warnings:
print(w)
if len... | [
"Main",
"entry",
"point",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/docs/examples/check_aws_limits.py#L151-L173 | [
"def",
"run",
"(",
"self",
",",
"error_on_warning",
"=",
"False",
",",
"verbose",
"=",
"False",
")",
":",
"warnings",
",",
"criticals",
"=",
"self",
".",
"check_limits",
"(",
"verbose",
"=",
"verbose",
")",
"# output",
"if",
"len",
"(",
"warnings",
")",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _AwsService.set_limit_override | Set a new limit ``value`` for the specified limit, overriding
the default. If ``override_ta`` is True, also use this value
instead of any found by Trusted Advisor. This method simply
passes the data through to the
:py:meth:`~awslimitchecker.limit.AwsLimit.set_limit_override`
meth... | awslimitchecker/services/base.py | def set_limit_override(self, limit_name, value, override_ta=True):
"""
Set a new limit ``value`` for the specified limit, overriding
the default. If ``override_ta`` is True, also use this value
instead of any found by Trusted Advisor. This method simply
passes the data through to... | def set_limit_override(self, limit_name, value, override_ta=True):
"""
Set a new limit ``value`` for the specified limit, overriding
the default. If ``override_ta`` is True, also use this value
instead of any found by Trusted Advisor. This method simply
passes the data through to... | [
"Set",
"a",
"new",
"limit",
"value",
"for",
"the",
"specified",
"limit",
"overriding",
"the",
"default",
".",
"If",
"override_ta",
"is",
"True",
"also",
"use",
"this",
"value",
"instead",
"of",
"any",
"found",
"by",
"Trusted",
"Advisor",
".",
"This",
"meth... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/base.py#L172-L205 | [
"def",
"set_limit_override",
"(",
"self",
",",
"limit_name",
",",
"value",
",",
"override_ta",
"=",
"True",
")",
":",
"try",
":",
"self",
".",
"limits",
"[",
"limit_name",
"]",
".",
"set_limit_override",
"(",
"value",
",",
"override_ta",
"=",
"override_ta",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _AwsService._set_ta_limit | Set the value for the limit as reported by Trusted Advisor,
for the specified limit.
This method should only be called by :py:class:`~.TrustedAdvisor`.
:param limit_name: the name of the limit to override the value for
:type limit_name: str
:param value: the Trusted Advisor lim... | awslimitchecker/services/base.py | def _set_ta_limit(self, limit_name, value):
"""
Set the value for the limit as reported by Trusted Advisor,
for the specified limit.
This method should only be called by :py:class:`~.TrustedAdvisor`.
:param limit_name: the name of the limit to override the value for
:ty... | def _set_ta_limit(self, limit_name, value):
"""
Set the value for the limit as reported by Trusted Advisor,
for the specified limit.
This method should only be called by :py:class:`~.TrustedAdvisor`.
:param limit_name: the name of the limit to override the value for
:ty... | [
"Set",
"the",
"value",
"for",
"the",
"limit",
"as",
"reported",
"by",
"Trusted",
"Advisor",
"for",
"the",
"specified",
"limit",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/base.py#L207-L231 | [
"def",
"_set_ta_limit",
"(",
"self",
",",
"limit_name",
",",
"value",
")",
":",
"try",
":",
"self",
".",
"limits",
"[",
"limit_name",
"]",
".",
"_set_ta_limit",
"(",
"value",
")",
"logger",
".",
"debug",
"(",
"\"Setting %s limit %s TA limit to %d\"",
",",
"s... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _AwsService.set_threshold_override | Override the default warning and critical thresholds used to evaluate
the specified limit's usage. Theresholds can be specified as a
percentage of the limit, or as a usage count, or both.
:param warn_percent: new warning threshold, percentage used
:type warn_percent: int
:param ... | awslimitchecker/services/base.py | def set_threshold_override(self, limit_name, warn_percent=None,
warn_count=None, crit_percent=None,
crit_count=None):
"""
Override the default warning and critical thresholds used to evaluate
the specified limit's usage. Theresholds c... | def set_threshold_override(self, limit_name, warn_percent=None,
warn_count=None, crit_percent=None,
crit_count=None):
"""
Override the default warning and critical thresholds used to evaluate
the specified limit's usage. Theresholds c... | [
"Override",
"the",
"default",
"warning",
"and",
"critical",
"thresholds",
"used",
"to",
"evaluate",
"the",
"specified",
"limit",
"s",
"usage",
".",
"Theresholds",
"can",
"be",
"specified",
"as",
"a",
"percentage",
"of",
"the",
"limit",
"or",
"as",
"a",
"usag... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/base.py#L233-L260 | [
"def",
"set_threshold_override",
"(",
"self",
",",
"limit_name",
",",
"warn_percent",
"=",
"None",
",",
"warn_count",
"=",
"None",
",",
"crit_percent",
"=",
"None",
",",
"crit_count",
"=",
"None",
")",
":",
"try",
":",
"self",
".",
"limits",
"[",
"limit_na... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _AwsService.check_thresholds | Checks current usage against configured thresholds for all limits
for this service.
:returns: a dict of limit name to :py:class:`~.AwsLimit` instance
for all limits that crossed one or more of their thresholds.
:rtype: :py:obj:`dict` of :py:class:`~.AwsLimit` | awslimitchecker/services/base.py | def check_thresholds(self):
"""
Checks current usage against configured thresholds for all limits
for this service.
:returns: a dict of limit name to :py:class:`~.AwsLimit` instance
for all limits that crossed one or more of their thresholds.
:rtype: :py:obj:`dict` of ... | def check_thresholds(self):
"""
Checks current usage against configured thresholds for all limits
for this service.
:returns: a dict of limit name to :py:class:`~.AwsLimit` instance
for all limits that crossed one or more of their thresholds.
:rtype: :py:obj:`dict` of ... | [
"Checks",
"current",
"usage",
"against",
"configured",
"thresholds",
"for",
"all",
"limits",
"for",
"this",
"service",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/base.py#L262-L277 | [
"def",
"check_thresholds",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_have_usage",
":",
"self",
".",
"find_usage",
"(",
")",
"ret",
"=",
"{",
"}",
"for",
"name",
",",
"limit",
"in",
"self",
".",
"limits",
".",
"items",
"(",
")",
":",
"if",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _RedshiftService.find_usage | Determine the current usage for each limit of this service,
and update corresponding Limit via
:py:meth:`~.AwsLimit._add_current_usage`. | awslimitchecker/services/redshift.py | def find_usage(self):
"""
Determine the current usage for each limit of this service,
and update corresponding Limit via
:py:meth:`~.AwsLimit._add_current_usage`.
"""
logger.debug("Checking usage for service %s", self.service_name)
self.connect()
for lim i... | def find_usage(self):
"""
Determine the current usage for each limit of this service,
and update corresponding Limit via
:py:meth:`~.AwsLimit._add_current_usage`.
"""
logger.debug("Checking usage for service %s", self.service_name)
self.connect()
for lim i... | [
"Determine",
"the",
"current",
"usage",
"for",
"each",
"limit",
"of",
"this",
"service",
"and",
"update",
"corresponding",
"Limit",
"via",
":",
"py",
":",
"meth",
":",
"~",
".",
"AwsLimit",
".",
"_add_current_usage",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/redshift.py#L55-L68 | [
"def",
"find_usage",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Checking usage for service %s\"",
",",
"self",
".",
"service_name",
")",
"self",
".",
"connect",
"(",
")",
"for",
"lim",
"in",
"self",
".",
"limits",
".",
"values",
"(",
")",
":"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | label_ref_node | Generate a node that references a label | docs/source/conf.py | def label_ref_node(docname, ref_to, title):
"""Generate a node that references a label"""
txt = Text(title, rawsource=title)
newchild = inline(
':ref:`%s`' % ref_to,
'',
txt,
classes=['xref', 'std', 'std-ref']
)
newnode = pending_xref(
':ref:`%s`' % ref_to,
... | def label_ref_node(docname, ref_to, title):
"""Generate a node that references a label"""
txt = Text(title, rawsource=title)
newchild = inline(
':ref:`%s`' % ref_to,
'',
txt,
classes=['xref', 'std', 'std-ref']
)
newnode = pending_xref(
':ref:`%s`' % ref_to,
... | [
"Generate",
"a",
"node",
"that",
"references",
"a",
"label"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/docs/source/conf.py#L420-L439 | [
"def",
"label_ref_node",
"(",
"docname",
",",
"ref_to",
",",
"title",
")",
":",
"txt",
"=",
"Text",
"(",
"title",
",",
"rawsource",
"=",
"title",
")",
"newchild",
"=",
"inline",
"(",
"':ref:`%s`'",
"%",
"ref_to",
",",
"''",
",",
"txt",
",",
"classes",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | on_doctree_read | When the doctree has been read in, and ``include`` directives have been
executed and replaced with the included file, walk the tree via
LinkToRefVisitor. | docs/source/conf.py | def on_doctree_read(_, doctree):
"""
When the doctree has been read in, and ``include`` directives have been
executed and replaced with the included file, walk the tree via
LinkToRefVisitor.
"""
docname = os.path.splitext(
os.path.basename(doctree.attributes['source']))[0]
if docname... | def on_doctree_read(_, doctree):
"""
When the doctree has been read in, and ``include`` directives have been
executed and replaced with the included file, walk the tree via
LinkToRefVisitor.
"""
docname = os.path.splitext(
os.path.basename(doctree.attributes['source']))[0]
if docname... | [
"When",
"the",
"doctree",
"has",
"been",
"read",
"in",
"and",
"include",
"directives",
"have",
"been",
"executed",
"and",
"replaced",
"with",
"the",
"included",
"file",
"walk",
"the",
"tree",
"via",
"LinkToRefVisitor",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/docs/source/conf.py#L466-L563 | [
"def",
"on_doctree_read",
"(",
"_",
",",
"doctree",
")",
":",
"docname",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"doctree",
".",
"attributes",
"[",
"'source'",
"]",
")",
")",
"[",
"0",
"]",
"if",
"docn... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | LinkToRefVisitor.visit_target | When we find a target node, first make sure it matches the last
reference node we saw. Assuming it does, see if its refuri (link URI)
is in our replacement list. If so, replace the link with an internal
reference. | docs/source/conf.py | def visit_target(self, node):
"""
When we find a target node, first make sure it matches the last
reference node we saw. Assuming it does, see if its refuri (link URI)
is in our replacement list. If so, replace the link with an internal
reference.
"""
if self.last... | def visit_target(self, node):
"""
When we find a target node, first make sure it matches the last
reference node we saw. Assuming it does, see if its refuri (link URI)
is in our replacement list. If so, replace the link with an internal
reference.
"""
if self.last... | [
"When",
"we",
"find",
"a",
"target",
"node",
"first",
"make",
"sure",
"it",
"matches",
"the",
"last",
"reference",
"node",
"we",
"saw",
".",
"Assuming",
"it",
"does",
"see",
"if",
"its",
"refuri",
"(",
"link",
"URI",
")",
"is",
"in",
"our",
"replacemen... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/docs/source/conf.py#L382-L408 | [
"def",
"visit_target",
"(",
"self",
",",
"node",
")",
":",
"if",
"self",
".",
"lastref",
"is",
"None",
":",
"return",
"if",
"(",
"self",
".",
"lastref",
".",
"attributes",
"[",
"'name'",
"]",
".",
"lower",
"(",
")",
"not",
"in",
"node",
".",
"attri... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _Ec2Service.find_usage | Determine the current usage for each limit of this service,
and update corresponding Limit via
:py:meth:`~.AwsLimit._add_current_usage`. | awslimitchecker/services/ec2.py | def find_usage(self):
"""
Determine the current usage for each limit of this service,
and update corresponding Limit via
:py:meth:`~.AwsLimit._add_current_usage`.
"""
logger.debug("Checking usage for service %s", self.service_name)
self.connect()
self.conn... | def find_usage(self):
"""
Determine the current usage for each limit of this service,
and update corresponding Limit via
:py:meth:`~.AwsLimit._add_current_usage`.
"""
logger.debug("Checking usage for service %s", self.service_name)
self.connect()
self.conn... | [
"Determine",
"the",
"current",
"usage",
"for",
"each",
"limit",
"of",
"this",
"service",
"and",
"update",
"corresponding",
"Limit",
"via",
":",
"py",
":",
"meth",
":",
"~",
".",
"AwsLimit",
".",
"_add_current_usage",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/ec2.py#L60-L78 | [
"def",
"find_usage",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Checking usage for service %s\"",
",",
"self",
".",
"service_name",
")",
"self",
".",
"connect",
"(",
")",
"self",
".",
"connect_resource",
"(",
")",
"for",
"lim",
"in",
"self",
".... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _Ec2Service._find_usage_instances | calculate On-Demand instance usage for all types and update Limits | awslimitchecker/services/ec2.py | def _find_usage_instances(self):
"""calculate On-Demand instance usage for all types and update Limits"""
# update our limits with usage
inst_usage = self._instance_usage()
res_usage = self._get_reserved_instance_count()
logger.debug('Reserved instance count: %s', res_usage)
... | def _find_usage_instances(self):
"""calculate On-Demand instance usage for all types and update Limits"""
# update our limits with usage
inst_usage = self._instance_usage()
res_usage = self._get_reserved_instance_count()
logger.debug('Reserved instance count: %s', res_usage)
... | [
"calculate",
"On",
"-",
"Demand",
"instance",
"usage",
"for",
"all",
"types",
"and",
"update",
"Limits"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/ec2.py#L80-L129 | [
"def",
"_find_usage_instances",
"(",
"self",
")",
":",
"# update our limits with usage",
"inst_usage",
"=",
"self",
".",
"_instance_usage",
"(",
")",
"res_usage",
"=",
"self",
".",
"_get_reserved_instance_count",
"(",
")",
"logger",
".",
"debug",
"(",
"'Reserved ins... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _Ec2Service._find_usage_spot_instances | calculate spot instance request usage and update Limits | awslimitchecker/services/ec2.py | def _find_usage_spot_instances(self):
"""calculate spot instance request usage and update Limits"""
logger.debug('Getting spot instance request usage')
try:
res = self.conn.describe_spot_instance_requests()
except botocore.exceptions.ClientError as e:
if e.respons... | def _find_usage_spot_instances(self):
"""calculate spot instance request usage and update Limits"""
logger.debug('Getting spot instance request usage')
try:
res = self.conn.describe_spot_instance_requests()
except botocore.exceptions.ClientError as e:
if e.respons... | [
"calculate",
"spot",
"instance",
"request",
"usage",
"and",
"update",
"Limits"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/ec2.py#L131-L152 | [
"def",
"_find_usage_spot_instances",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"'Getting spot instance request usage'",
")",
"try",
":",
"res",
"=",
"self",
".",
"conn",
".",
"describe_spot_instance_requests",
"(",
")",
"except",
"botocore",
".",
"except... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _Ec2Service._find_usage_spot_fleets | calculate spot fleet request usage and update Limits | awslimitchecker/services/ec2.py | def _find_usage_spot_fleets(self):
"""calculate spot fleet request usage and update Limits"""
logger.debug('Getting spot fleet request usage')
try:
res = self.conn.describe_spot_fleet_requests()
except botocore.exceptions.ClientError as e:
if e.response['Error']['... | def _find_usage_spot_fleets(self):
"""calculate spot fleet request usage and update Limits"""
logger.debug('Getting spot fleet request usage')
try:
res = self.conn.describe_spot_fleet_requests()
except botocore.exceptions.ClientError as e:
if e.response['Error']['... | [
"calculate",
"spot",
"fleet",
"request",
"usage",
"and",
"update",
"Limits"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/ec2.py#L154-L194 | [
"def",
"_find_usage_spot_fleets",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"'Getting spot fleet request usage'",
")",
"try",
":",
"res",
"=",
"self",
".",
"conn",
".",
"describe_spot_fleet_requests",
"(",
")",
"except",
"botocore",
".",
"exceptions",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _Ec2Service._get_reserved_instance_count | For each availability zone, get the count of current instance
reservations of each instance type. Return as a nested
dict of AZ name to dict of instance type to reservation count.
:rtype: dict | awslimitchecker/services/ec2.py | def _get_reserved_instance_count(self):
"""
For each availability zone, get the count of current instance
reservations of each instance type. Return as a nested
dict of AZ name to dict of instance type to reservation count.
:rtype: dict
"""
reservations = default... | def _get_reserved_instance_count(self):
"""
For each availability zone, get the count of current instance
reservations of each instance type. Return as a nested
dict of AZ name to dict of instance type to reservation count.
:rtype: dict
"""
reservations = default... | [
"For",
"each",
"availability",
"zone",
"get",
"the",
"count",
"of",
"current",
"instance",
"reservations",
"of",
"each",
"instance",
"type",
".",
"Return",
"as",
"a",
"nested",
"dict",
"of",
"AZ",
"name",
"to",
"dict",
"of",
"instance",
"type",
"to",
"rese... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/ec2.py#L196-L224 | [
"def",
"_get_reserved_instance_count",
"(",
"self",
")",
":",
"reservations",
"=",
"defaultdict",
"(",
"int",
")",
"az_to_res",
"=",
"{",
"}",
"logger",
".",
"debug",
"(",
"\"Getting reserved instance information\"",
")",
"res",
"=",
"self",
".",
"conn",
".",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _Ec2Service._instance_usage | Find counts of currently-running EC2 Instances
(On-Demand or Reserved) by placement (Availability
Zone) and instance type (size). Return as a nested dict
of AZ name to dict of instance type to count.
:rtype: dict | awslimitchecker/services/ec2.py | def _instance_usage(self):
"""
Find counts of currently-running EC2 Instances
(On-Demand or Reserved) by placement (Availability
Zone) and instance type (size). Return as a nested dict
of AZ name to dict of instance type to count.
:rtype: dict
"""
# On-De... | def _instance_usage(self):
"""
Find counts of currently-running EC2 Instances
(On-Demand or Reserved) by placement (Availability
Zone) and instance type (size). Return as a nested dict
of AZ name to dict of instance type to count.
:rtype: dict
"""
# On-De... | [
"Find",
"counts",
"of",
"currently",
"-",
"running",
"EC2",
"Instances",
"(",
"On",
"-",
"Demand",
"or",
"Reserved",
")",
"by",
"placement",
"(",
"Availability",
"Zone",
")",
"and",
"instance",
"type",
"(",
"size",
")",
".",
"Return",
"as",
"a",
"nested"... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/ec2.py#L226-L259 | [
"def",
"_instance_usage",
"(",
"self",
")",
":",
"# On-Demand instances by type",
"ondemand",
"=",
"{",
"}",
"for",
"t",
"in",
"self",
".",
"_instance_types",
"(",
")",
":",
"ondemand",
"[",
"t",
"]",
"=",
"0",
"az_to_inst",
"=",
"{",
"}",
"logger",
".",... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _Ec2Service.get_limits | Return all known limits for this service, as a dict of their names
to :py:class:`~.AwsLimit` objects.
:returns: dict of limit names to :py:class:`~.AwsLimit` objects
:rtype: dict | awslimitchecker/services/ec2.py | def get_limits(self):
"""
Return all known limits for this service, as a dict of their names
to :py:class:`~.AwsLimit` objects.
:returns: dict of limit names to :py:class:`~.AwsLimit` objects
:rtype: dict
"""
if self.limits != {}:
return self.limits
... | def get_limits(self):
"""
Return all known limits for this service, as a dict of their names
to :py:class:`~.AwsLimit` objects.
:returns: dict of limit names to :py:class:`~.AwsLimit` objects
:rtype: dict
"""
if self.limits != {}:
return self.limits
... | [
"Return",
"all",
"known",
"limits",
"for",
"this",
"service",
"as",
"a",
"dict",
"of",
"their",
"names",
"to",
":",
"py",
":",
"class",
":",
"~",
".",
"AwsLimit",
"objects",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/ec2.py#L261-L276 | [
"def",
"get_limits",
"(",
"self",
")",
":",
"if",
"self",
".",
"limits",
"!=",
"{",
"}",
":",
"return",
"self",
".",
"limits",
"limits",
"=",
"{",
"}",
"limits",
".",
"update",
"(",
"self",
".",
"_get_limits_instances",
"(",
")",
")",
"limits",
".",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _Ec2Service._update_limits_from_api | Query EC2's DescribeAccountAttributes API action, and update limits
with the quotas returned. Updates ``self.limits``. | awslimitchecker/services/ec2.py | def _update_limits_from_api(self):
"""
Query EC2's DescribeAccountAttributes API action, and update limits
with the quotas returned. Updates ``self.limits``.
"""
self.connect()
self.connect_resource()
logger.info("Querying EC2 DescribeAccountAttributes for limits"... | def _update_limits_from_api(self):
"""
Query EC2's DescribeAccountAttributes API action, and update limits
with the quotas returned. Updates ``self.limits``.
"""
self.connect()
self.connect_resource()
logger.info("Querying EC2 DescribeAccountAttributes for limits"... | [
"Query",
"EC2",
"s",
"DescribeAccountAttributes",
"API",
"action",
"and",
"update",
"limits",
"with",
"the",
"quotas",
"returned",
".",
"Updates",
"self",
".",
"limits",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/ec2.py#L278-L304 | [
"def",
"_update_limits_from_api",
"(",
"self",
")",
":",
"self",
".",
"connect",
"(",
")",
"self",
".",
"connect_resource",
"(",
")",
"logger",
".",
"info",
"(",
"\"Querying EC2 DescribeAccountAttributes for limits\"",
")",
"# no need to paginate",
"attribs",
"=",
"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _Ec2Service._get_limits_instances | Return a dict of limits for EC2 instances only.
This method should only be used internally by
:py:meth:~.get_limits`.
:rtype: dict | awslimitchecker/services/ec2.py | def _get_limits_instances(self):
"""
Return a dict of limits for EC2 instances only.
This method should only be used internally by
:py:meth:~.get_limits`.
:rtype: dict
"""
# from: http://aws.amazon.com/ec2/faqs/
# (On-Demand, Reserved, Spot)
defau... | def _get_limits_instances(self):
"""
Return a dict of limits for EC2 instances only.
This method should only be used internally by
:py:meth:~.get_limits`.
:rtype: dict
"""
# from: http://aws.amazon.com/ec2/faqs/
# (On-Demand, Reserved, Spot)
defau... | [
"Return",
"a",
"dict",
"of",
"limits",
"for",
"EC2",
"instances",
"only",
".",
"This",
"method",
"should",
"only",
"be",
"used",
"internally",
"by",
":",
"py",
":",
"meth",
":",
"~",
".",
"get_limits",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/ec2.py#L306-L392 | [
"def",
"_get_limits_instances",
"(",
"self",
")",
":",
"# from: http://aws.amazon.com/ec2/faqs/",
"# (On-Demand, Reserved, Spot)",
"default_limits",
"=",
"(",
"20",
",",
"20",
",",
"5",
")",
"special_limits",
"=",
"{",
"'c4.4xlarge'",
":",
"(",
"10",
",",
"20",
",... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _Ec2Service._get_limits_spot | Return a dict of limits for spot requests only.
This method should only be used internally by
:py:meth:~.get_limits`.
:rtype: dict | awslimitchecker/services/ec2.py | def _get_limits_spot(self):
"""
Return a dict of limits for spot requests only.
This method should only be used internally by
:py:meth:~.get_limits`.
:rtype: dict
"""
limits = {}
limits['Max spot instance requests per region'] = AwsLimit(
'Max... | def _get_limits_spot(self):
"""
Return a dict of limits for spot requests only.
This method should only be used internally by
:py:meth:~.get_limits`.
:rtype: dict
"""
limits = {}
limits['Max spot instance requests per region'] = AwsLimit(
'Max... | [
"Return",
"a",
"dict",
"of",
"limits",
"for",
"spot",
"requests",
"only",
".",
"This",
"method",
"should",
"only",
"be",
"used",
"internally",
"by",
":",
"py",
":",
"meth",
":",
"~",
".",
"get_limits",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/ec2.py#L394-L443 | [
"def",
"_get_limits_spot",
"(",
"self",
")",
":",
"limits",
"=",
"{",
"}",
"limits",
"[",
"'Max spot instance requests per region'",
"]",
"=",
"AwsLimit",
"(",
"'Max spot instance requests per region'",
",",
"self",
",",
"20",
",",
"self",
".",
"warning_threshold",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _Ec2Service._find_usage_networking_sgs | calculate usage for VPC-related things | awslimitchecker/services/ec2.py | def _find_usage_networking_sgs(self):
"""calculate usage for VPC-related things"""
logger.debug("Getting usage for EC2 VPC resources")
sgs_per_vpc = defaultdict(int)
rules_per_sg = defaultdict(int)
for sg in self.resource_conn.security_groups.all():
if sg.vpc_id is no... | def _find_usage_networking_sgs(self):
"""calculate usage for VPC-related things"""
logger.debug("Getting usage for EC2 VPC resources")
sgs_per_vpc = defaultdict(int)
rules_per_sg = defaultdict(int)
for sg in self.resource_conn.security_groups.all():
if sg.vpc_id is no... | [
"calculate",
"usage",
"for",
"VPC",
"-",
"related",
"things"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/ec2.py#L445-L466 | [
"def",
"_find_usage_networking_sgs",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Getting usage for EC2 VPC resources\"",
")",
"sgs_per_vpc",
"=",
"defaultdict",
"(",
"int",
")",
"rules_per_sg",
"=",
"defaultdict",
"(",
"int",
")",
"for",
"sg",
"in",
"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _Ec2Service._get_limits_networking | Return a dict of VPC-related limits only.
This method should only be used internally by
:py:meth:~.get_limits`.
:rtype: dict | awslimitchecker/services/ec2.py | def _get_limits_networking(self):
"""
Return a dict of VPC-related limits only.
This method should only be used internally by
:py:meth:~.get_limits`.
:rtype: dict
"""
limits = {}
limits['Security groups per VPC'] = AwsLimit(
'Security groups p... | def _get_limits_networking(self):
"""
Return a dict of VPC-related limits only.
This method should only be used internally by
:py:meth:~.get_limits`.
:rtype: dict
"""
limits = {}
limits['Security groups per VPC'] = AwsLimit(
'Security groups p... | [
"Return",
"a",
"dict",
"of",
"VPC",
"-",
"related",
"limits",
"only",
".",
"This",
"method",
"should",
"only",
"be",
"used",
"internally",
"by",
":",
"py",
":",
"meth",
":",
"~",
".",
"get_limits",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/ec2.py#L496-L552 | [
"def",
"_get_limits_networking",
"(",
"self",
")",
":",
"limits",
"=",
"{",
"}",
"limits",
"[",
"'Security groups per VPC'",
"]",
"=",
"AwsLimit",
"(",
"'Security groups per VPC'",
",",
"self",
",",
"500",
",",
"self",
".",
"warning_threshold",
",",
"self",
".... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _Ec2Service._instance_types | Return a list of all known EC2 instance types
:returns: list of all valid known EC2 instance types
:rtype: list | awslimitchecker/services/ec2.py | def _instance_types(self):
"""
Return a list of all known EC2 instance types
:returns: list of all valid known EC2 instance types
:rtype: list
"""
GENERAL_TYPES = [
'a1.2xlarge',
'a1.4xlarge',
'a1.large',
'a1.medium',
... | def _instance_types(self):
"""
Return a list of all known EC2 instance types
:returns: list of all valid known EC2 instance types
:rtype: list
"""
GENERAL_TYPES = [
'a1.2xlarge',
'a1.4xlarge',
'a1.large',
'a1.medium',
... | [
"Return",
"a",
"list",
"of",
"all",
"known",
"EC2",
"instance",
"types"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/ec2.py#L585-L825 | [
"def",
"_instance_types",
"(",
"self",
")",
":",
"GENERAL_TYPES",
"=",
"[",
"'a1.2xlarge'",
",",
"'a1.4xlarge'",
",",
"'a1.large'",
",",
"'a1.medium'",
",",
"'a1.xlarge'",
",",
"'t2.nano'",
",",
"'t2.micro'",
",",
"'t2.small'",
",",
"'t2.medium'",
",",
"'t2.larg... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _RDSService.find_usage | Determine the current usage for each limit of this service,
and update corresponding Limit via
:py:meth:`~.AwsLimit._add_current_usage`. | awslimitchecker/services/rds.py | def find_usage(self):
"""
Determine the current usage for each limit of this service,
and update corresponding Limit via
:py:meth:`~.AwsLimit._add_current_usage`.
"""
logger.debug("Checking usage for service %s", self.service_name)
self.connect()
for lim i... | def find_usage(self):
"""
Determine the current usage for each limit of this service,
and update corresponding Limit via
:py:meth:`~.AwsLimit._add_current_usage`.
"""
logger.debug("Checking usage for service %s", self.service_name)
self.connect()
for lim i... | [
"Determine",
"the",
"current",
"usage",
"for",
"each",
"limit",
"of",
"this",
"service",
"and",
"update",
"corresponding",
"Limit",
"via",
":",
"py",
":",
"meth",
":",
"~",
".",
"AwsLimit",
".",
"_add_current_usage",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/rds.py#L73-L89 | [
"def",
"find_usage",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Checking usage for service %s\"",
",",
"self",
".",
"service_name",
")",
"self",
".",
"connect",
"(",
")",
"for",
"lim",
"in",
"self",
".",
"limits",
".",
"values",
"(",
")",
":"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _RDSService._find_usage_instances | find usage for DB Instances and related limits | awslimitchecker/services/rds.py | def _find_usage_instances(self):
"""find usage for DB Instances and related limits"""
paginator = self.conn.get_paginator('describe_db_instances')
for page in paginator.paginate():
for instance in page['DBInstances']:
self.limits['Read replicas per master']._add_curre... | def _find_usage_instances(self):
"""find usage for DB Instances and related limits"""
paginator = self.conn.get_paginator('describe_db_instances')
for page in paginator.paginate():
for instance in page['DBInstances']:
self.limits['Read replicas per master']._add_curre... | [
"find",
"usage",
"for",
"DB",
"Instances",
"and",
"related",
"limits"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/rds.py#L91-L100 | [
"def",
"_find_usage_instances",
"(",
"self",
")",
":",
"paginator",
"=",
"self",
".",
"conn",
".",
"get_paginator",
"(",
"'describe_db_instances'",
")",
"for",
"page",
"in",
"paginator",
".",
"paginate",
"(",
")",
":",
"for",
"instance",
"in",
"page",
"[",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _RDSService._find_usage_subnet_groups | find usage for subnet groups | awslimitchecker/services/rds.py | def _find_usage_subnet_groups(self):
"""find usage for subnet groups"""
paginator = self.conn.get_paginator('describe_db_subnet_groups')
for page in paginator.paginate():
for group in page['DBSubnetGroups']:
self.limits['Subnets per Subnet Group']._add_current_usage(
... | def _find_usage_subnet_groups(self):
"""find usage for subnet groups"""
paginator = self.conn.get_paginator('describe_db_subnet_groups')
for page in paginator.paginate():
for group in page['DBSubnetGroups']:
self.limits['Subnets per Subnet Group']._add_current_usage(
... | [
"find",
"usage",
"for",
"subnet",
"groups"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/rds.py#L102-L111 | [
"def",
"_find_usage_subnet_groups",
"(",
"self",
")",
":",
"paginator",
"=",
"self",
".",
"conn",
".",
"get_paginator",
"(",
"'describe_db_subnet_groups'",
")",
"for",
"page",
"in",
"paginator",
".",
"paginate",
"(",
")",
":",
"for",
"group",
"in",
"page",
"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _RDSService._find_usage_security_groups | find usage for security groups | awslimitchecker/services/rds.py | def _find_usage_security_groups(self):
"""find usage for security groups"""
vpc_count = 0
paginator = self.conn.get_paginator('describe_db_security_groups')
for page in paginator.paginate():
for group in page['DBSecurityGroups']:
if 'VpcId' in group and group... | def _find_usage_security_groups(self):
"""find usage for security groups"""
vpc_count = 0
paginator = self.conn.get_paginator('describe_db_security_groups')
for page in paginator.paginate():
for group in page['DBSecurityGroups']:
if 'VpcId' in group and group... | [
"find",
"usage",
"for",
"security",
"groups"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/rds.py#L113-L131 | [
"def",
"_find_usage_security_groups",
"(",
"self",
")",
":",
"vpc_count",
"=",
"0",
"paginator",
"=",
"self",
".",
"conn",
".",
"get_paginator",
"(",
"'describe_db_security_groups'",
")",
"for",
"page",
"in",
"paginator",
".",
"paginate",
"(",
")",
":",
"for",... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _RDSService.get_limits | Return all known limits for this service, as a dict of their names
to :py:class:`~.AwsLimit` objects.
:returns: dict of limit names to :py:class:`~.AwsLimit` objects
:rtype: dict | awslimitchecker/services/rds.py | def get_limits(self):
"""
Return all known limits for this service, as a dict of their names
to :py:class:`~.AwsLimit` objects.
:returns: dict of limit names to :py:class:`~.AwsLimit` objects
:rtype: dict
"""
if self.limits != {}:
return self.limits
... | def get_limits(self):
"""
Return all known limits for this service, as a dict of their names
to :py:class:`~.AwsLimit` objects.
:returns: dict of limit names to :py:class:`~.AwsLimit` objects
:rtype: dict
"""
if self.limits != {}:
return self.limits
... | [
"Return",
"all",
"known",
"limits",
"for",
"this",
"service",
"as",
"a",
"dict",
"of",
"their",
"names",
"to",
":",
"py",
":",
"class",
":",
"~",
".",
"AwsLimit",
"objects",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/rds.py#L133-L272 | [
"def",
"get_limits",
"(",
"self",
")",
":",
"if",
"self",
".",
"limits",
"!=",
"{",
"}",
":",
"return",
"self",
".",
"limits",
"limits",
"=",
"{",
"}",
"limits",
"[",
"'DB instances'",
"]",
"=",
"AwsLimit",
"(",
"'DB instances'",
",",
"self",
",",
"4... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _RDSService._update_limits_from_api | Query RDS's DescribeAccountAttributes API action, and update limits
with the quotas returned. Updates ``self.limits``.
We ignore the usage information from the API, | awslimitchecker/services/rds.py | def _update_limits_from_api(self):
"""
Query RDS's DescribeAccountAttributes API action, and update limits
with the quotas returned. Updates ``self.limits``.
We ignore the usage information from the API,
"""
self.connect()
logger.info("Querying RDS DescribeAccoun... | def _update_limits_from_api(self):
"""
Query RDS's DescribeAccountAttributes API action, and update limits
with the quotas returned. Updates ``self.limits``.
We ignore the usage information from the API,
"""
self.connect()
logger.info("Querying RDS DescribeAccoun... | [
"Query",
"RDS",
"s",
"DescribeAccountAttributes",
"API",
"action",
"and",
"update",
"limits",
"with",
"the",
"quotas",
"returned",
".",
"Updates",
"self",
".",
"limits",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/rds.py#L274-L294 | [
"def",
"_update_limits_from_api",
"(",
"self",
")",
":",
"self",
".",
"connect",
"(",
")",
"logger",
".",
"info",
"(",
"\"Querying RDS DescribeAccountAttributes for limits\"",
")",
"lims",
"=",
"self",
".",
"conn",
".",
"describe_account_attributes",
"(",
")",
"["... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _FirehoseService.find_usage | Determine the current usage for each limit of this service,
and update corresponding Limit via
:py:meth:`~.AwsLimit._add_current_usage`. | awslimitchecker/services/firehose.py | def find_usage(self):
"""
Determine the current usage for each limit of this service,
and update corresponding Limit via
:py:meth:`~.AwsLimit._add_current_usage`.
"""
logger.debug("Checking usage for service %s", self.service_name)
self.connect()
for lim i... | def find_usage(self):
"""
Determine the current usage for each limit of this service,
and update corresponding Limit via
:py:meth:`~.AwsLimit._add_current_usage`.
"""
logger.debug("Checking usage for service %s", self.service_name)
self.connect()
for lim i... | [
"Determine",
"the",
"current",
"usage",
"for",
"each",
"limit",
"of",
"this",
"service",
"and",
"update",
"corresponding",
"Limit",
"via",
":",
"py",
":",
"meth",
":",
"~",
".",
"AwsLimit",
".",
"_add_current_usage",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/firehose.py#L55-L75 | [
"def",
"find_usage",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Checking usage for service %s\"",
",",
"self",
".",
"service_name",
")",
"self",
".",
"connect",
"(",
")",
"for",
"lim",
"in",
"self",
".",
"limits",
".",
"values",
"(",
")",
":"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _CloudTrailService._find_usage_cloudtrail | Calculate current usage for CloudTrail related metrics | awslimitchecker/services/cloudtrail.py | def _find_usage_cloudtrail(self):
"""Calculate current usage for CloudTrail related metrics"""
trail_list = self.conn.describe_trails()['trailList']
trail_count = len(trail_list) if trail_list else 0
for trail in trail_list:
data_resource_count = 0
if self.conn.... | def _find_usage_cloudtrail(self):
"""Calculate current usage for CloudTrail related metrics"""
trail_list = self.conn.describe_trails()['trailList']
trail_count = len(trail_list) if trail_list else 0
for trail in trail_list:
data_resource_count = 0
if self.conn.... | [
"Calculate",
"current",
"usage",
"for",
"CloudTrail",
"related",
"metrics"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/cloudtrail.py#L71-L106 | [
"def",
"_find_usage_cloudtrail",
"(",
"self",
")",
":",
"trail_list",
"=",
"self",
".",
"conn",
".",
"describe_trails",
"(",
")",
"[",
"'trailList'",
"]",
"trail_count",
"=",
"len",
"(",
"trail_list",
")",
"if",
"trail_list",
"else",
"0",
"for",
"trail",
"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _CloudTrailService.get_limits | Return all known limits for this service, as a dict of their names
to :py:class:`~.AwsLimit` objects.
:returns: dict of limit names to :py:class:`~.AwsLimit` objects
:rtype: dict | awslimitchecker/services/cloudtrail.py | def get_limits(self):
"""
Return all known limits for this service, as a dict of their names
to :py:class:`~.AwsLimit` objects.
:returns: dict of limit names to :py:class:`~.AwsLimit` objects
:rtype: dict
"""
logger.debug("Gathering %s's limits from AWS", self.se... | def get_limits(self):
"""
Return all known limits for this service, as a dict of their names
to :py:class:`~.AwsLimit` objects.
:returns: dict of limit names to :py:class:`~.AwsLimit` objects
:rtype: dict
"""
logger.debug("Gathering %s's limits from AWS", self.se... | [
"Return",
"all",
"known",
"limits",
"for",
"this",
"service",
"as",
"a",
"dict",
"of",
"their",
"names",
"to",
":",
"py",
":",
"class",
":",
"~",
".",
"AwsLimit",
"objects",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/cloudtrail.py#L108-L152 | [
"def",
"get_limits",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Gathering %s's limits from AWS\"",
",",
"self",
".",
"service_name",
")",
"if",
"self",
".",
"limits",
":",
"return",
"self",
".",
"limits",
"limits",
"=",
"{",
"}",
"limits",
"[",... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | ElementPlot.initialize_plot | Initializes a new plot object with the last available frame. | holoviews/plotting/plotly/element.py | def initialize_plot(self, ranges=None):
"""
Initializes a new plot object with the last available frame.
"""
# Get element key and ranges for frame
fig = self.generate_plot(self.keys[-1], ranges)
self.drawn = True
return fig | def initialize_plot(self, ranges=None):
"""
Initializes a new plot object with the last available frame.
"""
# Get element key and ranges for frame
fig = self.generate_plot(self.keys[-1], ranges)
self.drawn = True
return fig | [
"Initializes",
"a",
"new",
"plot",
"object",
"with",
"the",
"last",
"available",
"frame",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/plotly/element.py#L103-L110 | [
"def",
"initialize_plot",
"(",
"self",
",",
"ranges",
"=",
"None",
")",
":",
"# Get element key and ranges for frame",
"fig",
"=",
"self",
".",
"generate_plot",
"(",
"self",
".",
"keys",
"[",
"-",
"1",
"]",
",",
"ranges",
")",
"self",
".",
"drawn",
"=",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | ElementPlot._get_axis_dims | Returns the dimensions corresponding to each axis.
Should return a list of dimensions or list of lists of
dimensions, which will be formatted to label the axis
and to link axes. | holoviews/plotting/plotly/element.py | def _get_axis_dims(self, element):
"""Returns the dimensions corresponding to each axis.
Should return a list of dimensions or list of lists of
dimensions, which will be formatted to label the axis
and to link axes.
"""
dims = element.dimensions()[:3]
pad = [None... | def _get_axis_dims(self, element):
"""Returns the dimensions corresponding to each axis.
Should return a list of dimensions or list of lists of
dimensions, which will be formatted to label the axis
and to link axes.
"""
dims = element.dimensions()[:3]
pad = [None... | [
"Returns",
"the",
"dimensions",
"corresponding",
"to",
"each",
"axis",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/plotly/element.py#L207-L216 | [
"def",
"_get_axis_dims",
"(",
"self",
",",
"element",
")",
":",
"dims",
"=",
"element",
".",
"dimensions",
"(",
")",
"[",
":",
"3",
"]",
"pad",
"=",
"[",
"None",
"]",
"*",
"max",
"(",
"3",
"-",
"len",
"(",
"dims",
")",
",",
"0",
")",
"return",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | ElementPlot.update_frame | Updates an existing plot with data corresponding
to the key. | holoviews/plotting/plotly/element.py | def update_frame(self, key, ranges=None, element=None):
"""
Updates an existing plot with data corresponding
to the key.
"""
self.generate_plot(key, ranges, element) | def update_frame(self, key, ranges=None, element=None):
"""
Updates an existing plot with data corresponding
to the key.
"""
self.generate_plot(key, ranges, element) | [
"Updates",
"an",
"existing",
"plot",
"with",
"data",
"corresponding",
"to",
"the",
"key",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/plotly/element.py#L358-L363 | [
"def",
"update_frame",
"(",
"self",
",",
"key",
",",
"ranges",
"=",
"None",
",",
"element",
"=",
"None",
")",
":",
"self",
".",
"generate_plot",
"(",
"key",
",",
"ranges",
",",
"element",
")"
] | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | OverlayPlot.initialize_plot | Initializes a new plot object with the last available frame. | holoviews/plotting/plotly/element.py | def initialize_plot(self, ranges=None):
"""
Initializes a new plot object with the last available frame.
"""
# Get element key and ranges for frame
return self.generate_plot(list(self.hmap.data.keys())[0], ranges) | def initialize_plot(self, ranges=None):
"""
Initializes a new plot object with the last available frame.
"""
# Get element key and ranges for frame
return self.generate_plot(list(self.hmap.data.keys())[0], ranges) | [
"Initializes",
"a",
"new",
"plot",
"object",
"with",
"the",
"last",
"available",
"frame",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/plotly/element.py#L453-L458 | [
"def",
"initialize_plot",
"(",
"self",
",",
"ranges",
"=",
"None",
")",
":",
"# Get element key and ranges for frame",
"return",
"self",
".",
"generate_plot",
"(",
"list",
"(",
"self",
".",
"hmap",
".",
"data",
".",
"keys",
"(",
")",
")",
"[",
"0",
"]",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | NotebookArchive.get_namespace | Find the name the user is using to access holoviews. | holoviews/ipython/archive.py | def get_namespace(self):
"""
Find the name the user is using to access holoviews.
"""
if 'holoviews' not in sys.modules:
raise ImportError('HoloViews does not seem to be imported')
matches = [k for k,v in get_ipython().user_ns.items() # noqa (get_ipython)
i... | def get_namespace(self):
"""
Find the name the user is using to access holoviews.
"""
if 'holoviews' not in sys.modules:
raise ImportError('HoloViews does not seem to be imported')
matches = [k for k,v in get_ipython().user_ns.items() # noqa (get_ipython)
i... | [
"Find",
"the",
"name",
"the",
"user",
"is",
"using",
"to",
"access",
"holoviews",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/ipython/archive.py#L101-L111 | [
"def",
"get_namespace",
"(",
"self",
")",
":",
"if",
"'holoviews'",
"not",
"in",
"sys",
".",
"modules",
":",
"raise",
"ImportError",
"(",
"'HoloViews does not seem to be imported'",
")",
"matches",
"=",
"[",
"k",
"for",
"k",
",",
"v",
"in",
"get_ipython",
"(... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | NotebookArchive.last_export_status | Helper to show the status of the last call to the export method. | holoviews/ipython/archive.py | def last_export_status(self):
"Helper to show the status of the last call to the export method."
if self.export_success is True:
print("The last call to holoviews.archive.export was successful.")
return
elif self.export_success is None:
print("Status of the la... | def last_export_status(self):
"Helper to show the status of the last call to the export method."
if self.export_success is True:
print("The last call to holoviews.archive.export was successful.")
return
elif self.export_success is None:
print("Status of the la... | [
"Helper",
"to",
"show",
"the",
"status",
"of",
"the",
"last",
"call",
"to",
"the",
"export",
"method",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/ipython/archive.py#L114-L127 | [
"def",
"last_export_status",
"(",
"self",
")",
":",
"if",
"self",
".",
"export_success",
"is",
"True",
":",
"print",
"(",
"\"The last call to holoviews.archive.export was successful.\"",
")",
"return",
"elif",
"self",
".",
"export_success",
"is",
"None",
":",
"print... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | NotebookArchive.auto | Method to enable or disable automatic capture, allowing you to
simultaneously set the instance parameters. | holoviews/ipython/archive.py | def auto(self, enabled=True, **kwargs):
"""
Method to enable or disable automatic capture, allowing you to
simultaneously set the instance parameters.
"""
self.namespace = self.get_namespace()
self.notebook_name = "{notebook}"
self._timestamp = tuple(time.localtim... | def auto(self, enabled=True, **kwargs):
"""
Method to enable or disable automatic capture, allowing you to
simultaneously set the instance parameters.
"""
self.namespace = self.get_namespace()
self.notebook_name = "{notebook}"
self._timestamp = tuple(time.localtim... | [
"Method",
"to",
"enable",
"or",
"disable",
"automatic",
"capture",
"allowing",
"you",
"to",
"simultaneously",
"set",
"the",
"instance",
"parameters",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/ipython/archive.py#L130-L150 | [
"def",
"auto",
"(",
"self",
",",
"enabled",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"namespace",
"=",
"self",
".",
"get_namespace",
"(",
")",
"self",
".",
"notebook_name",
"=",
"\"{notebook}\"",
"self",
".",
"_timestamp",
"=",
"tup... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | NotebookArchive.export | Get the current notebook data and export. | holoviews/ipython/archive.py | def export(self, timestamp=None):
"""
Get the current notebook data and export.
"""
if self._timestamp is None:
raise Exception("No timestamp set. Has the archive been initialized?")
if self.skip_notebook_export:
super(NotebookArchive, self).export(timesta... | def export(self, timestamp=None):
"""
Get the current notebook data and export.
"""
if self._timestamp is None:
raise Exception("No timestamp set. Has the archive been initialized?")
if self.skip_notebook_export:
super(NotebookArchive, self).export(timesta... | [
"Get",
"the",
"current",
"notebook",
"data",
"and",
"export",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/ipython/archive.py#L152-L180 | [
"def",
"export",
"(",
"self",
",",
"timestamp",
"=",
"None",
")",
":",
"if",
"self",
".",
"_timestamp",
"is",
"None",
":",
"raise",
"Exception",
"(",
"\"No timestamp set. Has the archive been initialized?\"",
")",
"if",
"self",
".",
"skip_notebook_export",
":",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | NotebookArchive.add | Similar to FileArchive.add but accepts html strings for substitution | holoviews/ipython/archive.py | def add(self, obj=None, filename=None, data=None, info={}, html=None):
"Similar to FileArchive.add but accepts html strings for substitution"
initial_last_key = list(self._files.keys())[-1] if len(self) else None
if self._auto:
exporters = self.exporters[:]
# Can only ass... | def add(self, obj=None, filename=None, data=None, info={}, html=None):
"Similar to FileArchive.add but accepts html strings for substitution"
initial_last_key = list(self._files.keys())[-1] if len(self) else None
if self._auto:
exporters = self.exporters[:]
# Can only ass... | [
"Similar",
"to",
"FileArchive",
".",
"add",
"but",
"accepts",
"html",
"strings",
"for",
"substitution"
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/ipython/archive.py#L183-L200 | [
"def",
"add",
"(",
"self",
",",
"obj",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"data",
"=",
"None",
",",
"info",
"=",
"{",
"}",
",",
"html",
"=",
"None",
")",
":",
"initial_last_key",
"=",
"list",
"(",
"self",
".",
"_files",
".",
"keys",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | NotebookArchive._export_with_html | Computes substitutions before using nbconvert with preprocessors | holoviews/ipython/archive.py | def _export_with_html(self): # pragma: no cover
"Computes substitutions before using nbconvert with preprocessors"
self.export_success = False
try:
tstamp = time.strftime(self.timestamp_format, self._timestamp)
substitutions = {}
for (basena... | def _export_with_html(self): # pragma: no cover
"Computes substitutions before using nbconvert with preprocessors"
self.export_success = False
try:
tstamp = time.strftime(self.timestamp_format, self._timestamp)
substitutions = {}
for (basena... | [
"Computes",
"substitutions",
"before",
"using",
"nbconvert",
"with",
"preprocessors"
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/ipython/archive.py#L225-L274 | [
"def",
"_export_with_html",
"(",
"self",
")",
":",
"# pragma: no cover",
"self",
".",
"export_success",
"=",
"False",
"try",
":",
"tstamp",
"=",
"time",
".",
"strftime",
"(",
"self",
".",
"timestamp_format",
",",
"self",
".",
"_timestamp",
")",
"substitutions"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | NotebookArchive._get_notebook_node | Load captured notebook node | holoviews/ipython/archive.py | def _get_notebook_node(self): # pragma: no cover
"Load captured notebook node"
size = len(self._notebook_data)
if size == 0:
raise Exception("Captured buffer size for notebook node is zero.")
node = reader.reads(self._notebook_data)
self.nbversion = ... | def _get_notebook_node(self): # pragma: no cover
"Load captured notebook node"
size = len(self._notebook_data)
if size == 0:
raise Exception("Captured buffer size for notebook node is zero.")
node = reader.reads(self._notebook_data)
self.nbversion = ... | [
"Load",
"captured",
"notebook",
"node"
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/ipython/archive.py#L276-L283 | [
"def",
"_get_notebook_node",
"(",
"self",
")",
":",
"# pragma: no cover",
"size",
"=",
"len",
"(",
"self",
".",
"_notebook_data",
")",
"if",
"size",
"==",
"0",
":",
"raise",
"Exception",
"(",
"\"Captured buffer size for notebook node is zero.\"",
")",
"node",
"=",... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | mpl_to_bokeh | Utility to process style properties converting any
matplotlib specific options to their nearest bokeh
equivalent. | holoviews/plotting/bokeh/styles.py | def mpl_to_bokeh(properties):
"""
Utility to process style properties converting any
matplotlib specific options to their nearest bokeh
equivalent.
"""
new_properties = {}
for k, v in properties.items():
if isinstance(v, dict):
new_properties[k] = v
elif k == 's':... | def mpl_to_bokeh(properties):
"""
Utility to process style properties converting any
matplotlib specific options to their nearest bokeh
equivalent.
"""
new_properties = {}
for k, v in properties.items():
if isinstance(v, dict):
new_properties[k] = v
elif k == 's':... | [
"Utility",
"to",
"process",
"style",
"properties",
"converting",
"any",
"matplotlib",
"specific",
"options",
"to",
"their",
"nearest",
"bokeh",
"equivalent",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/styles.py#L61-L85 | [
"def",
"mpl_to_bokeh",
"(",
"properties",
")",
":",
"new_properties",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"properties",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"v",
",",
"dict",
")",
":",
"new_properties",
"[",
"k",
"]",
"=",
"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | validate | Validates a style and associated value.
Arguments
---------
style: str
The style to validate (e.g. 'color', 'size' or 'marker')
value:
The style value to validate
scalar: bool
Returns
-------
valid: boolean or None
If validation is supported returns boolean, othe... | holoviews/plotting/bokeh/styles.py | def validate(style, value, scalar=False):
"""
Validates a style and associated value.
Arguments
---------
style: str
The style to validate (e.g. 'color', 'size' or 'marker')
value:
The style value to validate
scalar: bool
Returns
-------
valid: boolean or None
... | def validate(style, value, scalar=False):
"""
Validates a style and associated value.
Arguments
---------
style: str
The style to validate (e.g. 'color', 'size' or 'marker')
value:
The style value to validate
scalar: bool
Returns
-------
valid: boolean or None
... | [
"Validates",
"a",
"style",
"and",
"associated",
"value",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/styles.py#L115-L140 | [
"def",
"validate",
"(",
"style",
",",
"value",
",",
"scalar",
"=",
"False",
")",
":",
"validator",
"=",
"get_validator",
"(",
"style",
")",
"if",
"validator",
"is",
"None",
":",
"return",
"None",
"if",
"isinstance",
"(",
"value",
",",
"(",
"np",
".",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | rgba_tuple | Ensures RGB(A) tuples in the range 0-1 are scaled to 0-255. | holoviews/plotting/bokeh/styles.py | def rgba_tuple(rgba):
"""
Ensures RGB(A) tuples in the range 0-1 are scaled to 0-255.
"""
if isinstance(rgba, tuple):
return tuple(int(c*255) if i<3 else c for i, c in enumerate(rgba))
else:
return COLOR_ALIASES.get(rgba, rgba) | def rgba_tuple(rgba):
"""
Ensures RGB(A) tuples in the range 0-1 are scaled to 0-255.
"""
if isinstance(rgba, tuple):
return tuple(int(c*255) if i<3 else c for i, c in enumerate(rgba))
else:
return COLOR_ALIASES.get(rgba, rgba) | [
"Ensures",
"RGB",
"(",
"A",
")",
"tuples",
"in",
"the",
"range",
"0",
"-",
"1",
"are",
"scaled",
"to",
"0",
"-",
"255",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/styles.py#L144-L151 | [
"def",
"rgba_tuple",
"(",
"rgba",
")",
":",
"if",
"isinstance",
"(",
"rgba",
",",
"tuple",
")",
":",
"return",
"tuple",
"(",
"int",
"(",
"c",
"*",
"255",
")",
"if",
"i",
"<",
"3",
"else",
"c",
"for",
"i",
",",
"c",
"in",
"enumerate",
"(",
"rgba... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | expand_batched_style | Computes styles applied to a batched plot by iterating over the
supplied list of style options and expanding any options found in
the supplied style dictionary returning a data and mapping defining
the data that should be added to the ColumnDataSource. | holoviews/plotting/bokeh/styles.py | def expand_batched_style(style, opts, mapping, nvals):
"""
Computes styles applied to a batched plot by iterating over the
supplied list of style options and expanding any options found in
the supplied style dictionary returning a data and mapping defining
the data that should be added to the Column... | def expand_batched_style(style, opts, mapping, nvals):
"""
Computes styles applied to a batched plot by iterating over the
supplied list of style options and expanding any options found in
the supplied style dictionary returning a data and mapping defining
the data that should be added to the Column... | [
"Computes",
"styles",
"applied",
"to",
"a",
"batched",
"plot",
"by",
"iterating",
"over",
"the",
"supplied",
"list",
"of",
"style",
"options",
"and",
"expanding",
"any",
"options",
"found",
"in",
"the",
"supplied",
"style",
"dictionary",
"returning",
"a",
"dat... | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/styles.py#L154-L193 | [
"def",
"expand_batched_style",
"(",
"style",
",",
"opts",
",",
"mapping",
",",
"nvals",
")",
":",
"opts",
"=",
"sorted",
"(",
"opts",
",",
"key",
"=",
"lambda",
"x",
":",
"x",
"in",
"[",
"'color'",
",",
"'alpha'",
"]",
")",
"applied_styles",
"=",
"se... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | ComparisonInterface.simple_equality | Classmethod equivalent to unittest.TestCase method (longMessage = False.) | holoviews/element/comparison.py | def simple_equality(cls, first, second, msg=None):
"""
Classmethod equivalent to unittest.TestCase method (longMessage = False.)
"""
if not first==second:
standardMsg = '%s != %s' % (safe_repr(first), safe_repr(second))
raise cls.failureException(msg or standardMs... | def simple_equality(cls, first, second, msg=None):
"""
Classmethod equivalent to unittest.TestCase method (longMessage = False.)
"""
if not first==second:
standardMsg = '%s != %s' % (safe_repr(first), safe_repr(second))
raise cls.failureException(msg or standardMs... | [
"Classmethod",
"equivalent",
"to",
"unittest",
".",
"TestCase",
"method",
"(",
"longMessage",
"=",
"False",
".",
")"
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/comparison.py#L50-L56 | [
"def",
"simple_equality",
"(",
"cls",
",",
"first",
",",
"second",
",",
"msg",
"=",
"None",
")",
":",
"if",
"not",
"first",
"==",
"second",
":",
"standardMsg",
"=",
"'%s != %s'",
"%",
"(",
"safe_repr",
"(",
"first",
")",
",",
"safe_repr",
"(",
"second"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | ComparisonInterface.assertEqual | Classmethod equivalent to unittest.TestCase method | holoviews/element/comparison.py | def assertEqual(cls, first, second, msg=None):
"""
Classmethod equivalent to unittest.TestCase method
"""
asserter = None
if type(first) is type(second):
asserter = cls.equality_type_funcs.get(type(first))
try: basestring = basestring # Pytho... | def assertEqual(cls, first, second, msg=None):
"""
Classmethod equivalent to unittest.TestCase method
"""
asserter = None
if type(first) is type(second):
asserter = cls.equality_type_funcs.get(type(first))
try: basestring = basestring # Pytho... | [
"Classmethod",
"equivalent",
"to",
"unittest",
".",
"TestCase",
"method"
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/comparison.py#L60-L81 | [
"def",
"assertEqual",
"(",
"cls",
",",
"first",
",",
"second",
",",
"msg",
"=",
"None",
")",
":",
"asserter",
"=",
"None",
"if",
"type",
"(",
"first",
")",
"is",
"type",
"(",
"second",
")",
":",
"asserter",
"=",
"cls",
".",
"equality_type_funcs",
"."... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | QuadMeshPlot._init_glyph | Returns a Bokeh glyph object. | holoviews/plotting/bokeh/raster.py | def _init_glyph(self, plot, mapping, properties):
"""
Returns a Bokeh glyph object.
"""
properties = mpl_to_bokeh(properties)
properties = dict(properties, **mapping)
if 'xs' in mapping:
renderer = plot.patches(**properties)
else:
renderer ... | def _init_glyph(self, plot, mapping, properties):
"""
Returns a Bokeh glyph object.
"""
properties = mpl_to_bokeh(properties)
properties = dict(properties, **mapping)
if 'xs' in mapping:
renderer = plot.patches(**properties)
else:
renderer ... | [
"Returns",
"a",
"Bokeh",
"glyph",
"object",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/raster.py#L269-L281 | [
"def",
"_init_glyph",
"(",
"self",
",",
"plot",
",",
"mapping",
",",
"properties",
")",
":",
"properties",
"=",
"mpl_to_bokeh",
"(",
"properties",
")",
"properties",
"=",
"dict",
"(",
"properties",
",",
"*",
"*",
"mapping",
")",
"if",
"'xs'",
"in",
"mapp... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | BoundingBox.contains | Returns true if the given point is contained within the
bounding box, where all boundaries of the box are
considered to be inclusive. | holoviews/core/boundingregion.py | def contains(self, x, y):
"""
Returns true if the given point is contained within the
bounding box, where all boundaries of the box are
considered to be inclusive.
"""
left, bottom, right, top = self.aarect().lbrt()
return (left <= x <= right) and (bottom <= y <= ... | def contains(self, x, y):
"""
Returns true if the given point is contained within the
bounding box, where all boundaries of the box are
considered to be inclusive.
"""
left, bottom, right, top = self.aarect().lbrt()
return (left <= x <= right) and (bottom <= y <= ... | [
"Returns",
"true",
"if",
"the",
"given",
"point",
"is",
"contained",
"within",
"the",
"bounding",
"box",
"where",
"all",
"boundaries",
"of",
"the",
"box",
"are",
"considered",
"to",
"be",
"inclusive",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/boundingregion.py#L147-L154 | [
"def",
"contains",
"(",
"self",
",",
"x",
",",
"y",
")",
":",
"left",
",",
"bottom",
",",
"right",
",",
"top",
"=",
"self",
".",
"aarect",
"(",
")",
".",
"lbrt",
"(",
")",
"return",
"(",
"left",
"<=",
"x",
"<=",
"right",
")",
"and",
"(",
"bot... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | BoundingBox.contains_exclusive | Return True if the given point is contained within the
bounding box, where the bottom and right boundaries are
considered exclusive. | holoviews/core/boundingregion.py | def contains_exclusive(self, x, y):
"""
Return True if the given point is contained within the
bounding box, where the bottom and right boundaries are
considered exclusive.
"""
left, bottom, right, top = self._aarect.lbrt()
return (left <= x < right) and (bottom <... | def contains_exclusive(self, x, y):
"""
Return True if the given point is contained within the
bounding box, where the bottom and right boundaries are
considered exclusive.
"""
left, bottom, right, top = self._aarect.lbrt()
return (left <= x < right) and (bottom <... | [
"Return",
"True",
"if",
"the",
"given",
"point",
"is",
"contained",
"within",
"the",
"bounding",
"box",
"where",
"the",
"bottom",
"and",
"right",
"boundaries",
"are",
"considered",
"exclusive",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/boundingregion.py#L157-L164 | [
"def",
"contains_exclusive",
"(",
"self",
",",
"x",
",",
"y",
")",
":",
"left",
",",
"bottom",
",",
"right",
",",
"top",
"=",
"self",
".",
"_aarect",
".",
"lbrt",
"(",
")",
"return",
"(",
"left",
"<=",
"x",
"<",
"right",
")",
"and",
"(",
"bottom"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.