repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
tonybaloney/requests-staticmock | requests_staticmock/responses.py | StaticResponseFactory.GoodResponse | def GoodResponse(body, request, status_code=None,
headers=None):
"""
Construct a Good HTTP response (defined in DEFAULT_GOOD_RESPONSE_CODE)
:param body: The body of the response
:type body: ``str``
:param request: The HTTP request
:type request: :... | python | def GoodResponse(body, request, status_code=None,
headers=None):
"""
Construct a Good HTTP response (defined in DEFAULT_GOOD_RESPONSE_CODE)
:param body: The body of the response
:type body: ``str``
:param request: The HTTP request
:type request: :... | [
"def",
"GoodResponse",
"(",
"body",
",",
"request",
",",
"status_code",
"=",
"None",
",",
"headers",
"=",
"None",
")",
":",
"response",
"=",
"Response",
"(",
")",
"response",
".",
"url",
"=",
"request",
".",
"url",
"response",
".",
"raw",
"=",
"BytesIO... | Construct a Good HTTP response (defined in DEFAULT_GOOD_RESPONSE_CODE)
:param body: The body of the response
:type body: ``str``
:param request: The HTTP request
:type request: :class:`requests.Request`
:param status_code: The return status code, defaults
to DEFA... | [
"Construct",
"a",
"Good",
"HTTP",
"response",
"(",
"defined",
"in",
"DEFAULT_GOOD_RESPONSE_CODE",
")"
] | train | https://github.com/tonybaloney/requests-staticmock/blob/431a68acc8e04eec42143bd1de43635cbc94fc3f/requests_staticmock/responses.py#L33-L68 |
tonybaloney/requests-staticmock | requests_staticmock/responses.py | StaticResponseFactory.BadResponse | def BadResponse(body, request, status_code=None,
headers=None):
"""
Construct a Bad HTTP response (defined in DEFAULT_BAD_RESPONSE_CODE)
:param body: The body of the response
:type body: ``str``
:param request: The HTTP request
:type request: :clas... | python | def BadResponse(body, request, status_code=None,
headers=None):
"""
Construct a Bad HTTP response (defined in DEFAULT_BAD_RESPONSE_CODE)
:param body: The body of the response
:type body: ``str``
:param request: The HTTP request
:type request: :clas... | [
"def",
"BadResponse",
"(",
"body",
",",
"request",
",",
"status_code",
"=",
"None",
",",
"headers",
"=",
"None",
")",
":",
"response",
"=",
"Response",
"(",
")",
"response",
".",
"url",
"=",
"request",
".",
"url",
"response",
".",
"raw",
"=",
"BytesIO"... | Construct a Bad HTTP response (defined in DEFAULT_BAD_RESPONSE_CODE)
:param body: The body of the response
:type body: ``str``
:param request: The HTTP request
:type request: :class:`requests.Request`
:param status_code: The return status code, defaults
to DEFAUL... | [
"Construct",
"a",
"Bad",
"HTTP",
"response",
"(",
"defined",
"in",
"DEFAULT_BAD_RESPONSE_CODE",
")"
] | train | https://github.com/tonybaloney/requests-staticmock/blob/431a68acc8e04eec42143bd1de43635cbc94fc3f/requests_staticmock/responses.py#L71-L106 |
Chilipp/psyplot | psyplot/warning.py | disable_warnings | def disable_warnings(critical=False):
"""Function that disables all warnings and all critical warnings (if
critical evaluates to True) related to the psyplot Module.
Please note that you can also configure the warnings via the
psyplot.warning logger (logging.getLogger(psyplot.warning))."""
warnings.... | python | def disable_warnings(critical=False):
"""Function that disables all warnings and all critical warnings (if
critical evaluates to True) related to the psyplot Module.
Please note that you can also configure the warnings via the
psyplot.warning logger (logging.getLogger(psyplot.warning))."""
warnings.... | [
"def",
"disable_warnings",
"(",
"critical",
"=",
"False",
")",
":",
"warnings",
".",
"filterwarnings",
"(",
"'ignore'",
",",
"'\\w'",
",",
"PsyPlotWarning",
",",
"'psyplot'",
",",
"0",
")",
"if",
"critical",
":",
"warnings",
".",
"filterwarnings",
"(",
"'ign... | Function that disables all warnings and all critical warnings (if
critical evaluates to True) related to the psyplot Module.
Please note that you can also configure the warnings via the
psyplot.warning logger (logging.getLogger(psyplot.warning)). | [
"Function",
"that",
"disables",
"all",
"warnings",
"and",
"all",
"critical",
"warnings",
"(",
"if",
"critical",
"evaluates",
"to",
"True",
")",
"related",
"to",
"the",
"psyplot",
"Module",
".",
"Please",
"note",
"that",
"you",
"can",
"also",
"configure",
"th... | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/warning.py#L56-L63 |
Chilipp/psyplot | psyplot/warning.py | warn | def warn(message, category=PsyPlotWarning, logger=None):
"""wrapper around the warnings.warn function for non-critical warnings.
logger may be a logging.Logger instance"""
if logger is not None:
message = "[Warning by %s]\n%s" % (logger.name, message)
warnings.warn(message, category, stacklevel=... | python | def warn(message, category=PsyPlotWarning, logger=None):
"""wrapper around the warnings.warn function for non-critical warnings.
logger may be a logging.Logger instance"""
if logger is not None:
message = "[Warning by %s]\n%s" % (logger.name, message)
warnings.warn(message, category, stacklevel=... | [
"def",
"warn",
"(",
"message",
",",
"category",
"=",
"PsyPlotWarning",
",",
"logger",
"=",
"None",
")",
":",
"if",
"logger",
"is",
"not",
"None",
":",
"message",
"=",
"\"[Warning by %s]\\n%s\"",
"%",
"(",
"logger",
".",
"name",
",",
"message",
")",
"warn... | wrapper around the warnings.warn function for non-critical warnings.
logger may be a logging.Logger instance | [
"wrapper",
"around",
"the",
"warnings",
".",
"warn",
"function",
"for",
"non",
"-",
"critical",
"warnings",
".",
"logger",
"may",
"be",
"a",
"logging",
".",
"Logger",
"instance"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/warning.py#L66-L71 |
Chilipp/psyplot | psyplot/warning.py | critical | def critical(message, category=PsyPlotCritical, logger=None):
"""wrapper around the warnings.warn function for critical warnings.
logger may be a logging.Logger instance"""
if logger is not None:
message = "[Critical warning by %s]\n%s" % (logger.name, message)
warnings.warn(message, category, s... | python | def critical(message, category=PsyPlotCritical, logger=None):
"""wrapper around the warnings.warn function for critical warnings.
logger may be a logging.Logger instance"""
if logger is not None:
message = "[Critical warning by %s]\n%s" % (logger.name, message)
warnings.warn(message, category, s... | [
"def",
"critical",
"(",
"message",
",",
"category",
"=",
"PsyPlotCritical",
",",
"logger",
"=",
"None",
")",
":",
"if",
"logger",
"is",
"not",
"None",
":",
"message",
"=",
"\"[Critical warning by %s]\\n%s\"",
"%",
"(",
"logger",
".",
"name",
",",
"message",
... | wrapper around the warnings.warn function for critical warnings.
logger may be a logging.Logger instance | [
"wrapper",
"around",
"the",
"warnings",
".",
"warn",
"function",
"for",
"critical",
"warnings",
".",
"logger",
"may",
"be",
"a",
"logging",
".",
"Logger",
"instance"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/warning.py#L74-L79 |
Chilipp/psyplot | psyplot/warning.py | customwarn | def customwarn(message, category, filename, lineno, *args, **kwargs):
"""Use the psyplot.warning logger for categories being out of
PsyPlotWarning and PsyPlotCritical and the default warnings.showwarning
function for all the others."""
if category is PsyPlotWarning:
logger.warning(warnings.forma... | python | def customwarn(message, category, filename, lineno, *args, **kwargs):
"""Use the psyplot.warning logger for categories being out of
PsyPlotWarning and PsyPlotCritical and the default warnings.showwarning
function for all the others."""
if category is PsyPlotWarning:
logger.warning(warnings.forma... | [
"def",
"customwarn",
"(",
"message",
",",
"category",
",",
"filename",
",",
"lineno",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"category",
"is",
"PsyPlotWarning",
":",
"logger",
".",
"warning",
"(",
"warnings",
".",
"formatwarning",
"("... | Use the psyplot.warning logger for categories being out of
PsyPlotWarning and PsyPlotCritical and the default warnings.showwarning
function for all the others. | [
"Use",
"the",
"psyplot",
".",
"warning",
"logger",
"for",
"categories",
"being",
"out",
"of",
"PsyPlotWarning",
"and",
"PsyPlotCritical",
"and",
"the",
"default",
"warnings",
".",
"showwarning",
"function",
"for",
"all",
"the",
"others",
"."
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/warning.py#L85-L97 |
Chilipp/psyplot | psyplot/config/logsetup.py | _get_home | def _get_home():
"""Find user's home directory if possible.
Otherwise, returns None.
:see: http://mail.python.org/pipermail/python-list/2005-February/325395.html
This function is copied from matplotlib version 1.4.3, Jan 2016
"""
try:
if six.PY2 and sys.platform == 'win32':
... | python | def _get_home():
"""Find user's home directory if possible.
Otherwise, returns None.
:see: http://mail.python.org/pipermail/python-list/2005-February/325395.html
This function is copied from matplotlib version 1.4.3, Jan 2016
"""
try:
if six.PY2 and sys.platform == 'win32':
... | [
"def",
"_get_home",
"(",
")",
":",
"try",
":",
"if",
"six",
".",
"PY2",
"and",
"sys",
".",
"platform",
"==",
"'win32'",
":",
"path",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"b\"~\"",
")",
".",
"decode",
"(",
"sys",
".",
"getfilesystemencoding... | Find user's home directory if possible.
Otherwise, returns None.
:see: http://mail.python.org/pipermail/python-list/2005-February/325395.html
This function is copied from matplotlib version 1.4.3, Jan 2016 | [
"Find",
"user",
"s",
"home",
"directory",
"if",
"possible",
".",
"Otherwise",
"returns",
"None",
"."
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/config/logsetup.py#L14-L37 |
tonybaloney/requests-staticmock | requests_staticmock/adapter.py | Adapter.match_url | def match_url(self, request):
"""
Match the request against a file in the adapter directory
:param request: The request
:type request: :class:`requests.Request`
:return: Path to the file
:rtype: ``str``
"""
parsed_url = urlparse(request.path_url)
... | python | def match_url(self, request):
"""
Match the request against a file in the adapter directory
:param request: The request
:type request: :class:`requests.Request`
:return: Path to the file
:rtype: ``str``
"""
parsed_url = urlparse(request.path_url)
... | [
"def",
"match_url",
"(",
"self",
",",
"request",
")",
":",
"parsed_url",
"=",
"urlparse",
"(",
"request",
".",
"path_url",
")",
"path_url",
"=",
"parsed_url",
".",
"path",
"query_params",
"=",
"parsed_url",
".",
"query",
"match",
"=",
"None",
"for",
"path"... | Match the request against a file in the adapter directory
:param request: The request
:type request: :class:`requests.Request`
:return: Path to the file
:rtype: ``str`` | [
"Match",
"the",
"request",
"against",
"a",
"file",
"in",
"the",
"adapter",
"directory"
] | train | https://github.com/tonybaloney/requests-staticmock/blob/431a68acc8e04eec42143bd1de43635cbc94fc3f/requests_staticmock/adapter.py#L50-L77 |
tonybaloney/requests-staticmock | requests_staticmock/adapter.py | Adapter._reindex | def _reindex(self):
"""
Create a case-insensitive index of the paths
"""
self.index = []
for path in self.paths:
target_path = os.path.normpath(os.path.join(BASE_PATH,
path))
for root, subdirs, files ... | python | def _reindex(self):
"""
Create a case-insensitive index of the paths
"""
self.index = []
for path in self.paths:
target_path = os.path.normpath(os.path.join(BASE_PATH,
path))
for root, subdirs, files ... | [
"def",
"_reindex",
"(",
"self",
")",
":",
"self",
".",
"index",
"=",
"[",
"]",
"for",
"path",
"in",
"self",
".",
"paths",
":",
"target_path",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"BASE_PATH",
",",
"pa... | Create a case-insensitive index of the paths | [
"Create",
"a",
"case",
"-",
"insensitive",
"index",
"of",
"the",
"paths"
] | train | https://github.com/tonybaloney/requests-staticmock/blob/431a68acc8e04eec42143bd1de43635cbc94fc3f/requests_staticmock/adapter.py#L109-L121 |
mfcloud/python-zvm-sdk | smtLayer/changeVM.py | add3390 | def add3390(rh):
"""
Adds a 3390 (ECKD) disk to a virtual machine's directory entry.
Input:
Request Handle with the following properties:
function - 'CHANGEVM'
subfunction - 'ADD3390'
userid - userid of the virtual machine
parms['diskPool'] - Disk po... | python | def add3390(rh):
"""
Adds a 3390 (ECKD) disk to a virtual machine's directory entry.
Input:
Request Handle with the following properties:
function - 'CHANGEVM'
subfunction - 'ADD3390'
userid - userid of the virtual machine
parms['diskPool'] - Disk po... | [
"def",
"add3390",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter changeVM.add3390\"",
")",
"results",
",",
"cyl",
"=",
"generalUtils",
".",
"cvtToCyl",
"(",
"rh",
",",
"rh",
".",
"parms",
"[",
"'diskSize'",
"]",
")",
"if",
"results",
"[",
... | Adds a 3390 (ECKD) disk to a virtual machine's directory entry.
Input:
Request Handle with the following properties:
function - 'CHANGEVM'
subfunction - 'ADD3390'
userid - userid of the virtual machine
parms['diskPool'] - Disk pool
parms['diskSize'... | [
"Adds",
"a",
"3390",
"(",
"ECKD",
")",
"disk",
"to",
"a",
"virtual",
"machine",
"s",
"directory",
"entry",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/changeVM.py#L140-L238 |
mfcloud/python-zvm-sdk | smtLayer/changeVM.py | add9336 | def add9336(rh):
"""
Adds a 9336 (FBA) disk to virtual machine's directory entry.
Input:
Request Handle with the following properties:
function - 'CHANGEVM'
subfunction - 'ADD9336'
userid - userid of the virtual machine
parms['diskPool'] - Disk pool
... | python | def add9336(rh):
"""
Adds a 9336 (FBA) disk to virtual machine's directory entry.
Input:
Request Handle with the following properties:
function - 'CHANGEVM'
subfunction - 'ADD9336'
userid - userid of the virtual machine
parms['diskPool'] - Disk pool
... | [
"def",
"add9336",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter changeVM.add9336\"",
")",
"results",
",",
"blocks",
"=",
"generalUtils",
".",
"cvtToBlocks",
"(",
"rh",
",",
"rh",
".",
"parms",
"[",
"'diskSize'",
"]",
")",
"if",
"results",
... | Adds a 9336 (FBA) disk to virtual machine's directory entry.
Input:
Request Handle with the following properties:
function - 'CHANGEVM'
subfunction - 'ADD9336'
userid - userid of the virtual machine
parms['diskPool'] - Disk pool
parms['diskSize'] ... | [
"Adds",
"a",
"9336",
"(",
"FBA",
")",
"disk",
"to",
"virtual",
"machine",
"s",
"directory",
"entry",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/changeVM.py#L241-L335 |
mfcloud/python-zvm-sdk | smtLayer/changeVM.py | dedicate | def dedicate(rh):
"""
Dedicate device.
Input:
Request Handle with the following properties:
function - 'CHANGEVM'
subfunction - 'DEDICATEDM'
userid - userid of the virtual machine
parms['vaddr'] - Virtual address
parms['raddr'] - Re... | python | def dedicate(rh):
"""
Dedicate device.
Input:
Request Handle with the following properties:
function - 'CHANGEVM'
subfunction - 'DEDICATEDM'
userid - userid of the virtual machine
parms['vaddr'] - Virtual address
parms['raddr'] - Re... | [
"def",
"dedicate",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter changeVM.dedicate\"",
")",
"parms",
"=",
"[",
"\"-T\"",
",",
"rh",
".",
"userid",
",",
"\"-v\"",
",",
"rh",
".",
"parms",
"[",
"'vaddr'",
"]",
",",
"\"-r\"",
",",
"rh",
"... | Dedicate device.
Input:
Request Handle with the following properties:
function - 'CHANGEVM'
subfunction - 'DEDICATEDM'
userid - userid of the virtual machine
parms['vaddr'] - Virtual address
parms['raddr'] - Real address
parms['mo... | [
"Dedicate",
"device",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/changeVM.py#L338-L395 |
mfcloud/python-zvm-sdk | smtLayer/changeVM.py | addAEMOD | def addAEMOD(rh):
"""
Send an Activation Modification Script to the virtual machine.
Input:
Request Handle with the following properties:
function - 'CHANGEVM'
subfunction - 'AEMOD'
userid - userid of the virtual machine
parms['aeScript'] - File spec... | python | def addAEMOD(rh):
"""
Send an Activation Modification Script to the virtual machine.
Input:
Request Handle with the following properties:
function - 'CHANGEVM'
subfunction - 'AEMOD'
userid - userid of the virtual machine
parms['aeScript'] - File spec... | [
"def",
"addAEMOD",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter changeVM.addAEMOD\"",
")",
"invokeScript",
"=",
"\"invokeScript.sh\"",
"trunkFile",
"=",
"\"aemod.doscript\"",
"fileClass",
"=",
"\"X\"",
"tempDir",
"=",
"tempfile",
".",
"mkdtemp",
"(... | Send an Activation Modification Script to the virtual machine.
Input:
Request Handle with the following properties:
function - 'CHANGEVM'
subfunction - 'AEMOD'
userid - userid of the virtual machine
parms['aeScript'] - File specification of the AE script
... | [
"Send",
"an",
"Activation",
"Modification",
"Script",
"to",
"the",
"virtual",
"machine",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/changeVM.py#L453-L516 |
mfcloud/python-zvm-sdk | smtLayer/changeVM.py | addLOADDEV | def addLOADDEV(rh):
"""
Sets the LOADDEV statement in the virtual machine's directory entry.
Input:
Request Handle with the following properties:
function - 'CHANGEVM'
subfunction - 'ADDLOADDEV'
userid - userid of the virtual machine
parms['boot'] ... | python | def addLOADDEV(rh):
"""
Sets the LOADDEV statement in the virtual machine's directory entry.
Input:
Request Handle with the following properties:
function - 'CHANGEVM'
subfunction - 'ADDLOADDEV'
userid - userid of the virtual machine
parms['boot'] ... | [
"def",
"addLOADDEV",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter changeVM.addLOADDEV\"",
")",
"# scpDataType and scpData must appear or disappear concurrently",
"if",
"(",
"'scpData'",
"in",
"rh",
".",
"parms",
"and",
"'scpDataType'",
"not",
"in",
"rh... | Sets the LOADDEV statement in the virtual machine's directory entry.
Input:
Request Handle with the following properties:
function - 'CHANGEVM'
subfunction - 'ADDLOADDEV'
userid - userid of the virtual machine
parms['boot'] - Boot program number
... | [
"Sets",
"the",
"LOADDEV",
"statement",
"in",
"the",
"virtual",
"machine",
"s",
"directory",
"entry",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/changeVM.py#L558-L663 |
mfcloud/python-zvm-sdk | smtLayer/changeVM.py | punchFile | def punchFile(rh):
"""
Punch a file to a virtual reader of the specified virtual machine.
Input:
Request Handle with the following properties:
function - 'CHANGEVM'
subfunction - 'PUNCHFILE'
userid - userid of the virtual machine
parms['class'] - Sp... | python | def punchFile(rh):
"""
Punch a file to a virtual reader of the specified virtual machine.
Input:
Request Handle with the following properties:
function - 'CHANGEVM'
subfunction - 'PUNCHFILE'
userid - userid of the virtual machine
parms['class'] - Sp... | [
"def",
"punchFile",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter changeVM.punchFile\"",
")",
"# Default spool class in \"A\" , if specified change to specified class",
"spoolClass",
"=",
"\"A\"",
"if",
"'class'",
"in",
"rh",
".",
"parms",
":",
"spoolClas... | Punch a file to a virtual reader of the specified virtual machine.
Input:
Request Handle with the following properties:
function - 'CHANGEVM'
subfunction - 'PUNCHFILE'
userid - userid of the virtual machine
parms['class'] - Spool class (optional)
... | [
"Punch",
"a",
"file",
"to",
"a",
"virtual",
"reader",
"of",
"the",
"specified",
"virtual",
"machine",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/changeVM.py#L795-L823 |
mfcloud/python-zvm-sdk | smtLayer/changeVM.py | purgeRDR | def purgeRDR(rh):
"""
Purge the reader belonging to the virtual machine.
Input:
Request Handle with the following properties:
function - 'CHANGEVM'
subfunction - 'PURGERDR'
userid - userid of the virtual machine
Output:
Request Handle updated with th... | python | def purgeRDR(rh):
"""
Purge the reader belonging to the virtual machine.
Input:
Request Handle with the following properties:
function - 'CHANGEVM'
subfunction - 'PURGERDR'
userid - userid of the virtual machine
Output:
Request Handle updated with th... | [
"def",
"purgeRDR",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter changeVM.purgeRDR\"",
")",
"results",
"=",
"purgeReader",
"(",
"rh",
")",
"rh",
".",
"updateResults",
"(",
"results",
")",
"rh",
".",
"printSysLog",
"(",
"\"Exit changeVM.purgeRDR,... | Purge the reader belonging to the virtual machine.
Input:
Request Handle with the following properties:
function - 'CHANGEVM'
subfunction - 'PURGERDR'
userid - userid of the virtual machine
Output:
Request Handle updated with the results.
Return code ... | [
"Purge",
"the",
"reader",
"belonging",
"to",
"the",
"virtual",
"machine",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/changeVM.py#L826-L846 |
mfcloud/python-zvm-sdk | smtLayer/changeVM.py | removeDisk | def removeDisk(rh):
"""
Remove a disk from a virtual machine.
Input:
Request Handle with the following properties:
function - 'CHANGEVM'
subfunction - 'REMOVEDISK'
userid - userid of the virtual machine
parms['vaddr'] - Virtual address... | python | def removeDisk(rh):
"""
Remove a disk from a virtual machine.
Input:
Request Handle with the following properties:
function - 'CHANGEVM'
subfunction - 'REMOVEDISK'
userid - userid of the virtual machine
parms['vaddr'] - Virtual address... | [
"def",
"removeDisk",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter changeVM.removeDisk\"",
")",
"results",
"=",
"{",
"'overallRC'",
":",
"0",
",",
"'rc'",
":",
"0",
",",
"'rs'",
":",
"0",
"}",
"# Is image logged on",
"loggedOn",
"=",
"False"... | Remove a disk from a virtual machine.
Input:
Request Handle with the following properties:
function - 'CHANGEVM'
subfunction - 'REMOVEDISK'
userid - userid of the virtual machine
parms['vaddr'] - Virtual address
Output:
Request Han... | [
"Remove",
"a",
"disk",
"from",
"a",
"virtual",
"machine",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/changeVM.py#L849-L920 |
mfcloud/python-zvm-sdk | smtLayer/changeVM.py | showInvLines | def showInvLines(rh):
"""
Produce help output related to command synopsis
Input:
Request Handle
"""
if rh.subfunction != '':
rh.printLn("N", "Usage:")
rh.printLn("N", " python " + rh.cmdName +
" ChangeVM <userid> add3390 <diskPool> <vAddr>")
rh.printLn("N", "... | python | def showInvLines(rh):
"""
Produce help output related to command synopsis
Input:
Request Handle
"""
if rh.subfunction != '':
rh.printLn("N", "Usage:")
rh.printLn("N", " python " + rh.cmdName +
" ChangeVM <userid> add3390 <diskPool> <vAddr>")
rh.printLn("N", "... | [
"def",
"showInvLines",
"(",
"rh",
")",
":",
"if",
"rh",
".",
"subfunction",
"!=",
"''",
":",
"rh",
".",
"printLn",
"(",
"\"N\"",
",",
"\"Usage:\"",
")",
"rh",
".",
"printLn",
"(",
"\"N\"",
",",
"\" python \"",
"+",
"rh",
".",
"cmdName",
"+",
"\" Cha... | Produce help output related to command synopsis
Input:
Request Handle | [
"Produce",
"help",
"output",
"related",
"to",
"command",
"synopsis"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/changeVM.py#L953-L995 |
mfcloud/python-zvm-sdk | smtLayer/changeVM.py | showOperandLines | def showOperandLines(rh):
"""
Produce help output related to operands.
Input:
Request Handle
"""
if rh.function == 'HELP':
rh.printLn("N", " For the ChangeVM function:")
else:
rh.printLn("N", "Sub-Functions(s):")
rh.printLn("N", " add3390 - Add a 3390 (EC... | python | def showOperandLines(rh):
"""
Produce help output related to operands.
Input:
Request Handle
"""
if rh.function == 'HELP':
rh.printLn("N", " For the ChangeVM function:")
else:
rh.printLn("N", "Sub-Functions(s):")
rh.printLn("N", " add3390 - Add a 3390 (EC... | [
"def",
"showOperandLines",
"(",
"rh",
")",
":",
"if",
"rh",
".",
"function",
"==",
"'HELP'",
":",
"rh",
".",
"printLn",
"(",
"\"N\"",
",",
"\" For the ChangeVM function:\"",
")",
"else",
":",
"rh",
".",
"printLn",
"(",
"\"N\"",
",",
"\"Sub-Functions(s):\"",... | Produce help output related to operands.
Input:
Request Handle | [
"Produce",
"help",
"output",
"related",
"to",
"operands",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/changeVM.py#L998-L1114 |
mfcloud/python-zvm-sdk | zvmconnector/connector.py | ZVMConnector.send_request | def send_request(self, api_name, *api_args, **api_kwargs):
"""Refer to SDK API documentation.
:param api_name: SDK API name
:param *api_args: SDK API sequence parameters
:param **api_kwargs: SDK API keyword parameters
"""
return self.conn.request(api_name, *... | python | def send_request(self, api_name, *api_args, **api_kwargs):
"""Refer to SDK API documentation.
:param api_name: SDK API name
:param *api_args: SDK API sequence parameters
:param **api_kwargs: SDK API keyword parameters
"""
return self.conn.request(api_name, *... | [
"def",
"send_request",
"(",
"self",
",",
"api_name",
",",
"*",
"api_args",
",",
"*",
"*",
"api_kwargs",
")",
":",
"return",
"self",
".",
"conn",
".",
"request",
"(",
"api_name",
",",
"*",
"api_args",
",",
"*",
"*",
"api_kwargs",
")"
] | Refer to SDK API documentation.
:param api_name: SDK API name
:param *api_args: SDK API sequence parameters
:param **api_kwargs: SDK API keyword parameters | [
"Refer",
"to",
"SDK",
"API",
"documentation",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmconnector/connector.py#L89-L96 |
mfcloud/python-zvm-sdk | smtLayer/getHost.py | getDiskPoolNames | def getDiskPoolNames(rh):
"""
Obtain the list of disk pools known to the directory manager.
Input:
Request Handle with the following properties:
function - 'GETHOST'
subfunction - 'DISKPOOLNAMES'
Output:
Request Handle updated with the results.
Return code -... | python | def getDiskPoolNames(rh):
"""
Obtain the list of disk pools known to the directory manager.
Input:
Request Handle with the following properties:
function - 'GETHOST'
subfunction - 'DISKPOOLNAMES'
Output:
Request Handle updated with the results.
Return code -... | [
"def",
"getDiskPoolNames",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter getHost.getDiskPoolNames\"",
")",
"parms",
"=",
"[",
"\"-q\"",
",",
"\"1\"",
",",
"\"-e\"",
",",
"\"3\"",
",",
"\"-T\"",
",",
"\"dummy\"",
"]",
"results",
"=",
"invokeSMC... | Obtain the list of disk pools known to the directory manager.
Input:
Request Handle with the following properties:
function - 'GETHOST'
subfunction - 'DISKPOOLNAMES'
Output:
Request Handle updated with the results.
Return code - 0: ok, non-zero: error | [
"Obtain",
"the",
"list",
"of",
"disk",
"pools",
"known",
"to",
"the",
"directory",
"manager",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/getHost.py#L110-L139 |
mfcloud/python-zvm-sdk | smtLayer/getHost.py | getDiskPoolSpace | def getDiskPoolSpace(rh):
"""
Obtain disk pool space information for all or a specific disk pool.
Input:
Request Handle with the following properties:
function - 'GETHOST'
subfunction - 'DISKPOOLSPACE'
parms['poolName'] - Name of the disk pool. Opti... | python | def getDiskPoolSpace(rh):
"""
Obtain disk pool space information for all or a specific disk pool.
Input:
Request Handle with the following properties:
function - 'GETHOST'
subfunction - 'DISKPOOLSPACE'
parms['poolName'] - Name of the disk pool. Opti... | [
"def",
"getDiskPoolSpace",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter getHost.getDiskPoolSpace\"",
")",
"results",
"=",
"{",
"'overallRC'",
":",
"0",
"}",
"if",
"'poolName'",
"not",
"in",
"rh",
".",
"parms",
":",
"poolNames",
"=",
"[",
"\... | Obtain disk pool space information for all or a specific disk pool.
Input:
Request Handle with the following properties:
function - 'GETHOST'
subfunction - 'DISKPOOLSPACE'
parms['poolName'] - Name of the disk pool. Optional,
... | [
"Obtain",
"disk",
"pool",
"space",
"information",
"for",
"all",
"or",
"a",
"specific",
"disk",
"pool",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/getHost.py#L142-L221 |
mfcloud/python-zvm-sdk | smtLayer/getHost.py | getFcpDevices | def getFcpDevices(rh):
"""
Lists the FCP device channels that are active, free, or offline.
Input:
Request Handle with the following properties:
function - 'GETHOST'
subfunction - 'FCPDEVICES'
Output:
Request Handle updated with the results.
Return code - 0:... | python | def getFcpDevices(rh):
"""
Lists the FCP device channels that are active, free, or offline.
Input:
Request Handle with the following properties:
function - 'GETHOST'
subfunction - 'FCPDEVICES'
Output:
Request Handle updated with the results.
Return code - 0:... | [
"def",
"getFcpDevices",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter getHost.getFcpDevices\"",
")",
"parms",
"=",
"[",
"\"-T\"",
",",
"\"dummy\"",
"]",
"results",
"=",
"invokeSMCLI",
"(",
"rh",
",",
"\"System_WWPN_Query\"",
",",
"parms",
")",
... | Lists the FCP device channels that are active, free, or offline.
Input:
Request Handle with the following properties:
function - 'GETHOST'
subfunction - 'FCPDEVICES'
Output:
Request Handle updated with the results.
Return code - 0: ok, non-zero: error | [
"Lists",
"the",
"FCP",
"device",
"channels",
"that",
"are",
"active",
"free",
"or",
"offline",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/getHost.py#L224-L251 |
mfcloud/python-zvm-sdk | smtLayer/getHost.py | getGeneralInfo | def getGeneralInfo(rh):
"""
Obtain general information about the host.
Input:
Request Handle with the following properties:
function - 'GETHOST'
subfunction - 'GENERAL'
Output:
Request Handle updated with the results.
Return code - 0: ok
Return code -... | python | def getGeneralInfo(rh):
"""
Obtain general information about the host.
Input:
Request Handle with the following properties:
function - 'GETHOST'
subfunction - 'GENERAL'
Output:
Request Handle updated with the results.
Return code - 0: ok
Return code -... | [
"def",
"getGeneralInfo",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter getHost.getGeneralInfo\"",
")",
"# Get host using VMCP",
"rh",
".",
"results",
"[",
"'overallRC'",
"]",
"=",
"0",
"cmd",
"=",
"[",
"\"sudo\"",
",",
"\"/sbin/vmcp\"",
",",
"\"... | Obtain general information about the host.
Input:
Request Handle with the following properties:
function - 'GETHOST'
subfunction - 'GENERAL'
Output:
Request Handle updated with the results.
Return code - 0: ok
Return code - 4: problem getting some info | [
"Obtain",
"general",
"information",
"about",
"the",
"host",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/getHost.py#L254-L431 |
mfcloud/python-zvm-sdk | smtLayer/getHost.py | parseCmdline | def parseCmdline(rh):
"""
Parse the request command input.
Input:
Request Handle
Output:
Request Handle updated with parsed input.
Return code - 0: ok, non-zero: error
"""
rh.printSysLog("Enter getHost.parseCmdline")
rh.userid = ''
if rh.totalParms >= 2:
... | python | def parseCmdline(rh):
"""
Parse the request command input.
Input:
Request Handle
Output:
Request Handle updated with parsed input.
Return code - 0: ok, non-zero: error
"""
rh.printSysLog("Enter getHost.parseCmdline")
rh.userid = ''
if rh.totalParms >= 2:
... | [
"def",
"parseCmdline",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter getHost.parseCmdline\"",
")",
"rh",
".",
"userid",
"=",
"''",
"if",
"rh",
".",
"totalParms",
">=",
"2",
":",
"rh",
".",
"subfunction",
"=",
"rh",
".",
"request",
"[",
"... | Parse the request command input.
Input:
Request Handle
Output:
Request Handle updated with parsed input.
Return code - 0: ok, non-zero: error | [
"Parse",
"the",
"request",
"command",
"input",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/getHost.py#L467-L501 |
mfcloud/python-zvm-sdk | smtLayer/getHost.py | showInvLines | def showInvLines(rh):
"""
Produce help output related to command synopsis
Input:
Request Handle
"""
if rh.subfunction != '':
rh.printLn("N", "Usage:")
rh.printLn("N", " python " + rh.cmdName + " GetHost " +
"diskpoolnames")
rh.printLn("N", " python " + rh.cmdName +... | python | def showInvLines(rh):
"""
Produce help output related to command synopsis
Input:
Request Handle
"""
if rh.subfunction != '':
rh.printLn("N", "Usage:")
rh.printLn("N", " python " + rh.cmdName + " GetHost " +
"diskpoolnames")
rh.printLn("N", " python " + rh.cmdName +... | [
"def",
"showInvLines",
"(",
"rh",
")",
":",
"if",
"rh",
".",
"subfunction",
"!=",
"''",
":",
"rh",
".",
"printLn",
"(",
"\"N\"",
",",
"\"Usage:\"",
")",
"rh",
".",
"printLn",
"(",
"\"N\"",
",",
"\" python \"",
"+",
"rh",
".",
"cmdName",
"+",
"\" Get... | Produce help output related to command synopsis
Input:
Request Handle | [
"Produce",
"help",
"output",
"related",
"to",
"command",
"synopsis"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/getHost.py#L504-L522 |
mfcloud/python-zvm-sdk | smtLayer/getHost.py | showOperandLines | def showOperandLines(rh):
"""
Produce help output related to operands.
Input:
Request Handle
"""
if rh.function == 'HELP':
rh.printLn("N", " For the GetHost function:")
else:
rh.printLn("N", "Sub-Functions(s):")
rh.printLn("N", " diskpoolnames - " +
"Re... | python | def showOperandLines(rh):
"""
Produce help output related to operands.
Input:
Request Handle
"""
if rh.function == 'HELP':
rh.printLn("N", " For the GetHost function:")
else:
rh.printLn("N", "Sub-Functions(s):")
rh.printLn("N", " diskpoolnames - " +
"Re... | [
"def",
"showOperandLines",
"(",
"rh",
")",
":",
"if",
"rh",
".",
"function",
"==",
"'HELP'",
":",
"rh",
".",
"printLn",
"(",
"\"N\"",
",",
"\" For the GetHost function:\"",
")",
"else",
":",
"rh",
".",
"printLn",
"(",
"\"N\"",
",",
"\"Sub-Functions(s):\"",
... | Produce help output related to operands.
Input:
Request Handle | [
"Produce",
"help",
"output",
"related",
"to",
"operands",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/getHost.py#L525-L553 |
mfcloud/python-zvm-sdk | smtLayer/deleteVM.py | deleteMachine | def deleteMachine(rh):
"""
Delete a virtual machine from the user directory.
Input:
Request Handle with the following properties:
function - 'DELETEVM'
subfunction - 'DIRECTORY'
userid - userid of the virtual machine to be deleted.
Output:
Request Ha... | python | def deleteMachine(rh):
"""
Delete a virtual machine from the user directory.
Input:
Request Handle with the following properties:
function - 'DELETEVM'
subfunction - 'DIRECTORY'
userid - userid of the virtual machine to be deleted.
Output:
Request Ha... | [
"def",
"deleteMachine",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter deleteVM.deleteMachine\"",
")",
"results",
"=",
"{",
"'overallRC'",
":",
"0",
",",
"'rc'",
":",
"0",
",",
"'rs'",
":",
"0",
"}",
"# Is image logged on ?",
"state",
"=",
"'... | Delete a virtual machine from the user directory.
Input:
Request Handle with the following properties:
function - 'DELETEVM'
subfunction - 'DIRECTORY'
userid - userid of the virtual machine to be deleted.
Output:
Request Handle updated with the results.
... | [
"Delete",
"a",
"virtual",
"machine",
"from",
"the",
"user",
"directory",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/deleteVM.py#L60-L128 |
mfcloud/python-zvm-sdk | smtLayer/powerVM.py | activate | def activate(rh):
"""
Activate a virtual machine.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'ON'
userid - userid of the virtual machine
parms['desiredState'] - Desired state. Optional,
... | python | def activate(rh):
"""
Activate a virtual machine.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'ON'
userid - userid of the virtual machine
parms['desiredState'] - Desired state. Optional,
... | [
"def",
"activate",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter powerVM.activate, userid: \"",
"+",
"rh",
".",
"userid",
")",
"parms",
"=",
"[",
"\"-T\"",
",",
"rh",
".",
"userid",
"]",
"smcliResults",
"=",
"invokeSMCLI",
"(",
"rh",
",",
... | Activate a virtual machine.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'ON'
userid - userid of the virtual machine
parms['desiredState'] - Desired state. Optional,
unless 'maxQu... | [
"Activate",
"a",
"virtual",
"machine",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/powerVM.py#L121-L183 |
mfcloud/python-zvm-sdk | smtLayer/powerVM.py | checkIsReachable | def checkIsReachable(rh):
"""
Check if a virtual machine is reachable.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'ISREACHABLE'
userid - userid of the virtual machine
Output:
Request Handle updated with th... | python | def checkIsReachable(rh):
"""
Check if a virtual machine is reachable.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'ISREACHABLE'
userid - userid of the virtual machine
Output:
Request Handle updated with th... | [
"def",
"checkIsReachable",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter powerVM.checkIsReachable, userid: \"",
"+",
"rh",
".",
"userid",
")",
"strCmd",
"=",
"\"echo 'ping'\"",
"results",
"=",
"execCmdThruIUCV",
"(",
"rh",
",",
"rh",
".",
"userid"... | Check if a virtual machine is reachable.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'ISREACHABLE'
userid - userid of the virtual machine
Output:
Request Handle updated with the results.
overallRC - 0: deter... | [
"Check",
"if",
"a",
"virtual",
"machine",
"is",
"reachable",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/powerVM.py#L186-L223 |
mfcloud/python-zvm-sdk | smtLayer/powerVM.py | deactivate | def deactivate(rh):
"""
Deactivate a virtual machine.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'OFF'
userid - userid of the virtual machine
parms['maxQueries'] - Maximum number of queries to issue.
... | python | def deactivate(rh):
"""
Deactivate a virtual machine.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'OFF'
userid - userid of the virtual machine
parms['maxQueries'] - Maximum number of queries to issue.
... | [
"def",
"deactivate",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter powerVM.deactivate, userid: \"",
"+",
"rh",
".",
"userid",
")",
"parms",
"=",
"[",
"\"-T\"",
",",
"rh",
".",
"userid",
",",
"\"-f\"",
",",
"\"IMMED\"",
"]",
"results",
"=",
... | Deactivate a virtual machine.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'OFF'
userid - userid of the virtual machine
parms['maxQueries'] - Maximum number of queries to issue.
... | [
"Deactivate",
"a",
"virtual",
"machine",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/powerVM.py#L226-L279 |
mfcloud/python-zvm-sdk | smtLayer/powerVM.py | getStatus | def getStatus(rh):
"""
Get the power (logon/off) status of a virtual machine.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'STATUS'
userid - userid of the virtual machine
Output:
Request Handle updated with ... | python | def getStatus(rh):
"""
Get the power (logon/off) status of a virtual machine.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'STATUS'
userid - userid of the virtual machine
Output:
Request Handle updated with ... | [
"def",
"getStatus",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter powerVM.getStatus, userid: \"",
"+",
"rh",
".",
"userid",
")",
"results",
"=",
"isLoggedOn",
"(",
"rh",
",",
"rh",
".",
"userid",
")",
"if",
"results",
"[",
"'overallRC'",
"]"... | Get the power (logon/off) status of a virtual machine.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'STATUS'
userid - userid of the virtual machine
Output:
Request Handle updated with the results.
results['ov... | [
"Get",
"the",
"power",
"(",
"logon",
"/",
"off",
")",
"status",
"of",
"a",
"virtual",
"machine",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/powerVM.py#L319-L354 |
mfcloud/python-zvm-sdk | smtLayer/powerVM.py | parseCmdline | def parseCmdline(rh):
"""
Parse the request command input.
Input:
Request Handle
Output:
Request Handle updated with parsed input.
Return code - 0: ok, non-zero: error
"""
rh.printSysLog("Enter powerVM.parseCmdline")
if rh.totalParms >= 2:
rh.userid = rh.requ... | python | def parseCmdline(rh):
"""
Parse the request command input.
Input:
Request Handle
Output:
Request Handle updated with parsed input.
Return code - 0: ok, non-zero: error
"""
rh.printSysLog("Enter powerVM.parseCmdline")
if rh.totalParms >= 2:
rh.userid = rh.requ... | [
"def",
"parseCmdline",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter powerVM.parseCmdline\"",
")",
"if",
"rh",
".",
"totalParms",
">=",
"2",
":",
"rh",
".",
"userid",
"=",
"rh",
".",
"request",
"[",
"1",
"]",
".",
"upper",
"(",
")",
"e... | Parse the request command input.
Input:
Request Handle
Output:
Request Handle updated with parsed input.
Return code - 0: ok, non-zero: error | [
"Parse",
"the",
"request",
"command",
"input",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/powerVM.py#L390-L484 |
mfcloud/python-zvm-sdk | smtLayer/powerVM.py | pause | def pause(rh):
"""
Pause a virtual machine.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'PAUSE'
userid - userid of the virtual machine
Output:
Request Handle updated with the results.
Return code - 0... | python | def pause(rh):
"""
Pause a virtual machine.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'PAUSE'
userid - userid of the virtual machine
Output:
Request Handle updated with the results.
Return code - 0... | [
"def",
"pause",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter powerVM.pause, userid: \"",
"+",
"rh",
".",
"userid",
")",
"parms",
"=",
"[",
"\"-T\"",
",",
"rh",
".",
"userid",
",",
"\"-k\"",
",",
"\"PAUSE=YES\"",
"]",
"results",
"=",
"invo... | Pause a virtual machine.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'PAUSE'
userid - userid of the virtual machine
Output:
Request Handle updated with the results.
Return code - 0: ok, non-zero: error | [
"Pause",
"a",
"virtual",
"machine",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/powerVM.py#L487-L512 |
mfcloud/python-zvm-sdk | smtLayer/powerVM.py | reboot | def reboot(rh):
"""
Reboot a virtual machine.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'REBOOT'
userid - userid of the virtual machine
parms['desiredState'] - Desired state. Optional, unless
... | python | def reboot(rh):
"""
Reboot a virtual machine.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'REBOOT'
userid - userid of the virtual machine
parms['desiredState'] - Desired state. Optional, unless
... | [
"def",
"reboot",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter powerVM.reboot, userid: \"",
"+",
"rh",
".",
"userid",
")",
"strCmd",
"=",
"\"shutdown -r now\"",
"results",
"=",
"execCmdThruIUCV",
"(",
"rh",
",",
"rh",
".",
"userid",
",",
"strC... | Reboot a virtual machine.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'REBOOT'
userid - userid of the virtual machine
parms['desiredState'] - Desired state. Optional, unless
'max... | [
"Reboot",
"a",
"virtual",
"machine",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/powerVM.py#L515-L567 |
mfcloud/python-zvm-sdk | smtLayer/powerVM.py | reset | def reset(rh):
"""
Reset a virtual machine.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'RESET'
userid - userid of the virtual machine
parms['maxQueries'] - Maximum number of queries to issue.
... | python | def reset(rh):
"""
Reset a virtual machine.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'RESET'
userid - userid of the virtual machine
parms['maxQueries'] - Maximum number of queries to issue.
... | [
"def",
"reset",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter powerVM.reset, userid: \"",
"+",
"rh",
".",
"userid",
")",
"# Log off the user",
"parms",
"=",
"[",
"\"-T\"",
",",
"rh",
".",
"userid",
"]",
"results",
"=",
"invokeSMCLI",
"(",
"r... | Reset a virtual machine.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'RESET'
userid - userid of the virtual machine
parms['maxQueries'] - Maximum number of queries to issue.
Op... | [
"Reset",
"a",
"virtual",
"machine",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/powerVM.py#L570-L644 |
mfcloud/python-zvm-sdk | smtLayer/powerVM.py | softDeactivate | def softDeactivate(rh):
"""
Deactivate a virtual machine by first shutting down Linux and
then log it off.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'SOFTOFF'
userid - userid of the virtual machine
parm... | python | def softDeactivate(rh):
"""
Deactivate a virtual machine by first shutting down Linux and
then log it off.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'SOFTOFF'
userid - userid of the virtual machine
parm... | [
"def",
"softDeactivate",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter powerVM.softDeactivate, userid: \"",
"+",
"rh",
".",
"userid",
")",
"strCmd",
"=",
"\"echo 'ping'\"",
"iucvResults",
"=",
"execCmdThruIUCV",
"(",
"rh",
",",
"rh",
".",
"userid"... | Deactivate a virtual machine by first shutting down Linux and
then log it off.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'SOFTOFF'
userid - userid of the virtual machine
parms['maxQueries'] - Maximum number... | [
"Deactivate",
"a",
"virtual",
"machine",
"by",
"first",
"shutting",
"down",
"Linux",
"and",
"then",
"log",
"it",
"off",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/powerVM.py#L743-L820 |
mfcloud/python-zvm-sdk | smtLayer/powerVM.py | wait | def wait(rh):
"""
Wait for the virtual machine to go into the specified state.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'WAIT'
userid - userid of the virtual machine
parms['desiredState'] - Desired state... | python | def wait(rh):
"""
Wait for the virtual machine to go into the specified state.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'WAIT'
userid - userid of the virtual machine
parms['desiredState'] - Desired state... | [
"def",
"wait",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter powerVM.wait, userid: \"",
"+",
"rh",
".",
"userid",
")",
"if",
"(",
"rh",
".",
"parms",
"[",
"'desiredState'",
"]",
"==",
"'off'",
"or",
"rh",
".",
"parms",
"[",
"'desiredState'... | Wait for the virtual machine to go into the specified state.
Input:
Request Handle with the following properties:
function - 'POWERVM'
subfunction - 'WAIT'
userid - userid of the virtual machine
parms['desiredState'] - Desired state
parms['maxQueri... | [
"Wait",
"for",
"the",
"virtual",
"machine",
"to",
"go",
"into",
"the",
"specified",
"state",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/powerVM.py#L853-L896 |
mfcloud/python-zvm-sdk | zvmconnector/socketclient.py | SDKSocketClient.call | def call(self, func, *api_args, **api_kwargs):
"""Send API call to SDK server and return results"""
if not isinstance(func, str) or (func == ''):
msg = ('Invalid input for API name, should be a'
'string, type: %s specified.') % type(func)
return self._construct... | python | def call(self, func, *api_args, **api_kwargs):
"""Send API call to SDK server and return results"""
if not isinstance(func, str) or (func == ''):
msg = ('Invalid input for API name, should be a'
'string, type: %s specified.') % type(func)
return self._construct... | [
"def",
"call",
"(",
"self",
",",
"func",
",",
"*",
"api_args",
",",
"*",
"*",
"api_kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"func",
",",
"str",
")",
"or",
"(",
"func",
"==",
"''",
")",
":",
"msg",
"=",
"(",
"'Invalid input for API name, sho... | Send API call to SDK server and return results | [
"Send",
"API",
"call",
"to",
"SDK",
"server",
"and",
"return",
"results"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmconnector/socketclient.py#L64-L141 |
mfcloud/python-zvm-sdk | zvmsdk/sdkserver.py | SDKServer.send_results | def send_results(self, client, addr, results):
""" send back results to client in the json format of:
{'overallRC': x, 'modID': x, 'rc': x, 'rs': x, 'errmsg': 'msg',
'output': 'out'}
"""
json_results = json.dumps(results)
json_results = json_results.encode()
sen... | python | def send_results(self, client, addr, results):
""" send back results to client in the json format of:
{'overallRC': x, 'modID': x, 'rc': x, 'rs': x, 'errmsg': 'msg',
'output': 'out'}
"""
json_results = json.dumps(results)
json_results = json_results.encode()
sen... | [
"def",
"send_results",
"(",
"self",
",",
"client",
",",
"addr",
",",
"results",
")",
":",
"json_results",
"=",
"json",
".",
"dumps",
"(",
"results",
")",
"json_results",
"=",
"json_results",
".",
"encode",
"(",
")",
"sent",
"=",
"0",
"total_len",
"=",
... | send back results to client in the json format of:
{'overallRC': x, 'modID': x, 'rc': x, 'rs': x, 'errmsg': 'msg',
'output': 'out'} | [
"send",
"back",
"results",
"to",
"client",
"in",
"the",
"json",
"format",
"of",
":",
"{",
"overallRC",
":",
"x",
"modID",
":",
"x",
"rc",
":",
"x",
"rs",
":",
"x",
"errmsg",
":",
"msg",
"output",
":",
"out",
"}"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/sdkserver.py#L87-L109 |
mfcloud/python-zvm-sdk | zvmsdk/sdkserver.py | SDKServer.serve_API | def serve_API(self, client, addr):
""" Read client request and call target SDK API"""
self.log_debug("(%s:%s) Handling new request from client." %
(addr[0], addr[1]))
results = None
try:
data = client.recv(4096)
data = bytes.decode(data)
... | python | def serve_API(self, client, addr):
""" Read client request and call target SDK API"""
self.log_debug("(%s:%s) Handling new request from client." %
(addr[0], addr[1]))
results = None
try:
data = client.recv(4096)
data = bytes.decode(data)
... | [
"def",
"serve_API",
"(",
"self",
",",
"client",
",",
"addr",
")",
":",
"self",
".",
"log_debug",
"(",
"\"(%s:%s) Handling new request from client.\"",
"%",
"(",
"addr",
"[",
"0",
"]",
",",
"addr",
"[",
"1",
"]",
")",
")",
"results",
"=",
"None",
"try",
... | Read client request and call target SDK API | [
"Read",
"client",
"request",
"and",
"call",
"target",
"SDK",
"API"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/sdkserver.py#L111-L197 |
mfcloud/python-zvm-sdk | zvmsdk/sdkwsgi/handler.py | dispatch | def dispatch(environ, start_response, mapper):
"""Find a matching route for the current request.
:raises: 404(not found) if no match request
405(method not allowed) if route exist but
method not provided.
"""
result = mapper.match(environ=environ)
if result is None:
... | python | def dispatch(environ, start_response, mapper):
"""Find a matching route for the current request.
:raises: 404(not found) if no match request
405(method not allowed) if route exist but
method not provided.
"""
result = mapper.match(environ=environ)
if result is None:
... | [
"def",
"dispatch",
"(",
"environ",
",",
"start_response",
",",
"mapper",
")",
":",
"result",
"=",
"mapper",
".",
"match",
"(",
"environ",
"=",
"environ",
")",
"if",
"result",
"is",
"None",
":",
"info",
"=",
"environ",
".",
"get",
"(",
"'PATH_INFO'",
",... | Find a matching route for the current request.
:raises: 404(not found) if no match request
405(method not allowed) if route exist but
method not provided. | [
"Find",
"a",
"matching",
"route",
"for",
"the",
"current",
"request",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/sdkwsgi/handler.py#L125-L142 |
mfcloud/python-zvm-sdk | zvmsdk/sdkwsgi/handler.py | handle_not_allowed | def handle_not_allowed(environ, start_response):
"""Return a 405 response when method is not allowed.
If _methods are in routing_args, send an allow header listing
the methods that are possible on the provided URL.
"""
_methods = util.wsgi_path_item(environ, '_methods')
headers = {}
if _met... | python | def handle_not_allowed(environ, start_response):
"""Return a 405 response when method is not allowed.
If _methods are in routing_args, send an allow header listing
the methods that are possible on the provided URL.
"""
_methods = util.wsgi_path_item(environ, '_methods')
headers = {}
if _met... | [
"def",
"handle_not_allowed",
"(",
"environ",
",",
"start_response",
")",
":",
"_methods",
"=",
"util",
".",
"wsgi_path_item",
"(",
"environ",
",",
"'_methods'",
")",
"headers",
"=",
"{",
"}",
"if",
"_methods",
":",
"headers",
"[",
"'allow'",
"]",
"=",
"str... | Return a 405 response when method is not allowed.
If _methods are in routing_args, send an allow header listing
the methods that are possible on the provided URL. | [
"Return",
"a",
"405",
"response",
"when",
"method",
"is",
"not",
"allowed",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/sdkwsgi/handler.py#L145-L157 |
mfcloud/python-zvm-sdk | zvmsdk/sdkwsgi/handler.py | make_map | def make_map(declarations):
"""Process route declarations to create a Route Mapper."""
mapper = routes.Mapper()
for route, methods in ROUTE_LIST:
allowed_methods = []
for method, func in methods.items():
mapper.connect(route, action=func,
conditions=dic... | python | def make_map(declarations):
"""Process route declarations to create a Route Mapper."""
mapper = routes.Mapper()
for route, methods in ROUTE_LIST:
allowed_methods = []
for method, func in methods.items():
mapper.connect(route, action=func,
conditions=dic... | [
"def",
"make_map",
"(",
"declarations",
")",
":",
"mapper",
"=",
"routes",
".",
"Mapper",
"(",
")",
"for",
"route",
",",
"methods",
"in",
"ROUTE_LIST",
":",
"allowed_methods",
"=",
"[",
"]",
"for",
"method",
",",
"func",
"in",
"methods",
".",
"items",
... | Process route declarations to create a Route Mapper. | [
"Process",
"route",
"declarations",
"to",
"create",
"a",
"Route",
"Mapper",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/sdkwsgi/handler.py#L160-L172 |
mfcloud/python-zvm-sdk | zvmsdk/dist.py | rhel._offline_fcp_device | def _offline_fcp_device(self, fcp, target_wwpn, target_lun, multipath):
"""rhel offline zfcp. sampe to all rhel distro."""
offline_dev = 'chccwdev -d %s' % fcp
delete_records = self._delete_zfcp_config_records(fcp,
target_wwpn,
... | python | def _offline_fcp_device(self, fcp, target_wwpn, target_lun, multipath):
"""rhel offline zfcp. sampe to all rhel distro."""
offline_dev = 'chccwdev -d %s' % fcp
delete_records = self._delete_zfcp_config_records(fcp,
target_wwpn,
... | [
"def",
"_offline_fcp_device",
"(",
"self",
",",
"fcp",
",",
"target_wwpn",
",",
"target_lun",
",",
"multipath",
")",
":",
"offline_dev",
"=",
"'chccwdev -d %s'",
"%",
"fcp",
"delete_records",
"=",
"self",
".",
"_delete_zfcp_config_records",
"(",
"fcp",
",",
"tar... | rhel offline zfcp. sampe to all rhel distro. | [
"rhel",
"offline",
"zfcp",
".",
"sampe",
"to",
"all",
"rhel",
"distro",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/dist.py#L576-L583 |
mfcloud/python-zvm-sdk | zvmsdk/dist.py | rhel._delete_zfcp_config_records | def _delete_zfcp_config_records(self, fcp, target_wwpn, target_lun):
"""rhel"""
device = '0.0.%s' % fcp
data = {'wwpn': target_wwpn, 'lun': target_lun,
'device': device, 'zfcpConf': '/etc/zfcp.conf'}
delete_records_cmd = ('sed -i -e '
'\"/%(d... | python | def _delete_zfcp_config_records(self, fcp, target_wwpn, target_lun):
"""rhel"""
device = '0.0.%s' % fcp
data = {'wwpn': target_wwpn, 'lun': target_lun,
'device': device, 'zfcpConf': '/etc/zfcp.conf'}
delete_records_cmd = ('sed -i -e '
'\"/%(d... | [
"def",
"_delete_zfcp_config_records",
"(",
"self",
",",
"fcp",
",",
"target_wwpn",
",",
"target_lun",
")",
":",
"device",
"=",
"'0.0.%s'",
"%",
"fcp",
"data",
"=",
"{",
"'wwpn'",
":",
"target_wwpn",
",",
"'lun'",
":",
"target_lun",
",",
"'device'",
":",
"d... | rhel | [
"rhel"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/dist.py#L606-L614 |
mfcloud/python-zvm-sdk | zvmsdk/dist.py | rhel._get_source_device_path | def _get_source_device_path(self, fcp, target_wwpn, target_lun):
"""rhel"""
device = '0.0.%s' % fcp
data = {'device': device, 'wwpn': target_wwpn, 'lun': target_lun}
var_source_device = ('SourceDevice="/dev/disk/by-path/ccw-%(device)s-'
'zfcp-%(wwpn)s:%(lun)s... | python | def _get_source_device_path(self, fcp, target_wwpn, target_lun):
"""rhel"""
device = '0.0.%s' % fcp
data = {'device': device, 'wwpn': target_wwpn, 'lun': target_lun}
var_source_device = ('SourceDevice="/dev/disk/by-path/ccw-%(device)s-'
'zfcp-%(wwpn)s:%(lun)s... | [
"def",
"_get_source_device_path",
"(",
"self",
",",
"fcp",
",",
"target_wwpn",
",",
"target_lun",
")",
":",
"device",
"=",
"'0.0.%s'",
"%",
"fcp",
"data",
"=",
"{",
"'device'",
":",
"device",
",",
"'wwpn'",
":",
"target_wwpn",
",",
"'lun'",
":",
"target_lu... | rhel | [
"rhel"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/dist.py#L616-L622 |
mfcloud/python-zvm-sdk | zvmsdk/dist.py | rhel6._set_sysfs | def _set_sysfs(self, fcp, target_wwpn, target_lun):
"""rhel6 set WWPN and LUN in sysfs"""
device = '0.0.%s' % fcp
port_add = "echo '%s' > " % target_wwpn
port_add += "/sys/bus/ccw/drivers/zfcp/%s/port_add" % device
unit_add = "echo '%s' > " % target_lun
unit_add += "/sys/... | python | def _set_sysfs(self, fcp, target_wwpn, target_lun):
"""rhel6 set WWPN and LUN in sysfs"""
device = '0.0.%s' % fcp
port_add = "echo '%s' > " % target_wwpn
port_add += "/sys/bus/ccw/drivers/zfcp/%s/port_add" % device
unit_add = "echo '%s' > " % target_lun
unit_add += "/sys/... | [
"def",
"_set_sysfs",
"(",
"self",
",",
"fcp",
",",
"target_wwpn",
",",
"target_lun",
")",
":",
"device",
"=",
"'0.0.%s'",
"%",
"fcp",
"port_add",
"=",
"\"echo '%s' > \"",
"%",
"target_wwpn",
"port_add",
"+=",
"\"/sys/bus/ccw/drivers/zfcp/%s/port_add\"",
"%",
"devi... | rhel6 set WWPN and LUN in sysfs | [
"rhel6",
"set",
"WWPN",
"and",
"LUN",
"in",
"sysfs"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/dist.py#L679-L688 |
mfcloud/python-zvm-sdk | zvmsdk/dist.py | rhel6._set_zfcp_config_files | def _set_zfcp_config_files(self, fcp, target_wwpn, target_lun):
"""rhel6 set WWPN and LUN in configuration files"""
device = '0.0.%s' % fcp
set_zfcp_conf = 'echo "%(device)s %(wwpn)s %(lun)s" >> /etc/zfcp.conf'\
% {'device': device, 'wwpn': target_wwpn,
... | python | def _set_zfcp_config_files(self, fcp, target_wwpn, target_lun):
"""rhel6 set WWPN and LUN in configuration files"""
device = '0.0.%s' % fcp
set_zfcp_conf = 'echo "%(device)s %(wwpn)s %(lun)s" >> /etc/zfcp.conf'\
% {'device': device, 'wwpn': target_wwpn,
... | [
"def",
"_set_zfcp_config_files",
"(",
"self",
",",
"fcp",
",",
"target_wwpn",
",",
"target_lun",
")",
":",
"device",
"=",
"'0.0.%s'",
"%",
"fcp",
"set_zfcp_conf",
"=",
"'echo \"%(device)s %(wwpn)s %(lun)s\" >> /etc/zfcp.conf'",
"%",
"{",
"'device'",
":",
"device",
"... | rhel6 set WWPN and LUN in configuration files | [
"rhel6",
"set",
"WWPN",
"and",
"LUN",
"in",
"configuration",
"files"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/dist.py#L690-L699 |
mfcloud/python-zvm-sdk | zvmsdk/dist.py | rhel7._set_sysfs | def _set_sysfs(self, fcp, target_wwpn, target_lun):
"""rhel7 set WWPN and LUN in sysfs"""
device = '0.0.%s' % fcp
unit_add = "echo '%s' > " % target_lun
unit_add += "/sys/bus/ccw/drivers/zfcp/%(device)s/%(wwpn)s/unit_add\n"\
% {'device': device, 'wwpn': target_wwpn}
... | python | def _set_sysfs(self, fcp, target_wwpn, target_lun):
"""rhel7 set WWPN and LUN in sysfs"""
device = '0.0.%s' % fcp
unit_add = "echo '%s' > " % target_lun
unit_add += "/sys/bus/ccw/drivers/zfcp/%(device)s/%(wwpn)s/unit_add\n"\
% {'device': device, 'wwpn': target_wwpn}
... | [
"def",
"_set_sysfs",
"(",
"self",
",",
"fcp",
",",
"target_wwpn",
",",
"target_lun",
")",
":",
"device",
"=",
"'0.0.%s'",
"%",
"fcp",
"unit_add",
"=",
"\"echo '%s' > \"",
"%",
"target_lun",
"unit_add",
"+=",
"\"/sys/bus/ccw/drivers/zfcp/%(device)s/%(wwpn)s/unit_add\\n... | rhel7 set WWPN and LUN in sysfs | [
"rhel7",
"set",
"WWPN",
"and",
"LUN",
"in",
"sysfs"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/dist.py#L769-L775 |
mfcloud/python-zvm-sdk | zvmsdk/dist.py | sles._get_udev_rules | def _get_udev_rules(self, channel_read, channel_write, channel_data):
"""construct udev rules info."""
sub_str = '%(read)s %%k %(read)s %(write)s %(data)s qeth' % {
'read': channel_read,
'read': channel_read,
... | python | def _get_udev_rules(self, channel_read, channel_write, channel_data):
"""construct udev rules info."""
sub_str = '%(read)s %%k %(read)s %(write)s %(data)s qeth' % {
'read': channel_read,
'read': channel_read,
... | [
"def",
"_get_udev_rules",
"(",
"self",
",",
"channel_read",
",",
"channel_write",
",",
"channel_data",
")",
":",
"sub_str",
"=",
"'%(read)s %%k %(read)s %(write)s %(data)s qeth'",
"%",
"{",
"'read'",
":",
"channel_read",
",",
"'read'",
":",
"channel_read",
",",
"'wr... | construct udev rules info. | [
"construct",
"udev",
"rules",
"info",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/dist.py#L865-L916 |
mfcloud/python-zvm-sdk | zvmsdk/dist.py | sles._delete_vdev_info | def _delete_vdev_info(self, vdev):
"""handle udev rules file."""
vdev = vdev.lower()
rules_file_name = '/etc/udev/rules.d/51-qeth-0.0.%s.rules' % vdev
cmd = 'rm -f %s\n' % rules_file_name
address = '0.0.%s' % str(vdev).zfill(4)
udev_file_name = '/etc/udev/rules.d/70-pers... | python | def _delete_vdev_info(self, vdev):
"""handle udev rules file."""
vdev = vdev.lower()
rules_file_name = '/etc/udev/rules.d/51-qeth-0.0.%s.rules' % vdev
cmd = 'rm -f %s\n' % rules_file_name
address = '0.0.%s' % str(vdev).zfill(4)
udev_file_name = '/etc/udev/rules.d/70-pers... | [
"def",
"_delete_vdev_info",
"(",
"self",
",",
"vdev",
")",
":",
"vdev",
"=",
"vdev",
".",
"lower",
"(",
")",
"rules_file_name",
"=",
"'/etc/udev/rules.d/51-qeth-0.0.%s.rules'",
"%",
"vdev",
"cmd",
"=",
"'rm -f %s\\n'",
"%",
"rules_file_name",
"address",
"=",
"'0... | handle udev rules file. | [
"handle",
"udev",
"rules",
"file",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/dist.py#L956-L967 |
mfcloud/python-zvm-sdk | zvmsdk/dist.py | sles._set_zfcp_config_files | def _set_zfcp_config_files(self, fcp, target_wwpn, target_lun):
"""sles set WWPN and LUN in configuration files"""
device = '0.0.%s' % fcp
# host config
host_config = '/sbin/zfcp_host_configure %s 1' % device
# disk config
disk_config = '/sbin/zfcp_disk_configure ' +\
... | python | def _set_zfcp_config_files(self, fcp, target_wwpn, target_lun):
"""sles set WWPN and LUN in configuration files"""
device = '0.0.%s' % fcp
# host config
host_config = '/sbin/zfcp_host_configure %s 1' % device
# disk config
disk_config = '/sbin/zfcp_disk_configure ' +\
... | [
"def",
"_set_zfcp_config_files",
"(",
"self",
",",
"fcp",
",",
"target_wwpn",
",",
"target_lun",
")",
":",
"device",
"=",
"'0.0.%s'",
"%",
"fcp",
"# host config",
"host_config",
"=",
"'/sbin/zfcp_host_configure %s 1'",
"%",
"device",
"# disk config",
"disk_config",
... | sles set WWPN and LUN in configuration files | [
"sles",
"set",
"WWPN",
"and",
"LUN",
"in",
"configuration",
"files"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/dist.py#L985-L1029 |
mfcloud/python-zvm-sdk | zvmsdk/dist.py | sles._set_zfcp_multipath | def _set_zfcp_multipath(self):
"""sles"""
# modprobe DM multipath kernel module
modprobe = 'modprobe dm_multipath'
conf_file = '#blacklist {\n'
conf_file += '#\tdevnode \\"*\\"\n'
conf_file += '#}\n'
conf_cmd = 'echo -e "%s" > /etc/multipath.conf' % conf_file
... | python | def _set_zfcp_multipath(self):
"""sles"""
# modprobe DM multipath kernel module
modprobe = 'modprobe dm_multipath'
conf_file = '#blacklist {\n'
conf_file += '#\tdevnode \\"*\\"\n'
conf_file += '#}\n'
conf_cmd = 'echo -e "%s" > /etc/multipath.conf' % conf_file
... | [
"def",
"_set_zfcp_multipath",
"(",
"self",
")",
":",
"# modprobe DM multipath kernel module",
"modprobe",
"=",
"'modprobe dm_multipath'",
"conf_file",
"=",
"'#blacklist {\\n'",
"conf_file",
"+=",
"'#\\tdevnode \\\\\"*\\\\\"\\n'",
"conf_file",
"+=",
"'#}\\n'",
"conf_cmd",
"=",... | sles | [
"sles"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/dist.py#L1037-L1048 |
mfcloud/python-zvm-sdk | zvmsdk/dist.py | sles._offline_fcp_device | def _offline_fcp_device(self, fcp, target_wwpn, target_lun, multipath):
"""sles offline zfcp. sampe to all rhel distro."""
device = '0.0.%s' % fcp
# disk config
disk_config = '/sbin/zfcp_disk_configure ' +\
'%(device)s %(wwpn)s %(lun)s 0' %\
{'... | python | def _offline_fcp_device(self, fcp, target_wwpn, target_lun, multipath):
"""sles offline zfcp. sampe to all rhel distro."""
device = '0.0.%s' % fcp
# disk config
disk_config = '/sbin/zfcp_disk_configure ' +\
'%(device)s %(wwpn)s %(lun)s 0' %\
{'... | [
"def",
"_offline_fcp_device",
"(",
"self",
",",
"fcp",
",",
"target_wwpn",
",",
"target_lun",
",",
"multipath",
")",
":",
"device",
"=",
"'0.0.%s'",
"%",
"fcp",
"# disk config",
"disk_config",
"=",
"'/sbin/zfcp_disk_configure '",
"+",
"'%(device)s %(wwpn)s %(lun)s 0'"... | sles offline zfcp. sampe to all rhel distro. | [
"sles",
"offline",
"zfcp",
".",
"sampe",
"to",
"all",
"rhel",
"distro",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/dist.py#L1050-L1061 |
mfcloud/python-zvm-sdk | zvmsdk/dist.py | ubuntu.create_network_configuration_files | def create_network_configuration_files(self, file_path, guest_networks,
first, active=False):
"""Generate network configuration files for guest vm
:param list guest_networks: a list of network info for the guest.
It has one dictionary that conta... | python | def create_network_configuration_files(self, file_path, guest_networks,
first, active=False):
"""Generate network configuration files for guest vm
:param list guest_networks: a list of network info for the guest.
It has one dictionary that conta... | [
"def",
"create_network_configuration_files",
"(",
"self",
",",
"file_path",
",",
"guest_networks",
",",
"first",
",",
"active",
"=",
"False",
")",
":",
"cfg_files",
"=",
"[",
"]",
"cmd_strings",
"=",
"''",
"network_config_file_name",
"=",
"self",
".",
"_get_netw... | Generate network configuration files for guest vm
:param list guest_networks: a list of network info for the guest.
It has one dictionary that contain some of the below keys for
each network, the format is:
{'ip_addr': (str) IP address,
'dns_addr': (l... | [
"Generate",
"network",
"configuration",
"files",
"for",
"guest",
"vm",
":",
"param",
"list",
"guest_networks",
":",
"a",
"list",
"of",
"network",
"info",
"for",
"the",
"guest",
".",
"It",
"has",
"one",
"dictionary",
"that",
"contain",
"some",
"of",
"the",
... | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/dist.py#L1142-L1194 |
mfcloud/python-zvm-sdk | zvmsdk/dist.py | ubuntu._delete_vdev_info | def _delete_vdev_info(self, vdev):
"""handle vdev related info."""
vdev = vdev.lower()
network_config_file_name = self._get_network_file()
device = self._get_device_name(vdev)
cmd = '\n'.join(("num=$(sed -n '/auto %s/=' %s)" % (device,
... | python | def _delete_vdev_info(self, vdev):
"""handle vdev related info."""
vdev = vdev.lower()
network_config_file_name = self._get_network_file()
device = self._get_device_name(vdev)
cmd = '\n'.join(("num=$(sed -n '/auto %s/=' %s)" % (device,
... | [
"def",
"_delete_vdev_info",
"(",
"self",
",",
"vdev",
")",
":",
"vdev",
"=",
"vdev",
".",
"lower",
"(",
")",
"network_config_file_name",
"=",
"self",
".",
"_get_network_file",
"(",
")",
"device",
"=",
"self",
".",
"_get_device_name",
"(",
"vdev",
")",
"cmd... | handle vdev related info. | [
"handle",
"vdev",
"related",
"info",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/dist.py#L1205-L1222 |
mfcloud/python-zvm-sdk | zvmsdk/dist.py | ubuntu._set_zfcp_config_files | def _set_zfcp_config_files(self, fcp, target_wwpn, target_lun):
"""ubuntu zfcp configuration """
host_config = '/sbin/chzdev zfcp-host %s -e' % fcp
device = '0.0.%s' % fcp
target = '%s:%s:%s' % (device, target_wwpn, target_lun)
disk_config = '/sbin/chzdev zfcp-lun %s -e\n' % tar... | python | def _set_zfcp_config_files(self, fcp, target_wwpn, target_lun):
"""ubuntu zfcp configuration """
host_config = '/sbin/chzdev zfcp-host %s -e' % fcp
device = '0.0.%s' % fcp
target = '%s:%s:%s' % (device, target_wwpn, target_lun)
disk_config = '/sbin/chzdev zfcp-lun %s -e\n' % tar... | [
"def",
"_set_zfcp_config_files",
"(",
"self",
",",
"fcp",
",",
"target_wwpn",
",",
"target_lun",
")",
":",
"host_config",
"=",
"'/sbin/chzdev zfcp-host %s -e'",
"%",
"fcp",
"device",
"=",
"'0.0.%s'",
"%",
"fcp",
"target",
"=",
"'%s:%s:%s'",
"%",
"(",
"device",
... | ubuntu zfcp configuration | [
"ubuntu",
"zfcp",
"configuration"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/dist.py#L1344-L1352 |
mfcloud/python-zvm-sdk | zvmsdk/dist.py | ubuntu._offline_fcp_device | def _offline_fcp_device(self, fcp, target_wwpn, target_lun, multipath):
"""ubuntu offline zfcp."""
device = '0.0.%s' % fcp
target = '%s:%s:%s' % (device, target_wwpn, target_lun)
disk_offline = '/sbin/chzdev zfcp-lun %s -d' % target
host_offline = '/sbin/chzdev zfcp-host %s -d' %... | python | def _offline_fcp_device(self, fcp, target_wwpn, target_lun, multipath):
"""ubuntu offline zfcp."""
device = '0.0.%s' % fcp
target = '%s:%s:%s' % (device, target_wwpn, target_lun)
disk_offline = '/sbin/chzdev zfcp-lun %s -d' % target
host_offline = '/sbin/chzdev zfcp-host %s -d' %... | [
"def",
"_offline_fcp_device",
"(",
"self",
",",
"fcp",
",",
"target_wwpn",
",",
"target_lun",
",",
"multipath",
")",
":",
"device",
"=",
"'0.0.%s'",
"%",
"fcp",
"target",
"=",
"'%s:%s:%s'",
"%",
"(",
"device",
",",
"target_wwpn",
",",
"target_lun",
")",
"d... | ubuntu offline zfcp. | [
"ubuntu",
"offline",
"zfcp",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/dist.py#L1383-L1392 |
mfcloud/python-zvm-sdk | zvmsdk/dist.py | LinuxDistManager.parse_dist | def parse_dist(self, os_version):
"""Separate os and version from os_version.
Possible return value are only:
('rhel', x.y) and ('sles', x.y) where x.y may not be digits
"""
supported = {'rhel': ['rhel', 'redhat', 'red hat'],
'sles': ['suse', 'sles'],
... | python | def parse_dist(self, os_version):
"""Separate os and version from os_version.
Possible return value are only:
('rhel', x.y) and ('sles', x.y) where x.y may not be digits
"""
supported = {'rhel': ['rhel', 'redhat', 'red hat'],
'sles': ['suse', 'sles'],
... | [
"def",
"parse_dist",
"(",
"self",
",",
"os_version",
")",
":",
"supported",
"=",
"{",
"'rhel'",
":",
"[",
"'rhel'",
",",
"'redhat'",
",",
"'red hat'",
"]",
",",
"'sles'",
":",
"[",
"'suse'",
",",
"'sles'",
"]",
",",
"'ubuntu'",
":",
"[",
"'ubuntu'",
... | Separate os and version from os_version.
Possible return value are only:
('rhel', x.y) and ('sles', x.y) where x.y may not be digits | [
"Separate",
"os",
"and",
"version",
"from",
"os_version",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/dist.py#L1435-L1454 |
mfcloud/python-zvm-sdk | smtLayer/migrateVM.py | getStatus | def getStatus(rh):
"""
Get status of a VMRelocate request.
Input:
Request Handle with the following properties:
function - 'MIGRATEVM'
subfunction - 'STATUS'
userid - userid of the virtual machine
parms['all'] - If present, set status_target to A... | python | def getStatus(rh):
"""
Get status of a VMRelocate request.
Input:
Request Handle with the following properties:
function - 'MIGRATEVM'
subfunction - 'STATUS'
userid - userid of the virtual machine
parms['all'] - If present, set status_target to A... | [
"def",
"getStatus",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter migrateVM.getStatus\"",
")",
"parms",
"=",
"[",
"\"-T\"",
",",
"rh",
".",
"userid",
"]",
"if",
"'all'",
"in",
"rh",
".",
"parms",
":",
"parms",
".",
"extend",
"(",
"[",
... | Get status of a VMRelocate request.
Input:
Request Handle with the following properties:
function - 'MIGRATEVM'
subfunction - 'STATUS'
userid - userid of the virtual machine
parms['all'] - If present, set status_target to ALL.
parms['incoming']... | [
"Get",
"status",
"of",
"a",
"VMRelocate",
"request",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/migrateVM.py#L169-L217 |
mfcloud/python-zvm-sdk | smtLayer/ReqHandle.py | ReqHandle.driveFunction | def driveFunction(self):
"""
Drive the function/subfunction call.
Input:
Self with request filled in.
Output:
Request Handle updated with the results.
Overall return code - 0: successful, non-zero: error
"""
if self.function == 'HELP':
... | python | def driveFunction(self):
"""
Drive the function/subfunction call.
Input:
Self with request filled in.
Output:
Request Handle updated with the results.
Overall return code - 0: successful, non-zero: error
"""
if self.function == 'HELP':
... | [
"def",
"driveFunction",
"(",
"self",
")",
":",
"if",
"self",
".",
"function",
"==",
"'HELP'",
":",
"# General help for all functions.",
"self",
".",
"printLn",
"(",
"\"N\"",
",",
"\"\"",
")",
"self",
".",
"printLn",
"(",
"\"N\"",
",",
"\"Usage:\"",
")",
"s... | Drive the function/subfunction call.
Input:
Self with request filled in.
Output:
Request Handle updated with the results.
Overall return code - 0: successful, non-zero: error | [
"Drive",
"the",
"function",
"/",
"subfunction",
"call",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/ReqHandle.py#L169-L210 |
mfcloud/python-zvm-sdk | smtLayer/ReqHandle.py | ReqHandle.parseCmdline | def parseCmdline(self, requestData):
"""
Parse the request command string.
Input:
Self with request filled in.
Output:
Request Handle updated with the parsed information so that
it is accessible via key/value pairs for later processing.
Re... | python | def parseCmdline(self, requestData):
"""
Parse the request command string.
Input:
Self with request filled in.
Output:
Request Handle updated with the parsed information so that
it is accessible via key/value pairs for later processing.
Re... | [
"def",
"parseCmdline",
"(",
"self",
",",
"requestData",
")",
":",
"self",
".",
"printSysLog",
"(",
"\"Enter ReqHandle.parseCmdline\"",
")",
"# Save the request data based on the type of operand.",
"if",
"isinstance",
"(",
"requestData",
",",
"list",
")",
":",
"self",
... | Parse the request command string.
Input:
Self with request filled in.
Output:
Request Handle updated with the parsed information so that
it is accessible via key/value pairs for later processing.
Return code - 0: successful, non-zero: error | [
"Parse",
"the",
"request",
"command",
"string",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/ReqHandle.py#L212-L275 |
mfcloud/python-zvm-sdk | smtLayer/ReqHandle.py | ReqHandle.printLn | def printLn(self, respType, respString):
"""
Add one or lines of output to the response list.
Input:
Response type: One or more characters indicate type of response.
E - Error message
N - Normal message
S - Output should be logged
... | python | def printLn(self, respType, respString):
"""
Add one or lines of output to the response list.
Input:
Response type: One or more characters indicate type of response.
E - Error message
N - Normal message
S - Output should be logged
... | [
"def",
"printLn",
"(",
"self",
",",
"respType",
",",
"respString",
")",
":",
"if",
"'E'",
"in",
"respType",
":",
"respString",
"=",
"'(Error) '",
"+",
"respString",
"if",
"'W'",
"in",
"respType",
":",
"respString",
"=",
"'(Warning) '",
"+",
"respString",
"... | Add one or lines of output to the response list.
Input:
Response type: One or more characters indicate type of response.
E - Error message
N - Normal message
S - Output should be logged
W - Warning message | [
"Add",
"one",
"or",
"lines",
"of",
"output",
"to",
"the",
"response",
"list",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/ReqHandle.py#L277-L297 |
mfcloud/python-zvm-sdk | smtLayer/ReqHandle.py | ReqHandle.printSysLog | def printSysLog(self, logString):
"""
Log one or more lines. Optionally, add them to logEntries list.
Input:
Strings to be logged.
"""
if zvmsdklog.LOGGER.getloglevel() <= logging.DEBUG:
# print log only when debug is enabled
if self.daemon =... | python | def printSysLog(self, logString):
"""
Log one or more lines. Optionally, add them to logEntries list.
Input:
Strings to be logged.
"""
if zvmsdklog.LOGGER.getloglevel() <= logging.DEBUG:
# print log only when debug is enabled
if self.daemon =... | [
"def",
"printSysLog",
"(",
"self",
",",
"logString",
")",
":",
"if",
"zvmsdklog",
".",
"LOGGER",
".",
"getloglevel",
"(",
")",
"<=",
"logging",
".",
"DEBUG",
":",
"# print log only when debug is enabled",
"if",
"self",
".",
"daemon",
"==",
"''",
":",
"self",... | Log one or more lines. Optionally, add them to logEntries list.
Input:
Strings to be logged. | [
"Log",
"one",
"or",
"more",
"lines",
".",
"Optionally",
"add",
"them",
"to",
"logEntries",
"list",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/ReqHandle.py#L299-L317 |
mfcloud/python-zvm-sdk | smtLayer/ReqHandle.py | ReqHandle.updateResults | def updateResults(self, newResults, **kwArgs):
"""
Update the results related to this request excluding the 'response'
and 'logEntries' values.
We specifically update (if present):
overallRC, rc, rs, errno.
Input:
Dictionary containing the results to be upd... | python | def updateResults(self, newResults, **kwArgs):
"""
Update the results related to this request excluding the 'response'
and 'logEntries' values.
We specifically update (if present):
overallRC, rc, rs, errno.
Input:
Dictionary containing the results to be upd... | [
"def",
"updateResults",
"(",
"self",
",",
"newResults",
",",
"*",
"*",
"kwArgs",
")",
":",
"if",
"'reset'",
"in",
"kwArgs",
".",
"keys",
"(",
")",
":",
"reset",
"=",
"kwArgs",
"[",
"'reset'",
"]",
"else",
":",
"reset",
"=",
"0",
"if",
"reset",
"=="... | Update the results related to this request excluding the 'response'
and 'logEntries' values.
We specifically update (if present):
overallRC, rc, rs, errno.
Input:
Dictionary containing the results to be updated or an empty
dictionary the reset keyword was spe... | [
"Update",
"the",
"results",
"related",
"to",
"this",
"request",
"excluding",
"the",
"response",
"and",
"logEntries",
"values",
".",
"We",
"specifically",
"update",
"(",
"if",
"present",
")",
":",
"overallRC",
"rc",
"rs",
"errno",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/ReqHandle.py#L319-L369 |
rpkilby/SurveyGizmo | surveygizmo/api/base.py | Resource.filter | def filter(self, field, operator, value):
""" Add a query filter to be applied to the next API list call for this resource.
:param field: Field name to filter by
:type field: str
:param operator: Operator value
:type operator: str
:param value: Value o... | python | def filter(self, field, operator, value):
""" Add a query filter to be applied to the next API list call for this resource.
:param field: Field name to filter by
:type field: str
:param operator: Operator value
:type operator: str
:param value: Value o... | [
"def",
"filter",
"(",
"self",
",",
"field",
",",
"operator",
",",
"value",
")",
":",
"instance",
"=",
"copy",
"(",
"self",
")",
"i",
"=",
"len",
"(",
"instance",
".",
"_filters",
")",
"instance",
".",
"_filters",
".",
"append",
"(",
"{",
"'filter[fie... | Add a query filter to be applied to the next API list call for this resource.
:param field: Field name to filter by
:type field: str
:param operator: Operator value
:type operator: str
:param value: Value of filter
:type value: str
:par... | [
"Add",
"a",
"query",
"filter",
"to",
"be",
"applied",
"to",
"the",
"next",
"API",
"list",
"call",
"for",
"this",
"resource",
".",
":",
"param",
"field",
":",
"Field",
"name",
"to",
"filter",
"by",
":",
"type",
"field",
":",
"str",
":",
"param",
"oper... | train | https://github.com/rpkilby/SurveyGizmo/blob/a097091dc7dcfb58f70242fb1becabc98df049a5/surveygizmo/api/base.py#L13-L68 |
rpkilby/SurveyGizmo | surveygizmo/api/base.py | Resource.resultsperpage | def resultsperpage(self, value):
""" Set the number of results that will be retrieved by the request.
:param value: 'resultsperpage' parameter value for the rest api call
:type value: str
Take a look at https://apihelp.surveygizmo.com/help/surveyresponse-sub-object
... | python | def resultsperpage(self, value):
""" Set the number of results that will be retrieved by the request.
:param value: 'resultsperpage' parameter value for the rest api call
:type value: str
Take a look at https://apihelp.surveygizmo.com/help/surveyresponse-sub-object
... | [
"def",
"resultsperpage",
"(",
"self",
",",
"value",
")",
":",
"instance",
"=",
"copy",
"(",
"self",
")",
"instance",
".",
"_filters",
".",
"append",
"(",
"{",
"'resultsperpage'",
":",
"value",
"}",
")",
"return",
"instance"
] | Set the number of results that will be retrieved by the request.
:param value: 'resultsperpage' parameter value for the rest api call
:type value: str
Take a look at https://apihelp.surveygizmo.com/help/surveyresponse-sub-object | [
"Set",
"the",
"number",
"of",
"results",
"that",
"will",
"be",
"retrieved",
"by",
"the",
"request",
".",
":",
"param",
"value",
":",
"resultsperpage",
"parameter",
"value",
"for",
"the",
"rest",
"api",
"call",
":",
"type",
"value",
":",
"str"
] | train | https://github.com/rpkilby/SurveyGizmo/blob/a097091dc7dcfb58f70242fb1becabc98df049a5/surveygizmo/api/base.py#L70-L84 |
rpkilby/SurveyGizmo | surveygizmo/api/base.py | Resource.page | def page(self, value):
""" Set the page which will be returned.
:param value: 'page' parameter value for the rest api call
:type value: str
Take a look at https://apihelp.surveygizmo.com/help/surveyresponse-sub-object
"""
instance = copy(self)
ins... | python | def page(self, value):
""" Set the page which will be returned.
:param value: 'page' parameter value for the rest api call
:type value: str
Take a look at https://apihelp.surveygizmo.com/help/surveyresponse-sub-object
"""
instance = copy(self)
ins... | [
"def",
"page",
"(",
"self",
",",
"value",
")",
":",
"instance",
"=",
"copy",
"(",
"self",
")",
"instance",
".",
"_filters",
".",
"append",
"(",
"{",
"'page'",
":",
"value",
"}",
")",
"return",
"instance"
] | Set the page which will be returned.
:param value: 'page' parameter value for the rest api call
:type value: str
Take a look at https://apihelp.surveygizmo.com/help/surveyresponse-sub-object | [
"Set",
"the",
"page",
"which",
"will",
"be",
"returned",
".",
":",
"param",
"value",
":",
"page",
"parameter",
"value",
"for",
"the",
"rest",
"api",
"call",
":",
"type",
"value",
":",
"str"
] | train | https://github.com/rpkilby/SurveyGizmo/blob/a097091dc7dcfb58f70242fb1becabc98df049a5/surveygizmo/api/base.py#L86-L100 |
rpkilby/SurveyGizmo | surveygizmo/api/base.py | Resource.filters | def filters(self):
"""
Returns a merged dictionary of filters.
"""
params = {}
for _filter in self._filters:
params.update(_filter)
return params | python | def filters(self):
"""
Returns a merged dictionary of filters.
"""
params = {}
for _filter in self._filters:
params.update(_filter)
return params | [
"def",
"filters",
"(",
"self",
")",
":",
"params",
"=",
"{",
"}",
"for",
"_filter",
"in",
"self",
".",
"_filters",
":",
"params",
".",
"update",
"(",
"_filter",
")",
"return",
"params"
] | Returns a merged dictionary of filters. | [
"Returns",
"a",
"merged",
"dictionary",
"of",
"filters",
"."
] | train | https://github.com/rpkilby/SurveyGizmo/blob/a097091dc7dcfb58f70242fb1becabc98df049a5/surveygizmo/api/base.py#L109-L117 |
mfcloud/python-zvm-sdk | zvmsdk/sdkwsgi/util.py | json_error_formatter | def json_error_formatter(body, status, title, environ):
"""A json_formatter for webob exceptions."""
body = webob.exc.strip_tags(body)
status_code = int(status.split(None, 1)[0])
error_dict = {
'status': status_code,
'title': title,
'detail': body
}
return {'errors': [err... | python | def json_error_formatter(body, status, title, environ):
"""A json_formatter for webob exceptions."""
body = webob.exc.strip_tags(body)
status_code = int(status.split(None, 1)[0])
error_dict = {
'status': status_code,
'title': title,
'detail': body
}
return {'errors': [err... | [
"def",
"json_error_formatter",
"(",
"body",
",",
"status",
",",
"title",
",",
"environ",
")",
":",
"body",
"=",
"webob",
".",
"exc",
".",
"strip_tags",
"(",
"body",
")",
"status_code",
"=",
"int",
"(",
"status",
".",
"split",
"(",
"None",
",",
"1",
"... | A json_formatter for webob exceptions. | [
"A",
"json_formatter",
"for",
"webob",
"exceptions",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/sdkwsgi/util.py#L45-L54 |
mfcloud/python-zvm-sdk | zvmsdk/sdkwsgi/util.py | SdkWsgify.call_func | def call_func(self, req, *args, **kwargs):
"""Add json_error_formatter to any webob HTTPExceptions."""
try:
return super(SdkWsgify, self).call_func(req, *args, **kwargs)
except webob.exc.HTTPException as exc:
msg = ('encounter %(error)s error') % {'error': exc}
... | python | def call_func(self, req, *args, **kwargs):
"""Add json_error_formatter to any webob HTTPExceptions."""
try:
return super(SdkWsgify, self).call_func(req, *args, **kwargs)
except webob.exc.HTTPException as exc:
msg = ('encounter %(error)s error') % {'error': exc}
... | [
"def",
"call_func",
"(",
"self",
",",
"req",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"return",
"super",
"(",
"SdkWsgify",
",",
"self",
")",
".",
"call_func",
"(",
"req",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"... | Add json_error_formatter to any webob HTTPExceptions. | [
"Add",
"json_error_formatter",
"to",
"any",
"webob",
"HTTPExceptions",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/sdkwsgi/util.py#L224-L243 |
Chilipp/psyplot | psyplot/gdal_store.py | GdalStore._load_GeoTransform | def _load_GeoTransform(self):
"""Calculate latitude and longitude variable calculated from the
gdal.Open.GetGeoTransform method"""
def load_lon():
return arange(ds.RasterXSize)*b[1]+b[0]
def load_lat():
return arange(ds.RasterYSize)*b[5]+b[3]
ds = self.ds... | python | def _load_GeoTransform(self):
"""Calculate latitude and longitude variable calculated from the
gdal.Open.GetGeoTransform method"""
def load_lon():
return arange(ds.RasterXSize)*b[1]+b[0]
def load_lat():
return arange(ds.RasterYSize)*b[5]+b[3]
ds = self.ds... | [
"def",
"_load_GeoTransform",
"(",
"self",
")",
":",
"def",
"load_lon",
"(",
")",
":",
"return",
"arange",
"(",
"ds",
".",
"RasterXSize",
")",
"*",
"b",
"[",
"1",
"]",
"+",
"b",
"[",
"0",
"]",
"def",
"load_lat",
"(",
")",
":",
"return",
"arange",
... | Calculate latitude and longitude variable calculated from the
gdal.Open.GetGeoTransform method | [
"Calculate",
"latitude",
"and",
"longitude",
"variable",
"calculated",
"from",
"the",
"gdal",
".",
"Open",
".",
"GetGeoTransform",
"method"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/gdal_store.py#L109-L129 |
Chilipp/psyplot | psyplot/config/rcsetup.py | psyplot_fname | def psyplot_fname(env_key='PSYPLOTRC', fname='psyplotrc.yml',
if_exists=True):
"""
Get the location of the config file.
The file location is determined in the following order
- `$PWD/psyplotrc.yml`
- environment variable `PSYPLOTRC` (pointing to the file location or a
dire... | python | def psyplot_fname(env_key='PSYPLOTRC', fname='psyplotrc.yml',
if_exists=True):
"""
Get the location of the config file.
The file location is determined in the following order
- `$PWD/psyplotrc.yml`
- environment variable `PSYPLOTRC` (pointing to the file location or a
dire... | [
"def",
"psyplot_fname",
"(",
"env_key",
"=",
"'PSYPLOTRC'",
",",
"fname",
"=",
"'psyplotrc.yml'",
",",
"if_exists",
"=",
"True",
")",
":",
"cwd",
"=",
"getcwd",
"(",
")",
"full_fname",
"=",
"os",
".",
"path",
".",
"join",
"(",
"cwd",
",",
"fname",
")",... | Get the location of the config file.
The file location is determined in the following order
- `$PWD/psyplotrc.yml`
- environment variable `PSYPLOTRC` (pointing to the file location or a
directory containing the file `psyplotrc.yml`)
- `$PSYPLOTCONFIGDIR/psyplot`
- On Linux and osx,
... | [
"Get",
"the",
"location",
"of",
"the",
"config",
"file",
"."
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/config/rcsetup.py#L861-L927 |
Chilipp/psyplot | psyplot/config/rcsetup.py | validate_path_exists | def validate_path_exists(s):
"""If s is a path, return s, else False"""
if s is None:
return None
if os.path.exists(s):
return s
else:
raise ValueError('"%s" should be a path but it does not exist' % s) | python | def validate_path_exists(s):
"""If s is a path, return s, else False"""
if s is None:
return None
if os.path.exists(s):
return s
else:
raise ValueError('"%s" should be a path but it does not exist' % s) | [
"def",
"validate_path_exists",
"(",
"s",
")",
":",
"if",
"s",
"is",
"None",
":",
"return",
"None",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"s",
")",
":",
"return",
"s",
"else",
":",
"raise",
"ValueError",
"(",
"'\"%s\" should be a path but it does not... | If s is a path, return s, else False | [
"If",
"s",
"is",
"a",
"path",
"return",
"s",
"else",
"False"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/config/rcsetup.py#L975-L982 |
Chilipp/psyplot | psyplot/config/rcsetup.py | validate_dict | def validate_dict(d):
"""Validate a dictionary
Parameters
----------
d: dict or str
If str, it must be a path to a yaml file
Returns
-------
dict
Raises
------
ValueError"""
try:
return dict(d)
except TypeError:
d = validate_path_exists(d)
... | python | def validate_dict(d):
"""Validate a dictionary
Parameters
----------
d: dict or str
If str, it must be a path to a yaml file
Returns
-------
dict
Raises
------
ValueError"""
try:
return dict(d)
except TypeError:
d = validate_path_exists(d)
... | [
"def",
"validate_dict",
"(",
"d",
")",
":",
"try",
":",
"return",
"dict",
"(",
"d",
")",
"except",
"TypeError",
":",
"d",
"=",
"validate_path_exists",
"(",
"d",
")",
"try",
":",
"with",
"open",
"(",
"d",
")",
"as",
"f",
":",
"return",
"dict",
"(",
... | Validate a dictionary
Parameters
----------
d: dict or str
If str, it must be a path to a yaml file
Returns
-------
dict
Raises
------
ValueError | [
"Validate",
"a",
"dictionary"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/config/rcsetup.py#L985-L1008 |
Chilipp/psyplot | psyplot/config/rcsetup.py | validate_bool_maybe_none | def validate_bool_maybe_none(b):
'Convert b to a boolean or raise'
if isinstance(b, six.string_types):
b = b.lower()
if b is None or b == 'none':
return None
return validate_bool(b) | python | def validate_bool_maybe_none(b):
'Convert b to a boolean or raise'
if isinstance(b, six.string_types):
b = b.lower()
if b is None or b == 'none':
return None
return validate_bool(b) | [
"def",
"validate_bool_maybe_none",
"(",
"b",
")",
":",
"if",
"isinstance",
"(",
"b",
",",
"six",
".",
"string_types",
")",
":",
"b",
"=",
"b",
".",
"lower",
"(",
")",
"if",
"b",
"is",
"None",
"or",
"b",
"==",
"'none'",
":",
"return",
"None",
"retur... | Convert b to a boolean or raise | [
"Convert",
"b",
"to",
"a",
"boolean",
"or",
"raise"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/config/rcsetup.py#L1011-L1017 |
Chilipp/psyplot | psyplot/config/rcsetup.py | validate_bool | def validate_bool(b):
"""Convert b to a boolean or raise"""
if isinstance(b, six.string_types):
b = b.lower()
if b in ('t', 'y', 'yes', 'on', 'true', '1', 1, True):
return True
elif b in ('f', 'n', 'no', 'off', 'false', '0', 0, False):
return False
else:
raise ValueEr... | python | def validate_bool(b):
"""Convert b to a boolean or raise"""
if isinstance(b, six.string_types):
b = b.lower()
if b in ('t', 'y', 'yes', 'on', 'true', '1', 1, True):
return True
elif b in ('f', 'n', 'no', 'off', 'false', '0', 0, False):
return False
else:
raise ValueEr... | [
"def",
"validate_bool",
"(",
"b",
")",
":",
"if",
"isinstance",
"(",
"b",
",",
"six",
".",
"string_types",
")",
":",
"b",
"=",
"b",
".",
"lower",
"(",
")",
"if",
"b",
"in",
"(",
"'t'",
",",
"'y'",
",",
"'yes'",
",",
"'on'",
",",
"'true'",
",",
... | Convert b to a boolean or raise | [
"Convert",
"b",
"to",
"a",
"boolean",
"or",
"raise"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/config/rcsetup.py#L1020-L1029 |
Chilipp/psyplot | psyplot/config/rcsetup.py | validate_str | def validate_str(s):
"""Validate a string
Parameters
----------
s: str
Returns
-------
str
Raises
------
ValueError"""
if not isinstance(s, six.string_types):
raise ValueError("Did not found string!")
return six.text_type(s) | python | def validate_str(s):
"""Validate a string
Parameters
----------
s: str
Returns
-------
str
Raises
------
ValueError"""
if not isinstance(s, six.string_types):
raise ValueError("Did not found string!")
return six.text_type(s) | [
"def",
"validate_str",
"(",
"s",
")",
":",
"if",
"not",
"isinstance",
"(",
"s",
",",
"six",
".",
"string_types",
")",
":",
"raise",
"ValueError",
"(",
"\"Did not found string!\"",
")",
"return",
"six",
".",
"text_type",
"(",
"s",
")"
] | Validate a string
Parameters
----------
s: str
Returns
-------
str
Raises
------
ValueError | [
"Validate",
"a",
"string"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/config/rcsetup.py#L1032-L1048 |
Chilipp/psyplot | psyplot/config/rcsetup.py | validate_stringlist | def validate_stringlist(s):
"""Validate a list of strings
Parameters
----------
val: iterable of strings
Returns
-------
list
list of str
Raises
------
ValueError"""
if isinstance(s, six.string_types):
return [six.text_type(v.strip()) for v in s.split(',') ... | python | def validate_stringlist(s):
"""Validate a list of strings
Parameters
----------
val: iterable of strings
Returns
-------
list
list of str
Raises
------
ValueError"""
if isinstance(s, six.string_types):
return [six.text_type(v.strip()) for v in s.split(',') ... | [
"def",
"validate_stringlist",
"(",
"s",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"six",
".",
"string_types",
")",
":",
"return",
"[",
"six",
".",
"text_type",
"(",
"v",
".",
"strip",
"(",
")",
")",
"for",
"v",
"in",
"s",
".",
"split",
"(",
"'... | Validate a list of strings
Parameters
----------
val: iterable of strings
Returns
-------
list
list of str
Raises
------
ValueError | [
"Validate",
"a",
"list",
"of",
"strings"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/config/rcsetup.py#L1051-L1072 |
Chilipp/psyplot | psyplot/config/rcsetup.py | SubDict.add_base_str | def add_base_str(self, base_str, pattern='.+', pattern_base=None,
append=True):
"""
Add further base string to this instance
Parameters
----------
base_str: str or list of str
Strings that are used as to look for keys to get and set keys in
... | python | def add_base_str(self, base_str, pattern='.+', pattern_base=None,
append=True):
"""
Add further base string to this instance
Parameters
----------
base_str: str or list of str
Strings that are used as to look for keys to get and set keys in
... | [
"def",
"add_base_str",
"(",
"self",
",",
"base_str",
",",
"pattern",
"=",
"'.+'",
",",
"pattern_base",
"=",
"None",
",",
"append",
"=",
"True",
")",
":",
"base_str",
"=",
"safe_list",
"(",
"base_str",
")",
"pattern_base",
"=",
"safe_list",
"(",
"pattern_ba... | Add further base string to this instance
Parameters
----------
base_str: str or list of str
Strings that are used as to look for keys to get and set keys in
the :attr:`base` dictionary. If a string does not contain
``'%(key)s'``, it will be appended at the en... | [
"Add",
"further",
"base",
"string",
"to",
"this",
"instance"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/config/rcsetup.py#L120-L164 |
Chilipp/psyplot | psyplot/config/rcsetup.py | SubDict.iterkeys | def iterkeys(self):
"""Unsorted iterator over keys"""
patterns = self.patterns
replace = self.replace
seen = set()
for key in six.iterkeys(self.base):
for pattern in patterns:
m = pattern.match(key)
if m:
ret = m.gro... | python | def iterkeys(self):
"""Unsorted iterator over keys"""
patterns = self.patterns
replace = self.replace
seen = set()
for key in six.iterkeys(self.base):
for pattern in patterns:
m = pattern.match(key)
if m:
ret = m.gro... | [
"def",
"iterkeys",
"(",
"self",
")",
":",
"patterns",
"=",
"self",
".",
"patterns",
"replace",
"=",
"self",
".",
"replace",
"seen",
"=",
"set",
"(",
")",
"for",
"key",
"in",
"six",
".",
"iterkeys",
"(",
"self",
".",
"base",
")",
":",
"for",
"patter... | Unsorted iterator over keys | [
"Unsorted",
"iterator",
"over",
"keys"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/config/rcsetup.py#L304-L320 |
Chilipp/psyplot | psyplot/config/rcsetup.py | RcParams.validate | def validate(self):
"""Dictionary with validation methods as values"""
depr = self._all_deprecated
return dict((key, val[1]) for key, val in
six.iteritems(self.defaultParams)
if key not in depr) | python | def validate(self):
"""Dictionary with validation methods as values"""
depr = self._all_deprecated
return dict((key, val[1]) for key, val in
six.iteritems(self.defaultParams)
if key not in depr) | [
"def",
"validate",
"(",
"self",
")",
":",
"depr",
"=",
"self",
".",
"_all_deprecated",
"return",
"dict",
"(",
"(",
"key",
",",
"val",
"[",
"1",
"]",
")",
"for",
"key",
",",
"val",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"defaultParams",
")... | Dictionary with validation methods as values | [
"Dictionary",
"with",
"validation",
"methods",
"as",
"values"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/config/rcsetup.py#L350-L355 |
Chilipp/psyplot | psyplot/config/rcsetup.py | RcParams.descriptions | def descriptions(self):
"""The description of each keyword in the rcParams dictionary"""
return {key: val[2] for key, val in six.iteritems(self.defaultParams)
if len(val) >= 3} | python | def descriptions(self):
"""The description of each keyword in the rcParams dictionary"""
return {key: val[2] for key, val in six.iteritems(self.defaultParams)
if len(val) >= 3} | [
"def",
"descriptions",
"(",
"self",
")",
":",
"return",
"{",
"key",
":",
"val",
"[",
"2",
"]",
"for",
"key",
",",
"val",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"defaultParams",
")",
"if",
"len",
"(",
"val",
")",
">=",
"3",
"}"
] | The description of each keyword in the rcParams dictionary | [
"The",
"description",
"of",
"each",
"keyword",
"in",
"the",
"rcParams",
"dictionary"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/config/rcsetup.py#L358-L361 |
Chilipp/psyplot | psyplot/config/rcsetup.py | RcParams.connect | def connect(self, key, func):
"""Connect a function to the given formatoption
Parameters
----------
key: str
The rcParams key
func: function
The function that shall be called when the rcParams key changes.
It must accept a single value that is... | python | def connect(self, key, func):
"""Connect a function to the given formatoption
Parameters
----------
key: str
The rcParams key
func: function
The function that shall be called when the rcParams key changes.
It must accept a single value that is... | [
"def",
"connect",
"(",
"self",
",",
"key",
",",
"func",
")",
":",
"key",
"=",
"self",
".",
"_get_depreceated",
"(",
"key",
")",
"[",
"0",
"]",
"if",
"key",
"is",
"not",
"None",
":",
"self",
".",
"_connections",
"[",
"key",
"]",
".",
"append",
"("... | Connect a function to the given formatoption
Parameters
----------
key: str
The rcParams key
func: function
The function that shall be called when the rcParams key changes.
It must accept a single value that is the new value of the
key. | [
"Connect",
"a",
"function",
"to",
"the",
"given",
"formatoption"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/config/rcsetup.py#L457-L470 |
Chilipp/psyplot | psyplot/config/rcsetup.py | RcParams.disconnect | def disconnect(self, key=None, func=None):
"""Disconnect the connections to the an rcParams key
Parameters
----------
key: str
The rcParams key. If None, all keys are used
func: function
The function that is connected. If None, all functions are
... | python | def disconnect(self, key=None, func=None):
"""Disconnect the connections to the an rcParams key
Parameters
----------
key: str
The rcParams key. If None, all keys are used
func: function
The function that is connected. If None, all functions are
... | [
"def",
"disconnect",
"(",
"self",
",",
"key",
"=",
"None",
",",
"func",
"=",
"None",
")",
":",
"if",
"key",
"is",
"None",
":",
"for",
"key",
",",
"connections",
"in",
"self",
".",
"_connections",
".",
"items",
"(",
")",
":",
"for",
"conn",
"in",
... | Disconnect the connections to the an rcParams key
Parameters
----------
key: str
The rcParams key. If None, all keys are used
func: function
The function that is connected. If None, all functions are
connected | [
"Disconnect",
"the",
"connections",
"to",
"the",
"an",
"rcParams",
"key"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/config/rcsetup.py#L472-L492 |
Chilipp/psyplot | psyplot/config/rcsetup.py | RcParams.update_from_defaultParams | def update_from_defaultParams(self, defaultParams=None,
plotters=True):
"""Update from the a dictionary like the :attr:`defaultParams`
Parameters
----------
defaultParams: dict
The :attr:`defaultParams` like dictionary. If None, the
... | python | def update_from_defaultParams(self, defaultParams=None,
plotters=True):
"""Update from the a dictionary like the :attr:`defaultParams`
Parameters
----------
defaultParams: dict
The :attr:`defaultParams` like dictionary. If None, the
... | [
"def",
"update_from_defaultParams",
"(",
"self",
",",
"defaultParams",
"=",
"None",
",",
"plotters",
"=",
"True",
")",
":",
"if",
"defaultParams",
"is",
"None",
":",
"defaultParams",
"=",
"self",
".",
"defaultParams",
"self",
".",
"update",
"(",
"{",
"key",
... | Update from the a dictionary like the :attr:`defaultParams`
Parameters
----------
defaultParams: dict
The :attr:`defaultParams` like dictionary. If None, the
:attr:`defaultParams` attribute will be updated
plotters: bool
If True, ``'project.plotters'`... | [
"Update",
"from",
"the",
"a",
"dictionary",
"like",
"the",
":",
"attr",
":",
"defaultParams"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/config/rcsetup.py#L513-L527 |
Chilipp/psyplot | psyplot/config/rcsetup.py | RcParams.keys | def keys(self):
"""
Return sorted list of keys.
"""
k = list(dict.keys(self))
k.sort()
return k | python | def keys(self):
"""
Return sorted list of keys.
"""
k = list(dict.keys(self))
k.sort()
return k | [
"def",
"keys",
"(",
"self",
")",
":",
"k",
"=",
"list",
"(",
"dict",
".",
"keys",
"(",
"self",
")",
")",
"k",
".",
"sort",
"(",
")",
"return",
"k"
] | Return sorted list of keys. | [
"Return",
"sorted",
"list",
"of",
"keys",
"."
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/config/rcsetup.py#L542-L548 |
Chilipp/psyplot | psyplot/config/rcsetup.py | RcParams.find_all | def find_all(self, pattern):
"""
Return the subset of this RcParams dictionary whose keys match,
using :func:`re.search`, the given ``pattern``.
Parameters
----------
pattern: str
pattern as suitable for re.compile
Returns
-------
RcP... | python | def find_all(self, pattern):
"""
Return the subset of this RcParams dictionary whose keys match,
using :func:`re.search`, the given ``pattern``.
Parameters
----------
pattern: str
pattern as suitable for re.compile
Returns
-------
RcP... | [
"def",
"find_all",
"(",
"self",
",",
"pattern",
")",
":",
"pattern_re",
"=",
"re",
".",
"compile",
"(",
"pattern",
")",
"ret",
"=",
"RcParams",
"(",
")",
"ret",
".",
"defaultParams",
"=",
"self",
".",
"defaultParams",
"ret",
".",
"update",
"(",
"(",
... | Return the subset of this RcParams dictionary whose keys match,
using :func:`re.search`, the given ``pattern``.
Parameters
----------
pattern: str
pattern as suitable for re.compile
Returns
-------
RcParams
RcParams instance with entries ... | [
"Return",
"the",
"subset",
"of",
"this",
"RcParams",
"dictionary",
"whose",
"keys",
"match",
"using",
":",
"func",
":",
"re",
".",
"search",
"the",
"given",
"pattern",
"."
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/config/rcsetup.py#L556-L585 |
Chilipp/psyplot | psyplot/config/rcsetup.py | RcParams.load_from_file | def load_from_file(self, fname=None):
"""Update rcParams from user-defined settings
This function updates the instance with what is found in `fname`
Parameters
----------
fname: str
Path to the yaml configuration file. Possible keys of the
dictionary are... | python | def load_from_file(self, fname=None):
"""Update rcParams from user-defined settings
This function updates the instance with what is found in `fname`
Parameters
----------
fname: str
Path to the yaml configuration file. Possible keys of the
dictionary are... | [
"def",
"load_from_file",
"(",
"self",
",",
"fname",
"=",
"None",
")",
":",
"fname",
"=",
"fname",
"or",
"psyplot_fname",
"(",
")",
"if",
"fname",
"and",
"os",
".",
"path",
".",
"exists",
"(",
"fname",
")",
":",
"with",
"open",
"(",
"fname",
")",
"a... | Update rcParams from user-defined settings
This function updates the instance with what is found in `fname`
Parameters
----------
fname: str
Path to the yaml configuration file. Possible keys of the
dictionary are defined by :data:`config.rcsetup.defaultParams`.... | [
"Update",
"rcParams",
"from",
"user",
"-",
"defined",
"settings"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/config/rcsetup.py#L629-L651 |
Chilipp/psyplot | psyplot/config/rcsetup.py | RcParams.dump | def dump(self, fname=None, overwrite=True, include_keys=None,
exclude_keys=['project.plotters'], include_descriptions=True,
**kwargs):
"""Dump this instance to a yaml file
Parameters
----------
fname: str or None
file name to write to. If None, the ... | python | def dump(self, fname=None, overwrite=True, include_keys=None,
exclude_keys=['project.plotters'], include_descriptions=True,
**kwargs):
"""Dump this instance to a yaml file
Parameters
----------
fname: str or None
file name to write to. If None, the ... | [
"def",
"dump",
"(",
"self",
",",
"fname",
"=",
"None",
",",
"overwrite",
"=",
"True",
",",
"include_keys",
"=",
"None",
",",
"exclude_keys",
"=",
"[",
"'project.plotters'",
"]",
",",
"include_descriptions",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",... | Dump this instance to a yaml file
Parameters
----------
fname: str or None
file name to write to. If None, the string that would be written
to a file is returned
overwrite: bool
If True and `fname` already exists, it will be overwritten
includ... | [
"Dump",
"this",
"instance",
"to",
"a",
"yaml",
"file"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/config/rcsetup.py#L653-L725 |
Chilipp/psyplot | psyplot/config/rcsetup.py | RcParams._load_plugin_entrypoints | def _load_plugin_entrypoints(self):
"""Load the modules for the psyplot plugins
Yields
------
pkg_resources.EntryPoint
The entry point for the psyplot plugin module"""
from pkg_resources import iter_entry_points
def load_plugin(ep):
if plugins_en... | python | def _load_plugin_entrypoints(self):
"""Load the modules for the psyplot plugins
Yields
------
pkg_resources.EntryPoint
The entry point for the psyplot plugin module"""
from pkg_resources import iter_entry_points
def load_plugin(ep):
if plugins_en... | [
"def",
"_load_plugin_entrypoints",
"(",
"self",
")",
":",
"from",
"pkg_resources",
"import",
"iter_entry_points",
"def",
"load_plugin",
"(",
"ep",
")",
":",
"if",
"plugins_env",
"==",
"[",
"'no'",
"]",
":",
"return",
"False",
"elif",
"ep",
".",
"module_name",
... | Load the modules for the psyplot plugins
Yields
------
pkg_resources.EntryPoint
The entry point for the psyplot plugin module | [
"Load",
"the",
"modules",
"for",
"the",
"psyplot",
"plugins"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/config/rcsetup.py#L727-L759 |
Chilipp/psyplot | psyplot/config/rcsetup.py | RcParams.load_plugins | def load_plugins(self, raise_error=False):
"""
Load the plotters and defaultParams from the plugins
This method loads the `plotters` attribute and `defaultParams`
attribute from the plugins that use the entry point specified by
`group`. Entry points must be objects (or modules) ... | python | def load_plugins(self, raise_error=False):
"""
Load the plotters and defaultParams from the plugins
This method loads the `plotters` attribute and `defaultParams`
attribute from the plugins that use the entry point specified by
`group`. Entry points must be objects (or modules) ... | [
"def",
"load_plugins",
"(",
"self",
",",
"raise_error",
"=",
"False",
")",
":",
"pm_env",
"=",
"os",
".",
"getenv",
"(",
"'PSYPLOT_PLOTMETHODS'",
",",
"''",
")",
".",
"split",
"(",
"'::'",
")",
"include_pms",
"=",
"[",
"s",
"[",
"4",
":",
"]",
"for",... | Load the plotters and defaultParams from the plugins
This method loads the `plotters` attribute and `defaultParams`
attribute from the plugins that use the entry point specified by
`group`. Entry points must be objects (or modules) that have a
`defaultParams` and a `plotters` attribute.... | [
"Load",
"the",
"plotters",
"and",
"defaultParams",
"from",
"the",
"plugins"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/config/rcsetup.py#L761-L854 |
mfcloud/python-zvm-sdk | zvmsdk/sdkwsgi/deploy.py | deploy | def deploy(project_name):
"""Assemble the middleware pipeline"""
request_log = requestlog.RequestLog
header_addon = HeaderControl
fault_wrapper = FaultWrapper
application = handler.SdkHandler()
# currently we have 3 middleware
for middleware in (header_addon,
fault_wr... | python | def deploy(project_name):
"""Assemble the middleware pipeline"""
request_log = requestlog.RequestLog
header_addon = HeaderControl
fault_wrapper = FaultWrapper
application = handler.SdkHandler()
# currently we have 3 middleware
for middleware in (header_addon,
fault_wr... | [
"def",
"deploy",
"(",
"project_name",
")",
":",
"request_log",
"=",
"requestlog",
".",
"RequestLog",
"header_addon",
"=",
"HeaderControl",
"fault_wrapper",
"=",
"FaultWrapper",
"application",
"=",
"handler",
".",
"SdkHandler",
"(",
")",
"# currently we have 3 middlewa... | Assemble the middleware pipeline | [
"Assemble",
"the",
"middleware",
"pipeline"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/sdkwsgi/deploy.py#L139-L154 |
mfcloud/python-zvm-sdk | zvmsdk/vmops.py | VMOps.guest_start | def guest_start(self, userid):
""""Power on z/VM instance."""
LOG.info("Begin to power on vm %s", userid)
self._smtclient.guest_start(userid)
LOG.info("Complete power on vm %s", userid) | python | def guest_start(self, userid):
""""Power on z/VM instance."""
LOG.info("Begin to power on vm %s", userid)
self._smtclient.guest_start(userid)
LOG.info("Complete power on vm %s", userid) | [
"def",
"guest_start",
"(",
"self",
",",
"userid",
")",
":",
"LOG",
".",
"info",
"(",
"\"Begin to power on vm %s\"",
",",
"userid",
")",
"self",
".",
"_smtclient",
".",
"guest_start",
"(",
"userid",
")",
"LOG",
".",
"info",
"(",
"\"Complete power on vm %s\"",
... | Power on z/VM instance. | [
"Power",
"on",
"z",
"/",
"VM",
"instance",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/vmops.py#L108-L112 |
mfcloud/python-zvm-sdk | zvmsdk/vmops.py | VMOps.guest_reboot | def guest_reboot(self, userid):
"""Reboot a guest vm."""
LOG.info("Begin to reboot vm %s", userid)
self._smtclient.guest_reboot(userid)
LOG.info("Complete reboot vm %s", userid) | python | def guest_reboot(self, userid):
"""Reboot a guest vm."""
LOG.info("Begin to reboot vm %s", userid)
self._smtclient.guest_reboot(userid)
LOG.info("Complete reboot vm %s", userid) | [
"def",
"guest_reboot",
"(",
"self",
",",
"userid",
")",
":",
"LOG",
".",
"info",
"(",
"\"Begin to reboot vm %s\"",
",",
"userid",
")",
"self",
".",
"_smtclient",
".",
"guest_reboot",
"(",
"userid",
")",
"LOG",
".",
"info",
"(",
"\"Complete reboot vm %s\"",
"... | Reboot a guest vm. | [
"Reboot",
"a",
"guest",
"vm",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/vmops.py#L134-L138 |
mfcloud/python-zvm-sdk | zvmsdk/vmops.py | VMOps.guest_reset | def guest_reset(self, userid):
"""Reset z/VM instance."""
LOG.info("Begin to reset vm %s", userid)
self._smtclient.guest_reset(userid)
LOG.info("Complete reset vm %s", userid) | python | def guest_reset(self, userid):
"""Reset z/VM instance."""
LOG.info("Begin to reset vm %s", userid)
self._smtclient.guest_reset(userid)
LOG.info("Complete reset vm %s", userid) | [
"def",
"guest_reset",
"(",
"self",
",",
"userid",
")",
":",
"LOG",
".",
"info",
"(",
"\"Begin to reset vm %s\"",
",",
"userid",
")",
"self",
".",
"_smtclient",
".",
"guest_reset",
"(",
"userid",
")",
"LOG",
".",
"info",
"(",
"\"Complete reset vm %s\"",
",",
... | Reset z/VM instance. | [
"Reset",
"z",
"/",
"VM",
"instance",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/vmops.py#L140-L144 |
mfcloud/python-zvm-sdk | zvmsdk/vmops.py | VMOps.live_migrate_vm | def live_migrate_vm(self, userid, destination, parms, action):
"""Move an eligible, running z/VM(R) virtual machine transparently
from one z/VM system to another within an SSI cluster."""
# Check guest state is 'on'
state = self.get_power_state(userid)
if state != 'on':
... | python | def live_migrate_vm(self, userid, destination, parms, action):
"""Move an eligible, running z/VM(R) virtual machine transparently
from one z/VM system to another within an SSI cluster."""
# Check guest state is 'on'
state = self.get_power_state(userid)
if state != 'on':
... | [
"def",
"live_migrate_vm",
"(",
"self",
",",
"userid",
",",
"destination",
",",
"parms",
",",
"action",
")",
":",
"# Check guest state is 'on'",
"state",
"=",
"self",
".",
"get_power_state",
"(",
"userid",
")",
"if",
"state",
"!=",
"'on'",
":",
"LOG",
".",
... | Move an eligible, running z/VM(R) virtual machine transparently
from one z/VM system to another within an SSI cluster. | [
"Move",
"an",
"eligible",
"running",
"z",
"/",
"VM",
"(",
"R",
")",
"virtual",
"machine",
"transparently",
"from",
"one",
"z",
"/",
"VM",
"system",
"to",
"another",
"within",
"an",
"SSI",
"cluster",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/vmops.py#L146-L165 |
mfcloud/python-zvm-sdk | zvmsdk/vmops.py | VMOps.create_vm | def create_vm(self, userid, cpu, memory, disk_list,
user_profile, max_cpu, max_mem, ipl_from,
ipl_param, ipl_loadparam):
"""Create z/VM userid into user directory for a z/VM instance."""
LOG.info("Creating the user directory for vm %s", userid)
info = self._s... | python | def create_vm(self, userid, cpu, memory, disk_list,
user_profile, max_cpu, max_mem, ipl_from,
ipl_param, ipl_loadparam):
"""Create z/VM userid into user directory for a z/VM instance."""
LOG.info("Creating the user directory for vm %s", userid)
info = self._s... | [
"def",
"create_vm",
"(",
"self",
",",
"userid",
",",
"cpu",
",",
"memory",
",",
"disk_list",
",",
"user_profile",
",",
"max_cpu",
",",
"max_mem",
",",
"ipl_from",
",",
"ipl_param",
",",
"ipl_loadparam",
")",
":",
"LOG",
".",
"info",
"(",
"\"Creating the us... | Create z/VM userid into user directory for a z/VM instance. | [
"Create",
"z",
"/",
"VM",
"userid",
"into",
"user",
"directory",
"for",
"a",
"z",
"/",
"VM",
"instance",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/vmops.py#L167-L180 |
mfcloud/python-zvm-sdk | zvmsdk/vmops.py | VMOps.delete_vm | def delete_vm(self, userid):
"""Delete z/VM userid for the instance."""
LOG.info("Begin to delete vm %s", userid)
self._smtclient.delete_vm(userid)
# remove userid from smapi namelist
self._smtclient.namelist_remove(self._namelist, userid)
LOG.info("Complete delete vm %s... | python | def delete_vm(self, userid):
"""Delete z/VM userid for the instance."""
LOG.info("Begin to delete vm %s", userid)
self._smtclient.delete_vm(userid)
# remove userid from smapi namelist
self._smtclient.namelist_remove(self._namelist, userid)
LOG.info("Complete delete vm %s... | [
"def",
"delete_vm",
"(",
"self",
",",
"userid",
")",
":",
"LOG",
".",
"info",
"(",
"\"Begin to delete vm %s\"",
",",
"userid",
")",
"self",
".",
"_smtclient",
".",
"delete_vm",
"(",
"userid",
")",
"# remove userid from smapi namelist",
"self",
".",
"_smtclient",... | Delete z/VM userid for the instance. | [
"Delete",
"z",
"/",
"VM",
"userid",
"for",
"the",
"instance",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/vmops.py#L227-L234 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.