repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
openid/JWTConnect-Python-OidcService | src/oidcservice/state_interface.py | StateInterface.store_item | def store_item(self, item, item_type, key):
"""
Store a service response.
:param item: The item as a :py:class:`oidcmsg.message.Message`
subclass instance or a JSON document.
:param item_type: The type of request or response
:param key: The key under which the inform... | python | def store_item(self, item, item_type, key):
"""
Store a service response.
:param item: The item as a :py:class:`oidcmsg.message.Message`
subclass instance or a JSON document.
:param item_type: The type of request or response
:param key: The key under which the inform... | [
"def",
"store_item",
"(",
"self",
",",
"item",
",",
"item_type",
",",
"key",
")",
":",
"try",
":",
"_state",
"=",
"self",
".",
"get_state",
"(",
"key",
")",
"except",
"KeyError",
":",
"_state",
"=",
"State",
"(",
")",
"try",
":",
"_state",
"[",
"it... | Store a service response.
:param item: The item as a :py:class:`oidcmsg.message.Message`
subclass instance or a JSON document.
:param item_type: The type of request or response
:param key: The key under which the information should be stored in
the state database | [
"Store",
"a",
"service",
"response",
"."
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/state_interface.py#L69-L89 |
openid/JWTConnect-Python-OidcService | src/oidcservice/state_interface.py | StateInterface.get_iss | def get_iss(self, key):
"""
Get the Issuer ID
:param key: Key to the information in the state database
:return: The issuer ID
"""
_state = self.get_state(key)
if not _state:
raise KeyError(key)
return _state['iss'] | python | def get_iss(self, key):
"""
Get the Issuer ID
:param key: Key to the information in the state database
:return: The issuer ID
"""
_state = self.get_state(key)
if not _state:
raise KeyError(key)
return _state['iss'] | [
"def",
"get_iss",
"(",
"self",
",",
"key",
")",
":",
"_state",
"=",
"self",
".",
"get_state",
"(",
"key",
")",
"if",
"not",
"_state",
":",
"raise",
"KeyError",
"(",
"key",
")",
"return",
"_state",
"[",
"'iss'",
"]"
] | Get the Issuer ID
:param key: Key to the information in the state database
:return: The issuer ID | [
"Get",
"the",
"Issuer",
"ID"
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/state_interface.py#L91-L101 |
openid/JWTConnect-Python-OidcService | src/oidcservice/state_interface.py | StateInterface.get_item | def get_item(self, item_cls, item_type, key):
"""
Get a piece of information (a request or a response) from the state
database.
:param item_cls: The :py:class:`oidcmsg.message.Message` subclass
that described the item.
:param item_type: Which request/response that is... | python | def get_item(self, item_cls, item_type, key):
"""
Get a piece of information (a request or a response) from the state
database.
:param item_cls: The :py:class:`oidcmsg.message.Message` subclass
that described the item.
:param item_type: Which request/response that is... | [
"def",
"get_item",
"(",
"self",
",",
"item_cls",
",",
"item_type",
",",
"key",
")",
":",
"_state",
"=",
"self",
".",
"get_state",
"(",
"key",
")",
"try",
":",
"return",
"item_cls",
"(",
"*",
"*",
"_state",
"[",
"item_type",
"]",
")",
"except",
"TypeE... | Get a piece of information (a request or a response) from the state
database.
:param item_cls: The :py:class:`oidcmsg.message.Message` subclass
that described the item.
:param item_type: Which request/response that is wanted
:param key: The key to the information in the stat... | [
"Get",
"a",
"piece",
"of",
"information",
"(",
"a",
"request",
"or",
"a",
"response",
")",
"from",
"the",
"state",
"database",
"."
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/state_interface.py#L103-L118 |
openid/JWTConnect-Python-OidcService | src/oidcservice/state_interface.py | StateInterface.extend_request_args | def extend_request_args(self, args, item_cls, item_type, key,
parameters, orig=False):
"""
Add a set of parameters and their value to a set of request arguments.
:param args: A dictionary
:param item_cls: The :py:class:`oidcmsg.message.Message` subclass
... | python | def extend_request_args(self, args, item_cls, item_type, key,
parameters, orig=False):
"""
Add a set of parameters and their value to a set of request arguments.
:param args: A dictionary
:param item_cls: The :py:class:`oidcmsg.message.Message` subclass
... | [
"def",
"extend_request_args",
"(",
"self",
",",
"args",
",",
"item_cls",
",",
"item_type",
",",
"key",
",",
"parameters",
",",
"orig",
"=",
"False",
")",
":",
"try",
":",
"item",
"=",
"self",
".",
"get_item",
"(",
"item_cls",
",",
"item_type",
",",
"ke... | Add a set of parameters and their value to a set of request arguments.
:param args: A dictionary
:param item_cls: The :py:class:`oidcmsg.message.Message` subclass
that describes the item
:param item_type: The type of item, this is one of the parameter
names in the :py:cl... | [
"Add",
"a",
"set",
"of",
"parameters",
"and",
"their",
"value",
"to",
"a",
"set",
"of",
"request",
"arguments",
"."
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/state_interface.py#L120-L160 |
openid/JWTConnect-Python-OidcService | src/oidcservice/state_interface.py | StateInterface.multiple_extend_request_args | def multiple_extend_request_args(self, args, key, parameters, item_types,
orig=False):
"""
Go through a set of items (by their type) and add the attribute-value
that match the list of parameters to the arguments
If the same parameter occurs in 2 diffe... | python | def multiple_extend_request_args(self, args, key, parameters, item_types,
orig=False):
"""
Go through a set of items (by their type) and add the attribute-value
that match the list of parameters to the arguments
If the same parameter occurs in 2 diffe... | [
"def",
"multiple_extend_request_args",
"(",
"self",
",",
"args",
",",
"key",
",",
"parameters",
",",
"item_types",
",",
"orig",
"=",
"False",
")",
":",
"_state",
"=",
"self",
".",
"get_state",
"(",
"key",
")",
"for",
"typ",
"in",
"item_types",
":",
"try"... | Go through a set of items (by their type) and add the attribute-value
that match the list of parameters to the arguments
If the same parameter occurs in 2 different items then the value in
the later one will be the one used.
:param args: Initial set of arguments
:param key: Key ... | [
"Go",
"through",
"a",
"set",
"of",
"items",
"(",
"by",
"their",
"type",
")",
"and",
"add",
"the",
"attribute",
"-",
"value",
"that",
"match",
"the",
"list",
"of",
"parameters",
"to",
"the",
"arguments",
"If",
"the",
"same",
"parameter",
"occurs",
"in",
... | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/state_interface.py#L162-L202 |
openid/JWTConnect-Python-OidcService | src/oidcservice/state_interface.py | StateInterface.store_X2state | def store_X2state(self, x, state, xtyp):
"""
Store the connection between some value (x) and a state value.
This allows us later in the game to find the state if we have x.
:param x: The value of x
:param state: The state value
:param xtyp: The type of value x is (e.g. n... | python | def store_X2state(self, x, state, xtyp):
"""
Store the connection between some value (x) and a state value.
This allows us later in the game to find the state if we have x.
:param x: The value of x
:param state: The state value
:param xtyp: The type of value x is (e.g. n... | [
"def",
"store_X2state",
"(",
"self",
",",
"x",
",",
"state",
",",
"xtyp",
")",
":",
"self",
".",
"state_db",
".",
"set",
"(",
"KEY_PATTERN",
"[",
"xtyp",
"]",
".",
"format",
"(",
"x",
")",
",",
"state",
")",
"try",
":",
"_val",
"=",
"self",
".",
... | Store the connection between some value (x) and a state value.
This allows us later in the game to find the state if we have x.
:param x: The value of x
:param state: The state value
:param xtyp: The type of value x is (e.g. nonce, ...) | [
"Store",
"the",
"connection",
"between",
"some",
"value",
"(",
"x",
")",
"and",
"a",
"state",
"value",
".",
"This",
"allows",
"us",
"later",
"in",
"the",
"game",
"to",
"find",
"the",
"state",
"if",
"we",
"have",
"x",
"."
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/state_interface.py#L204-L224 |
openid/JWTConnect-Python-OidcService | src/oidcservice/state_interface.py | StateInterface.get_state_by_X | def get_state_by_X(self, x, xtyp):
"""
Find the state value by providing the x value.
Will raise an exception if the x value is absent from the state
data base.
:param x: The x value
:return: The state value
"""
_state = self.state_db.get(KEY_PATTERN[xtyp... | python | def get_state_by_X(self, x, xtyp):
"""
Find the state value by providing the x value.
Will raise an exception if the x value is absent from the state
data base.
:param x: The x value
:return: The state value
"""
_state = self.state_db.get(KEY_PATTERN[xtyp... | [
"def",
"get_state_by_X",
"(",
"self",
",",
"x",
",",
"xtyp",
")",
":",
"_state",
"=",
"self",
".",
"state_db",
".",
"get",
"(",
"KEY_PATTERN",
"[",
"xtyp",
"]",
".",
"format",
"(",
"x",
")",
")",
"if",
"_state",
":",
"return",
"_state",
"else",
":"... | Find the state value by providing the x value.
Will raise an exception if the x value is absent from the state
data base.
:param x: The x value
:return: The state value | [
"Find",
"the",
"state",
"value",
"by",
"providing",
"the",
"x",
"value",
".",
"Will",
"raise",
"an",
"exception",
"if",
"the",
"x",
"value",
"is",
"absent",
"from",
"the",
"state",
"data",
"base",
"."
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/state_interface.py#L226-L239 |
openid/JWTConnect-Python-OidcService | src/oidcservice/service_context.py | ServiceContext.filename_from_webname | def filename_from_webname(self, webname):
"""
A 1<->1 map is maintained between a URL pointing to a file and
the name of the file in the file system.
As an example if the base_url is 'https://example.com' and a jwks_uri
is 'https://example.com/jwks_uri.json' then the filename of... | python | def filename_from_webname(self, webname):
"""
A 1<->1 map is maintained between a URL pointing to a file and
the name of the file in the file system.
As an example if the base_url is 'https://example.com' and a jwks_uri
is 'https://example.com/jwks_uri.json' then the filename of... | [
"def",
"filename_from_webname",
"(",
"self",
",",
"webname",
")",
":",
"if",
"not",
"webname",
".",
"startswith",
"(",
"self",
".",
"base_url",
")",
":",
"raise",
"ValueError",
"(",
"\"Webname doesn't match base_url\"",
")",
"_name",
"=",
"webname",
"[",
"len"... | A 1<->1 map is maintained between a URL pointing to a file and
the name of the file in the file system.
As an example if the base_url is 'https://example.com' and a jwks_uri
is 'https://example.com/jwks_uri.json' then the filename of the
corresponding file on the local filesystem would ... | [
"A",
"1<",
"-",
">",
"1",
"map",
"is",
"maintained",
"between",
"a",
"URL",
"pointing",
"to",
"a",
"file",
"and",
"the",
"name",
"of",
"the",
"file",
"in",
"the",
"file",
"system",
"."
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/service_context.py#L159-L179 |
openid/JWTConnect-Python-OidcService | src/oidcservice/service_context.py | ServiceContext.generate_request_uris | def generate_request_uris(self, path):
"""
Need to generate a redirect_uri path that is unique for a OP/RP combo
This is to counter the mix-up attack.
:param path: Leading path
:return: A list of one unique URL
"""
m = hashlib.sha256()
try:
m.... | python | def generate_request_uris(self, path):
"""
Need to generate a redirect_uri path that is unique for a OP/RP combo
This is to counter the mix-up attack.
:param path: Leading path
:return: A list of one unique URL
"""
m = hashlib.sha256()
try:
m.... | [
"def",
"generate_request_uris",
"(",
"self",
",",
"path",
")",
":",
"m",
"=",
"hashlib",
".",
"sha256",
"(",
")",
"try",
":",
"m",
".",
"update",
"(",
"as_bytes",
"(",
"self",
".",
"provider_info",
"[",
"'issuer'",
"]",
")",
")",
"except",
"KeyError",
... | Need to generate a redirect_uri path that is unique for a OP/RP combo
This is to counter the mix-up attack.
:param path: Leading path
:return: A list of one unique URL | [
"Need",
"to",
"generate",
"a",
"redirect_uri",
"path",
"that",
"is",
"unique",
"for",
"a",
"OP",
"/",
"RP",
"combo",
"This",
"is",
"to",
"counter",
"the",
"mix",
"-",
"up",
"attack",
"."
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/service_context.py#L181-L198 |
openid/JWTConnect-Python-OidcService | src/oidcservice/service_context.py | ServiceContext.import_keys | def import_keys(self, keyspec):
"""
The client needs it's own set of keys. It can either dynamically
create them or load them from local storage.
This method can also fetch other entities keys provided the
URL points to a JWKS.
:param keyspec:
"""
for whe... | python | def import_keys(self, keyspec):
"""
The client needs it's own set of keys. It can either dynamically
create them or load them from local storage.
This method can also fetch other entities keys provided the
URL points to a JWKS.
:param keyspec:
"""
for whe... | [
"def",
"import_keys",
"(",
"self",
",",
"keyspec",
")",
":",
"for",
"where",
",",
"spec",
"in",
"keyspec",
".",
"items",
"(",
")",
":",
"if",
"where",
"==",
"'file'",
":",
"for",
"typ",
",",
"files",
"in",
"spec",
".",
"items",
"(",
")",
":",
"if... | The client needs it's own set of keys. It can either dynamically
create them or load them from local storage.
This method can also fetch other entities keys provided the
URL points to a JWKS.
:param keyspec: | [
"The",
"client",
"needs",
"it",
"s",
"own",
"set",
"of",
"keys",
".",
"It",
"can",
"either",
"dynamically",
"create",
"them",
"or",
"load",
"them",
"from",
"local",
"storage",
".",
"This",
"method",
"can",
"also",
"fetch",
"other",
"entities",
"keys",
"p... | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/service_context.py#L200-L223 |
openid/JWTConnect-Python-OidcService | src/oidcservice/client_auth.py | assertion_jwt | def assertion_jwt(client_id, keys, audience, algorithm, lifetime=600):
"""
Create a signed Json Web Token containing some information.
:param client_id: The Client ID
:param keys: Signing keys
:param audience: Who is the receivers for this assertion
:param algorithm: Signing algorithm
:para... | python | def assertion_jwt(client_id, keys, audience, algorithm, lifetime=600):
"""
Create a signed Json Web Token containing some information.
:param client_id: The Client ID
:param keys: Signing keys
:param audience: Who is the receivers for this assertion
:param algorithm: Signing algorithm
:para... | [
"def",
"assertion_jwt",
"(",
"client_id",
",",
"keys",
",",
"audience",
",",
"algorithm",
",",
"lifetime",
"=",
"600",
")",
":",
"_now",
"=",
"utc_time_sans_frac",
"(",
")",
"at",
"=",
"AuthnToken",
"(",
"iss",
"=",
"client_id",
",",
"sub",
"=",
"client_... | Create a signed Json Web Token containing some information.
:param client_id: The Client ID
:param keys: Signing keys
:param audience: Who is the receivers for this assertion
:param algorithm: Signing algorithm
:param lifetime: The lifetime of the signed Json Web Token
:return: A Signed Json We... | [
"Create",
"a",
"signed",
"Json",
"Web",
"Token",
"containing",
"some",
"information",
"."
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/client_auth.py#L36-L53 |
openid/JWTConnect-Python-OidcService | src/oidcservice/client_auth.py | find_token | def find_token(request, token_type, service, **kwargs):
"""
The access token can be in a number of places.
There are priority rules as to which one to use, abide by those:
1 If it's among the request parameters use that
2 If among the extra keyword arguments
3 Acquired by a previous run service... | python | def find_token(request, token_type, service, **kwargs):
"""
The access token can be in a number of places.
There are priority rules as to which one to use, abide by those:
1 If it's among the request parameters use that
2 If among the extra keyword arguments
3 Acquired by a previous run service... | [
"def",
"find_token",
"(",
"request",
",",
"token_type",
",",
"service",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"request",
"is",
"not",
"None",
":",
"try",
":",
"_token",
"=",
"request",
"[",
"token_type",
"]",
"except",
"KeyError",
":",
"pass",
"else... | The access token can be in a number of places.
There are priority rules as to which one to use, abide by those:
1 If it's among the request parameters use that
2 If among the extra keyword arguments
3 Acquired by a previous run service.
:param request:
:param token_type:
:param service:
... | [
"The",
"access",
"token",
"can",
"be",
"in",
"a",
"number",
"of",
"places",
".",
"There",
"are",
"priority",
"rules",
"as",
"to",
"which",
"one",
"to",
"use",
"abide",
"by",
"those",
":"
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/client_auth.py#L186-L220 |
openid/JWTConnect-Python-OidcService | src/oidcservice/client_auth.py | valid_service_context | def valid_service_context(service_context, when=0):
"""
Check if the client_secret has expired
:param service_context: A
:py:class:`oidcservice.service_context.ServiceContext` instance
:param when: A time stamp against which the expiration time is to be checked
:return: True if the client_s... | python | def valid_service_context(service_context, when=0):
"""
Check if the client_secret has expired
:param service_context: A
:py:class:`oidcservice.service_context.ServiceContext` instance
:param when: A time stamp against which the expiration time is to be checked
:return: True if the client_s... | [
"def",
"valid_service_context",
"(",
"service_context",
",",
"when",
"=",
"0",
")",
":",
"eta",
"=",
"getattr",
"(",
"service_context",
",",
"'client_secret_expires_at'",
",",
"0",
")",
"now",
"=",
"when",
"or",
"utc_time_sans_frac",
"(",
")",
"if",
"eta",
"... | Check if the client_secret has expired
:param service_context: A
:py:class:`oidcservice.service_context.ServiceContext` instance
:param when: A time stamp against which the expiration time is to be checked
:return: True if the client_secret is still valid | [
"Check",
"if",
"the",
"client_secret",
"has",
"expired"
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/client_auth.py#L491-L504 |
openid/JWTConnect-Python-OidcService | src/oidcservice/client_auth.py | ClientSecretBasic.construct | def construct(self, request, service=None, http_args=None, **kwargs):
"""
Construct a dictionary to be added to the HTTP request headers
:param request: The request
:param service: A
:py:class:`oidcservice.service.Service` instance
:param http_args: HTTP arguments
... | python | def construct(self, request, service=None, http_args=None, **kwargs):
"""
Construct a dictionary to be added to the HTTP request headers
:param request: The request
:param service: A
:py:class:`oidcservice.service.Service` instance
:param http_args: HTTP arguments
... | [
"def",
"construct",
"(",
"self",
",",
"request",
",",
"service",
"=",
"None",
",",
"http_args",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"http_args",
"is",
"None",
":",
"http_args",
"=",
"{",
"}",
"if",
"\"headers\"",
"not",
"in",
"http_... | Construct a dictionary to be added to the HTTP request headers
:param request: The request
:param service: A
:py:class:`oidcservice.service.Service` instance
:param http_args: HTTP arguments
:return: dictionary of HTTP arguments | [
"Construct",
"a",
"dictionary",
"to",
"be",
"added",
"to",
"the",
"HTTP",
"request",
"headers"
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/client_auth.py#L82-L151 |
openid/JWTConnect-Python-OidcService | src/oidcservice/client_auth.py | BearerHeader.construct | def construct(self, request=None, service=None, http_args=None,
**kwargs):
"""
Constructing the Authorization header. The value of
the Authorization header is "Bearer <access_token>".
:param request: Request class instance
:param service: Service
:param... | python | def construct(self, request=None, service=None, http_args=None,
**kwargs):
"""
Constructing the Authorization header. The value of
the Authorization header is "Bearer <access_token>".
:param request: Request class instance
:param service: Service
:param... | [
"def",
"construct",
"(",
"self",
",",
"request",
"=",
"None",
",",
"service",
"=",
"None",
",",
"http_args",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"service",
".",
"service_name",
"==",
"'refresh_token'",
":",
"_acc_token",
"=",
"find_toke... | Constructing the Authorization header. The value of
the Authorization header is "Bearer <access_token>".
:param request: Request class instance
:param service: Service
:param http_args: HTTP header arguments
:param kwargs: extra keyword arguments
:return: | [
"Constructing",
"the",
"Authorization",
"header",
".",
"The",
"value",
"of",
"the",
"Authorization",
"header",
"is",
"Bearer",
"<access_token",
">",
"."
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/client_auth.py#L225-L260 |
openid/JWTConnect-Python-OidcService | src/oidcservice/client_auth.py | BearerBody.construct | def construct(self, request, service=None, http_args=None, **kwargs):
"""
Will add a token to the request if not present
:param request: The request
:param service_context: A
:py:class:`oidcservice.service.Service` instance
:param http_args: HTTP arguments
:p... | python | def construct(self, request, service=None, http_args=None, **kwargs):
"""
Will add a token to the request if not present
:param request: The request
:param service_context: A
:py:class:`oidcservice.service.Service` instance
:param http_args: HTTP arguments
:p... | [
"def",
"construct",
"(",
"self",
",",
"request",
",",
"service",
"=",
"None",
",",
"http_args",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"_acc_token",
"=",
"''",
"for",
"_token_type",
"in",
"[",
"'access_token'",
",",
"'refresh_token'",
"]",
":",
... | Will add a token to the request if not present
:param request: The request
:param service_context: A
:py:class:`oidcservice.service.Service` instance
:param http_args: HTTP arguments
:param kwargs: extra keyword arguments
:return: A possibly modified dictionary with ... | [
"Will",
"add",
"a",
"token",
"to",
"the",
"request",
"if",
"not",
"present"
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/client_auth.py#L264-L287 |
openid/JWTConnect-Python-OidcService | src/oidcservice/client_auth.py | JWSAuthnMethod.choose_algorithm | def choose_algorithm(self, context, **kwargs):
"""
Pick signing algorithm
:param context: Signing context
:param kwargs: extra keyword arguments
:return: Name of a signing algorithm
"""
try:
algorithm = kwargs["algorithm"]
except KeyError:
... | python | def choose_algorithm(self, context, **kwargs):
"""
Pick signing algorithm
:param context: Signing context
:param kwargs: extra keyword arguments
:return: Name of a signing algorithm
"""
try:
algorithm = kwargs["algorithm"]
except KeyError:
... | [
"def",
"choose_algorithm",
"(",
"self",
",",
"context",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"algorithm",
"=",
"kwargs",
"[",
"\"algorithm\"",
"]",
"except",
"KeyError",
":",
"# different contexts uses different signing algorithms",
"algorithm",
"=",
"DE... | Pick signing algorithm
:param context: Signing context
:param kwargs: extra keyword arguments
:return: Name of a signing algorithm | [
"Pick",
"signing",
"algorithm"
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/client_auth.py#L314-L329 |
openid/JWTConnect-Python-OidcService | src/oidcservice/client_auth.py | JWSAuthnMethod.get_signing_key | def get_signing_key(self, algorithm, service_context):
"""
Pick signing key based on signing algorithm to be used
:param algorithm: Signing algorithm
:param service_context: A
:py:class:`oidcservice.service_context.ServiceContext` instance
:return: A key
"""
... | python | def get_signing_key(self, algorithm, service_context):
"""
Pick signing key based on signing algorithm to be used
:param algorithm: Signing algorithm
:param service_context: A
:py:class:`oidcservice.service_context.ServiceContext` instance
:return: A key
"""
... | [
"def",
"get_signing_key",
"(",
"self",
",",
"algorithm",
",",
"service_context",
")",
":",
"return",
"service_context",
".",
"keyjar",
".",
"get_signing_key",
"(",
"alg2keytype",
"(",
"algorithm",
")",
",",
"alg",
"=",
"algorithm",
")"
] | Pick signing key based on signing algorithm to be used
:param algorithm: Signing algorithm
:param service_context: A
:py:class:`oidcservice.service_context.ServiceContext` instance
:return: A key | [
"Pick",
"signing",
"key",
"based",
"on",
"signing",
"algorithm",
"to",
"be",
"used"
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/client_auth.py#L331-L341 |
openid/JWTConnect-Python-OidcService | src/oidcservice/client_auth.py | JWSAuthnMethod.get_key_by_kid | def get_key_by_kid(self, kid, algorithm, service_context):
"""
Pick a key that matches a given key ID and signing algorithm.
:param kid: Key ID
:param algorithm: Signing algorithm
:param service_context: A
:py:class:`oidcservice.service_context.ServiceContext` instan... | python | def get_key_by_kid(self, kid, algorithm, service_context):
"""
Pick a key that matches a given key ID and signing algorithm.
:param kid: Key ID
:param algorithm: Signing algorithm
:param service_context: A
:py:class:`oidcservice.service_context.ServiceContext` instan... | [
"def",
"get_key_by_kid",
"(",
"self",
",",
"kid",
",",
"algorithm",
",",
"service_context",
")",
":",
"_key",
"=",
"service_context",
".",
"keyjar",
".",
"get_key_by_kid",
"(",
"kid",
")",
"if",
"_key",
":",
"ktype",
"=",
"alg2keytype",
"(",
"algorithm",
"... | Pick a key that matches a given key ID and signing algorithm.
:param kid: Key ID
:param algorithm: Signing algorithm
:param service_context: A
:py:class:`oidcservice.service_context.ServiceContext` instance
:return: A matching key | [
"Pick",
"a",
"key",
"that",
"matches",
"a",
"given",
"key",
"ID",
"and",
"signing",
"algorithm",
"."
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/client_auth.py#L343-L361 |
openid/JWTConnect-Python-OidcService | src/oidcservice/client_auth.py | JWSAuthnMethod.construct | def construct(self, request, service=None, http_args=None, **kwargs):
"""
Constructs a client assertion and signs it with a key.
The request is modified as a side effect.
:param request: The request
:param service: A :py:class:`oidcservice.service.Service` instance
:para... | python | def construct(self, request, service=None, http_args=None, **kwargs):
"""
Constructs a client assertion and signs it with a key.
The request is modified as a side effect.
:param request: The request
:param service: A :py:class:`oidcservice.service.Service` instance
:para... | [
"def",
"construct",
"(",
"self",
",",
"request",
",",
"service",
"=",
"None",
",",
"http_args",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'client_assertion'",
"in",
"kwargs",
":",
"request",
"[",
"\"client_assertion\"",
"]",
"=",
"kwargs",
"... | Constructs a client assertion and signs it with a key.
The request is modified as a side effect.
:param request: The request
:param service: A :py:class:`oidcservice.service.Service` instance
:param http_args: HTTP arguments
:param kwargs: Extra arguments
:return: Constr... | [
"Constructs",
"a",
"client",
"assertion",
"and",
"signs",
"it",
"with",
"a",
"key",
".",
"The",
"request",
"is",
"modified",
"as",
"a",
"side",
"effect",
"."
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/client_auth.py#L363-L445 |
openid/JWTConnect-Python-OidcService | src/oidcservice/oauth2/provider_info_discovery.py | ProviderInfoDiscovery.get_endpoint | def get_endpoint(self):
"""
Find the issuer ID and from it construct the service endpoint
:return: Service endpoint
"""
try:
_iss = self.service_context.issuer
except AttributeError:
_iss = self.endpoint
if _iss.endswith('/'):
... | python | def get_endpoint(self):
"""
Find the issuer ID and from it construct the service endpoint
:return: Service endpoint
"""
try:
_iss = self.service_context.issuer
except AttributeError:
_iss = self.endpoint
if _iss.endswith('/'):
... | [
"def",
"get_endpoint",
"(",
"self",
")",
":",
"try",
":",
"_iss",
"=",
"self",
".",
"service_context",
".",
"issuer",
"except",
"AttributeError",
":",
"_iss",
"=",
"self",
".",
"endpoint",
"if",
"_iss",
".",
"endswith",
"(",
"'/'",
")",
":",
"return",
... | Find the issuer ID and from it construct the service endpoint
:return: Service endpoint | [
"Find",
"the",
"issuer",
"ID",
"and",
"from",
"it",
"construct",
"the",
"service",
"endpoint"
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/oauth2/provider_info_discovery.py#L28-L42 |
openid/JWTConnect-Python-OidcService | src/oidcservice/oauth2/provider_info_discovery.py | ProviderInfoDiscovery._update_service_context | def _update_service_context(self, resp, **kwargs):
"""
Deal with Provider Config Response. Based on the provider info
response a set of parameters in different places needs to be set.
:param resp: The provider info response
:param service_context: Information collected/used by s... | python | def _update_service_context(self, resp, **kwargs):
"""
Deal with Provider Config Response. Based on the provider info
response a set of parameters in different places needs to be set.
:param resp: The provider info response
:param service_context: Information collected/used by s... | [
"def",
"_update_service_context",
"(",
"self",
",",
"resp",
",",
"*",
"*",
"kwargs",
")",
":",
"issuer",
"=",
"self",
".",
"service_context",
".",
"issuer",
"# Verify that the issuer value received is the same as the",
"# url that was used as service endpoint (without the .we... | Deal with Provider Config Response. Based on the provider info
response a set of parameters in different places needs to be set.
:param resp: The provider info response
:param service_context: Information collected/used by services | [
"Deal",
"with",
"Provider",
"Config",
"Response",
".",
"Based",
"on",
"the",
"provider",
"info",
"response",
"a",
"set",
"of",
"parameters",
"in",
"different",
"places",
"needs",
"to",
"be",
"set",
"."
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/oauth2/provider_info_discovery.py#L54-L129 |
openid/JWTConnect-Python-OidcService | src/oidcservice/oidc/webfinger.py | WebFinger.query | def query(self, resource):
"""
Given a resource identifier find the domain specifier and then
construct the webfinger request. Implements
http://openid.net/specs/openid-connect-discovery-1_0.html#NormalizationSteps
:param resource:
"""
if resource[0] in ['=', '@'... | python | def query(self, resource):
"""
Given a resource identifier find the domain specifier and then
construct the webfinger request. Implements
http://openid.net/specs/openid-connect-discovery-1_0.html#NormalizationSteps
:param resource:
"""
if resource[0] in ['=', '@'... | [
"def",
"query",
"(",
"self",
",",
"resource",
")",
":",
"if",
"resource",
"[",
"0",
"]",
"in",
"[",
"'='",
",",
"'@'",
",",
"'!'",
"]",
":",
"# Have no process for handling these",
"raise",
"ValueError",
"(",
"'Not allowed resource identifier'",
")",
"try",
... | Given a resource identifier find the domain specifier and then
construct the webfinger request. Implements
http://openid.net/specs/openid-connect-discovery-1_0.html#NormalizationSteps
:param resource: | [
"Given",
"a",
"resource",
"identifier",
"find",
"the",
"domain",
"specifier",
"and",
"then",
"construct",
"the",
"webfinger",
"request",
".",
"Implements",
"http",
":",
"//",
"openid",
".",
"net",
"/",
"specs",
"/",
"openid",
"-",
"connect",
"-",
"discovery"... | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/oidc/webfinger.py#L80-L150 |
openid/JWTConnect-Python-OidcService | src/oidcservice/util.py | get_http_url | def get_http_url(url, req, method='GET'):
"""
Add a query part representing the request to a url that may already contain
a query part. Only done if the HTTP method used is 'GET' or 'DELETE'.
:param url: The URL
:param req: The request as a :py:class:`oidcmsg.message.Message` instance
:param me... | python | def get_http_url(url, req, method='GET'):
"""
Add a query part representing the request to a url that may already contain
a query part. Only done if the HTTP method used is 'GET' or 'DELETE'.
:param url: The URL
:param req: The request as a :py:class:`oidcmsg.message.Message` instance
:param me... | [
"def",
"get_http_url",
"(",
"url",
",",
"req",
",",
"method",
"=",
"'GET'",
")",
":",
"if",
"method",
"in",
"[",
"\"GET\"",
",",
"\"DELETE\"",
"]",
":",
"if",
"req",
".",
"keys",
"(",
")",
":",
"_req",
"=",
"req",
".",
"copy",
"(",
")",
"comp",
... | Add a query part representing the request to a url that may already contain
a query part. Only done if the HTTP method used is 'GET' or 'DELETE'.
:param url: The URL
:param req: The request as a :py:class:`oidcmsg.message.Message` instance
:param method: The HTTP method
:return: A possibly modified... | [
"Add",
"a",
"query",
"part",
"representing",
"the",
"request",
"to",
"a",
"url",
"that",
"may",
"already",
"contain",
"a",
"query",
"part",
".",
"Only",
"done",
"if",
"the",
"HTTP",
"method",
"used",
"is",
"GET",
"or",
"DELETE",
"."
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/util.py#L19-L42 |
openid/JWTConnect-Python-OidcService | src/oidcservice/util.py | get_http_body | def get_http_body(req, content_type=URL_ENCODED):
"""
Get the message into the format that should be places in the body part
of a HTTP request.
:param req: The service request as a :py:class:`oidcmsg.message.Message`
instance
:param content_type: The format of the body part.
:return: T... | python | def get_http_body(req, content_type=URL_ENCODED):
"""
Get the message into the format that should be places in the body part
of a HTTP request.
:param req: The service request as a :py:class:`oidcmsg.message.Message`
instance
:param content_type: The format of the body part.
:return: T... | [
"def",
"get_http_body",
"(",
"req",
",",
"content_type",
"=",
"URL_ENCODED",
")",
":",
"if",
"URL_ENCODED",
"in",
"content_type",
":",
"return",
"req",
".",
"to_urlencoded",
"(",
")",
"elif",
"JSON_ENCODED",
"in",
"content_type",
":",
"return",
"req",
".",
"... | Get the message into the format that should be places in the body part
of a HTTP request.
:param req: The service request as a :py:class:`oidcmsg.message.Message`
instance
:param content_type: The format of the body part.
:return: The correctly formatet service request. | [
"Get",
"the",
"message",
"into",
"the",
"format",
"that",
"should",
"be",
"places",
"in",
"the",
"body",
"part",
"of",
"a",
"HTTP",
"request",
"."
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/util.py#L45-L63 |
openid/JWTConnect-Python-OidcService | src/oidcservice/util.py | modsplit | def modsplit(s):
"""Split importable"""
if ':' in s:
c = s.split(':')
if len(c) != 2:
raise ValueError("Syntax error: {s}")
return c[0], c[1]
else:
c = s.split('.')
if len(c) < 2:
raise ValueError("Syntax error: {s}")
return '.'.join(c[... | python | def modsplit(s):
"""Split importable"""
if ':' in s:
c = s.split(':')
if len(c) != 2:
raise ValueError("Syntax error: {s}")
return c[0], c[1]
else:
c = s.split('.')
if len(c) < 2:
raise ValueError("Syntax error: {s}")
return '.'.join(c[... | [
"def",
"modsplit",
"(",
"s",
")",
":",
"if",
"':'",
"in",
"s",
":",
"c",
"=",
"s",
".",
"split",
"(",
"':'",
")",
"if",
"len",
"(",
"c",
")",
"!=",
"2",
":",
"raise",
"ValueError",
"(",
"\"Syntax error: {s}\"",
")",
"return",
"c",
"[",
"0",
"]"... | Split importable | [
"Split",
"importable"
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/util.py#L72-L83 |
openid/JWTConnect-Python-OidcService | src/oidcservice/util.py | importer | def importer(name):
"""Import by name"""
c1, c2 = modsplit(name)
module = importlib.import_module(c1)
return getattr(module, c2) | python | def importer(name):
"""Import by name"""
c1, c2 = modsplit(name)
module = importlib.import_module(c1)
return getattr(module, c2) | [
"def",
"importer",
"(",
"name",
")",
":",
"c1",
",",
"c2",
"=",
"modsplit",
"(",
"name",
")",
"module",
"=",
"importlib",
".",
"import_module",
"(",
"c1",
")",
"return",
"getattr",
"(",
"module",
",",
"c2",
")"
] | Import by name | [
"Import",
"by",
"name"
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/util.py#L86-L90 |
openid/JWTConnect-Python-OidcService | src/oidcservice/__init__.py | rndstr | def rndstr(size=16):
"""
Returns a string of random ascii characters or digits
:param size: The length of the string
:return: string
"""
_basech = string.ascii_letters + string.digits
return "".join([rnd.choice(_basech) for _ in range(size)]) | python | def rndstr(size=16):
"""
Returns a string of random ascii characters or digits
:param size: The length of the string
:return: string
"""
_basech = string.ascii_letters + string.digits
return "".join([rnd.choice(_basech) for _ in range(size)]) | [
"def",
"rndstr",
"(",
"size",
"=",
"16",
")",
":",
"_basech",
"=",
"string",
".",
"ascii_letters",
"+",
"string",
".",
"digits",
"return",
"\"\"",
".",
"join",
"(",
"[",
"rnd",
".",
"choice",
"(",
"_basech",
")",
"for",
"_",
"in",
"range",
"(",
"si... | Returns a string of random ascii characters or digits
:param size: The length of the string
:return: string | [
"Returns",
"a",
"string",
"of",
"random",
"ascii",
"characters",
"or",
"digits"
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/__init__.py#L35-L43 |
openid/JWTConnect-Python-OidcService | src/oidcservice/oidc/provider_info_discovery.py | add_redirect_uris | def add_redirect_uris(request_args, service=None, **kwargs):
"""
Add redirect_uris to the request arguments.
:param request_args: Incomming request arguments
:param service: A link to the service
:param kwargs: Possible extra keyword arguments
:return: A possibly augmented set of request argume... | python | def add_redirect_uris(request_args, service=None, **kwargs):
"""
Add redirect_uris to the request arguments.
:param request_args: Incomming request arguments
:param service: A link to the service
:param kwargs: Possible extra keyword arguments
:return: A possibly augmented set of request argume... | [
"def",
"add_redirect_uris",
"(",
"request_args",
",",
"service",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"_context",
"=",
"service",
".",
"service_context",
"if",
"\"redirect_uris\"",
"not",
"in",
"request_args",
":",
"# Callbacks is a dictionary with callba... | Add redirect_uris to the request arguments.
:param request_args: Incomming request arguments
:param service: A link to the service
:param kwargs: Possible extra keyword arguments
:return: A possibly augmented set of request arguments. | [
"Add",
"redirect_uris",
"to",
"the",
"request",
"arguments",
"."
] | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/oidc/provider_info_discovery.py#L48-L70 |
openid/JWTConnect-Python-OidcService | src/oidcservice/oidc/provider_info_discovery.py | ProviderInfoDiscovery.match_preferences | def match_preferences(self, pcr=None, issuer=None):
"""
Match the clients preferences against what the provider can do.
This is to prepare for later client registration and or what
functionality the client actually will use.
In the client configuration the client preferences are ... | python | def match_preferences(self, pcr=None, issuer=None):
"""
Match the clients preferences against what the provider can do.
This is to prepare for later client registration and or what
functionality the client actually will use.
In the client configuration the client preferences are ... | [
"def",
"match_preferences",
"(",
"self",
",",
"pcr",
"=",
"None",
",",
"issuer",
"=",
"None",
")",
":",
"if",
"not",
"pcr",
":",
"pcr",
"=",
"self",
".",
"service_context",
".",
"provider_info",
"regreq",
"=",
"oidc",
".",
"RegistrationRequest",
"for",
"... | Match the clients preferences against what the provider can do.
This is to prepare for later client registration and or what
functionality the client actually will use.
In the client configuration the client preferences are expressed.
These are then compared with the Provider Configurati... | [
"Match",
"the",
"clients",
"preferences",
"against",
"what",
"the",
"provider",
"can",
"do",
".",
"This",
"is",
"to",
"prepare",
"for",
"later",
"client",
"registration",
"and",
"or",
"what",
"functionality",
"the",
"client",
"actually",
"will",
"use",
".",
... | train | https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/oidc/provider_info_discovery.py#L93-L178 |
libindic/soundex | libindic/soundex/__init__.py | Soundex.soundexCode | def soundexCode(self, char):
'''Return the soundex code for given character
:param char:
Character whose soundex code is needed
:return:
Returns soundex code if character is found in charmap
else returns 0
'''
lang = get_languag... | python | def soundexCode(self, char):
'''Return the soundex code for given character
:param char:
Character whose soundex code is needed
:return:
Returns soundex code if character is found in charmap
else returns 0
'''
lang = get_languag... | [
"def",
"soundexCode",
"(",
"self",
",",
"char",
")",
":",
"lang",
"=",
"get_language",
"(",
"char",
")",
"try",
":",
"if",
"lang",
"==",
"\"en_US\"",
":",
"return",
"_soundex_map",
"[",
"\"soundex_en\"",
"]",
"[",
"charmap",
"[",
"lang",
"]",
".",
"ind... | Return the soundex code for given character
:param char:
Character whose soundex code is needed
:return:
Returns soundex code if character is found in charmap
else returns 0 | [
"Return",
"the",
"soundex",
"code",
"for",
"given",
"character"
] | train | https://github.com/libindic/soundex/blob/5d41126b9a017ecee0ae71902388c7bf47722907/libindic/soundex/__init__.py#L45-L65 |
libindic/soundex | libindic/soundex/__init__.py | Soundex.soundex | def soundex(self, name, length=8):
'''Calculate soundex of given string
This function calculates soundex for Indian language string
as well as English string.
This function is exposed as service method for JSONRPC in
SILPA framework.
:param name: String ... | python | def soundex(self, name, length=8):
'''Calculate soundex of given string
This function calculates soundex for Indian language string
as well as English string.
This function is exposed as service method for JSONRPC in
SILPA framework.
:param name: String ... | [
"def",
"soundex",
"(",
"self",
",",
"name",
",",
"length",
"=",
"8",
")",
":",
"sndx",
"=",
"[",
"]",
"fc",
"=",
"name",
"[",
"0",
"]",
"# translate alpha chars in name to soundex digits",
"for",
"c",
"in",
"name",
"[",
"1",
":",
"]",
".",
"lower",
"... | Calculate soundex of given string
This function calculates soundex for Indian language string
as well as English string.
This function is exposed as service method for JSONRPC in
SILPA framework.
:param name: String whose Soundex value to be calculated
... | [
"Calculate",
"soundex",
"of",
"given",
"string"
] | train | https://github.com/libindic/soundex/blob/5d41126b9a017ecee0ae71902388c7bf47722907/libindic/soundex/__init__.py#L68-L111 |
libindic/soundex | libindic/soundex/__init__.py | Soundex.compare | def compare(self, string1, string2):
'''Compare soundex of given strings
This function checks if 2 given strings are phonetically
sounds same by doing soundex code comparison
:param string1: First string for comparison
:param string2: Second string for comparison
... | python | def compare(self, string1, string2):
'''Compare soundex of given strings
This function checks if 2 given strings are phonetically
sounds same by doing soundex code comparison
:param string1: First string for comparison
:param string2: Second string for comparison
... | [
"def",
"compare",
"(",
"self",
",",
"string1",
",",
"string2",
")",
":",
"# do a quick check",
"if",
"string1",
"==",
"string2",
":",
"return",
"0",
"string1_lang",
"=",
"get_language",
"(",
"string1",
"[",
"0",
"]",
")",
"string2_lang",
"=",
"get_language",... | Compare soundex of given strings
This function checks if 2 given strings are phonetically
sounds same by doing soundex code comparison
:param string1: First string for comparison
:param string2: Second string for comparison
:return: Returns 0 if both strings are... | [
"Compare",
"soundex",
"of",
"given",
"strings"
] | train | https://github.com/libindic/soundex/blob/5d41126b9a017ecee0ae71902388c7bf47722907/libindic/soundex/__init__.py#L114-L155 |
skoczen/django-seo-js | django_seo_js/backends/prerender.py | PrerenderIO.get_response_for_url | def get_response_for_url(self, url):
"""
Accepts a fully-qualified url.
Returns an HttpResponse, passing through all headers and the status code.
"""
if not url or "//" not in url:
raise ValueError("Missing or invalid url: %s" % url)
render_url = self.BASE_U... | python | def get_response_for_url(self, url):
"""
Accepts a fully-qualified url.
Returns an HttpResponse, passing through all headers and the status code.
"""
if not url or "//" not in url:
raise ValueError("Missing or invalid url: %s" % url)
render_url = self.BASE_U... | [
"def",
"get_response_for_url",
"(",
"self",
",",
"url",
")",
":",
"if",
"not",
"url",
"or",
"\"//\"",
"not",
"in",
"url",
":",
"raise",
"ValueError",
"(",
"\"Missing or invalid url: %s\"",
"%",
"url",
")",
"render_url",
"=",
"self",
".",
"BASE_URL",
"+",
"... | Accepts a fully-qualified url.
Returns an HttpResponse, passing through all headers and the status code. | [
"Accepts",
"a",
"fully",
"-",
"qualified",
"url",
".",
"Returns",
"an",
"HttpResponse",
"passing",
"through",
"all",
"headers",
"and",
"the",
"status",
"code",
"."
] | train | https://github.com/skoczen/django-seo-js/blob/7613a168deec9e7f11e5d845176d85a3e2c5cc55/django_seo_js/backends/prerender.py#L19-L35 |
skoczen/django-seo-js | django_seo_js/backends/prerender.py | PrerenderIO.update_url | def update_url(self, url=None, regex=None):
"""
Accepts a fully-qualified url, or regex.
Returns True if successful, False if not successful.
"""
if not url and not regex:
raise ValueError("Neither a url or regex was provided to update_url.")
headers = {
... | python | def update_url(self, url=None, regex=None):
"""
Accepts a fully-qualified url, or regex.
Returns True if successful, False if not successful.
"""
if not url and not regex:
raise ValueError("Neither a url or regex was provided to update_url.")
headers = {
... | [
"def",
"update_url",
"(",
"self",
",",
"url",
"=",
"None",
",",
"regex",
"=",
"None",
")",
":",
"if",
"not",
"url",
"and",
"not",
"regex",
":",
"raise",
"ValueError",
"(",
"\"Neither a url or regex was provided to update_url.\"",
")",
"headers",
"=",
"{",
"'... | Accepts a fully-qualified url, or regex.
Returns True if successful, False if not successful. | [
"Accepts",
"a",
"fully",
"-",
"qualified",
"url",
"or",
"regex",
".",
"Returns",
"True",
"if",
"successful",
"False",
"if",
"not",
"successful",
"."
] | train | https://github.com/skoczen/django-seo-js/blob/7613a168deec9e7f11e5d845176d85a3e2c5cc55/django_seo_js/backends/prerender.py#L37-L59 |
skoczen/django-seo-js | django_seo_js/backends/prerender.py | PrerenderHosted.update_url | def update_url(self, url=None):
"""
Accepts a fully-qualified url.
Returns True if successful, False if not successful.
"""
if not url:
raise ValueError("Neither a url or regex was provided to update_url.")
post_url = "%s%s" % (self.BASE_URL, url)
r = ... | python | def update_url(self, url=None):
"""
Accepts a fully-qualified url.
Returns True if successful, False if not successful.
"""
if not url:
raise ValueError("Neither a url or regex was provided to update_url.")
post_url = "%s%s" % (self.BASE_URL, url)
r = ... | [
"def",
"update_url",
"(",
"self",
",",
"url",
"=",
"None",
")",
":",
"if",
"not",
"url",
":",
"raise",
"ValueError",
"(",
"\"Neither a url or regex was provided to update_url.\"",
")",
"post_url",
"=",
"\"%s%s\"",
"%",
"(",
"self",
".",
"BASE_URL",
",",
"url",... | Accepts a fully-qualified url.
Returns True if successful, False if not successful. | [
"Accepts",
"a",
"fully",
"-",
"qualified",
"url",
".",
"Returns",
"True",
"if",
"successful",
"False",
"if",
"not",
"successful",
"."
] | train | https://github.com/skoczen/django-seo-js/blob/7613a168deec9e7f11e5d845176d85a3e2c5cc55/django_seo_js/backends/prerender.py#L80-L89 |
lock8/django-rest-framework-jwt-refresh-token | refreshtoken/serializers.py | RefreshTokenSerializer.create | def create(self, validated_data):
"""Override ``create`` to provide a user via request.user by default.
This is required since the read_only ``user`` field is not included by
default anymore since
https://github.com/encode/django-rest-framework/pull/5886.
"""
if 'user' n... | python | def create(self, validated_data):
"""Override ``create`` to provide a user via request.user by default.
This is required since the read_only ``user`` field is not included by
default anymore since
https://github.com/encode/django-rest-framework/pull/5886.
"""
if 'user' n... | [
"def",
"create",
"(",
"self",
",",
"validated_data",
")",
":",
"if",
"'user'",
"not",
"in",
"validated_data",
":",
"validated_data",
"[",
"'user'",
"]",
"=",
"self",
".",
"context",
"[",
"'request'",
"]",
".",
"user",
"return",
"super",
"(",
"RefreshTokenS... | Override ``create`` to provide a user via request.user by default.
This is required since the read_only ``user`` field is not included by
default anymore since
https://github.com/encode/django-rest-framework/pull/5886. | [
"Override",
"create",
"to",
"provide",
"a",
"user",
"via",
"request",
".",
"user",
"by",
"default",
"."
] | train | https://github.com/lock8/django-rest-framework-jwt-refresh-token/blob/9d46478ac1536982e4dc9dec7599fbce30fef91a/refreshtoken/serializers.py#L22-L31 |
lock8/django-rest-framework-jwt-refresh-token | refreshtoken/permissions.py | IsOwnerOrAdmin.has_object_permission | def has_object_permission(self, request, view, obj):
"""
Allow staff or superusers, and the owner of the object itself.
"""
user = request.user
if not user.is_authenticated:
return False
elif user.is_staff or user.is_superuser:
return True
... | python | def has_object_permission(self, request, view, obj):
"""
Allow staff or superusers, and the owner of the object itself.
"""
user = request.user
if not user.is_authenticated:
return False
elif user.is_staff or user.is_superuser:
return True
... | [
"def",
"has_object_permission",
"(",
"self",
",",
"request",
",",
"view",
",",
"obj",
")",
":",
"user",
"=",
"request",
".",
"user",
"if",
"not",
"user",
".",
"is_authenticated",
":",
"return",
"False",
"elif",
"user",
".",
"is_staff",
"or",
"user",
".",... | Allow staff or superusers, and the owner of the object itself. | [
"Allow",
"staff",
"or",
"superusers",
"and",
"the",
"owner",
"of",
"the",
"object",
"itself",
"."
] | train | https://github.com/lock8/django-rest-framework-jwt-refresh-token/blob/9d46478ac1536982e4dc9dec7599fbce30fef91a/refreshtoken/permissions.py#L12-L21 |
Aula13/poloniex | poloniex/concurrency.py | Semaphore.clear | def clear(self):
"""Release the semaphore of all of its bounds, setting the internal
counter back to its original bind limit. Notify an equivalent amount
of threads that they can run."""
with self._cond:
to_notify = self._initial - self._value
self._value = self._... | python | def clear(self):
"""Release the semaphore of all of its bounds, setting the internal
counter back to its original bind limit. Notify an equivalent amount
of threads that they can run."""
with self._cond:
to_notify = self._initial - self._value
self._value = self._... | [
"def",
"clear",
"(",
"self",
")",
":",
"with",
"self",
".",
"_cond",
":",
"to_notify",
"=",
"self",
".",
"_initial",
"-",
"self",
".",
"_value",
"self",
".",
"_value",
"=",
"self",
".",
"_initial",
"self",
".",
"_cond",
".",
"notify",
"(",
"to_notify... | Release the semaphore of all of its bounds, setting the internal
counter back to its original bind limit. Notify an equivalent amount
of threads that they can run. | [
"Release",
"the",
"semaphore",
"of",
"all",
"of",
"its",
"bounds",
"setting",
"the",
"internal",
"counter",
"back",
"to",
"its",
"original",
"bind",
"limit",
".",
"Notify",
"an",
"equivalent",
"amount",
"of",
"threads",
"that",
"they",
"can",
"run",
"."
] | train | https://github.com/Aula13/poloniex/blob/a5bfc91e766e220bf77f5e3a1b131f095913e714/poloniex/concurrency.py#L96-L103 |
Aula13/poloniex | poloniex/poloniex.py | _api_wrapper | def _api_wrapper(fn):
"""API function decorator that performs rate limiting and error checking."""
def _convert(value):
if isinstance(value, _datetime.date):
return value.strftime('%s')
return value
@_six.wraps(fn)
def _fn(self, command, **params):
# sanitize the pa... | python | def _api_wrapper(fn):
"""API function decorator that performs rate limiting and error checking."""
def _convert(value):
if isinstance(value, _datetime.date):
return value.strftime('%s')
return value
@_six.wraps(fn)
def _fn(self, command, **params):
# sanitize the pa... | [
"def",
"_api_wrapper",
"(",
"fn",
")",
":",
"def",
"_convert",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"_datetime",
".",
"date",
")",
":",
"return",
"value",
".",
"strftime",
"(",
"'%s'",
")",
"return",
"value",
"@",
"_six",
".... | API function decorator that performs rate limiting and error checking. | [
"API",
"function",
"decorator",
"that",
"performs",
"rate",
"limiting",
"and",
"error",
"checking",
"."
] | train | https://github.com/Aula13/poloniex/blob/a5bfc91e766e220bf77f5e3a1b131f095913e714/poloniex/poloniex.py#L20-L55 |
Aula13/poloniex | poloniex/poloniex.py | PoloniexPublic._public | def _public(self, command, **params):
"""Invoke the 'command' public API with optional params."""
params['command'] = command
response = self.session.get(self._public_url, params=params)
return response | python | def _public(self, command, **params):
"""Invoke the 'command' public API with optional params."""
params['command'] = command
response = self.session.get(self._public_url, params=params)
return response | [
"def",
"_public",
"(",
"self",
",",
"command",
",",
"*",
"*",
"params",
")",
":",
"params",
"[",
"'command'",
"]",
"=",
"command",
"response",
"=",
"self",
".",
"session",
".",
"get",
"(",
"self",
".",
"_public_url",
",",
"params",
"=",
"params",
")"... | Invoke the 'command' public API with optional params. | [
"Invoke",
"the",
"command",
"public",
"API",
"with",
"optional",
"params",
"."
] | train | https://github.com/Aula13/poloniex/blob/a5bfc91e766e220bf77f5e3a1b131f095913e714/poloniex/poloniex.py#L80-L84 |
Aula13/poloniex | poloniex/poloniex.py | PoloniexPublic.returnOrderBook | def returnOrderBook(self, currencyPair='all', depth='50'):
"""Returns the order book for a given market, as well as a sequence
number for use with the Push API and an indicator specifying whether
the market is frozen. You may set currencyPair to "all" to get the
order books of all market... | python | def returnOrderBook(self, currencyPair='all', depth='50'):
"""Returns the order book for a given market, as well as a sequence
number for use with the Push API and an indicator specifying whether
the market is frozen. You may set currencyPair to "all" to get the
order books of all market... | [
"def",
"returnOrderBook",
"(",
"self",
",",
"currencyPair",
"=",
"'all'",
",",
"depth",
"=",
"'50'",
")",
":",
"return",
"self",
".",
"_public",
"(",
"'returnOrderBook'",
",",
"currencyPair",
"=",
"currencyPair",
",",
"depth",
"=",
"depth",
")"
] | Returns the order book for a given market, as well as a sequence
number for use with the Push API and an indicator specifying whether
the market is frozen. You may set currencyPair to "all" to get the
order books of all markets. | [
"Returns",
"the",
"order",
"book",
"for",
"a",
"given",
"market",
"as",
"well",
"as",
"a",
"sequence",
"number",
"for",
"use",
"with",
"the",
"Push",
"API",
"and",
"an",
"indicator",
"specifying",
"whether",
"the",
"market",
"is",
"frozen",
".",
"You",
"... | train | https://github.com/Aula13/poloniex/blob/a5bfc91e766e220bf77f5e3a1b131f095913e714/poloniex/poloniex.py#L95-L101 |
Aula13/poloniex | poloniex/poloniex.py | PoloniexPublic.returnTradeHistory | def returnTradeHistory(self, currencyPair, start=None, end=None):
"""Returns the past 200 trades for a given market, or up to 50,000
trades between a range specified in UNIX timestamps by the "start"
and "end" GET parameters."""
return self._public('returnTradeHistory', currencyPair=curr... | python | def returnTradeHistory(self, currencyPair, start=None, end=None):
"""Returns the past 200 trades for a given market, or up to 50,000
trades between a range specified in UNIX timestamps by the "start"
and "end" GET parameters."""
return self._public('returnTradeHistory', currencyPair=curr... | [
"def",
"returnTradeHistory",
"(",
"self",
",",
"currencyPair",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
")",
":",
"return",
"self",
".",
"_public",
"(",
"'returnTradeHistory'",
",",
"currencyPair",
"=",
"currencyPair",
",",
"start",
"=",
"start",
... | Returns the past 200 trades for a given market, or up to 50,000
trades between a range specified in UNIX timestamps by the "start"
and "end" GET parameters. | [
"Returns",
"the",
"past",
"200",
"trades",
"for",
"a",
"given",
"market",
"or",
"up",
"to",
"50",
"000",
"trades",
"between",
"a",
"range",
"specified",
"in",
"UNIX",
"timestamps",
"by",
"the",
"start",
"and",
"end",
"GET",
"parameters",
"."
] | train | https://github.com/Aula13/poloniex/blob/a5bfc91e766e220bf77f5e3a1b131f095913e714/poloniex/poloniex.py#L103-L108 |
Aula13/poloniex | poloniex/poloniex.py | PoloniexPublic.returnChartData | def returnChartData(self, currencyPair, period, start=0, end=2**32-1):
"""Returns candlestick chart data. Required GET parameters are
"currencyPair", "period" (candlestick period in seconds; valid values
are 300, 900, 1800, 7200, 14400, and 86400), "start", and "end".
"Start" and "end" a... | python | def returnChartData(self, currencyPair, period, start=0, end=2**32-1):
"""Returns candlestick chart data. Required GET parameters are
"currencyPair", "period" (candlestick period in seconds; valid values
are 300, 900, 1800, 7200, 14400, and 86400), "start", and "end".
"Start" and "end" a... | [
"def",
"returnChartData",
"(",
"self",
",",
"currencyPair",
",",
"period",
",",
"start",
"=",
"0",
",",
"end",
"=",
"2",
"**",
"32",
"-",
"1",
")",
":",
"return",
"self",
".",
"_public",
"(",
"'returnChartData'",
",",
"currencyPair",
"=",
"currencyPair",... | Returns candlestick chart data. Required GET parameters are
"currencyPair", "period" (candlestick period in seconds; valid values
are 300, 900, 1800, 7200, 14400, and 86400), "start", and "end".
"Start" and "end" are given in UNIX timestamp format and used to
specify the date range for t... | [
"Returns",
"candlestick",
"chart",
"data",
".",
"Required",
"GET",
"parameters",
"are",
"currencyPair",
"period",
"(",
"candlestick",
"period",
"in",
"seconds",
";",
"valid",
"values",
"are",
"300",
"900",
"1800",
"7200",
"14400",
"and",
"86400",
")",
"start",... | train | https://github.com/Aula13/poloniex/blob/a5bfc91e766e220bf77f5e3a1b131f095913e714/poloniex/poloniex.py#L110-L117 |
Aula13/poloniex | poloniex/poloniex.py | Poloniex._private | def _private(self, command, **params):
"""Invoke the 'command' public API with optional params."""
if not self._apikey or not self._secret:
raise PoloniexCredentialsException('missing apikey/secret')
with self.nonce_lock:
params.update({'command': command, 'nonce': next(... | python | def _private(self, command, **params):
"""Invoke the 'command' public API with optional params."""
if not self._apikey or not self._secret:
raise PoloniexCredentialsException('missing apikey/secret')
with self.nonce_lock:
params.update({'command': command, 'nonce': next(... | [
"def",
"_private",
"(",
"self",
",",
"command",
",",
"*",
"*",
"params",
")",
":",
"if",
"not",
"self",
".",
"_apikey",
"or",
"not",
"self",
".",
"_secret",
":",
"raise",
"PoloniexCredentialsException",
"(",
"'missing apikey/secret'",
")",
"with",
"self",
... | Invoke the 'command' public API with optional params. | [
"Invoke",
"the",
"command",
"public",
"API",
"with",
"optional",
"params",
"."
] | train | https://github.com/Aula13/poloniex/blob/a5bfc91e766e220bf77f5e3a1b131f095913e714/poloniex/poloniex.py#L169-L179 |
Aula13/poloniex | poloniex/poloniex.py | Poloniex.returnDepositsWithdrawals | def returnDepositsWithdrawals(self, start=0, end=2**32-1):
"""Returns your deposit and withdrawal history within a range,
specified by the "start" and "end" POST parameters, both of which
should be given as UNIX timestamps."""
return self._private('returnDepositsWithdrawals', start=start... | python | def returnDepositsWithdrawals(self, start=0, end=2**32-1):
"""Returns your deposit and withdrawal history within a range,
specified by the "start" and "end" POST parameters, both of which
should be given as UNIX timestamps."""
return self._private('returnDepositsWithdrawals', start=start... | [
"def",
"returnDepositsWithdrawals",
"(",
"self",
",",
"start",
"=",
"0",
",",
"end",
"=",
"2",
"**",
"32",
"-",
"1",
")",
":",
"return",
"self",
".",
"_private",
"(",
"'returnDepositsWithdrawals'",
",",
"start",
"=",
"start",
",",
"end",
"=",
"end",
")... | Returns your deposit and withdrawal history within a range,
specified by the "start" and "end" POST parameters, both of which
should be given as UNIX timestamps. | [
"Returns",
"your",
"deposit",
"and",
"withdrawal",
"history",
"within",
"a",
"range",
"specified",
"by",
"the",
"start",
"and",
"end",
"POST",
"parameters",
"both",
"of",
"which",
"should",
"be",
"given",
"as",
"UNIX",
"timestamps",
"."
] | train | https://github.com/Aula13/poloniex/blob/a5bfc91e766e220bf77f5e3a1b131f095913e714/poloniex/poloniex.py#L203-L207 |
Aula13/poloniex | poloniex/poloniex.py | Poloniex.returnTradeHistory | def returnTradeHistory(self, currencyPair='all', start=None, end=None, limit=500):
"""Returns your trade history for a given market, specified by the
"currencyPair" POST parameter. You may specify "all" as the
currencyPair to receive your trade history for all markets. You may
optionally... | python | def returnTradeHistory(self, currencyPair='all', start=None, end=None, limit=500):
"""Returns your trade history for a given market, specified by the
"currencyPair" POST parameter. You may specify "all" as the
currencyPair to receive your trade history for all markets. You may
optionally... | [
"def",
"returnTradeHistory",
"(",
"self",
",",
"currencyPair",
"=",
"'all'",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
",",
"limit",
"=",
"500",
")",
":",
"return",
"self",
".",
"_private",
"(",
"'returnTradeHistory'",
",",
"currencyPair",
"=",
... | Returns your trade history for a given market, specified by the
"currencyPair" POST parameter. You may specify "all" as the
currencyPair to receive your trade history for all markets. You may
optionally specify a range via "start" and/or "end" POST parameters,
given in UNIX timestamp for... | [
"Returns",
"your",
"trade",
"history",
"for",
"a",
"given",
"market",
"specified",
"by",
"the",
"currencyPair",
"POST",
"parameter",
".",
"You",
"may",
"specify",
"all",
"as",
"the",
"currencyPair",
"to",
"receive",
"your",
"trade",
"history",
"for",
"all",
... | train | https://github.com/Aula13/poloniex/blob/a5bfc91e766e220bf77f5e3a1b131f095913e714/poloniex/poloniex.py#L227-L235 |
Aula13/poloniex | poloniex/poloniex.py | Poloniex.returnTradeHistoryPublic | def returnTradeHistoryPublic(self, currencyPair, start=None, end=None):
"""Returns the past 200 trades for a given market, or up to 50,000
trades between a range specified in UNIX timestamps by the "start"
and "end" GET parameters."""
return super(Poloniex, self).returnTradeHistory(curre... | python | def returnTradeHistoryPublic(self, currencyPair, start=None, end=None):
"""Returns the past 200 trades for a given market, or up to 50,000
trades between a range specified in UNIX timestamps by the "start"
and "end" GET parameters."""
return super(Poloniex, self).returnTradeHistory(curre... | [
"def",
"returnTradeHistoryPublic",
"(",
"self",
",",
"currencyPair",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
")",
":",
"return",
"super",
"(",
"Poloniex",
",",
"self",
")",
".",
"returnTradeHistory",
"(",
"currencyPair",
",",
"start",
",",
"end... | Returns the past 200 trades for a given market, or up to 50,000
trades between a range specified in UNIX timestamps by the "start"
and "end" GET parameters. | [
"Returns",
"the",
"past",
"200",
"trades",
"for",
"a",
"given",
"market",
"or",
"up",
"to",
"50",
"000",
"trades",
"between",
"a",
"range",
"specified",
"in",
"UNIX",
"timestamps",
"by",
"the",
"start",
"and",
"end",
"GET",
"parameters",
"."
] | train | https://github.com/Aula13/poloniex/blob/a5bfc91e766e220bf77f5e3a1b131f095913e714/poloniex/poloniex.py#L237-L241 |
Aula13/poloniex | poloniex/poloniex.py | Poloniex.buy | def buy(self, currencyPair, rate, amount, fillOrKill=None,
immediateOrCancel=None, postOnly=None):
"""Places a limit buy order in a given market. Required POST parameters
are "currencyPair", "rate", and "amount". If successful, the method
will return the order number.
You may... | python | def buy(self, currencyPair, rate, amount, fillOrKill=None,
immediateOrCancel=None, postOnly=None):
"""Places a limit buy order in a given market. Required POST parameters
are "currencyPair", "rate", and "amount". If successful, the method
will return the order number.
You may... | [
"def",
"buy",
"(",
"self",
",",
"currencyPair",
",",
"rate",
",",
"amount",
",",
"fillOrKill",
"=",
"None",
",",
"immediateOrCancel",
"=",
"None",
",",
"postOnly",
"=",
"None",
")",
":",
"return",
"self",
".",
"_private",
"(",
"'buy'",
",",
"currencyPair... | Places a limit buy order in a given market. Required POST parameters
are "currencyPair", "rate", and "amount". If successful, the method
will return the order number.
You may optionally set "fillOrKill", "immediateOrCancel", "postOnly"
to 1. A fill-or-kill order will either fill in its e... | [
"Places",
"a",
"limit",
"buy",
"order",
"in",
"a",
"given",
"market",
".",
"Required",
"POST",
"parameters",
"are",
"currencyPair",
"rate",
"and",
"amount",
".",
"If",
"successful",
"the",
"method",
"will",
"return",
"the",
"order",
"number",
".",
"You",
"... | train | https://github.com/Aula13/poloniex/blob/a5bfc91e766e220bf77f5e3a1b131f095913e714/poloniex/poloniex.py#L250-L266 |
Aula13/poloniex | poloniex/poloniex.py | Poloniex.moveOrder | def moveOrder(self, orderNumber, rate, amount=None, postOnly=None,
immediateOrCancel=None):
"""Cancels an order and places a new one of the same type in a single
atomic transaction, meaning either both operations will succeed or both
will fail. Required POST parameters are "or... | python | def moveOrder(self, orderNumber, rate, amount=None, postOnly=None,
immediateOrCancel=None):
"""Cancels an order and places a new one of the same type in a single
atomic transaction, meaning either both operations will succeed or both
will fail. Required POST parameters are "or... | [
"def",
"moveOrder",
"(",
"self",
",",
"orderNumber",
",",
"rate",
",",
"amount",
"=",
"None",
",",
"postOnly",
"=",
"None",
",",
"immediateOrCancel",
"=",
"None",
")",
":",
"return",
"self",
".",
"_private",
"(",
"'moveOrder'",
",",
"orderNumber",
"=",
"... | Cancels an order and places a new one of the same type in a single
atomic transaction, meaning either both operations will succeed or both
will fail. Required POST parameters are "orderNumber" and "rate"; you
may optionally specify "amount" if you wish to change the amount of
the new ... | [
"Cancels",
"an",
"order",
"and",
"places",
"a",
"new",
"one",
"of",
"the",
"same",
"type",
"in",
"a",
"single",
"atomic",
"transaction",
"meaning",
"either",
"both",
"operations",
"will",
"succeed",
"or",
"both",
"will",
"fail",
".",
"Required",
"POST",
"p... | train | https://github.com/Aula13/poloniex/blob/a5bfc91e766e220bf77f5e3a1b131f095913e714/poloniex/poloniex.py#L282-L292 |
Aula13/poloniex | poloniex/poloniex.py | Poloniex.withdraw | def withdraw(self, currency, amount, address, paymentId=None):
"""Immediately places a withdrawal for a given currency, with no email
confirmation. In order to use this method, the withdrawal privilege
must be enabled for your API key. Required POST parameters are
"currency", "amount", a... | python | def withdraw(self, currency, amount, address, paymentId=None):
"""Immediately places a withdrawal for a given currency, with no email
confirmation. In order to use this method, the withdrawal privilege
must be enabled for your API key. Required POST parameters are
"currency", "amount", a... | [
"def",
"withdraw",
"(",
"self",
",",
"currency",
",",
"amount",
",",
"address",
",",
"paymentId",
"=",
"None",
")",
":",
"return",
"self",
".",
"_private",
"(",
"'withdraw'",
",",
"currency",
"=",
"currency",
",",
"amount",
"=",
"amount",
",",
"address",... | Immediately places a withdrawal for a given currency, with no email
confirmation. In order to use this method, the withdrawal privilege
must be enabled for your API key. Required POST parameters are
"currency", "amount", and "address". For XMR withdrawals, you may
optionally specify "pay... | [
"Immediately",
"places",
"a",
"withdrawal",
"for",
"a",
"given",
"currency",
"with",
"no",
"email",
"confirmation",
".",
"In",
"order",
"to",
"use",
"this",
"method",
"the",
"withdrawal",
"privilege",
"must",
"be",
"enabled",
"for",
"your",
"API",
"key",
"."... | train | https://github.com/Aula13/poloniex/blob/a5bfc91e766e220bf77f5e3a1b131f095913e714/poloniex/poloniex.py#L294-L301 |
Aula13/poloniex | poloniex/poloniex.py | Poloniex.transferBalance | def transferBalance(self, currency, amount, fromAccount, toAccount):
"""Transfers funds from one account to another (e.g. from your exchange
account to your margin account). Required POST parameters are
"currency", "amount", "fromAccount", and "toAccount"."""
return self._private('tran... | python | def transferBalance(self, currency, amount, fromAccount, toAccount):
"""Transfers funds from one account to another (e.g. from your exchange
account to your margin account). Required POST parameters are
"currency", "amount", "fromAccount", and "toAccount"."""
return self._private('tran... | [
"def",
"transferBalance",
"(",
"self",
",",
"currency",
",",
"amount",
",",
"fromAccount",
",",
"toAccount",
")",
":",
"return",
"self",
".",
"_private",
"(",
"'transferBalance'",
",",
"currency",
"=",
"currency",
",",
"amount",
"=",
"amount",
",",
"fromAcco... | Transfers funds from one account to another (e.g. from your exchange
account to your margin account). Required POST parameters are
"currency", "amount", "fromAccount", and "toAccount". | [
"Transfers",
"funds",
"from",
"one",
"account",
"to",
"another",
"(",
"e",
".",
"g",
".",
"from",
"your",
"exchange",
"account",
"to",
"your",
"margin",
"account",
")",
".",
"Required",
"POST",
"parameters",
"are",
"currency",
"amount",
"fromAccount",
"and",... | train | https://github.com/Aula13/poloniex/blob/a5bfc91e766e220bf77f5e3a1b131f095913e714/poloniex/poloniex.py#L322-L328 |
Aula13/poloniex | poloniex/poloniex.py | Poloniex.marginBuy | def marginBuy(self, currencyPair, rate, amount, lendingRate=None):
"""Places a margin buy order in a given market. Required POST
parameters are "currencyPair", "rate", and "amount". You may optionally
specify a maximum lending rate using the "lendingRate" parameter.
If successful, the ... | python | def marginBuy(self, currencyPair, rate, amount, lendingRate=None):
"""Places a margin buy order in a given market. Required POST
parameters are "currencyPair", "rate", and "amount". You may optionally
specify a maximum lending rate using the "lendingRate" parameter.
If successful, the ... | [
"def",
"marginBuy",
"(",
"self",
",",
"currencyPair",
",",
"rate",
",",
"amount",
",",
"lendingRate",
"=",
"None",
")",
":",
"return",
"self",
".",
"_private",
"(",
"'marginBuy'",
",",
"currencyPair",
"=",
"currencyPair",
",",
"rate",
"=",
"rate",
",",
"... | Places a margin buy order in a given market. Required POST
parameters are "currencyPair", "rate", and "amount". You may optionally
specify a maximum lending rate using the "lendingRate" parameter.
If successful, the method will return the order number and any trades
immediately result... | [
"Places",
"a",
"margin",
"buy",
"order",
"in",
"a",
"given",
"market",
".",
"Required",
"POST",
"parameters",
"are",
"currencyPair",
"rate",
"and",
"amount",
".",
"You",
"may",
"optionally",
"specify",
"a",
"maximum",
"lending",
"rate",
"using",
"the",
"lend... | train | https://github.com/Aula13/poloniex/blob/a5bfc91e766e220bf77f5e3a1b131f095913e714/poloniex/poloniex.py#L336-L343 |
Aula13/poloniex | poloniex/poloniex.py | Poloniex.marginSell | def marginSell(self, currencyPair, rate, amount, lendingRate=None):
"""Places a margin sell order in a given market. Parameters and output
are the same as for the marginBuy method."""
return self._private('marginSell', currencyPair=currencyPair, rate=rate,
amount=amo... | python | def marginSell(self, currencyPair, rate, amount, lendingRate=None):
"""Places a margin sell order in a given market. Parameters and output
are the same as for the marginBuy method."""
return self._private('marginSell', currencyPair=currencyPair, rate=rate,
amount=amo... | [
"def",
"marginSell",
"(",
"self",
",",
"currencyPair",
",",
"rate",
",",
"amount",
",",
"lendingRate",
"=",
"None",
")",
":",
"return",
"self",
".",
"_private",
"(",
"'marginSell'",
",",
"currencyPair",
"=",
"currencyPair",
",",
"rate",
"=",
"rate",
",",
... | Places a margin sell order in a given market. Parameters and output
are the same as for the marginBuy method. | [
"Places",
"a",
"margin",
"sell",
"order",
"in",
"a",
"given",
"market",
".",
"Parameters",
"and",
"output",
"are",
"the",
"same",
"as",
"for",
"the",
"marginBuy",
"method",
"."
] | train | https://github.com/Aula13/poloniex/blob/a5bfc91e766e220bf77f5e3a1b131f095913e714/poloniex/poloniex.py#L345-L349 |
Aula13/poloniex | poloniex/poloniex.py | Poloniex.createLoanOffer | def createLoanOffer(self, currency, amount, duration, autoRenew,
lendingRate):
"""Creates a loan offer for a given currency. Required POST parameters
are "currency", "amount", "duration", "autoRenew" (0 or 1), and
"lendingRate". """
return self._private('createLoa... | python | def createLoanOffer(self, currency, amount, duration, autoRenew,
lendingRate):
"""Creates a loan offer for a given currency. Required POST parameters
are "currency", "amount", "duration", "autoRenew" (0 or 1), and
"lendingRate". """
return self._private('createLoa... | [
"def",
"createLoanOffer",
"(",
"self",
",",
"currency",
",",
"amount",
",",
"duration",
",",
"autoRenew",
",",
"lendingRate",
")",
":",
"return",
"self",
".",
"_private",
"(",
"'createLoanOffer'",
",",
"currency",
"=",
"currency",
",",
"amount",
"=",
"amount... | Creates a loan offer for a given currency. Required POST parameters
are "currency", "amount", "duration", "autoRenew" (0 or 1), and
"lendingRate". | [
"Creates",
"a",
"loan",
"offer",
"for",
"a",
"given",
"currency",
".",
"Required",
"POST",
"parameters",
"are",
"currency",
"amount",
"duration",
"autoRenew",
"(",
"0",
"or",
"1",
")",
"and",
"lendingRate",
"."
] | train | https://github.com/Aula13/poloniex/blob/a5bfc91e766e220bf77f5e3a1b131f095913e714/poloniex/poloniex.py#L369-L376 |
Aula13/poloniex | poloniex/poloniex.py | Poloniex.returnLendingHistory | def returnLendingHistory(self, start=0, end=2**32-1, limit=None):
"""Returns your lending history within a time range specified by the
"start" and "end" POST parameters as UNIX timestamps. "limit" may also
be specified to limit the number of rows returned. """
return self._private('retur... | python | def returnLendingHistory(self, start=0, end=2**32-1, limit=None):
"""Returns your lending history within a time range specified by the
"start" and "end" POST parameters as UNIX timestamps. "limit" may also
be specified to limit the number of rows returned. """
return self._private('retur... | [
"def",
"returnLendingHistory",
"(",
"self",
",",
"start",
"=",
"0",
",",
"end",
"=",
"2",
"**",
"32",
"-",
"1",
",",
"limit",
"=",
"None",
")",
":",
"return",
"self",
".",
"_private",
"(",
"'returnLendingHistory'",
",",
"start",
"=",
"start",
",",
"e... | Returns your lending history within a time range specified by the
"start" and "end" POST parameters as UNIX timestamps. "limit" may also
be specified to limit the number of rows returned. | [
"Returns",
"your",
"lending",
"history",
"within",
"a",
"time",
"range",
"specified",
"by",
"the",
"start",
"and",
"end",
"POST",
"parameters",
"as",
"UNIX",
"timestamps",
".",
"limit",
"may",
"also",
"be",
"specified",
"to",
"limit",
"the",
"number",
"of",
... | train | https://github.com/Aula13/poloniex/blob/a5bfc91e766e220bf77f5e3a1b131f095913e714/poloniex/poloniex.py#L391-L396 |
Polyconseil/django-cid | cid/locals.py | get_cid | def get_cid():
"""Return the currently set correlation id (if any).
If no correlation id has been set and ``CID_GENERATE`` is enabled
in the settings, a new correlation id is set and returned.
FIXME (dbaty): in version 2, just `return getattr(_thread_locals, 'CID', None)`
We want the simplest thin... | python | def get_cid():
"""Return the currently set correlation id (if any).
If no correlation id has been set and ``CID_GENERATE`` is enabled
in the settings, a new correlation id is set and returned.
FIXME (dbaty): in version 2, just `return getattr(_thread_locals, 'CID', None)`
We want the simplest thin... | [
"def",
"get_cid",
"(",
")",
":",
"cid",
"=",
"getattr",
"(",
"_thread_locals",
",",
"'CID'",
",",
"None",
")",
"if",
"cid",
"is",
"None",
"and",
"getattr",
"(",
"settings",
",",
"'CID_GENERATE'",
",",
"False",
")",
":",
"cid",
"=",
"str",
"(",
"uuid"... | Return the currently set correlation id (if any).
If no correlation id has been set and ``CID_GENERATE`` is enabled
in the settings, a new correlation id is set and returned.
FIXME (dbaty): in version 2, just `return getattr(_thread_locals, 'CID', None)`
We want the simplest thing here and let `genera... | [
"Return",
"the",
"currently",
"set",
"correlation",
"id",
"(",
"if",
"any",
")",
"."
] | train | https://github.com/Polyconseil/django-cid/blob/43415c8bbc91aa03983384072dbc1d2ecdeb2852/cid/locals.py#L15-L28 |
Polyconseil/django-cid | cid/locals.py | generate_new_cid | def generate_new_cid(upstream_cid=None):
"""Generate a new correlation id, possibly based on the given one."""
if upstream_cid is None:
return str(uuid.uuid4()) if getattr(settings, 'CID_GENERATE', False) else None
if (
getattr(settings, 'CID_CONCATENATE_IDS', False)
and geta... | python | def generate_new_cid(upstream_cid=None):
"""Generate a new correlation id, possibly based on the given one."""
if upstream_cid is None:
return str(uuid.uuid4()) if getattr(settings, 'CID_GENERATE', False) else None
if (
getattr(settings, 'CID_CONCATENATE_IDS', False)
and geta... | [
"def",
"generate_new_cid",
"(",
"upstream_cid",
"=",
"None",
")",
":",
"if",
"upstream_cid",
"is",
"None",
":",
"return",
"str",
"(",
"uuid",
".",
"uuid4",
"(",
")",
")",
"if",
"getattr",
"(",
"settings",
",",
"'CID_GENERATE'",
",",
"False",
")",
"else",... | Generate a new correlation id, possibly based on the given one. | [
"Generate",
"a",
"new",
"correlation",
"id",
"possibly",
"based",
"on",
"the",
"given",
"one",
"."
] | train | https://github.com/Polyconseil/django-cid/blob/43415c8bbc91aa03983384072dbc1d2ecdeb2852/cid/locals.py#L31-L40 |
morgante/django-graph-auth | graph_auth/settings.py | import_from_string | def import_from_string(val, setting_name):
"""
Attempt to import a class from a string representation.
"""
try:
# Nod to tastypie's use of importlib.
parts = val.split('.')
module_path, class_name = '.'.join(parts[:-1]), parts[-1]
module = importlib.import_module(module_p... | python | def import_from_string(val, setting_name):
"""
Attempt to import a class from a string representation.
"""
try:
# Nod to tastypie's use of importlib.
parts = val.split('.')
module_path, class_name = '.'.join(parts[:-1]), parts[-1]
module = importlib.import_module(module_p... | [
"def",
"import_from_string",
"(",
"val",
",",
"setting_name",
")",
":",
"try",
":",
"# Nod to tastypie's use of importlib.",
"parts",
"=",
"val",
".",
"split",
"(",
"'.'",
")",
"module_path",
",",
"class_name",
"=",
"'.'",
".",
"join",
"(",
"parts",
"[",
":"... | Attempt to import a class from a string representation. | [
"Attempt",
"to",
"import",
"a",
"class",
"from",
"a",
"string",
"representation",
"."
] | train | https://github.com/morgante/django-graph-auth/blob/f37b3ab113b3ebab4ad1d6685d9e4884c047f7f1/graph_auth/settings.py#L51-L63 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_eaton_ups/check_snmp_eaton_ups.py | check_ups_estimated_minutes_remaining | def check_ups_estimated_minutes_remaining(the_session, the_helper, the_snmp_value):
"""
OID .1.3.6.1.2.1.33.1.2.3.0
MIB excerpt
An estimate of the time to battery charge depletion
under the present load conditions if the utility power
is off and remains off, or if it were to be lost and
rema... | python | def check_ups_estimated_minutes_remaining(the_session, the_helper, the_snmp_value):
"""
OID .1.3.6.1.2.1.33.1.2.3.0
MIB excerpt
An estimate of the time to battery charge depletion
under the present load conditions if the utility power
is off and remains off, or if it were to be lost and
rema... | [
"def",
"check_ups_estimated_minutes_remaining",
"(",
"the_session",
",",
"the_helper",
",",
"the_snmp_value",
")",
":",
"the_helper",
".",
"add_metric",
"(",
"label",
"=",
"the_helper",
".",
"options",
".",
"type",
",",
"value",
"=",
"the_snmp_value",
",",
"uom",
... | OID .1.3.6.1.2.1.33.1.2.3.0
MIB excerpt
An estimate of the time to battery charge depletion
under the present load conditions if the utility power
is off and remains off, or if it were to be lost and
remain off. | [
"OID",
".",
"1",
".",
"3",
".",
"6",
".",
"1",
".",
"2",
".",
"1",
".",
"33",
".",
"1",
".",
"2",
".",
"3",
".",
"0",
"MIB",
"excerpt",
"An",
"estimate",
"of",
"the",
"time",
"to",
"battery",
"charge",
"depletion",
"under",
"the",
"present",
... | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_eaton_ups/check_snmp_eaton_ups.py#L61-L75 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_eaton_ups/check_snmp_eaton_ups.py | check_ups_input_frequency | def check_ups_input_frequency(the_session, the_helper, the_snmp_value):
"""
OID .1.3.6.1.2.1.33.1.3.3.1.2.1
MIB excerpt
The present input frequency.
"""
a_frequency = calc_frequency_from_snmpvalue(the_snmp_value)
the_helper.add_metric(
label=the_helper.options.type,
value=a_f... | python | def check_ups_input_frequency(the_session, the_helper, the_snmp_value):
"""
OID .1.3.6.1.2.1.33.1.3.3.1.2.1
MIB excerpt
The present input frequency.
"""
a_frequency = calc_frequency_from_snmpvalue(the_snmp_value)
the_helper.add_metric(
label=the_helper.options.type,
value=a_f... | [
"def",
"check_ups_input_frequency",
"(",
"the_session",
",",
"the_helper",
",",
"the_snmp_value",
")",
":",
"a_frequency",
"=",
"calc_frequency_from_snmpvalue",
"(",
"the_snmp_value",
")",
"the_helper",
".",
"add_metric",
"(",
"label",
"=",
"the_helper",
".",
"options... | OID .1.3.6.1.2.1.33.1.3.3.1.2.1
MIB excerpt
The present input frequency. | [
"OID",
".",
"1",
".",
"3",
".",
"6",
".",
"1",
".",
"2",
".",
"1",
".",
"33",
".",
"1",
".",
"3",
".",
"3",
".",
"1",
".",
"2",
".",
"1",
"MIB",
"excerpt",
"The",
"present",
"input",
"frequency",
"."
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_eaton_ups/check_snmp_eaton_ups.py#L78-L90 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_eaton_ups/check_snmp_eaton_ups.py | check_ups_output_current | def check_ups_output_current(the_session, the_helper, the_snmp_value):
"""
OID .1.3.6.1.2.1.33.1.4.4.1.3.1
MIB excerpt
The present output current.
"""
a_current = calc_output_current_from_snmpvalue(the_snmp_value)
the_helper.add_metric(
label=the_helper.options.type,
val... | python | def check_ups_output_current(the_session, the_helper, the_snmp_value):
"""
OID .1.3.6.1.2.1.33.1.4.4.1.3.1
MIB excerpt
The present output current.
"""
a_current = calc_output_current_from_snmpvalue(the_snmp_value)
the_helper.add_metric(
label=the_helper.options.type,
val... | [
"def",
"check_ups_output_current",
"(",
"the_session",
",",
"the_helper",
",",
"the_snmp_value",
")",
":",
"a_current",
"=",
"calc_output_current_from_snmpvalue",
"(",
"the_snmp_value",
")",
"the_helper",
".",
"add_metric",
"(",
"label",
"=",
"the_helper",
".",
"optio... | OID .1.3.6.1.2.1.33.1.4.4.1.3.1
MIB excerpt
The present output current. | [
"OID",
".",
"1",
".",
"3",
".",
"6",
".",
"1",
".",
"2",
".",
"1",
".",
"33",
".",
"1",
".",
"4",
".",
"4",
".",
"1",
".",
"3",
".",
"1",
"MIB",
"excerpt",
"The",
"present",
"output",
"current",
"."
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_eaton_ups/check_snmp_eaton_ups.py#L121-L134 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_eaton_ups/check_snmp_eaton_ups.py | check_ups_alarms_present | def check_ups_alarms_present(the_session, the_helper, the_snmp_value):
"""
OID .1.3.6.1.2.1.33.1.6.1.0
MIB excerpt
The present number of active alarm conditions.
"""
if the_snmp_value != '0':
the_helper.add_status(pynag.Plugins.critical)
else:
the_helper.add_status(pynag.Plug... | python | def check_ups_alarms_present(the_session, the_helper, the_snmp_value):
"""
OID .1.3.6.1.2.1.33.1.6.1.0
MIB excerpt
The present number of active alarm conditions.
"""
if the_snmp_value != '0':
the_helper.add_status(pynag.Plugins.critical)
else:
the_helper.add_status(pynag.Plug... | [
"def",
"check_ups_alarms_present",
"(",
"the_session",
",",
"the_helper",
",",
"the_snmp_value",
")",
":",
"if",
"the_snmp_value",
"!=",
"'0'",
":",
"the_helper",
".",
"add_status",
"(",
"pynag",
".",
"Plugins",
".",
"critical",
")",
"else",
":",
"the_helper",
... | OID .1.3.6.1.2.1.33.1.6.1.0
MIB excerpt
The present number of active alarm conditions. | [
"OID",
".",
"1",
".",
"3",
".",
"6",
".",
"1",
".",
"2",
".",
"1",
".",
"33",
".",
"1",
".",
"6",
".",
"1",
".",
"0",
"MIB",
"excerpt",
"The",
"present",
"number",
"of",
"active",
"alarm",
"conditions",
"."
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_eaton_ups/check_snmp_eaton_ups.py#L168-L178 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_eaton_ups/check_snmp_eaton_ups.py | check_xups_bat_capacity | def check_xups_bat_capacity(the_session, the_helper, the_snmp_value):
"""
OID .1.3.6.1.4.1.534.1.2.4.0
MIB Excerpt
Battery percent charge.
"""
the_helper.add_metric(
label=the_helper.options.type,
value=a_snmp_value,
uom='%')
the_helper.set_summary("Remaining Batter... | python | def check_xups_bat_capacity(the_session, the_helper, the_snmp_value):
"""
OID .1.3.6.1.4.1.534.1.2.4.0
MIB Excerpt
Battery percent charge.
"""
the_helper.add_metric(
label=the_helper.options.type,
value=a_snmp_value,
uom='%')
the_helper.set_summary("Remaining Batter... | [
"def",
"check_xups_bat_capacity",
"(",
"the_session",
",",
"the_helper",
",",
"the_snmp_value",
")",
":",
"the_helper",
".",
"add_metric",
"(",
"label",
"=",
"the_helper",
".",
"options",
".",
"type",
",",
"value",
"=",
"a_snmp_value",
",",
"uom",
"=",
"'%'",
... | OID .1.3.6.1.4.1.534.1.2.4.0
MIB Excerpt
Battery percent charge. | [
"OID",
".",
"1",
".",
"3",
".",
"6",
".",
"1",
".",
"4",
".",
"1",
".",
"534",
".",
"1",
".",
"2",
".",
"4",
".",
"0",
"MIB",
"Excerpt",
"Battery",
"percent",
"charge",
"."
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_eaton_ups/check_snmp_eaton_ups.py#L241-L253 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_eaton_ups/check_snmp_eaton_ups.py | check_xups_env_ambient_temp | def check_xups_env_ambient_temp(the_session, the_helper, the_snmp_value, the_unit=1):
"""
OID .1.3.6.1.4.1.534.1.6.1.0
MIB Excerpt
The reading of the ambient temperature in the vicinity of the
UPS or SNMP agent.
"""
the_helper.add_metric(
label=the_helper.options.type,
... | python | def check_xups_env_ambient_temp(the_session, the_helper, the_snmp_value, the_unit=1):
"""
OID .1.3.6.1.4.1.534.1.6.1.0
MIB Excerpt
The reading of the ambient temperature in the vicinity of the
UPS or SNMP agent.
"""
the_helper.add_metric(
label=the_helper.options.type,
... | [
"def",
"check_xups_env_ambient_temp",
"(",
"the_session",
",",
"the_helper",
",",
"the_snmp_value",
",",
"the_unit",
"=",
"1",
")",
":",
"the_helper",
".",
"add_metric",
"(",
"label",
"=",
"the_helper",
".",
"options",
".",
"type",
",",
"value",
"=",
"the_snmp... | OID .1.3.6.1.4.1.534.1.6.1.0
MIB Excerpt
The reading of the ambient temperature in the vicinity of the
UPS or SNMP agent. | [
"OID",
".",
"1",
".",
"3",
".",
"6",
".",
"1",
".",
"4",
".",
"1",
".",
"534",
".",
"1",
".",
"6",
".",
"1",
".",
"0",
"MIB",
"Excerpt",
"The",
"reading",
"of",
"the",
"ambient",
"temperature",
"in",
"the",
"vicinity",
"of",
"the",
"UPS",
"or... | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_eaton_ups/check_snmp_eaton_ups.py#L256-L269 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_fortinet/check_snmp_fortinet.py | check_ressources | def check_ressources(sess):
"""
check the Ressources of the Fortinet Controller
all thresholds are currently hard coded. should be fine.
"""
# get the data
cpu_value = get_data(sess, cpu_oid, helper)
memory_value = get_data(sess, memory_oid, helper)
fil... | python | def check_ressources(sess):
"""
check the Ressources of the Fortinet Controller
all thresholds are currently hard coded. should be fine.
"""
# get the data
cpu_value = get_data(sess, cpu_oid, helper)
memory_value = get_data(sess, memory_oid, helper)
fil... | [
"def",
"check_ressources",
"(",
"sess",
")",
":",
"# get the data",
"cpu_value",
"=",
"get_data",
"(",
"sess",
",",
"cpu_oid",
",",
"helper",
")",
"memory_value",
"=",
"get_data",
"(",
"sess",
",",
"memory_oid",
",",
"helper",
")",
"filesystem_value",
"=",
"... | check the Ressources of the Fortinet Controller
all thresholds are currently hard coded. should be fine. | [
"check",
"the",
"Ressources",
"of",
"the",
"Fortinet",
"Controller",
"all",
"thresholds",
"are",
"currently",
"hard",
"coded",
".",
"should",
"be",
"fine",
"."
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_fortinet/check_snmp_fortinet.py#L88-L115 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_fortinet/check_snmp_fortinet.py | check_controller | def check_controller(sess):
"""
check the status of the controller
"""
controller_operational = get_data(sess, operational_oid, helper)
controller_availability = get_data(sess, availability_oid, helper)
controller_alarm = get_data(sess, alarm_oid, helper)... | python | def check_controller(sess):
"""
check the status of the controller
"""
controller_operational = get_data(sess, operational_oid, helper)
controller_availability = get_data(sess, availability_oid, helper)
controller_alarm = get_data(sess, alarm_oid, helper)... | [
"def",
"check_controller",
"(",
"sess",
")",
":",
"controller_operational",
"=",
"get_data",
"(",
"sess",
",",
"operational_oid",
",",
"helper",
")",
"controller_availability",
"=",
"get_data",
"(",
"sess",
",",
"availability_oid",
",",
"helper",
")",
"controller_... | check the status of the controller | [
"check",
"the",
"status",
"of",
"the",
"controller"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_fortinet/check_snmp_fortinet.py#L118-L150 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_fortinet/check_snmp_fortinet.py | check_accesspoints | def check_accesspoints(sess):
"""
check the status of all connected access points
"""
ap_names = walk_data(sess, name_ap_oid, helper)[0]
ap_operationals = walk_data(sess, operational_ap_oid, helper)[0]
ap_availabilitys = walk_data(sess, availability_ap_oid, helper)[0]
... | python | def check_accesspoints(sess):
"""
check the status of all connected access points
"""
ap_names = walk_data(sess, name_ap_oid, helper)[0]
ap_operationals = walk_data(sess, operational_ap_oid, helper)[0]
ap_availabilitys = walk_data(sess, availability_ap_oid, helper)[0]
... | [
"def",
"check_accesspoints",
"(",
"sess",
")",
":",
"ap_names",
"=",
"walk_data",
"(",
"sess",
",",
"name_ap_oid",
",",
"helper",
")",
"[",
"0",
"]",
"ap_operationals",
"=",
"walk_data",
"(",
"sess",
",",
"operational_ap_oid",
",",
"helper",
")",
"[",
"0",... | check the status of all connected access points | [
"check",
"the",
"status",
"of",
"all",
"connected",
"access",
"points"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_fortinet/check_snmp_fortinet.py#L153-L191 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/idrac.py | normal_check | def normal_check(name, status, device_type):
"""if the status is "ok" in the NORMAL_STATE dict, return ok + string
if the status is not "ok", return critical + string"""
status_string = NORMAL_STATE.get(int(status), "unknown")
if status_string == "ok":
return ok, "{} '{}': {}".format(device_typ... | python | def normal_check(name, status, device_type):
"""if the status is "ok" in the NORMAL_STATE dict, return ok + string
if the status is not "ok", return critical + string"""
status_string = NORMAL_STATE.get(int(status), "unknown")
if status_string == "ok":
return ok, "{} '{}': {}".format(device_typ... | [
"def",
"normal_check",
"(",
"name",
",",
"status",
",",
"device_type",
")",
":",
"status_string",
"=",
"NORMAL_STATE",
".",
"get",
"(",
"int",
"(",
"status",
")",
",",
"\"unknown\"",
")",
"if",
"status_string",
"==",
"\"ok\"",
":",
"return",
"ok",
",",
"... | if the status is "ok" in the NORMAL_STATE dict, return ok + string
if the status is not "ok", return critical + string | [
"if",
"the",
"status",
"is",
"ok",
"in",
"the",
"NORMAL_STATE",
"dict",
"return",
"ok",
"+",
"string",
"if",
"the",
"status",
"is",
"not",
"ok",
"return",
"critical",
"+",
"string"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/idrac.py#L163-L174 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/idrac.py | probe_check | def probe_check(name, status, device_type):
"""if the status is "ok" in the PROBE_STATE dict, return ok + string
if the status is not "ok", return critical + string"""
status_string = PROBE_STATE.get(int(status), "unknown")
if status_string == "ok":
return ok, "{} '{}': {}".format(device_type, ... | python | def probe_check(name, status, device_type):
"""if the status is "ok" in the PROBE_STATE dict, return ok + string
if the status is not "ok", return critical + string"""
status_string = PROBE_STATE.get(int(status), "unknown")
if status_string == "ok":
return ok, "{} '{}': {}".format(device_type, ... | [
"def",
"probe_check",
"(",
"name",
",",
"status",
",",
"device_type",
")",
":",
"status_string",
"=",
"PROBE_STATE",
".",
"get",
"(",
"int",
"(",
"status",
")",
",",
"\"unknown\"",
")",
"if",
"status_string",
"==",
"\"ok\"",
":",
"return",
"ok",
",",
"\"... | if the status is "ok" in the PROBE_STATE dict, return ok + string
if the status is not "ok", return critical + string | [
"if",
"the",
"status",
"is",
"ok",
"in",
"the",
"PROBE_STATE",
"dict",
"return",
"ok",
"+",
"string",
"if",
"the",
"status",
"is",
"not",
"ok",
"return",
"critical",
"+",
"string"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/idrac.py#L177-L188 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/idrac.py | Idrac.add_device_information | def add_device_information(helper, session):
""" add general device information to summary """
host_name_data = helper.get_snmp_value(session, helper,
DEVICE_INFORMATION_OIDS['oid_host_name'])
product_type_data = helper.get_snmp_value(session, help... | python | def add_device_information(helper, session):
""" add general device information to summary """
host_name_data = helper.get_snmp_value(session, helper,
DEVICE_INFORMATION_OIDS['oid_host_name'])
product_type_data = helper.get_snmp_value(session, help... | [
"def",
"add_device_information",
"(",
"helper",
",",
"session",
")",
":",
"host_name_data",
"=",
"helper",
".",
"get_snmp_value",
"(",
"session",
",",
"helper",
",",
"DEVICE_INFORMATION_OIDS",
"[",
"'oid_host_name'",
"]",
")",
"product_type_data",
"=",
"helper",
"... | add general device information to summary | [
"add",
"general",
"device",
"information",
"to",
"summary"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/idrac.py#L198-L210 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/idrac.py | Idrac.process_status | def process_status(self, helper, session, check):
""""process a single status"""
snmp_result_status = helper.get_snmp_value(session, helper, DEVICE_GLOBAL_OIDS['oid_' + check])
if check == "system_lcd":
helper.update_status(helper, normal_check("global", snmp_result_status, "LCD sta... | python | def process_status(self, helper, session, check):
""""process a single status"""
snmp_result_status = helper.get_snmp_value(session, helper, DEVICE_GLOBAL_OIDS['oid_' + check])
if check == "system_lcd":
helper.update_status(helper, normal_check("global", snmp_result_status, "LCD sta... | [
"def",
"process_status",
"(",
"self",
",",
"helper",
",",
"session",
",",
"check",
")",
":",
"snmp_result_status",
"=",
"helper",
".",
"get_snmp_value",
"(",
"session",
",",
"helper",
",",
"DEVICE_GLOBAL_OIDS",
"[",
"'oid_'",
"+",
"check",
"]",
")",
"if",
... | process a single status | [
"process",
"a",
"single",
"status"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/idrac.py#L212-L224 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/idrac.py | Idrac.process_states | def process_states(self, helper, session, check):
"""process status values from a table"""
snmp_result_status = helper.walk_snmp_values(session, helper,
DEVICE_STATES_OIDS["oid_" + check],
check)
... | python | def process_states(self, helper, session, check):
"""process status values from a table"""
snmp_result_status = helper.walk_snmp_values(session, helper,
DEVICE_STATES_OIDS["oid_" + check],
check)
... | [
"def",
"process_states",
"(",
"self",
",",
"helper",
",",
"session",
",",
"check",
")",
":",
"snmp_result_status",
"=",
"helper",
".",
"walk_snmp_values",
"(",
"session",
",",
"helper",
",",
"DEVICE_STATES_OIDS",
"[",
"\"oid_\"",
"+",
"check",
"]",
",",
"che... | process status values from a table | [
"process",
"status",
"values",
"from",
"a",
"table"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/idrac.py#L226-L257 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/idrac.py | Idrac.process_temperature_sensors | def process_temperature_sensors(helper, session):
"""process the temperature sensors"""
snmp_result_temp_sensor_names = helper.walk_snmp_values(
session, helper,
DEVICE_TEMPERATURE_OIDS['oid_temperature_probe_location'], "temperature sensors")
snmp_result_temp_sensor_stat... | python | def process_temperature_sensors(helper, session):
"""process the temperature sensors"""
snmp_result_temp_sensor_names = helper.walk_snmp_values(
session, helper,
DEVICE_TEMPERATURE_OIDS['oid_temperature_probe_location'], "temperature sensors")
snmp_result_temp_sensor_stat... | [
"def",
"process_temperature_sensors",
"(",
"helper",
",",
"session",
")",
":",
"snmp_result_temp_sensor_names",
"=",
"helper",
".",
"walk_snmp_values",
"(",
"session",
",",
"helper",
",",
"DEVICE_TEMPERATURE_OIDS",
"[",
"'oid_temperature_probe_location'",
"]",
",",
"\"t... | process the temperature sensors | [
"process",
"the",
"temperature",
"sensors"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/idrac.py#L260-L279 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/idrac.py | Idrac.check_drives | def check_drives(drivename, drivestatus):
""" check the drive status """
return DISK_STATES[int(drivestatus)]["icingastatus"], "Drive '{}': {}".format(
drivename, DISK_STATES[int(drivestatus)]["result"]) | python | def check_drives(drivename, drivestatus):
""" check the drive status """
return DISK_STATES[int(drivestatus)]["icingastatus"], "Drive '{}': {}".format(
drivename, DISK_STATES[int(drivestatus)]["result"]) | [
"def",
"check_drives",
"(",
"drivename",
",",
"drivestatus",
")",
":",
"return",
"DISK_STATES",
"[",
"int",
"(",
"drivestatus",
")",
"]",
"[",
"\"icingastatus\"",
"]",
",",
"\"Drive '{}': {}\"",
".",
"format",
"(",
"drivename",
",",
"DISK_STATES",
"[",
"int",
... | check the drive status | [
"check",
"the",
"drive",
"status"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/idrac.py#L282-L285 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/idrac.py | Idrac.check_power_unit_redundancy | def check_power_unit_redundancy(power_unit_name_data, power_unit_redundancy_data):
""" check the status of the power units """
return (POWER_UNIT_REDUNDANCY_STATE[int(power_unit_redundancy_data)]["icingastatus"],
"Power unit '{}' redundancy: {}".format(power_unit_name_data,
... | python | def check_power_unit_redundancy(power_unit_name_data, power_unit_redundancy_data):
""" check the status of the power units """
return (POWER_UNIT_REDUNDANCY_STATE[int(power_unit_redundancy_data)]["icingastatus"],
"Power unit '{}' redundancy: {}".format(power_unit_name_data,
... | [
"def",
"check_power_unit_redundancy",
"(",
"power_unit_name_data",
",",
"power_unit_redundancy_data",
")",
":",
"return",
"(",
"POWER_UNIT_REDUNDANCY_STATE",
"[",
"int",
"(",
"power_unit_redundancy_data",
")",
"]",
"[",
"\"icingastatus\"",
"]",
",",
"\"Power unit '{}' redun... | check the status of the power units | [
"check",
"the",
"status",
"of",
"the",
"power",
"units"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/idrac.py#L294-L300 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_ilo4/check_snmp_ilo4.py | check_global_status | def check_global_status(flag, name, oid):
"""
check a global status
check_global_status(True, "Global Storage", '.1.3.6.1.4.1.232.3.1.3.0')
"""
# only check the status, if the "no" flag is not set
if flag:
# get the data via snmp
myData = get_data(sess, oid, helper)
data_... | python | def check_global_status(flag, name, oid):
"""
check a global status
check_global_status(True, "Global Storage", '.1.3.6.1.4.1.232.3.1.3.0')
"""
# only check the status, if the "no" flag is not set
if flag:
# get the data via snmp
myData = get_data(sess, oid, helper)
data_... | [
"def",
"check_global_status",
"(",
"flag",
",",
"name",
",",
"oid",
")",
":",
"# only check the status, if the \"no\" flag is not set",
"if",
"flag",
":",
"# get the data via snmp",
"myData",
"=",
"get_data",
"(",
"sess",
",",
"oid",
",",
"helper",
")",
"data_summar... | check a global status
check_global_status(True, "Global Storage", '.1.3.6.1.4.1.232.3.1.3.0') | [
"check",
"a",
"global",
"status",
"check_global_status",
"(",
"True",
"Global",
"Storage",
".",
"1",
".",
"3",
".",
"6",
".",
"1",
".",
"4",
".",
"1",
".",
"232",
".",
"3",
".",
"1",
".",
"3",
".",
"0",
")"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_ilo4/check_snmp_ilo4.py#L212-L222 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_ilo4/check_snmp_ilo4.py | check_server_power | def check_server_power():
"""
Check if the server is powered on
Skip this check, if the --noPowerState is set
"""
if power_state_flag:
power_state = get_data(sess, oid_power_state, helper)
power_state_summary_output, power_state_long_output = state_summary(power_state, 'Server power'... | python | def check_server_power():
"""
Check if the server is powered on
Skip this check, if the --noPowerState is set
"""
if power_state_flag:
power_state = get_data(sess, oid_power_state, helper)
power_state_summary_output, power_state_long_output = state_summary(power_state, 'Server power'... | [
"def",
"check_server_power",
"(",
")",
":",
"if",
"power_state_flag",
":",
"power_state",
"=",
"get_data",
"(",
"sess",
",",
"oid_power_state",
",",
"helper",
")",
"power_state_summary_output",
",",
"power_state_long_output",
"=",
"state_summary",
"(",
"power_state",
... | Check if the server is powered on
Skip this check, if the --noPowerState is set | [
"Check",
"if",
"the",
"server",
"is",
"powered",
"on",
"Skip",
"this",
"check",
"if",
"the",
"--",
"noPowerState",
"is",
"set"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_ilo4/check_snmp_ilo4.py#L224-L232 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_ilo4/check_snmp_ilo4.py | check_storage_controllers | def check_storage_controllers():
"""
Check the status of the storage controllers
Skip this check, if --noController is set
"""
if ctrl_flag:
ctrl = walk_data(sess, oid_ctrl, helper)[0]
for x, data in enumerate(ctrl, 1):
ctrl_summary_output, ctrl_long_output = state_summar... | python | def check_storage_controllers():
"""
Check the status of the storage controllers
Skip this check, if --noController is set
"""
if ctrl_flag:
ctrl = walk_data(sess, oid_ctrl, helper)[0]
for x, data in enumerate(ctrl, 1):
ctrl_summary_output, ctrl_long_output = state_summar... | [
"def",
"check_storage_controllers",
"(",
")",
":",
"if",
"ctrl_flag",
":",
"ctrl",
"=",
"walk_data",
"(",
"sess",
",",
"oid_ctrl",
",",
"helper",
")",
"[",
"0",
"]",
"for",
"x",
",",
"data",
"in",
"enumerate",
"(",
"ctrl",
",",
"1",
")",
":",
"ctrl_s... | Check the status of the storage controllers
Skip this check, if --noController is set | [
"Check",
"the",
"status",
"of",
"the",
"storage",
"controllers",
"Skip",
"this",
"check",
"if",
"--",
"noController",
"is",
"set"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_ilo4/check_snmp_ilo4.py#L234-L243 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_ilo4/check_snmp_ilo4.py | check_temperature_sensors | def check_temperature_sensors():
"""
Check all temperature sensors of the server
All sensors with the value or threshold is -99 or 0 are ignored
"""
# walk all temperature sensor values and thresholds
env_temp = walk_data(sess, oid_env_temp, helper)[0]
env_temp_thresh = walk_data(sess, o... | python | def check_temperature_sensors():
"""
Check all temperature sensors of the server
All sensors with the value or threshold is -99 or 0 are ignored
"""
# walk all temperature sensor values and thresholds
env_temp = walk_data(sess, oid_env_temp, helper)[0]
env_temp_thresh = walk_data(sess, o... | [
"def",
"check_temperature_sensors",
"(",
")",
":",
"# walk all temperature sensor values and thresholds",
"env_temp",
"=",
"walk_data",
"(",
"sess",
",",
"oid_env_temp",
",",
"helper",
")",
"[",
"0",
"]",
"env_temp_thresh",
"=",
"walk_data",
"(",
"sess",
",",
"oid_e... | Check all temperature sensors of the server
All sensors with the value or threshold is -99 or 0 are ignored | [
"Check",
"all",
"temperature",
"sensors",
"of",
"the",
"server",
"All",
"sensors",
"with",
"the",
"value",
"or",
"threshold",
"is",
"-",
"99",
"or",
"0",
"are",
"ignored"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_ilo4/check_snmp_ilo4.py#L245-L266 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_ilo4/check_snmp_ilo4.py | check_ps | def check_ps():
"""
Check if the power supplies are ok, and we have the configured amount
The check is skipped if --ps=0
"""
if int(input_pwr_sply) != 0:
ps_data = walk_data(sess, oid_ps, helper)[0]
ps_ok_count = 0
for x, state in enumerate(ps_data, 1):
... | python | def check_ps():
"""
Check if the power supplies are ok, and we have the configured amount
The check is skipped if --ps=0
"""
if int(input_pwr_sply) != 0:
ps_data = walk_data(sess, oid_ps, helper)[0]
ps_ok_count = 0
for x, state in enumerate(ps_data, 1):
... | [
"def",
"check_ps",
"(",
")",
":",
"if",
"int",
"(",
"input_pwr_sply",
")",
"!=",
"0",
":",
"ps_data",
"=",
"walk_data",
"(",
"sess",
",",
"oid_ps",
",",
"helper",
")",
"[",
"0",
"]",
"ps_ok_count",
"=",
"0",
"for",
"x",
",",
"state",
"in",
"enumera... | Check if the power supplies are ok, and we have the configured amount
The check is skipped if --ps=0 | [
"Check",
"if",
"the",
"power",
"supplies",
"are",
"ok",
"and",
"we",
"have",
"the",
"configured",
"amount",
"The",
"check",
"is",
"skipped",
"if",
"--",
"ps",
"=",
"0"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_ilo4/check_snmp_ilo4.py#L321-L348 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_ilo4/check_snmp_ilo4.py | check_power_redundancy | def check_power_redundancy():
"""
Check if the power supplies are redundant
The check is skipped if --noPowerRedundancy is set
"""
# skip the check if --noPowerRedundancy is set
if power_redundancy_flag:
# walk the data
ps_redundant_data = walk_data(sess, oid_ps_redundant... | python | def check_power_redundancy():
"""
Check if the power supplies are redundant
The check is skipped if --noPowerRedundancy is set
"""
# skip the check if --noPowerRedundancy is set
if power_redundancy_flag:
# walk the data
ps_redundant_data = walk_data(sess, oid_ps_redundant... | [
"def",
"check_power_redundancy",
"(",
")",
":",
"# skip the check if --noPowerRedundancy is set",
"if",
"power_redundancy_flag",
":",
"# walk the data ",
"ps_redundant_data",
"=",
"walk_data",
"(",
"sess",
",",
"oid_ps_redundant",
",",
"helper",
")",
"[",
"0",
"]",... | Check if the power supplies are redundant
The check is skipped if --noPowerRedundancy is set | [
"Check",
"if",
"the",
"power",
"supplies",
"are",
"redundant",
"The",
"check",
"is",
"skipped",
"if",
"--",
"noPowerRedundancy",
"is",
"set"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_ilo4/check_snmp_ilo4.py#L350-L369 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_ilo4/check_snmp_ilo4.py | check_fan | def check_fan(input_fan):
"""
check the fans
"""
# get a list of all fans
fan_data = walk_data(sess, oid_fan, helper)[0]
fan_count = 0
summary_output = ''
long_output = ''
for x, fan in enumerate(fan_data, 1):
fan = int(fan)
if normal_state[fan] == 'ok':
... | python | def check_fan(input_fan):
"""
check the fans
"""
# get a list of all fans
fan_data = walk_data(sess, oid_fan, helper)[0]
fan_count = 0
summary_output = ''
long_output = ''
for x, fan in enumerate(fan_data, 1):
fan = int(fan)
if normal_state[fan] == 'ok':
... | [
"def",
"check_fan",
"(",
"input_fan",
")",
":",
"# get a list of all fans ",
"fan_data",
"=",
"walk_data",
"(",
"sess",
",",
"oid_fan",
",",
"helper",
")",
"[",
"0",
"]",
"fan_count",
"=",
"0",
"summary_output",
"=",
"''",
"long_output",
"=",
"''",
"for... | check the fans | [
"check",
"the",
"fans"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_ilo4/check_snmp_ilo4.py#L371-L394 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/trustedfilter.py | TrustedFilter.get_snmp_from_host1 | def get_snmp_from_host1(self):
"""
Get SNMP values from 1st host.
"""
response = self.snmp1.get_oids(ps1_oid, ps2_oid, fan1_oid, fan2_oid, bat_oid, temp_oid, activity_oid, logfill_oid)
self.ps1_value = states[int(response[0])]
self.ps2_value = states[int(response[1])]
... | python | def get_snmp_from_host1(self):
"""
Get SNMP values from 1st host.
"""
response = self.snmp1.get_oids(ps1_oid, ps2_oid, fan1_oid, fan2_oid, bat_oid, temp_oid, activity_oid, logfill_oid)
self.ps1_value = states[int(response[0])]
self.ps2_value = states[int(response[1])]
... | [
"def",
"get_snmp_from_host1",
"(",
"self",
")",
":",
"response",
"=",
"self",
".",
"snmp1",
".",
"get_oids",
"(",
"ps1_oid",
",",
"ps2_oid",
",",
"fan1_oid",
",",
"fan2_oid",
",",
"bat_oid",
",",
"temp_oid",
",",
"activity_oid",
",",
"logfill_oid",
")",
"s... | Get SNMP values from 1st host. | [
"Get",
"SNMP",
"values",
"from",
"1st",
"host",
"."
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/trustedfilter.py#L37-L49 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/trustedfilter.py | TrustedFilter.get_snmp_from_host2 | def get_snmp_from_host2(self):
"""
Get SNMP values from 2nd host.
"""
if not self.snmp2:
self.activity_value2 = None
else:
response = self.snmp2.get_oids(activity_oid)
self.activity_value2 = activity[int(response[0])] | python | def get_snmp_from_host2(self):
"""
Get SNMP values from 2nd host.
"""
if not self.snmp2:
self.activity_value2 = None
else:
response = self.snmp2.get_oids(activity_oid)
self.activity_value2 = activity[int(response[0])] | [
"def",
"get_snmp_from_host2",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"snmp2",
":",
"self",
".",
"activity_value2",
"=",
"None",
"else",
":",
"response",
"=",
"self",
".",
"snmp2",
".",
"get_oids",
"(",
"activity_oid",
")",
"self",
".",
"activit... | Get SNMP values from 2nd host. | [
"Get",
"SNMP",
"values",
"from",
"2nd",
"host",
"."
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/trustedfilter.py#L51-L59 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/trustedfilter.py | TrustedFilter.check | def check(self):
"""
Evaluate health status from device parameters.
"""
try:
self.get_snmp_from_host1()
self.get_snmp_from_host2()
except (health_monitoring_plugins.SnmpException, TypeError, KeyError):
self.helper.status(unknown)
se... | python | def check(self):
"""
Evaluate health status from device parameters.
"""
try:
self.get_snmp_from_host1()
self.get_snmp_from_host2()
except (health_monitoring_plugins.SnmpException, TypeError, KeyError):
self.helper.status(unknown)
se... | [
"def",
"check",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"get_snmp_from_host1",
"(",
")",
"self",
".",
"get_snmp_from_host2",
"(",
")",
"except",
"(",
"health_monitoring_plugins",
".",
"SnmpException",
",",
"TypeError",
",",
"KeyError",
")",
":",
"sel... | Evaluate health status from device parameters. | [
"Evaluate",
"health",
"status",
"from",
"device",
"parameters",
"."
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/trustedfilter.py#L61-L122 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/__init__.py | HelperExtension.update_status | def update_status(self, helper, status):
""" update the helper """
if status:
self.status(status[0])
# if the status is ok, add it to the long output
if status[0] == 0:
self.add_long_output(status[1])
# if the status is not ok, add it to t... | python | def update_status(self, helper, status):
""" update the helper """
if status:
self.status(status[0])
# if the status is ok, add it to the long output
if status[0] == 0:
self.add_long_output(status[1])
# if the status is not ok, add it to t... | [
"def",
"update_status",
"(",
"self",
",",
"helper",
",",
"status",
")",
":",
"if",
"status",
":",
"self",
".",
"status",
"(",
"status",
"[",
"0",
"]",
")",
"# if the status is ok, add it to the long output",
"if",
"status",
"[",
"0",
"]",
"==",
"0",
":",
... | update the helper | [
"update",
"the",
"helper"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/__init__.py#L23-L33 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/__init__.py | SnmpHelper.get_snmp_value | def get_snmp_value(sess, helper, oid):
""" return a snmp value or exits the plugin with unknown"""
snmp_result = sess.get_oids(oid)[0]
if snmp_result is None:
helper.exit(summary="No response from device for oid " + oid, exit_code=unknown, perfdata='')
else:
retu... | python | def get_snmp_value(sess, helper, oid):
""" return a snmp value or exits the plugin with unknown"""
snmp_result = sess.get_oids(oid)[0]
if snmp_result is None:
helper.exit(summary="No response from device for oid " + oid, exit_code=unknown, perfdata='')
else:
retu... | [
"def",
"get_snmp_value",
"(",
"sess",
",",
"helper",
",",
"oid",
")",
":",
"snmp_result",
"=",
"sess",
".",
"get_oids",
"(",
"oid",
")",
"[",
"0",
"]",
"if",
"snmp_result",
"is",
"None",
":",
"helper",
".",
"exit",
"(",
"summary",
"=",
"\"No response f... | return a snmp value or exits the plugin with unknown | [
"return",
"a",
"snmp",
"value",
"or",
"exits",
"the",
"plugin",
"with",
"unknown"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/__init__.py#L77-L84 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/__init__.py | SnmpHelper.walk_snmp_values | def walk_snmp_values(sess, helper, oid, check):
""" return a snmp value or exits the plugin with unknown"""
try:
snmp_walk = sess.walk_oid(oid)
result_list = []
for x in range(len(snmp_walk)):
result_list.append(snmp_walk[x].val)
if resul... | python | def walk_snmp_values(sess, helper, oid, check):
""" return a snmp value or exits the plugin with unknown"""
try:
snmp_walk = sess.walk_oid(oid)
result_list = []
for x in range(len(snmp_walk)):
result_list.append(snmp_walk[x].val)
if resul... | [
"def",
"walk_snmp_values",
"(",
"sess",
",",
"helper",
",",
"oid",
",",
"check",
")",
":",
"try",
":",
"snmp_walk",
"=",
"sess",
".",
"walk_oid",
"(",
"oid",
")",
"result_list",
"=",
"[",
"]",
"for",
"x",
"in",
"range",
"(",
"len",
"(",
"snmp_walk",
... | return a snmp value or exits the plugin with unknown | [
"return",
"a",
"snmp",
"value",
"or",
"exits",
"the",
"plugin",
"with",
"unknown"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/__init__.py#L87-L103 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/__init__.py | SnmpSession.walk_oid | def walk_oid(self, oid):
"""Get a list of SNMP varbinds in response to a walk for oid.
Each varbind in response list has a tag, iid, val and type attribute."""
var = netsnmp.Varbind(oid)
varlist = netsnmp.VarList(var)
data = self.walk(varlist)
if len(data) == 0:
... | python | def walk_oid(self, oid):
"""Get a list of SNMP varbinds in response to a walk for oid.
Each varbind in response list has a tag, iid, val and type attribute."""
var = netsnmp.Varbind(oid)
varlist = netsnmp.VarList(var)
data = self.walk(varlist)
if len(data) == 0:
... | [
"def",
"walk_oid",
"(",
"self",
",",
"oid",
")",
":",
"var",
"=",
"netsnmp",
".",
"Varbind",
"(",
"oid",
")",
"varlist",
"=",
"netsnmp",
".",
"VarList",
"(",
"var",
")",
"data",
"=",
"self",
".",
"walk",
"(",
"varlist",
")",
"if",
"len",
"(",
"da... | Get a list of SNMP varbinds in response to a walk for oid.
Each varbind in response list has a tag, iid, val and type attribute. | [
"Get",
"a",
"list",
"of",
"SNMP",
"varbinds",
"in",
"response",
"to",
"a",
"walk",
"for",
"oid",
".",
"Each",
"varbind",
"in",
"response",
"list",
"has",
"a",
"tag",
"iid",
"val",
"and",
"type",
"attribute",
"."
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/__init__.py#L121-L130 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_large_storage/check_snmp_large_storage.py | run_scan | def run_scan():
"""
show all available partitions
"""
all_disks = walk_data(sess, oid_hrStorageDescr, helper)[0]
print "All available disks at: " + host
for disk in all_disks:
print "Disk: \t'" + disk + "'"
quit() | python | def run_scan():
"""
show all available partitions
"""
all_disks = walk_data(sess, oid_hrStorageDescr, helper)[0]
print "All available disks at: " + host
for disk in all_disks:
print "Disk: \t'" + disk + "'"
quit() | [
"def",
"run_scan",
"(",
")",
":",
"all_disks",
"=",
"walk_data",
"(",
"sess",
",",
"oid_hrStorageDescr",
",",
"helper",
")",
"[",
"0",
"]",
"print",
"\"All available disks at: \"",
"+",
"host",
"for",
"disk",
"in",
"all_disks",
":",
"print",
"\"Disk: \\t'\"",
... | show all available partitions | [
"show",
"all",
"available",
"partitions"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_large_storage/check_snmp_large_storage.py#L104-L113 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_large_storage/check_snmp_large_storage.py | partition_found | def partition_found(partition, description):
"""
returns True, if the partition (--partition) is in the description we received from the host
"""
# if we want to have a linux partition (/) we use the full path (startswith "/" would result in / /var /dev etc).
# if we start with something else, we u... | python | def partition_found(partition, description):
"""
returns True, if the partition (--partition) is in the description we received from the host
"""
# if we want to have a linux partition (/) we use the full path (startswith "/" would result in / /var /dev etc).
# if we start with something else, we u... | [
"def",
"partition_found",
"(",
"partition",
",",
"description",
")",
":",
"# if we want to have a linux partition (/) we use the full path (startswith \"/\" would result in / /var /dev etc). ",
"# if we start with something else, we use the startswith function",
"if",
"\"/\"",
"in",
"parti... | returns True, if the partition (--partition) is in the description we received from the host | [
"returns",
"True",
"if",
"the",
"partition",
"(",
"--",
"partition",
")",
"is",
"in",
"the",
"description",
"we",
"received",
"from",
"the",
"host"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_large_storage/check_snmp_large_storage.py#L116-L132 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_large_storage/check_snmp_large_storage.py | check_partition | def check_partition():
"""
check the defined partition
"""
all_index = walk_data(sess, oid_hrStorageIndex, helper)[0]
all_descriptions = walk_data(sess, oid_hrStorageDescr, helper)[0]
# we need the sucess flag for the error handling (partition found or not found)
sucess ... | python | def check_partition():
"""
check the defined partition
"""
all_index = walk_data(sess, oid_hrStorageIndex, helper)[0]
all_descriptions = walk_data(sess, oid_hrStorageDescr, helper)[0]
# we need the sucess flag for the error handling (partition found or not found)
sucess ... | [
"def",
"check_partition",
"(",
")",
":",
"all_index",
"=",
"walk_data",
"(",
"sess",
",",
"oid_hrStorageIndex",
",",
"helper",
")",
"[",
"0",
"]",
"all_descriptions",
"=",
"walk_data",
"(",
"sess",
",",
"oid_hrStorageDescr",
",",
"helper",
")",
"[",
"0",
"... | check the defined partition | [
"check",
"the",
"defined",
"partition"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_large_storage/check_snmp_large_storage.py#L135-L190 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_procurve/check_snmp_procurve.py | check_sensors | def check_sensors():
"""
collect and check all available sensors
"""
all_sensors = walk_data(sess, oid_description, helper)[0]
all_status = walk_data(sess, oid_status, helper)[0]
# here we zip all index and descriptions to have a list like
# [('Fan Sensor', '2'), ('Power Supply Sensor', '4... | python | def check_sensors():
"""
collect and check all available sensors
"""
all_sensors = walk_data(sess, oid_description, helper)[0]
all_status = walk_data(sess, oid_status, helper)[0]
# here we zip all index and descriptions to have a list like
# [('Fan Sensor', '2'), ('Power Supply Sensor', '4... | [
"def",
"check_sensors",
"(",
")",
":",
"all_sensors",
"=",
"walk_data",
"(",
"sess",
",",
"oid_description",
",",
"helper",
")",
"[",
"0",
"]",
"all_status",
"=",
"walk_data",
"(",
"sess",
",",
"oid_status",
",",
"helper",
")",
"[",
"0",
"]",
"# here we ... | collect and check all available sensors | [
"collect",
"and",
"check",
"all",
"available",
"sensors"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_procurve/check_snmp_procurve.py#L59-L89 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_apc_ups/check_snmp_apc_ups.py | check_basic_battery_status | def check_basic_battery_status(the_session, the_helper, the_snmp_value):
"""
OID .1.3.6.1.4.1.318.1.1.1.2.1.1.0
MIB Excerpt
The status of the UPS batteries. A batteryLow(3)
value indicates the UPS will be unable to sustain the
current load, and its services will be lost if power is
not ... | python | def check_basic_battery_status(the_session, the_helper, the_snmp_value):
"""
OID .1.3.6.1.4.1.318.1.1.1.2.1.1.0
MIB Excerpt
The status of the UPS batteries. A batteryLow(3)
value indicates the UPS will be unable to sustain the
current load, and its services will be lost if power is
not ... | [
"def",
"check_basic_battery_status",
"(",
"the_session",
",",
"the_helper",
",",
"the_snmp_value",
")",
":",
"apc_battery_states",
"=",
"{",
"'1'",
":",
"'unknown'",
",",
"'2'",
":",
"'batteryNormal'",
",",
"'3'",
":",
"'batteryLow'",
",",
"'4'",
":",
"'batteryI... | OID .1.3.6.1.4.1.318.1.1.1.2.1.1.0
MIB Excerpt
The status of the UPS batteries. A batteryLow(3)
value indicates the UPS will be unable to sustain the
current load, and its services will be lost if power is
not restored. The amount of run time in reserve at the
time of low battery can be c... | [
"OID",
".",
"1",
".",
"3",
".",
"6",
".",
"1",
".",
"4",
".",
"1",
".",
"318",
".",
"1",
".",
"1",
".",
"1",
".",
"2",
".",
"1",
".",
"1",
".",
"0",
"MIB",
"Excerpt",
"The",
"status",
"of",
"the",
"UPS",
"batteries",
".",
"A",
"batteryLow... | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_apc_ups/check_snmp_apc_ups.py#L66-L99 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_apc_ups/check_snmp_apc_ups.py | check_runtime_remaining | def check_runtime_remaining(the_session, the_helper, the_snmp_value):
"""
OID .1.3.6.1.4.1.318.1.1.1.2.2.3.0
MIB excerpt
The UPS battery run time remaining before battery
exhaustion.
SNMP value is in TimeTicks aka hundredths of a second
"""
a_minute_value = calc_minutes_from_ticks(the_s... | python | def check_runtime_remaining(the_session, the_helper, the_snmp_value):
"""
OID .1.3.6.1.4.1.318.1.1.1.2.2.3.0
MIB excerpt
The UPS battery run time remaining before battery
exhaustion.
SNMP value is in TimeTicks aka hundredths of a second
"""
a_minute_value = calc_minutes_from_ticks(the_s... | [
"def",
"check_runtime_remaining",
"(",
"the_session",
",",
"the_helper",
",",
"the_snmp_value",
")",
":",
"a_minute_value",
"=",
"calc_minutes_from_ticks",
"(",
"the_snmp_value",
")",
"the_helper",
".",
"add_metric",
"(",
"label",
"=",
"the_helper",
".",
"options",
... | OID .1.3.6.1.4.1.318.1.1.1.2.2.3.0
MIB excerpt
The UPS battery run time remaining before battery
exhaustion.
SNMP value is in TimeTicks aka hundredths of a second | [
"OID",
".",
"1",
".",
"3",
".",
"6",
".",
"1",
".",
"4",
".",
"1",
".",
"318",
".",
"1",
".",
"1",
".",
"1",
".",
"2",
".",
"2",
".",
"3",
".",
"0",
"MIB",
"excerpt",
"The",
"UPS",
"battery",
"run",
"time",
"remaining",
"before",
"battery",... | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_apc_ups/check_snmp_apc_ups.py#L160-L176 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_apc_ups/check_snmp_apc_ups.py | check_battery_replace_indicator | def check_battery_replace_indicator(the_session, the_helper, the_snmp_value):
"""
OID .1.3.6.1.4.1.318.1.1.1.2.2.4.0
MIB Excerpt
Indicates whether the UPS batteries need replacing.
Value List
noBatteryNeedsReplacing (1)
batteryNeedsReplacing (2)
"""
apc_states = {
'1' : 'Bat... | python | def check_battery_replace_indicator(the_session, the_helper, the_snmp_value):
"""
OID .1.3.6.1.4.1.318.1.1.1.2.2.4.0
MIB Excerpt
Indicates whether the UPS batteries need replacing.
Value List
noBatteryNeedsReplacing (1)
batteryNeedsReplacing (2)
"""
apc_states = {
'1' : 'Bat... | [
"def",
"check_battery_replace_indicator",
"(",
"the_session",
",",
"the_helper",
",",
"the_snmp_value",
")",
":",
"apc_states",
"=",
"{",
"'1'",
":",
"'Battery does not need to be replaced'",
",",
"'2'",
":",
"'Battery needs to be replaced!'",
"}",
"a_state",
"=",
"apc_... | OID .1.3.6.1.4.1.318.1.1.1.2.2.4.0
MIB Excerpt
Indicates whether the UPS batteries need replacing.
Value List
noBatteryNeedsReplacing (1)
batteryNeedsReplacing (2) | [
"OID",
".",
"1",
".",
"3",
".",
"6",
".",
"1",
".",
"4",
".",
"1",
".",
"318",
".",
"1",
".",
"1",
".",
"1",
".",
"2",
".",
"2",
".",
"4",
".",
"0",
"MIB",
"Excerpt",
"Indicates",
"whether",
"the",
"UPS",
"batteries",
"need",
"replacing",
"... | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_apc_ups/check_snmp_apc_ups.py#L179-L199 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_apc_ups/check_snmp_apc_ups.py | check_environment_temperature | def check_environment_temperature(the_session, the_helper, the_snmp_value, the_unit=1):
"""
OID .1.3.6.1.4.1.318.1.1.10.2.3.2.1.4.1
MIB Excerpt
The current temperature reading from the probe displayed
in the units shown in the 'iemStatusProbeTempUnits' OID
(Celsius or Fahrenheit).
Descripti... | python | def check_environment_temperature(the_session, the_helper, the_snmp_value, the_unit=1):
"""
OID .1.3.6.1.4.1.318.1.1.10.2.3.2.1.4.1
MIB Excerpt
The current temperature reading from the probe displayed
in the units shown in the 'iemStatusProbeTempUnits' OID
(Celsius or Fahrenheit).
Descripti... | [
"def",
"check_environment_temperature",
"(",
"the_session",
",",
"the_helper",
",",
"the_snmp_value",
",",
"the_unit",
"=",
"1",
")",
":",
"a_snmp_unit",
"=",
"snmpSessionBaseClass",
".",
"get_data",
"(",
"the_session",
",",
"apc_oid_environment_temperature_unit",
",",
... | OID .1.3.6.1.4.1.318.1.1.10.2.3.2.1.4.1
MIB Excerpt
The current temperature reading from the probe displayed
in the units shown in the 'iemStatusProbeTempUnits' OID
(Celsius or Fahrenheit).
Description of unit OID
OID .1.3.6.1.4.1.318.1.1.10.2.3.2.1.5
The temperature scale used to display t... | [
"OID",
".",
"1",
".",
"3",
".",
"6",
".",
"1",
".",
"4",
".",
"1",
".",
"318",
".",
"1",
".",
"1",
".",
"10",
".",
"2",
".",
"3",
".",
"2",
".",
"1",
".",
"4",
".",
"1",
"MIB",
"Excerpt",
"The",
"current",
"temperature",
"reading",
"from"... | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_apc_ups/check_snmp_apc_ups.py#L330-L364 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_port/check_snmp_port.py | check_typ | def check_typ(helper, typ):
"""
check if typ parameter is TCP or UDP
"""
if typ != "tcp" and typ != "udp":
helper.exit(summary="Type (-t) must be udp or tcp.", exit_code=unknown, perfdata='') | python | def check_typ(helper, typ):
"""
check if typ parameter is TCP or UDP
"""
if typ != "tcp" and typ != "udp":
helper.exit(summary="Type (-t) must be udp or tcp.", exit_code=unknown, perfdata='') | [
"def",
"check_typ",
"(",
"helper",
",",
"typ",
")",
":",
"if",
"typ",
"!=",
"\"tcp\"",
"and",
"typ",
"!=",
"\"udp\"",
":",
"helper",
".",
"exit",
"(",
"summary",
"=",
"\"Type (-t) must be udp or tcp.\"",
",",
"exit_code",
"=",
"unknown",
",",
"perfdata",
"... | check if typ parameter is TCP or UDP | [
"check",
"if",
"typ",
"parameter",
"is",
"TCP",
"or",
"UDP"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_port/check_snmp_port.py#L56-L61 |
rsmuc/health_monitoring_plugins | health_monitoring_plugins/check_snmp_port/check_snmp_port.py | check_port | def check_port(helper, port):
"""
check if the port parameter is really a port or "scan"
"""
try:
int(port)
except ValueError:
helper.exit(summary="Port (-p) must be a integer value.", exit_code=unknown, perfdata='') | python | def check_port(helper, port):
"""
check if the port parameter is really a port or "scan"
"""
try:
int(port)
except ValueError:
helper.exit(summary="Port (-p) must be a integer value.", exit_code=unknown, perfdata='') | [
"def",
"check_port",
"(",
"helper",
",",
"port",
")",
":",
"try",
":",
"int",
"(",
"port",
")",
"except",
"ValueError",
":",
"helper",
".",
"exit",
"(",
"summary",
"=",
"\"Port (-p) must be a integer value.\"",
",",
"exit_code",
"=",
"unknown",
",",
"perfdat... | check if the port parameter is really a port or "scan" | [
"check",
"if",
"the",
"port",
"parameter",
"is",
"really",
"a",
"port",
"or",
"scan"
] | train | https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/check_snmp_port/check_snmp_port.py#L63-L70 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.