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 | OpenCage._check_status | Validates error statuses. | geopy/geocoders/opencage.py | def _check_status(status):
"""
Validates error statuses.
"""
status_code = status['code']
if status_code == 429:
# Rate limit exceeded
raise GeocoderQuotaExceeded(
'The given key has gone over the requests limit in the 24'
'... | def _check_status(status):
"""
Validates error statuses.
"""
status_code = status['code']
if status_code == 429:
# Rate limit exceeded
raise GeocoderQuotaExceeded(
'The given key has gone over the requests limit in the 24'
'... | [
"Validates",
"error",
"statuses",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/opencage.py#L253-L274 | [
"def",
"_check_status",
"(",
"status",
")",
":",
"status_code",
"=",
"status",
"[",
"'code'",
"]",
"if",
"status_code",
"==",
"429",
":",
"# Rate limit exceeded",
"raise",
"GeocoderQuotaExceeded",
"(",
"'The given key has gone over the requests limit in the 24'",
"' hour ... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | Geolake.geocode | Return a location point by address.
:param str query: The address or query you wish to geocode.
For a structured query, provide a dictionary whose keys
are one of: `country`, `state`, `city`, `zipcode`, `street`, `address`,
`houseNumber` or `subNumber`.
:param coun... | geopy/geocoders/geolake.py | def geocode(
self,
query,
country_codes=None,
exactly_one=True,
timeout=DEFAULT_SENTINEL,
):
"""
Return a location point by address.
:param str query: The address or query you wish to geocode.
For a structured query, p... | def geocode(
self,
query,
country_codes=None,
exactly_one=True,
timeout=DEFAULT_SENTINEL,
):
"""
Return a location point by address.
:param str query: The address or query you wish to geocode.
For a structured query, p... | [
"Return",
"a",
"location",
"point",
"by",
"address",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/geolake.py#L87-L154 | [
"def",
"geocode",
"(",
"self",
",",
"query",
",",
"country_codes",
"=",
"None",
",",
"exactly_one",
"=",
"True",
",",
"timeout",
"=",
"DEFAULT_SENTINEL",
",",
")",
":",
"if",
"isinstance",
"(",
"query",
",",
"dict",
")",
":",
"params",
"=",
"{",
"key",... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | Geolake._parse_json | Returns location, (latitude, longitude) from json feed. | geopy/geocoders/geolake.py | def _parse_json(self, page, exactly_one):
"""Returns location, (latitude, longitude) from json feed."""
if not page.get('success'):
return None
latitude = page['latitude']
longitude = page['longitude']
place = page.get('place')
address = ", ".join([place['c... | def _parse_json(self, page, exactly_one):
"""Returns location, (latitude, longitude) from json feed."""
if not page.get('success'):
return None
latitude = page['latitude']
longitude = page['longitude']
place = page.get('place')
address = ", ".join([place['c... | [
"Returns",
"location",
"(",
"latitude",
"longitude",
")",
"from",
"json",
"feed",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/geolake.py#L156-L171 | [
"def",
"_parse_json",
"(",
"self",
",",
"page",
",",
"exactly_one",
")",
":",
"if",
"not",
"page",
".",
"get",
"(",
"'success'",
")",
":",
"return",
"None",
"latitude",
"=",
"page",
"[",
"'latitude'",
"]",
"longitude",
"=",
"page",
"[",
"'longitude'",
... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | What3Words.geocode | Return a location point for a `3 words` query. If the `3 words` address
doesn't exist, a :class:`geopy.exc.GeocoderQueryError` exception will be
thrown.
:param str query: The 3-word address you wish to geocode.
:param str lang: two character language codes as supported by
t... | geopy/geocoders/what3words.py | def geocode(self,
query,
lang='en',
exactly_one=True,
timeout=DEFAULT_SENTINEL):
"""
Return a location point for a `3 words` query. If the `3 words` address
doesn't exist, a :class:`geopy.exc.GeocoderQueryError` exception will be
... | def geocode(self,
query,
lang='en',
exactly_one=True,
timeout=DEFAULT_SENTINEL):
"""
Return a location point for a `3 words` query. If the `3 words` address
doesn't exist, a :class:`geopy.exc.GeocoderQueryError` exception will be
... | [
"Return",
"a",
"location",
"point",
"for",
"a",
"3",
"words",
"query",
".",
"If",
"the",
"3",
"words",
"address",
"doesn",
"t",
"exist",
"a",
":",
"class",
":",
"geopy",
".",
"exc",
".",
"GeocoderQueryError",
"exception",
"will",
"be",
"thrown",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/what3words.py#L102-L152 | [
"def",
"geocode",
"(",
"self",
",",
"query",
",",
"lang",
"=",
"'en'",
",",
"exactly_one",
"=",
"True",
",",
"timeout",
"=",
"DEFAULT_SENTINEL",
")",
":",
"if",
"not",
"self",
".",
"_check_query",
"(",
"query",
")",
":",
"raise",
"exc",
".",
"GeocoderQ... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | What3Words._parse_json | Parse type, words, latitude, and longitude and language from a
JSON response. | geopy/geocoders/what3words.py | def _parse_json(self, resources, exactly_one=True):
"""
Parse type, words, latitude, and longitude and language from a
JSON response.
"""
code = resources['status'].get('code')
if code:
# https://docs.what3words.com/api/v2/#errors
exc_msg = "Erro... | def _parse_json(self, resources, exactly_one=True):
"""
Parse type, words, latitude, and longitude and language from a
JSON response.
"""
code = resources['status'].get('code')
if code:
# https://docs.what3words.com/api/v2/#errors
exc_msg = "Erro... | [
"Parse",
"type",
"words",
"latitude",
"and",
"longitude",
"and",
"language",
"from",
"a",
"JSON",
"response",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/what3words.py#L154-L191 | [
"def",
"_parse_json",
"(",
"self",
",",
"resources",
",",
"exactly_one",
"=",
"True",
")",
":",
"code",
"=",
"resources",
"[",
"'status'",
"]",
".",
"get",
"(",
"'code'",
")",
"if",
"code",
":",
"# https://docs.what3words.com/api/v2/#errors",
"exc_msg",
"=",
... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | What3Words.reverse | Return a `3 words` address by location point. Each point on surface has
a `3 words` address, so there's always a non-empty response.
:param query: The coordinates for which you wish to obtain the 3 word
address.
:type query: :class:`geopy.point.Point`, list or tuple of ``(latitude,
... | geopy/geocoders/what3words.py | def reverse(self, query, lang='en', exactly_one=True,
timeout=DEFAULT_SENTINEL):
"""
Return a `3 words` address by location point. Each point on surface has
a `3 words` address, so there's always a non-empty response.
:param query: The coordinates for which you wish to o... | def reverse(self, query, lang='en', exactly_one=True,
timeout=DEFAULT_SENTINEL):
"""
Return a `3 words` address by location point. Each point on surface has
a `3 words` address, so there's always a non-empty response.
:param query: The coordinates for which you wish to o... | [
"Return",
"a",
"3",
"words",
"address",
"by",
"location",
"point",
".",
"Each",
"point",
"on",
"surface",
"has",
"a",
"3",
"words",
"address",
"so",
"there",
"s",
"always",
"a",
"non",
"-",
"empty",
"response",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/what3words.py#L193-L239 | [
"def",
"reverse",
"(",
"self",
",",
"query",
",",
"lang",
"=",
"'en'",
",",
"exactly_one",
"=",
"True",
",",
"timeout",
"=",
"DEFAULT_SENTINEL",
")",
":",
"lang",
"=",
"lang",
".",
"lower",
"(",
")",
"params",
"=",
"{",
"'coords'",
":",
"self",
".",
... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | Nominatim.geocode | Return a location point by address.
:param query: The address, query or a structured query
you wish to geocode.
.. versionchanged:: 1.0.0
For a structured query, provide a dictionary whose keys
are one of: `street`, `city`, `county`, `state`, `country`, ... | geopy/geocoders/osm.py | def geocode(
self,
query,
exactly_one=True,
timeout=DEFAULT_SENTINEL,
limit=None,
addressdetails=False,
language=False,
geometry=None,
extratags=False,
country_codes=None,
viewbox=None,
... | def geocode(
self,
query,
exactly_one=True,
timeout=DEFAULT_SENTINEL,
limit=None,
addressdetails=False,
language=False,
geometry=None,
extratags=False,
country_codes=None,
viewbox=None,
... | [
"Return",
"a",
"location",
"point",
"by",
"address",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/osm.py#L210-L388 | [
"def",
"geocode",
"(",
"self",
",",
"query",
",",
"exactly_one",
"=",
"True",
",",
"timeout",
"=",
"DEFAULT_SENTINEL",
",",
"limit",
"=",
"None",
",",
"addressdetails",
"=",
"False",
",",
"language",
"=",
"False",
",",
"geometry",
"=",
"None",
",",
"extr... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | Nominatim.reverse | Return an address by location point.
:param query: The coordinates for which you wish to obtain the
closest human-readable addresses.
:type query: :class:`geopy.point.Point`, list or tuple of ``(latitude,
longitude)``, or string as ``"%(latitude)s, %(longitude)s"``.
:pa... | geopy/geocoders/osm.py | def reverse(
self,
query,
exactly_one=True,
timeout=DEFAULT_SENTINEL,
language=False,
addressdetails=True
):
"""
Return an address by location point.
:param query: The coordinates for which you wish to obtain the
... | def reverse(
self,
query,
exactly_one=True,
timeout=DEFAULT_SENTINEL,
language=False,
addressdetails=True
):
"""
Return an address by location point.
:param query: The coordinates for which you wish to obtain the
... | [
"Return",
"an",
"address",
"by",
"location",
"point",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/osm.py#L390-L450 | [
"def",
"reverse",
"(",
"self",
",",
"query",
",",
"exactly_one",
"=",
"True",
",",
"timeout",
"=",
"DEFAULT_SENTINEL",
",",
"language",
"=",
"False",
",",
"addressdetails",
"=",
"True",
")",
":",
"try",
":",
"lat",
",",
"lon",
"=",
"self",
".",
"_coerc... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | Photon.geocode | Return a location point by address.
:param str query: The address or query you wish to geocode.
:param bool exactly_one: Return one result or a list of results, if
available.
:param int timeout: Time, in seconds, to wait for the geocoding service
to respond before rais... | geopy/geocoders/photon.py | def geocode(
self,
query,
exactly_one=True,
timeout=DEFAULT_SENTINEL,
location_bias=None,
language=False,
limit=None,
osm_tag=None
):
"""
Return a location point by address.
:param str query: The... | def geocode(
self,
query,
exactly_one=True,
timeout=DEFAULT_SENTINEL,
location_bias=None,
language=False,
limit=None,
osm_tag=None
):
"""
Return a location point by address.
:param str query: The... | [
"Return",
"a",
"location",
"point",
"by",
"address",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/photon.py#L74-L147 | [
"def",
"geocode",
"(",
"self",
",",
"query",
",",
"exactly_one",
"=",
"True",
",",
"timeout",
"=",
"DEFAULT_SENTINEL",
",",
"location_bias",
"=",
"None",
",",
"language",
"=",
"False",
",",
"limit",
"=",
"None",
",",
"osm_tag",
"=",
"None",
")",
":",
"... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | Photon._parse_json | Parse display name, latitude, and longitude from a JSON response. | geopy/geocoders/photon.py | def _parse_json(cls, resources, exactly_one=True):
"""
Parse display name, latitude, and longitude from a JSON response.
"""
if not len(resources['features']): # pragma: no cover
return None
if exactly_one:
return cls.parse_resource(resources['features'][... | def _parse_json(cls, resources, exactly_one=True):
"""
Parse display name, latitude, and longitude from a JSON response.
"""
if not len(resources['features']): # pragma: no cover
return None
if exactly_one:
return cls.parse_resource(resources['features'][... | [
"Parse",
"display",
"name",
"latitude",
"and",
"longitude",
"from",
"a",
"JSON",
"response",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/photon.py#L205-L215 | [
"def",
"_parse_json",
"(",
"cls",
",",
"resources",
",",
"exactly_one",
"=",
"True",
")",
":",
"if",
"not",
"len",
"(",
"resources",
"[",
"'features'",
"]",
")",
":",
"# pragma: no cover",
"return",
"None",
"if",
"exactly_one",
":",
"return",
"cls",
".",
... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | Baidu.reverse | Return an address by location point.
:param query: The coordinates for which you wish to obtain the
closest human-readable addresses.
:type query: :class:`geopy.point.Point`, list or tuple of ``(latitude,
longitude)``, or string as ``"%(latitude)s, %(longitude)s"``.
:pa... | geopy/geocoders/baidu.py | def reverse(self, query, exactly_one=True, timeout=DEFAULT_SENTINEL):
"""
Return an address by location point.
:param query: The coordinates for which you wish to obtain the
closest human-readable addresses.
:type query: :class:`geopy.point.Point`, list or tuple of ``(latitu... | def reverse(self, query, exactly_one=True, timeout=DEFAULT_SENTINEL):
"""
Return an address by location point.
:param query: The coordinates for which you wish to obtain the
closest human-readable addresses.
:type query: :class:`geopy.point.Point`, list or tuple of ``(latitu... | [
"Return",
"an",
"address",
"by",
"location",
"point",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/baidu.py#L136-L170 | [
"def",
"reverse",
"(",
"self",
",",
"query",
",",
"exactly_one",
"=",
"True",
",",
"timeout",
"=",
"DEFAULT_SENTINEL",
")",
":",
"params",
"=",
"{",
"'ak'",
":",
"self",
".",
"api_key",
",",
"'output'",
":",
"'json'",
",",
"'location'",
":",
"self",
".... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | Baidu._parse_reverse_json | Parses a location from a single-result reverse API call. | geopy/geocoders/baidu.py | def _parse_reverse_json(self, page, exactly_one=True):
"""
Parses a location from a single-result reverse API call.
"""
place = page.get('result')
if not place:
self._check_status(page.get('status'))
return None
location = place.get('formatted_ad... | def _parse_reverse_json(self, page, exactly_one=True):
"""
Parses a location from a single-result reverse API call.
"""
place = page.get('result')
if not place:
self._check_status(page.get('status'))
return None
location = place.get('formatted_ad... | [
"Parses",
"a",
"location",
"from",
"a",
"single",
"-",
"result",
"reverse",
"API",
"call",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/baidu.py#L172-L190 | [
"def",
"_parse_reverse_json",
"(",
"self",
",",
"page",
",",
"exactly_one",
"=",
"True",
")",
":",
"place",
"=",
"page",
".",
"get",
"(",
"'result'",
")",
"if",
"not",
"place",
":",
"self",
".",
"_check_status",
"(",
"page",
".",
"get",
"(",
"'status'"... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | Baidu._check_status | Validates error statuses. | geopy/geocoders/baidu.py | def _check_status(status):
"""
Validates error statuses.
"""
if status == 0:
# When there are no results, just return.
return
if status == 1:
raise GeocoderServiceError(
'Internal server error.'
)
elif status... | def _check_status(status):
"""
Validates error statuses.
"""
if status == 0:
# When there are no results, just return.
return
if status == 1:
raise GeocoderServiceError(
'Internal server error.'
)
elif status... | [
"Validates",
"error",
"statuses",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/baidu.py#L218-L270 | [
"def",
"_check_status",
"(",
"status",
")",
":",
"if",
"status",
"==",
"0",
":",
"# When there are no results, just return.",
"return",
"if",
"status",
"==",
"1",
":",
"raise",
"GeocoderServiceError",
"(",
"'Internal server error.'",
")",
"elif",
"status",
"==",
"... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | TomTom.geocode | Return a location point by address.
:param str query: The address or query you wish to geocode.
:param bool exactly_one: Return one result or a list of results, if
available.
:param int timeout: Time, in seconds, to wait for the geocoding service
to respond before rais... | geopy/geocoders/tomtom.py | def geocode(
self,
query,
exactly_one=True,
timeout=DEFAULT_SENTINEL,
limit=None,
typeahead=False,
language=None,
):
"""
Return a location point by address.
:param str query: The address or query you wish to... | def geocode(
self,
query,
exactly_one=True,
timeout=DEFAULT_SENTINEL,
limit=None,
typeahead=False,
language=None,
):
"""
Return a location point by address.
:param str query: The address or query you wish to... | [
"Return",
"a",
"location",
"point",
"by",
"address",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/tomtom.py#L69-L126 | [
"def",
"geocode",
"(",
"self",
",",
"query",
",",
"exactly_one",
"=",
"True",
",",
"timeout",
"=",
"DEFAULT_SENTINEL",
",",
"limit",
"=",
"None",
",",
"typeahead",
"=",
"False",
",",
"language",
"=",
"None",
",",
")",
":",
"query",
"=",
"self",
".",
... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | TomTom.reverse | Return an address by location point.
:param query: The coordinates for which you wish to obtain the
closest human-readable addresses.
:type query: :class:`geopy.point.Point`, list or tuple of ``(latitude,
longitude)``, or string as ``"%(latitude)s, %(longitude)s"``.
:pa... | geopy/geocoders/tomtom.py | def reverse(
self,
query,
exactly_one=True,
timeout=DEFAULT_SENTINEL,
language=None,
):
"""
Return an address by location point.
:param query: The coordinates for which you wish to obtain the
closest human-readable addr... | def reverse(
self,
query,
exactly_one=True,
timeout=DEFAULT_SENTINEL,
language=None,
):
"""
Return an address by location point.
:param query: The coordinates for which you wish to obtain the
closest human-readable addr... | [
"Return",
"an",
"address",
"by",
"location",
"point",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/tomtom.py#L128-L175 | [
"def",
"reverse",
"(",
"self",
",",
"query",
",",
"exactly_one",
"=",
"True",
",",
"timeout",
"=",
"DEFAULT_SENTINEL",
",",
"language",
"=",
"None",
",",
")",
":",
"position",
"=",
"self",
".",
"_coerce_point_to_string",
"(",
"query",
")",
"params",
"=",
... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | IGNFrance.geocode | Return a location point by address.
:param str query: The query string to be geocoded.
:param str query_type: The type to provide for geocoding. It can be
`PositionOfInterest`, `StreetAddress` or `CadastralParcel`.
`StreetAddress` is the default choice if none provided.
... | geopy/geocoders/ignfrance.py | def geocode(
self,
query,
query_type='StreetAddress',
maximum_responses=25,
is_freeform=False,
filtering=None,
exactly_one=True,
timeout=DEFAULT_SENTINEL,
):
"""
Return a location point by address.
... | def geocode(
self,
query,
query_type='StreetAddress',
maximum_responses=25,
is_freeform=False,
filtering=None,
exactly_one=True,
timeout=DEFAULT_SENTINEL,
):
"""
Return a location point by address.
... | [
"Return",
"a",
"location",
"point",
"by",
"address",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/ignfrance.py#L142-L247 | [
"def",
"geocode",
"(",
"self",
",",
"query",
",",
"query_type",
"=",
"'StreetAddress'",
",",
"maximum_responses",
"=",
"25",
",",
"is_freeform",
"=",
"False",
",",
"filtering",
"=",
"None",
",",
"exactly_one",
"=",
"True",
",",
"timeout",
"=",
"DEFAULT_SENTI... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | IGNFrance.reverse | Return an address by location point.
:param query: The coordinates for which you wish to obtain the
closest human-readable addresses.
:type query: :class:`geopy.point.Point`, list or tuple of ``(latitude,
longitude)``, or string as ``"%(latitude)s, %(longitude)s"``.
:pa... | geopy/geocoders/ignfrance.py | def reverse(
self,
query,
reverse_geocode_preference=('StreetAddress', ),
maximum_responses=25,
filtering='',
exactly_one=DEFAULT_SENTINEL,
timeout=DEFAULT_SENTINEL,
):
"""
Return an address by location point.
... | def reverse(
self,
query,
reverse_geocode_preference=('StreetAddress', ),
maximum_responses=25,
filtering='',
exactly_one=DEFAULT_SENTINEL,
timeout=DEFAULT_SENTINEL,
):
"""
Return an address by location point.
... | [
"Return",
"an",
"address",
"by",
"location",
"point",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/ignfrance.py#L249-L353 | [
"def",
"reverse",
"(",
"self",
",",
"query",
",",
"reverse_geocode_preference",
"=",
"(",
"'StreetAddress'",
",",
")",
",",
"maximum_responses",
"=",
"25",
",",
"filtering",
"=",
"''",
",",
"exactly_one",
"=",
"DEFAULT_SENTINEL",
",",
"timeout",
"=",
"DEFAULT_... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | IGNFrance._parse_xml | Returns location, (latitude, longitude) from XML feed
and transform to json | geopy/geocoders/ignfrance.py | def _parse_xml(self,
page,
is_reverse=False,
is_freeform=False,
exactly_one=True):
"""
Returns location, (latitude, longitude) from XML feed
and transform to json
"""
# Parse the page
tree = ET.fr... | def _parse_xml(self,
page,
is_reverse=False,
is_freeform=False,
exactly_one=True):
"""
Returns location, (latitude, longitude) from XML feed
and transform to json
"""
# Parse the page
tree = ET.fr... | [
"Returns",
"location",
"(",
"latitude",
"longitude",
")",
"from",
"XML",
"feed",
"and",
"transform",
"to",
"json"
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/ignfrance.py#L404-L441 | [
"def",
"_parse_xml",
"(",
"self",
",",
"page",
",",
"is_reverse",
"=",
"False",
",",
"is_freeform",
"=",
"False",
",",
"exactly_one",
"=",
"True",
")",
":",
"# Parse the page",
"tree",
"=",
"ET",
".",
"fromstring",
"(",
"page",
".",
"encode",
"(",
"'utf-... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | IGNFrance._xml_to_json_places | Transform the xml ElementTree due to XML webservice return to json | geopy/geocoders/ignfrance.py | def _xml_to_json_places(tree, is_reverse=False):
"""
Transform the xml ElementTree due to XML webservice return to json
"""
select_multi = (
'GeocodedAddress'
if not is_reverse
else 'ReverseGeocodedLocation'
)
adresses = tree.findall(... | def _xml_to_json_places(tree, is_reverse=False):
"""
Transform the xml ElementTree due to XML webservice return to json
"""
select_multi = (
'GeocodedAddress'
if not is_reverse
else 'ReverseGeocodedLocation'
)
adresses = tree.findall(... | [
"Transform",
"the",
"xml",
"ElementTree",
"due",
"to",
"XML",
"webservice",
"return",
"to",
"json"
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/ignfrance.py#L444-L527 | [
"def",
"_xml_to_json_places",
"(",
"tree",
",",
"is_reverse",
"=",
"False",
")",
":",
"select_multi",
"=",
"(",
"'GeocodedAddress'",
"if",
"not",
"is_reverse",
"else",
"'ReverseGeocodedLocation'",
")",
"adresses",
"=",
"tree",
".",
"findall",
"(",
"'.//'",
"+",
... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | IGNFrance._request_raw_content | Send the request to get raw content. | geopy/geocoders/ignfrance.py | def _request_raw_content(self, url, timeout):
"""
Send the request to get raw content.
"""
request = Request(url)
if self.referer is not None:
request.add_header('Referer', self.referer)
raw_xml = self._call_geocoder(
request,
timeou... | def _request_raw_content(self, url, timeout):
"""
Send the request to get raw content.
"""
request = Request(url)
if self.referer is not None:
request.add_header('Referer', self.referer)
raw_xml = self._call_geocoder(
request,
timeou... | [
"Send",
"the",
"request",
"to",
"get",
"raw",
"content",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/ignfrance.py#L529-L545 | [
"def",
"_request_raw_content",
"(",
"self",
",",
"url",
",",
"timeout",
")",
":",
"request",
"=",
"Request",
"(",
"url",
")",
"if",
"self",
".",
"referer",
"is",
"not",
"None",
":",
"request",
".",
"add_header",
"(",
"'Referer'",
",",
"self",
".",
"ref... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | IGNFrance._parse_place | Get the location, lat, lng and place from a single json place. | geopy/geocoders/ignfrance.py | def _parse_place(place, is_freeform=None):
"""
Get the location, lat, lng and place from a single json place.
"""
# When freeform already so full address
if is_freeform == 'true':
location = place.get('freeformaddress')
else:
# For parcelle
... | def _parse_place(place, is_freeform=None):
"""
Get the location, lat, lng and place from a single json place.
"""
# When freeform already so full address
if is_freeform == 'true':
location = place.get('freeformaddress')
else:
# For parcelle
... | [
"Get",
"the",
"location",
"lat",
"lng",
"and",
"place",
"from",
"a",
"single",
"json",
"place",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/ignfrance.py#L548-L577 | [
"def",
"_parse_place",
"(",
"place",
",",
"is_freeform",
"=",
"None",
")",
":",
"# When freeform already so full address",
"if",
"is_freeform",
"==",
"'true'",
":",
"location",
"=",
"place",
".",
"get",
"(",
"'freeformaddress'",
")",
"else",
":",
"# For parcelle",... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | GeoNames.geocode | Return a location point by address.
:param str query: The address or query you wish to geocode.
:param bool exactly_one: Return one result or a list of results, if
available.
:param int timeout: Time, in seconds, to wait for the geocoding service
to respond before rais... | geopy/geocoders/geonames.py | def geocode(
self,
query,
exactly_one=True,
timeout=DEFAULT_SENTINEL,
country=None,
country_bias=None,
):
"""
Return a location point by address.
:param str query: The address or query you wish to geocode.
:par... | def geocode(
self,
query,
exactly_one=True,
timeout=DEFAULT_SENTINEL,
country=None,
country_bias=None,
):
"""
Return a location point by address.
:param str query: The address or query you wish to geocode.
:par... | [
"Return",
"a",
"location",
"point",
"by",
"address",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/geonames.py#L132-L193 | [
"def",
"geocode",
"(",
"self",
",",
"query",
",",
"exactly_one",
"=",
"True",
",",
"timeout",
"=",
"DEFAULT_SENTINEL",
",",
"country",
"=",
"None",
",",
"country_bias",
"=",
"None",
",",
")",
":",
"params",
"=",
"[",
"(",
"'q'",
",",
"self",
".",
"fo... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | GeoNames.reverse | Return an address by location point.
.. versionadded:: 1.2.0
:param query: The coordinates for which you wish to obtain the
closest human-readable addresses.
:type query: :class:`geopy.point.Point`, list or tuple of ``(latitude,
longitude)``, or string as ``"%(latit... | geopy/geocoders/geonames.py | def reverse(
self,
query,
exactly_one=DEFAULT_SENTINEL,
timeout=DEFAULT_SENTINEL,
feature_code=None,
lang=None,
find_nearby_type='findNearbyPlaceName',
):
"""
Return an address by location point.
.. vers... | def reverse(
self,
query,
exactly_one=DEFAULT_SENTINEL,
timeout=DEFAULT_SENTINEL,
feature_code=None,
lang=None,
find_nearby_type='findNearbyPlaceName',
):
"""
Return an address by location point.
.. vers... | [
"Return",
"an",
"address",
"by",
"location",
"point",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/geonames.py#L195-L296 | [
"def",
"reverse",
"(",
"self",
",",
"query",
",",
"exactly_one",
"=",
"DEFAULT_SENTINEL",
",",
"timeout",
"=",
"DEFAULT_SENTINEL",
",",
"feature_code",
"=",
"None",
",",
"lang",
"=",
"None",
",",
"find_nearby_type",
"=",
"'findNearbyPlaceName'",
",",
")",
":",... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | GeoNames.reverse_timezone | Find the timezone for a point in `query`.
GeoNames always returns a timezone: if the point being queried
doesn't have an assigned Olson timezone id, a ``pytz.FixedOffset``
timezone is used to produce the :class:`geopy.timezone.Timezone`.
.. versionadded:: 1.18.0
:param query: ... | geopy/geocoders/geonames.py | def reverse_timezone(self, query, timeout=DEFAULT_SENTINEL):
"""
Find the timezone for a point in `query`.
GeoNames always returns a timezone: if the point being queried
doesn't have an assigned Olson timezone id, a ``pytz.FixedOffset``
timezone is used to produce the :class:`ge... | def reverse_timezone(self, query, timeout=DEFAULT_SENTINEL):
"""
Find the timezone for a point in `query`.
GeoNames always returns a timezone: if the point being queried
doesn't have an assigned Olson timezone id, a ``pytz.FixedOffset``
timezone is used to produce the :class:`ge... | [
"Find",
"the",
"timezone",
"for",
"a",
"point",
"in",
"query",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/geonames.py#L318-L357 | [
"def",
"reverse_timezone",
"(",
"self",
",",
"query",
",",
"timeout",
"=",
"DEFAULT_SENTINEL",
")",
":",
"ensure_pytz_is_installed",
"(",
")",
"try",
":",
"lat",
",",
"lng",
"=",
"self",
".",
"_coerce_point_to_string",
"(",
"query",
")",
".",
"split",
"(",
... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | GeoNames._parse_json | Parse JSON response body. | geopy/geocoders/geonames.py | def _parse_json(self, doc, exactly_one):
"""
Parse JSON response body.
"""
places = doc.get('geonames', [])
self._raise_for_error(doc)
if not len(places):
return None
def parse_code(place):
"""
Parse each record.
""... | def _parse_json(self, doc, exactly_one):
"""
Parse JSON response body.
"""
places = doc.get('geonames', [])
self._raise_for_error(doc)
if not len(places):
return None
def parse_code(place):
"""
Parse each record.
""... | [
"Parse",
"JSON",
"response",
"body",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/geonames.py#L387-L421 | [
"def",
"_parse_json",
"(",
"self",
",",
"doc",
",",
"exactly_one",
")",
":",
"places",
"=",
"doc",
".",
"get",
"(",
"'geonames'",
",",
"[",
"]",
")",
"self",
".",
"_raise_for_error",
"(",
"doc",
")",
"if",
"not",
"len",
"(",
"places",
")",
":",
"re... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | Pelias.geocode | Return a location point by address.
:param str query: The address, query or structured query to geocode
you wish to geocode.
:param bool exactly_one: Return one result or a list of results, if
available.
:param int timeout: Time, in seconds, to wait for the geocoding s... | geopy/geocoders/pelias.py | def geocode(
self,
query,
exactly_one=True,
timeout=DEFAULT_SENTINEL,
boundary_rect=None,
country_bias=None,
):
"""
Return a location point by address.
:param str query: The address, query or structured query to geocode... | def geocode(
self,
query,
exactly_one=True,
timeout=DEFAULT_SENTINEL,
boundary_rect=None,
country_bias=None,
):
"""
Return a location point by address.
:param str query: The address, query or structured query to geocode... | [
"Return",
"a",
"location",
"point",
"by",
"address",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/pelias.py#L127-L201 | [
"def",
"geocode",
"(",
"self",
",",
"query",
",",
"exactly_one",
"=",
"True",
",",
"timeout",
"=",
"DEFAULT_SENTINEL",
",",
"boundary_rect",
"=",
"None",
",",
"country_bias",
"=",
"None",
",",
")",
":",
"params",
"=",
"{",
"'text'",
":",
"self",
".",
"... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | MapBox._parse_json | Returns location, (latitude, longitude) from json feed. | geopy/geocoders/mapbox.py | def _parse_json(self, json, exactly_one=True):
'''Returns location, (latitude, longitude) from json feed.'''
features = json['features']
if features == []:
return None
def parse_feature(feature):
location = feature['place_name']
place = feature['text'... | def _parse_json(self, json, exactly_one=True):
'''Returns location, (latitude, longitude) from json feed.'''
features = json['features']
if features == []:
return None
def parse_feature(feature):
location = feature['place_name']
place = feature['text'... | [
"Returns",
"location",
"(",
"latitude",
"longitude",
")",
"from",
"json",
"feed",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/mapbox.py#L70-L85 | [
"def",
"_parse_json",
"(",
"self",
",",
"json",
",",
"exactly_one",
"=",
"True",
")",
":",
"features",
"=",
"json",
"[",
"'features'",
"]",
"if",
"features",
"==",
"[",
"]",
":",
"return",
"None",
"def",
"parse_feature",
"(",
"feature",
")",
":",
"loca... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | MapBox.geocode | Return a location point by address
:param str query: The address or query you wish to geocode.
:param bool exactly_one: Return one result or a list of results, if
available.
:param int timeout: Time, in seconds, to wait for the geocoding service
to respond before raisi... | geopy/geocoders/mapbox.py | def geocode(
self,
query,
exactly_one=True,
timeout=DEFAULT_SENTINEL,
proximity=None,
country=None,
bbox=None,
):
"""
Return a location point by address
:param str query: The address or query you wish to geo... | def geocode(
self,
query,
exactly_one=True,
timeout=DEFAULT_SENTINEL,
proximity=None,
country=None,
bbox=None,
):
"""
Return a location point by address
:param str query: The address or query you wish to geo... | [
"Return",
"a",
"location",
"point",
"by",
"address"
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/mapbox.py#L87-L159 | [
"def",
"geocode",
"(",
"self",
",",
"query",
",",
"exactly_one",
"=",
"True",
",",
"timeout",
"=",
"DEFAULT_SENTINEL",
",",
"proximity",
"=",
"None",
",",
"country",
"=",
"None",
",",
"bbox",
"=",
"None",
",",
")",
":",
"params",
"=",
"{",
"}",
"para... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | MapBox.reverse | Return an address by location point.
:param query: The coordinates for which you wish to obtain the
closest human-readable addresses.
:type query: :class:`geopy.point.Point`, list or tuple of ``(latitude,
longitude)``, or string as ``"%(latitude)s, %(longitude)s"``.
:pa... | geopy/geocoders/mapbox.py | def reverse(
self,
query,
exactly_one=True,
timeout=DEFAULT_SENTINEL,
):
"""
Return an address by location point.
:param query: The coordinates for which you wish to obtain the
closest human-readable addresses.
:type query:... | def reverse(
self,
query,
exactly_one=True,
timeout=DEFAULT_SENTINEL,
):
"""
Return an address by location point.
:param query: The coordinates for which you wish to obtain the
closest human-readable addresses.
:type query:... | [
"Return",
"an",
"address",
"by",
"location",
"point",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/mapbox.py#L161-L197 | [
"def",
"reverse",
"(",
"self",
",",
"query",
",",
"exactly_one",
"=",
"True",
",",
"timeout",
"=",
"DEFAULT_SENTINEL",
",",
")",
":",
"params",
"=",
"{",
"}",
"params",
"[",
"'access_token'",
"]",
"=",
"self",
".",
"api_key",
"point",
"=",
"self",
".",... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | get_geocoder_for_service | For the service provided, try to return a geocoder class.
>>> from geopy.geocoders import get_geocoder_for_service
>>> get_geocoder_for_service("nominatim")
geopy.geocoders.osm.Nominatim
If the string given is not recognized, a
:class:`geopy.exc.GeocoderNotFound` exception is raised. | geopy/geocoders/__init__.py | def get_geocoder_for_service(service):
"""
For the service provided, try to return a geocoder class.
>>> from geopy.geocoders import get_geocoder_for_service
>>> get_geocoder_for_service("nominatim")
geopy.geocoders.osm.Nominatim
If the string given is not recognized, a
:class:`geopy.exc.G... | def get_geocoder_for_service(service):
"""
For the service provided, try to return a geocoder class.
>>> from geopy.geocoders import get_geocoder_for_service
>>> get_geocoder_for_service("nominatim")
geopy.geocoders.osm.Nominatim
If the string given is not recognized, a
:class:`geopy.exc.G... | [
"For",
"the",
"service",
"provided",
"try",
"to",
"return",
"a",
"geocoder",
"class",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/__init__.py#L175-L193 | [
"def",
"get_geocoder_for_service",
"(",
"service",
")",
":",
"try",
":",
"return",
"SERVICE_TO_GEOCODER",
"[",
"service",
".",
"lower",
"(",
")",
"]",
"except",
"KeyError",
":",
"raise",
"GeocoderNotFound",
"(",
"\"Unknown geocoder '%s'; options are: %s\"",
"%",
"("... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | Yandex.reverse | Return an address by location point.
:param query: The coordinates for which you wish to obtain the
closest human-readable addresses.
:type query: :class:`geopy.point.Point`, list or tuple of ``(latitude,
longitude)``, or string as ``"%(latitude)s, %(longitude)s"``.
:pa... | geopy/geocoders/yandex.py | def reverse(
self,
query,
exactly_one=DEFAULT_SENTINEL,
timeout=DEFAULT_SENTINEL,
kind=None,
):
"""
Return an address by location point.
:param query: The coordinates for which you wish to obtain the
closest human-reada... | def reverse(
self,
query,
exactly_one=DEFAULT_SENTINEL,
timeout=DEFAULT_SENTINEL,
kind=None,
):
"""
Return an address by location point.
:param query: The coordinates for which you wish to obtain the
closest human-reada... | [
"Return",
"an",
"address",
"by",
"location",
"point",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/yandex.py#L120-L184 | [
"def",
"reverse",
"(",
"self",
",",
"query",
",",
"exactly_one",
"=",
"DEFAULT_SENTINEL",
",",
"timeout",
"=",
"DEFAULT_SENTINEL",
",",
"kind",
"=",
"None",
",",
")",
":",
"if",
"exactly_one",
"is",
"DEFAULT_SENTINEL",
":",
"warnings",
".",
"warn",
"(",
"'... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | Yandex._parse_json | Parse JSON response body. | geopy/geocoders/yandex.py | def _parse_json(self, doc, exactly_one):
"""
Parse JSON response body.
"""
if doc.get('error'):
raise GeocoderServiceError(doc['error']['message'])
try:
places = doc['response']['GeoObjectCollection']['featureMember']
except KeyError:
... | def _parse_json(self, doc, exactly_one):
"""
Parse JSON response body.
"""
if doc.get('error'):
raise GeocoderServiceError(doc['error']['message'])
try:
places = doc['response']['GeoObjectCollection']['featureMember']
except KeyError:
... | [
"Parse",
"JSON",
"response",
"body",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/geocoders/yandex.py#L186-L222 | [
"def",
"_parse_json",
"(",
"self",
",",
"doc",
",",
"exactly_one",
")",
":",
"if",
"doc",
".",
"get",
"(",
"'error'",
")",
":",
"raise",
"GeocoderServiceError",
"(",
"doc",
"[",
"'error'",
"]",
"[",
"'message'",
"]",
")",
"try",
":",
"places",
"=",
"... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | format_degrees | TODO docs. | geopy/format.py | def format_degrees(degrees, fmt=DEGREES_FORMAT, symbols=None):
"""
TODO docs.
"""
symbols = symbols or ASCII_SYMBOLS
arcminutes = units.arcminutes(degrees=degrees - int(degrees))
arcseconds = units.arcseconds(arcminutes=arcminutes - int(arcminutes))
format_dict = dict(
symbols,
... | def format_degrees(degrees, fmt=DEGREES_FORMAT, symbols=None):
"""
TODO docs.
"""
symbols = symbols or ASCII_SYMBOLS
arcminutes = units.arcminutes(degrees=degrees - int(degrees))
arcseconds = units.arcseconds(arcminutes=arcminutes - int(arcminutes))
format_dict = dict(
symbols,
... | [
"TODO",
"docs",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/format.py#L68-L81 | [
"def",
"format_degrees",
"(",
"degrees",
",",
"fmt",
"=",
"DEGREES_FORMAT",
",",
"symbols",
"=",
"None",
")",
":",
"symbols",
"=",
"symbols",
"or",
"ASCII_SYMBOLS",
"arcminutes",
"=",
"units",
".",
"arcminutes",
"(",
"degrees",
"=",
"degrees",
"-",
"int",
... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | format_distance | TODO docs. | geopy/format.py | def format_distance(kilometers, fmt=DISTANCE_FORMAT, unit='km'):
"""
TODO docs.
"""
magnitude = DISTANCE_UNITS[unit](kilometers)
return fmt % {'magnitude': magnitude, 'unit': unit} | def format_distance(kilometers, fmt=DISTANCE_FORMAT, unit='km'):
"""
TODO docs.
"""
magnitude = DISTANCE_UNITS[unit](kilometers)
return fmt % {'magnitude': magnitude, 'unit': unit} | [
"TODO",
"docs",
"."
] | geopy/geopy | python | https://github.com/geopy/geopy/blob/02c838d965e76497f3c3d61f53808c86b5c58224/geopy/format.py#L95-L100 | [
"def",
"format_distance",
"(",
"kilometers",
",",
"fmt",
"=",
"DISTANCE_FORMAT",
",",
"unit",
"=",
"'km'",
")",
":",
"magnitude",
"=",
"DISTANCE_UNITS",
"[",
"unit",
"]",
"(",
"kilometers",
")",
"return",
"fmt",
"%",
"{",
"'magnitude'",
":",
"magnitude",
"... | 02c838d965e76497f3c3d61f53808c86b5c58224 |
train | AlcReleaseAutomator._last_step | If ``self._savepath`` doesn't exist, can't be read as JSON, or doesn't
match ``VERSION``, return 0. Otherwise, return the step which that file
lists as the last-run step for this release.
:return: last-run step from the release or 0
:rtype: int | dev/release.py | def _last_step(self):
"""
If ``self._savepath`` doesn't exist, can't be read as JSON, or doesn't
match ``VERSION``, return 0. Otherwise, return the step which that file
lists as the last-run step for this release.
:return: last-run step from the release or 0
:rtype: int
... | def _last_step(self):
"""
If ``self._savepath`` doesn't exist, can't be read as JSON, or doesn't
match ``VERSION``, return 0. Otherwise, return the step which that file
lists as the last-run step for this release.
:return: last-run step from the release or 0
:rtype: int
... | [
"If",
"self",
".",
"_savepath",
"doesn",
"t",
"exist",
"can",
"t",
"be",
"read",
"as",
"JSON",
"or",
"doesn",
"t",
"match",
"VERSION",
"return",
"0",
".",
"Otherwise",
"return",
"the",
"step",
"which",
"that",
"file",
"lists",
"as",
"the",
"last",
"-",... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/dev/release.py#L468-L489 | [
"def",
"_last_step",
"(",
"self",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"_savepath",
")",
":",
"return",
"0",
"try",
":",
"with",
"open",
"(",
"self",
".",
"_savepath",
",",
"'r'",
")",
"as",
"fh",
":",
"j",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | TravisChecker._find_travis_job | Given a build object, find the acceptance36 job | dev/release_utils.py | def _find_travis_job(self, build, toxenv):
"""Given a build object, find the acceptance36 job"""
for jobid in build.job_ids:
j = self._travis.job(jobid)
if 'TOXENV=%s' % toxenv in j.config['env']:
logger.debug('Found %s job: %s', toxenv, j.number)
... | def _find_travis_job(self, build, toxenv):
"""Given a build object, find the acceptance36 job"""
for jobid in build.job_ids:
j = self._travis.job(jobid)
if 'TOXENV=%s' % toxenv in j.config['env']:
logger.debug('Found %s job: %s', toxenv, j.number)
... | [
"Given",
"a",
"build",
"object",
"find",
"the",
"acceptance36",
"job"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/dev/release_utils.py#L117-L128 | [
"def",
"_find_travis_job",
"(",
"self",
",",
"build",
",",
"toxenv",
")",
":",
"for",
"jobid",
"in",
"build",
".",
"job_ids",
":",
"j",
"=",
"self",
".",
"_travis",
".",
"job",
"(",
"jobid",
")",
"if",
"'TOXENV=%s'",
"%",
"toxenv",
"in",
"j",
".",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | BaseStep._run_tox_env | Run the specified tox environment.
:param env_name: name of the tox environment to run
:type env_name: str
:param extra_env_vars: additional variables to set in the environment
:type extra_env_vars: dict
:raises: RuntimeError
:returns: combined STDOUT / STDERR
:r... | dev/release_utils.py | def _run_tox_env(self, env_name, extra_env_vars={}):
"""
Run the specified tox environment.
:param env_name: name of the tox environment to run
:type env_name: str
:param extra_env_vars: additional variables to set in the environment
:type extra_env_vars: dict
:r... | def _run_tox_env(self, env_name, extra_env_vars={}):
"""
Run the specified tox environment.
:param env_name: name of the tox environment to run
:type env_name: str
:param extra_env_vars: additional variables to set in the environment
:type extra_env_vars: dict
:r... | [
"Run",
"the",
"specified",
"tox",
"environment",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/dev/release_utils.py#L239-L274 | [
"def",
"_run_tox_env",
"(",
"self",
",",
"env_name",
",",
"extra_env_vars",
"=",
"{",
"}",
")",
":",
"projdir",
"=",
"self",
".",
"projdir",
"env",
"=",
"deepcopy",
"(",
"os",
".",
"environ",
")",
"env",
"[",
"'PATH'",
"]",
"=",
"self",
".",
"_fixed_... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | BaseStep._fixed_path | Return the current PATH, fixed to remove the docker tox env.
:return: sanitized path
:rtype: str | dev/release_utils.py | def _fixed_path(self, projdir):
"""
Return the current PATH, fixed to remove the docker tox env.
:return: sanitized path
:rtype: str
"""
res = []
toxdir = os.path.join(projdir, '.tox')
for p in os.environ['PATH'].split(':'):
if not p.startswit... | def _fixed_path(self, projdir):
"""
Return the current PATH, fixed to remove the docker tox env.
:return: sanitized path
:rtype: str
"""
res = []
toxdir = os.path.join(projdir, '.tox')
for p in os.environ['PATH'].split(':'):
if not p.startswit... | [
"Return",
"the",
"current",
"PATH",
"fixed",
"to",
"remove",
"the",
"docker",
"tox",
"env",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/dev/release_utils.py#L276-L288 | [
"def",
"_fixed_path",
"(",
"self",
",",
"projdir",
")",
":",
"res",
"=",
"[",
"]",
"toxdir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"projdir",
",",
"'.tox'",
")",
"for",
"p",
"in",
"os",
".",
"environ",
"[",
"'PATH'",
"]",
".",
"split",
"(",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _LambdaService.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/lambdafunc.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("Getting usage for Lambda metrics")
try:
self.connect()
resp... | 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("Getting usage for Lambda metrics")
try:
self.connect()
resp... | [
"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/lambdafunc.py#L55-L72 | [
"def",
"find_usage",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Getting usage for Lambda metrics\"",
")",
"try",
":",
"self",
".",
"connect",
"(",
")",
"resp",
"=",
"self",
".",
"conn",
".",
"get_account_settings",
"(",
")",
"except",
"EndpointCo... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _LambdaService.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/lambdafunc.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("Getting limits for Lambda")
if s... | 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("Getting limits for Lambda")
if s... | [
"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/lambdafunc.py#L74-L88 | [
"def",
"get_limits",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Getting limits for Lambda\"",
")",
"if",
"self",
".",
"limits",
"!=",
"{",
"}",
":",
"return",
"self",
".",
"limits",
"self",
".",
"_construct_limits",
"(",
")",
"return",
"self",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _LambdaService._update_limits_from_api | Query Lambda's DescribeLimits API action, and update limits
with the quotas returned. Updates ``self.limits``. | awslimitchecker/services/lambdafunc.py | def _update_limits_from_api(self):
"""
Query Lambda's DescribeLimits API action, and update limits
with the quotas returned. Updates ``self.limits``.
"""
logger.debug("Updating limits for Lambda from the AWS API")
if len(self.limits) == 2:
return
self.... | def _update_limits_from_api(self):
"""
Query Lambda's DescribeLimits API action, and update limits
with the quotas returned. Updates ``self.limits``.
"""
logger.debug("Updating limits for Lambda from the AWS API")
if len(self.limits) == 2:
return
self.... | [
"Query",
"Lambda",
"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/lambdafunc.py#L90-L109 | [
"def",
"_update_limits_from_api",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Updating limits for Lambda from the AWS API\"",
")",
"if",
"len",
"(",
"self",
".",
"limits",
")",
"==",
"2",
":",
"return",
"self",
".",
"connect",
"(",
")",
"lims",
"=... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _AutoscalingService.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/autoscaling.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/autoscaling.py#L55-L90 | [
"def",
"find_usage",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Checking usage for service %s\"",
",",
"self",
".",
"service_name",
")",
"self",
".",
"connect",
"(",
")",
"for",
"lim",
"in",
"self",
".",
"limits",
".",
"values",
"(",
")",
":"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _AutoscalingService.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/autoscaling.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/autoscaling.py#L92-L122 | [
"def",
"get_limits",
"(",
"self",
")",
":",
"if",
"self",
".",
"limits",
"!=",
"{",
"}",
":",
"return",
"self",
".",
"limits",
"limits",
"=",
"{",
"}",
"# autoscaleconnection.get_all_groups()",
"limits",
"[",
"'Auto Scaling groups'",
"]",
"=",
"AwsLimit",
"(... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _AutoscalingService._update_limits_from_api | Query EC2's DescribeAccountAttributes API action, and update limits
with the quotas returned. Updates ``self.limits``. | awslimitchecker/services/autoscaling.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()
logger.info("Querying EC2 DescribeAccountAttributes for limits")
lims = self.conn.descr... | def _update_limits_from_api(self):
"""
Query EC2's DescribeAccountAttributes API action, and update limits
with the quotas returned. Updates ``self.limits``.
"""
self.connect()
logger.info("Querying EC2 DescribeAccountAttributes for limits")
lims = self.conn.descr... | [
"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/autoscaling.py#L139-L150 | [
"def",
"_update_limits_from_api",
"(",
"self",
")",
":",
"self",
".",
"connect",
"(",
")",
"logger",
".",
"info",
"(",
"\"Querying EC2 DescribeAccountAttributes for limits\"",
")",
"lims",
"=",
"self",
".",
"conn",
".",
"describe_account_limits",
"(",
")",
"self",... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _EcsService._find_usage_clusters | Find the ECS service usage for clusters. Calls
:py:meth:`~._find_usage_one_cluster` for each cluster. | awslimitchecker/services/ecs.py | def _find_usage_clusters(self):
"""
Find the ECS service usage for clusters. Calls
:py:meth:`~._find_usage_one_cluster` for each cluster.
"""
count = 0
fargate_task_count = 0
paginator = self.conn.get_paginator('list_clusters')
for page in paginator.pagina... | def _find_usage_clusters(self):
"""
Find the ECS service usage for clusters. Calls
:py:meth:`~._find_usage_one_cluster` for each cluster.
"""
count = 0
fargate_task_count = 0
paginator = self.conn.get_paginator('list_clusters')
for page in paginator.pagina... | [
"Find",
"the",
"ECS",
"service",
"usage",
"for",
"clusters",
".",
"Calls",
":",
"py",
":",
"meth",
":",
"~",
".",
"_find_usage_one_cluster",
"for",
"each",
"cluster",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/ecs.py#L77-L121 | [
"def",
"_find_usage_clusters",
"(",
"self",
")",
":",
"count",
"=",
"0",
"fargate_task_count",
"=",
"0",
"paginator",
"=",
"self",
".",
"conn",
".",
"get_paginator",
"(",
"'list_clusters'",
")",
"for",
"page",
"in",
"paginator",
".",
"paginate",
"(",
")",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _EcsService._find_usage_one_cluster | Find usage for services in each cluster.
:param cluster_name: name of the cluster to find usage for
:type cluster_name: str | awslimitchecker/services/ecs.py | def _find_usage_one_cluster(self, cluster_name):
"""
Find usage for services in each cluster.
:param cluster_name: name of the cluster to find usage for
:type cluster_name: str
"""
tps_lim = self.limits['EC2 Tasks per Service (desired count)']
paginator = self.co... | def _find_usage_one_cluster(self, cluster_name):
"""
Find usage for services in each cluster.
:param cluster_name: name of the cluster to find usage for
:type cluster_name: str
"""
tps_lim = self.limits['EC2 Tasks per Service (desired count)']
paginator = self.co... | [
"Find",
"usage",
"for",
"services",
"in",
"each",
"cluster",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/ecs.py#L123-L147 | [
"def",
"_find_usage_one_cluster",
"(",
"self",
",",
"cluster_name",
")",
":",
"tps_lim",
"=",
"self",
".",
"limits",
"[",
"'EC2 Tasks per Service (desired count)'",
"]",
"paginator",
"=",
"self",
".",
"conn",
".",
"get_paginator",
"(",
"'list_services'",
")",
"for... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _ApigatewayService.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/apigateway.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/apigateway.py#L55-L71 | [
"def",
"find_usage",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Checking usage for service %s\"",
",",
"self",
".",
"service_name",
")",
"self",
".",
"connect",
"(",
")",
"for",
"lim",
"in",
"self",
".",
"limits",
".",
"values",
"(",
")",
":"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _ApigatewayService._find_usage_apis | Find usage on APIs / RestAPIs, and resources that are limited per-API.
Update `self.limits`. | awslimitchecker/services/apigateway.py | def _find_usage_apis(self):
"""
Find usage on APIs / RestAPIs, and resources that are limited per-API.
Update `self.limits`.
"""
api_ids = []
logger.debug('Finding usage for APIs')
regional_count = 0
private_count = 0
edge_count = 0
paginat... | def _find_usage_apis(self):
"""
Find usage on APIs / RestAPIs, and resources that are limited per-API.
Update `self.limits`.
"""
api_ids = []
logger.debug('Finding usage for APIs')
regional_count = 0
private_count = 0
edge_count = 0
paginat... | [
"Find",
"usage",
"on",
"APIs",
"/",
"RestAPIs",
"and",
"resources",
"that",
"are",
"limited",
"per",
"-",
"API",
".",
"Update",
"self",
".",
"limits",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/apigateway.py#L73-L150 | [
"def",
"_find_usage_apis",
"(",
"self",
")",
":",
"api_ids",
"=",
"[",
"]",
"logger",
".",
"debug",
"(",
"'Finding usage for APIs'",
")",
"regional_count",
"=",
"0",
"private_count",
"=",
"0",
"edge_count",
"=",
"0",
"paginator",
"=",
"self",
".",
"conn",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _ApigatewayService._find_usage_api_keys | Find usage on API Keys.
Update `self.limits`. | awslimitchecker/services/apigateway.py | def _find_usage_api_keys(self):
"""
Find usage on API Keys.
Update `self.limits`.
"""
logger.debug('Finding usage for API Keys')
key_count = 0
paginator = self.conn.get_paginator('get_api_keys')
for resp in paginator.paginate():
key_count += le... | def _find_usage_api_keys(self):
"""
Find usage on API Keys.
Update `self.limits`.
"""
logger.debug('Finding usage for API Keys')
key_count = 0
paginator = self.conn.get_paginator('get_api_keys')
for resp in paginator.paginate():
key_count += le... | [
"Find",
"usage",
"on",
"API",
"Keys",
".",
"Update",
"self",
".",
"limits",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/apigateway.py#L152-L164 | [
"def",
"_find_usage_api_keys",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"'Finding usage for API Keys'",
")",
"key_count",
"=",
"0",
"paginator",
"=",
"self",
".",
"conn",
".",
"get_paginator",
"(",
"'get_api_keys'",
")",
"for",
"resp",
"in",
"pagina... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _ApigatewayService._find_usage_certs | Find usage on Client Certificates. Update `self.limits`. | awslimitchecker/services/apigateway.py | def _find_usage_certs(self):
"""
Find usage on Client Certificates. Update `self.limits`.
"""
logger.debug('Finding usage for Client Certificates')
cert_count = 0
paginator = self.conn.get_paginator('get_client_certificates')
for resp in paginator.paginate():
... | def _find_usage_certs(self):
"""
Find usage on Client Certificates. Update `self.limits`.
"""
logger.debug('Finding usage for Client Certificates')
cert_count = 0
paginator = self.conn.get_paginator('get_client_certificates')
for resp in paginator.paginate():
... | [
"Find",
"usage",
"on",
"Client",
"Certificates",
".",
"Update",
"self",
".",
"limits",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/apigateway.py#L166-L177 | [
"def",
"_find_usage_certs",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"'Finding usage for Client Certificates'",
")",
"cert_count",
"=",
"0",
"paginator",
"=",
"self",
".",
"conn",
".",
"get_paginator",
"(",
"'get_client_certificates'",
")",
"for",
"resp... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _ApigatewayService._find_usage_vpc_links | Find usage on VPC Links. Update `self.limits`. | awslimitchecker/services/apigateway.py | def _find_usage_vpc_links(self):
"""
Find usage on VPC Links. Update `self.limits`.
"""
logger.debug('Finding usage for VPC Links')
link_count = 0
paginator = self.conn.get_paginator('get_vpc_links')
for resp in paginator.paginate():
link_count += len(... | def _find_usage_vpc_links(self):
"""
Find usage on VPC Links. Update `self.limits`.
"""
logger.debug('Finding usage for VPC Links')
link_count = 0
paginator = self.conn.get_paginator('get_vpc_links')
for resp in paginator.paginate():
link_count += len(... | [
"Find",
"usage",
"on",
"VPC",
"Links",
".",
"Update",
"self",
".",
"limits",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/apigateway.py#L179-L190 | [
"def",
"_find_usage_vpc_links",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"'Finding usage for VPC Links'",
")",
"link_count",
"=",
"0",
"paginator",
"=",
"self",
".",
"conn",
".",
"get_paginator",
"(",
"'get_vpc_links'",
")",
"for",
"resp",
"in",
"pa... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _ApigatewayService._find_usage_plans | Find usage on Usage Plans and plans per API Key. Update `self.limits`. | awslimitchecker/services/apigateway.py | def _find_usage_plans(self):
"""
Find usage on Usage Plans and plans per API Key. Update `self.limits`.
"""
logger.debug('Finding usage for Usage Plans')
plan_count = 0
paginator = self.conn.get_paginator('get_usage_plans')
for resp in paginator.paginate():
... | def _find_usage_plans(self):
"""
Find usage on Usage Plans and plans per API Key. Update `self.limits`.
"""
logger.debug('Finding usage for Usage Plans')
plan_count = 0
paginator = self.conn.get_paginator('get_usage_plans')
for resp in paginator.paginate():
... | [
"Find",
"usage",
"on",
"Usage",
"Plans",
"and",
"plans",
"per",
"API",
"Key",
".",
"Update",
"self",
".",
"limits",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/apigateway.py#L192-L203 | [
"def",
"_find_usage_plans",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"'Finding usage for Usage Plans'",
")",
"plan_count",
"=",
"0",
"paginator",
"=",
"self",
".",
"conn",
".",
"get_paginator",
"(",
"'get_usage_plans'",
")",
"for",
"resp",
"in",
"pa... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _EfsService.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/efs.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/efs.py#L57-L76 | [
"def",
"find_usage",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Checking usage for service %s\"",
",",
"self",
".",
"service_name",
")",
"self",
".",
"connect",
"(",
")",
"for",
"lim",
"in",
"self",
".",
"limits",
".",
"values",
"(",
")",
":"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _EfsService._update_limits_from_api | Call :py:meth:`~.connect` and then check what region we're running in;
adjust default limits as required for regions that differ (us-east-1). | awslimitchecker/services/efs.py | def _update_limits_from_api(self):
"""
Call :py:meth:`~.connect` and then check what region we're running in;
adjust default limits as required for regions that differ (us-east-1).
"""
region_limits = {
'us-east-1': 70
}
self.connect()
rname = ... | def _update_limits_from_api(self):
"""
Call :py:meth:`~.connect` and then check what region we're running in;
adjust default limits as required for regions that differ (us-east-1).
"""
region_limits = {
'us-east-1': 70
}
self.connect()
rname = ... | [
"Call",
":",
"py",
":",
"meth",
":",
"~",
".",
"connect",
"and",
"then",
"check",
"what",
"region",
"we",
"re",
"running",
"in",
";",
"adjust",
"default",
"limits",
"as",
"required",
"for",
"regions",
"that",
"differ",
"(",
"us",
"-",
"east",
"-",
"1... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/efs.py#L116-L131 | [
"def",
"_update_limits_from_api",
"(",
"self",
")",
":",
"region_limits",
"=",
"{",
"'us-east-1'",
":",
"70",
"}",
"self",
".",
"connect",
"(",
")",
"rname",
"=",
"self",
".",
"conn",
".",
"_client_config",
".",
"region_name",
"if",
"rname",
"in",
"region_... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | TrustedAdvisor.update_limits | Poll 'Service Limits' check results from Trusted Advisor, if possible.
Iterate over all :py:class:`~.AwsLimit` objects for the given services
and update their limits from TA if present in TA checks.
:param services: dict of service name (string) to
:py:class:`~._AwsService` objects
... | awslimitchecker/trustedadvisor.py | def update_limits(self):
"""
Poll 'Service Limits' check results from Trusted Advisor, if possible.
Iterate over all :py:class:`~.AwsLimit` objects for the given services
and update their limits from TA if present in TA checks.
:param services: dict of service name (string) to
... | def update_limits(self):
"""
Poll 'Service Limits' check results from Trusted Advisor, if possible.
Iterate over all :py:class:`~.AwsLimit` objects for the given services
and update their limits from TA if present in TA checks.
:param services: dict of service name (string) to
... | [
"Poll",
"Service",
"Limits",
"check",
"results",
"from",
"Trusted",
"Advisor",
"if",
"possible",
".",
"Iterate",
"over",
"all",
":",
"py",
":",
"class",
":",
"~",
".",
"AwsLimit",
"objects",
"for",
"the",
"given",
"services",
"and",
"update",
"their",
"lim... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/trustedadvisor.py#L127-L143 | [
"def",
"update_limits",
"(",
"self",
")",
":",
"if",
"self",
".",
"limits_updated",
":",
"logger",
".",
"debug",
"(",
"'Already polled TA; skipping update'",
")",
"return",
"self",
".",
"connect",
"(",
")",
"ta_results",
"=",
"self",
".",
"_poll",
"(",
")",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | TrustedAdvisor._poll | Poll Trusted Advisor (Support) API for limit checks.
Return a dict of service name (string) keys to nested dict vals, where
each key is a limit name and each value the current numeric limit.
e.g.:
::
{
'EC2': {
'SomeLimit': 10,
... | awslimitchecker/trustedadvisor.py | def _poll(self):
"""
Poll Trusted Advisor (Support) API for limit checks.
Return a dict of service name (string) keys to nested dict vals, where
each key is a limit name and each value the current numeric limit.
e.g.:
::
{
'EC2': {
... | def _poll(self):
"""
Poll Trusted Advisor (Support) API for limit checks.
Return a dict of service name (string) keys to nested dict vals, where
each key is a limit name and each value the current numeric limit.
e.g.:
::
{
'EC2': {
... | [
"Poll",
"Trusted",
"Advisor",
"(",
"Support",
")",
"API",
"for",
"limit",
"checks",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/trustedadvisor.py#L145-L208 | [
"def",
"_poll",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"\"Beginning TrustedAdvisor poll\"",
")",
"tmp",
"=",
"self",
".",
"_get_limit_check_id",
"(",
")",
"if",
"not",
"self",
".",
"have_ta",
":",
"logger",
".",
"info",
"(",
"'TrustedAdvisor.have... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | TrustedAdvisor._get_limit_check_id | Query currently-available TA checks, return the check ID and metadata
of the 'performance/Service Limits' check.
:returns: 2-tuple of Service Limits TA check ID (string),
metadata (list), or (None, None).
:rtype: tuple | awslimitchecker/trustedadvisor.py | def _get_limit_check_id(self):
"""
Query currently-available TA checks, return the check ID and metadata
of the 'performance/Service Limits' check.
:returns: 2-tuple of Service Limits TA check ID (string),
metadata (list), or (None, None).
:rtype: tuple
"""
... | def _get_limit_check_id(self):
"""
Query currently-available TA checks, return the check ID and metadata
of the 'performance/Service Limits' check.
:returns: 2-tuple of Service Limits TA check ID (string),
metadata (list), or (None, None).
:rtype: tuple
"""
... | [
"Query",
"currently",
"-",
"available",
"TA",
"checks",
"return",
"the",
"check",
"ID",
"and",
"metadata",
"of",
"the",
"performance",
"/",
"Service",
"Limits",
"check",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/trustedadvisor.py#L210-L246 | [
"def",
"_get_limit_check_id",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Querying Trusted Advisor checks\"",
")",
"try",
":",
"checks",
"=",
"self",
".",
"conn",
".",
"describe_trusted_advisor_checks",
"(",
"language",
"=",
"'en'",
")",
"[",
"'checks... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | TrustedAdvisor._get_refreshed_check_result | Given the ``check_id``, return the dict of Trusted Advisor check
results. This handles refreshing the Trusted Advisor check, if desired,
according to ``self.refresh_mode`` and ``self.refresh_timeout``.
:param check_id: the Trusted Advisor check ID
:type check_id: str
:returns: d... | awslimitchecker/trustedadvisor.py | def _get_refreshed_check_result(self, check_id):
"""
Given the ``check_id``, return the dict of Trusted Advisor check
results. This handles refreshing the Trusted Advisor check, if desired,
according to ``self.refresh_mode`` and ``self.refresh_timeout``.
:param check_id: the Tru... | def _get_refreshed_check_result(self, check_id):
"""
Given the ``check_id``, return the dict of Trusted Advisor check
results. This handles refreshing the Trusted Advisor check, if desired,
according to ``self.refresh_mode`` and ``self.refresh_timeout``.
:param check_id: the Tru... | [
"Given",
"the",
"check_id",
"return",
"the",
"dict",
"of",
"Trusted",
"Advisor",
"check",
"results",
".",
"This",
"handles",
"refreshing",
"the",
"Trusted",
"Advisor",
"check",
"if",
"desired",
"according",
"to",
"self",
".",
"refresh_mode",
"and",
"self",
"."... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/trustedadvisor.py#L248-L291 | [
"def",
"_get_refreshed_check_result",
"(",
"self",
",",
"check_id",
")",
":",
"# handle a refresh_mode of None right off the bat",
"if",
"self",
".",
"refresh_mode",
"is",
"None",
":",
"logger",
".",
"info",
"(",
"\"Not refreshing Trusted Advisor check (refresh mode \"",
"\... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | TrustedAdvisor._poll_for_refresh | Given a Trusted Advisor check_id that has just been refreshed, poll
until the refresh is complete. Once complete, return the check result.
:param check_id: the Trusted Advisor check ID
:type check_id: str
:returns: dict check result. The return value of
:py:meth:`Support.Clien... | awslimitchecker/trustedadvisor.py | def _poll_for_refresh(self, check_id):
"""
Given a Trusted Advisor check_id that has just been refreshed, poll
until the refresh is complete. Once complete, return the check result.
:param check_id: the Trusted Advisor check ID
:type check_id: str
:returns: dict check re... | def _poll_for_refresh(self, check_id):
"""
Given a Trusted Advisor check_id that has just been refreshed, poll
until the refresh is complete. Once complete, return the check result.
:param check_id: the Trusted Advisor check ID
:type check_id: str
:returns: dict check re... | [
"Given",
"a",
"Trusted",
"Advisor",
"check_id",
"that",
"has",
"just",
"been",
"refreshed",
"poll",
"until",
"the",
"refresh",
"is",
"complete",
".",
"Once",
"complete",
"return",
"the",
"check",
"result",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/trustedadvisor.py#L293-L334 | [
"def",
"_poll_for_refresh",
"(",
"self",
",",
"check_id",
")",
":",
"logger",
".",
"warning",
"(",
"'Polling for TA check %s refresh...'",
",",
"check_id",
")",
"if",
"self",
".",
"refresh_timeout",
"is",
"None",
":",
"# no timeout...",
"cutoff",
"=",
"datetime_no... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | TrustedAdvisor._can_refresh_check | Determine if the given check_id can be refreshed yet.
:param check_id: the Trusted Advisor check ID
:type check_id: str
:return: whether or not the check can be refreshed yet
:rtype: bool | awslimitchecker/trustedadvisor.py | def _can_refresh_check(self, check_id):
"""
Determine if the given check_id can be refreshed yet.
:param check_id: the Trusted Advisor check ID
:type check_id: str
:return: whether or not the check can be refreshed yet
:rtype: bool
"""
try:
re... | def _can_refresh_check(self, check_id):
"""
Determine if the given check_id can be refreshed yet.
:param check_id: the Trusted Advisor check ID
:type check_id: str
:return: whether or not the check can be refreshed yet
:rtype: bool
"""
try:
re... | [
"Determine",
"if",
"the",
"given",
"check_id",
"can",
"be",
"refreshed",
"yet",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/trustedadvisor.py#L336-L363 | [
"def",
"_can_refresh_check",
"(",
"self",
",",
"check_id",
")",
":",
"try",
":",
"refresh_status",
"=",
"self",
".",
"conn",
".",
"describe_trusted_advisor_check_refresh_statuses",
"(",
"checkIds",
"=",
"[",
"check_id",
"]",
")",
"logger",
".",
"debug",
"(",
"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | TrustedAdvisor._get_check_result | Directly wrap
:py:meth:`Support.Client.describe_trusted_advisor_check_result`;
return a 2-tuple of the result dict and the last refresh DateTime.
:param check_id: the Trusted Advisor check ID
:type check_id: str
:return: 2-tuple of (result dict, last refresh DateTime). If the la... | awslimitchecker/trustedadvisor.py | def _get_check_result(self, check_id):
"""
Directly wrap
:py:meth:`Support.Client.describe_trusted_advisor_check_result`;
return a 2-tuple of the result dict and the last refresh DateTime.
:param check_id: the Trusted Advisor check ID
:type check_id: str
:return:... | def _get_check_result(self, check_id):
"""
Directly wrap
:py:meth:`Support.Client.describe_trusted_advisor_check_result`;
return a 2-tuple of the result dict and the last refresh DateTime.
:param check_id: the Trusted Advisor check ID
:type check_id: str
:return:... | [
"Directly",
"wrap",
":",
"py",
":",
"meth",
":",
"Support",
".",
"Client",
".",
"describe_trusted_advisor_check_result",
";",
"return",
"a",
"2",
"-",
"tuple",
"of",
"the",
"result",
"dict",
"and",
"the",
"last",
"refresh",
"DateTime",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/trustedadvisor.py#L365-L389 | [
"def",
"_get_check_result",
"(",
"self",
",",
"check_id",
")",
":",
"checks",
"=",
"self",
".",
"conn",
".",
"describe_trusted_advisor_check_result",
"(",
"checkId",
"=",
"check_id",
",",
"language",
"=",
"'en'",
")",
"try",
":",
"check_datetime",
"=",
"parser... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | TrustedAdvisor._update_services | Given a dict of TrustedAdvisor check results from :py:meth:`~._poll`
and a dict of Service objects passed in to :py:meth:`~.update_limits`,
updated the TrustedAdvisor limits for all services.
:param ta_results: results returned by :py:meth:`~._poll`
:type ta_results: dict
:param... | awslimitchecker/trustedadvisor.py | def _update_services(self, ta_results):
"""
Given a dict of TrustedAdvisor check results from :py:meth:`~._poll`
and a dict of Service objects passed in to :py:meth:`~.update_limits`,
updated the TrustedAdvisor limits for all services.
:param ta_results: results returned by :py:... | def _update_services(self, ta_results):
"""
Given a dict of TrustedAdvisor check results from :py:meth:`~._poll`
and a dict of Service objects passed in to :py:meth:`~.update_limits`,
updated the TrustedAdvisor limits for all services.
:param ta_results: results returned by :py:... | [
"Given",
"a",
"dict",
"of",
"TrustedAdvisor",
"check",
"results",
"from",
":",
"py",
":",
"meth",
":",
"~",
".",
"_poll",
"and",
"a",
"dict",
"of",
"Service",
"objects",
"passed",
"in",
"to",
":",
"py",
":",
"meth",
":",
"~",
".",
"update_limits",
"u... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/trustedadvisor.py#L391-L422 | [
"def",
"_update_services",
"(",
"self",
",",
"ta_results",
")",
":",
"logger",
".",
"debug",
"(",
"\"Updating TA limits on all services\"",
")",
"for",
"svc_name",
"in",
"sorted",
"(",
"ta_results",
".",
"keys",
"(",
")",
")",
":",
"svc_results",
"=",
"ta_resu... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | TrustedAdvisor._make_ta_service_dict | Build our service and limits dict. This is laid out identical to
``self.all_services``, but keys limits by their ``ta_service_name``
and ``ta_limit_name`` properties.
:return: dict of TA service names to TA limit names to AwsLimit objects. | awslimitchecker/trustedadvisor.py | def _make_ta_service_dict(self):
"""
Build our service and limits dict. This is laid out identical to
``self.all_services``, but keys limits by their ``ta_service_name``
and ``ta_limit_name`` properties.
:return: dict of TA service names to TA limit names to AwsLimit objects.
... | def _make_ta_service_dict(self):
"""
Build our service and limits dict. This is laid out identical to
``self.all_services``, but keys limits by their ``ta_service_name``
and ``ta_limit_name`` properties.
:return: dict of TA service names to TA limit names to AwsLimit objects.
... | [
"Build",
"our",
"service",
"and",
"limits",
"dict",
".",
"This",
"is",
"laid",
"out",
"identical",
"to",
"self",
".",
"all_services",
"but",
"keys",
"limits",
"by",
"their",
"ta_service_name",
"and",
"ta_limit_name",
"properties",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/trustedadvisor.py#L424-L439 | [
"def",
"_make_ta_service_dict",
"(",
"self",
")",
":",
"res",
"=",
"{",
"}",
"for",
"svc_name",
"in",
"self",
".",
"all_services",
":",
"svc_obj",
"=",
"self",
".",
"all_services",
"[",
"svc_name",
"]",
"for",
"lim_name",
",",
"lim",
"in",
"svc_obj",
"."... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _ElasticBeanstalkService.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/elasticbeanstalk.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/elasticbeanstalk.py#L54-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 | _ElasticBeanstalkService._find_usage_applications | find usage for ElasticBeanstalk applications | awslimitchecker/services/elasticbeanstalk.py | def _find_usage_applications(self):
"""find usage for ElasticBeanstalk applications"""
applications = self.conn.describe_applications()
self.limits['Applications']._add_current_usage(
len(applications['Applications']),
aws_type='AWS::ElasticBeanstalk::Application',
... | def _find_usage_applications(self):
"""find usage for ElasticBeanstalk applications"""
applications = self.conn.describe_applications()
self.limits['Applications']._add_current_usage(
len(applications['Applications']),
aws_type='AWS::ElasticBeanstalk::Application',
... | [
"find",
"usage",
"for",
"ElasticBeanstalk",
"applications"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/elasticbeanstalk.py#L70-L76 | [
"def",
"_find_usage_applications",
"(",
"self",
")",
":",
"applications",
"=",
"self",
".",
"conn",
".",
"describe_applications",
"(",
")",
"self",
".",
"limits",
"[",
"'Applications'",
"]",
".",
"_add_current_usage",
"(",
"len",
"(",
"applications",
"[",
"'Ap... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _ElasticBeanstalkService._find_usage_application_versions | find usage for ElasticBeanstalk application verions | awslimitchecker/services/elasticbeanstalk.py | def _find_usage_application_versions(self):
"""find usage for ElasticBeanstalk application verions"""
versions = self.conn.describe_application_versions()
self.limits['Application versions']._add_current_usage(
len(versions['ApplicationVersions']),
aws_type='AWS::ElasticB... | def _find_usage_application_versions(self):
"""find usage for ElasticBeanstalk application verions"""
versions = self.conn.describe_application_versions()
self.limits['Application versions']._add_current_usage(
len(versions['ApplicationVersions']),
aws_type='AWS::ElasticB... | [
"find",
"usage",
"for",
"ElasticBeanstalk",
"application",
"verions"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/elasticbeanstalk.py#L78-L84 | [
"def",
"_find_usage_application_versions",
"(",
"self",
")",
":",
"versions",
"=",
"self",
".",
"conn",
".",
"describe_application_versions",
"(",
")",
"self",
".",
"limits",
"[",
"'Application versions'",
"]",
".",
"_add_current_usage",
"(",
"len",
"(",
"versions... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _ElasticBeanstalkService._find_usage_environments | find usage for ElasticBeanstalk environments | awslimitchecker/services/elasticbeanstalk.py | def _find_usage_environments(self):
"""find usage for ElasticBeanstalk environments"""
environments = self.conn.describe_environments()
self.limits['Environments']._add_current_usage(
len(environments['Environments']),
aws_type='AWS::ElasticBeanstalk::Environment',
... | def _find_usage_environments(self):
"""find usage for ElasticBeanstalk environments"""
environments = self.conn.describe_environments()
self.limits['Environments']._add_current_usage(
len(environments['Environments']),
aws_type='AWS::ElasticBeanstalk::Environment',
... | [
"find",
"usage",
"for",
"ElasticBeanstalk",
"environments"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/elasticbeanstalk.py#L86-L92 | [
"def",
"_find_usage_environments",
"(",
"self",
")",
":",
"environments",
"=",
"self",
".",
"conn",
".",
"describe_environments",
"(",
")",
"self",
".",
"limits",
"[",
"'Environments'",
"]",
".",
"_add_current_usage",
"(",
"len",
"(",
"environments",
"[",
"'En... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | format_cmd_output | format command output for docs | docs/build_generated_docs.py | def format_cmd_output(cmd, output, name):
"""format command output for docs"""
formatted = '.. code-block:: console\n\n'
formatted += ' (venv)$ {c}\n'.format(c=cmd)
lines = output.split("\n")
if name != 'help':
for idx, line in enumerate(lines):
if len(line) > 100:
... | def format_cmd_output(cmd, output, name):
"""format command output for docs"""
formatted = '.. code-block:: console\n\n'
formatted += ' (venv)$ {c}\n'.format(c=cmd)
lines = output.split("\n")
if name != 'help':
for idx, line in enumerate(lines):
if len(line) > 100:
... | [
"format",
"command",
"output",
"for",
"docs"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/docs/build_generated_docs.py#L247-L283 | [
"def",
"format_cmd_output",
"(",
"cmd",
",",
"output",
",",
"name",
")",
":",
"formatted",
"=",
"'.. code-block:: console\\n\\n'",
"formatted",
"+=",
"' (venv)$ {c}\\n'",
".",
"format",
"(",
"c",
"=",
"cmd",
")",
"lines",
"=",
"output",
".",
"split",
"(",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | build_docs | Trigger rebuild of all documentation that is dynamically generated
from awslimitchecker. | docs/build_generated_docs.py | def build_docs():
"""
Trigger rebuild of all documentation that is dynamically generated
from awslimitchecker.
"""
if os.environ.get('CI', None) is not None:
print("Not building dynamic docs in CI environment")
raise SystemExit(0)
region = os.environ.get('AWS_DEFAULT_REGION', Non... | def build_docs():
"""
Trigger rebuild of all documentation that is dynamically generated
from awslimitchecker.
"""
if os.environ.get('CI', None) is not None:
print("Not building dynamic docs in CI environment")
raise SystemExit(0)
region = os.environ.get('AWS_DEFAULT_REGION', Non... | [
"Trigger",
"rebuild",
"of",
"all",
"documentation",
"that",
"is",
"dynamically",
"generated",
"from",
"awslimitchecker",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/docs/build_generated_docs.py#L285-L301 | [
"def",
"build_docs",
"(",
")",
":",
"if",
"os",
".",
"environ",
".",
"get",
"(",
"'CI'",
",",
"None",
")",
"is",
"not",
"None",
":",
"print",
"(",
"\"Not building dynamic docs in CI environment\"",
")",
"raise",
"SystemExit",
"(",
"0",
")",
"region",
"=",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _VpcService.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/vpc.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/vpc.py#L59-L78 | [
"def",
"find_usage",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Checking usage for service %s\"",
",",
"self",
".",
"service_name",
")",
"self",
".",
"connect",
"(",
")",
"for",
"lim",
"in",
"self",
".",
"limits",
".",
"values",
"(",
")",
":"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _VpcService._find_usage_vpcs | find usage for VPCs | awslimitchecker/services/vpc.py | def _find_usage_vpcs(self):
"""find usage for VPCs"""
# overall number of VPCs
vpcs = self.conn.describe_vpcs()
self.limits['VPCs']._add_current_usage(
len(vpcs['Vpcs']),
aws_type='AWS::EC2::VPC'
) | def _find_usage_vpcs(self):
"""find usage for VPCs"""
# overall number of VPCs
vpcs = self.conn.describe_vpcs()
self.limits['VPCs']._add_current_usage(
len(vpcs['Vpcs']),
aws_type='AWS::EC2::VPC'
) | [
"find",
"usage",
"for",
"VPCs"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/vpc.py#L80-L87 | [
"def",
"_find_usage_vpcs",
"(",
"self",
")",
":",
"# overall number of VPCs",
"vpcs",
"=",
"self",
".",
"conn",
".",
"describe_vpcs",
"(",
")",
"self",
".",
"limits",
"[",
"'VPCs'",
"]",
".",
"_add_current_usage",
"(",
"len",
"(",
"vpcs",
"[",
"'Vpcs'",
"]... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _VpcService._find_usage_subnets | find usage for Subnets; return dict of SubnetId to AZ | awslimitchecker/services/vpc.py | def _find_usage_subnets(self):
"""find usage for Subnets; return dict of SubnetId to AZ"""
# subnets per VPC
subnet_to_az = {}
subnets = defaultdict(int)
for subnet in self.conn.describe_subnets()['Subnets']:
subnets[subnet['VpcId']] += 1
subnet_to_az[subn... | def _find_usage_subnets(self):
"""find usage for Subnets; return dict of SubnetId to AZ"""
# subnets per VPC
subnet_to_az = {}
subnets = defaultdict(int)
for subnet in self.conn.describe_subnets()['Subnets']:
subnets[subnet['VpcId']] += 1
subnet_to_az[subn... | [
"find",
"usage",
"for",
"Subnets",
";",
"return",
"dict",
"of",
"SubnetId",
"to",
"AZ"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/vpc.py#L89-L103 | [
"def",
"_find_usage_subnets",
"(",
"self",
")",
":",
"# subnets per VPC",
"subnet_to_az",
"=",
"{",
"}",
"subnets",
"=",
"defaultdict",
"(",
"int",
")",
"for",
"subnet",
"in",
"self",
".",
"conn",
".",
"describe_subnets",
"(",
")",
"[",
"'Subnets'",
"]",
"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _VpcService._find_usage_ACLs | find usage for ACLs | awslimitchecker/services/vpc.py | def _find_usage_ACLs(self):
"""find usage for ACLs"""
# Network ACLs per VPC
acls = defaultdict(int)
for acl in self.conn.describe_network_acls()['NetworkAcls']:
acls[acl['VpcId']] += 1
# Rules per network ACL
self.limits['Rules per network ACL']._add_... | def _find_usage_ACLs(self):
"""find usage for ACLs"""
# Network ACLs per VPC
acls = defaultdict(int)
for acl in self.conn.describe_network_acls()['NetworkAcls']:
acls[acl['VpcId']] += 1
# Rules per network ACL
self.limits['Rules per network ACL']._add_... | [
"find",
"usage",
"for",
"ACLs"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/vpc.py#L105-L122 | [
"def",
"_find_usage_ACLs",
"(",
"self",
")",
":",
"# Network ACLs per VPC",
"acls",
"=",
"defaultdict",
"(",
"int",
")",
"for",
"acl",
"in",
"self",
".",
"conn",
".",
"describe_network_acls",
"(",
")",
"[",
"'NetworkAcls'",
"]",
":",
"acls",
"[",
"acl",
"[... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _VpcService._find_usage_route_tables | find usage for route tables | awslimitchecker/services/vpc.py | def _find_usage_route_tables(self):
"""find usage for route tables"""
# Route tables per VPC
tables = defaultdict(int)
for table in self.conn.describe_route_tables()['RouteTables']:
tables[table['VpcId']] += 1
# Entries per route table
routes = [
... | def _find_usage_route_tables(self):
"""find usage for route tables"""
# Route tables per VPC
tables = defaultdict(int)
for table in self.conn.describe_route_tables()['RouteTables']:
tables[table['VpcId']] += 1
# Entries per route table
routes = [
... | [
"find",
"usage",
"for",
"route",
"tables"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/vpc.py#L124-L145 | [
"def",
"_find_usage_route_tables",
"(",
"self",
")",
":",
"# Route tables per VPC",
"tables",
"=",
"defaultdict",
"(",
"int",
")",
"for",
"table",
"in",
"self",
".",
"conn",
".",
"describe_route_tables",
"(",
")",
"[",
"'RouteTables'",
"]",
":",
"tables",
"[",... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _VpcService._find_usage_gateways | find usage for Internet Gateways | awslimitchecker/services/vpc.py | def _find_usage_gateways(self):
"""find usage for Internet Gateways"""
# Internet gateways
gws = self.conn.describe_internet_gateways()
self.limits['Internet gateways']._add_current_usage(
len(gws['InternetGateways']),
aws_type='AWS::EC2::InternetGateway',
... | def _find_usage_gateways(self):
"""find usage for Internet Gateways"""
# Internet gateways
gws = self.conn.describe_internet_gateways()
self.limits['Internet gateways']._add_current_usage(
len(gws['InternetGateways']),
aws_type='AWS::EC2::InternetGateway',
... | [
"find",
"usage",
"for",
"Internet",
"Gateways"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/vpc.py#L147-L154 | [
"def",
"_find_usage_gateways",
"(",
"self",
")",
":",
"# Internet gateways",
"gws",
"=",
"self",
".",
"conn",
".",
"describe_internet_gateways",
"(",
")",
"self",
".",
"limits",
"[",
"'Internet gateways'",
"]",
".",
"_add_current_usage",
"(",
"len",
"(",
"gws",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _VpcService._find_usage_nat_gateways | find usage for NAT Gateways
:param subnet_to_az: dict mapping subnet ID to AZ
:type subnet_to_az: dict | awslimitchecker/services/vpc.py | def _find_usage_nat_gateways(self, subnet_to_az):
"""
find usage for NAT Gateways
:param subnet_to_az: dict mapping subnet ID to AZ
:type subnet_to_az: dict
"""
# currently, some regions (sa-east-1 as one example) don't have NAT
# Gateway service; they return an ... | def _find_usage_nat_gateways(self, subnet_to_az):
"""
find usage for NAT Gateways
:param subnet_to_az: dict mapping subnet ID to AZ
:type subnet_to_az: dict
"""
# currently, some regions (sa-east-1 as one example) don't have NAT
# Gateway service; they return an ... | [
"find",
"usage",
"for",
"NAT",
"Gateways"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/vpc.py#L156-L195 | [
"def",
"_find_usage_nat_gateways",
"(",
"self",
",",
"subnet_to_az",
")",
":",
"# currently, some regions (sa-east-1 as one example) don't have NAT",
"# Gateway service; they return an AuthError,",
"# \"This request has been administratively disabled.\"",
"try",
":",
"gws_per_az",
"=",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _VpcService._find_usages_vpn_gateways | find usage of vpn gateways | awslimitchecker/services/vpc.py | def _find_usages_vpn_gateways(self):
"""find usage of vpn gateways"""
# do not include deleting and deleted in the results
vpngws = self.conn.describe_vpn_gateways(Filters=[
{
'Name': 'state',
'Values': [
'available',
... | def _find_usages_vpn_gateways(self):
"""find usage of vpn gateways"""
# do not include deleting and deleted in the results
vpngws = self.conn.describe_vpn_gateways(Filters=[
{
'Name': 'state',
'Values': [
'available',
... | [
"find",
"usage",
"of",
"vpn",
"gateways"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/vpc.py#L197-L214 | [
"def",
"_find_usages_vpn_gateways",
"(",
"self",
")",
":",
"# do not include deleting and deleted in the results",
"vpngws",
"=",
"self",
".",
"conn",
".",
"describe_vpn_gateways",
"(",
"Filters",
"=",
"[",
"{",
"'Name'",
":",
"'state'",
",",
"'Values'",
":",
"[",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _VpcService._find_usage_network_interfaces | find usage of network interfaces | awslimitchecker/services/vpc.py | def _find_usage_network_interfaces(self):
"""find usage of network interfaces"""
enis = paginate_dict(
self.conn.describe_network_interfaces,
alc_marker_path=['NextToken'],
alc_data_path=['NetworkInterfaces'],
alc_marker_param='NextToken'
)
... | def _find_usage_network_interfaces(self):
"""find usage of network interfaces"""
enis = paginate_dict(
self.conn.describe_network_interfaces,
alc_marker_path=['NextToken'],
alc_data_path=['NetworkInterfaces'],
alc_marker_param='NextToken'
)
... | [
"find",
"usage",
"of",
"network",
"interfaces"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/vpc.py#L216-L228 | [
"def",
"_find_usage_network_interfaces",
"(",
"self",
")",
":",
"enis",
"=",
"paginate_dict",
"(",
"self",
".",
"conn",
".",
"describe_network_interfaces",
",",
"alc_marker_path",
"=",
"[",
"'NextToken'",
"]",
",",
"alc_data_path",
"=",
"[",
"'NetworkInterfaces'",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _VpcService._update_limits_from_api | Query EC2's DescribeAccountAttributes API action and
update the network interface limit, as needed. Updates ``self.limits``.
More info on the network interface limit, from the docs:
'This limit is the greater of either the default limit (350) or your
On-Demand Instance limit multiplied ... | awslimitchecker/services/vpc.py | def _update_limits_from_api(self):
"""
Query EC2's DescribeAccountAttributes API action and
update the network interface limit, as needed. Updates ``self.limits``.
More info on the network interface limit, from the docs:
'This limit is the greater of either the default limit (35... | def _update_limits_from_api(self):
"""
Query EC2's DescribeAccountAttributes API action and
update the network interface limit, as needed. Updates ``self.limits``.
More info on the network interface limit, from the docs:
'This limit is the greater of either the default limit (35... | [
"Query",
"EC2",
"s",
"DescribeAccountAttributes",
"API",
"action",
"and",
"update",
"the",
"network",
"interface",
"limit",
"as",
"needed",
".",
"Updates",
"self",
".",
"limits",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/vpc.py#L339-L359 | [
"def",
"_update_limits_from_api",
"(",
"self",
")",
":",
"self",
".",
"connect",
"(",
")",
"self",
".",
"connect_resource",
"(",
")",
"logger",
".",
"info",
"(",
"\"Querying EC2 DescribeAccountAttributes for limits\"",
")",
"attribs",
"=",
"self",
".",
"conn",
"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _DirectoryserviceService.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/directoryservice.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/directoryservice.py#L55-L80 | [
"def",
"find_usage",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Checking usage for service %s\"",
",",
"self",
".",
"service_name",
")",
"self",
".",
"connect",
"(",
")",
"for",
"lim",
"in",
"self",
".",
"limits",
".",
"values",
"(",
")",
":"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _DirectoryserviceService._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/directoryservice.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.
"""
logger.debug('Setting DirectoryService limits from API')
self.connect()
resp = self.... | 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.
"""
logger.debug('Setting DirectoryService limits from API')
self.connect()
resp = self.... | [
"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/directoryservice.py#L120-L137 | [
"def",
"_update_limits_from_api",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"'Setting DirectoryService limits from API'",
")",
"self",
".",
"connect",
"(",
")",
"resp",
"=",
"self",
".",
"conn",
".",
"get_directory_limits",
"(",
")",
"directory_limits",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _CloudformationService.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/cloudformation.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`.
"""
ignore_statuses = [
'DELETE_COMPLETE'
]
logger.debug("Checking usage for serv... | 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`.
"""
ignore_statuses = [
'DELETE_COMPLETE'
]
logger.debug("Checking usage for serv... | [
"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/cloudformation.py#L54-L78 | [
"def",
"find_usage",
"(",
"self",
")",
":",
"ignore_statuses",
"=",
"[",
"'DELETE_COMPLETE'",
"]",
"logger",
".",
"debug",
"(",
"\"Checking usage for service %s\"",
",",
"self",
".",
"service_name",
")",
"self",
".",
"connect",
"(",
")",
"for",
"lim",
"in",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _CloudformationService._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/cloudformation.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.
"""
logger.debug('Setting CloudFormation limits from API')
self.connect()
resp = self.co... | 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.
"""
logger.debug('Setting CloudFormation limits from API')
self.connect()
resp = self.co... | [
"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/cloudformation.py#L102-L115 | [
"def",
"_update_limits_from_api",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"'Setting CloudFormation limits from API'",
")",
"self",
".",
"connect",
"(",
")",
"resp",
"=",
"self",
".",
"conn",
".",
"describe_account_limits",
"(",
")",
"for",
"lim",
"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | AwsLimit.set_limit_override | Set a new value for this limit, to override the default
(such as when AWS Support has increased a limit of yours).
If ``override_ta`` is True, this value will also supersede
any found through Trusted Advisor.
:param limit_value: the new limit value
:type limit_value: int
... | awslimitchecker/limit.py | def set_limit_override(self, limit_value, override_ta=True):
"""
Set a new value for this limit, to override the default
(such as when AWS Support has increased a limit of yours).
If ``override_ta`` is True, this value will also supersede
any found through Trusted Advisor.
... | def set_limit_override(self, limit_value, override_ta=True):
"""
Set a new value for this limit, to override the default
(such as when AWS Support has increased a limit of yours).
If ``override_ta`` is True, this value will also supersede
any found through Trusted Advisor.
... | [
"Set",
"a",
"new",
"value",
"for",
"this",
"limit",
"to",
"override",
"the",
"default",
"(",
"such",
"as",
"when",
"AWS",
"Support",
"has",
"increased",
"a",
"limit",
"of",
"yours",
")",
".",
"If",
"override_ta",
"is",
"True",
"this",
"value",
"will",
... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/limit.py#L118-L132 | [
"def",
"set_limit_override",
"(",
"self",
",",
"limit_value",
",",
"override_ta",
"=",
"True",
")",
":",
"self",
".",
"limit_override",
"=",
"limit_value",
"self",
".",
"override_ta",
"=",
"override_ta"
] | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | AwsLimit.get_limit_source | Return :py:const:`~awslimitchecker.limit.SOURCE_DEFAULT` if
:py:meth:`~.get_limit` returns the default limit,
:py:const:`~awslimitchecker.limit.SOURCE_OVERRIDE` if it returns a
manually-overridden limit,
:py:const:`~awslimitchecker.limit.SOURCE_TA` if it returns a limit from
Trus... | awslimitchecker/limit.py | def get_limit_source(self):
"""
Return :py:const:`~awslimitchecker.limit.SOURCE_DEFAULT` if
:py:meth:`~.get_limit` returns the default limit,
:py:const:`~awslimitchecker.limit.SOURCE_OVERRIDE` if it returns a
manually-overridden limit,
:py:const:`~awslimitchecker.limit.SO... | def get_limit_source(self):
"""
Return :py:const:`~awslimitchecker.limit.SOURCE_DEFAULT` if
:py:meth:`~.get_limit` returns the default limit,
:py:const:`~awslimitchecker.limit.SOURCE_OVERRIDE` if it returns a
manually-overridden limit,
:py:const:`~awslimitchecker.limit.SO... | [
"Return",
":",
"py",
":",
"const",
":",
"~awslimitchecker",
".",
"limit",
".",
"SOURCE_DEFAULT",
"if",
":",
"py",
":",
"meth",
":",
"~",
".",
"get_limit",
"returns",
"the",
"default",
"limit",
":",
"py",
":",
"const",
":",
"~awslimitchecker",
".",
"limit... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/limit.py#L165-L190 | [
"def",
"get_limit_source",
"(",
"self",
")",
":",
"if",
"self",
".",
"limit_override",
"is",
"not",
"None",
"and",
"(",
"self",
".",
"override_ta",
"is",
"True",
"or",
"(",
"self",
".",
"ta_limit",
"is",
"None",
"and",
"self",
".",
"ta_unlimited",
"is",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | AwsLimit.get_limit | Returns the effective limit value for this Limit,
taking into account limit overrides and Trusted
Advisor data. None is returned for limits that are
explicitly unlimited.
:returns: effective limit value, ``int`` or ``None`` | awslimitchecker/limit.py | def get_limit(self):
"""
Returns the effective limit value for this Limit,
taking into account limit overrides and Trusted
Advisor data. None is returned for limits that are
explicitly unlimited.
:returns: effective limit value, ``int`` or ``None``
"""
li... | def get_limit(self):
"""
Returns the effective limit value for this Limit,
taking into account limit overrides and Trusted
Advisor data. None is returned for limits that are
explicitly unlimited.
:returns: effective limit value, ``int`` or ``None``
"""
li... | [
"Returns",
"the",
"effective",
"limit",
"value",
"for",
"this",
"Limit",
"taking",
"into",
"account",
"limit",
"overrides",
"and",
"Trusted",
"Advisor",
"data",
".",
"None",
"is",
"returned",
"for",
"limits",
"that",
"are",
"explicitly",
"unlimited",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/limit.py#L192-L210 | [
"def",
"get_limit",
"(",
"self",
")",
":",
"limit_type",
"=",
"self",
".",
"get_limit_source",
"(",
")",
"if",
"limit_type",
"==",
"SOURCE_OVERRIDE",
":",
"return",
"self",
".",
"limit_override",
"elif",
"limit_type",
"==",
"SOURCE_API",
":",
"return",
"self",... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | AwsLimit.get_current_usage_str | Get the a string describing the current usage for this limit.
If no usage has been added for this limit, the result will be
"<unknown>".
If the limit has only one current usage instance, this will be
that instance's :py:meth:`~.AwsLimitUsage.__str__` value.
If the limit has mo... | awslimitchecker/limit.py | def get_current_usage_str(self):
"""
Get the a string describing the current usage for this limit.
If no usage has been added for this limit, the result will be
"<unknown>".
If the limit has only one current usage instance, this will be
that instance's :py:meth:`~.AwsLi... | def get_current_usage_str(self):
"""
Get the a string describing the current usage for this limit.
If no usage has been added for this limit, the result will be
"<unknown>".
If the limit has only one current usage instance, this will be
that instance's :py:meth:`~.AwsLi... | [
"Get",
"the",
"a",
"string",
"describing",
"the",
"current",
"usage",
"for",
"this",
"limit",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/limit.py#L233-L262 | [
"def",
"get_current_usage_str",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"_current_usage",
")",
"==",
"0",
":",
"return",
"'<unknown>'",
"if",
"len",
"(",
"self",
".",
"_current_usage",
")",
"==",
"1",
":",
"return",
"str",
"(",
"self",
".... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | AwsLimit._add_current_usage | Add a new current usage value for this limit.
Creates a new :py:class:`~.AwsLimitUsage` instance and
appends it to the internal list. If more than one usage value
is given to this service, they should have ``id`` and
``aws_type`` set.
This method should only be called from the ... | awslimitchecker/limit.py | def _add_current_usage(self, value, maximum=None, resource_id=None,
aws_type=None):
"""
Add a new current usage value for this limit.
Creates a new :py:class:`~.AwsLimitUsage` instance and
appends it to the internal list. If more than one usage value
i... | def _add_current_usage(self, value, maximum=None, resource_id=None,
aws_type=None):
"""
Add a new current usage value for this limit.
Creates a new :py:class:`~.AwsLimitUsage` instance and
appends it to the internal list. If more than one usage value
i... | [
"Add",
"a",
"new",
"current",
"usage",
"value",
"for",
"this",
"limit",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/limit.py#L264-L296 | [
"def",
"_add_current_usage",
"(",
"self",
",",
"value",
",",
"maximum",
"=",
"None",
",",
"resource_id",
"=",
"None",
",",
"aws_type",
"=",
"None",
")",
":",
"self",
".",
"_current_usage",
".",
"append",
"(",
"AwsLimitUsage",
"(",
"self",
",",
"value",
"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | AwsLimit._get_thresholds | Get the warning and critical thresholds for this Limit.
Return type is a 4-tuple of:
1. warning integer (usage) threshold, or None
2. warning percent threshold
3. critical integer (usage) threshold, or None
4. critical percent threshold
:rtype: tuple | awslimitchecker/limit.py | def _get_thresholds(self):
"""
Get the warning and critical thresholds for this Limit.
Return type is a 4-tuple of:
1. warning integer (usage) threshold, or None
2. warning percent threshold
3. critical integer (usage) threshold, or None
4. critical percent thre... | def _get_thresholds(self):
"""
Get the warning and critical thresholds for this Limit.
Return type is a 4-tuple of:
1. warning integer (usage) threshold, or None
2. warning percent threshold
3. critical integer (usage) threshold, or None
4. critical percent thre... | [
"Get",
"the",
"warning",
"and",
"critical",
"thresholds",
"for",
"this",
"Limit",
"."
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/limit.py#L302-L321 | [
"def",
"_get_thresholds",
"(",
"self",
")",
":",
"t",
"=",
"(",
"self",
".",
"warn_count",
",",
"self",
".",
"warn_percent",
"or",
"self",
".",
"def_warning_threshold",
",",
"self",
".",
"crit_count",
",",
"self",
".",
"crit_percent",
"or",
"self",
".",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | AwsLimit.set_threshold_override | Override the default warning and critical thresholds used to evaluate
this limit's usage. Theresholds can be specified as a percentage
of the limit, or as a usage count, or both.
**Note:** The percent thresholds (``warn_percent`` and ``crit_percent``)
have default values that are set gl... | awslimitchecker/limit.py | def set_threshold_override(self, warn_percent=None, warn_count=None,
crit_percent=None, crit_count=None):
"""
Override the default warning and critical thresholds used to evaluate
this limit's usage. Theresholds can be specified as a percentage
of the limit... | def set_threshold_override(self, warn_percent=None, warn_count=None,
crit_percent=None, crit_count=None):
"""
Override the default warning and critical thresholds used to evaluate
this limit's usage. Theresholds can be specified as a percentage
of the limit... | [
"Override",
"the",
"default",
"warning",
"and",
"critical",
"thresholds",
"used",
"to",
"evaluate",
"this",
"limit",
"s",
"usage",
".",
"Theresholds",
"can",
"be",
"specified",
"as",
"a",
"percentage",
"of",
"the",
"limit",
"or",
"as",
"a",
"usage",
"count",... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/limit.py#L323-L353 | [
"def",
"set_threshold_override",
"(",
"self",
",",
"warn_percent",
"=",
"None",
",",
"warn_count",
"=",
"None",
",",
"crit_percent",
"=",
"None",
",",
"crit_count",
"=",
"None",
")",
":",
"self",
".",
"warn_percent",
"=",
"warn_percent",
"self",
".",
"warn_c... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | AwsLimit.check_thresholds | Check this limit's current usage against the specified default
thresholds, and any custom theresholds that have been set on the
class instance. Return True if usage is within thresholds, or false if
warning or critical thresholds have been surpassed.
This method sets internal variables ... | awslimitchecker/limit.py | def check_thresholds(self):
"""
Check this limit's current usage against the specified default
thresholds, and any custom theresholds that have been set on the
class instance. Return True if usage is within thresholds, or false if
warning or critical thresholds have been surpasse... | def check_thresholds(self):
"""
Check this limit's current usage against the specified default
thresholds, and any custom theresholds that have been set on the
class instance. Return True if usage is within thresholds, or false if
warning or critical thresholds have been surpasse... | [
"Check",
"this",
"limit",
"s",
"current",
"usage",
"against",
"the",
"specified",
"default",
"thresholds",
"and",
"any",
"custom",
"theresholds",
"that",
"have",
"been",
"set",
"on",
"the",
"class",
"instance",
".",
"Return",
"True",
"if",
"usage",
"is",
"wi... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/limit.py#L355-L397 | [
"def",
"check_thresholds",
"(",
"self",
")",
":",
"(",
"warn_int",
",",
"warn_pct",
",",
"crit_int",
",",
"crit_pct",
")",
"=",
"self",
".",
"_get_thresholds",
"(",
")",
"all_ok",
"=",
"True",
"for",
"u",
"in",
"self",
".",
"_current_usage",
":",
"usage"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _ElastiCacheService.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/elasticache.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/elasticache.py#L55-L70 | [
"def",
"find_usage",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Checking usage for service %s\"",
",",
"self",
".",
"service_name",
")",
"self",
".",
"connect",
"(",
")",
"for",
"lim",
"in",
"self",
".",
"limits",
".",
"values",
"(",
")",
":"... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _ElastiCacheService._find_usage_nodes | find usage for cache nodes | awslimitchecker/services/elasticache.py | def _find_usage_nodes(self):
"""find usage for cache nodes"""
nodes = 0
paginator = self.conn.get_paginator('describe_cache_clusters')
for page in paginator.paginate(ShowCacheNodeInfo=True):
for cluster in page['CacheClusters']:
try:
num_no... | def _find_usage_nodes(self):
"""find usage for cache nodes"""
nodes = 0
paginator = self.conn.get_paginator('describe_cache_clusters')
for page in paginator.paginate(ShowCacheNodeInfo=True):
for cluster in page['CacheClusters']:
try:
num_no... | [
"find",
"usage",
"for",
"cache",
"nodes"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/elasticache.py#L72-L97 | [
"def",
"_find_usage_nodes",
"(",
"self",
")",
":",
"nodes",
"=",
"0",
"paginator",
"=",
"self",
".",
"conn",
".",
"get_paginator",
"(",
"'describe_cache_clusters'",
")",
"for",
"page",
"in",
"paginator",
".",
"paginate",
"(",
"ShowCacheNodeInfo",
"=",
"True",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _ElastiCacheService._find_usage_parameter_groups | find usage for elasticache parameter groups | awslimitchecker/services/elasticache.py | def _find_usage_parameter_groups(self):
"""find usage for elasticache parameter groups"""
num_groups = 0
paginator = self.conn.get_paginator('describe_cache_parameter_groups')
for page in paginator.paginate():
for group in page['CacheParameterGroups']:
num_gr... | def _find_usage_parameter_groups(self):
"""find usage for elasticache parameter groups"""
num_groups = 0
paginator = self.conn.get_paginator('describe_cache_parameter_groups')
for page in paginator.paginate():
for group in page['CacheParameterGroups']:
num_gr... | [
"find",
"usage",
"for",
"elasticache",
"parameter",
"groups"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/elasticache.py#L117-L128 | [
"def",
"_find_usage_parameter_groups",
"(",
"self",
")",
":",
"num_groups",
"=",
"0",
"paginator",
"=",
"self",
".",
"conn",
".",
"get_paginator",
"(",
"'describe_cache_parameter_groups'",
")",
"for",
"page",
"in",
"paginator",
".",
"paginate",
"(",
")",
":",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _ElastiCacheService._find_usage_security_groups | find usage for elasticache security groups | awslimitchecker/services/elasticache.py | def _find_usage_security_groups(self):
"""find usage for elasticache security groups"""
num_groups = 0
# If EC2-Classic isn't available (e.g., a new account)
# this method will fail with:
# Code: "InvalidParameterValue"
# Message: "Use of cache security groups is n... | def _find_usage_security_groups(self):
"""find usage for elasticache security groups"""
num_groups = 0
# If EC2-Classic isn't available (e.g., a new account)
# this method will fail with:
# Code: "InvalidParameterValue"
# Message: "Use of cache security groups is n... | [
"find",
"usage",
"for",
"elasticache",
"security",
"groups"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/elasticache.py#L130-L154 | [
"def",
"_find_usage_security_groups",
"(",
"self",
")",
":",
"num_groups",
"=",
"0",
"# If EC2-Classic isn't available (e.g., a new account)",
"# this method will fail with:",
"# Code: \"InvalidParameterValue\"",
"# Message: \"Use of cache security groups is not permitted in",
"# ... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _IamService.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/iam.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/iam.py#L65-L76 | [
"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 | _IamService.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/iam.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/iam.py#L78-L146 | [
"def",
"get_limits",
"(",
"self",
")",
":",
"if",
"self",
".",
"limits",
"!=",
"{",
"}",
":",
"return",
"self",
".",
"limits",
"limits",
"=",
"{",
"}",
"limits",
"[",
"'Groups'",
"]",
"=",
"AwsLimit",
"(",
"'Groups'",
",",
"self",
",",
"300",
",",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | _IamService._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/iam.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.
"""
self.connect_resource()
summary = self.resource_conn.AccountSummary()
for k, v in so... | 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.
"""
self.connect_resource()
summary = self.resource_conn.AccountSummary()
for k, v in so... | [
"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/iam.py#L148-L166 | [
"def",
"_update_limits_from_api",
"(",
"self",
")",
":",
"self",
".",
"connect_resource",
"(",
")",
"summary",
"=",
"self",
".",
"resource_conn",
".",
"AccountSummary",
"(",
")",
"for",
"k",
",",
"v",
"in",
"sorted",
"(",
"summary",
".",
"summary_map",
"."... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | Runner.parse_args | parse arguments/options
:param argv: argument list to parse, usually ``sys.argv[1:]``
:type argv: list
:returns: parsed arguments
:rtype: :py:class:`argparse.Namespace` | awslimitchecker/runner.py | def parse_args(self, argv):
"""
parse arguments/options
:param argv: argument list to parse, usually ``sys.argv[1:]``
:type argv: list
:returns: parsed arguments
:rtype: :py:class:`argparse.Namespace`
"""
desc = 'Report on AWS service limits and usage via... | def parse_args(self, argv):
"""
parse arguments/options
:param argv: argument list to parse, usually ``sys.argv[1:]``
:type argv: list
:returns: parsed arguments
:rtype: :py:class:`argparse.Namespace`
"""
desc = 'Report on AWS service limits and usage via... | [
"parse",
"arguments",
"/",
"options"
] | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/runner.py#L73-L217 | [
"def",
"parse_args",
"(",
"self",
",",
"argv",
")",
":",
"desc",
"=",
"'Report on AWS service limits and usage via boto3, optionally '",
"'warn about any services with usage nearing or exceeding their'",
"' limits. For further help, see '",
"'<http://awslimitchecker.readthedocs.org/>'",
... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
train | Runner.print_issue | :param service_name: the name of the service
:type service_name: str
:param limit: the Limit this relates to
:type limit: :py:class:`~.AwsLimit`
:param crits: the specific usage values that crossed the critical
threshold
:type usage: :py:obj:`list` of :py:class:`~.AwsLi... | awslimitchecker/runner.py | def print_issue(self, service_name, limit, crits, warns):
"""
:param service_name: the name of the service
:type service_name: str
:param limit: the Limit this relates to
:type limit: :py:class:`~.AwsLimit`
:param crits: the specific usage values that crossed the critical... | def print_issue(self, service_name, limit, crits, warns):
"""
:param service_name: the name of the service
:type service_name: str
:param limit: the Limit this relates to
:type limit: :py:class:`~.AwsLimit`
:param crits: the specific usage values that crossed the critical... | [
":",
"param",
"service_name",
":",
"the",
"name",
"of",
"the",
"service",
":",
"type",
"service_name",
":",
"str",
":",
"param",
"limit",
":",
"the",
"Limit",
"this",
"relates",
"to",
":",
"type",
"limit",
":",
":",
"py",
":",
"class",
":",
"~",
".",... | jantman/awslimitchecker | python | https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/runner.py#L276-L308 | [
"def",
"print_issue",
"(",
"self",
",",
"service_name",
",",
"limit",
",",
"crits",
",",
"warns",
")",
":",
"usage_str",
"=",
"''",
"if",
"len",
"(",
"crits",
")",
">",
"0",
":",
"tmp",
"=",
"'CRITICAL: '",
"tmp",
"+=",
"', '",
".",
"join",
"(",
"[... | e50197f70f3d0abcc5cfc7fde6336f548b790e34 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.