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 |
|---|---|---|---|---|---|---|---|---|---|---|
mfcloud/python-zvm-sdk | sample/simple/sample.py | coupleTo_vswitch | def coupleTo_vswitch(userid, vswitch_name):
""" Couple to vswitch.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8
:network_info: dict of network info
"""
print("\nCoupleing to vswitch for %s ..." % userid)
vswitch_info = client.send_request('guest_nic_c... | python | def coupleTo_vswitch(userid, vswitch_name):
""" Couple to vswitch.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8
:network_info: dict of network info
"""
print("\nCoupleing to vswitch for %s ..." % userid)
vswitch_info = client.send_request('guest_nic_c... | [
"def",
"coupleTo_vswitch",
"(",
"userid",
",",
"vswitch_name",
")",
":",
"print",
"(",
"\"\\nCoupleing to vswitch for %s ...\"",
"%",
"userid",
")",
"vswitch_info",
"=",
"client",
".",
"send_request",
"(",
"'guest_nic_couple_to_vswitch'",
",",
"userid",
",",
"'1000'",... | Couple to vswitch.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8
:network_info: dict of network info | [
"Couple",
"to",
"vswitch",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/sample/simple/sample.py#L151-L166 |
mfcloud/python-zvm-sdk | sample/simple/sample.py | grant_user | def grant_user(userid, vswitch_name):
""" Grant user.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8
:network_info: dict of network info
"""
print("\nGranting user %s ..." % userid)
user_grant_info = client.send_request('vswitch_grant_user', vswitch_nam... | python | def grant_user(userid, vswitch_name):
""" Grant user.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8
:network_info: dict of network info
"""
print("\nGranting user %s ..." % userid)
user_grant_info = client.send_request('vswitch_grant_user', vswitch_nam... | [
"def",
"grant_user",
"(",
"userid",
",",
"vswitch_name",
")",
":",
"print",
"(",
"\"\\nGranting user %s ...\"",
"%",
"userid",
")",
"user_grant_info",
"=",
"client",
".",
"send_request",
"(",
"'vswitch_grant_user'",
",",
"vswitch_name",
",",
"userid",
")",
"if",
... | Grant user.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8
:network_info: dict of network info | [
"Grant",
"user",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/sample/simple/sample.py#L169-L182 |
mfcloud/python-zvm-sdk | sample/simple/sample.py | start_guest | def start_guest(userid):
""" Power on the vm.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8
"""
# Check the power state before starting guest.
power_state_info = client.send_request('guest_get_power_state', userid)
print("\nPower state is: %s." % power_stat... | python | def start_guest(userid):
""" Power on the vm.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8
"""
# Check the power state before starting guest.
power_state_info = client.send_request('guest_get_power_state', userid)
print("\nPower state is: %s." % power_stat... | [
"def",
"start_guest",
"(",
"userid",
")",
":",
"# Check the power state before starting guest.",
"power_state_info",
"=",
"client",
".",
"send_request",
"(",
"'guest_get_power_state'",
",",
"userid",
")",
"print",
"(",
"\"\\nPower state is: %s.\"",
"%",
"power_state_info",
... | Power on the vm.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8 | [
"Power",
"on",
"the",
"vm",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/sample/simple/sample.py#L185-L209 |
mfcloud/python-zvm-sdk | sample/simple/sample.py | _run_guest | def _run_guest(userid, image_path, os_version, profile,
cpu, memory, network_info, vswitch_name, disks_list):
""" Deploy and provide a virtual machine.
Input parameters:
:userid: USERID of the guest, no more than 8
:image_path: image file path
:os_version: ... | python | def _run_guest(userid, image_path, os_version, profile,
cpu, memory, network_info, vswitch_name, disks_list):
""" Deploy and provide a virtual machine.
Input parameters:
:userid: USERID of the guest, no more than 8
:image_path: image file path
:os_version: ... | [
"def",
"_run_guest",
"(",
"userid",
",",
"image_path",
",",
"os_version",
",",
"profile",
",",
"cpu",
",",
"memory",
",",
"network_info",
",",
"vswitch_name",
",",
"disks_list",
")",
":",
"print",
"(",
"\"Start deploying a virtual machine:\"",
")",
"# Import image... | Deploy and provide a virtual machine.
Input parameters:
:userid: USERID of the guest, no more than 8
:image_path: image file path
:os_version: os version of the image file
:profile: profile of the userid
:cpu: the number of vc... | [
"Deploy",
"and",
"provide",
"a",
"virtual",
"machine",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/sample/simple/sample.py#L212-L266 |
mfcloud/python-zvm-sdk | sample/simple/sample.py | _user_input_properties | def _user_input_properties():
""" User input the properties of guest, image, and network. """
global GUEST_USERID
global GUEST_PROFILE
global GUEST_VCPUS
global GUEST_MEMORY
global GUEST_ROOT_DISK_SIZE
global DISK_POOL
global IMAGE_PATH
global IMAGE_OS_VERSION
global GUEST_IP_ADD... | python | def _user_input_properties():
""" User input the properties of guest, image, and network. """
global GUEST_USERID
global GUEST_PROFILE
global GUEST_VCPUS
global GUEST_MEMORY
global GUEST_ROOT_DISK_SIZE
global DISK_POOL
global IMAGE_PATH
global IMAGE_OS_VERSION
global GUEST_IP_ADD... | [
"def",
"_user_input_properties",
"(",
")",
":",
"global",
"GUEST_USERID",
"global",
"GUEST_PROFILE",
"global",
"GUEST_VCPUS",
"global",
"GUEST_MEMORY",
"global",
"GUEST_ROOT_DISK_SIZE",
"global",
"DISK_POOL",
"global",
"IMAGE_PATH",
"global",
"IMAGE_OS_VERSION",
"global",
... | User input the properties of guest, image, and network. | [
"User",
"input",
"the",
"properties",
"of",
"guest",
"image",
"and",
"network",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/sample/simple/sample.py#L269-L315 |
mfcloud/python-zvm-sdk | sample/simple/sample.py | run_guest | def run_guest():
"""
A sample for quickly deploy and start a virtual guest.
"""
# user input the properties of guest, image and network.
_user_input_properties()
# run a guest.
_run_guest(GUEST_USERID, IMAGE_PATH, IMAGE_OS_VERSION, GUEST_PROFILE,
GUEST_VCPUS, GUEST_MEMORY, ... | python | def run_guest():
"""
A sample for quickly deploy and start a virtual guest.
"""
# user input the properties of guest, image and network.
_user_input_properties()
# run a guest.
_run_guest(GUEST_USERID, IMAGE_PATH, IMAGE_OS_VERSION, GUEST_PROFILE,
GUEST_VCPUS, GUEST_MEMORY, ... | [
"def",
"run_guest",
"(",
")",
":",
"# user input the properties of guest, image and network.",
"_user_input_properties",
"(",
")",
"# run a guest.",
"_run_guest",
"(",
"GUEST_USERID",
",",
"IMAGE_PATH",
",",
"IMAGE_OS_VERSION",
",",
"GUEST_PROFILE",
",",
"GUEST_VCPUS",
",",... | A sample for quickly deploy and start a virtual guest. | [
"A",
"sample",
"for",
"quickly",
"deploy",
"and",
"start",
"a",
"virtual",
"guest",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/sample/simple/sample.py#L318-L328 |
mfcloud/python-zvm-sdk | doc/source/conf.py | package_version | def package_version(filename, varname):
"""Return package version string by reading `filename` and retrieving its
module-global variable `varnam`."""
_locals = {}
with open(filename) as fp:
exec(fp.read(), None, _locals)
return _locals[varname] | python | def package_version(filename, varname):
"""Return package version string by reading `filename` and retrieving its
module-global variable `varnam`."""
_locals = {}
with open(filename) as fp:
exec(fp.read(), None, _locals)
return _locals[varname] | [
"def",
"package_version",
"(",
"filename",
",",
"varname",
")",
":",
"_locals",
"=",
"{",
"}",
"with",
"open",
"(",
"filename",
")",
"as",
"fp",
":",
"exec",
"(",
"fp",
".",
"read",
"(",
")",
",",
"None",
",",
"_locals",
")",
"return",
"_locals",
"... | Return package version string by reading `filename` and retrieving its
module-global variable `varnam`. | [
"Return",
"package",
"version",
"string",
"by",
"reading",
"filename",
"and",
"retrieving",
"its",
"module",
"-",
"global",
"variable",
"varnam",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/doc/source/conf.py#L69-L75 |
mfcloud/python-zvm-sdk | smtLayer/smt.py | SMT.request | def request(self, requestData, **kwArgs):
"""
Process a request.
Input:
Request as either a string or a list.
captureLogs=<True|False>
Enables or disables log capture per request.
This overrides the value from SMT.
requestId=<id> to p... | python | def request(self, requestData, **kwArgs):
"""
Process a request.
Input:
Request as either a string or a list.
captureLogs=<True|False>
Enables or disables log capture per request.
This overrides the value from SMT.
requestId=<id> to p... | [
"def",
"request",
"(",
"self",
",",
"requestData",
",",
"*",
"*",
"kwArgs",
")",
":",
"self",
".",
"reqCnt",
"=",
"self",
".",
"reqCnt",
"+",
"1",
"# Determine whether the request will be capturing logs",
"if",
"'captureLogs'",
"in",
"kwArgs",
".",
"keys",
"("... | Process a request.
Input:
Request as either a string or a list.
captureLogs=<True|False>
Enables or disables log capture per request.
This overrides the value from SMT.
requestId=<id> to pass a value for the request Id instead of
using ... | [
"Process",
"a",
"request",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/smt.py#L76-L117 |
mfcloud/python-zvm-sdk | smtLayer/smapi.py | invokeSmapiApi | def invokeSmapiApi(rh):
"""
Invoke a SMAPI API.
Input:
Request Handle with the following properties:
function - 'SMAPI'
subfunction - 'API'
userid - 'HYPERVISOR'
parms['apiName'] - Name of API as defined by SMCLI
parms['operands'] - List (... | python | def invokeSmapiApi(rh):
"""
Invoke a SMAPI API.
Input:
Request Handle with the following properties:
function - 'SMAPI'
subfunction - 'API'
userid - 'HYPERVISOR'
parms['apiName'] - Name of API as defined by SMCLI
parms['operands'] - List (... | [
"def",
"invokeSmapiApi",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter smapi.invokeSmapiApi\"",
")",
"if",
"rh",
".",
"userid",
"!=",
"'HYPERVISOR'",
":",
"userid",
"=",
"rh",
".",
"userid",
"else",
":",
"userid",
"=",
"'dummy'",
"parms",
"=... | Invoke a SMAPI API.
Input:
Request Handle with the following properties:
function - 'SMAPI'
subfunction - 'API'
userid - 'HYPERVISOR'
parms['apiName'] - Name of API as defined by SMCLI
parms['operands'] - List (array) of operands to send or
... | [
"Invoke",
"a",
"SMAPI",
"API",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/smapi.py#L133-L170 |
mfcloud/python-zvm-sdk | zvmsdk/volumeop.py | FCP._parse | def _parse(self, init_info):
"""Initialize a FCP device object from several lines of string
describing properties of the FCP device.
Here is a sample:
opnstk1: FCP device number: B83D
opnstk1: Status: Free
opnstk1: NPIV world wide port numbe... | python | def _parse(self, init_info):
"""Initialize a FCP device object from several lines of string
describing properties of the FCP device.
Here is a sample:
opnstk1: FCP device number: B83D
opnstk1: Status: Free
opnstk1: NPIV world wide port numbe... | [
"def",
"_parse",
"(",
"self",
",",
"init_info",
")",
":",
"if",
"isinstance",
"(",
"init_info",
",",
"list",
")",
"and",
"(",
"len",
"(",
"init_info",
")",
"==",
"5",
")",
":",
"self",
".",
"_dev_no",
"=",
"self",
".",
"_get_dev_number_from_line",
"(",... | Initialize a FCP device object from several lines of string
describing properties of the FCP device.
Here is a sample:
opnstk1: FCP device number: B83D
opnstk1: Status: Free
opnstk1: NPIV world wide port number: NONE
opnstk1: Channe... | [
"Initialize",
"a",
"FCP",
"device",
"object",
"from",
"several",
"lines",
"of",
"string",
"describing",
"properties",
"of",
"the",
"FCP",
"device",
".",
"Here",
"is",
"a",
"sample",
":",
"opnstk1",
":",
"FCP",
"device",
"number",
":",
"B83D",
"opnstk1",
":... | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/volumeop.py#L216-L232 |
mfcloud/python-zvm-sdk | zvmsdk/volumeop.py | FCPManager.init_fcp | def init_fcp(self, assigner_id):
"""init_fcp to init the FCP managed by this host"""
# TODO master_fcp_list (zvm_zhcp_fcp_list) really need?
fcp_list = CONF.volume.fcp_list
if fcp_list == '':
errmsg = ("because CONF.volume.fcp_list is empty, "
"no volume... | python | def init_fcp(self, assigner_id):
"""init_fcp to init the FCP managed by this host"""
# TODO master_fcp_list (zvm_zhcp_fcp_list) really need?
fcp_list = CONF.volume.fcp_list
if fcp_list == '':
errmsg = ("because CONF.volume.fcp_list is empty, "
"no volume... | [
"def",
"init_fcp",
"(",
"self",
",",
"assigner_id",
")",
":",
"# TODO master_fcp_list (zvm_zhcp_fcp_list) really need?",
"fcp_list",
"=",
"CONF",
".",
"volume",
".",
"fcp_list",
"if",
"fcp_list",
"==",
"''",
":",
"errmsg",
"=",
"(",
"\"because CONF.volume.fcp_list is ... | init_fcp to init the FCP managed by this host | [
"init_fcp",
"to",
"init",
"the",
"FCP",
"managed",
"by",
"this",
"host"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/volumeop.py#L258-L269 |
mfcloud/python-zvm-sdk | zvmsdk/volumeop.py | FCPManager._init_fcp_pool | def _init_fcp_pool(self, fcp_list, assigner_id):
"""The FCP infomation got from smt(zthin) looks like :
host: FCP device number: xxxx
host: Status: Active
host: NPIV world wide port number: xxxxxxxx
host: Channel path ID: xx
host: Physical world wid... | python | def _init_fcp_pool(self, fcp_list, assigner_id):
"""The FCP infomation got from smt(zthin) looks like :
host: FCP device number: xxxx
host: Status: Active
host: NPIV world wide port number: xxxxxxxx
host: Channel path ID: xx
host: Physical world wid... | [
"def",
"_init_fcp_pool",
"(",
"self",
",",
"fcp_list",
",",
"assigner_id",
")",
":",
"complete_fcp_set",
"=",
"self",
".",
"_expand_fcp_list",
"(",
"fcp_list",
")",
"fcp_info",
"=",
"self",
".",
"_get_all_fcp_info",
"(",
"assigner_id",
")",
"lines_per_item",
"="... | The FCP infomation got from smt(zthin) looks like :
host: FCP device number: xxxx
host: Status: Active
host: NPIV world wide port number: xxxxxxxx
host: Channel path ID: xx
host: Physical world wide port number: xxxxxxxx
......
host: F... | [
"The",
"FCP",
"infomation",
"got",
"from",
"smt",
"(",
"zthin",
")",
"looks",
"like",
":",
"host",
":",
"FCP",
"device",
"number",
":",
"xxxx",
"host",
":",
"Status",
":",
"Active",
"host",
":",
"NPIV",
"world",
"wide",
"port",
"number",
":",
"xxxxxxxx... | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/volumeop.py#L271-L312 |
mfcloud/python-zvm-sdk | zvmsdk/volumeop.py | FCPManager._expand_fcp_list | def _expand_fcp_list(fcp_list):
"""Expand fcp list string into a python list object which contains
each fcp devices in the list string. A fcp list is composed of fcp
device addresses, range indicator '-', and split indicator ';'.
For example, if fcp_list is
"0011-0013;0015;0017-... | python | def _expand_fcp_list(fcp_list):
"""Expand fcp list string into a python list object which contains
each fcp devices in the list string. A fcp list is composed of fcp
device addresses, range indicator '-', and split indicator ';'.
For example, if fcp_list is
"0011-0013;0015;0017-... | [
"def",
"_expand_fcp_list",
"(",
"fcp_list",
")",
":",
"LOG",
".",
"debug",
"(",
"\"Expand FCP list %s\"",
"%",
"fcp_list",
")",
"if",
"not",
"fcp_list",
":",
"return",
"set",
"(",
")",
"range_pattern",
"=",
"'[0-9a-fA-F]{1,4}(-[0-9a-fA-F]{1,4})?'",
"match_pattern",
... | Expand fcp list string into a python list object which contains
each fcp devices in the list string. A fcp list is composed of fcp
device addresses, range indicator '-', and split indicator ';'.
For example, if fcp_list is
"0011-0013;0015;0017-0018", expand_fcp_list(fcp_list) will retur... | [
"Expand",
"fcp",
"list",
"string",
"into",
"a",
"python",
"list",
"object",
"which",
"contains",
"each",
"fcp",
"devices",
"in",
"the",
"list",
"string",
".",
"A",
"fcp",
"list",
"is",
"composed",
"of",
"fcp",
"device",
"addresses",
"range",
"indicator",
"... | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/volumeop.py#L315-L352 |
mfcloud/python-zvm-sdk | zvmsdk/volumeop.py | FCPManager._add_fcp | def _add_fcp(self, fcp):
"""add fcp to db if it's not in db but in fcp list and init it"""
try:
LOG.info("fcp %s found in CONF.volume.fcp_list, add it to db" %
fcp)
self.db.new(fcp)
except Exception:
LOG.info("failed to add fcp %s into db"... | python | def _add_fcp(self, fcp):
"""add fcp to db if it's not in db but in fcp list and init it"""
try:
LOG.info("fcp %s found in CONF.volume.fcp_list, add it to db" %
fcp)
self.db.new(fcp)
except Exception:
LOG.info("failed to add fcp %s into db"... | [
"def",
"_add_fcp",
"(",
"self",
",",
"fcp",
")",
":",
"try",
":",
"LOG",
".",
"info",
"(",
"\"fcp %s found in CONF.volume.fcp_list, add it to db\"",
"%",
"fcp",
")",
"self",
".",
"db",
".",
"new",
"(",
"fcp",
")",
"except",
"Exception",
":",
"LOG",
".",
... | add fcp to db if it's not in db but in fcp list and init it | [
"add",
"fcp",
"to",
"db",
"if",
"it",
"s",
"not",
"in",
"db",
"but",
"in",
"fcp",
"list",
"and",
"init",
"it"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/volumeop.py#L360-L367 |
mfcloud/python-zvm-sdk | zvmsdk/volumeop.py | FCPManager._sync_db_fcp_list | def _sync_db_fcp_list(self):
"""sync db records from given fcp list, for example, you need
warn if some FCP already removed while it's still in use,
or info about the new FCP added"""
fcp_db_list = self.db.get_all()
for fcp_rec in fcp_db_list:
if not fcp_rec[0].lower... | python | def _sync_db_fcp_list(self):
"""sync db records from given fcp list, for example, you need
warn if some FCP already removed while it's still in use,
or info about the new FCP added"""
fcp_db_list = self.db.get_all()
for fcp_rec in fcp_db_list:
if not fcp_rec[0].lower... | [
"def",
"_sync_db_fcp_list",
"(",
"self",
")",
":",
"fcp_db_list",
"=",
"self",
".",
"db",
".",
"get_all",
"(",
")",
"for",
"fcp_rec",
"in",
"fcp_db_list",
":",
"if",
"not",
"fcp_rec",
"[",
"0",
"]",
".",
"lower",
"(",
")",
"in",
"self",
".",
"_fcp_po... | sync db records from given fcp list, for example, you need
warn if some FCP already removed while it's still in use,
or info about the new FCP added | [
"sync",
"db",
"records",
"from",
"given",
"fcp",
"list",
"for",
"example",
"you",
"need",
"warn",
"if",
"some",
"FCP",
"already",
"removed",
"while",
"it",
"s",
"still",
"in",
"use",
"or",
"info",
"about",
"the",
"new",
"FCP",
"added"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/volumeop.py#L369-L384 |
mfcloud/python-zvm-sdk | zvmsdk/volumeop.py | FCPManager.find_and_reserve_fcp | def find_and_reserve_fcp(self, assigner_id):
"""reserve the fcp to assigner_id
The function to reserve a fcp for user
1. Check whether assigner_id has a fcp already
if yes, make the reserve of that record to 1
2. No fcp, then find a fcp and reserve it
fcp will be ret... | python | def find_and_reserve_fcp(self, assigner_id):
"""reserve the fcp to assigner_id
The function to reserve a fcp for user
1. Check whether assigner_id has a fcp already
if yes, make the reserve of that record to 1
2. No fcp, then find a fcp and reserve it
fcp will be ret... | [
"def",
"find_and_reserve_fcp",
"(",
"self",
",",
"assigner_id",
")",
":",
"fcp_list",
"=",
"self",
".",
"db",
".",
"get_from_assigner",
"(",
"assigner_id",
")",
"if",
"not",
"fcp_list",
":",
"new_fcp",
"=",
"self",
".",
"db",
".",
"find_and_reserve",
"(",
... | reserve the fcp to assigner_id
The function to reserve a fcp for user
1. Check whether assigner_id has a fcp already
if yes, make the reserve of that record to 1
2. No fcp, then find a fcp and reserve it
fcp will be returned, or None indicate no fcp | [
"reserve",
"the",
"fcp",
"to",
"assigner_id"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/volumeop.py#L402-L426 |
mfcloud/python-zvm-sdk | zvmsdk/volumeop.py | FCPManager.increase_fcp_usage | def increase_fcp_usage(self, fcp, assigner_id=None):
"""Incrase fcp usage of given fcp
Returns True if it's a new fcp, otherwise return False
"""
# TODO: check assigner_id to make sure on the correct fcp record
connections = self.db.get_connections_from_assigner(assigner_id)
... | python | def increase_fcp_usage(self, fcp, assigner_id=None):
"""Incrase fcp usage of given fcp
Returns True if it's a new fcp, otherwise return False
"""
# TODO: check assigner_id to make sure on the correct fcp record
connections = self.db.get_connections_from_assigner(assigner_id)
... | [
"def",
"increase_fcp_usage",
"(",
"self",
",",
"fcp",
",",
"assigner_id",
"=",
"None",
")",
":",
"# TODO: check assigner_id to make sure on the correct fcp record",
"connections",
"=",
"self",
".",
"db",
".",
"get_connections_from_assigner",
"(",
"assigner_id",
")",
"ne... | Incrase fcp usage of given fcp
Returns True if it's a new fcp, otherwise return False | [
"Incrase",
"fcp",
"usage",
"of",
"given",
"fcp"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/volumeop.py#L428-L443 |
mfcloud/python-zvm-sdk | zvmsdk/volumeop.py | FCPManager.get_available_fcp | def get_available_fcp(self):
"""get all the fcps not reserved"""
# get the unreserved FCP devices belongs to assigner_id
available_list = []
free_unreserved = self.db.get_all_free_unreserved()
for item in free_unreserved:
available_list.append(item[0])
return ... | python | def get_available_fcp(self):
"""get all the fcps not reserved"""
# get the unreserved FCP devices belongs to assigner_id
available_list = []
free_unreserved = self.db.get_all_free_unreserved()
for item in free_unreserved:
available_list.append(item[0])
return ... | [
"def",
"get_available_fcp",
"(",
"self",
")",
":",
"# get the unreserved FCP devices belongs to assigner_id",
"available_list",
"=",
"[",
"]",
"free_unreserved",
"=",
"self",
".",
"db",
".",
"get_all_free_unreserved",
"(",
")",
"for",
"item",
"in",
"free_unreserved",
... | get all the fcps not reserved | [
"get",
"all",
"the",
"fcps",
"not",
"reserved"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/volumeop.py#L458-L465 |
mfcloud/python-zvm-sdk | zvmsdk/volumeop.py | FCPVolumeManager._attach | def _attach(self, fcp, assigner_id, target_wwpn, target_lun,
multipath, os_version, mount_point):
"""Attach a volume
First, we need translate fcp into local wwpn, then
dedicate fcp to the user if it's needed, after that
call smt layer to call linux command
"""
... | python | def _attach(self, fcp, assigner_id, target_wwpn, target_lun,
multipath, os_version, mount_point):
"""Attach a volume
First, we need translate fcp into local wwpn, then
dedicate fcp to the user if it's needed, after that
call smt layer to call linux command
"""
... | [
"def",
"_attach",
"(",
"self",
",",
"fcp",
",",
"assigner_id",
",",
"target_wwpn",
",",
"target_lun",
",",
"multipath",
",",
"os_version",
",",
"mount_point",
")",
":",
"LOG",
".",
"info",
"(",
"'Start to attach device to %s'",
"%",
"assigner_id",
")",
"self",... | Attach a volume
First, we need translate fcp into local wwpn, then
dedicate fcp to the user if it's needed, after that
call smt layer to call linux command | [
"Attach",
"a",
"volume"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/volumeop.py#L496-L524 |
mfcloud/python-zvm-sdk | zvmsdk/volumeop.py | FCPVolumeManager._detach | def _detach(self, fcp, assigner_id, target_wwpn, target_lun,
multipath, os_version, mount_point):
"""Detach a volume from a guest"""
LOG.info('Start to detach device from %s' % assigner_id)
connections = self.fcp_mgr.decrease_fcp_usage(fcp, assigner_id)
try:
... | python | def _detach(self, fcp, assigner_id, target_wwpn, target_lun,
multipath, os_version, mount_point):
"""Detach a volume from a guest"""
LOG.info('Start to detach device from %s' % assigner_id)
connections = self.fcp_mgr.decrease_fcp_usage(fcp, assigner_id)
try:
... | [
"def",
"_detach",
"(",
"self",
",",
"fcp",
",",
"assigner_id",
",",
"target_wwpn",
",",
"target_lun",
",",
"multipath",
",",
"os_version",
",",
"mount_point",
")",
":",
"LOG",
".",
"info",
"(",
"'Start to detach device from %s'",
"%",
"assigner_id",
")",
"conn... | Detach a volume from a guest | [
"Detach",
"a",
"volume",
"from",
"a",
"guest"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/volumeop.py#L565-L586 |
mfcloud/python-zvm-sdk | zvmsdk/volumeop.py | FCPVolumeManager.detach | def detach(self, connection_info):
"""Detach a volume from a guest
"""
fcp = connection_info['zvm_fcp']
fcp = fcp.lower()
target_wwpn = connection_info['target_wwpn']
target_lun = connection_info['target_lun']
assigner_id = connection_info['assigner_id']
a... | python | def detach(self, connection_info):
"""Detach a volume from a guest
"""
fcp = connection_info['zvm_fcp']
fcp = fcp.lower()
target_wwpn = connection_info['target_wwpn']
target_lun = connection_info['target_lun']
assigner_id = connection_info['assigner_id']
a... | [
"def",
"detach",
"(",
"self",
",",
"connection_info",
")",
":",
"fcp",
"=",
"connection_info",
"[",
"'zvm_fcp'",
"]",
"fcp",
"=",
"fcp",
".",
"lower",
"(",
")",
"target_wwpn",
"=",
"connection_info",
"[",
"'target_wwpn'",
"]",
"target_lun",
"=",
"connection_... | Detach a volume from a guest | [
"Detach",
"a",
"volume",
"from",
"a",
"guest"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/volumeop.py#L588-L607 |
mfcloud/python-zvm-sdk | zvmsdk/volumeop.py | FCPVolumeManager.get_volume_connector | def get_volume_connector(self, assigner_id):
"""Get connector information of the instance for attaching to volumes.
Connector information is a dictionary representing the ip of the
machine that will be making the connection, the name of the iscsi
initiator and the hostname of the machin... | python | def get_volume_connector(self, assigner_id):
"""Get connector information of the instance for attaching to volumes.
Connector information is a dictionary representing the ip of the
machine that will be making the connection, the name of the iscsi
initiator and the hostname of the machin... | [
"def",
"get_volume_connector",
"(",
"self",
",",
"assigner_id",
")",
":",
"empty_connector",
"=",
"{",
"'zvm_fcp'",
":",
"[",
"]",
",",
"'wwpns'",
":",
"[",
"]",
",",
"'host'",
":",
"''",
"}",
"# init fcp pool",
"self",
".",
"fcp_mgr",
".",
"init_fcp",
"... | Get connector information of the instance for attaching to volumes.
Connector information is a dictionary representing the ip of the
machine that will be making the connection, the name of the iscsi
initiator and the hostname of the machine as follows::
{
'zvm_fcp':... | [
"Get",
"connector",
"information",
"of",
"the",
"instance",
"for",
"attaching",
"to",
"volumes",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/volumeop.py#L609-L658 |
jvarho/pylibscrypt | pylibscrypt/pypyscrypt_inline.py | salsa20_8 | def salsa20_8(B, x, src, s_start, dest, d_start):
"""Salsa20/8 http://en.wikipedia.org/wiki/Salsa20"""
# Merged blockxor for speed
for i in xrange(16):
x[i] = B[i] = B[i] ^ src[s_start + i]
# This is the actual Salsa 20/8: four identical double rounds
for i in xrange(4):
a = (x[0]+... | python | def salsa20_8(B, x, src, s_start, dest, d_start):
"""Salsa20/8 http://en.wikipedia.org/wiki/Salsa20"""
# Merged blockxor for speed
for i in xrange(16):
x[i] = B[i] = B[i] ^ src[s_start + i]
# This is the actual Salsa 20/8: four identical double rounds
for i in xrange(4):
a = (x[0]+... | [
"def",
"salsa20_8",
"(",
"B",
",",
"x",
",",
"src",
",",
"s_start",
",",
"dest",
",",
"d_start",
")",
":",
"# Merged blockxor for speed",
"for",
"i",
"in",
"xrange",
"(",
"16",
")",
":",
"x",
"[",
"i",
"]",
"=",
"B",
"[",
"i",
"]",
"=",
"B",
"[... | Salsa20/8 http://en.wikipedia.org/wiki/Salsa20 | [
"Salsa20",
"/",
"8",
"http",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Salsa20"
] | train | https://github.com/jvarho/pylibscrypt/blob/f2ff02e49f44aa620e308a4a64dd8376b9510f99/pylibscrypt/pypyscrypt_inline.py#L58-L135 |
jvarho/pylibscrypt | pylibscrypt/pypyscrypt_inline.py | blockmix_salsa8 | def blockmix_salsa8(BY, Yi, r):
"""Blockmix; Used by SMix"""
start = (2 * r - 1) * 16
X = BY[start:start+16] # BlockMix - 1
tmp = [0]*16
for i in xrange(2 * r): # BlockMix - 2
#blockxor(BY, i * 16, X, 0, 16) # BlockMix -... | python | def blockmix_salsa8(BY, Yi, r):
"""Blockmix; Used by SMix"""
start = (2 * r - 1) * 16
X = BY[start:start+16] # BlockMix - 1
tmp = [0]*16
for i in xrange(2 * r): # BlockMix - 2
#blockxor(BY, i * 16, X, 0, 16) # BlockMix -... | [
"def",
"blockmix_salsa8",
"(",
"BY",
",",
"Yi",
",",
"r",
")",
":",
"start",
"=",
"(",
"2",
"*",
"r",
"-",
"1",
")",
"*",
"16",
"X",
"=",
"BY",
"[",
"start",
":",
"start",
"+",
"16",
"]",
"# BlockMix - 1",
"tmp",
"=",
"[",
"0",
"]",
"*",
"1... | Blockmix; Used by SMix | [
"Blockmix",
";",
"Used",
"by",
"SMix"
] | train | https://github.com/jvarho/pylibscrypt/blob/f2ff02e49f44aa620e308a4a64dd8376b9510f99/pylibscrypt/pypyscrypt_inline.py#L138-L152 |
jvarho/pylibscrypt | pylibscrypt/pypyscrypt_inline.py | smix | def smix(B, Bi, r, N, V, X):
"""SMix; a specific case of ROMix based on Salsa20/8"""
X[0:(0)+(32 * r)] = B[Bi:(Bi)+(32 * r)]
for i in xrange(N): # ROMix - 2
V[i * (32 * r):(i * (32 * r))+(32 * r)] = X[0:(0)+(32 * r)]
blockmix_salsa8(X, 32 * r, r) ... | python | def smix(B, Bi, r, N, V, X):
"""SMix; a specific case of ROMix based on Salsa20/8"""
X[0:(0)+(32 * r)] = B[Bi:(Bi)+(32 * r)]
for i in xrange(N): # ROMix - 2
V[i * (32 * r):(i * (32 * r))+(32 * r)] = X[0:(0)+(32 * r)]
blockmix_salsa8(X, 32 * r, r) ... | [
"def",
"smix",
"(",
"B",
",",
"Bi",
",",
"r",
",",
"N",
",",
"V",
",",
"X",
")",
":",
"X",
"[",
"0",
":",
"(",
"0",
")",
"+",
"(",
"32",
"*",
"r",
")",
"]",
"=",
"B",
"[",
"Bi",
":",
"(",
"Bi",
")",
"+",
"(",
"32",
"*",
"r",
")",
... | SMix; a specific case of ROMix based on Salsa20/8 | [
"SMix",
";",
"a",
"specific",
"case",
"of",
"ROMix",
"based",
"on",
"Salsa20",
"/",
"8"
] | train | https://github.com/jvarho/pylibscrypt/blob/f2ff02e49f44aa620e308a4a64dd8376b9510f99/pylibscrypt/pypyscrypt_inline.py#L155-L169 |
jvarho/pylibscrypt | pylibscrypt/pypyscrypt_inline.py | scrypt | def scrypt(password, salt, N=SCRYPT_N, r=SCRYPT_r, p=SCRYPT_p, olen=64):
"""Returns a key derived using the scrypt key-derivarion function
N must be a power of two larger than 1 but no larger than 2 ** 63 (insane)
r and p must be positive numbers such that r * p < 2 ** 30
The default values are:
N... | python | def scrypt(password, salt, N=SCRYPT_N, r=SCRYPT_r, p=SCRYPT_p, olen=64):
"""Returns a key derived using the scrypt key-derivarion function
N must be a power of two larger than 1 but no larger than 2 ** 63 (insane)
r and p must be positive numbers such that r * p < 2 ** 30
The default values are:
N... | [
"def",
"scrypt",
"(",
"password",
",",
"salt",
",",
"N",
"=",
"SCRYPT_N",
",",
"r",
"=",
"SCRYPT_r",
",",
"p",
"=",
"SCRYPT_p",
",",
"olen",
"=",
"64",
")",
":",
"check_args",
"(",
"password",
",",
"salt",
",",
"N",
",",
"r",
",",
"p",
",",
"ol... | Returns a key derived using the scrypt key-derivarion function
N must be a power of two larger than 1 but no larger than 2 ** 63 (insane)
r and p must be positive numbers such that r * p < 2 ** 30
The default values are:
N -- 2**14 (~16k)
r -- 8
p -- 1
Memory usage is proportional to N*r.... | [
"Returns",
"a",
"key",
"derived",
"using",
"the",
"scrypt",
"key",
"-",
"derivarion",
"function"
] | train | https://github.com/jvarho/pylibscrypt/blob/f2ff02e49f44aa620e308a4a64dd8376b9510f99/pylibscrypt/pypyscrypt_inline.py#L172-L207 |
jvarho/pylibscrypt | pylibscrypt/pypyscrypt_inline.py | scrypt_mcf | def scrypt_mcf(password, salt=None, N=SCRYPT_N, r=SCRYPT_r, p=SCRYPT_p,
prefix=SCRYPT_MCF_PREFIX_DEFAULT):
"""Derives a Modular Crypt Format hash using the scrypt KDF
Parameter space is smaller than for scrypt():
N must be a power of two larger than 1 but no larger than 2 ** 31
r and p m... | python | def scrypt_mcf(password, salt=None, N=SCRYPT_N, r=SCRYPT_r, p=SCRYPT_p,
prefix=SCRYPT_MCF_PREFIX_DEFAULT):
"""Derives a Modular Crypt Format hash using the scrypt KDF
Parameter space is smaller than for scrypt():
N must be a power of two larger than 1 but no larger than 2 ** 31
r and p m... | [
"def",
"scrypt_mcf",
"(",
"password",
",",
"salt",
"=",
"None",
",",
"N",
"=",
"SCRYPT_N",
",",
"r",
"=",
"SCRYPT_r",
",",
"p",
"=",
"SCRYPT_p",
",",
"prefix",
"=",
"SCRYPT_MCF_PREFIX_DEFAULT",
")",
":",
"return",
"mcf_mod",
".",
"scrypt_mcf",
"(",
"scry... | Derives a Modular Crypt Format hash using the scrypt KDF
Parameter space is smaller than for scrypt():
N must be a power of two larger than 1 but no larger than 2 ** 31
r and p must be positive numbers between 1 and 255
Salt must be a byte string 1-16 bytes long.
If no salt is given, a random salt... | [
"Derives",
"a",
"Modular",
"Crypt",
"Format",
"hash",
"using",
"the",
"scrypt",
"KDF"
] | train | https://github.com/jvarho/pylibscrypt/blob/f2ff02e49f44aa620e308a4a64dd8376b9510f99/pylibscrypt/pypyscrypt_inline.py#L210-L221 |
Chilipp/psyplot | psyplot/project.py | _update_versions | def _update_versions():
"""Update :attr:`_versions` with the registered plotter methods"""
for pm_name in plot._plot_methods:
pm = getattr(plot, pm_name)
plugin = pm._plugin
if (plugin is not None and plugin not in _versions and
pm.module in sys.modules):
_ver... | python | def _update_versions():
"""Update :attr:`_versions` with the registered plotter methods"""
for pm_name in plot._plot_methods:
pm = getattr(plot, pm_name)
plugin = pm._plugin
if (plugin is not None and plugin not in _versions and
pm.module in sys.modules):
_ver... | [
"def",
"_update_versions",
"(",
")",
":",
"for",
"pm_name",
"in",
"plot",
".",
"_plot_methods",
":",
"pm",
"=",
"getattr",
"(",
"plot",
",",
"pm_name",
")",
"plugin",
"=",
"pm",
".",
"_plugin",
"if",
"(",
"plugin",
"is",
"not",
"None",
"and",
"plugin",... | Update :attr:`_versions` with the registered plotter methods | [
"Update",
":",
"attr",
":",
"_versions",
"with",
"the",
"registered",
"plotter",
"methods"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L70-L77 |
Chilipp/psyplot | psyplot/project.py | multiple_subplots | def multiple_subplots(rows=1, cols=1, maxplots=None, n=1, delete=True,
for_maps=False, *args, **kwargs):
"""
Function to create subplots.
This function creates so many subplots on so many figures until the
specified number `n` is reached.
Parameters
----------
rows: i... | python | def multiple_subplots(rows=1, cols=1, maxplots=None, n=1, delete=True,
for_maps=False, *args, **kwargs):
"""
Function to create subplots.
This function creates so many subplots on so many figures until the
specified number `n` is reached.
Parameters
----------
rows: i... | [
"def",
"multiple_subplots",
"(",
"rows",
"=",
"1",
",",
"cols",
"=",
"1",
",",
"maxplots",
"=",
"None",
",",
"n",
"=",
"1",
",",
"delete",
"=",
"True",
",",
"for_maps",
"=",
"False",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
... | Function to create subplots.
This function creates so many subplots on so many figures until the
specified number `n` is reached.
Parameters
----------
rows: int
The number of subplots per rows
cols: int
The number of subplots per column
maxplots: int
The number of ... | [
"Function",
"to",
"create",
"subplots",
"."
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L82-L138 |
Chilipp/psyplot | psyplot/project.py | _only_main | def _only_main(func):
"""Call the given `func` only from the main project"""
@wraps(func)
def wrapper(self, *args, **kwargs):
if not self.is_main:
return getattr(self.main, func.__name__)(*args, **kwargs)
return func(self, *args, **kwargs)
return wrapper | python | def _only_main(func):
"""Call the given `func` only from the main project"""
@wraps(func)
def wrapper(self, *args, **kwargs):
if not self.is_main:
return getattr(self.main, func.__name__)(*args, **kwargs)
return func(self, *args, **kwargs)
return wrapper | [
"def",
"_only_main",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"self",
".",
"is_main",
":",
"return",
"getattr",
"(",
"self",
".",
"main... | Call the given `func` only from the main project | [
"Call",
"the",
"given",
"func",
"only",
"from",
"the",
"main",
"project"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L145-L152 |
Chilipp/psyplot | psyplot/project.py | gcp | def gcp(main=False):
"""
Get the current project
Parameters
----------
main: bool
If True, the current main project is returned, otherwise the current
subproject is returned.
See Also
--------
scp: Sets the current project
project: Creates a new project"""
if mai... | python | def gcp(main=False):
"""
Get the current project
Parameters
----------
main: bool
If True, the current main project is returned, otherwise the current
subproject is returned.
See Also
--------
scp: Sets the current project
project: Creates a new project"""
if mai... | [
"def",
"gcp",
"(",
"main",
"=",
"False",
")",
":",
"if",
"main",
":",
"return",
"project",
"(",
")",
"if",
"_current_project",
"is",
"None",
"else",
"_current_project",
"else",
":",
"return",
"gcp",
"(",
"True",
")",
"if",
"_current_subproject",
"is",
"N... | Get the current project
Parameters
----------
main: bool
If True, the current main project is returned, otherwise the current
subproject is returned.
See Also
--------
scp: Sets the current project
project: Creates a new project | [
"Get",
"the",
"current",
"project"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L2262-L2279 |
Chilipp/psyplot | psyplot/project.py | _scp | def _scp(p, main=False):
"""scp version that allows a bit more control over whether the project is a
main project or not"""
global _current_subproject
global _current_project
if p is None:
mp = project() if main or _current_project is None else \
_current_project
_current... | python | def _scp(p, main=False):
"""scp version that allows a bit more control over whether the project is a
main project or not"""
global _current_subproject
global _current_project
if p is None:
mp = project() if main or _current_project is None else \
_current_project
_current... | [
"def",
"_scp",
"(",
"p",
",",
"main",
"=",
"False",
")",
":",
"global",
"_current_subproject",
"global",
"_current_project",
"if",
"p",
"is",
"None",
":",
"mp",
"=",
"project",
"(",
")",
"if",
"main",
"or",
"_current_project",
"is",
"None",
"else",
"_cur... | scp version that allows a bit more control over whether the project is a
main project or not | [
"scp",
"version",
"that",
"allows",
"a",
"bit",
"more",
"control",
"over",
"whether",
"the",
"project",
"is",
"a",
"main",
"project",
"or",
"not"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L2298-L2310 |
Chilipp/psyplot | psyplot/project.py | project | def project(num=None, *args, **kwargs):
"""
Create a new main project
Parameters
----------
num: int
The number of the project
%(Project.parameters.no_num)s
Returns
-------
Project
The with the given `num` (if it does not already exist, it is created)
See Also
... | python | def project(num=None, *args, **kwargs):
"""
Create a new main project
Parameters
----------
num: int
The number of the project
%(Project.parameters.no_num)s
Returns
-------
Project
The with the given `num` (if it does not already exist, it is created)
See Also
... | [
"def",
"project",
"(",
"num",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"numbers",
"=",
"[",
"project",
".",
"num",
"for",
"project",
"in",
"_open_projects",
"]",
"if",
"num",
"in",
"numbers",
":",
"return",
"_open_projects",
... | Create a new main project
Parameters
----------
num: int
The number of the project
%(Project.parameters.no_num)s
Returns
-------
Project
The with the given `num` (if it does not already exist, it is created)
See Also
--------
scp: Sets the current project
g... | [
"Create",
"a",
"new",
"main",
"project"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L2314-L2341 |
Chilipp/psyplot | psyplot/project.py | close | def close(num=None, figs=True, data=True, ds=True, remove_only=False):
"""
Close the project
This method closes the current project (figures, data and datasets) or the
project specified by `num`
Parameters
----------
num: int, None or 'all'
if :class:`int`, it specifies the number ... | python | def close(num=None, figs=True, data=True, ds=True, remove_only=False):
"""
Close the project
This method closes the current project (figures, data and datasets) or the
project specified by `num`
Parameters
----------
num: int, None or 'all'
if :class:`int`, it specifies the number ... | [
"def",
"close",
"(",
"num",
"=",
"None",
",",
"figs",
"=",
"True",
",",
"data",
"=",
"True",
",",
"ds",
"=",
"True",
",",
"remove_only",
"=",
"False",
")",
":",
"kws",
"=",
"dict",
"(",
"figs",
"=",
"figs",
",",
"data",
"=",
"data",
",",
"ds",
... | Close the project
This method closes the current project (figures, data and datasets) or the
project specified by `num`
Parameters
----------
num: int, None or 'all'
if :class:`int`, it specifies the number of the project, if None, the
current subproject is closed, if ``'all'``, al... | [
"Close",
"the",
"project"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L2345-L2392 |
Chilipp/psyplot | psyplot/project.py | register_plotter | def register_plotter(identifier, module, plotter_name, plotter_cls=None,
sorter=True, plot_func=True, import_plotter=None,
**kwargs):
"""
Register a :class:`psyplot.plotter.Plotter` for the projects
This function registers plotters for the :class:`Project` class to... | python | def register_plotter(identifier, module, plotter_name, plotter_cls=None,
sorter=True, plot_func=True, import_plotter=None,
**kwargs):
"""
Register a :class:`psyplot.plotter.Plotter` for the projects
This function registers plotters for the :class:`Project` class to... | [
"def",
"register_plotter",
"(",
"identifier",
",",
"module",
",",
"plotter_name",
",",
"plotter_cls",
"=",
"None",
",",
"sorter",
"=",
"True",
",",
"plot_func",
"=",
"True",
",",
"import_plotter",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"pl... | Register a :class:`psyplot.plotter.Plotter` for the projects
This function registers plotters for the :class:`Project` class to allow
a dynamical handling of different plotter classes.
Parameters
----------
%(Project._register_plotter.parameters.no_plotter_cls)s
sorter: bool, optional
... | [
"Register",
"a",
":",
"class",
":",
"psyplot",
".",
"plotter",
".",
"Plotter",
"for",
"the",
"projects"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L2399-L2460 |
Chilipp/psyplot | psyplot/project.py | unregister_plotter | def unregister_plotter(identifier, sorter=True, plot_func=True):
"""
Unregister a :class:`psyplot.plotter.Plotter` for the projects
Parameters
----------
identifier: str
Name of the attribute that is used to filter for the instances
belonging to this plotter or to create plots with ... | python | def unregister_plotter(identifier, sorter=True, plot_func=True):
"""
Unregister a :class:`psyplot.plotter.Plotter` for the projects
Parameters
----------
identifier: str
Name of the attribute that is used to filter for the instances
belonging to this plotter or to create plots with ... | [
"def",
"unregister_plotter",
"(",
"identifier",
",",
"sorter",
"=",
"True",
",",
"plot_func",
"=",
"True",
")",
":",
"d",
"=",
"registered_plotters",
".",
"get",
"(",
"identifier",
",",
"{",
"}",
")",
"if",
"sorter",
"and",
"hasattr",
"(",
"Project",
","... | Unregister a :class:`psyplot.plotter.Plotter` for the projects
Parameters
----------
identifier: str
Name of the attribute that is used to filter for the instances
belonging to this plotter or to create plots with this plotter
sorter: bool
If True, the identifier will be unregis... | [
"Unregister",
"a",
":",
"class",
":",
"psyplot",
".",
"plotter",
".",
"Plotter",
"for",
"the",
"projects"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L2463-L2492 |
Chilipp/psyplot | psyplot/project.py | Project._fmtos | def _fmtos(self):
"""An iterator over formatoption objects
Contains only the formatoption whose keys are in all plotters in this
list"""
plotters = self.plotters
if len(plotters) == 0:
return {}
p0 = plotters[0]
if len(plotters) == 1:
retu... | python | def _fmtos(self):
"""An iterator over formatoption objects
Contains only the formatoption whose keys are in all plotters in this
list"""
plotters = self.plotters
if len(plotters) == 0:
return {}
p0 = plotters[0]
if len(plotters) == 1:
retu... | [
"def",
"_fmtos",
"(",
"self",
")",
":",
"plotters",
"=",
"self",
".",
"plotters",
"if",
"len",
"(",
"plotters",
")",
"==",
"0",
":",
"return",
"{",
"}",
"p0",
"=",
"plotters",
"[",
"0",
"]",
"if",
"len",
"(",
"plotters",
")",
"==",
"1",
":",
"r... | An iterator over formatoption objects
Contains only the formatoption whose keys are in all plotters in this
list | [
"An",
"iterator",
"over",
"formatoption",
"objects"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L197-L209 |
Chilipp/psyplot | psyplot/project.py | Project.figs | def figs(self):
"""A mapping from figures to data objects with the plotter in this
figure"""
ret = utils.DefaultOrderedDict(lambda: self[1:0])
for arr in self:
if arr.psy.plotter is not None:
ret[arr.psy.plotter.ax.get_figure()].append(arr)
return Orde... | python | def figs(self):
"""A mapping from figures to data objects with the plotter in this
figure"""
ret = utils.DefaultOrderedDict(lambda: self[1:0])
for arr in self:
if arr.psy.plotter is not None:
ret[arr.psy.plotter.ax.get_figure()].append(arr)
return Orde... | [
"def",
"figs",
"(",
"self",
")",
":",
"ret",
"=",
"utils",
".",
"DefaultOrderedDict",
"(",
"lambda",
":",
"self",
"[",
"1",
":",
"0",
"]",
")",
"for",
"arr",
"in",
"self",
":",
"if",
"arr",
".",
"psy",
".",
"plotter",
"is",
"not",
"None",
":",
... | A mapping from figures to data objects with the plotter in this
figure | [
"A",
"mapping",
"from",
"figures",
"to",
"data",
"objects",
"with",
"the",
"plotter",
"in",
"this",
"figure"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L222-L229 |
Chilipp/psyplot | psyplot/project.py | Project.axes | def axes(self):
"""A mapping from axes to data objects with the plotter in this axes
"""
ret = utils.DefaultOrderedDict(lambda: self[1:0])
for arr in self:
if arr.psy.plotter is not None:
ret[arr.psy.plotter.ax].append(arr)
return OrderedDict(ret) | python | def axes(self):
"""A mapping from axes to data objects with the plotter in this axes
"""
ret = utils.DefaultOrderedDict(lambda: self[1:0])
for arr in self:
if arr.psy.plotter is not None:
ret[arr.psy.plotter.ax].append(arr)
return OrderedDict(ret) | [
"def",
"axes",
"(",
"self",
")",
":",
"ret",
"=",
"utils",
".",
"DefaultOrderedDict",
"(",
"lambda",
":",
"self",
"[",
"1",
":",
"0",
"]",
")",
"for",
"arr",
"in",
"self",
":",
"if",
"arr",
".",
"psy",
".",
"plotter",
"is",
"not",
"None",
":",
... | A mapping from axes to data objects with the plotter in this axes | [
"A",
"mapping",
"from",
"axes",
"to",
"data",
"objects",
"with",
"the",
"plotter",
"in",
"this",
"axes"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L232-L239 |
Chilipp/psyplot | psyplot/project.py | Project.logger | def logger(self):
""":class:`logging.Logger` of this instance"""
if not self.is_main:
return self.main.logger
try:
return self._logger
except AttributeError:
name = '%s.%s.%s' % (self.__module__, self.__class__.__name__,
... | python | def logger(self):
""":class:`logging.Logger` of this instance"""
if not self.is_main:
return self.main.logger
try:
return self._logger
except AttributeError:
name = '%s.%s.%s' % (self.__module__, self.__class__.__name__,
... | [
"def",
"logger",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_main",
":",
"return",
"self",
".",
"main",
".",
"logger",
"try",
":",
"return",
"self",
".",
"_logger",
"except",
"AttributeError",
":",
"name",
"=",
"'%s.%s.%s'",
"%",
"(",
"self",
... | :class:`logging.Logger` of this instance | [
":",
"class",
":",
"logging",
".",
"Logger",
"of",
"this",
"instance"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L247-L258 |
Chilipp/psyplot | psyplot/project.py | Project.datasets | def datasets(self):
"""A mapping from dataset numbers to datasets in this list"""
return {key: val['ds'] for key, val in six.iteritems(
self._get_ds_descriptions(self.array_info(ds_description=['ds'])))} | python | def datasets(self):
"""A mapping from dataset numbers to datasets in this list"""
return {key: val['ds'] for key, val in six.iteritems(
self._get_ds_descriptions(self.array_info(ds_description=['ds'])))} | [
"def",
"datasets",
"(",
"self",
")",
":",
"return",
"{",
"key",
":",
"val",
"[",
"'ds'",
"]",
"for",
"key",
",",
"val",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"_get_ds_descriptions",
"(",
"self",
".",
"array_info",
"(",
"ds_description",
"=",... | A mapping from dataset numbers to datasets in this list | [
"A",
"mapping",
"from",
"dataset",
"numbers",
"to",
"datasets",
"in",
"this",
"list"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L305-L308 |
Chilipp/psyplot | psyplot/project.py | Project._register_plotter | def _register_plotter(cls, identifier, module, plotter_name,
plotter_cls=None):
"""
Register a plotter in the :class:`Project` class to easy access it
Parameters
----------
identifier: str
Name of the attribute that is used to filter for the... | python | def _register_plotter(cls, identifier, module, plotter_name,
plotter_cls=None):
"""
Register a plotter in the :class:`Project` class to easy access it
Parameters
----------
identifier: str
Name of the attribute that is used to filter for the... | [
"def",
"_register_plotter",
"(",
"cls",
",",
"identifier",
",",
"module",
",",
"plotter_name",
",",
"plotter_cls",
"=",
"None",
")",
":",
"if",
"plotter_cls",
"is",
"not",
"None",
":",
"# plotter has already been imported",
"def",
"get_x",
"(",
"self",
")",
":... | Register a plotter in the :class:`Project` class to easy access it
Parameters
----------
identifier: str
Name of the attribute that is used to filter for the instances
belonging to this plotter
module: str
The module from where to import the `plotter_... | [
"Register",
"a",
"plotter",
"in",
"the",
":",
"class",
":",
"Project",
"class",
"to",
"easy",
"access",
"it"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L346-L373 |
Chilipp/psyplot | psyplot/project.py | Project.disable | def disable(self):
"""Disables the plotters in this list"""
for arr in self:
if arr.psy.plotter:
arr.psy.plotter.disabled = True | python | def disable(self):
"""Disables the plotters in this list"""
for arr in self:
if arr.psy.plotter:
arr.psy.plotter.disabled = True | [
"def",
"disable",
"(",
"self",
")",
":",
"for",
"arr",
"in",
"self",
":",
"if",
"arr",
".",
"psy",
".",
"plotter",
":",
"arr",
".",
"psy",
".",
"plotter",
".",
"disabled",
"=",
"True"
] | Disables the plotters in this list | [
"Disables",
"the",
"plotters",
"in",
"this",
"list"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L375-L379 |
Chilipp/psyplot | psyplot/project.py | Project.close | def close(self, figs=True, data=False, ds=False, remove_only=False):
"""
Close this project instance
Parameters
----------
figs: bool
Close the figures
data: bool
delete the arrays from the (main) project
ds: bool
If True, clos... | python | def close(self, figs=True, data=False, ds=False, remove_only=False):
"""
Close this project instance
Parameters
----------
figs: bool
Close the figures
data: bool
delete the arrays from the (main) project
ds: bool
If True, clos... | [
"def",
"close",
"(",
"self",
",",
"figs",
"=",
"True",
",",
"data",
"=",
"False",
",",
"ds",
"=",
"False",
",",
"remove_only",
"=",
"False",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"close_ds",
"=",
"ds",
"for",
"arr",
"in",
"s... | Close this project instance
Parameters
----------
figs: bool
Close the figures
data: bool
delete the arrays from the (main) project
ds: bool
If True, close the dataset as well
remove_only: bool
If True and `figs` is True, t... | [
"Close",
"this",
"project",
"instance"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L423-L472 |
Chilipp/psyplot | psyplot/project.py | Project._add_data | def _add_data(self, plotter_cls, filename_or_obj, fmt={}, make_plot=True,
draw=False, mf_mode=False, ax=None, engine=None, delete=True,
share=False, clear=False, enable_post=None,
concat_dim=_concat_dim_default, load=False,
*args, **kwargs):
... | python | def _add_data(self, plotter_cls, filename_or_obj, fmt={}, make_plot=True,
draw=False, mf_mode=False, ax=None, engine=None, delete=True,
share=False, clear=False, enable_post=None,
concat_dim=_concat_dim_default, load=False,
*args, **kwargs):
... | [
"def",
"_add_data",
"(",
"self",
",",
"plotter_cls",
",",
"filename_or_obj",
",",
"fmt",
"=",
"{",
"}",
",",
"make_plot",
"=",
"True",
",",
"draw",
"=",
"False",
",",
"mf_mode",
"=",
"False",
",",
"ax",
"=",
"None",
",",
"engine",
"=",
"None",
",",
... | Extract data from a dataset and visualize it with the given plotter
Parameters
----------
plotter_cls: type
The subclass of :class:`psyplot.plotter.Plotter` to use for
visualization
filename_or_obj: filename, :class:`xarray.Dataset` or data store
The ... | [
"Extract",
"data",
"from",
"a",
"dataset",
"and",
"visualize",
"it",
"with",
"the",
"given",
"plotter"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L485-L619 |
Chilipp/psyplot | psyplot/project.py | Project.joined_attrs | def joined_attrs(self, delimiter=', ', enhanced=True, plot_data=False,
keep_all=True):
"""Join the attributes of the arrays in this project
Parameters
----------
%(join_dicts.parameters.delimiter)s
enhanced: bool
If True, the :meth:`psyplot.plott... | python | def joined_attrs(self, delimiter=', ', enhanced=True, plot_data=False,
keep_all=True):
"""Join the attributes of the arrays in this project
Parameters
----------
%(join_dicts.parameters.delimiter)s
enhanced: bool
If True, the :meth:`psyplot.plott... | [
"def",
"joined_attrs",
"(",
"self",
",",
"delimiter",
"=",
"', '",
",",
"enhanced",
"=",
"True",
",",
"plot_data",
"=",
"False",
",",
"keep_all",
"=",
"True",
")",
":",
"if",
"enhanced",
":",
"all_attrs",
"=",
"[",
"plotter",
".",
"get_enhanced_attrs",
"... | Join the attributes of the arrays in this project
Parameters
----------
%(join_dicts.parameters.delimiter)s
enhanced: bool
If True, the :meth:`psyplot.plotter.Plotter.get_enhanced_attrs`
method is used, otherwise the :attr:`xarray.DataArray.attrs`
att... | [
"Join",
"the",
"attributes",
"of",
"the",
"arrays",
"in",
"this",
"project"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L652-L686 |
Chilipp/psyplot | psyplot/project.py | Project.export | def export(self, output, tight=False, concat=True, close_pdf=None,
use_time=False, **kwargs):
"""Exports the figures of the project to one or more image files
Parameters
----------
output: str, iterable or matplotlib.backends.backend_pdf.PdfPages
if string or ... | python | def export(self, output, tight=False, concat=True, close_pdf=None,
use_time=False, **kwargs):
"""Exports the figures of the project to one or more image files
Parameters
----------
output: str, iterable or matplotlib.backends.backend_pdf.PdfPages
if string or ... | [
"def",
"export",
"(",
"self",
",",
"output",
",",
"tight",
"=",
"False",
",",
"concat",
"=",
"True",
",",
"close_pdf",
"=",
"None",
",",
"use_time",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"matplotlib",
".",
"backends",
".",
"backend... | Exports the figures of the project to one or more image files
Parameters
----------
output: str, iterable or matplotlib.backends.backend_pdf.PdfPages
if string or list of strings, those define the names of the output
files. Otherwise you may provide an instance of
... | [
"Exports",
"the",
"figures",
"of",
"the",
"project",
"to",
"one",
"or",
"more",
"image",
"files"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L688-L835 |
Chilipp/psyplot | psyplot/project.py | Project.share | def share(self, base=None, keys=None, by=None, **kwargs):
"""
Share the formatoptions of one plotter with all the others
This method shares specified formatoptions from `base` with all the
plotters in this instance.
Parameters
----------
base: None, Plotter, xar... | python | def share(self, base=None, keys=None, by=None, **kwargs):
"""
Share the formatoptions of one plotter with all the others
This method shares specified formatoptions from `base` with all the
plotters in this instance.
Parameters
----------
base: None, Plotter, xar... | [
"def",
"share",
"(",
"self",
",",
"base",
"=",
"None",
",",
"keys",
"=",
"None",
",",
"by",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"by",
"is",
"not",
"None",
":",
"if",
"base",
"is",
"not",
"None",
":",
"if",
"hasattr",
"(",
"b... | Share the formatoptions of one plotter with all the others
This method shares specified formatoptions from `base` with all the
plotters in this instance.
Parameters
----------
base: None, Plotter, xarray.DataArray, InteractiveList, or list of them
The source of the ... | [
"Share",
"the",
"formatoptions",
"of",
"one",
"plotter",
"with",
"all",
"the",
"others"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L841-L896 |
Chilipp/psyplot | psyplot/project.py | Project.save_project | def save_project(self, fname=None, pwd=None, pack=False, **kwargs):
"""
Save this project to a file
Parameters
----------
fname: str or None
If None, the dictionary will be returned. Otherwise the necessary
information to load this project via the :meth:`... | python | def save_project(self, fname=None, pwd=None, pack=False, **kwargs):
"""
Save this project to a file
Parameters
----------
fname: str or None
If None, the dictionary will be returned. Otherwise the necessary
information to load this project via the :meth:`... | [
"def",
"save_project",
"(",
"self",
",",
"fname",
"=",
"None",
",",
"pwd",
"=",
"None",
",",
"pack",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# store the figure informatoptions and array informations",
"if",
"fname",
"is",
"not",
"None",
"and",
"pwd... | Save this project to a file
Parameters
----------
fname: str or None
If None, the dictionary will be returned. Otherwise the necessary
information to load this project via the :meth:`load` method is
saved to `fname` using the :mod:`pickle` module
pwd:... | [
"Save",
"this",
"project",
"to",
"a",
"file"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L920-L1030 |
Chilipp/psyplot | psyplot/project.py | Project.keys | def keys(self, *args, **kwargs):
"""
Show the available formatoptions in this project
Parameters
----------
%(Plotter.show_keys.parameters)s
Other Parameters
----------------
%(Plotter.show_keys.other_parameters)s
Returns
-------
... | python | def keys(self, *args, **kwargs):
"""
Show the available formatoptions in this project
Parameters
----------
%(Plotter.show_keys.parameters)s
Other Parameters
----------------
%(Plotter.show_keys.other_parameters)s
Returns
-------
... | [
"def",
"keys",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"class",
"TmpClass",
"(",
"Plotter",
")",
":",
"pass",
"for",
"fmto",
"in",
"self",
".",
"_fmtos",
":",
"setattr",
"(",
"TmpClass",
",",
"fmto",
".",
"key",
",",
"ty... | Show the available formatoptions in this project
Parameters
----------
%(Plotter.show_keys.parameters)s
Other Parameters
----------------
%(Plotter.show_keys.other_parameters)s
Returns
-------
%(Plotter.show_keys.returns)s | [
"Show",
"the",
"available",
"formatoptions",
"in",
"this",
"project"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L1033-L1053 |
Chilipp/psyplot | psyplot/project.py | Project.summaries | def summaries(self, *args, **kwargs):
"""
Show the available formatoptions and their summaries in this project
Parameters
----------
%(Plotter.show_keys.parameters)s
Other Parameters
----------------
%(Plotter.show_keys.other_parameters)s
Return... | python | def summaries(self, *args, **kwargs):
"""
Show the available formatoptions and their summaries in this project
Parameters
----------
%(Plotter.show_keys.parameters)s
Other Parameters
----------------
%(Plotter.show_keys.other_parameters)s
Return... | [
"def",
"summaries",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"class",
"TmpClass",
"(",
"Plotter",
")",
":",
"pass",
"for",
"fmto",
"in",
"self",
".",
"_fmtos",
":",
"setattr",
"(",
"TmpClass",
",",
"fmto",
".",
"key",
",",
... | Show the available formatoptions and their summaries in this project
Parameters
----------
%(Plotter.show_keys.parameters)s
Other Parameters
----------------
%(Plotter.show_keys.other_parameters)s
Returns
-------
%(Plotter.show_keys.returns)s | [
"Show",
"the",
"available",
"formatoptions",
"and",
"their",
"summaries",
"in",
"this",
"project"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L1056-L1076 |
Chilipp/psyplot | psyplot/project.py | Project.docs | def docs(self, *args, **kwargs):
"""
Show the available formatoptions in this project and their full docu
Parameters
----------
%(Plotter.show_keys.parameters)s
Other Parameters
----------------
%(Plotter.show_keys.other_parameters)s
Returns
... | python | def docs(self, *args, **kwargs):
"""
Show the available formatoptions in this project and their full docu
Parameters
----------
%(Plotter.show_keys.parameters)s
Other Parameters
----------------
%(Plotter.show_keys.other_parameters)s
Returns
... | [
"def",
"docs",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"class",
"TmpClass",
"(",
"Plotter",
")",
":",
"pass",
"for",
"fmto",
"in",
"self",
".",
"_fmtos",
":",
"setattr",
"(",
"TmpClass",
",",
"fmto",
".",
"key",
",",
"ty... | Show the available formatoptions in this project and their full docu
Parameters
----------
%(Plotter.show_keys.parameters)s
Other Parameters
----------------
%(Plotter.show_keys.other_parameters)s
Returns
-------
%(Plotter.show_keys.returns)s | [
"Show",
"the",
"available",
"formatoptions",
"in",
"this",
"project",
"and",
"their",
"full",
"docu"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L1079-L1099 |
Chilipp/psyplot | psyplot/project.py | Project.from_dataset | def from_dataset(cls, *args, **kwargs):
"""Construct an ArrayList instance from an existing base dataset
Parameters
----------
%(ArrayList.from_dataset.parameters)s
main: Project
The main project that this project corresponds to
Other Parameters
----... | python | def from_dataset(cls, *args, **kwargs):
"""Construct an ArrayList instance from an existing base dataset
Parameters
----------
%(ArrayList.from_dataset.parameters)s
main: Project
The main project that this project corresponds to
Other Parameters
----... | [
"def",
"from_dataset",
"(",
"cls",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"main",
"=",
"kwargs",
".",
"pop",
"(",
"'main'",
",",
"None",
")",
"ret",
"=",
"super",
"(",
"Project",
",",
"cls",
")",
".",
"from_dataset",
"(",
"*",
"args... | Construct an ArrayList instance from an existing base dataset
Parameters
----------
%(ArrayList.from_dataset.parameters)s
main: Project
The main project that this project corresponds to
Other Parameters
----------------
%(ArrayList.from_dataset.other... | [
"Construct",
"an",
"ArrayList",
"instance",
"from",
"an",
"existing",
"base",
"dataset"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L1103-L1126 |
Chilipp/psyplot | psyplot/project.py | Project.load_project | def load_project(cls, fname, auto_update=None, make_plot=True,
draw=False, alternative_axes=None, main=False,
encoding=None, enable_post=False, new_fig=True,
clear=None, **kwargs):
"""
Load a project from a file or dict
This classme... | python | def load_project(cls, fname, auto_update=None, make_plot=True,
draw=False, alternative_axes=None, main=False,
encoding=None, enable_post=False, new_fig=True,
clear=None, **kwargs):
"""
Load a project from a file or dict
This classme... | [
"def",
"load_project",
"(",
"cls",
",",
"fname",
",",
"auto_update",
"=",
"None",
",",
"make_plot",
"=",
"True",
",",
"draw",
"=",
"False",
",",
"alternative_axes",
"=",
"None",
",",
"main",
"=",
"False",
",",
"encoding",
"=",
"None",
",",
"enable_post",... | Load a project from a file or dict
This classmethod allows to load a project that has been stored using
the :meth:`save_project` method and reads all the data and creates the
figures.
Since the data is stored in external files when saving a project,
make sure that the data is a... | [
"Load",
"a",
"project",
"from",
"a",
"file",
"or",
"dict"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L1135-L1322 |
Chilipp/psyplot | psyplot/project.py | Project.scp | def scp(cls, project):
"""
Set the current project
Parameters
----------
project: Project or None
The project to set. If it is None, the current subproject is set
to empty. If it is a sub project (see:attr:`Project.is_main`),
the current subpr... | python | def scp(cls, project):
"""
Set the current project
Parameters
----------
project: Project or None
The project to set. If it is None, the current subproject is set
to empty. If it is a sub project (see:attr:`Project.is_main`),
the current subpr... | [
"def",
"scp",
"(",
"cls",
",",
"project",
")",
":",
"if",
"project",
"is",
"None",
":",
"_scp",
"(",
"None",
")",
"cls",
".",
"oncpchange",
".",
"emit",
"(",
"gcp",
"(",
")",
")",
"elif",
"not",
"project",
".",
"is_main",
":",
"if",
"project",
".... | Set the current project
Parameters
----------
project: Project or None
The project to set. If it is None, the current subproject is set
to empty. If it is a sub project (see:attr:`Project.is_main`),
the current subproject is set to this project. Otherwise it
... | [
"Set",
"the",
"current",
"project"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L1327-L1358 |
Chilipp/psyplot | psyplot/project.py | Project.new | def new(cls, num=None, *args, **kwargs):
"""
Create a new main project
Parameters
----------
num: int
The number of the project
%(Project.parameters.no_num)s
Returns
-------
Project
The with the given `num` (if it does not... | python | def new(cls, num=None, *args, **kwargs):
"""
Create a new main project
Parameters
----------
num: int
The number of the project
%(Project.parameters.no_num)s
Returns
-------
Project
The with the given `num` (if it does not... | [
"def",
"new",
"(",
"cls",
",",
"num",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"project",
"=",
"cls",
"(",
"*",
"args",
",",
"num",
"=",
"num",
",",
"*",
"*",
"kwargs",
")",
"scp",
"(",
"project",
")",
"return",
"proj... | Create a new main project
Parameters
----------
num: int
The number of the project
%(Project.parameters.no_num)s
Returns
-------
Project
The with the given `num` (if it does not already exist, it is
created)
See Also
... | [
"Create",
"a",
"new",
"main",
"project"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L1364-L1387 |
Chilipp/psyplot | psyplot/project.py | _ProjectLoader.inspect_figure | def inspect_figure(fig):
"""Get the parameters (heigth, width, etc.) to create a figure
This method returns the number of the figure and a dictionary
containing the necessary information for the
:func:`matplotlib.pyplot.figure` function"""
return fig.number, {
'num':... | python | def inspect_figure(fig):
"""Get the parameters (heigth, width, etc.) to create a figure
This method returns the number of the figure and a dictionary
containing the necessary information for the
:func:`matplotlib.pyplot.figure` function"""
return fig.number, {
'num':... | [
"def",
"inspect_figure",
"(",
"fig",
")",
":",
"return",
"fig",
".",
"number",
",",
"{",
"'num'",
":",
"fig",
".",
"number",
",",
"'figsize'",
":",
"(",
"fig",
".",
"get_figwidth",
"(",
")",
",",
"fig",
".",
"get_figheight",
"(",
")",
")",
",",
"'d... | Get the parameters (heigth, width, etc.) to create a figure
This method returns the number of the figure and a dictionary
containing the necessary information for the
:func:`matplotlib.pyplot.figure` function | [
"Get",
"the",
"parameters",
"(",
"heigth",
"width",
"etc",
".",
")",
"to",
"create",
"a",
"figure"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L1398-L1412 |
Chilipp/psyplot | psyplot/project.py | _ProjectLoader.load_figure | def load_figure(d, new_fig=True):
"""Create a figure from what is returned by :meth:`inspect_figure`"""
import matplotlib.pyplot as plt
subplotpars = d.pop('subplotpars', None)
if subplotpars is not None:
subplotpars.pop('validate', None)
subplotpars = mfig.Subplo... | python | def load_figure(d, new_fig=True):
"""Create a figure from what is returned by :meth:`inspect_figure`"""
import matplotlib.pyplot as plt
subplotpars = d.pop('subplotpars', None)
if subplotpars is not None:
subplotpars.pop('validate', None)
subplotpars = mfig.Subplo... | [
"def",
"load_figure",
"(",
"d",
",",
"new_fig",
"=",
"True",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"subplotpars",
"=",
"d",
".",
"pop",
"(",
"'subplotpars'",
",",
"None",
")",
"if",
"subplotpars",
"is",
"not",
"None",
":",
"subp... | Create a figure from what is returned by :meth:`inspect_figure` | [
"Create",
"a",
"figure",
"from",
"what",
"is",
"returned",
"by",
":",
"meth",
":",
"inspect_figure"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L1415-L1428 |
Chilipp/psyplot | psyplot/project.py | _ProjectLoader.inspect_axes | def inspect_axes(ax):
"""Inspect an axes or subplot to get the initialization parameters"""
ret = {'fig': ax.get_figure().number}
if mpl.__version__ < '2.0':
ret['axisbg'] = ax.get_axis_bgcolor()
else: # axisbg is depreceated
ret['facecolor'] = ax.get_facecolor()... | python | def inspect_axes(ax):
"""Inspect an axes or subplot to get the initialization parameters"""
ret = {'fig': ax.get_figure().number}
if mpl.__version__ < '2.0':
ret['axisbg'] = ax.get_axis_bgcolor()
else: # axisbg is depreceated
ret['facecolor'] = ax.get_facecolor()... | [
"def",
"inspect_axes",
"(",
"ax",
")",
":",
"ret",
"=",
"{",
"'fig'",
":",
"ax",
".",
"get_figure",
"(",
")",
".",
"number",
"}",
"if",
"mpl",
".",
"__version__",
"<",
"'2.0'",
":",
"ret",
"[",
"'axisbg'",
"]",
"=",
"ax",
".",
"get_axis_bgcolor",
"... | Inspect an axes or subplot to get the initialization parameters | [
"Inspect",
"an",
"axes",
"or",
"subplot",
"to",
"get",
"the",
"initialization",
"parameters"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L1431-L1460 |
Chilipp/psyplot | psyplot/project.py | _ProjectLoader.load_axes | def load_axes(d):
"""Create an axes or subplot from what is returned by
:meth:`inspect_axes`"""
import matplotlib.pyplot as plt
fig = plt.figure(d.pop('fig', None))
proj = d.pop('projection', None)
spines = d.pop('spines', None)
invert_yaxis = d.pop('yaxis_inverte... | python | def load_axes(d):
"""Create an axes or subplot from what is returned by
:meth:`inspect_axes`"""
import matplotlib.pyplot as plt
fig = plt.figure(d.pop('fig', None))
proj = d.pop('projection', None)
spines = d.pop('spines', None)
invert_yaxis = d.pop('yaxis_inverte... | [
"def",
"load_axes",
"(",
"d",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"fig",
"=",
"plt",
".",
"figure",
"(",
"d",
".",
"pop",
"(",
"'fig'",
",",
"None",
")",
")",
"proj",
"=",
"d",
".",
"pop",
"(",
"'projection'",
",",
"None... | Create an axes or subplot from what is returned by
:meth:`inspect_axes` | [
"Create",
"an",
"axes",
"or",
"subplot",
"from",
"what",
"is",
"returned",
"by",
":",
"meth",
":",
"inspect_axes"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L1463-L1493 |
Chilipp/psyplot | psyplot/project.py | ProjectPlotter._plot_methods | def _plot_methods(self):
"""A dictionary with mappings from plot method to their summary"""
ret = {}
for attr in filter(lambda s: not s.startswith("_"), dir(self)):
obj = getattr(self, attr)
if isinstance(obj, PlotterInterface):
ret[attr] = obj._summary
... | python | def _plot_methods(self):
"""A dictionary with mappings from plot method to their summary"""
ret = {}
for attr in filter(lambda s: not s.startswith("_"), dir(self)):
obj = getattr(self, attr)
if isinstance(obj, PlotterInterface):
ret[attr] = obj._summary
... | [
"def",
"_plot_methods",
"(",
"self",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"attr",
"in",
"filter",
"(",
"lambda",
"s",
":",
"not",
"s",
".",
"startswith",
"(",
"\"_\"",
")",
",",
"dir",
"(",
"self",
")",
")",
":",
"obj",
"=",
"getattr",
"(",
"... | A dictionary with mappings from plot method to their summary | [
"A",
"dictionary",
"with",
"mappings",
"from",
"plot",
"method",
"to",
"their",
"summary"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L1514-L1521 |
Chilipp/psyplot | psyplot/project.py | ProjectPlotter.show_plot_methods | def show_plot_methods(self):
"""Print the plotmethods of this instance"""
print_func = PlotterInterface._print_func
if print_func is None:
print_func = six.print_
s = "\n".join(
"%s\n %s" % t for t in six.iteritems(self._plot_methods))
return print_func... | python | def show_plot_methods(self):
"""Print the plotmethods of this instance"""
print_func = PlotterInterface._print_func
if print_func is None:
print_func = six.print_
s = "\n".join(
"%s\n %s" % t for t in six.iteritems(self._plot_methods))
return print_func... | [
"def",
"show_plot_methods",
"(",
"self",
")",
":",
"print_func",
"=",
"PlotterInterface",
".",
"_print_func",
"if",
"print_func",
"is",
"None",
":",
"print_func",
"=",
"six",
".",
"print_",
"s",
"=",
"\"\\n\"",
".",
"join",
"(",
"\"%s\\n %s\"",
"%",
"t",
... | Print the plotmethods of this instance | [
"Print",
"the",
"plotmethods",
"of",
"this",
"instance"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L1523-L1530 |
Chilipp/psyplot | psyplot/project.py | ProjectPlotter._register_plotter | def _register_plotter(cls, identifier, module, plotter_name,
plotter_cls=None, summary='', prefer_list=False,
default_slice=None, default_dims={},
show_examples=True,
example_call="filename, name=['my_variable'], ...... | python | def _register_plotter(cls, identifier, module, plotter_name,
plotter_cls=None, summary='', prefer_list=False,
default_slice=None, default_dims={},
show_examples=True,
example_call="filename, name=['my_variable'], ...... | [
"def",
"_register_plotter",
"(",
"cls",
",",
"identifier",
",",
"module",
",",
"plotter_name",
",",
"plotter_cls",
"=",
"None",
",",
"summary",
"=",
"''",
",",
"prefer_list",
"=",
"False",
",",
"default_slice",
"=",
"None",
",",
"default_dims",
"=",
"{",
"... | Register a plotter for making plots
This class method registeres a plot function for the :class:`Project`
class under the name of the given `identifier`
Parameters
----------
%(Project._register_plotter.parameters)s
Other Parameters
----------------
pre... | [
"Register",
"a",
"plotter",
"for",
"making",
"plots"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L1560-L1629 |
Chilipp/psyplot | psyplot/project.py | ProjectPlotter._gen_doc | def _gen_doc(cls, summary, full_name, identifier, example_call, doc_str,
show_examples):
"""Generate the documentation docstring for a PlotMethod"""
ret = docstrings.dedents("""
%s
This plotting method adds data arrays and plots them via
:class:`%s` ... | python | def _gen_doc(cls, summary, full_name, identifier, example_call, doc_str,
show_examples):
"""Generate the documentation docstring for a PlotMethod"""
ret = docstrings.dedents("""
%s
This plotting method adds data arrays and plots them via
:class:`%s` ... | [
"def",
"_gen_doc",
"(",
"cls",
",",
"summary",
",",
"full_name",
",",
"identifier",
",",
"example_call",
",",
"doc_str",
",",
"show_examples",
")",
":",
"ret",
"=",
"docstrings",
".",
"dedents",
"(",
"\"\"\"\n %s\n\n This plotting method adds dat... | Generate the documentation docstring for a PlotMethod | [
"Generate",
"the",
"documentation",
"docstring",
"for",
"a",
"PlotMethod"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L1632-L1649 |
Chilipp/psyplot | psyplot/project.py | PlotterInterface.plotter_cls | def plotter_cls(self):
"""The plotter class"""
ret = self._plotter_cls
if ret is None:
self._logger.debug('importing %s', self.module)
mod = import_module(self.module)
plotter = self.plotter_name
if plotter not in vars(mod):
raise I... | python | def plotter_cls(self):
"""The plotter class"""
ret = self._plotter_cls
if ret is None:
self._logger.debug('importing %s', self.module)
mod = import_module(self.module)
plotter = self.plotter_name
if plotter not in vars(mod):
raise I... | [
"def",
"plotter_cls",
"(",
"self",
")",
":",
"ret",
"=",
"self",
".",
"_plotter_cls",
"if",
"ret",
"is",
"None",
":",
"self",
".",
"_logger",
".",
"debug",
"(",
"'importing %s'",
",",
"self",
".",
"module",
")",
"mod",
"=",
"import_module",
"(",
"self"... | The plotter class | [
"The",
"plotter",
"class"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L1689-L1701 |
Chilipp/psyplot | psyplot/project.py | PlotterInterface.check_data | def check_data(self, ds, name, dims):
"""
A validation method for the data shape
Parameters
----------
name: list of lists of strings
The variable names (see the
:meth:`~psyplot.plotter.Plotter.check_data` method of the
:attr:`plotter_cls` att... | python | def check_data(self, ds, name, dims):
"""
A validation method for the data shape
Parameters
----------
name: list of lists of strings
The variable names (see the
:meth:`~psyplot.plotter.Plotter.check_data` method of the
:attr:`plotter_cls` att... | [
"def",
"check_data",
"(",
"self",
",",
"ds",
",",
"name",
",",
"dims",
")",
":",
"if",
"isinstance",
"(",
"name",
",",
"six",
".",
"string_types",
")",
":",
"name",
"=",
"[",
"name",
"]",
"dims",
"=",
"[",
"dims",
"]",
"else",
":",
"dims",
"=",
... | A validation method for the data shape
Parameters
----------
name: list of lists of strings
The variable names (see the
:meth:`~psyplot.plotter.Plotter.check_data` method of the
:attr:`plotter_cls` attribute for details)
dims: list of dictionaries
... | [
"A",
"validation",
"method",
"for",
"the",
"data",
"shape"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L1852-L1898 |
Chilipp/psyplot | psyplot/project.py | DatasetPlotter._add_data | def _add_data(self, plotter_cls, *args, **kwargs):
"""
Add new plots to the project
Parameters
----------
%(ProjectPlotter._add_data.parameters.no_filename_or_obj)s
Other Parameters
----------------
%(ProjectPlotter._add_data.other_parameters)s
... | python | def _add_data(self, plotter_cls, *args, **kwargs):
"""
Add new plots to the project
Parameters
----------
%(ProjectPlotter._add_data.parameters.no_filename_or_obj)s
Other Parameters
----------------
%(ProjectPlotter._add_data.other_parameters)s
... | [
"def",
"_add_data",
"(",
"self",
",",
"plotter_cls",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# this method is just a shortcut to the :meth:`Project._add_data`",
"# method but is reimplemented by subclasses as the",
"# :class:`DatasetPlotter` or the :class:`DataArrayPl... | Add new plots to the project
Parameters
----------
%(ProjectPlotter._add_data.parameters.no_filename_or_obj)s
Other Parameters
----------------
%(ProjectPlotter._add_data.other_parameters)s
Returns
-------
%(ProjectPlotter._add_data.returns)s | [
"Add",
"new",
"plots",
"to",
"the",
"project"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L1953-L1973 |
Chilipp/psyplot | psyplot/project.py | DatasetPlotter._gen_doc | def _gen_doc(cls, summary, full_name, identifier, example_call, doc_str,
show_examples):
"""Generate the documentation docstring for a PlotMethod"""
# leave out the first argument
example_call = ', '.join(map(str.strip, example_call.split(',')[1:]))
ret = docstrings.dede... | python | def _gen_doc(cls, summary, full_name, identifier, example_call, doc_str,
show_examples):
"""Generate the documentation docstring for a PlotMethod"""
# leave out the first argument
example_call = ', '.join(map(str.strip, example_call.split(',')[1:]))
ret = docstrings.dede... | [
"def",
"_gen_doc",
"(",
"cls",
",",
"summary",
",",
"full_name",
",",
"identifier",
",",
"example_call",
",",
"doc_str",
",",
"show_examples",
")",
":",
"# leave out the first argument",
"example_call",
"=",
"', '",
".",
"join",
"(",
"map",
"(",
"str",
".",
... | Generate the documentation docstring for a PlotMethod | [
"Generate",
"the",
"documentation",
"docstring",
"for",
"a",
"PlotMethod"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L1976-L1995 |
Chilipp/psyplot | psyplot/project.py | DataArrayPlotterInterface.check_data | def check_data(self, *args, **kwargs):
"""Check whether the plotter of this plot method can visualize the data
"""
plotter_cls = self.plotter_cls
da_list = self._project_plotter._da.psy.to_interactive_list()
return plotter_cls.check_data(
da_list.all_names, da_list.al... | python | def check_data(self, *args, **kwargs):
"""Check whether the plotter of this plot method can visualize the data
"""
plotter_cls = self.plotter_cls
da_list = self._project_plotter._da.psy.to_interactive_list()
return plotter_cls.check_data(
da_list.all_names, da_list.al... | [
"def",
"check_data",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"plotter_cls",
"=",
"self",
".",
"plotter_cls",
"da_list",
"=",
"self",
".",
"_project_plotter",
".",
"_da",
".",
"psy",
".",
"to_interactive_list",
"(",
")",
"return"... | Check whether the plotter of this plot method can visualize the data | [
"Check",
"whether",
"the",
"plotter",
"of",
"this",
"plot",
"method",
"can",
"visualize",
"the",
"data"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L2051-L2057 |
Chilipp/psyplot | psyplot/project.py | DataArrayPlotter._add_data | def _add_data(self, plotter_cls, *args, **kwargs):
"""
Visualize this data array
Parameters
----------
%(Plotter.parameters.no_data)s
Returns
-------
psyplot.plotter.Plotter
The plotter that visualizes the data
"""
# this meth... | python | def _add_data(self, plotter_cls, *args, **kwargs):
"""
Visualize this data array
Parameters
----------
%(Plotter.parameters.no_data)s
Returns
-------
psyplot.plotter.Plotter
The plotter that visualizes the data
"""
# this meth... | [
"def",
"_add_data",
"(",
"self",
",",
"plotter_cls",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# this method is just a shortcut to the :meth:`Project._add_data`",
"# method but is reimplemented by subclasses as the",
"# :class:`DatasetPlotter` or the :class:`DataArrayPl... | Visualize this data array
Parameters
----------
%(Plotter.parameters.no_data)s
Returns
-------
psyplot.plotter.Plotter
The plotter that visualizes the data | [
"Visualize",
"this",
"data",
"array"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/project.py#L2074-L2090 |
mfcloud/python-zvm-sdk | doc/ext/restapi_parameters.py | RestAPIParametersDirective.yaml_from_file | def yaml_from_file(self, fpath):
"""Collect Parameter stanzas from inline + file.
This allows use to reference an external file for the actual
parameter definitions.
"""
lookup = self._load_param_file(fpath)
if not lookup:
return
content = "\n".join... | python | def yaml_from_file(self, fpath):
"""Collect Parameter stanzas from inline + file.
This allows use to reference an external file for the actual
parameter definitions.
"""
lookup = self._load_param_file(fpath)
if not lookup:
return
content = "\n".join... | [
"def",
"yaml_from_file",
"(",
"self",
",",
"fpath",
")",
":",
"lookup",
"=",
"self",
".",
"_load_param_file",
"(",
"fpath",
")",
"if",
"not",
"lookup",
":",
"return",
"content",
"=",
"\"\\n\"",
".",
"join",
"(",
"self",
".",
"content",
")",
"parsed",
"... | Collect Parameter stanzas from inline + file.
This allows use to reference an external file for the actual
parameter definitions. | [
"Collect",
"Parameter",
"stanzas",
"from",
"inline",
"+",
"file",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/doc/ext/restapi_parameters.py#L78-L114 |
jvarho/pylibscrypt | pylibscrypt/libsodium_load.py | get_libsodium | def get_libsodium():
'''Locate the libsodium C library'''
__SONAMES = (13, 10, 5, 4)
# Import libsodium from system
sys_sodium = ctypes.util.find_library('sodium')
if sys_sodium is None:
sys_sodium = ctypes.util.find_library('libsodium')
if sys_sodium:
try:
return c... | python | def get_libsodium():
'''Locate the libsodium C library'''
__SONAMES = (13, 10, 5, 4)
# Import libsodium from system
sys_sodium = ctypes.util.find_library('sodium')
if sys_sodium is None:
sys_sodium = ctypes.util.find_library('libsodium')
if sys_sodium:
try:
return c... | [
"def",
"get_libsodium",
"(",
")",
":",
"__SONAMES",
"=",
"(",
"13",
",",
"10",
",",
"5",
",",
"4",
")",
"# Import libsodium from system",
"sys_sodium",
"=",
"ctypes",
".",
"util",
".",
"find_library",
"(",
"'sodium'",
")",
"if",
"sys_sodium",
"is",
"None",... | Locate the libsodium C library | [
"Locate",
"the",
"libsodium",
"C",
"library"
] | train | https://github.com/jvarho/pylibscrypt/blob/f2ff02e49f44aa620e308a4a64dd8376b9510f99/pylibscrypt/libsodium_load.py#L19-L71 |
Chilipp/psyplot | psyplot/__main__.py | main | def main(args=None):
"""Main function for usage of psyplot from the command line
This function creates a parser that parses command lines to the
:func:`make_plot` functions or (if the ``psyplot_gui`` module is
present, to the :func:`psyplot_gui.start_app` function)
Returns
-------
psyplot.... | python | def main(args=None):
"""Main function for usage of psyplot from the command line
This function creates a parser that parses command lines to the
:func:`make_plot` functions or (if the ``psyplot_gui`` module is
present, to the :func:`psyplot_gui.start_app` function)
Returns
-------
psyplot.... | [
"def",
"main",
"(",
"args",
"=",
"None",
")",
":",
"try",
":",
"from",
"psyplot_gui",
"import",
"get_parser",
"as",
"_get_parser",
"except",
"ImportError",
":",
"logger",
".",
"debug",
"(",
"'Failed to import gui'",
",",
"exc_info",
"=",
"True",
")",
"parser... | Main function for usage of psyplot from the command line
This function creates a parser that parses command lines to the
:func:`make_plot` functions or (if the ``psyplot_gui`` module is
present, to the :func:`psyplot_gui.start_app` function)
Returns
-------
psyplot.parser.FuncArgParser
... | [
"Main",
"function",
"for",
"usage",
"of",
"psyplot",
"from",
"the",
"command",
"line"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/__main__.py#L24-L46 |
Chilipp/psyplot | psyplot/__main__.py | make_plot | def make_plot(fnames=[], name=[], dims=None, plot_method=None,
output=None, project=None, engine=None, formatoptions=None,
tight=False, rc_file=None, encoding=None, enable_post=False,
seaborn_style=None, output_project=None,
concat_dim=get_default_value(xr.open_mf... | python | def make_plot(fnames=[], name=[], dims=None, plot_method=None,
output=None, project=None, engine=None, formatoptions=None,
tight=False, rc_file=None, encoding=None, enable_post=False,
seaborn_style=None, output_project=None,
concat_dim=get_default_value(xr.open_mf... | [
"def",
"make_plot",
"(",
"fnames",
"=",
"[",
"]",
",",
"name",
"=",
"[",
"]",
",",
"dims",
"=",
"None",
",",
"plot_method",
"=",
"None",
",",
"output",
"=",
"None",
",",
"project",
"=",
"None",
",",
"engine",
"=",
"None",
",",
"formatoptions",
"=",... | Eventually start the QApplication or only make a plot
Parameters
----------
fnames: list of str
Either the filenames to show, or, if the `project` parameter is set,
the a list of `,`-separated filenames to make a mapping from the
original filename to a new one
name: list of str
... | [
"Eventually",
"start",
"the",
"QApplication",
"or",
"only",
"make",
"a",
"plot"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/__main__.py#L51-L159 |
Chilipp/psyplot | psyplot/__main__.py | get_parser | def get_parser(create=True):
"""Return a parser to make that can be used to make plots or open files
from the command line
Returns
-------
psyplot.parser.FuncArgParser
The :class:`argparse.ArgumentParser` instance"""
#: The parse that is used to parse arguments from the command line
... | python | def get_parser(create=True):
"""Return a parser to make that can be used to make plots or open files
from the command line
Returns
-------
psyplot.parser.FuncArgParser
The :class:`argparse.ArgumentParser` instance"""
#: The parse that is used to parse arguments from the command line
... | [
"def",
"get_parser",
"(",
"create",
"=",
"True",
")",
":",
"#: The parse that is used to parse arguments from the command line",
"epilog",
"=",
"docstrings",
".",
"get_sections",
"(",
"docstrings",
".",
"dedents",
"(",
"\"\"\"\n Examples\n --------\n\n Here... | Return a parser to make that can be used to make plots or open files
from the command line
Returns
-------
psyplot.parser.FuncArgParser
The :class:`argparse.ArgumentParser` instance | [
"Return",
"a",
"parser",
"to",
"make",
"that",
"can",
"be",
"used",
"to",
"make",
"plots",
"or",
"open",
"files",
"from",
"the",
"command",
"line"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/__main__.py#L162-L296 |
jvarho/pylibscrypt | pylibscrypt/pylibsodium.py | scrypt | def scrypt(password, salt, N=SCRYPT_N, r=SCRYPT_r, p=SCRYPT_p, olen=64):
"""Returns a key derived using the scrypt key-derivarion function
N must be a power of two larger than 1 but no larger than 2 ** 63 (insane)
r and p must be positive numbers such that r * p < 2 ** 30
The default values are:
N... | python | def scrypt(password, salt, N=SCRYPT_N, r=SCRYPT_r, p=SCRYPT_p, olen=64):
"""Returns a key derived using the scrypt key-derivarion function
N must be a power of two larger than 1 but no larger than 2 ** 63 (insane)
r and p must be positive numbers such that r * p < 2 ** 30
The default values are:
N... | [
"def",
"scrypt",
"(",
"password",
",",
"salt",
",",
"N",
"=",
"SCRYPT_N",
",",
"r",
"=",
"SCRYPT_r",
",",
"p",
"=",
"SCRYPT_p",
",",
"olen",
"=",
"64",
")",
":",
"check_args",
"(",
"password",
",",
"salt",
",",
"N",
",",
"r",
",",
"p",
",",
"ol... | Returns a key derived using the scrypt key-derivarion function
N must be a power of two larger than 1 but no larger than 2 ** 63 (insane)
r and p must be positive numbers such that r * p < 2 ** 30
The default values are:
N -- 2**14 (~16k)
r -- 8
p -- 1
Memory usage is proportional to N*r.... | [
"Returns",
"a",
"key",
"derived",
"using",
"the",
"scrypt",
"key",
"-",
"derivarion",
"function"
] | train | https://github.com/jvarho/pylibscrypt/blob/f2ff02e49f44aa620e308a4a64dd8376b9510f99/pylibscrypt/pylibsodium.py#L98-L138 |
jvarho/pylibscrypt | pylibscrypt/pylibsodium.py | scrypt_mcf | def scrypt_mcf(password, salt=None, N=SCRYPT_N, r=SCRYPT_r, p=SCRYPT_p,
prefix=SCRYPT_MCF_PREFIX_DEFAULT):
"""Derives a Modular Crypt Format hash using the scrypt KDF
Parameter space is smaller than for scrypt():
N must be a power of two larger than 1 but no larger than 2 ** 31
r and p m... | python | def scrypt_mcf(password, salt=None, N=SCRYPT_N, r=SCRYPT_r, p=SCRYPT_p,
prefix=SCRYPT_MCF_PREFIX_DEFAULT):
"""Derives a Modular Crypt Format hash using the scrypt KDF
Parameter space is smaller than for scrypt():
N must be a power of two larger than 1 but no larger than 2 ** 31
r and p m... | [
"def",
"scrypt_mcf",
"(",
"password",
",",
"salt",
"=",
"None",
",",
"N",
"=",
"SCRYPT_N",
",",
"r",
"=",
"SCRYPT_r",
",",
"p",
"=",
"SCRYPT_p",
",",
"prefix",
"=",
"SCRYPT_MCF_PREFIX_DEFAULT",
")",
":",
"if",
"isinstance",
"(",
"password",
",",
"unicode... | Derives a Modular Crypt Format hash using the scrypt KDF
Parameter space is smaller than for scrypt():
N must be a power of two larger than 1 but no larger than 2 ** 31
r and p must be positive numbers between 1 and 255
Salt must be a byte string 1-16 bytes long.
If no salt is given, a random salt... | [
"Derives",
"a",
"Modular",
"Crypt",
"Format",
"hash",
"using",
"the",
"scrypt",
"KDF"
] | train | https://github.com/jvarho/pylibscrypt/blob/f2ff02e49f44aa620e308a4a64dd8376b9510f99/pylibscrypt/pylibsodium.py#L141-L182 |
jvarho/pylibscrypt | pylibscrypt/pylibsodium.py | scrypt_mcf_check | def scrypt_mcf_check(mcf, password):
"""Returns True if the password matches the given MCF hash"""
if isinstance(password, unicode):
password = password.encode('utf8')
elif not isinstance(password, bytes):
raise TypeError('password must be a unicode or byte string')
if not isinstance(mcf... | python | def scrypt_mcf_check(mcf, password):
"""Returns True if the password matches the given MCF hash"""
if isinstance(password, unicode):
password = password.encode('utf8')
elif not isinstance(password, bytes):
raise TypeError('password must be a unicode or byte string')
if not isinstance(mcf... | [
"def",
"scrypt_mcf_check",
"(",
"mcf",
",",
"password",
")",
":",
"if",
"isinstance",
"(",
"password",
",",
"unicode",
")",
":",
"password",
"=",
"password",
".",
"encode",
"(",
"'utf8'",
")",
"elif",
"not",
"isinstance",
"(",
"password",
",",
"bytes",
"... | Returns True if the password matches the given MCF hash | [
"Returns",
"True",
"if",
"the",
"password",
"matches",
"the",
"given",
"MCF",
"hash"
] | train | https://github.com/jvarho/pylibscrypt/blob/f2ff02e49f44aa620e308a4a64dd8376b9510f99/pylibscrypt/pylibsodium.py#L185-L195 |
Chilipp/psyplot | psyplot/utils.py | _temp_bool_prop | def _temp_bool_prop(propname, doc="", default=False):
"""Creates a property that uses the :class:`_TempBool` class
Parameters
----------
propname: str
The attribute name to use. The _TempBool instance will be stored in the
``'_' + propname`` attribute of the corresponding instance
d... | python | def _temp_bool_prop(propname, doc="", default=False):
"""Creates a property that uses the :class:`_TempBool` class
Parameters
----------
propname: str
The attribute name to use. The _TempBool instance will be stored in the
``'_' + propname`` attribute of the corresponding instance
d... | [
"def",
"_temp_bool_prop",
"(",
"propname",
",",
"doc",
"=",
"\"\"",
",",
"default",
"=",
"False",
")",
":",
"def",
"getx",
"(",
"self",
")",
":",
"if",
"getattr",
"(",
"self",
",",
"'_'",
"+",
"propname",
",",
"None",
")",
"is",
"not",
"None",
":",... | Creates a property that uses the :class:`_TempBool` class
Parameters
----------
propname: str
The attribute name to use. The _TempBool instance will be stored in the
``'_' + propname`` attribute of the corresponding instance
doc: str
The documentation of the property
default... | [
"Creates",
"a",
"property",
"that",
"uses",
"the",
":",
"class",
":",
"_TempBool",
"class"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/utils.py#L124-L149 |
Chilipp/psyplot | psyplot/utils.py | check_key | def check_key(key, possible_keys, raise_error=True,
name='formatoption keyword',
msg=("See show_fmtkeys function for possible formatopion "
"keywords"),
*args, **kwargs):
"""
Checks whether the key is in a list of possible keys
This function chec... | python | def check_key(key, possible_keys, raise_error=True,
name='formatoption keyword',
msg=("See show_fmtkeys function for possible formatopion "
"keywords"),
*args, **kwargs):
"""
Checks whether the key is in a list of possible keys
This function chec... | [
"def",
"check_key",
"(",
"key",
",",
"possible_keys",
",",
"raise_error",
"=",
"True",
",",
"name",
"=",
"'formatoption keyword'",
",",
"msg",
"=",
"(",
"\"See show_fmtkeys function for possible formatopion \"",
"\"keywords\"",
")",
",",
"*",
"args",
",",
"*",
"*"... | Checks whether the key is in a list of possible keys
This function checks whether the given `key` is in `possible_keys` and if
not looks for similar sounding keys
Parameters
----------
key: str
Key to check
possible_keys: list of strings
a list of possible keys to use
raise... | [
"Checks",
"whether",
"the",
"key",
"is",
"in",
"a",
"list",
"of",
"possible",
"keys"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/utils.py#L182-L235 |
Chilipp/psyplot | psyplot/utils.py | sort_kwargs | def sort_kwargs(kwargs, *param_lists):
"""Function to sort keyword arguments and sort them into dictionaries
This function returns dictionaries that contain the keyword arguments
from `kwargs` corresponding given iterables in ``*params``
Parameters
----------
kwargs: dict
Original dict... | python | def sort_kwargs(kwargs, *param_lists):
"""Function to sort keyword arguments and sort them into dictionaries
This function returns dictionaries that contain the keyword arguments
from `kwargs` corresponding given iterables in ``*params``
Parameters
----------
kwargs: dict
Original dict... | [
"def",
"sort_kwargs",
"(",
"kwargs",
",",
"*",
"param_lists",
")",
":",
"return",
"chain",
"(",
"(",
"{",
"key",
":",
"kwargs",
".",
"pop",
"(",
"key",
")",
"for",
"key",
"in",
"params",
".",
"intersection",
"(",
"kwargs",
")",
"}",
"for",
"params",
... | Function to sort keyword arguments and sort them into dictionaries
This function returns dictionaries that contain the keyword arguments
from `kwargs` corresponding given iterables in ``*params``
Parameters
----------
kwargs: dict
Original dictionary
``*param_lists``
iterables ... | [
"Function",
"to",
"sort",
"keyword",
"arguments",
"and",
"sort",
"them",
"into",
"dictionaries"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/utils.py#L238-L259 |
Chilipp/psyplot | psyplot/utils.py | hashable | def hashable(val):
"""Test if `val` is hashable and if not, get it's string representation
Parameters
----------
val: object
Any (possibly not hashable) python object
Returns
-------
val or string
The given `val` if it is hashable or it's string representation"""
if val... | python | def hashable(val):
"""Test if `val` is hashable and if not, get it's string representation
Parameters
----------
val: object
Any (possibly not hashable) python object
Returns
-------
val or string
The given `val` if it is hashable or it's string representation"""
if val... | [
"def",
"hashable",
"(",
"val",
")",
":",
"if",
"val",
"is",
"None",
":",
"return",
"val",
"try",
":",
"hash",
"(",
"val",
")",
"except",
"TypeError",
":",
"return",
"repr",
"(",
"val",
")",
"else",
":",
"return",
"val"
] | Test if `val` is hashable and if not, get it's string representation
Parameters
----------
val: object
Any (possibly not hashable) python object
Returns
-------
val or string
The given `val` if it is hashable or it's string representation | [
"Test",
"if",
"val",
"is",
"hashable",
"and",
"if",
"not",
"get",
"it",
"s",
"string",
"representation"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/utils.py#L262-L281 |
Chilipp/psyplot | psyplot/utils.py | join_dicts | def join_dicts(dicts, delimiter=None, keep_all=False):
"""Join multiple dictionaries into one
Parameters
----------
dicts: list of dict
A list of dictionaries
delimiter: str
The string that shall be used as the delimiter in case that there
are multiple values for one attribu... | python | def join_dicts(dicts, delimiter=None, keep_all=False):
"""Join multiple dictionaries into one
Parameters
----------
dicts: list of dict
A list of dictionaries
delimiter: str
The string that shall be used as the delimiter in case that there
are multiple values for one attribu... | [
"def",
"join_dicts",
"(",
"dicts",
",",
"delimiter",
"=",
"None",
",",
"keep_all",
"=",
"False",
")",
":",
"if",
"not",
"dicts",
":",
"return",
"{",
"}",
"if",
"keep_all",
":",
"all_keys",
"=",
"set",
"(",
"chain",
"(",
"*",
"(",
"d",
".",
"keys",
... | Join multiple dictionaries into one
Parameters
----------
dicts: list of dict
A list of dictionaries
delimiter: str
The string that shall be used as the delimiter in case that there
are multiple values for one attribute in the arrays. If None, they
will be returned as se... | [
"Join",
"multiple",
"dictionaries",
"into",
"one"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/utils.py#L285-L320 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | check_guest_exist | def check_guest_exist(check_index=0):
"""Check guest exist in database.
:param check_index: The parameter index of userid(s), default as 0
"""
def outer(f):
@six.wraps(f)
def inner(self, *args, **kw):
userids = args[check_index]
if isinstance(userids, list):
... | python | def check_guest_exist(check_index=0):
"""Check guest exist in database.
:param check_index: The parameter index of userid(s), default as 0
"""
def outer(f):
@six.wraps(f)
def inner(self, *args, **kw):
userids = args[check_index]
if isinstance(userids, list):
... | [
"def",
"check_guest_exist",
"(",
"check_index",
"=",
"0",
")",
":",
"def",
"outer",
"(",
"f",
")",
":",
"@",
"six",
".",
"wraps",
"(",
"f",
")",
"def",
"inner",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"userids",
"=",
"args... | Check guest exist in database.
:param check_index: The parameter index of userid(s), default as 0 | [
"Check",
"guest",
"exist",
"in",
"database",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L38-L66 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_start | def guest_start(self, userid):
"""Power on a virtual machine.
:param str userid: the id of the virtual machine to be power on
:returns: None
"""
action = "start guest '%s'" % userid
with zvmutils.log_and_reraise_sdkbase_error(action):
self._vmops.guest_start... | python | def guest_start(self, userid):
"""Power on a virtual machine.
:param str userid: the id of the virtual machine to be power on
:returns: None
"""
action = "start guest '%s'" % userid
with zvmutils.log_and_reraise_sdkbase_error(action):
self._vmops.guest_start... | [
"def",
"guest_start",
"(",
"self",
",",
"userid",
")",
":",
"action",
"=",
"\"start guest '%s'\"",
"%",
"userid",
"with",
"zvmutils",
".",
"log_and_reraise_sdkbase_error",
"(",
"action",
")",
":",
"self",
".",
"_vmops",
".",
"guest_start",
"(",
"userid",
")"
] | Power on a virtual machine.
:param str userid: the id of the virtual machine to be power on
:returns: None | [
"Power",
"on",
"a",
"virtual",
"machine",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L84-L93 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_stop | def guest_stop(self, userid, **kwargs):
"""Power off a virtual machine.
:param str userid: the id of the virtual machine to be power off
:param dict kwargs:
- timeout=<value>:
Integer, time to wait for vm to be deactivate, the
recommended value i... | python | def guest_stop(self, userid, **kwargs):
"""Power off a virtual machine.
:param str userid: the id of the virtual machine to be power off
:param dict kwargs:
- timeout=<value>:
Integer, time to wait for vm to be deactivate, the
recommended value i... | [
"def",
"guest_stop",
"(",
"self",
",",
"userid",
",",
"*",
"*",
"kwargs",
")",
":",
"action",
"=",
"\"stop guest '%s'\"",
"%",
"userid",
"with",
"zvmutils",
".",
"log_and_reraise_sdkbase_error",
"(",
"action",
")",
":",
"self",
".",
"_vmops",
".",
"guest_sto... | Power off a virtual machine.
:param str userid: the id of the virtual machine to be power off
:param dict kwargs:
- timeout=<value>:
Integer, time to wait for vm to be deactivate, the
recommended value is 300
- poll_interval=<value>
... | [
"Power",
"off",
"a",
"virtual",
"machine",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L96-L113 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_softstop | def guest_softstop(self, userid, **kwargs):
"""Issue a shutdown command to shutdown the OS in a virtual
machine and then log the virtual machine off z/VM..
:param str userid: the id of the virtual machine to be power off
:param dict kwargs:
- timeout=<value>:
... | python | def guest_softstop(self, userid, **kwargs):
"""Issue a shutdown command to shutdown the OS in a virtual
machine and then log the virtual machine off z/VM..
:param str userid: the id of the virtual machine to be power off
:param dict kwargs:
- timeout=<value>:
... | [
"def",
"guest_softstop",
"(",
"self",
",",
"userid",
",",
"*",
"*",
"kwargs",
")",
":",
"action",
"=",
"\"soft stop guest '%s'\"",
"%",
"userid",
"with",
"zvmutils",
".",
"log_and_reraise_sdkbase_error",
"(",
"action",
")",
":",
"self",
".",
"_vmops",
".",
"... | Issue a shutdown command to shutdown the OS in a virtual
machine and then log the virtual machine off z/VM..
:param str userid: the id of the virtual machine to be power off
:param dict kwargs:
- timeout=<value>:
Integer, time to wait for vm to be deactivate, the... | [
"Issue",
"a",
"shutdown",
"command",
"to",
"shutdown",
"the",
"OS",
"in",
"a",
"virtual",
"machine",
"and",
"then",
"log",
"the",
"virtual",
"machine",
"off",
"z",
"/",
"VM",
".."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L116-L134 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_reboot | def guest_reboot(self, userid):
"""Reboot a virtual machine
:param str userid: the id of the virtual machine to be reboot
:returns: None
"""
action = "reboot guest '%s'" % userid
with zvmutils.log_and_reraise_sdkbase_error(action):
self._vmops.guest_reboot(use... | python | def guest_reboot(self, userid):
"""Reboot a virtual machine
:param str userid: the id of the virtual machine to be reboot
:returns: None
"""
action = "reboot guest '%s'" % userid
with zvmutils.log_and_reraise_sdkbase_error(action):
self._vmops.guest_reboot(use... | [
"def",
"guest_reboot",
"(",
"self",
",",
"userid",
")",
":",
"action",
"=",
"\"reboot guest '%s'\"",
"%",
"userid",
"with",
"zvmutils",
".",
"log_and_reraise_sdkbase_error",
"(",
"action",
")",
":",
"self",
".",
"_vmops",
".",
"guest_reboot",
"(",
"userid",
")... | Reboot a virtual machine
:param str userid: the id of the virtual machine to be reboot
:returns: None | [
"Reboot",
"a",
"virtual",
"machine",
":",
"param",
"str",
"userid",
":",
"the",
"id",
"of",
"the",
"virtual",
"machine",
"to",
"be",
"reboot",
":",
"returns",
":",
"None"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L137-L144 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_reset | def guest_reset(self, userid):
"""reset a virtual machine
:param str userid: the id of the virtual machine to be reset
:returns: None
"""
action = "reset guest '%s'" % userid
with zvmutils.log_and_reraise_sdkbase_error(action):
self._vmops.guest_reset(userid) | python | def guest_reset(self, userid):
"""reset a virtual machine
:param str userid: the id of the virtual machine to be reset
:returns: None
"""
action = "reset guest '%s'" % userid
with zvmutils.log_and_reraise_sdkbase_error(action):
self._vmops.guest_reset(userid) | [
"def",
"guest_reset",
"(",
"self",
",",
"userid",
")",
":",
"action",
"=",
"\"reset guest '%s'\"",
"%",
"userid",
"with",
"zvmutils",
".",
"log_and_reraise_sdkbase_error",
"(",
"action",
")",
":",
"self",
".",
"_vmops",
".",
"guest_reset",
"(",
"userid",
")"
] | reset a virtual machine
:param str userid: the id of the virtual machine to be reset
:returns: None | [
"reset",
"a",
"virtual",
"machine",
":",
"param",
"str",
"userid",
":",
"the",
"id",
"of",
"the",
"virtual",
"machine",
"to",
"be",
"reset",
":",
"returns",
":",
"None"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L147-L154 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_pause | def guest_pause(self, userid):
"""Pause a virtual machine.
:param str userid: the id of the virtual machine to be paused
:returns: None
"""
action = "pause guest '%s'" % userid
with zvmutils.log_and_reraise_sdkbase_error(action):
self._vmops.guest_pause(useri... | python | def guest_pause(self, userid):
"""Pause a virtual machine.
:param str userid: the id of the virtual machine to be paused
:returns: None
"""
action = "pause guest '%s'" % userid
with zvmutils.log_and_reraise_sdkbase_error(action):
self._vmops.guest_pause(useri... | [
"def",
"guest_pause",
"(",
"self",
",",
"userid",
")",
":",
"action",
"=",
"\"pause guest '%s'\"",
"%",
"userid",
"with",
"zvmutils",
".",
"log_and_reraise_sdkbase_error",
"(",
"action",
")",
":",
"self",
".",
"_vmops",
".",
"guest_pause",
"(",
"userid",
")"
] | Pause a virtual machine.
:param str userid: the id of the virtual machine to be paused
:returns: None | [
"Pause",
"a",
"virtual",
"machine",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L157-L165 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_unpause | def guest_unpause(self, userid):
"""Unpause a virtual machine.
:param str userid: the id of the virtual machine to be unpaused
:returns: None
"""
action = "unpause guest '%s'" % userid
with zvmutils.log_and_reraise_sdkbase_error(action):
self._vmops.guest_unp... | python | def guest_unpause(self, userid):
"""Unpause a virtual machine.
:param str userid: the id of the virtual machine to be unpaused
:returns: None
"""
action = "unpause guest '%s'" % userid
with zvmutils.log_and_reraise_sdkbase_error(action):
self._vmops.guest_unp... | [
"def",
"guest_unpause",
"(",
"self",
",",
"userid",
")",
":",
"action",
"=",
"\"unpause guest '%s'\"",
"%",
"userid",
"with",
"zvmutils",
".",
"log_and_reraise_sdkbase_error",
"(",
"action",
")",
":",
"self",
".",
"_vmops",
".",
"guest_unpause",
"(",
"userid",
... | Unpause a virtual machine.
:param str userid: the id of the virtual machine to be unpaused
:returns: None | [
"Unpause",
"a",
"virtual",
"machine",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L168-L176 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_get_power_state | def guest_get_power_state(self, userid):
"""Returns power state."""
action = "get power state of guest '%s'" % userid
with zvmutils.log_and_reraise_sdkbase_error(action):
return self._vmops.get_power_state(userid) | python | def guest_get_power_state(self, userid):
"""Returns power state."""
action = "get power state of guest '%s'" % userid
with zvmutils.log_and_reraise_sdkbase_error(action):
return self._vmops.get_power_state(userid) | [
"def",
"guest_get_power_state",
"(",
"self",
",",
"userid",
")",
":",
"action",
"=",
"\"get power state of guest '%s'\"",
"%",
"userid",
"with",
"zvmutils",
".",
"log_and_reraise_sdkbase_error",
"(",
"action",
")",
":",
"return",
"self",
".",
"_vmops",
".",
"get_p... | Returns power state. | [
"Returns",
"power",
"state",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L179-L183 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_get_info | def guest_get_info(self, userid):
"""Get the status of a virtual machine.
:param str userid: the id of the virtual machine
:returns: Dictionary contains:
power_state: (str) the running state, one of on | off
max_mem_kb: (int) the maximum memory in KBytes all... | python | def guest_get_info(self, userid):
"""Get the status of a virtual machine.
:param str userid: the id of the virtual machine
:returns: Dictionary contains:
power_state: (str) the running state, one of on | off
max_mem_kb: (int) the maximum memory in KBytes all... | [
"def",
"guest_get_info",
"(",
"self",
",",
"userid",
")",
":",
"action",
"=",
"\"get info of guest '%s'\"",
"%",
"userid",
"with",
"zvmutils",
".",
"log_and_reraise_sdkbase_error",
"(",
"action",
")",
":",
"return",
"self",
".",
"_vmops",
".",
"get_info",
"(",
... | Get the status of a virtual machine.
:param str userid: the id of the virtual machine
:returns: Dictionary contains:
power_state: (str) the running state, one of on | off
max_mem_kb: (int) the maximum memory in KBytes allowed
mem_kb: (int) the memo... | [
"Get",
"the",
"status",
"of",
"a",
"virtual",
"machine",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L186-L200 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.host_diskpool_get_info | def host_diskpool_get_info(self, disk_pool=None):
""" Retrieve diskpool information.
:param str disk_pool: the disk pool info. It use ':' to separate
disk pool type and pool name, eg "ECKD:eckdpool" or "FBA:fbapool"
:returns: Dictionary describing disk pool usage info
"""
... | python | def host_diskpool_get_info(self, disk_pool=None):
""" Retrieve diskpool information.
:param str disk_pool: the disk pool info. It use ':' to separate
disk pool type and pool name, eg "ECKD:eckdpool" or "FBA:fbapool"
:returns: Dictionary describing disk pool usage info
"""
... | [
"def",
"host_diskpool_get_info",
"(",
"self",
",",
"disk_pool",
"=",
"None",
")",
":",
"# disk_pool must be assigned. disk_pool default to None because",
"# it is more convenient for users to just type function name when",
"# they want to get the disk pool info of CONF.zvm.disk_pool",
"if"... | Retrieve diskpool information.
:param str disk_pool: the disk pool info. It use ':' to separate
disk pool type and pool name, eg "ECKD:eckdpool" or "FBA:fbapool"
:returns: Dictionary describing disk pool usage info | [
"Retrieve",
"diskpool",
"information",
".",
":",
"param",
"str",
"disk_pool",
":",
"the",
"disk",
"pool",
"info",
".",
"It",
"use",
":",
"to",
"separate",
"disk",
"pool",
"type",
"and",
"pool",
"name",
"eg",
"ECKD",
":",
"eckdpool",
"or",
"FBA",
":",
"... | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L220-L247 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.image_delete | def image_delete(self, image_name):
"""Delete image from image repository
:param image_name: the name of the image to be deleted
"""
try:
self._imageops.image_delete(image_name)
except exception.SDKBaseException:
LOG.error("Failed to delete image '%s'" % ... | python | def image_delete(self, image_name):
"""Delete image from image repository
:param image_name: the name of the image to be deleted
"""
try:
self._imageops.image_delete(image_name)
except exception.SDKBaseException:
LOG.error("Failed to delete image '%s'" % ... | [
"def",
"image_delete",
"(",
"self",
",",
"image_name",
")",
":",
"try",
":",
"self",
".",
"_imageops",
".",
"image_delete",
"(",
"image_name",
")",
"except",
"exception",
".",
"SDKBaseException",
":",
"LOG",
".",
"error",
"(",
"\"Failed to delete image '%s'\"",
... | Delete image from image repository
:param image_name: the name of the image to be deleted | [
"Delete",
"image",
"from",
"image",
"repository"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L249-L258 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.image_get_root_disk_size | def image_get_root_disk_size(self, image_name):
"""Get the root disk size of the image
:param image_name: the image name in image Repository
:returns: the disk size in units CYL or BLK
"""
try:
return self._imageops.image_get_root_disk_size(image_name)
except... | python | def image_get_root_disk_size(self, image_name):
"""Get the root disk size of the image
:param image_name: the image name in image Repository
:returns: the disk size in units CYL or BLK
"""
try:
return self._imageops.image_get_root_disk_size(image_name)
except... | [
"def",
"image_get_root_disk_size",
"(",
"self",
",",
"image_name",
")",
":",
"try",
":",
"return",
"self",
".",
"_imageops",
".",
"image_get_root_disk_size",
"(",
"image_name",
")",
"except",
"exception",
".",
"SDKBaseException",
":",
"LOG",
".",
"error",
"(",
... | Get the root disk size of the image
:param image_name: the image name in image Repository
:returns: the disk size in units CYL or BLK | [
"Get",
"the",
"root",
"disk",
"size",
"of",
"the",
"image"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L260-L271 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.image_import | def image_import(self, image_name, url, image_meta, remote_host=None):
"""Import image to zvmsdk image repository
:param image_name: image name that can be uniquely identify an image
:param str url: image url to specify the location of image such as
http://netloc/path/to/file.tar... | python | def image_import(self, image_name, url, image_meta, remote_host=None):
"""Import image to zvmsdk image repository
:param image_name: image name that can be uniquely identify an image
:param str url: image url to specify the location of image such as
http://netloc/path/to/file.tar... | [
"def",
"image_import",
"(",
"self",
",",
"image_name",
",",
"url",
",",
"image_meta",
",",
"remote_host",
"=",
"None",
")",
":",
"try",
":",
"self",
".",
"_imageops",
".",
"image_import",
"(",
"image_name",
",",
"url",
",",
"image_meta",
",",
"remote_host"... | Import image to zvmsdk image repository
:param image_name: image name that can be uniquely identify an image
:param str url: image url to specify the location of image such as
http://netloc/path/to/file.tar.gz.0
https://netloc/path/to/file.tar.gz.0
file:///p... | [
"Import",
"image",
"to",
"zvmsdk",
"image",
"repository"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L273-L298 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.image_query | def image_query(self, imagename=None):
"""Get the list of image info in image repository
:param imagename: Used to retrieve the specified image info,
if not specified, all images info will be returned
:returns: A list that contains the specified or all images info
"""
... | python | def image_query(self, imagename=None):
"""Get the list of image info in image repository
:param imagename: Used to retrieve the specified image info,
if not specified, all images info will be returned
:returns: A list that contains the specified or all images info
"""
... | [
"def",
"image_query",
"(",
"self",
",",
"imagename",
"=",
"None",
")",
":",
"try",
":",
"return",
"self",
".",
"_imageops",
".",
"image_query",
"(",
"imagename",
")",
"except",
"exception",
".",
"SDKBaseException",
":",
"LOG",
".",
"error",
"(",
"\"Failed ... | Get the list of image info in image repository
:param imagename: Used to retrieve the specified image info,
if not specified, all images info will be returned
:returns: A list that contains the specified or all images info | [
"Get",
"the",
"list",
"of",
"image",
"info",
"in",
"image",
"repository"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L300-L312 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.image_export | def image_export(self, image_name, dest_url, remote_host=None):
"""Export the image to the specified location
:param image_name: image name that can be uniquely identify an image
:param dest_url: the location of exported image, eg.
file:///opt/images/export.img, now only support export t... | python | def image_export(self, image_name, dest_url, remote_host=None):
"""Export the image to the specified location
:param image_name: image name that can be uniquely identify an image
:param dest_url: the location of exported image, eg.
file:///opt/images/export.img, now only support export t... | [
"def",
"image_export",
"(",
"self",
",",
"image_name",
",",
"dest_url",
",",
"remote_host",
"=",
"None",
")",
":",
"try",
":",
"return",
"self",
".",
"_imageops",
".",
"image_export",
"(",
"image_name",
",",
"dest_url",
",",
"remote_host",
")",
"except",
"... | Export the image to the specified location
:param image_name: image name that can be uniquely identify an image
:param dest_url: the location of exported image, eg.
file:///opt/images/export.img, now only support export to remote server
or local server's file system
:param remote... | [
"Export",
"the",
"image",
"to",
"the",
"specified",
"location",
":",
"param",
"image_name",
":",
"image",
"name",
"that",
"can",
"be",
"uniquely",
"identify",
"an",
"image",
":",
"param",
"dest_url",
":",
"the",
"location",
"of",
"exported",
"image",
"eg",
... | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L314-L336 |
mfcloud/python-zvm-sdk | zvmsdk/api.py | SDKAPI.guest_deploy | def guest_deploy(self, userid, image_name, transportfiles=None,
remotehost=None, vdev=None, hostname=None):
""" Deploy the image to vm.
:param userid: (str) the user id of the vm
:param image_name: (str) the name of image that used to deploy the vm
:param transportf... | python | def guest_deploy(self, userid, image_name, transportfiles=None,
remotehost=None, vdev=None, hostname=None):
""" Deploy the image to vm.
:param userid: (str) the user id of the vm
:param image_name: (str) the name of image that used to deploy the vm
:param transportf... | [
"def",
"guest_deploy",
"(",
"self",
",",
"userid",
",",
"image_name",
",",
"transportfiles",
"=",
"None",
",",
"remotehost",
"=",
"None",
",",
"vdev",
"=",
"None",
",",
"hostname",
"=",
"None",
")",
":",
"action",
"=",
"(",
"\"deploy image '%(img)s' to guest... | Deploy the image to vm.
:param userid: (str) the user id of the vm
:param image_name: (str) the name of image that used to deploy the vm
:param transportfiles: (str) the files that used to customize the vm
:param remotehost: the server where the transportfiles located, the
... | [
"Deploy",
"the",
"image",
"to",
"vm",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/api.py#L339-L356 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.