repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
wilfilho/BingTranslator | BingTranslator/__init__.py | Translator._get_content | def _get_content(self, params, mode_translate):
"""
This method gets the token and makes the header variable that
will be used in connection authentication. After that, calls
the _make_request() method to return the desired data.
"""
token = self._get_... | python | def _get_content(self, params, mode_translate):
"""
This method gets the token and makes the header variable that
will be used in connection authentication. After that, calls
the _make_request() method to return the desired data.
"""
token = self._get_... | [
"def",
"_get_content",
"(",
"self",
",",
"params",
",",
"mode_translate",
")",
":",
"token",
"=",
"self",
".",
"_get_token",
"(",
")",
"headers",
"=",
"{",
"'Authorization'",
":",
"'Bearer '",
"+",
"token",
"}",
"parameters",
"=",
"params",
"translation_url"... | This method gets the token and makes the header variable that
will be used in connection authentication. After that, calls
the _make_request() method to return the desired data. | [
"This",
"method",
"gets",
"the",
"token",
"and",
"makes",
"the",
"header",
"variable",
"that",
"will",
"be",
"used",
"in",
"connection",
"authentication",
".",
"After",
"that",
"calls",
"the",
"_make_request",
"()",
"method",
"to",
"return",
"the",
"desired",
... | 6bada6fe1ac4177cc7dc62ff16dab561ba714534 | https://github.com/wilfilho/BingTranslator/blob/6bada6fe1ac4177cc7dc62ff16dab561ba714534/BingTranslator/__init__.py#L74-L84 | train |
wilfilho/BingTranslator | BingTranslator/__init__.py | Translator.detect_language | def detect_language(self, text):
"""
Params:
::text = Text for identify language.
Returns:
Returns language present on text.
"""
infos_translate = TextDetectLanguageModel(text).to_dict()
mode_translate = Transl... | python | def detect_language(self, text):
"""
Params:
::text = Text for identify language.
Returns:
Returns language present on text.
"""
infos_translate = TextDetectLanguageModel(text).to_dict()
mode_translate = Transl... | [
"def",
"detect_language",
"(",
"self",
",",
"text",
")",
":",
"infos_translate",
"=",
"TextDetectLanguageModel",
"(",
"text",
")",
".",
"to_dict",
"(",
")",
"mode_translate",
"=",
"TranslatorMode",
".",
"Detect",
".",
"value",
"return",
"self",
".",
"_get_cont... | Params:
::text = Text for identify language.
Returns:
Returns language present on text. | [
"Params",
":",
"::",
"text",
"=",
"Text",
"for",
"identify",
"language",
".",
"Returns",
":",
"Returns",
"language",
"present",
"on",
"text",
"."
] | 6bada6fe1ac4177cc7dc62ff16dab561ba714534 | https://github.com/wilfilho/BingTranslator/blob/6bada6fe1ac4177cc7dc62ff16dab561ba714534/BingTranslator/__init__.py#L100-L110 | train |
wilfilho/BingTranslator | BingTranslator/__init__.py | Translator.detect_languages | def detect_languages(self, texts):
"""
Params:
::texts = Array of texts for detect languages
Returns:
Returns language present on array of text.
"""
text_list = TextUtils.format_list_to_send(texts)
infos_translate = TextDe... | python | def detect_languages(self, texts):
"""
Params:
::texts = Array of texts for detect languages
Returns:
Returns language present on array of text.
"""
text_list = TextUtils.format_list_to_send(texts)
infos_translate = TextDe... | [
"def",
"detect_languages",
"(",
"self",
",",
"texts",
")",
":",
"text_list",
"=",
"TextUtils",
".",
"format_list_to_send",
"(",
"texts",
")",
"infos_translate",
"=",
"TextDetectLanguageModel",
"(",
"text_list",
")",
".",
"to_dict",
"(",
")",
"texts_for_detect",
... | Params:
::texts = Array of texts for detect languages
Returns:
Returns language present on array of text. | [
"Params",
":",
"::",
"texts",
"=",
"Array",
"of",
"texts",
"for",
"detect",
"languages",
"Returns",
":",
"Returns",
"language",
"present",
"on",
"array",
"of",
"text",
"."
] | 6bada6fe1ac4177cc7dc62ff16dab561ba714534 | https://github.com/wilfilho/BingTranslator/blob/6bada6fe1ac4177cc7dc62ff16dab561ba714534/BingTranslator/__init__.py#L112-L125 | train |
wilfilho/BingTranslator | BingTranslator/__init__.py | Translator.translate | def translate(self, text, to_lang, from_lang=None,
content_type="text/plain", category=None):
"""
This method takes as a parameter the desired text to be translated
and the language to which should be translated. To find the code
for each language just ... | python | def translate(self, text, to_lang, from_lang=None,
content_type="text/plain", category=None):
"""
This method takes as a parameter the desired text to be translated
and the language to which should be translated. To find the code
for each language just ... | [
"def",
"translate",
"(",
"self",
",",
"text",
",",
"to_lang",
",",
"from_lang",
"=",
"None",
",",
"content_type",
"=",
"\"text/plain\"",
",",
"category",
"=",
"None",
")",
":",
"infos_translate",
"=",
"TextModel",
"(",
"text",
",",
"to_lang",
",",
"from_la... | This method takes as a parameter the desired text to be translated
and the language to which should be translated. To find the code
for each language just go to the library home page.
The parameter ::from_lang:: is optional because the api microsoft
recognizes the l... | [
"This",
"method",
"takes",
"as",
"a",
"parameter",
"the",
"desired",
"text",
"to",
"be",
"translated",
"and",
"the",
"language",
"to",
"which",
"should",
"be",
"translated",
".",
"To",
"find",
"the",
"code",
"for",
"each",
"language",
"just",
"go",
"to",
... | 6bada6fe1ac4177cc7dc62ff16dab561ba714534 | https://github.com/wilfilho/BingTranslator/blob/6bada6fe1ac4177cc7dc62ff16dab561ba714534/BingTranslator/__init__.py#L127-L143 | train |
wilfilho/BingTranslator | BingTranslator/__init__.py | Translator.speak_phrase | def speak_phrase(self, text, language, format_audio=None, option=None):
"""
This method is very similar to the above, the difference between
them is that this method creates an object of class
TranslateSpeak(having therefore different attributes) and use
a... | python | def speak_phrase(self, text, language, format_audio=None, option=None):
"""
This method is very similar to the above, the difference between
them is that this method creates an object of class
TranslateSpeak(having therefore different attributes) and use
a... | [
"def",
"speak_phrase",
"(",
"self",
",",
"text",
",",
"language",
",",
"format_audio",
"=",
"None",
",",
"option",
"=",
"None",
")",
":",
"infos_speak_translate",
"=",
"SpeakModel",
"(",
"text",
",",
"language",
",",
"format_audio",
",",
"option",
")",
"."... | This method is very similar to the above, the difference between
them is that this method creates an object of class
TranslateSpeak(having therefore different attributes) and use
another url, as we see the presence of SpeakMode enumerator instead
of Translate.
... | [
"This",
"method",
"is",
"very",
"similar",
"to",
"the",
"above",
"the",
"difference",
"between",
"them",
"is",
"that",
"this",
"method",
"creates",
"an",
"object",
"of",
"class",
"TranslateSpeak",
"(",
"having",
"therefore",
"different",
"attributes",
")",
"an... | 6bada6fe1ac4177cc7dc62ff16dab561ba714534 | https://github.com/wilfilho/BingTranslator/blob/6bada6fe1ac4177cc7dc62ff16dab561ba714534/BingTranslator/__init__.py#L179-L201 | train |
HPENetworking/PYHPEIMC | pyhpeimc/plat/vrm.py | get_vm_host_info | def get_vm_host_info(hostip, auth, url):
"""
function takes hostId as input to RESTFUL call to HP IMC
:param hostip: int or string of hostip of Hypervisor host
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually aut... | python | def get_vm_host_info(hostip, auth, url):
"""
function takes hostId as input to RESTFUL call to HP IMC
:param hostip: int or string of hostip of Hypervisor host
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually aut... | [
"def",
"get_vm_host_info",
"(",
"hostip",
",",
"auth",
",",
"url",
")",
":",
"hostid",
"=",
"get_dev_details",
"(",
"hostip",
",",
"auth",
",",
"url",
")",
"[",
"'id'",
"]",
"f_url",
"=",
"url",
"+",
"\"/imcrs/vrm/host?hostId=\"",
"+",
"str",
"(",
"hosti... | function takes hostId as input to RESTFUL call to HP IMC
:param hostip: int or string of hostip of Hypervisor host
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:return: Dict... | [
"function",
"takes",
"hostId",
"as",
"input",
"to",
"RESTFUL",
"call",
"to",
"HP",
"IMC"
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/vrm.py#L21-L79 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpimc/plat/operator.py | get_plat_operator | def get_plat_operator(auth, url,headers=HEADERS):
'''
Funtion takes no inputs and returns a list of dictionaties of all of the operators currently configured on the HPE
IMC system
:return: list of dictionaries
'''
get_operator_url = '/imcrs/plat/operator?start=0&size=1000&orderBy=id&desc=false&t... | python | def get_plat_operator(auth, url,headers=HEADERS):
'''
Funtion takes no inputs and returns a list of dictionaties of all of the operators currently configured on the HPE
IMC system
:return: list of dictionaries
'''
get_operator_url = '/imcrs/plat/operator?start=0&size=1000&orderBy=id&desc=false&t... | [
"def",
"get_plat_operator",
"(",
"auth",
",",
"url",
",",
"headers",
"=",
"HEADERS",
")",
":",
"get_operator_url",
"=",
"'/imcrs/plat/operator?start=0&size=1000&orderBy=id&desc=false&total=false'",
"f_url",
"=",
"url",
"+",
"get_operator_url",
"try",
":",
"r",
"=",
"r... | Funtion takes no inputs and returns a list of dictionaties of all of the operators currently configured on the HPE
IMC system
:return: list of dictionaries | [
"Funtion",
"takes",
"no",
"inputs",
"and",
"returns",
"a",
"list",
"of",
"dictionaties",
"of",
"all",
"of",
"the",
"operators",
"currently",
"configured",
"on",
"the",
"HPE",
"IMC",
"system",
":",
"return",
":",
"list",
"of",
"dictionaries"
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpimc/plat/operator.py#L115-L129 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpimc/plat/operator.py | delete_plat_operator | def delete_plat_operator(operator,auth, url, headers=HEADERS):
"""
Function to set the password of an existing operator
:param operator: str Name of the operator account
:param password: str New password
:param url: str url of IMC server, see requests library docs for more info
:param auth: str ... | python | def delete_plat_operator(operator,auth, url, headers=HEADERS):
"""
Function to set the password of an existing operator
:param operator: str Name of the operator account
:param password: str New password
:param url: str url of IMC server, see requests library docs for more info
:param auth: str ... | [
"def",
"delete_plat_operator",
"(",
"operator",
",",
"auth",
",",
"url",
",",
"headers",
"=",
"HEADERS",
")",
":",
"#oper_id = None",
"plat_oper_list",
"=",
"get_plat_operator",
"(",
"auth",
",",
"url",
")",
"for",
"i",
"in",
"plat_oper_list",
":",
"if",
"op... | Function to set the password of an existing operator
:param operator: str Name of the operator account
:param password: str New password
:param url: str url of IMC server, see requests library docs for more info
:param auth: str see requests library docs for more info
:param headers: json formated s... | [
"Function",
"to",
"set",
"the",
"password",
"of",
"an",
"existing",
"operator",
":",
"param",
"operator",
":",
"str",
"Name",
"of",
"the",
"operator",
"account",
":",
"param",
"password",
":",
"str",
"New",
"password",
":",
"param",
"url",
":",
"str",
"u... | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpimc/plat/operator.py#L131-L158 | train |
Tygs/ww | src/ww/wrappers/tuples.py | TupleWrapper.index | def index(self, value):
"""
Args:
value: index
Returns: index of the values
Raises:
ValueError: value is not in list
"""
for i, x in enumerate(self):
if x == value:
return i
raise ValueError("{} is not in lis... | python | def index(self, value):
"""
Args:
value: index
Returns: index of the values
Raises:
ValueError: value is not in list
"""
for i, x in enumerate(self):
if x == value:
return i
raise ValueError("{} is not in lis... | [
"def",
"index",
"(",
"self",
",",
"value",
")",
":",
"for",
"i",
",",
"x",
"in",
"enumerate",
"(",
"self",
")",
":",
"if",
"x",
"==",
"value",
":",
"return",
"i",
"raise",
"ValueError",
"(",
"\"{} is not in list\"",
".",
"format",
"(",
"value",
")",
... | Args:
value: index
Returns: index of the values
Raises:
ValueError: value is not in list | [
"Args",
":",
"value",
":",
"index"
] | 6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4 | https://github.com/Tygs/ww/blob/6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4/src/ww/wrappers/tuples.py#L33-L48 | train |
Tygs/ww | src/ww/wrappers/tuples.py | TupleWrapper.to_d | def to_d(self):
"""
Args: self
Returns: a d that stems from self
Raises:
ValueError: dictionary update sequence element #index has length
len(tuple); 2 is required
TypeError: cannot convert dictionary update sequence element
#index to a ... | python | def to_d(self):
"""
Args: self
Returns: a d that stems from self
Raises:
ValueError: dictionary update sequence element #index has length
len(tuple); 2 is required
TypeError: cannot convert dictionary update sequence element
#index to a ... | [
"def",
"to_d",
"(",
"self",
")",
":",
"try",
":",
"return",
"ww",
".",
"d",
"(",
"self",
")",
"except",
"(",
"TypeError",
",",
"ValueError",
")",
":",
"for",
"i",
",",
"element",
"in",
"enumerate",
"(",
"self",
")",
":",
"try",
":",
"iter",
"(",
... | Args: self
Returns: a d that stems from self
Raises:
ValueError: dictionary update sequence element #index has length
len(tuple); 2 is required
TypeError: cannot convert dictionary update sequence element
#index to a sequence | [
"Args",
":",
"self"
] | 6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4 | https://github.com/Tygs/ww/blob/6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4/src/ww/wrappers/tuples.py#L59-L101 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpeimc/plat/icc.py | get_cfg_template | def get_cfg_template(auth, url, folder = None):
'''
Function takes no input and returns a list of dictionaries containing the configuration templates in the root folder
of the icc configuration template library.
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:p... | python | def get_cfg_template(auth, url, folder = None):
'''
Function takes no input and returns a list of dictionaries containing the configuration templates in the root folder
of the icc configuration template library.
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:p... | [
"def",
"get_cfg_template",
"(",
"auth",
",",
"url",
",",
"folder",
"=",
"None",
")",
":",
"if",
"folder",
"==",
"None",
":",
"get_cfg_template_url",
"=",
"\"/imcrs/icc/confFile/list\"",
"else",
":",
"folder_id",
"=",
"get_folder_id",
"(",
"folder",
",",
"auth"... | Function takes no input and returns a list of dictionaries containing the configuration templates in the root folder
of the icc configuration template library.
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url fro... | [
"Function",
"takes",
"no",
"input",
"and",
"returns",
"a",
"list",
"of",
"dictionaries",
"containing",
"the",
"configuration",
"templates",
"in",
"the",
"root",
"folder",
"of",
"the",
"icc",
"configuration",
"template",
"library",
"."
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/icc.py#L17-L67 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpeimc/plat/icc.py | create_cfg_segment | def create_cfg_segment(filename, filecontent, description, auth, url):
'''
Takes a str into var filecontent which represents the entire content of a configuration segment, or partial
configuration file. Takes a str into var description which represents the description of the configuration segment
:param... | python | def create_cfg_segment(filename, filecontent, description, auth, url):
'''
Takes a str into var filecontent which represents the entire content of a configuration segment, or partial
configuration file. Takes a str into var description which represents the description of the configuration segment
:param... | [
"def",
"create_cfg_segment",
"(",
"filename",
",",
"filecontent",
",",
"description",
",",
"auth",
",",
"url",
")",
":",
"payload",
"=",
"{",
"\"confFileName\"",
":",
"filename",
",",
"\"confFileType\"",
":",
"\"2\"",
",",
"\"cfgFileParent\"",
":",
"\"-1\"",
"... | Takes a str into var filecontent which represents the entire content of a configuration segment, or partial
configuration file. Takes a str into var description which represents the description of the configuration segment
:param filename: str containing the name of the configuration segment.
:param fileco... | [
"Takes",
"a",
"str",
"into",
"var",
"filecontent",
"which",
"represents",
"the",
"entire",
"content",
"of",
"a",
"configuration",
"segment",
"or",
"partial",
"configuration",
"file",
".",
"Takes",
"a",
"str",
"into",
"var",
"description",
"which",
"represents",
... | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/icc.py#L71-L117 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpeimc/plat/icc.py | get_template_id | def get_template_id(template_name, auth, url):
"""
Helper function takes str input of folder name and returns str numerical id of the folder.
:param folder_name: str name of the folder
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC R... | python | def get_template_id(template_name, auth, url):
"""
Helper function takes str input of folder name and returns str numerical id of the folder.
:param folder_name: str name of the folder
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC R... | [
"def",
"get_template_id",
"(",
"template_name",
",",
"auth",
",",
"url",
")",
":",
"object_list",
"=",
"get_cfg_template",
"(",
"auth",
"=",
"auth",
",",
"url",
"=",
"url",
")",
"for",
"object",
"in",
"object_list",
":",
"if",
"object",
"[",
"'confFileName... | Helper function takes str input of folder name and returns str numerical id of the folder.
:param folder_name: str name of the folder
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
... | [
"Helper",
"function",
"takes",
"str",
"input",
"of",
"folder",
"name",
"and",
"returns",
"str",
"numerical",
"id",
"of",
"the",
"folder",
".",
":",
"param",
"folder_name",
":",
"str",
"name",
"of",
"the",
"folder"
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/icc.py#L120-L148 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpeimc/plat/icc.py | delete_cfg_template | def delete_cfg_template(template_name, auth, url):
'''Uses the get_template_id() funct to gather the template_id to craft a url which is sent to the IMC server using
a Delete Method
:param template_name: str containing the entire contents of the configuration segment
:param auth: requests auth object #... | python | def delete_cfg_template(template_name, auth, url):
'''Uses the get_template_id() funct to gather the template_id to craft a url which is sent to the IMC server using
a Delete Method
:param template_name: str containing the entire contents of the configuration segment
:param auth: requests auth object #... | [
"def",
"delete_cfg_template",
"(",
"template_name",
",",
"auth",
",",
"url",
")",
":",
"file_id",
"=",
"get_template_id",
"(",
"template_name",
",",
"auth",
",",
"url",
")",
"delete_cfg_template_url",
"=",
"\"/imcrs/icc/confFile/\"",
"+",
"str",
"(",
"file_id",
... | Uses the get_template_id() funct to gather the template_id to craft a url which is sent to the IMC server using
a Delete Method
:param template_name: str containing the entire contents of the configuration segment
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:par... | [
"Uses",
"the",
"get_template_id",
"()",
"funct",
"to",
"gather",
"the",
"template_id",
"to",
"craft",
"a",
"url",
"which",
"is",
"sent",
"to",
"the",
"IMC",
"server",
"using",
"a",
"Delete",
"Method",
":",
"param",
"template_name",
":",
"str",
"containing",
... | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/icc.py#L151-L187 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpeimc/plat/icc.py | get_folder_id | def get_folder_id(folder_name, auth, url):
"""
Helper function takes str input of folder name and returns str numerical id of the folder.
:param folder_name: str name of the folder
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS in... | python | def get_folder_id(folder_name, auth, url):
"""
Helper function takes str input of folder name and returns str numerical id of the folder.
:param folder_name: str name of the folder
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS in... | [
"def",
"get_folder_id",
"(",
"folder_name",
",",
"auth",
",",
"url",
")",
":",
"object_list",
"=",
"get_cfg_template",
"(",
"auth",
"=",
"auth",
",",
"url",
"=",
"url",
")",
"for",
"object",
"in",
"object_list",
":",
"if",
"object",
"[",
"'confFileName'",
... | Helper function takes str input of folder name and returns str numerical id of the folder.
:param folder_name: str name of the folder
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
... | [
"Helper",
"function",
"takes",
"str",
"input",
"of",
"folder",
"name",
"and",
"returns",
"str",
"numerical",
"id",
"of",
"the",
"folder",
".",
":",
"param",
"folder_name",
":",
"str",
"name",
"of",
"the",
"folder"
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/icc.py#L189-L217 | train |
lablup/backend.ai-client-py | src/ai/backend/client/cli/pretty.py | bold | def bold(text: str) -> str:
'''
Wraps the given text with bold enable/disable ANSI sequences.
'''
return (style(text, bold=True, reset=False) +
style('', bold=False, reset=False)) | python | def bold(text: str) -> str:
'''
Wraps the given text with bold enable/disable ANSI sequences.
'''
return (style(text, bold=True, reset=False) +
style('', bold=False, reset=False)) | [
"def",
"bold",
"(",
"text",
":",
"str",
")",
"->",
"str",
":",
"return",
"(",
"style",
"(",
"text",
",",
"bold",
"=",
"True",
",",
"reset",
"=",
"False",
")",
"+",
"style",
"(",
"''",
",",
"bold",
"=",
"False",
",",
"reset",
"=",
"False",
")",
... | Wraps the given text with bold enable/disable ANSI sequences. | [
"Wraps",
"the",
"given",
"text",
"with",
"bold",
"enable",
"/",
"disable",
"ANSI",
"sequences",
"."
] | a063d774fea6f4350b89498c40d3c837ec3029a7 | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/pretty.py#L28-L33 | train |
lablup/backend.ai-client-py | src/ai/backend/client/manager.py | Manager.status | async def status(cls):
'''
Returns the current status of the configured API server.
'''
rqst = Request(cls.session, 'GET', '/manager/status')
rqst.set_json({
'status': 'running',
})
async with rqst.fetch() as resp:
return await resp.json() | python | async def status(cls):
'''
Returns the current status of the configured API server.
'''
rqst = Request(cls.session, 'GET', '/manager/status')
rqst.set_json({
'status': 'running',
})
async with rqst.fetch() as resp:
return await resp.json() | [
"async",
"def",
"status",
"(",
"cls",
")",
":",
"rqst",
"=",
"Request",
"(",
"cls",
".",
"session",
",",
"'GET'",
",",
"'/manager/status'",
")",
"rqst",
".",
"set_json",
"(",
"{",
"'status'",
":",
"'running'",
",",
"}",
")",
"async",
"with",
"rqst",
... | Returns the current status of the configured API server. | [
"Returns",
"the",
"current",
"status",
"of",
"the",
"configured",
"API",
"server",
"."
] | a063d774fea6f4350b89498c40d3c837ec3029a7 | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/manager.py#L18-L27 | train |
lablup/backend.ai-client-py | src/ai/backend/client/manager.py | Manager.freeze | async def freeze(cls, force_kill: bool = False):
'''
Freezes the configured API server.
Any API clients will no longer be able to create new compute sessions nor
create and modify vfolders/keypairs/etc.
This is used to enter the maintenance mode of the server for unobtrusive
... | python | async def freeze(cls, force_kill: bool = False):
'''
Freezes the configured API server.
Any API clients will no longer be able to create new compute sessions nor
create and modify vfolders/keypairs/etc.
This is used to enter the maintenance mode of the server for unobtrusive
... | [
"async",
"def",
"freeze",
"(",
"cls",
",",
"force_kill",
":",
"bool",
"=",
"False",
")",
":",
"rqst",
"=",
"Request",
"(",
"cls",
".",
"session",
",",
"'PUT'",
",",
"'/manager/status'",
")",
"rqst",
".",
"set_json",
"(",
"{",
"'status'",
":",
"'frozen'... | Freezes the configured API server.
Any API clients will no longer be able to create new compute sessions nor
create and modify vfolders/keypairs/etc.
This is used to enter the maintenance mode of the server for unobtrusive
manager and/or agent upgrades.
:param force_kill: If set... | [
"Freezes",
"the",
"configured",
"API",
"server",
".",
"Any",
"API",
"clients",
"will",
"no",
"longer",
"be",
"able",
"to",
"create",
"new",
"compute",
"sessions",
"nor",
"create",
"and",
"modify",
"vfolders",
"/",
"keypairs",
"/",
"etc",
".",
"This",
"is",... | a063d774fea6f4350b89498c40d3c837ec3029a7 | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/manager.py#L31-L50 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpimc/plat/alarms.py | get_dev_alarms | def get_dev_alarms(devId, auth=auth.creds, url=auth.url):
"""
function takes the devId of a specific device and issues a RESTFUL call to get the current alarms for the target
device.
:param devId: int or str value of the target device
:return:list of dictionaries containing the alarms for this devic... | python | def get_dev_alarms(devId, auth=auth.creds, url=auth.url):
"""
function takes the devId of a specific device and issues a RESTFUL call to get the current alarms for the target
device.
:param devId: int or str value of the target device
:return:list of dictionaries containing the alarms for this devic... | [
"def",
"get_dev_alarms",
"(",
"devId",
",",
"auth",
"=",
"auth",
".",
"creds",
",",
"url",
"=",
"auth",
".",
"url",
")",
":",
"# checks to see if the imc credentials are already available",
"get_dev_alarm_url",
"=",
"\"/imcrs/fault/alarm?operatorName=admin&deviceId=\"",
"... | function takes the devId of a specific device and issues a RESTFUL call to get the current alarms for the target
device.
:param devId: int or str value of the target device
:return:list of dictionaries containing the alarms for this device | [
"function",
"takes",
"the",
"devId",
"of",
"a",
"specific",
"device",
"and",
"issues",
"a",
"RESTFUL",
"call",
"to",
"get",
"the",
"current",
"alarms",
"for",
"the",
"target",
"device",
".",
":",
"param",
"devId",
":",
"int",
"or",
"str",
"value",
"of",
... | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpimc/plat/alarms.py#L43-L64 | train |
lablup/backend.ai-client-py | src/ai/backend/client/cli/files.py | upload | def upload(sess_id_or_alias, files):
"""
Upload files to user's home folder.
\b
SESSID: Session ID or its alias given when creating the session.
FILES: Path to upload.
"""
if len(files) < 1:
return
with Session() as session:
try:
print_wait('Uploading files..... | python | def upload(sess_id_or_alias, files):
"""
Upload files to user's home folder.
\b
SESSID: Session ID or its alias given when creating the session.
FILES: Path to upload.
"""
if len(files) < 1:
return
with Session() as session:
try:
print_wait('Uploading files..... | [
"def",
"upload",
"(",
"sess_id_or_alias",
",",
"files",
")",
":",
"if",
"len",
"(",
"files",
")",
"<",
"1",
":",
"return",
"with",
"Session",
"(",
")",
"as",
"session",
":",
"try",
":",
"print_wait",
"(",
"'Uploading files...'",
")",
"kernel",
"=",
"se... | Upload files to user's home folder.
\b
SESSID: Session ID or its alias given when creating the session.
FILES: Path to upload. | [
"Upload",
"files",
"to",
"user",
"s",
"home",
"folder",
"."
] | a063d774fea6f4350b89498c40d3c837ec3029a7 | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/files.py#L17-L35 | train |
lablup/backend.ai-client-py | src/ai/backend/client/cli/files.py | download | def download(sess_id_or_alias, files, dest):
"""
Download files from a running container.
\b
SESSID: Session ID or its alias given when creating the session.
FILES: Paths inside container.
"""
if len(files) < 1:
return
with Session() as session:
try:
print_wa... | python | def download(sess_id_or_alias, files, dest):
"""
Download files from a running container.
\b
SESSID: Session ID or its alias given when creating the session.
FILES: Paths inside container.
"""
if len(files) < 1:
return
with Session() as session:
try:
print_wa... | [
"def",
"download",
"(",
"sess_id_or_alias",
",",
"files",
",",
"dest",
")",
":",
"if",
"len",
"(",
"files",
")",
"<",
"1",
":",
"return",
"with",
"Session",
"(",
")",
"as",
"session",
":",
"try",
":",
"print_wait",
"(",
"'Downloading file(s) from {}...'",
... | Download files from a running container.
\b
SESSID: Session ID or its alias given when creating the session.
FILES: Paths inside container. | [
"Download",
"files",
"from",
"a",
"running",
"container",
"."
] | a063d774fea6f4350b89498c40d3c837ec3029a7 | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/files.py#L43-L62 | train |
lablup/backend.ai-client-py | src/ai/backend/client/cli/files.py | ls | def ls(sess_id_or_alias, path):
"""
List files in a path of a running container.
\b
SESSID: Session ID or its alias given when creating the session.
PATH: Path inside container.
"""
with Session() as session:
try:
print_wait('Retrieving list of files in "{}"...'.format(p... | python | def ls(sess_id_or_alias, path):
"""
List files in a path of a running container.
\b
SESSID: Session ID or its alias given when creating the session.
PATH: Path inside container.
"""
with Session() as session:
try:
print_wait('Retrieving list of files in "{}"...'.format(p... | [
"def",
"ls",
"(",
"sess_id_or_alias",
",",
"path",
")",
":",
"with",
"Session",
"(",
")",
"as",
"session",
":",
"try",
":",
"print_wait",
"(",
"'Retrieving list of files in \"{}\"...'",
".",
"format",
"(",
"path",
")",
")",
"kernel",
"=",
"session",
".",
"... | List files in a path of a running container.
\b
SESSID: Session ID or its alias given when creating the session.
PATH: Path inside container. | [
"List",
"files",
"in",
"a",
"path",
"of",
"a",
"running",
"container",
"."
] | a063d774fea6f4350b89498c40d3c837ec3029a7 | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/files.py#L68-L99 | train |
AoiKuiyuyou/AoikLiveReload | src/aoiklivereload/demo/sanic_demo.py | main | def main():
"""
Main function.
:return:
None.
"""
try:
# Get the `src` directory's absolute path
src_path = os.path.dirname(
# `aoiklivereload` directory's absolute path
os.path.dirname(
# `demo` directory's absolute path
... | python | def main():
"""
Main function.
:return:
None.
"""
try:
# Get the `src` directory's absolute path
src_path = os.path.dirname(
# `aoiklivereload` directory's absolute path
os.path.dirname(
# `demo` directory's absolute path
... | [
"def",
"main",
"(",
")",
":",
"try",
":",
"# Get the `src` directory's absolute path",
"src_path",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"# `aoiklivereload` directory's absolute path",
"os",
".",
"path",
".",
"dirname",
"(",
"# `demo` directory's absolute path",
... | Main function.
:return:
None. | [
"Main",
"function",
"."
] | 0d5adb12118a33749e6690a8165fdb769cff7d5c | https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/src/aoiklivereload/demo/sanic_demo.py#L16-L94 | train |
HPENetworking/PYHPEIMC | pyhpeimc/plat/icc.py | get_cfg_template | def get_cfg_template(auth, url, folder=None):
"""
Function takes no input and returns a list of dictionaries containing the configuration
templates in the root folder of the icc configuration template library.
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:par... | python | def get_cfg_template(auth, url, folder=None):
"""
Function takes no input and returns a list of dictionaries containing the configuration
templates in the root folder of the icc configuration template library.
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:par... | [
"def",
"get_cfg_template",
"(",
"auth",
",",
"url",
",",
"folder",
"=",
"None",
")",
":",
"if",
"folder",
"is",
"None",
":",
"get_cfg_template_url",
"=",
"\"/imcrs/icc/confFile/list\"",
"else",
":",
"folder_id",
"=",
"get_folder_id",
"(",
"folder",
",",
"auth"... | Function takes no input and returns a list of dictionaries containing the configuration
templates in the root folder of the icc configuration template library.
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url fro... | [
"Function",
"takes",
"no",
"input",
"and",
"returns",
"a",
"list",
"of",
"dictionaries",
"containing",
"the",
"configuration",
"templates",
"in",
"the",
"root",
"folder",
"of",
"the",
"icc",
"configuration",
"template",
"library",
"."
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/icc.py#L19-L74 | train |
HPENetworking/PYHPEIMC | pyhpeimc/plat/icc.py | create_cfg_segment | def create_cfg_segment(filename, filecontent, description, auth, url):
"""
Takes a str into var filecontent which represents the entire content of a configuration
segment, or partial configuration file. Takes a str into var description which represents the
description of the configuration segment
:p... | python | def create_cfg_segment(filename, filecontent, description, auth, url):
"""
Takes a str into var filecontent which represents the entire content of a configuration
segment, or partial configuration file. Takes a str into var description which represents the
description of the configuration segment
:p... | [
"def",
"create_cfg_segment",
"(",
"filename",
",",
"filecontent",
",",
"description",
",",
"auth",
",",
"url",
")",
":",
"payload",
"=",
"{",
"\"confFileName\"",
":",
"filename",
",",
"\"confFileType\"",
":",
"\"2\"",
",",
"\"cfgFileParent\"",
":",
"\"-1\"",
"... | Takes a str into var filecontent which represents the entire content of a configuration
segment, or partial configuration file. Takes a str into var description which represents the
description of the configuration segment
:param filename: str containing the name of the configuration segment.
:param fi... | [
"Takes",
"a",
"str",
"into",
"var",
"filecontent",
"which",
"represents",
"the",
"entire",
"content",
"of",
"a",
"configuration",
"segment",
"or",
"partial",
"configuration",
"file",
".",
"Takes",
"a",
"str",
"into",
"var",
"description",
"which",
"represents",
... | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/icc.py#L77-L130 | train |
HPENetworking/PYHPEIMC | pyhpeimc/plat/icc.py | get_template_id | def get_template_id(template_name, auth, url):
"""
Helper function takes str input of folder name and returns str numerical id of the folder.
:param template_name: str name of the target template
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base u... | python | def get_template_id(template_name, auth, url):
"""
Helper function takes str input of folder name and returns str numerical id of the folder.
:param template_name: str name of the target template
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base u... | [
"def",
"get_template_id",
"(",
"template_name",
",",
"auth",
",",
"url",
")",
":",
"object_list",
"=",
"get_cfg_template",
"(",
"auth",
"=",
"auth",
",",
"url",
"=",
"url",
")",
"for",
"template",
"in",
"object_list",
":",
"if",
"template",
"[",
"'confFile... | Helper function takes str input of folder name and returns str numerical id of the folder.
:param template_name: str name of the target template
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth... | [
"Helper",
"function",
"takes",
"str",
"input",
"of",
"folder",
"name",
"and",
"returns",
"str",
"numerical",
"id",
"of",
"the",
"folder",
".",
":",
"param",
"template_name",
":",
"str",
"name",
"of",
"the",
"target",
"template"
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/icc.py#L133-L161 | train |
HPENetworking/PYHPEIMC | pyhpeimc/plat/icc.py | get_folder_id | def get_folder_id(folder_name, auth, url):
"""
Helper function takes str input of folder name and returns str numerical id of the folder.
:param folder_name: str name of the folder
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS in... | python | def get_folder_id(folder_name, auth, url):
"""
Helper function takes str input of folder name and returns str numerical id of the folder.
:param folder_name: str name of the folder
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS in... | [
"def",
"get_folder_id",
"(",
"folder_name",
",",
"auth",
",",
"url",
")",
":",
"object_list",
"=",
"get_cfg_template",
"(",
"auth",
"=",
"auth",
",",
"url",
"=",
"url",
")",
"for",
"template",
"in",
"object_list",
":",
"if",
"template",
"[",
"'confFileName... | Helper function takes str input of folder name and returns str numerical id of the folder.
:param folder_name: str name of the folder
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
... | [
"Helper",
"function",
"takes",
"str",
"input",
"of",
"folder",
"name",
"and",
"returns",
"str",
"numerical",
"id",
"of",
"the",
"folder",
".",
":",
"param",
"folder_name",
":",
"str",
"name",
"of",
"the",
"folder"
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/icc.py#L164-L192 | train |
HPENetworking/PYHPEIMC | pyhpeimc/plat/icc.py | delete_cfg_template | def delete_cfg_template(template_name, auth, url):
"""Uses the get_template_id() funct to gather the template_id
to craft a url which is sent to the IMC server using a Delete Method
:param template_name: str containing the entire contents of the configuration segment
:param auth: requests auth object #... | python | def delete_cfg_template(template_name, auth, url):
"""Uses the get_template_id() funct to gather the template_id
to craft a url which is sent to the IMC server using a Delete Method
:param template_name: str containing the entire contents of the configuration segment
:param auth: requests auth object #... | [
"def",
"delete_cfg_template",
"(",
"template_name",
",",
"auth",
",",
"url",
")",
":",
"file_id",
"=",
"get_template_id",
"(",
"template_name",
",",
"auth",
",",
"url",
")",
"f_url",
"=",
"url",
"+",
"\"/imcrs/icc/confFile/\"",
"+",
"str",
"(",
"file_id",
")... | Uses the get_template_id() funct to gather the template_id
to craft a url which is sent to the IMC server using a Delete Method
:param template_name: str containing the entire contents of the configuration segment
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:par... | [
"Uses",
"the",
"get_template_id",
"()",
"funct",
"to",
"gather",
"the",
"template_id",
"to",
"craft",
"a",
"url",
"which",
"is",
"sent",
"to",
"the",
"IMC",
"server",
"using",
"a",
"Delete",
"Method",
":",
"param",
"template_name",
":",
"str",
"containing",
... | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/icc.py#L195-L226 | train |
HPENetworking/PYHPEIMC | pyhpeimc/plat/icc.py | get_template_details | def get_template_details(template_name, auth, url):
"""Uses the get_template_id() funct to gather the template_id to craft a
get_template_details_url which is sent to the IMC server using
a get Method
:param template_name: str containing the entire contents of the configuration segment
:param auth:... | python | def get_template_details(template_name, auth, url):
"""Uses the get_template_id() funct to gather the template_id to craft a
get_template_details_url which is sent to the IMC server using
a get Method
:param template_name: str containing the entire contents of the configuration segment
:param auth:... | [
"def",
"get_template_details",
"(",
"template_name",
",",
"auth",
",",
"url",
")",
":",
"file_id",
"=",
"get_template_id",
"(",
"template_name",
",",
"auth",
",",
"url",
")",
"if",
"isinstance",
"(",
"file_id",
",",
"str",
")",
":",
"return",
"file_id",
"f... | Uses the get_template_id() funct to gather the template_id to craft a
get_template_details_url which is sent to the IMC server using
a get Method
:param template_name: str containing the entire contents of the configuration segment
:param auth: requests auth object #usually auth.creds from auth pyhpeim... | [
"Uses",
"the",
"get_template_id",
"()",
"funct",
"to",
"gather",
"the",
"template_id",
"to",
"craft",
"a",
"get_template_details_url",
"which",
"is",
"sent",
"to",
"the",
"IMC",
"server",
"using",
"a",
"get",
"Method",
":",
"param",
"template_name",
":",
"str"... | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/icc.py#L229-L272 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpimc/plat/vlanm.py | get_dev_vlans | def get_dev_vlans(devid, auth, url):
"""Function takes input of devID to issue RESTUL call to HP IMC
:param devid: requires devId as the only input parameter
:return: dictionary of existing vlans on the devices. Device must be supported in HP IMC platform VLAN manager module
"""
# checks to see if ... | python | def get_dev_vlans(devid, auth, url):
"""Function takes input of devID to issue RESTUL call to HP IMC
:param devid: requires devId as the only input parameter
:return: dictionary of existing vlans on the devices. Device must be supported in HP IMC platform VLAN manager module
"""
# checks to see if ... | [
"def",
"get_dev_vlans",
"(",
"devid",
",",
"auth",
",",
"url",
")",
":",
"# checks to see if the imc credentials are already available",
"get_dev_vlans_url",
"=",
"\"/imcrs/vlan?devId=\"",
"+",
"str",
"(",
"devid",
")",
"+",
"\"&start=0&size=5000&total=false\"",
"f_url",
... | Function takes input of devID to issue RESTUL call to HP IMC
:param devid: requires devId as the only input parameter
:return: dictionary of existing vlans on the devices. Device must be supported in HP IMC platform VLAN manager module | [
"Function",
"takes",
"input",
"of",
"devID",
"to",
"issue",
"RESTUL",
"call",
"to",
"HP",
"IMC",
":",
"param",
"devid",
":",
"requires",
"devId",
"as",
"the",
"only",
"input",
"parameter",
":",
"return",
":",
"dictionary",
"of",
"existing",
"vlans",
"on",
... | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpimc/plat/vlanm.py#L35-L55 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpimc/plat/vlanm.py | get_trunk_interfaces | def get_trunk_interfaces(devId, auth, url):
"""Function takes devId as input to RESTFULL call to HP IMC platform
:param devId: output of get_dev_details
:return: list of dictionaries containing of interfaces configured as an 802.1q trunk
Example:
auth = IMCAuth("http://", "10.101.0.203", "8080"... | python | def get_trunk_interfaces(devId, auth, url):
"""Function takes devId as input to RESTFULL call to HP IMC platform
:param devId: output of get_dev_details
:return: list of dictionaries containing of interfaces configured as an 802.1q trunk
Example:
auth = IMCAuth("http://", "10.101.0.203", "8080"... | [
"def",
"get_trunk_interfaces",
"(",
"devId",
",",
"auth",
",",
"url",
")",
":",
"# checks to see if the imc credentials are already available",
"get_trunk_interfaces_url",
"=",
"\"/imcrs/vlan/trunk?devId=\"",
"+",
"str",
"(",
"devId",
")",
"+",
"\"&start=1&size=5000&total=fal... | Function takes devId as input to RESTFULL call to HP IMC platform
:param devId: output of get_dev_details
:return: list of dictionaries containing of interfaces configured as an 802.1q trunk
Example:
auth = IMCAuth("http://", "10.101.0.203", "8080", "admin", "admin")
get_dev_asset_details("... | [
"Function",
"takes",
"devId",
"as",
"input",
"to",
"RESTFULL",
"call",
"to",
"HP",
"IMC",
"platform",
":",
"param",
"devId",
":",
"output",
"of",
"get_dev_details",
":",
"return",
":",
"list",
"of",
"dictionaries",
"containing",
"of",
"interfaces",
"configured... | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpimc/plat/vlanm.py#L57-L81 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpimc/plat/vlanm.py | get_device_access_interfaces | def get_device_access_interfaces(devId, auth, url):
"""Function takes devId as input to RESTFUL call to HP IMC platform
:param devId: requires deviceID as the only input parameter
:return: list of dictionaries containing interfaces configured as access ports
"""
# checks to see if the imc credential... | python | def get_device_access_interfaces(devId, auth, url):
"""Function takes devId as input to RESTFUL call to HP IMC platform
:param devId: requires deviceID as the only input parameter
:return: list of dictionaries containing interfaces configured as access ports
"""
# checks to see if the imc credential... | [
"def",
"get_device_access_interfaces",
"(",
"devId",
",",
"auth",
",",
"url",
")",
":",
"# checks to see if the imc credentials are already available",
"get_access_interface_vlan_url",
"=",
"\"/imcrs/vlan/access?devId=\"",
"+",
"str",
"(",
"devId",
")",
"+",
"\"&start=1&size=... | Function takes devId as input to RESTFUL call to HP IMC platform
:param devId: requires deviceID as the only input parameter
:return: list of dictionaries containing interfaces configured as access ports | [
"Function",
"takes",
"devId",
"as",
"input",
"to",
"RESTFUL",
"call",
"to",
"HP",
"IMC",
"platform",
":",
"param",
"devId",
":",
"requires",
"deviceID",
"as",
"the",
"only",
"input",
"parameter",
":",
"return",
":",
"list",
"of",
"dictionaries",
"containing"... | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpimc/plat/vlanm.py#L86-L107 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpimc/plat/vlanm.py | create_dev_vlan | def create_dev_vlan(devid, vlanid, vlan_name, auth, url):
"""
function takes devid and vlanid vlan_name of specific device and 802.1q VLAN tag and issues a RESTFUL call to add the
specified VLAN from the target device. VLAN Name MUST be valid on target device.
:param devid: int or str value of the targe... | python | def create_dev_vlan(devid, vlanid, vlan_name, auth, url):
"""
function takes devid and vlanid vlan_name of specific device and 802.1q VLAN tag and issues a RESTFUL call to add the
specified VLAN from the target device. VLAN Name MUST be valid on target device.
:param devid: int or str value of the targe... | [
"def",
"create_dev_vlan",
"(",
"devid",
",",
"vlanid",
",",
"vlan_name",
",",
"auth",
",",
"url",
")",
":",
"create_dev_vlan_url",
"=",
"\"/imcrs/vlan?devId=\"",
"+",
"str",
"(",
"devid",
")",
"f_url",
"=",
"url",
"+",
"create_dev_vlan_url",
"payload",
"=",
... | function takes devid and vlanid vlan_name of specific device and 802.1q VLAN tag and issues a RESTFUL call to add the
specified VLAN from the target device. VLAN Name MUST be valid on target device.
:param devid: int or str value of the target device
:param vlanid:int or str value of target 802.1q VLAN
... | [
"function",
"takes",
"devid",
"and",
"vlanid",
"vlan_name",
"of",
"specific",
"device",
"and",
"802",
".",
"1q",
"VLAN",
"tag",
"and",
"issues",
"a",
"RESTFUL",
"call",
"to",
"add",
"the",
"specified",
"VLAN",
"from",
"the",
"target",
"device",
".",
"VLAN"... | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpimc/plat/vlanm.py#L119-L142 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpimc/plat/vlanm.py | delete_dev_vlans | def delete_dev_vlans(devid, vlanid, auth, url):
"""
function takes devid and vlanid of specific device and 802.1q VLAN tag and issues a RESTFUL call to remove the
specified VLAN from the target device.
:param devid: int or str value of the target device
:param vlanid:
:return:HTTP Status code of... | python | def delete_dev_vlans(devid, vlanid, auth, url):
"""
function takes devid and vlanid of specific device and 802.1q VLAN tag and issues a RESTFUL call to remove the
specified VLAN from the target device.
:param devid: int or str value of the target device
:param vlanid:
:return:HTTP Status code of... | [
"def",
"delete_dev_vlans",
"(",
"devid",
",",
"vlanid",
",",
"auth",
",",
"url",
")",
":",
"remove_dev_vlan_url",
"=",
"\"/imcrs/vlan/delvlan?devId=\"",
"+",
"str",
"(",
"devid",
")",
"+",
"\"&vlanId=\"",
"+",
"str",
"(",
"vlanid",
")",
"f_url",
"=",
"url",
... | function takes devid and vlanid of specific device and 802.1q VLAN tag and issues a RESTFUL call to remove the
specified VLAN from the target device.
:param devid: int or str value of the target device
:param vlanid:
:return:HTTP Status code of 204 with no values. | [
"function",
"takes",
"devid",
"and",
"vlanid",
"of",
"specific",
"device",
"and",
"802",
".",
"1q",
"VLAN",
"tag",
"and",
"issues",
"a",
"RESTFUL",
"call",
"to",
"remove",
"the",
"specified",
"VLAN",
"from",
"the",
"target",
"device",
".",
":",
"param",
... | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpimc/plat/vlanm.py#L145-L166 | train |
HPENetworking/PYHPEIMC | pyhpeimc/plat/operator.py | create_operator | def create_operator(operator, auth, url):
"""
Function takes input of dictionary operator with the following keys
operator = { "fullName" : "" ,
"sessionTimeout" : "",
"password" : "",
"operatorGroupId" : "",
"name" : "",
"desc" : "",
... | python | def create_operator(operator, auth, url):
"""
Function takes input of dictionary operator with the following keys
operator = { "fullName" : "" ,
"sessionTimeout" : "",
"password" : "",
"operatorGroupId" : "",
"name" : "",
"desc" : "",
... | [
"def",
"create_operator",
"(",
"operator",
",",
"auth",
",",
"url",
")",
":",
"f_url",
"=",
"url",
"+",
"'/imcrs/plat/operator'",
"payload",
"=",
"json",
".",
"dumps",
"(",
"operator",
",",
"indent",
"=",
"4",
")",
"response",
"=",
"requests",
".",
"post... | Function takes input of dictionary operator with the following keys
operator = { "fullName" : "" ,
"sessionTimeout" : "",
"password" : "",
"operatorGroupId" : "",
"name" : "",
"desc" : "",
"defaultAcl" : "",
"authType" : ... | [
"Function",
"takes",
"input",
"of",
"dictionary",
"operator",
"with",
"the",
"following",
"keys",
"operator",
"=",
"{",
"fullName",
":",
"sessionTimeout",
":",
"password",
":",
"operatorGroupId",
":",
"name",
":",
"desc",
":",
"defaultAcl",
":",
"authType",
":... | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/operator.py#L22-L84 | train |
HPENetworking/PYHPEIMC | pyhpeimc/plat/operator.py | set_operator_password | def set_operator_password(operator, password, auth, url):
"""
Function to set the password of an existing operator
:param operator: str Name of the operator account
:param password: str New password
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param ur... | python | def set_operator_password(operator, password, auth, url):
"""
Function to set the password of an existing operator
:param operator: str Name of the operator account
:param password: str New password
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param ur... | [
"def",
"set_operator_password",
"(",
"operator",
",",
"password",
",",
"auth",
",",
"url",
")",
":",
"if",
"operator",
"is",
"None",
":",
"operator",
"=",
"input",
"(",
"'''\\n What is the username you wish to change the password?'''",
")",
"oper_id",
"=",
"''",
"... | Function to set the password of an existing operator
:param operator: str Name of the operator account
:param password: str New password
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.a... | [
"Function",
"to",
"set",
"the",
"password",
"of",
"an",
"existing",
"operator"
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/operator.py#L87-L148 | train |
HPENetworking/PYHPEIMC | pyhpeimc/plat/operator.py | get_plat_operator | def get_plat_operator(auth, url):
"""
Funtion takes no inputs and returns a list of dictionaties of all of the operators currently
configured on the HPE IMC system
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually ... | python | def get_plat_operator(auth, url):
"""
Funtion takes no inputs and returns a list of dictionaties of all of the operators currently
configured on the HPE IMC system
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually ... | [
"def",
"get_plat_operator",
"(",
"auth",
",",
"url",
")",
":",
"f_url",
"=",
"url",
"+",
"'/imcrs/plat/operator?start=0&size=1000&orderBy=id&desc=false&total=false'",
"try",
":",
"response",
"=",
"requests",
".",
"get",
"(",
"f_url",
",",
"auth",
"=",
"auth",
",",... | Funtion takes no inputs and returns a list of dictionaties of all of the operators currently
configured on the HPE IMC system
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:re... | [
"Funtion",
"takes",
"no",
"inputs",
"and",
"returns",
"a",
"list",
"of",
"dictionaties",
"of",
"all",
"of",
"the",
"operators",
"currently",
"configured",
"on",
"the",
"HPE",
"IMC",
"system"
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/operator.py#L151-L187 | train |
HPENetworking/PYHPEIMC | pyhpeimc/plat/operator.py | delete_plat_operator | def delete_plat_operator(operator, auth, url):
"""
Function to set the password of an existing operator
:param operator: str Name of the operator account
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url f... | python | def delete_plat_operator(operator, auth, url):
"""
Function to set the password of an existing operator
:param operator: str Name of the operator account
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url f... | [
"def",
"delete_plat_operator",
"(",
"operator",
",",
"auth",
",",
"url",
")",
":",
"oper_id",
"=",
"None",
"plat_oper_list",
"=",
"get_plat_operator",
"(",
"auth",
",",
"url",
")",
"for",
"i",
"in",
"plat_oper_list",
":",
"if",
"operator",
"==",
"i",
"[",
... | Function to set the password of an existing operator
:param operator: str Name of the operator account
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:return: int of 204 if suc... | [
"Function",
"to",
"set",
"the",
"password",
"of",
"an",
"existing",
"operator",
":",
"param",
"operator",
":",
"str",
"Name",
"of",
"the",
"operator",
"account"
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/operator.py#L190-L240 | train |
housecanary/hc-api-python | housecanary/requestclient.py | RequestClient.execute_request | def execute_request(self, url, http_method, query_params, post_data):
"""Makes a request to the specified url endpoint with the
specified http method, params and post data.
Args:
url (string): The url to the API without query params.
Example: "https://api.h... | python | def execute_request(self, url, http_method, query_params, post_data):
"""Makes a request to the specified url endpoint with the
specified http method, params and post data.
Args:
url (string): The url to the API without query params.
Example: "https://api.h... | [
"def",
"execute_request",
"(",
"self",
",",
"url",
",",
"http_method",
",",
"query_params",
",",
"post_data",
")",
":",
"response",
"=",
"requests",
".",
"request",
"(",
"http_method",
",",
"url",
",",
"params",
"=",
"query_params",
",",
"auth",
"=",
"self... | Makes a request to the specified url endpoint with the
specified http method, params and post data.
Args:
url (string): The url to the API without query params.
Example: "https://api.housecanary.com/v2/property/value"
http_method (string): The http meth... | [
"Makes",
"a",
"request",
"to",
"the",
"specified",
"url",
"endpoint",
"with",
"the",
"specified",
"http",
"method",
"params",
"and",
"post",
"data",
"."
] | 2bb9e2208b34e8617575de45934357ee33b8531c | https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/requestclient.py#L32-L59 | train |
housecanary/hc-api-python | housecanary/requestclient.py | RequestClient.post | def post(self, url, post_data, query_params=None):
"""Makes a POST request to the specified url endpoint.
Args:
url (string): The url to the API without query params.
Example: "https://api.housecanary.com/v2/property/value"
post_data: Json post data to ... | python | def post(self, url, post_data, query_params=None):
"""Makes a POST request to the specified url endpoint.
Args:
url (string): The url to the API without query params.
Example: "https://api.housecanary.com/v2/property/value"
post_data: Json post data to ... | [
"def",
"post",
"(",
"self",
",",
"url",
",",
"post_data",
",",
"query_params",
"=",
"None",
")",
":",
"if",
"query_params",
"is",
"None",
":",
"query_params",
"=",
"{",
"}",
"return",
"self",
".",
"execute_request",
"(",
"url",
",",
"\"POST\"",
",",
"q... | Makes a POST request to the specified url endpoint.
Args:
url (string): The url to the API without query params.
Example: "https://api.housecanary.com/v2/property/value"
post_data: Json post data to send in the body of the request.
query_params (dic... | [
"Makes",
"a",
"POST",
"request",
"to",
"the",
"specified",
"url",
"endpoint",
"."
] | 2bb9e2208b34e8617575de45934357ee33b8531c | https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/requestclient.py#L76-L93 | train |
HPENetworking/PYHPEIMC | examples/HPE IMC Custom Views.py | import_custom_views | def import_custom_views(filename):
"""
Function which takes in a csv files as input to the create_custom_views function from the pyhpeimc python module
available at https://github.com/HPNetworking/HP-Intelligent-Management-Center
:param filename: user-defined filename which contains two column named "na... | python | def import_custom_views(filename):
"""
Function which takes in a csv files as input to the create_custom_views function from the pyhpeimc python module
available at https://github.com/HPNetworking/HP-Intelligent-Management-Center
:param filename: user-defined filename which contains two column named "na... | [
"def",
"import_custom_views",
"(",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
")",
"as",
"csvfile",
":",
"# decodes file as csv as a python dictionary",
"reader",
"=",
"csv",
".",
"DictReader",
"(",
"csvfile",
")",
"for",
"view",
"in",
"reader",
":",... | Function which takes in a csv files as input to the create_custom_views function from the pyhpeimc python module
available at https://github.com/HPNetworking/HP-Intelligent-Management-Center
:param filename: user-defined filename which contains two column named "name" and "upperview" as input into the
creat... | [
"Function",
"which",
"takes",
"in",
"a",
"csv",
"files",
"as",
"input",
"to",
"the",
"create_custom_views",
"function",
"from",
"the",
"pyhpeimc",
"python",
"module",
"available",
"at",
"https",
":",
"//",
"github",
".",
"com",
"/",
"HPNetworking",
"/",
"HP"... | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/examples/HPE IMC Custom Views.py#L8-L25 | train |
HPENetworking/PYHPEIMC | pyhpeimc/plat/termaccess.py | get_real_time_locate | def get_real_time_locate(host_ipaddress, auth, url):
"""
function takes the ipAddress of a specific host and issues a RESTFUL call to get the device and
interface that the target host is currently connected to. Note: Although intended to return a
single location, Multiple locations may be returned for a... | python | def get_real_time_locate(host_ipaddress, auth, url):
"""
function takes the ipAddress of a specific host and issues a RESTFUL call to get the device and
interface that the target host is currently connected to. Note: Although intended to return a
single location, Multiple locations may be returned for a... | [
"def",
"get_real_time_locate",
"(",
"host_ipaddress",
",",
"auth",
",",
"url",
")",
":",
"f_url",
"=",
"url",
"+",
"\"/imcrs/res/access/realtimeLocate?type=2&value=\"",
"+",
"str",
"(",
"host_ipaddress",
")",
"+",
"\"&total=false\"",
"response",
"=",
"requests",
"."... | function takes the ipAddress of a specific host and issues a RESTFUL call to get the device and
interface that the target host is currently connected to. Note: Although intended to return a
single location, Multiple locations may be returned for a single host due to a partially
discovered network or misconf... | [
"function",
"takes",
"the",
"ipAddress",
"of",
"a",
"specific",
"host",
"and",
"issues",
"a",
"RESTFUL",
"call",
"to",
"get",
"the",
"device",
"and",
"interface",
"that",
"the",
"target",
"host",
"is",
"currently",
"connected",
"to",
".",
"Note",
":",
"Alt... | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/termaccess.py#L23-L83 | train |
HPENetworking/PYHPEIMC | pyhpeimc/plat/termaccess.py | get_ip_mac_arp_list | def get_ip_mac_arp_list(auth, url, devid=None, devip=None):
"""
function takes devid of specific device and issues a RESTFUL call to get the IP/MAC/ARP list
from the target device.
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS in... | python | def get_ip_mac_arp_list(auth, url, devid=None, devip=None):
"""
function takes devid of specific device and issues a RESTFUL call to get the IP/MAC/ARP list
from the target device.
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS in... | [
"def",
"get_ip_mac_arp_list",
"(",
"auth",
",",
"url",
",",
"devid",
"=",
"None",
",",
"devip",
"=",
"None",
")",
":",
"if",
"devip",
"is",
"not",
"None",
":",
"dev_details",
"=",
"get_dev_details",
"(",
"devip",
",",
"auth",
",",
"url",
")",
"if",
"... | function takes devid of specific device and issues a RESTFUL call to get the IP/MAC/ARP list
from the target device.
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:param devid... | [
"function",
"takes",
"devid",
"of",
"specific",
"device",
"and",
"issues",
"a",
"RESTFUL",
"call",
"to",
"get",
"the",
"IP",
"/",
"MAC",
"/",
"ARP",
"list",
"from",
"the",
"target",
"device",
"."
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/termaccess.py#L86-L135 | train |
HPENetworking/PYHPEIMC | pyhpeimc/plat/termaccess.py | get_ip_scope | def get_ip_scope(auth, url, scopeid=None, ):
"""
function requires no inputs and returns all IP address scopes currently configured on the HPE
IMC server. If the optional scopeid parameter is included, this will automatically return
only the desired scope id.
:param scopeid: integer of the desired ... | python | def get_ip_scope(auth, url, scopeid=None, ):
"""
function requires no inputs and returns all IP address scopes currently configured on the HPE
IMC server. If the optional scopeid parameter is included, this will automatically return
only the desired scope id.
:param scopeid: integer of the desired ... | [
"def",
"get_ip_scope",
"(",
"auth",
",",
"url",
",",
"scopeid",
"=",
"None",
",",
")",
":",
"if",
"scopeid",
"is",
"None",
":",
"get_ip_scope_url",
"=",
"\"/imcrs/res/access/assignedIpScope\"",
"else",
":",
"get_ip_scope_url",
"=",
"\"/imcrs/res/access/assignedIpSco... | function requires no inputs and returns all IP address scopes currently configured on the HPE
IMC server. If the optional scopeid parameter is included, this will automatically return
only the desired scope id.
:param scopeid: integer of the desired scope id ( optional )
:param auth: requests auth obj... | [
"function",
"requires",
"no",
"inputs",
"and",
"returns",
"all",
"IP",
"address",
"scopes",
"currently",
"configured",
"on",
"the",
"HPE",
"IMC",
"server",
".",
"If",
"the",
"optional",
"scopeid",
"parameter",
"is",
"included",
"this",
"will",
"automatically",
... | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/termaccess.py#L143-L187 | train |
HPENetworking/PYHPEIMC | pyhpeimc/plat/termaccess.py | add_ip_scope | def add_ip_scope(name, description, auth, url, startip=None, endip=None, network_address=None):
"""
Function takes input of four strings Start Ip, endIp, name, and description to add new Ip Scope
to terminal access in the HPE IMC base platform
:param name: str Name of the owner of this IP scope ex. 'a... | python | def add_ip_scope(name, description, auth, url, startip=None, endip=None, network_address=None):
"""
Function takes input of four strings Start Ip, endIp, name, and description to add new Ip Scope
to terminal access in the HPE IMC base platform
:param name: str Name of the owner of this IP scope ex. 'a... | [
"def",
"add_ip_scope",
"(",
"name",
",",
"description",
",",
"auth",
",",
"url",
",",
"startip",
"=",
"None",
",",
"endip",
"=",
"None",
",",
"network_address",
"=",
"None",
")",
":",
"if",
"network_address",
"is",
"not",
"None",
":",
"nw_address",
"=",
... | Function takes input of four strings Start Ip, endIp, name, and description to add new Ip Scope
to terminal access in the HPE IMC base platform
:param name: str Name of the owner of this IP scope ex. 'admin'
:param description: str description of the Ip scope
:param auth: requests auth object #usual... | [
"Function",
"takes",
"input",
"of",
"four",
"strings",
"Start",
"Ip",
"endIp",
"name",
"and",
"description",
"to",
"add",
"new",
"Ip",
"Scope",
"to",
"terminal",
"access",
"in",
"the",
"HPE",
"IMC",
"base",
"platform"
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/termaccess.py#L233-L295 | train |
HPENetworking/PYHPEIMC | pyhpeimc/plat/termaccess.py | delete_ip_scope | def delete_ip_scope(network_address, auth, url):
"""
Function to delete an entire IP segment from the IMC IP Address management under terminal access
:param network_address
:param auth
:param url
>>> from pyhpeimc.auth import *
>>> from pyhpeimc.plat.termaccess import *
>>> auth = IMC... | python | def delete_ip_scope(network_address, auth, url):
"""
Function to delete an entire IP segment from the IMC IP Address management under terminal access
:param network_address
:param auth
:param url
>>> from pyhpeimc.auth import *
>>> from pyhpeimc.plat.termaccess import *
>>> auth = IMC... | [
"def",
"delete_ip_scope",
"(",
"network_address",
",",
"auth",
",",
"url",
")",
":",
"scope_id",
"=",
"get_scope_id",
"(",
"network_address",
",",
"auth",
",",
"url",
")",
"if",
"scope_id",
"==",
"\"Scope Doesn't Exist\"",
":",
"return",
"scope_id",
"f_url",
"... | Function to delete an entire IP segment from the IMC IP Address management under terminal access
:param network_address
:param auth
:param url
>>> from pyhpeimc.auth import *
>>> from pyhpeimc.plat.termaccess import *
>>> auth = IMCAuth("http://", "10.101.0.203", "8080", "admin", "admin")
... | [
"Function",
"to",
"delete",
"an",
"entire",
"IP",
"segment",
"from",
"the",
"IMC",
"IP",
"Address",
"management",
"under",
"terminal",
"access",
":",
"param",
"network_address",
":",
"param",
"auth",
":",
"param",
"url"
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/termaccess.py#L357-L386 | train |
HPENetworking/PYHPEIMC | pyhpeimc/plat/termaccess.py | add_scope_ip | def add_scope_ip(hostipaddress, name, description, auth, url, scopeid=None, network_address=None):
"""
Function to add new host IP address allocation to existing scope ID
:param hostipaddress: ipv4 address of the target host to be added to the target scope
:param name: name of the owner of this host
... | python | def add_scope_ip(hostipaddress, name, description, auth, url, scopeid=None, network_address=None):
"""
Function to add new host IP address allocation to existing scope ID
:param hostipaddress: ipv4 address of the target host to be added to the target scope
:param name: name of the owner of this host
... | [
"def",
"add_scope_ip",
"(",
"hostipaddress",
",",
"name",
",",
"description",
",",
"auth",
",",
"url",
",",
"scopeid",
"=",
"None",
",",
"network_address",
"=",
"None",
")",
":",
"if",
"network_address",
"is",
"not",
"None",
":",
"scopeid",
"=",
"get_scope... | Function to add new host IP address allocation to existing scope ID
:param hostipaddress: ipv4 address of the target host to be added to the target scope
:param name: name of the owner of this host
:param description: Description of the host
:param auth: requests auth object #usually auth.creds from... | [
"Function",
"to",
"add",
"new",
"host",
"IP",
"address",
"allocation",
"to",
"existing",
"scope",
"ID"
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/termaccess.py#L391-L440 | train |
HPENetworking/PYHPEIMC | pyhpeimc/plat/termaccess.py | remove_scope_ip | def remove_scope_ip(hostid, auth, url):
"""
Function to add remove IP address allocation
:param hostid: Host id of the host to be deleted
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.au... | python | def remove_scope_ip(hostid, auth, url):
"""
Function to add remove IP address allocation
:param hostid: Host id of the host to be deleted
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.au... | [
"def",
"remove_scope_ip",
"(",
"hostid",
",",
"auth",
",",
"url",
")",
":",
"f_url",
"=",
"url",
"+",
"'/imcrs/res/access/assignedIpScope/ip/'",
"+",
"str",
"(",
"hostid",
")",
"response",
"=",
"requests",
".",
"delete",
"(",
"f_url",
",",
"auth",
"=",
"au... | Function to add remove IP address allocation
:param hostid: Host id of the host to be deleted
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:return: String of HTTP response c... | [
"Function",
"to",
"add",
"remove",
"IP",
"address",
"allocation"
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/termaccess.py#L443-L486 | train |
HPENetworking/PYHPEIMC | pyhpeimc/plat/termaccess.py | get_ip_scope_hosts | def get_ip_scope_hosts(auth, url, scopeid=None, network_address=None):
"""
Function requires input of scope ID and returns list of allocated IP address for the
specified scope
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interfa... | python | def get_ip_scope_hosts(auth, url, scopeid=None, network_address=None):
"""
Function requires input of scope ID and returns list of allocated IP address for the
specified scope
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interfa... | [
"def",
"get_ip_scope_hosts",
"(",
"auth",
",",
"url",
",",
"scopeid",
"=",
"None",
",",
"network_address",
"=",
"None",
")",
":",
"if",
"network_address",
"is",
"not",
"None",
":",
"scopeid",
"=",
"get_scope_id",
"(",
"network_address",
",",
"auth",
",",
"... | Function requires input of scope ID and returns list of allocated IP address for the
specified scope
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:param scopeid: Integer of t... | [
"Function",
"requires",
"input",
"of",
"scope",
"ID",
"and",
"returns",
"list",
"of",
"allocated",
"IP",
"address",
"for",
"the",
"specified",
"scope"
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/termaccess.py#L489-L546 | train |
HPENetworking/PYHPEIMC | pyhpeimc/plat/termaccess.py | delete_host_from_segment | def delete_host_from_segment(hostipaddress, networkaddress, auth, url):
"""
:param hostipaddress: str ipv4 address of the target host to be deleted
:param networkaddress: ipv4 network address + subnet bits of target scope
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.cl... | python | def delete_host_from_segment(hostipaddress, networkaddress, auth, url):
"""
:param hostipaddress: str ipv4 address of the target host to be deleted
:param networkaddress: ipv4 network address + subnet bits of target scope
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.cl... | [
"def",
"delete_host_from_segment",
"(",
"hostipaddress",
",",
"networkaddress",
",",
"auth",
",",
"url",
")",
":",
"host_id",
"=",
"get_host_id",
"(",
"hostipaddress",
",",
"networkaddress",
",",
"auth",
",",
"url",
")",
"delete_host",
"=",
"remove_scope_ip",
"(... | :param hostipaddress: str ipv4 address of the target host to be deleted
:param networkaddress: ipv4 network address + subnet bits of target scope
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.au... | [
":",
"param",
"hostipaddress",
":",
"str",
"ipv4",
"address",
"of",
"the",
"target",
"host",
"to",
"be",
"deleted"
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/termaccess.py#L578-L595 | train |
landscapeio/pylint-common | pylint_common/augmentations.py | allow_attribute_comments | def allow_attribute_comments(chain, node):
"""
This augmentation is to allow comments on class attributes, for example:
class SomeClass(object):
some_attribute = 5
''' This is a docstring for the above attribute '''
"""
# TODO: find the relevant citation for why this is the correct... | python | def allow_attribute_comments(chain, node):
"""
This augmentation is to allow comments on class attributes, for example:
class SomeClass(object):
some_attribute = 5
''' This is a docstring for the above attribute '''
"""
# TODO: find the relevant citation for why this is the correct... | [
"def",
"allow_attribute_comments",
"(",
"chain",
",",
"node",
")",
":",
"# TODO: find the relevant citation for why this is the correct way to comment attributes",
"if",
"isinstance",
"(",
"node",
".",
"previous_sibling",
"(",
")",
",",
"astroid",
".",
"Assign",
")",
"and... | This augmentation is to allow comments on class attributes, for example:
class SomeClass(object):
some_attribute = 5
''' This is a docstring for the above attribute ''' | [
"This",
"augmentation",
"is",
"to",
"allow",
"comments",
"on",
"class",
"attributes",
"for",
"example",
":"
] | c4d492ec25dca42e78508bf30dcfdac7ed71898f | https://github.com/landscapeio/pylint-common/blob/c4d492ec25dca42e78508bf30dcfdac7ed71898f/pylint_common/augmentations.py#L12-L28 | train |
wilfilho/BingTranslator | BingTranslator/utils.py | DownloadAudio.download | def download(self, url, path, name_audio):
"""
Params:
::url = Comprises the url used to download the audio.
::path = Comprises the location where the file should be saved.
::name_audio = Is the name of the desired audio.
Def... | python | def download(self, url, path, name_audio):
"""
Params:
::url = Comprises the url used to download the audio.
::path = Comprises the location where the file should be saved.
::name_audio = Is the name of the desired audio.
Def... | [
"def",
"download",
"(",
"self",
",",
"url",
",",
"path",
",",
"name_audio",
")",
":",
"if",
"path",
"is",
"not",
"None",
":",
"with",
"open",
"(",
"str",
"(",
"path",
"+",
"name_audio",
")",
",",
"'wb'",
")",
"as",
"handle",
":",
"response",
"=",
... | Params:
::url = Comprises the url used to download the audio.
::path = Comprises the location where the file should be saved.
::name_audio = Is the name of the desired audio.
Definition:
Basically, we do a get with the requests modu... | [
"Params",
":"
] | 6bada6fe1ac4177cc7dc62ff16dab561ba714534 | https://github.com/wilfilho/BingTranslator/blob/6bada6fe1ac4177cc7dc62ff16dab561ba714534/BingTranslator/utils.py#L39-L61 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpeimc/plat/netassets.py | get_dev_asset_details | def get_dev_asset_details(ipaddress, auth, url):
"""Takes in ipaddress as input to fetch device assett details from HP IMC RESTFUL API
:param ipaddress: IP address of the device you wish to gather the asset details
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:p... | python | def get_dev_asset_details(ipaddress, auth, url):
"""Takes in ipaddress as input to fetch device assett details from HP IMC RESTFUL API
:param ipaddress: IP address of the device you wish to gather the asset details
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:p... | [
"def",
"get_dev_asset_details",
"(",
"ipaddress",
",",
"auth",
",",
"url",
")",
":",
"get_dev_asset_url",
"=",
"\"/imcrs/netasset/asset?assetDevice.ip=\"",
"+",
"str",
"(",
"ipaddress",
")",
"f_url",
"=",
"url",
"+",
"get_dev_asset_url",
"# creates the URL using the pay... | Takes in ipaddress as input to fetch device assett details from HP IMC RESTFUL API
:param ipaddress: IP address of the device you wish to gather the asset details
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url... | [
"Takes",
"in",
"ipaddress",
"as",
"input",
"to",
"fetch",
"device",
"assett",
"details",
"from",
"HP",
"IMC",
"RESTFUL",
"API"
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/netassets.py#L17-L59 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpeimc/plat/netassets.py | get_dev_asset_details_all | def get_dev_asset_details_all(auth, url):
"""Takes no input to fetch device assett details from HP IMC RESTFUL API
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:return: list ... | python | def get_dev_asset_details_all(auth, url):
"""Takes no input to fetch device assett details from HP IMC RESTFUL API
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:return: list ... | [
"def",
"get_dev_asset_details_all",
"(",
"auth",
",",
"url",
")",
":",
"get_dev_asset_details_all_url",
"=",
"\"/imcrs/netasset/asset?start=0&size=15000\"",
"f_url",
"=",
"url",
"+",
"get_dev_asset_details_all_url",
"# creates the URL using the payload variable as the contents",
"r... | Takes no input to fetch device assett details from HP IMC RESTFUL API
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:return: list of dictionatires containing the device asset deta... | [
"Takes",
"no",
"input",
"to",
"fetch",
"device",
"assett",
"details",
"from",
"HP",
"IMC",
"RESTFUL",
"API"
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/netassets.py#L61-L95 | train |
mozilla-services/python-dockerflow | src/dockerflow/flask/checks/__init__.py | check_database_connected | def check_database_connected(db):
"""
A built-in check to see if connecting to the configured default
database backend succeeds.
It's automatically added to the list of Dockerflow checks if a
:class:`~flask_sqlalchemy.SQLAlchemy` object is passed
to the :class:`~dockerflow.flask.app.Dockerflow`... | python | def check_database_connected(db):
"""
A built-in check to see if connecting to the configured default
database backend succeeds.
It's automatically added to the list of Dockerflow checks if a
:class:`~flask_sqlalchemy.SQLAlchemy` object is passed
to the :class:`~dockerflow.flask.app.Dockerflow`... | [
"def",
"check_database_connected",
"(",
"db",
")",
":",
"from",
"sqlalchemy",
".",
"exc",
"import",
"DBAPIError",
",",
"SQLAlchemyError",
"errors",
"=",
"[",
"]",
"try",
":",
"with",
"db",
".",
"engine",
".",
"connect",
"(",
")",
"as",
"connection",
":",
... | A built-in check to see if connecting to the configured default
database backend succeeds.
It's automatically added to the list of Dockerflow checks if a
:class:`~flask_sqlalchemy.SQLAlchemy` object is passed
to the :class:`~dockerflow.flask.app.Dockerflow` class during
instantiation, e.g.::
... | [
"A",
"built",
"-",
"in",
"check",
"to",
"see",
"if",
"connecting",
"to",
"the",
"configured",
"default",
"database",
"backend",
"succeeds",
"."
] | 43703c5e8934ba6901b0a1520d6da4ed6457208c | https://github.com/mozilla-services/python-dockerflow/blob/43703c5e8934ba6901b0a1520d6da4ed6457208c/src/dockerflow/flask/checks/__init__.py#L14-L46 | train |
mozilla-services/python-dockerflow | src/dockerflow/flask/checks/__init__.py | check_migrations_applied | def check_migrations_applied(migrate):
"""
A built-in check to see if all migrations have been applied correctly.
It's automatically added to the list of Dockerflow checks if a
`flask_migrate.Migrate <https://flask-migrate.readthedocs.io/>`_ object
is passed to the :class:`~dockerflow.flask.app.Doc... | python | def check_migrations_applied(migrate):
"""
A built-in check to see if all migrations have been applied correctly.
It's automatically added to the list of Dockerflow checks if a
`flask_migrate.Migrate <https://flask-migrate.readthedocs.io/>`_ object
is passed to the :class:`~dockerflow.flask.app.Doc... | [
"def",
"check_migrations_applied",
"(",
"migrate",
")",
":",
"errors",
"=",
"[",
"]",
"from",
"alembic",
".",
"migration",
"import",
"MigrationContext",
"from",
"alembic",
".",
"script",
"import",
"ScriptDirectory",
"from",
"sqlalchemy",
".",
"exc",
"import",
"D... | A built-in check to see if all migrations have been applied correctly.
It's automatically added to the list of Dockerflow checks if a
`flask_migrate.Migrate <https://flask-migrate.readthedocs.io/>`_ object
is passed to the :class:`~dockerflow.flask.app.Dockerflow` class during
instantiation, e.g.::
... | [
"A",
"built",
"-",
"in",
"check",
"to",
"see",
"if",
"all",
"migrations",
"have",
"been",
"applied",
"correctly",
"."
] | 43703c5e8934ba6901b0a1520d6da4ed6457208c | https://github.com/mozilla-services/python-dockerflow/blob/43703c5e8934ba6901b0a1520d6da4ed6457208c/src/dockerflow/flask/checks/__init__.py#L49-L93 | train |
mozilla-services/python-dockerflow | src/dockerflow/flask/checks/__init__.py | check_redis_connected | def check_redis_connected(client):
"""
A built-in check to connect to Redis using the given client and see
if it responds to the ``PING`` command.
It's automatically added to the list of Dockerflow checks if a
:class:`~redis.StrictRedis` instances is passed
to the :class:`~dockerflow.flask.app.... | python | def check_redis_connected(client):
"""
A built-in check to connect to Redis using the given client and see
if it responds to the ``PING`` command.
It's automatically added to the list of Dockerflow checks if a
:class:`~redis.StrictRedis` instances is passed
to the :class:`~dockerflow.flask.app.... | [
"def",
"check_redis_connected",
"(",
"client",
")",
":",
"import",
"redis",
"errors",
"=",
"[",
"]",
"try",
":",
"result",
"=",
"client",
".",
"ping",
"(",
")",
"except",
"redis",
".",
"ConnectionError",
"as",
"e",
":",
"msg",
"=",
"'Could not connect to r... | A built-in check to connect to Redis using the given client and see
if it responds to the ``PING`` command.
It's automatically added to the list of Dockerflow checks if a
:class:`~redis.StrictRedis` instances is passed
to the :class:`~dockerflow.flask.app.Dockerflow` class during
instantiation, e.g... | [
"A",
"built",
"-",
"in",
"check",
"to",
"connect",
"to",
"Redis",
"using",
"the",
"given",
"client",
"and",
"see",
"if",
"it",
"responds",
"to",
"the",
"PING",
"command",
"."
] | 43703c5e8934ba6901b0a1520d6da4ed6457208c | https://github.com/mozilla-services/python-dockerflow/blob/43703c5e8934ba6901b0a1520d6da4ed6457208c/src/dockerflow/flask/checks/__init__.py#L96-L145 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpimc/plat/groups.py | get_custom_views | def get_custom_views(auth, url,name=None,headers=HEADERS):
"""
function requires no input and returns a list of dictionaries of custom views from an HPE IMC. Optional name
argument will return only the specified view.
:param name: str containing the name of the desired custom view
:return: list of d... | python | def get_custom_views(auth, url,name=None,headers=HEADERS):
"""
function requires no input and returns a list of dictionaries of custom views from an HPE IMC. Optional name
argument will return only the specified view.
:param name: str containing the name of the desired custom view
:return: list of d... | [
"def",
"get_custom_views",
"(",
"auth",
",",
"url",
",",
"name",
"=",
"None",
",",
"headers",
"=",
"HEADERS",
")",
":",
"if",
"name",
"is",
"None",
":",
"get_custom_view_url",
"=",
"'/imcrs/plat/res/view/custom?resPrivilegeFilter=false&desc=false&total=false'",
"elif"... | function requires no input and returns a list of dictionaries of custom views from an HPE IMC. Optional name
argument will return only the specified view.
:param name: str containing the name of the desired custom view
:return: list of dictionaties containing attributes of the custom views | [
"function",
"requires",
"no",
"input",
"and",
"returns",
"a",
"list",
"of",
"dictionaries",
"of",
"custom",
"views",
"from",
"an",
"HPE",
"IMC",
".",
"Optional",
"name",
"argument",
"will",
"return",
"only",
"the",
"specified",
"view",
".",
":",
"param",
"... | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpimc/plat/groups.py#L42-L64 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpimc/plat/groups.py | create_custom_views | def create_custom_views(auth, url,name=None, upperview=None):
"""
function takes no input and issues a RESTFUL call to get a list of custom views from HPE IMC. Optioanl Name input
will return only the specified view.
:param name: string containg the name of the desired custom view
:return: list of d... | python | def create_custom_views(auth, url,name=None, upperview=None):
"""
function takes no input and issues a RESTFUL call to get a list of custom views from HPE IMC. Optioanl Name input
will return only the specified view.
:param name: string containg the name of the desired custom view
:return: list of d... | [
"def",
"create_custom_views",
"(",
"auth",
",",
"url",
",",
"name",
"=",
"None",
",",
"upperview",
"=",
"None",
")",
":",
"create_custom_views_url",
"=",
"'/imcrs/plat/res/view/custom?resPrivilegeFilter=false&desc=false&total=false'",
"f_url",
"=",
"url",
"+",
"create_c... | function takes no input and issues a RESTFUL call to get a list of custom views from HPE IMC. Optioanl Name input
will return only the specified view.
:param name: string containg the name of the desired custom view
:return: list of dictionaries containing attributes of the custom views. | [
"function",
"takes",
"no",
"input",
"and",
"issues",
"a",
"RESTFUL",
"call",
"to",
"get",
"a",
"list",
"of",
"custom",
"views",
"from",
"HPE",
"IMC",
".",
"Optioanl",
"Name",
"input",
"will",
"return",
"only",
"the",
"specified",
"view",
".",
":",
"param... | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpimc/plat/groups.py#L67-L90 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpimc/plat/device.py | get_dev_run_config | def get_dev_run_config(devid, auth, url):
"""
function takes the devId of a specific device and issues a RESTFUL call to get the most current running config
file as known by the HP IMC Base Platform ICC module for the target device.
:param devid: int or str value of the target device
:return: str w... | python | def get_dev_run_config(devid, auth, url):
"""
function takes the devId of a specific device and issues a RESTFUL call to get the most current running config
file as known by the HP IMC Base Platform ICC module for the target device.
:param devid: int or str value of the target device
:return: str w... | [
"def",
"get_dev_run_config",
"(",
"devid",
",",
"auth",
",",
"url",
")",
":",
"# checks to see if the imc credentials are already available",
"get_dev_run_url",
"=",
"\"/imcrs/icc/deviceCfg/\"",
"+",
"str",
"(",
"devid",
")",
"+",
"\"/currentRun\"",
"f_url",
"=",
"url",... | function takes the devId of a specific device and issues a RESTFUL call to get the most current running config
file as known by the HP IMC Base Platform ICC module for the target device.
:param devid: int or str value of the target device
:return: str which contains the entire content of the target device ... | [
"function",
"takes",
"the",
"devId",
"of",
"a",
"specific",
"device",
"and",
"issues",
"a",
"RESTFUL",
"call",
"to",
"get",
"the",
"most",
"current",
"running",
"config",
"file",
"as",
"known",
"by",
"the",
"HP",
"IMC",
"Base",
"Platform",
"ICC",
"module",... | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpimc/plat/device.py#L91-L114 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpimc/plat/device.py | get_dev_start_config | def get_dev_start_config(devId, auth, url):
"""
function takes the devId of a specific device and issues a RESTFUL call to get the most current startup config
file as known by the HP IMC Base Platform ICC module for the target device.
:param devId: int or str value of the target device
:return: str... | python | def get_dev_start_config(devId, auth, url):
"""
function takes the devId of a specific device and issues a RESTFUL call to get the most current startup config
file as known by the HP IMC Base Platform ICC module for the target device.
:param devId: int or str value of the target device
:return: str... | [
"def",
"get_dev_start_config",
"(",
"devId",
",",
"auth",
",",
"url",
")",
":",
"# checks to see if the imc credentials are already available",
"get_dev_run_url",
"=",
"\"/imcrs/icc/deviceCfg/\"",
"+",
"str",
"(",
"devId",
")",
"+",
"\"/currentStart\"",
"f_url",
"=",
"u... | function takes the devId of a specific device and issues a RESTFUL call to get the most current startup config
file as known by the HP IMC Base Platform ICC module for the target device.
:param devId: int or str value of the target device
:return: str which contains the entire content of the target device ... | [
"function",
"takes",
"the",
"devId",
"of",
"a",
"specific",
"device",
"and",
"issues",
"a",
"RESTFUL",
"call",
"to",
"get",
"the",
"most",
"current",
"startup",
"config",
"file",
"as",
"known",
"by",
"the",
"HP",
"IMC",
"Base",
"Platform",
"ICC",
"module",... | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpimc/plat/device.py#L117-L140 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpimc/plat/device.py | set_inteface_up | def set_inteface_up(devid, ifindex, auth, url):
"""
function takest devid and ifindex of specific device and interface and issues a RESTFUL call to "undo shut" the spec
ified interface on the target device.
:param devid: int or str value of the target device
:param ifindex: int or str value of the t... | python | def set_inteface_up(devid, ifindex, auth, url):
"""
function takest devid and ifindex of specific device and interface and issues a RESTFUL call to "undo shut" the spec
ified interface on the target device.
:param devid: int or str value of the target device
:param ifindex: int or str value of the t... | [
"def",
"set_inteface_up",
"(",
"devid",
",",
"ifindex",
",",
"auth",
",",
"url",
")",
":",
"set_int_up_url",
"=",
"\"/imcrs/plat/res/device/\"",
"+",
"str",
"(",
"devid",
")",
"+",
"\"/interface/\"",
"+",
"str",
"(",
"ifindex",
")",
"+",
"\"/up\"",
"f_url",
... | function takest devid and ifindex of specific device and interface and issues a RESTFUL call to "undo shut" the spec
ified interface on the target device.
:param devid: int or str value of the target device
:param ifindex: int or str value of the target interface
:return: HTTP status code 204 with no va... | [
"function",
"takest",
"devid",
"and",
"ifindex",
"of",
"specific",
"device",
"and",
"interface",
"and",
"issues",
"a",
"RESTFUL",
"call",
"to",
"undo",
"shut",
"the",
"spec",
"ified",
"interface",
"on",
"the",
"target",
"device",
".",
":",
"param",
"devid",
... | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpimc/plat/device.py#L186-L202 | train |
lablup/backend.ai-client-py | src/ai/backend/client/cli/admin/vfolders.py | vfolders | def vfolders(access_key):
'''
List and manage virtual folders.
'''
fields = [
('Name', 'name'),
('Created At', 'created_at'),
('Last Used', 'last_used'),
('Max Files', 'max_files'),
('Max Size', 'max_size'),
]
if access_key is None:
q = 'query { vf... | python | def vfolders(access_key):
'''
List and manage virtual folders.
'''
fields = [
('Name', 'name'),
('Created At', 'created_at'),
('Last Used', 'last_used'),
('Max Files', 'max_files'),
('Max Size', 'max_size'),
]
if access_key is None:
q = 'query { vf... | [
"def",
"vfolders",
"(",
"access_key",
")",
":",
"fields",
"=",
"[",
"(",
"'Name'",
",",
"'name'",
")",
",",
"(",
"'Created At'",
",",
"'created_at'",
")",
",",
"(",
"'Last Used'",
",",
"'last_used'",
")",
",",
"(",
"'Max Files'",
",",
"'max_files'",
")",... | List and manage virtual folders. | [
"List",
"and",
"manage",
"virtual",
"folders",
"."
] | a063d774fea6f4350b89498c40d3c837ec3029a7 | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/vfolders.py#L15-L39 | train |
lablup/backend.ai-client-py | src/ai/backend/client/cli/config.py | config | def config():
'''
Shows the current configuration.
'''
config = get_config()
print('Client version: {0}'.format(click.style(__version__, bold=True)))
print('API endpoint: {0}'.format(click.style(str(config.endpoint), bold=True)))
print('API version: {0}'.format(click.style(config.version, bo... | python | def config():
'''
Shows the current configuration.
'''
config = get_config()
print('Client version: {0}'.format(click.style(__version__, bold=True)))
print('API endpoint: {0}'.format(click.style(str(config.endpoint), bold=True)))
print('API version: {0}'.format(click.style(config.version, bo... | [
"def",
"config",
"(",
")",
":",
"config",
"=",
"get_config",
"(",
")",
"print",
"(",
"'Client version: {0}'",
".",
"format",
"(",
"click",
".",
"style",
"(",
"__version__",
",",
"bold",
"=",
"True",
")",
")",
")",
"print",
"(",
"'API endpoint: {0}'",
"."... | Shows the current configuration. | [
"Shows",
"the",
"current",
"configuration",
"."
] | a063d774fea6f4350b89498c40d3c837ec3029a7 | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/config.py#L9-L23 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpeimc/plat/device.py | get_system_vendors | def get_system_vendors(auth, url):
"""Takes string no input to issue RESTUL call to HP IMC\n
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:return: list of dictionaries ... | python | def get_system_vendors(auth, url):
"""Takes string no input to issue RESTUL call to HP IMC\n
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:return: list of dictionaries ... | [
"def",
"get_system_vendors",
"(",
"auth",
",",
"url",
")",
":",
"get_system_vendors_url",
"=",
"'/imcrs/plat/res/vendor?start=0&size=10000&orderBy=id&desc=false&total=false'",
"f_url",
"=",
"url",
"+",
"get_system_vendors_url",
"# creates the URL using the payload variable as the con... | Takes string no input to issue RESTUL call to HP IMC\n
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:return: list of dictionaries where each dictionary represents a single ... | [
"Takes",
"string",
"no",
"input",
"to",
"issue",
"RESTUL",
"call",
"to",
"HP",
"IMC",
"\\",
"n"
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/device.py#L22-L57 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpeimc/plat/device.py | get_system_category | def get_system_category(auth, url):
"""Takes string no input to issue RESTUL call to HP IMC\n
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:return: list of dictionaries... | python | def get_system_category(auth, url):
"""Takes string no input to issue RESTUL call to HP IMC\n
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:return: list of dictionaries... | [
"def",
"get_system_category",
"(",
"auth",
",",
"url",
")",
":",
"get_system_category_url",
"=",
"'/imcrs/plat/res/category?start=0&size=10000&orderBy=id&desc=false&total=false'",
"f_url",
"=",
"url",
"+",
"get_system_category_url",
"# creates the URL using the payload variable as th... | Takes string no input to issue RESTUL call to HP IMC\n
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:return: list of dictionaries where each dictionary represents a single ... | [
"Takes",
"string",
"no",
"input",
"to",
"issue",
"RESTUL",
"call",
"to",
"HP",
"IMC",
"\\",
"n"
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/device.py#L60-L95 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpeimc/plat/device.py | get_system_device_models | def get_system_device_models(auth, url):
"""Takes string no input to issue RESTUL call to HP IMC\n
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:return: list of diction... | python | def get_system_device_models(auth, url):
"""Takes string no input to issue RESTUL call to HP IMC\n
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:return: list of diction... | [
"def",
"get_system_device_models",
"(",
"auth",
",",
"url",
")",
":",
"get_system_device_model_url",
"=",
"'/imcrs/plat/res/model?start=0&size=10000&orderBy=id&desc=false&total=false'",
"f_url",
"=",
"url",
"+",
"get_system_device_model_url",
"# creates the URL using the payload vari... | Takes string no input to issue RESTUL call to HP IMC\n
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:return: list of dictionaries where each dictionary represents a single ... | [
"Takes",
"string",
"no",
"input",
"to",
"issue",
"RESTUL",
"call",
"to",
"HP",
"IMC",
"\\",
"n"
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/device.py#L98-L132 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpeimc/plat/device.py | get_system_series | def get_system_series(auth, url):
"""Takes string no input to issue RESTUL call to HP IMC\n
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:return: list of dictionaries w... | python | def get_system_series(auth, url):
"""Takes string no input to issue RESTUL call to HP IMC\n
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:return: list of dictionaries w... | [
"def",
"get_system_series",
"(",
"auth",
",",
"url",
")",
":",
"get_system_series_url",
"=",
"'/imcrs/plat/res/series?managedOnly=false&start=0&size=10000&orderBy=id&desc=false&total=false'",
"f_url",
"=",
"url",
"+",
"get_system_series_url",
"# creates the URL using the payload vari... | Takes string no input to issue RESTUL call to HP IMC\n
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:return: list of dictionaries where each dictionary represents a single ... | [
"Takes",
"string",
"no",
"input",
"to",
"issue",
"RESTUL",
"call",
"to",
"HP",
"IMC",
"\\",
"n"
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/device.py#L135-L171 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpeimc/plat/device.py | get_all_devs | def get_all_devs(auth, url, network_address= None):
"""Takes string input of IP address to issue RESTUL call to HP IMC\n
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:param n... | python | def get_all_devs(auth, url, network_address= None):
"""Takes string input of IP address to issue RESTUL call to HP IMC\n
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:param n... | [
"def",
"get_all_devs",
"(",
"auth",
",",
"url",
",",
"network_address",
"=",
"None",
")",
":",
"if",
"network_address",
"!=",
"None",
":",
"get_all_devs_url",
"=",
"\"/imcrs/plat/res/device?resPrivilegeFilter=false&ip=\"",
"+",
"str",
"(",
"network_address",
")",
"+... | Takes string input of IP address to issue RESTUL call to HP IMC\n
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass
:param network_address= str IPv4 Network Address
:return: dict... | [
"Takes",
"string",
"input",
"of",
"IP",
"address",
"to",
"issue",
"RESTUL",
"call",
"to",
"HP",
"IMC",
"\\",
"n"
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/device.py#L177-L224 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpeimc/plat/device.py | get_dev_details | def get_dev_details(ip_address, auth, url):
"""Takes string input of IP address to issue RESTUL call to HP IMC\n
:param ip_address: string object of dotted decimal notation of IPv4 address
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC ... | python | def get_dev_details(ip_address, auth, url):
"""Takes string input of IP address to issue RESTUL call to HP IMC\n
:param ip_address: string object of dotted decimal notation of IPv4 address
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC ... | [
"def",
"get_dev_details",
"(",
"ip_address",
",",
"auth",
",",
"url",
")",
":",
"get_dev_details_url",
"=",
"\"/imcrs/plat/res/device?resPrivilegeFilter=false&ip=\"",
"+",
"str",
"(",
"ip_address",
")",
"+",
"\"&start=0&size=1000&orderBy=id&desc=false&total=false\"",
"f_url",... | Takes string input of IP address to issue RESTUL call to HP IMC\n
:param ip_address: string object of dotted decimal notation of IPv4 address
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.a... | [
"Takes",
"string",
"input",
"of",
"IP",
"address",
"to",
"issue",
"RESTUL",
"call",
"to",
"HP",
"IMC",
"\\",
"n"
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/device.py#L227-L280 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpeimc/plat/device.py | get_dev_interface | def get_dev_interface(devid, auth, url):
"""
Function takes devid as input to RESTFUL call to HP IMC platform and returns list of device interfaces
:param devid: requires devid as the only input
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base u... | python | def get_dev_interface(devid, auth, url):
"""
Function takes devid as input to RESTFUL call to HP IMC platform and returns list of device interfaces
:param devid: requires devid as the only input
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base u... | [
"def",
"get_dev_interface",
"(",
"devid",
",",
"auth",
",",
"url",
")",
":",
"get_dev_interface_url",
"=",
"\"/imcrs/plat/res/device/\"",
"+",
"str",
"(",
"devid",
")",
"+",
"\"/interface?start=0&size=1000&desc=false&total=false\"",
"f_url",
"=",
"url",
"+",
"get_dev_... | Function takes devid as input to RESTFUL call to HP IMC platform and returns list of device interfaces
:param devid: requires devid as the only input
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeim... | [
"Function",
"takes",
"devid",
"as",
"input",
"to",
"RESTFUL",
"call",
"to",
"HP",
"IMC",
"platform",
"and",
"returns",
"list",
"of",
"device",
"interfaces"
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/device.py#L283-L323 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpeimc/plat/device.py | get_dev_mac_learn | def get_dev_mac_learn(devid, auth, url):
'''
function takes devid of specific device and issues a RESTFUL call to gather the current IP-MAC learning entries on
the target device.
:param devid: int value of the target device
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.a... | python | def get_dev_mac_learn(devid, auth, url):
'''
function takes devid of specific device and issues a RESTFUL call to gather the current IP-MAC learning entries on
the target device.
:param devid: int value of the target device
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.a... | [
"def",
"get_dev_mac_learn",
"(",
"devid",
",",
"auth",
",",
"url",
")",
":",
"get_dev_mac_learn_url",
"=",
"'/imcrs/res/access/ipMacLearn/'",
"+",
"str",
"(",
"devid",
")",
"f_url",
"=",
"url",
"+",
"get_dev_mac_learn_url",
"try",
":",
"r",
"=",
"requests",
".... | function takes devid of specific device and issues a RESTFUL call to gather the current IP-MAC learning entries on
the target device.
:param devid: int value of the target device
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interfa... | [
"function",
"takes",
"devid",
"of",
"specific",
"device",
"and",
"issues",
"a",
"RESTFUL",
"call",
"to",
"gather",
"the",
"current",
"IP",
"-",
"MAC",
"learning",
"entries",
"on",
"the",
"target",
"device",
"."
] | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/device.py#L416-L456 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpeimc/plat/device.py | run_dev_cmd | def run_dev_cmd(devid, cmd_list, auth, url):
'''
Function takes devid of target device and a sequential list of strings which define the specific commands to be run
on the target device and returns a str object containing the output of the commands.
:param devid: int devid of the target device
:par... | python | def run_dev_cmd(devid, cmd_list, auth, url):
'''
Function takes devid of target device and a sequential list of strings which define the specific commands to be run
on the target device and returns a str object containing the output of the commands.
:param devid: int devid of the target device
:par... | [
"def",
"run_dev_cmd",
"(",
"devid",
",",
"cmd_list",
",",
"auth",
",",
"url",
")",
":",
"run_dev_cmd_url",
"=",
"'/imcrs/icc/confFile/executeCmd'",
"f_url",
"=",
"url",
"+",
"run_dev_cmd_url",
"cmd_list",
"=",
"_make_cmd_list",
"(",
"cmd_list",
")",
"payload",
"... | Function takes devid of target device and a sequential list of strings which define the specific commands to be run
on the target device and returns a str object containing the output of the commands.
:param devid: int devid of the target device
:param cmd_list: list of strings
:return: str containing... | [
"Function",
"takes",
"devid",
"of",
"target",
"device",
"and",
"a",
"sequential",
"list",
"of",
"strings",
"which",
"define",
"the",
"specific",
"commands",
"to",
"be",
"run",
"on",
"the",
"target",
"device",
"and",
"returns",
"a",
"str",
"object",
"containi... | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/device.py#L459-L501 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpeimc/plat/device.py | get_all_interface_details | def get_all_interface_details(devId, auth, url):
"""
function takes the devId of a specific device and the ifindex value assigned to a specific interface
and issues a RESTFUL call to get the interface details
file as known by the HP IMC Base Platform ICC module for the target device.
:param devId: ... | python | def get_all_interface_details(devId, auth, url):
"""
function takes the devId of a specific device and the ifindex value assigned to a specific interface
and issues a RESTFUL call to get the interface details
file as known by the HP IMC Base Platform ICC module for the target device.
:param devId: ... | [
"def",
"get_all_interface_details",
"(",
"devId",
",",
"auth",
",",
"url",
")",
":",
"get_all_interface_details_url",
"=",
"\"/imcrs/plat/res/device/\"",
"+",
"str",
"(",
"devId",
")",
"+",
"\"/interface/?start=0&size=1000&desc=false&total=false\"",
"f_url",
"=",
"url",
... | function takes the devId of a specific device and the ifindex value assigned to a specific interface
and issues a RESTFUL call to get the interface details
file as known by the HP IMC Base Platform ICC module for the target device.
:param devId: int or str value of the devId of the target device
:par... | [
"function",
"takes",
"the",
"devId",
"of",
"a",
"specific",
"device",
"and",
"the",
"ifindex",
"value",
"assigned",
"to",
"a",
"specific",
"interface",
"and",
"issues",
"a",
"RESTFUL",
"call",
"to",
"get",
"the",
"interface",
"details",
"file",
"as",
"known"... | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/device.py#L509-L551 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpeimc/plat/device.py | get_interface_details | def get_interface_details(devId, ifIndex, auth, url):
"""
function takes the devId of a specific device and the ifindex value assigned to a specific interface
and issues a RESTFUL call to get the interface details
file as known by the HP IMC Base Platform ICC module for the target device.
:param de... | python | def get_interface_details(devId, ifIndex, auth, url):
"""
function takes the devId of a specific device and the ifindex value assigned to a specific interface
and issues a RESTFUL call to get the interface details
file as known by the HP IMC Base Platform ICC module for the target device.
:param de... | [
"def",
"get_interface_details",
"(",
"devId",
",",
"ifIndex",
",",
"auth",
",",
"url",
")",
":",
"get_interface_details_url",
"=",
"\"/imcrs/plat/res/device/\"",
"+",
"str",
"(",
"devId",
")",
"+",
"\"/interface/\"",
"+",
"str",
"(",
"ifIndex",
")",
"f_url",
"... | function takes the devId of a specific device and the ifindex value assigned to a specific interface
and issues a RESTFUL call to get the interface details
file as known by the HP IMC Base Platform ICC module for the target device.
:param devId: int or str value of the devId of the target device
:par... | [
"function",
"takes",
"the",
"devId",
"of",
"a",
"specific",
"device",
"and",
"the",
"ifindex",
"value",
"assigned",
"to",
"a",
"specific",
"interface",
"and",
"issues",
"a",
"RESTFUL",
"call",
"to",
"get",
"the",
"interface",
"details",
"file",
"as",
"known"... | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/device.py#L554-L597 | train |
HPENetworking/PYHPEIMC | build/lib/pyhpeimc/plat/device.py | set_interface_down | def set_interface_down(devid, ifindex, auth, url):
"""
function takest devid and ifindex of specific device and interface and issues a RESTFUL call to " shut" the specifie
d interface on the target device.
:param devid: int or str value of the target device
:param ifindex: int or str value of the t... | python | def set_interface_down(devid, ifindex, auth, url):
"""
function takest devid and ifindex of specific device and interface and issues a RESTFUL call to " shut" the specifie
d interface on the target device.
:param devid: int or str value of the target device
:param ifindex: int or str value of the t... | [
"def",
"set_interface_down",
"(",
"devid",
",",
"ifindex",
",",
"auth",
",",
"url",
")",
":",
"set_int_down_url",
"=",
"\"/imcrs/plat/res/device/\"",
"+",
"str",
"(",
"devid",
")",
"+",
"\"/interface/\"",
"+",
"str",
"(",
"ifindex",
")",
"+",
"\"/down\"",
"f... | function takest devid and ifindex of specific device and interface and issues a RESTFUL call to " shut" the specifie
d interface on the target device.
:param devid: int or str value of the target device
:param ifindex: int or str value of the target interface
:param auth: requests auth object #usually... | [
"function",
"takest",
"devid",
"and",
"ifindex",
"of",
"specific",
"device",
"and",
"interface",
"and",
"issues",
"a",
"RESTFUL",
"call",
"to",
"shut",
"the",
"specifie",
"d",
"interface",
"on",
"the",
"target",
"device",
".",
":",
"param",
"devid",
":",
"... | 4fba31827573587e03a6233c7db60f188038c8e5 | https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/device.py#L600-L638 | train |
lablup/backend.ai-client-py | src/ai/backend/client/resource_policy.py | ResourcePolicy.create | async def create(cls, name: str,
default_for_unspecified: int,
total_resource_slots: int,
max_concurrent_sessions: int,
max_containers_per_session: int,
max_vfolder_count: int,
max_vfolder_size:... | python | async def create(cls, name: str,
default_for_unspecified: int,
total_resource_slots: int,
max_concurrent_sessions: int,
max_containers_per_session: int,
max_vfolder_count: int,
max_vfolder_size:... | [
"async",
"def",
"create",
"(",
"cls",
",",
"name",
":",
"str",
",",
"default_for_unspecified",
":",
"int",
",",
"total_resource_slots",
":",
"int",
",",
"max_concurrent_sessions",
":",
"int",
",",
"max_containers_per_session",
":",
"int",
",",
"max_vfolder_count",... | Creates a new keypair resource policy with the given options.
You need an admin privilege for this operation. | [
"Creates",
"a",
"new",
"keypair",
"resource",
"policy",
"with",
"the",
"given",
"options",
".",
"You",
"need",
"an",
"admin",
"privilege",
"for",
"this",
"operation",
"."
] | a063d774fea6f4350b89498c40d3c837ec3029a7 | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/resource_policy.py#L23-L66 | train |
lablup/backend.ai-client-py | src/ai/backend/client/resource_policy.py | ResourcePolicy.list | async def list(cls, fields: Iterable[str] = None) -> Sequence[dict]:
'''
Lists the keypair resource policies.
You need an admin privilege for this operation.
'''
if fields is None:
fields = (
'name', 'created_at',
'total_resource_slots'... | python | async def list(cls, fields: Iterable[str] = None) -> Sequence[dict]:
'''
Lists the keypair resource policies.
You need an admin privilege for this operation.
'''
if fields is None:
fields = (
'name', 'created_at',
'total_resource_slots'... | [
"async",
"def",
"list",
"(",
"cls",
",",
"fields",
":",
"Iterable",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"Sequence",
"[",
"dict",
"]",
":",
"if",
"fields",
"is",
"None",
":",
"fields",
"=",
"(",
"'name'",
",",
"'created_at'",
",",
"'total_resourc... | Lists the keypair resource policies.
You need an admin privilege for this operation. | [
"Lists",
"the",
"keypair",
"resource",
"policies",
".",
"You",
"need",
"an",
"admin",
"privilege",
"for",
"this",
"operation",
"."
] | a063d774fea6f4350b89498c40d3c837ec3029a7 | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/resource_policy.py#L138-L162 | train |
lablup/backend.ai-client-py | src/ai/backend/client/cli/admin/keypairs.py | keypair | def keypair():
'''
Show the server-side information of the currently configured access key.
'''
fields = [
('User ID', 'user_id'),
('Access Key', 'access_key'),
('Secret Key', 'secret_key'),
('Active?', 'is_active'),
('Admin?', 'is_admin'),
('Created At', ... | python | def keypair():
'''
Show the server-side information of the currently configured access key.
'''
fields = [
('User ID', 'user_id'),
('Access Key', 'access_key'),
('Secret Key', 'secret_key'),
('Active?', 'is_active'),
('Admin?', 'is_admin'),
('Created At', ... | [
"def",
"keypair",
"(",
")",
":",
"fields",
"=",
"[",
"(",
"'User ID'",
",",
"'user_id'",
")",
",",
"(",
"'Access Key'",
",",
"'access_key'",
")",
",",
"(",
"'Secret Key'",
",",
"'secret_key'",
")",
",",
"(",
"'Active?'",
",",
"'is_active'",
")",
",",
"... | Show the server-side information of the currently configured access key. | [
"Show",
"the",
"server",
"-",
"side",
"information",
"of",
"the",
"currently",
"configured",
"access",
"key",
"."
] | a063d774fea6f4350b89498c40d3c837ec3029a7 | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/keypairs.py#L12-L39 | train |
lablup/backend.ai-client-py | src/ai/backend/client/cli/admin/keypairs.py | keypairs | def keypairs(ctx, user_id, is_active):
'''
List and manage keypairs.
To show all keypairs or other user's, your access key must have the admin
privilege.
(admin privilege required)
'''
if ctx.invoked_subcommand is not None:
return
fields = [
('User ID', 'user_id'),
... | python | def keypairs(ctx, user_id, is_active):
'''
List and manage keypairs.
To show all keypairs or other user's, your access key must have the admin
privilege.
(admin privilege required)
'''
if ctx.invoked_subcommand is not None:
return
fields = [
('User ID', 'user_id'),
... | [
"def",
"keypairs",
"(",
"ctx",
",",
"user_id",
",",
"is_active",
")",
":",
"if",
"ctx",
".",
"invoked_subcommand",
"is",
"not",
"None",
":",
"return",
"fields",
"=",
"[",
"(",
"'User ID'",
",",
"'user_id'",
")",
",",
"(",
"'Access Key'",
",",
"'access_ke... | List and manage keypairs.
To show all keypairs or other user's, your access key must have the admin
privilege.
(admin privilege required) | [
"List",
"and",
"manage",
"keypairs",
".",
"To",
"show",
"all",
"keypairs",
"or",
"other",
"user",
"s",
"your",
"access",
"key",
"must",
"have",
"the",
"admin",
"privilege",
".",
"(",
"admin",
"privilege",
"required",
")"
] | a063d774fea6f4350b89498c40d3c837ec3029a7 | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/keypairs.py#L48-L86 | train |
lablup/backend.ai-client-py | src/ai/backend/client/cli/admin/keypairs.py | add | def add(user_id, resource_policy, admin, inactive, rate_limit):
'''
Add a new keypair.
USER_ID: User ID of a new key pair.
RESOURCE_POLICY: resource policy for new key pair.
'''
try:
user_id = int(user_id)
except ValueError:
pass # string-based user ID for Backend.AI v1.4+... | python | def add(user_id, resource_policy, admin, inactive, rate_limit):
'''
Add a new keypair.
USER_ID: User ID of a new key pair.
RESOURCE_POLICY: resource policy for new key pair.
'''
try:
user_id = int(user_id)
except ValueError:
pass # string-based user ID for Backend.AI v1.4+... | [
"def",
"add",
"(",
"user_id",
",",
"resource_policy",
",",
"admin",
",",
"inactive",
",",
"rate_limit",
")",
":",
"try",
":",
"user_id",
"=",
"int",
"(",
"user_id",
")",
"except",
"ValueError",
":",
"pass",
"# string-based user ID for Backend.AI v1.4+",
"with",
... | Add a new keypair.
USER_ID: User ID of a new key pair.
RESOURCE_POLICY: resource policy for new key pair. | [
"Add",
"a",
"new",
"keypair",
"."
] | a063d774fea6f4350b89498c40d3c837ec3029a7 | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/keypairs.py#L98-L125 | train |
lablup/backend.ai-client-py | src/ai/backend/client/cli/admin/keypairs.py | update | def update(access_key, resource_policy, is_admin, is_active, rate_limit):
'''
Update an existing keypair.
ACCESS_KEY: Access key of an existing key pair.
'''
with Session() as session:
try:
data = session.KeyPair.update(
access_key,
is_active=is_... | python | def update(access_key, resource_policy, is_admin, is_active, rate_limit):
'''
Update an existing keypair.
ACCESS_KEY: Access key of an existing key pair.
'''
with Session() as session:
try:
data = session.KeyPair.update(
access_key,
is_active=is_... | [
"def",
"update",
"(",
"access_key",
",",
"resource_policy",
",",
"is_admin",
",",
"is_active",
",",
"rate_limit",
")",
":",
"with",
"Session",
"(",
")",
"as",
"session",
":",
"try",
":",
"data",
"=",
"session",
".",
"KeyPair",
".",
"update",
"(",
"access... | Update an existing keypair.
ACCESS_KEY: Access key of an existing key pair. | [
"Update",
"an",
"existing",
"keypair",
"."
] | a063d774fea6f4350b89498c40d3c837ec3029a7 | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/keypairs.py#L134-L154 | train |
lablup/backend.ai-client-py | src/ai/backend/client/cli/admin/keypairs.py | delete | def delete(access_key):
"""
Delete an existing keypair.
ACCESSKEY: ACCESSKEY for a keypair to delete.
"""
with Session() as session:
try:
data = session.KeyPair.delete(access_key)
except Exception as e:
print_error(e)
sys.exit(1)
if not da... | python | def delete(access_key):
"""
Delete an existing keypair.
ACCESSKEY: ACCESSKEY for a keypair to delete.
"""
with Session() as session:
try:
data = session.KeyPair.delete(access_key)
except Exception as e:
print_error(e)
sys.exit(1)
if not da... | [
"def",
"delete",
"(",
"access_key",
")",
":",
"with",
"Session",
"(",
")",
"as",
"session",
":",
"try",
":",
"data",
"=",
"session",
".",
"KeyPair",
".",
"delete",
"(",
"access_key",
")",
"except",
"Exception",
"as",
"e",
":",
"print_error",
"(",
"e",
... | Delete an existing keypair.
ACCESSKEY: ACCESSKEY for a keypair to delete. | [
"Delete",
"an",
"existing",
"keypair",
"."
] | a063d774fea6f4350b89498c40d3c837ec3029a7 | https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/cli/admin/keypairs.py#L159-L174 | train |
vektorlab/slacksocket | slacksocket/webclient.py | WebClient.login | def login(self):
""" perform API auth test returning user and team """
log.debug('performing auth test')
test = self._get(urls['test'])
user = User({ 'name': test['user'], 'id': test['user_id'] })
self._refresh()
return test['team'], user | python | def login(self):
""" perform API auth test returning user and team """
log.debug('performing auth test')
test = self._get(urls['test'])
user = User({ 'name': test['user'], 'id': test['user_id'] })
self._refresh()
return test['team'], user | [
"def",
"login",
"(",
"self",
")",
":",
"log",
".",
"debug",
"(",
"'performing auth test'",
")",
"test",
"=",
"self",
".",
"_get",
"(",
"urls",
"[",
"'test'",
"]",
")",
"user",
"=",
"User",
"(",
"{",
"'name'",
":",
"test",
"[",
"'user'",
"]",
",",
... | perform API auth test returning user and team | [
"perform",
"API",
"auth",
"test",
"returning",
"user",
"and",
"team"
] | 8eb8b0f14fe80740217ea0aaf6feb7f736bdf57f | https://github.com/vektorlab/slacksocket/blob/8eb8b0f14fe80740217ea0aaf6feb7f736bdf57f/slacksocket/webclient.py#L26-L32 | train |
vektorlab/slacksocket | slacksocket/webclient.py | WebClient.user | def user(self, match):
""" Return User object for a given Slack ID or name """
if len(match) == 9 and match[0] == 'U':
return self._lookup(User, 'id', match)
return self._lookup(User, 'name', match) | python | def user(self, match):
""" Return User object for a given Slack ID or name """
if len(match) == 9 and match[0] == 'U':
return self._lookup(User, 'id', match)
return self._lookup(User, 'name', match) | [
"def",
"user",
"(",
"self",
",",
"match",
")",
":",
"if",
"len",
"(",
"match",
")",
"==",
"9",
"and",
"match",
"[",
"0",
"]",
"==",
"'U'",
":",
"return",
"self",
".",
"_lookup",
"(",
"User",
",",
"'id'",
",",
"match",
")",
"return",
"self",
"."... | Return User object for a given Slack ID or name | [
"Return",
"User",
"object",
"for",
"a",
"given",
"Slack",
"ID",
"or",
"name"
] | 8eb8b0f14fe80740217ea0aaf6feb7f736bdf57f | https://github.com/vektorlab/slacksocket/blob/8eb8b0f14fe80740217ea0aaf6feb7f736bdf57f/slacksocket/webclient.py#L42-L46 | train |
vektorlab/slacksocket | slacksocket/webclient.py | WebClient.channel | def channel(self, match):
""" Return Channel object for a given Slack ID or name """
if len(match) == 9 and match[0] in ('C','G','D'):
return self._lookup(Channel, 'id', match)
return self._lookup(Channel, 'name', match) | python | def channel(self, match):
""" Return Channel object for a given Slack ID or name """
if len(match) == 9 and match[0] in ('C','G','D'):
return self._lookup(Channel, 'id', match)
return self._lookup(Channel, 'name', match) | [
"def",
"channel",
"(",
"self",
",",
"match",
")",
":",
"if",
"len",
"(",
"match",
")",
"==",
"9",
"and",
"match",
"[",
"0",
"]",
"in",
"(",
"'C'",
",",
"'G'",
",",
"'D'",
")",
":",
"return",
"self",
".",
"_lookup",
"(",
"Channel",
",",
"'id'",
... | Return Channel object for a given Slack ID or name | [
"Return",
"Channel",
"object",
"for",
"a",
"given",
"Slack",
"ID",
"or",
"name"
] | 8eb8b0f14fe80740217ea0aaf6feb7f736bdf57f | https://github.com/vektorlab/slacksocket/blob/8eb8b0f14fe80740217ea0aaf6feb7f736bdf57f/slacksocket/webclient.py#L48-L52 | train |
vektorlab/slacksocket | slacksocket/webclient.py | WebClient._refresh | def _refresh(self):
""" refresh internal directory cache """
log.debug('refreshing directory cache')
self._users.update(list(self._user_gen()))
self._channels.update(list(self._channel_gen())) | python | def _refresh(self):
""" refresh internal directory cache """
log.debug('refreshing directory cache')
self._users.update(list(self._user_gen()))
self._channels.update(list(self._channel_gen())) | [
"def",
"_refresh",
"(",
"self",
")",
":",
"log",
".",
"debug",
"(",
"'refreshing directory cache'",
")",
"self",
".",
"_users",
".",
"update",
"(",
"list",
"(",
"self",
".",
"_user_gen",
"(",
")",
")",
")",
"self",
".",
"_channels",
".",
"update",
"(",... | refresh internal directory cache | [
"refresh",
"internal",
"directory",
"cache"
] | 8eb8b0f14fe80740217ea0aaf6feb7f736bdf57f | https://github.com/vektorlab/slacksocket/blob/8eb8b0f14fe80740217ea0aaf6feb7f736bdf57f/slacksocket/webclient.py#L122-L126 | train |
vektorlab/slacksocket | slacksocket/webclient.py | Directory.match | def match(self, attr, val):
""" lookup object in directory with attribute matching value """
self._lock.acquire()
try:
for x in self:
if getattr(x, attr) == val:
return x
finally:
self._lock.release() | python | def match(self, attr, val):
""" lookup object in directory with attribute matching value """
self._lock.acquire()
try:
for x in self:
if getattr(x, attr) == val:
return x
finally:
self._lock.release() | [
"def",
"match",
"(",
"self",
",",
"attr",
",",
"val",
")",
":",
"self",
".",
"_lock",
".",
"acquire",
"(",
")",
"try",
":",
"for",
"x",
"in",
"self",
":",
"if",
"getattr",
"(",
"x",
",",
"attr",
")",
"==",
"val",
":",
"return",
"x",
"finally",
... | lookup object in directory with attribute matching value | [
"lookup",
"object",
"in",
"directory",
"with",
"attribute",
"matching",
"value"
] | 8eb8b0f14fe80740217ea0aaf6feb7f736bdf57f | https://github.com/vektorlab/slacksocket/blob/8eb8b0f14fe80740217ea0aaf6feb7f736bdf57f/slacksocket/webclient.py#L155-L163 | train |
SciTools/biggus | biggus/experimental/dask_engine.py | _groups_of_size | def _groups_of_size(iterable, n, fillvalue=None):
"""Collect data into fixed-length chunks or blocks."""
# _groups_of_size('ABCDEFG', 3, 'x') --> ABC DEF Gxx
args = [iter(iterable)] * n
return zip_longest(fillvalue=fillvalue, *args) | python | def _groups_of_size(iterable, n, fillvalue=None):
"""Collect data into fixed-length chunks or blocks."""
# _groups_of_size('ABCDEFG', 3, 'x') --> ABC DEF Gxx
args = [iter(iterable)] * n
return zip_longest(fillvalue=fillvalue, *args) | [
"def",
"_groups_of_size",
"(",
"iterable",
",",
"n",
",",
"fillvalue",
"=",
"None",
")",
":",
"# _groups_of_size('ABCDEFG', 3, 'x') --> ABC DEF Gxx",
"args",
"=",
"[",
"iter",
"(",
"iterable",
")",
"]",
"*",
"n",
"return",
"zip_longest",
"(",
"fillvalue",
"=",
... | Collect data into fixed-length chunks or blocks. | [
"Collect",
"data",
"into",
"fixed",
"-",
"length",
"chunks",
"or",
"blocks",
"."
] | 0a76fbe7806dd6295081cd399bcb76135d834d25 | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/experimental/dask_engine.py#L94-L98 | train |
SciTools/biggus | biggus/experimental/dask_engine.py | slice_repr | def slice_repr(slice_instance):
"""
Turn things like `slice(None, 2, -1)` into `:2:-1`.
"""
if not isinstance(slice_instance, slice):
raise TypeError('Unhandled type {}'.format(type(slice_instance)))
start = slice_instance.start or ''
stop = slice_instance.stop or ''
step = slice_in... | python | def slice_repr(slice_instance):
"""
Turn things like `slice(None, 2, -1)` into `:2:-1`.
"""
if not isinstance(slice_instance, slice):
raise TypeError('Unhandled type {}'.format(type(slice_instance)))
start = slice_instance.start or ''
stop = slice_instance.stop or ''
step = slice_in... | [
"def",
"slice_repr",
"(",
"slice_instance",
")",
":",
"if",
"not",
"isinstance",
"(",
"slice_instance",
",",
"slice",
")",
":",
"raise",
"TypeError",
"(",
"'Unhandled type {}'",
".",
"format",
"(",
"type",
"(",
"slice_instance",
")",
")",
")",
"start",
"=",
... | Turn things like `slice(None, 2, -1)` into `:2:-1`. | [
"Turn",
"things",
"like",
"slice",
"(",
"None",
"2",
"-",
"1",
")",
"into",
":",
"2",
":",
"-",
"1",
"."
] | 0a76fbe7806dd6295081cd399bcb76135d834d25 | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/experimental/dask_engine.py#L101-L119 | train |
SciTools/biggus | biggus/experimental/dask_engine.py | DaskGroup.biggus_chunk | def biggus_chunk(chunk_key, biggus_array, masked):
"""
A function that lazily evaluates a biggus.Chunk. This is useful for
passing through as a dask task so that we don't have to compute the
chunk in order to compute the graph.
"""
if masked:
array = biggus_a... | python | def biggus_chunk(chunk_key, biggus_array, masked):
"""
A function that lazily evaluates a biggus.Chunk. This is useful for
passing through as a dask task so that we don't have to compute the
chunk in order to compute the graph.
"""
if masked:
array = biggus_a... | [
"def",
"biggus_chunk",
"(",
"chunk_key",
",",
"biggus_array",
",",
"masked",
")",
":",
"if",
"masked",
":",
"array",
"=",
"biggus_array",
".",
"masked_array",
"(",
")",
"else",
":",
"array",
"=",
"biggus_array",
".",
"ndarray",
"(",
")",
"return",
"biggus"... | A function that lazily evaluates a biggus.Chunk. This is useful for
passing through as a dask task so that we don't have to compute the
chunk in order to compute the graph. | [
"A",
"function",
"that",
"lazily",
"evaluates",
"a",
"biggus",
".",
"Chunk",
".",
"This",
"is",
"useful",
"for",
"passing",
"through",
"as",
"a",
"dask",
"task",
"so",
"that",
"we",
"don",
"t",
"have",
"to",
"compute",
"the",
"chunk",
"in",
"order",
"t... | 0a76fbe7806dd6295081cd399bcb76135d834d25 | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/experimental/dask_engine.py#L128-L140 | train |
SciTools/biggus | biggus/experimental/dask_engine.py | DaskGroup._make_stream_handler_nodes | def _make_stream_handler_nodes(self, dsk_graph, array, iteration_order,
masked):
"""
Produce task graph entries for an array that comes from a biggus
StreamsHandler.
This is essentially every type of array that isn't already a thing on
disk/in-... | python | def _make_stream_handler_nodes(self, dsk_graph, array, iteration_order,
masked):
"""
Produce task graph entries for an array that comes from a biggus
StreamsHandler.
This is essentially every type of array that isn't already a thing on
disk/in-... | [
"def",
"_make_stream_handler_nodes",
"(",
"self",
",",
"dsk_graph",
",",
"array",
",",
"iteration_order",
",",
"masked",
")",
":",
"nodes",
"=",
"{",
"}",
"handler",
"=",
"array",
".",
"streams_handler",
"(",
"masked",
")",
"input_iteration_order",
"=",
"handl... | Produce task graph entries for an array that comes from a biggus
StreamsHandler.
This is essentially every type of array that isn't already a thing on
disk/in-memory. StreamsHandler arrays include all aggregations and
elementwise operations. | [
"Produce",
"task",
"graph",
"entries",
"for",
"an",
"array",
"that",
"comes",
"from",
"a",
"biggus",
"StreamsHandler",
"."
] | 0a76fbe7806dd6295081cd399bcb76135d834d25 | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/experimental/dask_engine.py#L160-L284 | train |
SciTools/biggus | biggus/experimental/dask_engine.py | DaskGroup.lazy_chunk_creator | def lazy_chunk_creator(name):
"""
Create a lazy chunk creating function with a nice name that is suitable
for representation in a dask graph.
"""
# TODO: Could this become a LazyChunk class?
def biggus_chunk(chunk_key, biggus_array, masked):
"""
A... | python | def lazy_chunk_creator(name):
"""
Create a lazy chunk creating function with a nice name that is suitable
for representation in a dask graph.
"""
# TODO: Could this become a LazyChunk class?
def biggus_chunk(chunk_key, biggus_array, masked):
"""
A... | [
"def",
"lazy_chunk_creator",
"(",
"name",
")",
":",
"# TODO: Could this become a LazyChunk class?",
"def",
"biggus_chunk",
"(",
"chunk_key",
",",
"biggus_array",
",",
"masked",
")",
":",
"\"\"\"\n A function that lazily evaluates a biggus.Chunk. This is useful for\n ... | Create a lazy chunk creating function with a nice name that is suitable
for representation in a dask graph. | [
"Create",
"a",
"lazy",
"chunk",
"creating",
"function",
"with",
"a",
"nice",
"name",
"that",
"is",
"suitable",
"for",
"representation",
"in",
"a",
"dask",
"graph",
"."
] | 0a76fbe7806dd6295081cd399bcb76135d834d25 | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/experimental/dask_engine.py#L287-L308 | train |
SciTools/biggus | biggus/experimental/dask_engine.py | DaskGroup._make_nodes | def _make_nodes(self, dsk_graph, array, iteration_order, masked,
top=False):
"""
Recursive function that returns the dask items for the given array.
NOTE: Currently assuming that all tasks are a tuple, with the second
item being the keys used to index the source of t... | python | def _make_nodes(self, dsk_graph, array, iteration_order, masked,
top=False):
"""
Recursive function that returns the dask items for the given array.
NOTE: Currently assuming that all tasks are a tuple, with the second
item being the keys used to index the source of t... | [
"def",
"_make_nodes",
"(",
"self",
",",
"dsk_graph",
",",
"array",
",",
"iteration_order",
",",
"masked",
",",
"top",
"=",
"False",
")",
":",
"cache_key",
"=",
"_array_id",
"(",
"array",
",",
"iteration_order",
",",
"masked",
")",
"# By the end of this functio... | Recursive function that returns the dask items for the given array.
NOTE: Currently assuming that all tasks are a tuple, with the second
item being the keys used to index the source of the respective input
array. | [
"Recursive",
"function",
"that",
"returns",
"the",
"dask",
"items",
"for",
"the",
"given",
"array",
"."
] | 0a76fbe7806dd6295081cd399bcb76135d834d25 | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/experimental/dask_engine.py#L310-L351 | train |
SciTools/biggus | biggus/experimental/key_grouper.py | group_keys | def group_keys(shape, *inputs_keys):
"""
Usecase: Two sets of chunks, one spans the whole of a dimension, the other
chunked it up. We need to know that we need to collect together the
chunked form, so that we can work with both sets at the same time.
Conceptually we have multiple source inputs, ea... | python | def group_keys(shape, *inputs_keys):
"""
Usecase: Two sets of chunks, one spans the whole of a dimension, the other
chunked it up. We need to know that we need to collect together the
chunked form, so that we can work with both sets at the same time.
Conceptually we have multiple source inputs, ea... | [
"def",
"group_keys",
"(",
"shape",
",",
"*",
"inputs_keys",
")",
":",
"# Store the result as a slice mapping to a subset of the inputs_keys. We",
"# start with the assumption that there will be only one group, and",
"# subdivide when we find this not to be the case.",
"ndim",
"=",
"len",... | Usecase: Two sets of chunks, one spans the whole of a dimension, the other
chunked it up. We need to know that we need to collect together the
chunked form, so that we can work with both sets at the same time.
Conceptually we have multiple source inputs, each with multiple key sets
for indexing.
... | [
"Usecase",
":",
"Two",
"sets",
"of",
"chunks",
"one",
"spans",
"the",
"whole",
"of",
"a",
"dimension",
"the",
"other",
"chunked",
"it",
"up",
".",
"We",
"need",
"to",
"know",
"that",
"we",
"need",
"to",
"collect",
"together",
"the",
"chunked",
"form",
... | 0a76fbe7806dd6295081cd399bcb76135d834d25 | https://github.com/SciTools/biggus/blob/0a76fbe7806dd6295081cd399bcb76135d834d25/biggus/experimental/key_grouper.py#L123-L182 | train |
secure-systems-lab/securesystemslib | securesystemslib/interface.py | get_password | def get_password(prompt='Password: ', confirm=False):
"""
<Purpose>
Return the password entered by the user. If 'confirm' is True, the user is
asked to enter the previously entered password once again. If they match,
the password is returned to the caller.
<Arguments>
prompt:
The text of ... | python | def get_password(prompt='Password: ', confirm=False):
"""
<Purpose>
Return the password entered by the user. If 'confirm' is True, the user is
asked to enter the previously entered password once again. If they match,
the password is returned to the caller.
<Arguments>
prompt:
The text of ... | [
"def",
"get_password",
"(",
"prompt",
"=",
"'Password: '",
",",
"confirm",
"=",
"False",
")",
":",
"# Are the arguments the expected type?",
"# If not, raise 'securesystemslib.exceptions.FormatError'.",
"securesystemslib",
".",
"formats",
".",
"TEXT_SCHEMA",
".",
"check_match... | <Purpose>
Return the password entered by the user. If 'confirm' is True, the user is
asked to enter the previously entered password once again. If they match,
the password is returned to the caller.
<Arguments>
prompt:
The text of the password prompt that is displayed to the user.
confir... | [
"<Purpose",
">",
"Return",
"the",
"password",
"entered",
"by",
"the",
"user",
".",
"If",
"confirm",
"is",
"True",
"the",
"user",
"is",
"asked",
"to",
"enter",
"the",
"previously",
"entered",
"password",
"once",
"again",
".",
"If",
"they",
"match",
"the",
... | beb3109d5bb462e5a60eed88fb40ed1167bd354e | https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/interface.py#L81-L125 | train |
secure-systems-lab/securesystemslib | securesystemslib/interface.py | generate_and_write_rsa_keypair | def generate_and_write_rsa_keypair(filepath=None, bits=DEFAULT_RSA_KEY_BITS,
password=None):
"""
<Purpose>
Generate an RSA key pair. The public portion of the generated RSA key is
saved to <'filepath'>.pub, whereas the private key portion is saved to
<'filepath'>. If no password is given, the user... | python | def generate_and_write_rsa_keypair(filepath=None, bits=DEFAULT_RSA_KEY_BITS,
password=None):
"""
<Purpose>
Generate an RSA key pair. The public portion of the generated RSA key is
saved to <'filepath'>.pub, whereas the private key portion is saved to
<'filepath'>. If no password is given, the user... | [
"def",
"generate_and_write_rsa_keypair",
"(",
"filepath",
"=",
"None",
",",
"bits",
"=",
"DEFAULT_RSA_KEY_BITS",
",",
"password",
"=",
"None",
")",
":",
"# Does 'bits' have the correct format?",
"# Raise 'securesystemslib.exceptions.FormatError' if there is a mismatch.",
"secures... | <Purpose>
Generate an RSA key pair. The public portion of the generated RSA key is
saved to <'filepath'>.pub, whereas the private key portion is saved to
<'filepath'>. If no password is given, the user is prompted for one. If
the 'password' is an empty string, the private key is saved unencrypted to
... | [
"<Purpose",
">",
"Generate",
"an",
"RSA",
"key",
"pair",
".",
"The",
"public",
"portion",
"of",
"the",
"generated",
"RSA",
"key",
"is",
"saved",
"to",
"<",
"filepath",
">",
".",
"pub",
"whereas",
"the",
"private",
"key",
"portion",
"is",
"saved",
"to",
... | beb3109d5bb462e5a60eed88fb40ed1167bd354e | https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/interface.py#L131-L234 | train |
secure-systems-lab/securesystemslib | securesystemslib/interface.py | import_rsa_privatekey_from_file | def import_rsa_privatekey_from_file(filepath, password=None,
scheme='rsassa-pss-sha256', prompt=False):
"""
<Purpose>
Import the PEM file in 'filepath' containing the private key.
If password is passed use passed password for decryption.
If prompt is True use entered password for decryption.
If... | python | def import_rsa_privatekey_from_file(filepath, password=None,
scheme='rsassa-pss-sha256', prompt=False):
"""
<Purpose>
Import the PEM file in 'filepath' containing the private key.
If password is passed use passed password for decryption.
If prompt is True use entered password for decryption.
If... | [
"def",
"import_rsa_privatekey_from_file",
"(",
"filepath",
",",
"password",
"=",
"None",
",",
"scheme",
"=",
"'rsassa-pss-sha256'",
",",
"prompt",
"=",
"False",
")",
":",
"# Does 'filepath' have the correct format?",
"# Ensure the arguments have the appropriate number of object... | <Purpose>
Import the PEM file in 'filepath' containing the private key.
If password is passed use passed password for decryption.
If prompt is True use entered password for decryption.
If no password is passed and either prompt is False or if the password
entered at the prompt is an empty string, o... | [
"<Purpose",
">",
"Import",
"the",
"PEM",
"file",
"in",
"filepath",
"containing",
"the",
"private",
"key",
"."
] | beb3109d5bb462e5a60eed88fb40ed1167bd354e | https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/interface.py#L239-L352 | train |
secure-systems-lab/securesystemslib | securesystemslib/interface.py | import_rsa_publickey_from_file | def import_rsa_publickey_from_file(filepath):
"""
<Purpose>
Import the RSA key stored in 'filepath'. The key object returned is in the
format 'securesystemslib.formats.RSAKEY_SCHEMA'. If the RSA PEM in
'filepath' contains a private key, it is discarded.
<Arguments>
filepath:
<filepath>.pu... | python | def import_rsa_publickey_from_file(filepath):
"""
<Purpose>
Import the RSA key stored in 'filepath'. The key object returned is in the
format 'securesystemslib.formats.RSAKEY_SCHEMA'. If the RSA PEM in
'filepath' contains a private key, it is discarded.
<Arguments>
filepath:
<filepath>.pu... | [
"def",
"import_rsa_publickey_from_file",
"(",
"filepath",
")",
":",
"# Does 'filepath' have the correct format?",
"# Ensure the arguments have the appropriate number of objects and object",
"# types, and that all dict keys are properly named.",
"# Raise 'securesystemslib.exceptions.FormatError' if... | <Purpose>
Import the RSA key stored in 'filepath'. The key object returned is in the
format 'securesystemslib.formats.RSAKEY_SCHEMA'. If the RSA PEM in
'filepath' contains a private key, it is discarded.
<Arguments>
filepath:
<filepath>.pub file, an RSA PEM file.
<Exceptions>
securesys... | [
"<Purpose",
">",
"Import",
"the",
"RSA",
"key",
"stored",
"in",
"filepath",
".",
"The",
"key",
"object",
"returned",
"is",
"in",
"the",
"format",
"securesystemslib",
".",
"formats",
".",
"RSAKEY_SCHEMA",
".",
"If",
"the",
"RSA",
"PEM",
"in",
"filepath",
"c... | beb3109d5bb462e5a60eed88fb40ed1167bd354e | https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/interface.py#L358-L402 | train |
secure-systems-lab/securesystemslib | securesystemslib/interface.py | generate_and_write_ed25519_keypair | def generate_and_write_ed25519_keypair(filepath=None, password=None):
"""
<Purpose>
Generate an Ed25519 keypair, where the encrypted key (using 'password' as
the passphrase) is saved to <'filepath'>. The public key portion of the
generated Ed25519 key is saved to <'filepath'>.pub. If the filepath is n... | python | def generate_and_write_ed25519_keypair(filepath=None, password=None):
"""
<Purpose>
Generate an Ed25519 keypair, where the encrypted key (using 'password' as
the passphrase) is saved to <'filepath'>. The public key portion of the
generated Ed25519 key is saved to <'filepath'>.pub. If the filepath is n... | [
"def",
"generate_and_write_ed25519_keypair",
"(",
"filepath",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"# Generate a new Ed25519 key object.",
"ed25519_key",
"=",
"securesystemslib",
".",
"keys",
".",
"generate_ed25519_key",
"(",
")",
"if",
"not",
"filepat... | <Purpose>
Generate an Ed25519 keypair, where the encrypted key (using 'password' as
the passphrase) is saved to <'filepath'>. The public key portion of the
generated Ed25519 key is saved to <'filepath'>.pub. If the filepath is not
given, the KEYID is used as the filename and the keypair saved to the
... | [
"<Purpose",
">",
"Generate",
"an",
"Ed25519",
"keypair",
"where",
"the",
"encrypted",
"key",
"(",
"using",
"password",
"as",
"the",
"passphrase",
")",
"is",
"saved",
"to",
"<",
"filepath",
">",
".",
"The",
"public",
"key",
"portion",
"of",
"the",
"generate... | beb3109d5bb462e5a60eed88fb40ed1167bd354e | https://github.com/secure-systems-lab/securesystemslib/blob/beb3109d5bb462e5a60eed88fb40ed1167bd354e/securesystemslib/interface.py#L408-L522 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.