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 |
|---|---|---|---|---|---|---|---|---|---|---|
Chilipp/psyplot | psyplot/data.py | UGridDecoder.get_nodes | def get_nodes(self, coord, coords):
"""Get the variables containing the definition of the nodes
Parameters
----------
coord: xarray.Coordinate
The mesh variable
coords: dict
The coordinates to use to get node coordinates"""
def get_coord(coord):
... | python | def get_nodes(self, coord, coords):
"""Get the variables containing the definition of the nodes
Parameters
----------
coord: xarray.Coordinate
The mesh variable
coords: dict
The coordinates to use to get node coordinates"""
def get_coord(coord):
... | [
"def",
"get_nodes",
"(",
"self",
",",
"coord",
",",
"coords",
")",
":",
"def",
"get_coord",
"(",
"coord",
")",
":",
"return",
"coords",
".",
"get",
"(",
"coord",
",",
"self",
".",
"ds",
".",
"coords",
".",
"get",
"(",
"coord",
")",
")",
"return",
... | Get the variables containing the definition of the nodes
Parameters
----------
coord: xarray.Coordinate
The mesh variable
coords: dict
The coordinates to use to get node coordinates | [
"Get",
"the",
"variables",
"containing",
"the",
"definition",
"of",
"the",
"nodes"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L1842-L1854 |
Chilipp/psyplot | psyplot/data.py | UGridDecoder.get_x | def get_x(self, var, coords=None):
"""
Get the centers of the triangles in the x-dimension
Parameters
----------
%(CFDecoder.get_y.parameters)s
Returns
-------
%(CFDecoder.get_y.returns)s"""
if coords is None:
coords = self.ds.coords
... | python | def get_x(self, var, coords=None):
"""
Get the centers of the triangles in the x-dimension
Parameters
----------
%(CFDecoder.get_y.parameters)s
Returns
-------
%(CFDecoder.get_y.returns)s"""
if coords is None:
coords = self.ds.coords
... | [
"def",
"get_x",
"(",
"self",
",",
"var",
",",
"coords",
"=",
"None",
")",
":",
"if",
"coords",
"is",
"None",
":",
"coords",
"=",
"self",
".",
"ds",
".",
"coords",
"# first we try the super class",
"ret",
"=",
"super",
"(",
"UGridDecoder",
",",
"self",
... | Get the centers of the triangles in the x-dimension
Parameters
----------
%(CFDecoder.get_y.parameters)s
Returns
-------
%(CFDecoder.get_y.returns)s | [
"Get",
"the",
"centers",
"of",
"the",
"triangles",
"in",
"the",
"x",
"-",
"dimension"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L1857-L1883 |
Chilipp/psyplot | psyplot/data.py | InteractiveBase.plot | def plot(self):
"""An object to visualize this data object
To make a 2D-plot with the :mod:`psy-simple <psy_simple.plugin>`
plugin, you can just type
.. code-block:: python
plotter = da.psy.plot.plot2d()
It will create a new :class:`psyplot.plotter.Plotter` instan... | python | def plot(self):
"""An object to visualize this data object
To make a 2D-plot with the :mod:`psy-simple <psy_simple.plugin>`
plugin, you can just type
.. code-block:: python
plotter = da.psy.plot.plot2d()
It will create a new :class:`psyplot.plotter.Plotter` instan... | [
"def",
"plot",
"(",
"self",
")",
":",
"if",
"self",
".",
"_plot",
"is",
"None",
":",
"import",
"psyplot",
".",
"project",
"as",
"psy",
"self",
".",
"_plot",
"=",
"psy",
".",
"DataArrayPlotter",
"(",
"self",
")",
"return",
"self",
".",
"_plot"
] | An object to visualize this data object
To make a 2D-plot with the :mod:`psy-simple <psy_simple.plugin>`
plugin, you can just type
.. code-block:: python
plotter = da.psy.plot.plot2d()
It will create a new :class:`psyplot.plotter.Plotter` instance with the
extract... | [
"An",
"object",
"to",
"visualize",
"this",
"data",
"object"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L2059-L2078 |
Chilipp/psyplot | psyplot/data.py | InteractiveBase._register_update | def _register_update(self, replot=False, fmt={}, force=False,
todefault=False):
"""
Register new formatoptions for updating
Parameters
----------
replot: bool
Boolean that determines whether the data specific formatoptions
shall b... | python | def _register_update(self, replot=False, fmt={}, force=False,
todefault=False):
"""
Register new formatoptions for updating
Parameters
----------
replot: bool
Boolean that determines whether the data specific formatoptions
shall b... | [
"def",
"_register_update",
"(",
"self",
",",
"replot",
"=",
"False",
",",
"fmt",
"=",
"{",
"}",
",",
"force",
"=",
"False",
",",
"todefault",
"=",
"False",
")",
":",
"self",
".",
"replot",
"=",
"self",
".",
"replot",
"or",
"replot",
"if",
"self",
"... | Register new formatoptions for updating
Parameters
----------
replot: bool
Boolean that determines whether the data specific formatoptions
shall be updated in any case or not. Note, if `dims` is not empty
or any coordinate keyword is in ``**kwargs``, this wil... | [
"Register",
"new",
"formatoptions",
"for",
"updating"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L2192-L2223 |
Chilipp/psyplot | psyplot/data.py | InteractiveBase.start_update | def start_update(self, draw=None, queues=None):
"""
Conduct the formerly registered updates
This method conducts the updates that have been registered via the
:meth:`update` method. You can call this method if the
:attr:`no_auto_update` attribute of this instance and the `auto_u... | python | def start_update(self, draw=None, queues=None):
"""
Conduct the formerly registered updates
This method conducts the updates that have been registered via the
:meth:`update` method. You can call this method if the
:attr:`no_auto_update` attribute of this instance and the `auto_u... | [
"def",
"start_update",
"(",
"self",
",",
"draw",
"=",
"None",
",",
"queues",
"=",
"None",
")",
":",
"if",
"self",
".",
"plotter",
"is",
"not",
"None",
":",
"return",
"self",
".",
"plotter",
".",
"start_update",
"(",
"draw",
"=",
"draw",
",",
"queues"... | Conduct the formerly registered updates
This method conducts the updates that have been registered via the
:meth:`update` method. You can call this method if the
:attr:`no_auto_update` attribute of this instance and the `auto_update`
parameter in the :meth:`update` method has been set t... | [
"Conduct",
"the",
"formerly",
"registered",
"updates"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L2228-L2262 |
Chilipp/psyplot | psyplot/data.py | InteractiveBase.update | def update(self, fmt={}, replot=False, draw=None, auto_update=False,
force=False, todefault=False, **kwargs):
"""
Update the coordinates and the plot
This method updates all arrays in this list with the given coordinate
values and formatoptions.
Parameters
... | python | def update(self, fmt={}, replot=False, draw=None, auto_update=False,
force=False, todefault=False, **kwargs):
"""
Update the coordinates and the plot
This method updates all arrays in this list with the given coordinate
values and formatoptions.
Parameters
... | [
"def",
"update",
"(",
"self",
",",
"fmt",
"=",
"{",
"}",
",",
"replot",
"=",
"False",
",",
"draw",
"=",
"None",
",",
"auto_update",
"=",
"False",
",",
"force",
"=",
"False",
",",
"todefault",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"fmt"... | Update the coordinates and the plot
This method updates all arrays in this list with the given coordinate
values and formatoptions.
Parameters
----------
%(InteractiveBase._register_update.parameters)s
auto_update: bool
Boolean determining whether or not the... | [
"Update",
"the",
"coordinates",
"and",
"the",
"plot"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L2269-L2304 |
Chilipp/psyplot | psyplot/data.py | ArrayList.dims_intersect | def dims_intersect(self):
"""Dimensions of the arrays in this list that are used in all arrays
"""
return set.intersection(*map(
set, (getattr(arr, 'dims_intersect', arr.dims) for arr in self))) | python | def dims_intersect(self):
"""Dimensions of the arrays in this list that are used in all arrays
"""
return set.intersection(*map(
set, (getattr(arr, 'dims_intersect', arr.dims) for arr in self))) | [
"def",
"dims_intersect",
"(",
"self",
")",
":",
"return",
"set",
".",
"intersection",
"(",
"*",
"map",
"(",
"set",
",",
"(",
"getattr",
"(",
"arr",
",",
"'dims_intersect'",
",",
"arr",
".",
"dims",
")",
"for",
"arr",
"in",
"self",
")",
")",
")"
] | Dimensions of the arrays in this list that are used in all arrays | [
"Dimensions",
"of",
"the",
"arrays",
"in",
"this",
"list",
"that",
"are",
"used",
"in",
"all",
"arrays"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L3197-L3201 |
Chilipp/psyplot | psyplot/data.py | ArrayList.names | def names(self):
"""Set of the variable in this list"""
ret = set()
for arr in self:
if isinstance(arr, InteractiveList):
ret.update(arr.names)
else:
ret.add(arr.name)
return ret | python | def names(self):
"""Set of the variable in this list"""
ret = set()
for arr in self:
if isinstance(arr, InteractiveList):
ret.update(arr.names)
else:
ret.add(arr.name)
return ret | [
"def",
"names",
"(",
"self",
")",
":",
"ret",
"=",
"set",
"(",
")",
"for",
"arr",
"in",
"self",
":",
"if",
"isinstance",
"(",
"arr",
",",
"InteractiveList",
")",
":",
"ret",
".",
"update",
"(",
"arr",
".",
"names",
")",
"else",
":",
"ret",
".",
... | Set of the variable in this list | [
"Set",
"of",
"the",
"variable",
"in",
"this",
"list"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L3222-L3230 |
Chilipp/psyplot | psyplot/data.py | ArrayList.all_names | def all_names(self):
"""The variable names for each of the arrays in this list"""
return [
_get_variable_names(arr) if not isinstance(arr, ArrayList) else
arr.all_names
for arr in self] | python | def all_names(self):
"""The variable names for each of the arrays in this list"""
return [
_get_variable_names(arr) if not isinstance(arr, ArrayList) else
arr.all_names
for arr in self] | [
"def",
"all_names",
"(",
"self",
")",
":",
"return",
"[",
"_get_variable_names",
"(",
"arr",
")",
"if",
"not",
"isinstance",
"(",
"arr",
",",
"ArrayList",
")",
"else",
"arr",
".",
"all_names",
"for",
"arr",
"in",
"self",
"]"
] | The variable names for each of the arrays in this list | [
"The",
"variable",
"names",
"for",
"each",
"of",
"the",
"arrays",
"in",
"this",
"list"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L3233-L3238 |
Chilipp/psyplot | psyplot/data.py | ArrayList.all_dims | def all_dims(self):
"""The dimensions for each of the arrays in this list"""
return [
_get_dims(arr) if not isinstance(arr, ArrayList) else
arr.all_dims
for arr in self] | python | def all_dims(self):
"""The dimensions for each of the arrays in this list"""
return [
_get_dims(arr) if not isinstance(arr, ArrayList) else
arr.all_dims
for arr in self] | [
"def",
"all_dims",
"(",
"self",
")",
":",
"return",
"[",
"_get_dims",
"(",
"arr",
")",
"if",
"not",
"isinstance",
"(",
"arr",
",",
"ArrayList",
")",
"else",
"arr",
".",
"all_dims",
"for",
"arr",
"in",
"self",
"]"
] | The dimensions for each of the arrays in this list | [
"The",
"dimensions",
"for",
"each",
"of",
"the",
"arrays",
"in",
"this",
"list"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L3241-L3246 |
Chilipp/psyplot | psyplot/data.py | ArrayList.is_unstructured | def is_unstructured(self):
"""A boolean for each array whether it is unstructured or not"""
return [
arr.psy.decoder.is_unstructured(arr)
if not isinstance(arr, ArrayList) else
arr.is_unstructured
for arr in self] | python | def is_unstructured(self):
"""A boolean for each array whether it is unstructured or not"""
return [
arr.psy.decoder.is_unstructured(arr)
if not isinstance(arr, ArrayList) else
arr.is_unstructured
for arr in self] | [
"def",
"is_unstructured",
"(",
"self",
")",
":",
"return",
"[",
"arr",
".",
"psy",
".",
"decoder",
".",
"is_unstructured",
"(",
"arr",
")",
"if",
"not",
"isinstance",
"(",
"arr",
",",
"ArrayList",
")",
"else",
"arr",
".",
"is_unstructured",
"for",
"arr",... | A boolean for each array whether it is unstructured or not | [
"A",
"boolean",
"for",
"each",
"array",
"whether",
"it",
"is",
"unstructured",
"or",
"not"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L3249-L3255 |
Chilipp/psyplot | psyplot/data.py | ArrayList.coords_intersect | def coords_intersect(self):
"""Coordinates of the arrays in this list that are used in all arrays
"""
return set.intersection(*map(
set, (getattr(arr, 'coords_intersect', arr.coords) for arr in self)
)) | python | def coords_intersect(self):
"""Coordinates of the arrays in this list that are used in all arrays
"""
return set.intersection(*map(
set, (getattr(arr, 'coords_intersect', arr.coords) for arr in self)
)) | [
"def",
"coords_intersect",
"(",
"self",
")",
":",
"return",
"set",
".",
"intersection",
"(",
"*",
"map",
"(",
"set",
",",
"(",
"getattr",
"(",
"arr",
",",
"'coords_intersect'",
",",
"arr",
".",
"coords",
")",
"for",
"arr",
"in",
"self",
")",
")",
")"... | Coordinates of the arrays in this list that are used in all arrays | [
"Coordinates",
"of",
"the",
"arrays",
"in",
"this",
"list",
"that",
"are",
"used",
"in",
"all",
"arrays"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L3263-L3268 |
Chilipp/psyplot | psyplot/data.py | ArrayList.with_plotter | def with_plotter(self):
"""The arrays in this instance that are visualized with a plotter"""
return self.__class__(
(arr for arr in self if arr.psy.plotter is not None),
auto_update=bool(self.auto_update)) | python | def with_plotter(self):
"""The arrays in this instance that are visualized with a plotter"""
return self.__class__(
(arr for arr in self if arr.psy.plotter is not None),
auto_update=bool(self.auto_update)) | [
"def",
"with_plotter",
"(",
"self",
")",
":",
"return",
"self",
".",
"__class__",
"(",
"(",
"arr",
"for",
"arr",
"in",
"self",
"if",
"arr",
".",
"psy",
".",
"plotter",
"is",
"not",
"None",
")",
",",
"auto_update",
"=",
"bool",
"(",
"self",
".",
"au... | The arrays in this instance that are visualized with a plotter | [
"The",
"arrays",
"in",
"this",
"instance",
"that",
"are",
"visualized",
"with",
"a",
"plotter"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L3271-L3275 |
Chilipp/psyplot | psyplot/data.py | ArrayList.arrays | def arrays(self):
"""A list of all the :class:`xarray.DataArray` instances in this list
"""
return list(chain.from_iterable(
([arr] if not isinstance(arr, InteractiveList) else arr.arrays
for arr in self))) | python | def arrays(self):
"""A list of all the :class:`xarray.DataArray` instances in this list
"""
return list(chain.from_iterable(
([arr] if not isinstance(arr, InteractiveList) else arr.arrays
for arr in self))) | [
"def",
"arrays",
"(",
"self",
")",
":",
"return",
"list",
"(",
"chain",
".",
"from_iterable",
"(",
"(",
"[",
"arr",
"]",
"if",
"not",
"isinstance",
"(",
"arr",
",",
"InteractiveList",
")",
"else",
"arr",
".",
"arrays",
"for",
"arr",
"in",
"self",
")"... | A list of all the :class:`xarray.DataArray` instances in this list | [
"A",
"list",
"of",
"all",
"the",
":",
"class",
":",
"xarray",
".",
"DataArray",
"instances",
"in",
"this",
"list"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L3302-L3307 |
Chilipp/psyplot | psyplot/data.py | ArrayList.rename | def rename(self, arr, new_name=True):
"""
Rename an array to find a name that isn't already in the list
Parameters
----------
arr: InteractiveBase
A :class:`InteractiveArray` or :class:`InteractiveList` instance
whose name shall be checked
new_nam... | python | def rename(self, arr, new_name=True):
"""
Rename an array to find a name that isn't already in the list
Parameters
----------
arr: InteractiveBase
A :class:`InteractiveArray` or :class:`InteractiveList` instance
whose name shall be checked
new_nam... | [
"def",
"rename",
"(",
"self",
",",
"arr",
",",
"new_name",
"=",
"True",
")",
":",
"name_in_me",
"=",
"arr",
".",
"psy",
".",
"arr_name",
"in",
"self",
".",
"arr_names",
"if",
"not",
"name_in_me",
":",
"return",
"arr",
",",
"False",
"elif",
"name_in_me"... | Rename an array to find a name that isn't already in the list
Parameters
----------
arr: InteractiveBase
A :class:`InteractiveArray` or :class:`InteractiveList` instance
whose name shall be checked
new_name: bool or str
If False, and the ``arr_name`` ... | [
"Rename",
"an",
"array",
"to",
"find",
"a",
"name",
"that",
"isn",
"t",
"already",
"in",
"the",
"list"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L3312-L3356 |
Chilipp/psyplot | psyplot/data.py | ArrayList.copy | def copy(self, deep=False):
"""Returns a copy of the list
Parameters
----------
deep: bool
If False (default), only the list is copied and not the contained
arrays, otherwise the contained arrays are deep copied"""
if not deep:
return self.__c... | python | def copy(self, deep=False):
"""Returns a copy of the list
Parameters
----------
deep: bool
If False (default), only the list is copied and not the contained
arrays, otherwise the contained arrays are deep copied"""
if not deep:
return self.__c... | [
"def",
"copy",
"(",
"self",
",",
"deep",
"=",
"False",
")",
":",
"if",
"not",
"deep",
":",
"return",
"self",
".",
"__class__",
"(",
"self",
"[",
":",
"]",
",",
"attrs",
"=",
"self",
".",
"attrs",
".",
"copy",
"(",
")",
",",
"auto_update",
"=",
... | Returns a copy of the list
Parameters
----------
deep: bool
If False (default), only the list is copied and not the contained
arrays, otherwise the contained arrays are deep copied | [
"Returns",
"a",
"copy",
"of",
"the",
"list"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L3384-L3398 |
Chilipp/psyplot | psyplot/data.py | ArrayList.from_dataset | def from_dataset(cls, base, method='isel', default_slice=None,
decoder=None, auto_update=None, prefer_list=False,
squeeze=True, attrs=None, load=False, **kwargs):
"""
Construct an ArrayList instance from an existing base dataset
Parameters
-----... | python | def from_dataset(cls, base, method='isel', default_slice=None,
decoder=None, auto_update=None, prefer_list=False,
squeeze=True, attrs=None, load=False, **kwargs):
"""
Construct an ArrayList instance from an existing base dataset
Parameters
-----... | [
"def",
"from_dataset",
"(",
"cls",
",",
"base",
",",
"method",
"=",
"'isel'",
",",
"default_slice",
"=",
"None",
",",
"decoder",
"=",
"None",
",",
"auto_update",
"=",
"None",
",",
"prefer_list",
"=",
"False",
",",
"squeeze",
"=",
"True",
",",
"attrs",
... | Construct an ArrayList instance from an existing base dataset
Parameters
----------
base: xarray.Dataset
Dataset instance that is used as reference
%(InteractiveArray.update.parameters.method)s
%(InteractiveBase.parameters.auto_update)s
prefer_list: bool
... | [
"Construct",
"an",
"ArrayList",
"instance",
"from",
"an",
"existing",
"base",
"dataset"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L3406-L3596 |
Chilipp/psyplot | psyplot/data.py | ArrayList._get_dsnames | def _get_dsnames(cls, data, ignore_keys=['attrs', 'plotter', 'ds'],
concat_dim=False):
"""Recursive method to get all the file names out of a dictionary
`data` created with the :meth`array_info` method"""
def filter_ignores(item):
return item[0] not in ignore_key... | python | def _get_dsnames(cls, data, ignore_keys=['attrs', 'plotter', 'ds'],
concat_dim=False):
"""Recursive method to get all the file names out of a dictionary
`data` created with the :meth`array_info` method"""
def filter_ignores(item):
return item[0] not in ignore_key... | [
"def",
"_get_dsnames",
"(",
"cls",
",",
"data",
",",
"ignore_keys",
"=",
"[",
"'attrs'",
",",
"'plotter'",
",",
"'ds'",
"]",
",",
"concat_dim",
"=",
"False",
")",
":",
"def",
"filter_ignores",
"(",
"item",
")",
":",
"return",
"item",
"[",
"0",
"]",
"... | Recursive method to get all the file names out of a dictionary
`data` created with the :meth`array_info` method | [
"Recursive",
"method",
"to",
"get",
"all",
"the",
"file",
"names",
"out",
"of",
"a",
"dictionary",
"data",
"created",
"with",
"the",
":",
"meth",
"array_info",
"method"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L3599-L3612 |
Chilipp/psyplot | psyplot/data.py | ArrayList._get_ds_descriptions_unsorted | def _get_ds_descriptions_unsorted(
cls, data, ignore_keys=['attrs', 'plotter'], nums=None):
"""Recursive method to get all the file names or datasets out of a
dictionary `data` created with the :meth`array_info` method"""
ds_description = {'ds', 'fname', 'num', 'arr', 'store'}
... | python | def _get_ds_descriptions_unsorted(
cls, data, ignore_keys=['attrs', 'plotter'], nums=None):
"""Recursive method to get all the file names or datasets out of a
dictionary `data` created with the :meth`array_info` method"""
ds_description = {'ds', 'fname', 'num', 'arr', 'store'}
... | [
"def",
"_get_ds_descriptions_unsorted",
"(",
"cls",
",",
"data",
",",
"ignore_keys",
"=",
"[",
"'attrs'",
",",
"'plotter'",
"]",
",",
"nums",
"=",
"None",
")",
":",
"ds_description",
"=",
"{",
"'ds'",
",",
"'fname'",
",",
"'num'",
",",
"'arr'",
",",
"'st... | Recursive method to get all the file names or datasets out of a
dictionary `data` created with the :meth`array_info` method | [
"Recursive",
"method",
"to",
"get",
"all",
"the",
"file",
"names",
"or",
"datasets",
"out",
"of",
"a",
"dictionary",
"data",
"created",
"with",
"the",
":",
"meth",
"array_info",
"method"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L3637-L3653 |
Chilipp/psyplot | psyplot/data.py | ArrayList.from_dict | def from_dict(cls, d, alternative_paths={}, datasets=None,
pwd=None, ignore_keys=['attrs', 'plotter', 'ds'],
only=None, chname={}, **kwargs):
"""
Create a list from the dictionary returned by :meth:`array_info`
This classmethod creates an :class:`~psyplot.dat... | python | def from_dict(cls, d, alternative_paths={}, datasets=None,
pwd=None, ignore_keys=['attrs', 'plotter', 'ds'],
only=None, chname={}, **kwargs):
"""
Create a list from the dictionary returned by :meth:`array_info`
This classmethod creates an :class:`~psyplot.dat... | [
"def",
"from_dict",
"(",
"cls",
",",
"d",
",",
"alternative_paths",
"=",
"{",
"}",
",",
"datasets",
"=",
"None",
",",
"pwd",
"=",
"None",
",",
"ignore_keys",
"=",
"[",
"'attrs'",
",",
"'plotter'",
",",
"'ds'",
"]",
",",
"only",
"=",
"None",
",",
"c... | Create a list from the dictionary returned by :meth:`array_info`
This classmethod creates an :class:`~psyplot.data.ArrayList` instance
from a dictionary containing filename, dimension infos and array names
Parameters
----------
d: dict
The dictionary holding the dat... | [
"Create",
"a",
"list",
"from",
"the",
"dictionary",
"returned",
"by",
":",
"meth",
":",
"array_info"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L3658-L3849 |
Chilipp/psyplot | psyplot/data.py | ArrayList.array_info | def array_info(self, dump=None, paths=None, attrs=True,
standardize_dims=True, pwd=None, use_rel_paths=True,
alternative_paths={}, ds_description={'fname', 'store'},
full_ds=True, copy=False, **kwargs):
"""
Get dimension informations on you arrays... | python | def array_info(self, dump=None, paths=None, attrs=True,
standardize_dims=True, pwd=None, use_rel_paths=True,
alternative_paths={}, ds_description={'fname', 'store'},
full_ds=True, copy=False, **kwargs):
"""
Get dimension informations on you arrays... | [
"def",
"array_info",
"(",
"self",
",",
"dump",
"=",
"None",
",",
"paths",
"=",
"None",
",",
"attrs",
"=",
"True",
",",
"standardize_dims",
"=",
"True",
",",
"pwd",
"=",
"None",
",",
"use_rel_paths",
"=",
"True",
",",
"alternative_paths",
"=",
"{",
"}",... | Get dimension informations on you arrays
This method returns a dictionary containing informations on the
array in this instance
Parameters
----------
dump: bool
If True and the dataset has not been dumped so far, it is dumped to
a temporary file or the o... | [
"Get",
"dimension",
"informations",
"on",
"you",
"arrays"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L3855-L4013 |
Chilipp/psyplot | psyplot/data.py | ArrayList._get_tnames | def _get_tnames(self):
"""Get the name of the time coordinate of the objects in this list"""
tnames = set()
for arr in self:
if isinstance(arr, InteractiveList):
tnames.update(arr.get_tnames())
else:
tnames.add(arr.psy.decoder.get_tname(
... | python | def _get_tnames(self):
"""Get the name of the time coordinate of the objects in this list"""
tnames = set()
for arr in self:
if isinstance(arr, InteractiveList):
tnames.update(arr.get_tnames())
else:
tnames.add(arr.psy.decoder.get_tname(
... | [
"def",
"_get_tnames",
"(",
"self",
")",
":",
"tnames",
"=",
"set",
"(",
")",
"for",
"arr",
"in",
"self",
":",
"if",
"isinstance",
"(",
"arr",
",",
"InteractiveList",
")",
":",
"tnames",
".",
"update",
"(",
"arr",
".",
"get_tnames",
"(",
")",
")",
"... | Get the name of the time coordinate of the objects in this list | [
"Get",
"the",
"name",
"of",
"the",
"time",
"coordinate",
"of",
"the",
"objects",
"in",
"this",
"list"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L4015-L4024 |
Chilipp/psyplot | psyplot/data.py | ArrayList._register_update | def _register_update(self, method='isel', replot=False, dims={}, fmt={},
force=False, todefault=False):
"""
Register new dimensions and formatoptions for updating. The keywords
are the same as for each single array
Parameters
----------
%(Interac... | python | def _register_update(self, method='isel', replot=False, dims={}, fmt={},
force=False, todefault=False):
"""
Register new dimensions and formatoptions for updating. The keywords
are the same as for each single array
Parameters
----------
%(Interac... | [
"def",
"_register_update",
"(",
"self",
",",
"method",
"=",
"'isel'",
",",
"replot",
"=",
"False",
",",
"dims",
"=",
"{",
"}",
",",
"fmt",
"=",
"{",
"}",
",",
"force",
"=",
"False",
",",
"todefault",
"=",
"False",
")",
":",
"for",
"arr",
"in",
"s... | Register new dimensions and formatoptions for updating. The keywords
are the same as for each single array
Parameters
----------
%(InteractiveArray._register_update.parameters)s | [
"Register",
"new",
"dimensions",
"and",
"formatoptions",
"for",
"updating",
".",
"The",
"keywords",
"are",
"the",
"same",
"as",
"for",
"each",
"single",
"array"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L4027-L4039 |
Chilipp/psyplot | psyplot/data.py | ArrayList.start_update | def start_update(self, draw=None):
"""
Conduct the registered plot updates
This method starts the updates from what has been registered by the
:meth:`update` method. You can call this method if you did not set the
`auto_update` parameter when calling the :meth:`update` method to... | python | def start_update(self, draw=None):
"""
Conduct the registered plot updates
This method starts the updates from what has been registered by the
:meth:`update` method. You can call this method if you did not set the
`auto_update` parameter when calling the :meth:`update` method to... | [
"def",
"start_update",
"(",
"self",
",",
"draw",
"=",
"None",
")",
":",
"def",
"worker",
"(",
"arr",
")",
":",
"results",
"[",
"arr",
".",
"psy",
".",
"arr_name",
"]",
"=",
"arr",
".",
"psy",
".",
"start_update",
"(",
"draw",
"=",
"False",
",",
"... | Conduct the registered plot updates
This method starts the updates from what has been registered by the
:meth:`update` method. You can call this method if you did not set the
`auto_update` parameter when calling the :meth:`update` method to True
and when the :attr:`no_auto_update` attri... | [
"Conduct",
"the",
"registered",
"plot",
"updates"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L4043-L4091 |
Chilipp/psyplot | psyplot/data.py | ArrayList.update | def update(self, method='isel', dims={}, fmt={}, replot=False,
auto_update=False, draw=None, force=False, todefault=False,
enable_post=None, **kwargs):
"""
Update the coordinates and the plot
This method updates all arrays in this list with the given coordinate
... | python | def update(self, method='isel', dims={}, fmt={}, replot=False,
auto_update=False, draw=None, force=False, todefault=False,
enable_post=None, **kwargs):
"""
Update the coordinates and the plot
This method updates all arrays in this list with the given coordinate
... | [
"def",
"update",
"(",
"self",
",",
"method",
"=",
"'isel'",
",",
"dims",
"=",
"{",
"}",
",",
"fmt",
"=",
"{",
"}",
",",
"replot",
"=",
"False",
",",
"auto_update",
"=",
"False",
",",
"draw",
"=",
"None",
",",
"force",
"=",
"False",
",",
"todefaul... | Update the coordinates and the plot
This method updates all arrays in this list with the given coordinate
values and formatoptions.
Parameters
----------
%(InteractiveArray._register_update.parameters)s
%(InteractiveArray.update.parameters.auto_update)s
%(ArrayL... | [
"Update",
"the",
"coordinates",
"and",
"the",
"plot"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L4098-L4140 |
Chilipp/psyplot | psyplot/data.py | ArrayList.draw | def draw(self):
"""Draws all the figures in this instance"""
for fig in set(chain(*map(
lambda arr: arr.psy.plotter.figs2draw, self.with_plotter))):
self.logger.debug("Drawing figure %s", fig.number)
fig.canvas.draw()
for arr in self:
if arr.ps... | python | def draw(self):
"""Draws all the figures in this instance"""
for fig in set(chain(*map(
lambda arr: arr.psy.plotter.figs2draw, self.with_plotter))):
self.logger.debug("Drawing figure %s", fig.number)
fig.canvas.draw()
for arr in self:
if arr.ps... | [
"def",
"draw",
"(",
"self",
")",
":",
"for",
"fig",
"in",
"set",
"(",
"chain",
"(",
"*",
"map",
"(",
"lambda",
"arr",
":",
"arr",
".",
"psy",
".",
"plotter",
".",
"figs2draw",
",",
"self",
".",
"with_plotter",
")",
")",
")",
":",
"self",
".",
"... | Draws all the figures in this instance | [
"Draws",
"all",
"the",
"figures",
"in",
"this",
"instance"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L4142-L4151 |
Chilipp/psyplot | psyplot/data.py | ArrayList._contains_array | def _contains_array(self, val):
"""Checks whether exactly this array is in the list"""
arr = self(arr_name=val.psy.arr_name)[0]
is_not_list = any(
map(lambda a: not isinstance(a, InteractiveList),
[arr, val]))
is_list = any(map(lambda a: isinstance(a, Interact... | python | def _contains_array(self, val):
"""Checks whether exactly this array is in the list"""
arr = self(arr_name=val.psy.arr_name)[0]
is_not_list = any(
map(lambda a: not isinstance(a, InteractiveList),
[arr, val]))
is_list = any(map(lambda a: isinstance(a, Interact... | [
"def",
"_contains_array",
"(",
"self",
",",
"val",
")",
":",
"arr",
"=",
"self",
"(",
"arr_name",
"=",
"val",
".",
"psy",
".",
"arr_name",
")",
"[",
"0",
"]",
"is_not_list",
"=",
"any",
"(",
"map",
"(",
"lambda",
"a",
":",
"not",
"isinstance",
"(",... | Checks whether exactly this array is in the list | [
"Checks",
"whether",
"exactly",
"this",
"array",
"is",
"in",
"the",
"list"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L4275-L4290 |
Chilipp/psyplot | psyplot/data.py | ArrayList.next_available_name | def next_available_name(self, fmt_str='arr{0}', counter=None):
"""Create a new array out of the given format string
Parameters
----------
format_str: str
The base string to use. ``'{0}'`` will be replaced by a counter
counter: iterable
An iterable where t... | python | def next_available_name(self, fmt_str='arr{0}', counter=None):
"""Create a new array out of the given format string
Parameters
----------
format_str: str
The base string to use. ``'{0}'`` will be replaced by a counter
counter: iterable
An iterable where t... | [
"def",
"next_available_name",
"(",
"self",
",",
"fmt_str",
"=",
"'arr{0}'",
",",
"counter",
"=",
"None",
")",
":",
"names",
"=",
"self",
".",
"arr_names",
"counter",
"=",
"counter",
"or",
"iter",
"(",
"range",
"(",
"1000",
")",
")",
"try",
":",
"new_na... | Create a new array out of the given format string
Parameters
----------
format_str: str
The base string to use. ``'{0}'`` will be replaced by a counter
counter: iterable
An iterable where the numbers should be drawn from. If None,
``range(100)`` is us... | [
"Create",
"a",
"new",
"array",
"out",
"of",
"the",
"given",
"format",
"string"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L4328-L4352 |
Chilipp/psyplot | psyplot/data.py | ArrayList.append | def append(self, value, new_name=False):
"""
Append a new array to the list
Parameters
----------
value: InteractiveBase
The data object to append to this list
%(ArrayList.rename.parameters.new_name)s
Raises
------
%(ArrayList.rename.... | python | def append(self, value, new_name=False):
"""
Append a new array to the list
Parameters
----------
value: InteractiveBase
The data object to append to this list
%(ArrayList.rename.parameters.new_name)s
Raises
------
%(ArrayList.rename.... | [
"def",
"append",
"(",
"self",
",",
"value",
",",
"new_name",
"=",
"False",
")",
":",
"arr",
",",
"renamed",
"=",
"self",
".",
"rename",
"(",
"value",
",",
"new_name",
")",
"if",
"renamed",
"is",
"not",
"None",
":",
"super",
"(",
"ArrayList",
",",
"... | Append a new array to the list
Parameters
----------
value: InteractiveBase
The data object to append to this list
%(ArrayList.rename.parameters.new_name)s
Raises
------
%(ArrayList.rename.raises)s
See Also
--------
list.appe... | [
"Append",
"a",
"new",
"array",
"to",
"the",
"list"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L4355-L4374 |
Chilipp/psyplot | psyplot/data.py | ArrayList.extend | def extend(self, iterable, new_name=False):
"""
Add further arrays from an iterable to this list
Parameters
----------
iterable
Any iterable that contains :class:`InteractiveBase` instances
%(ArrayList.rename.parameters.new_name)s
Raises
----... | python | def extend(self, iterable, new_name=False):
"""
Add further arrays from an iterable to this list
Parameters
----------
iterable
Any iterable that contains :class:`InteractiveBase` instances
%(ArrayList.rename.parameters.new_name)s
Raises
----... | [
"def",
"extend",
"(",
"self",
",",
"iterable",
",",
"new_name",
"=",
"False",
")",
":",
"# extend those arrays that aren't alredy in the list",
"super",
"(",
"ArrayList",
",",
"self",
")",
".",
"extend",
"(",
"t",
"[",
"0",
"]",
"for",
"t",
"in",
"filter",
... | Add further arrays from an iterable to this list
Parameters
----------
iterable
Any iterable that contains :class:`InteractiveBase` instances
%(ArrayList.rename.parameters.new_name)s
Raises
------
%(ArrayList.rename.raises)s
See Also
... | [
"Add",
"further",
"arrays",
"from",
"an",
"iterable",
"to",
"this",
"list"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L4377-L4397 |
Chilipp/psyplot | psyplot/data.py | ArrayList.remove | def remove(self, arr):
"""Removes an array from the list
Parameters
----------
arr: str or :class:`InteractiveBase`
The array name or the data object in this list to remove
Raises
------
ValueError
If no array with the specified array nam... | python | def remove(self, arr):
"""Removes an array from the list
Parameters
----------
arr: str or :class:`InteractiveBase`
The array name or the data object in this list to remove
Raises
------
ValueError
If no array with the specified array nam... | [
"def",
"remove",
"(",
"self",
",",
"arr",
")",
":",
"name",
"=",
"arr",
"if",
"isinstance",
"(",
"arr",
",",
"six",
".",
"string_types",
")",
"else",
"arr",
".",
"psy",
".",
"arr_name",
"if",
"arr",
"not",
"in",
"self",
":",
"raise",
"ValueError",
... | Removes an array from the list
Parameters
----------
arr: str or :class:`InteractiveBase`
The array name or the data object in this list to remove
Raises
------
ValueError
If no array with the specified array name is in the list | [
"Removes",
"an",
"array",
"from",
"the",
"list"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L4399-L4420 |
Chilipp/psyplot | psyplot/data.py | InteractiveList._njobs | def _njobs(self):
"""%(InteractiveBase._njobs)s"""
ret = super(self.__class__, self)._njobs or [0]
ret[0] += 1
return ret | python | def _njobs(self):
"""%(InteractiveBase._njobs)s"""
ret = super(self.__class__, self)._njobs or [0]
ret[0] += 1
return ret | [
"def",
"_njobs",
"(",
"self",
")",
":",
"ret",
"=",
"super",
"(",
"self",
".",
"__class__",
",",
"self",
")",
".",
"_njobs",
"or",
"[",
"0",
"]",
"ret",
"[",
"0",
"]",
"+=",
"1",
"return",
"ret"
] | %(InteractiveBase._njobs)s | [
"%",
"(",
"InteractiveBase",
".",
"_njobs",
")",
"s"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L4572-L4576 |
Chilipp/psyplot | psyplot/data.py | InteractiveList._register_update | def _register_update(self, method='isel', replot=False, dims={}, fmt={},
force=False, todefault=False):
"""
Register new dimensions and formatoptions for updating
Parameters
----------
%(InteractiveArray._register_update.parameters)s"""
ArrayList... | python | def _register_update(self, method='isel', replot=False, dims={}, fmt={},
force=False, todefault=False):
"""
Register new dimensions and formatoptions for updating
Parameters
----------
%(InteractiveArray._register_update.parameters)s"""
ArrayList... | [
"def",
"_register_update",
"(",
"self",
",",
"method",
"=",
"'isel'",
",",
"replot",
"=",
"False",
",",
"dims",
"=",
"{",
"}",
",",
"fmt",
"=",
"{",
"}",
",",
"force",
"=",
"False",
",",
"todefault",
"=",
"False",
")",
":",
"ArrayList",
".",
"_regi... | Register new dimensions and formatoptions for updating
Parameters
----------
%(InteractiveArray._register_update.parameters)s | [
"Register",
"new",
"dimensions",
"and",
"formatoptions",
"for",
"updating"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L4602-L4613 |
Chilipp/psyplot | psyplot/data.py | InteractiveList.start_update | def start_update(self, draw=None, queues=None):
"""
Conduct the formerly registered updates
This method conducts the updates that have been registered via the
:meth:`update` method. You can call this method if the
:attr:`auto_update` attribute of this instance is True and the
... | python | def start_update(self, draw=None, queues=None):
"""
Conduct the formerly registered updates
This method conducts the updates that have been registered via the
:meth:`update` method. You can call this method if the
:attr:`auto_update` attribute of this instance is True and the
... | [
"def",
"start_update",
"(",
"self",
",",
"draw",
"=",
"None",
",",
"queues",
"=",
"None",
")",
":",
"if",
"queues",
"is",
"not",
"None",
":",
"queues",
"[",
"0",
"]",
".",
"get",
"(",
")",
"try",
":",
"for",
"arr",
"in",
"self",
":",
"arr",
"."... | Conduct the formerly registered updates
This method conducts the updates that have been registered via the
:meth:`update` method. You can call this method if the
:attr:`auto_update` attribute of this instance is True and the
`auto_update` parameter in the :meth:`update` method has been ... | [
"Conduct",
"the",
"formerly",
"registered",
"updates"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L4616-L4649 |
Chilipp/psyplot | psyplot/data.py | InteractiveList.from_dataset | def from_dataset(cls, *args, **kwargs):
"""
Create an InteractiveList instance from the given base dataset
Parameters
----------
%(ArrayList.from_dataset.parameters.no_plotter)s
plotter: psyplot.plotter.Plotter
The plotter instance that is used to visualize t... | python | def from_dataset(cls, *args, **kwargs):
"""
Create an InteractiveList instance from the given base dataset
Parameters
----------
%(ArrayList.from_dataset.parameters.no_plotter)s
plotter: psyplot.plotter.Plotter
The plotter instance that is used to visualize t... | [
"def",
"from_dataset",
"(",
"cls",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"plotter",
"=",
"kwargs",
".",
"pop",
"(",
"'plotter'",
",",
"None",
")",
"make_plot",
"=",
"kwargs",
".",
"pop",
"(",
"'make_plot'",
",",
"True",
")",
"instance"... | Create an InteractiveList instance from the given base dataset
Parameters
----------
%(ArrayList.from_dataset.parameters.no_plotter)s
plotter: psyplot.plotter.Plotter
The plotter instance that is used to visualize the data in this
list
make_plot: bool
... | [
"Create",
"an",
"InteractiveList",
"instance",
"from",
"the",
"given",
"base",
"dataset"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L4675-L4703 |
mfcloud/python-zvm-sdk | smtLayer/makeVM.py | createVM | def createVM(rh):
"""
Create a virtual machine in z/VM.
Input:
Request Handle with the following properties:
function - 'CMDVM'
subfunction - 'CMD'
userid - userid of the virtual machine
Output:
Request Handle updated with the results.
Return ... | python | def createVM(rh):
"""
Create a virtual machine in z/VM.
Input:
Request Handle with the following properties:
function - 'CMDVM'
subfunction - 'CMD'
userid - userid of the virtual machine
Output:
Request Handle updated with the results.
Return ... | [
"def",
"createVM",
"(",
"rh",
")",
":",
"rh",
".",
"printSysLog",
"(",
"\"Enter makeVM.createVM\"",
")",
"dirLines",
"=",
"[",
"]",
"dirLines",
".",
"append",
"(",
"\"USER \"",
"+",
"rh",
".",
"userid",
"+",
"\" \"",
"+",
"rh",
".",
"parms",
"[",
"'pw'... | Create a virtual machine in z/VM.
Input:
Request Handle with the following properties:
function - 'CMDVM'
subfunction - 'CMD'
userid - userid of the virtual machine
Output:
Request Handle updated with the results.
Return code - 0: ok, non-zero: error | [
"Create",
"a",
"virtual",
"machine",
"in",
"z",
"/",
"VM",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/makeVM.py#L79-L154 |
mfcloud/python-zvm-sdk | smtLayer/makeVM.py | showOperandLines | def showOperandLines(rh):
"""
Produce help output related to operands.
Input:
Request Handle
"""
if rh.function == 'HELP':
rh.printLn("N", " For the MakeVM function:")
else:
rh.printLn("N", "Sub-Functions(s):")
rh.printLn("N", " directory - " +
"Cre... | python | def showOperandLines(rh):
"""
Produce help output related to operands.
Input:
Request Handle
"""
if rh.function == 'HELP':
rh.printLn("N", " For the MakeVM function:")
else:
rh.printLn("N", "Sub-Functions(s):")
rh.printLn("N", " directory - " +
"Cre... | [
"def",
"showOperandLines",
"(",
"rh",
")",
":",
"if",
"rh",
".",
"function",
"==",
"'HELP'",
":",
"rh",
".",
"printLn",
"(",
"\"N\"",
",",
"\" For the MakeVM function:\"",
")",
"else",
":",
"rh",
".",
"printLn",
"(",
"\"N\"",
",",
"\"Sub-Functions(s):\"",
... | Produce help output related to operands.
Input:
Request Handle | [
"Produce",
"help",
"output",
"related",
"to",
"operands",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/makeVM.py#L309-L370 |
mfcloud/python-zvm-sdk | tools/sample.py | capture_guest | def capture_guest(userid):
"""Caputre a virtual machine image.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8
Output parameters:
:image_name: Image name that captured
"""
# check power state, if down, start it
ret = sdk_client.send_request('guest_get_power_... | python | def capture_guest(userid):
"""Caputre a virtual machine image.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8
Output parameters:
:image_name: Image name that captured
"""
# check power state, if down, start it
ret = sdk_client.send_request('guest_get_power_... | [
"def",
"capture_guest",
"(",
"userid",
")",
":",
"# check power state, if down, start it",
"ret",
"=",
"sdk_client",
".",
"send_request",
"(",
"'guest_get_power_state'",
",",
"userid",
")",
"power_status",
"=",
"ret",
"[",
"'output'",
"]",
"if",
"power_status",
"=="... | Caputre a virtual machine image.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8
Output parameters:
:image_name: Image name that captured | [
"Caputre",
"a",
"virtual",
"machine",
"image",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/tools/sample.py#L71-L92 |
mfcloud/python-zvm-sdk | tools/sample.py | import_image | def import_image(image_path, os_version):
"""Import image.
Input parameters:
:image_path: Image file path
:os_version: Operating system version. e.g. rhel7.2
"""
image_name = os.path.basename(image_path)
print("Checking if image %s exists or not, import it if not exists" %
... | python | def import_image(image_path, os_version):
"""Import image.
Input parameters:
:image_path: Image file path
:os_version: Operating system version. e.g. rhel7.2
"""
image_name = os.path.basename(image_path)
print("Checking if image %s exists or not, import it if not exists" %
... | [
"def",
"import_image",
"(",
"image_path",
",",
"os_version",
")",
":",
"image_name",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"image_path",
")",
"print",
"(",
"\"Checking if image %s exists or not, import it if not exists\"",
"%",
"image_name",
")",
"image_info",... | Import image.
Input parameters:
:image_path: Image file path
:os_version: Operating system version. e.g. rhel7.2 | [
"Import",
"image",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/tools/sample.py#L95-L112 |
mfcloud/python-zvm-sdk | tools/sample.py | _run_guest | def _run_guest(userid, image_path, os_version, profile,
cpu, memory, network_info, disks_list):
"""Deploy and provision a virtual machine.
Input parameters:
:userid: USERID of the guest, no more than 8.
:image_name: path of the image file
:os_version: os ve... | python | def _run_guest(userid, image_path, os_version, profile,
cpu, memory, network_info, disks_list):
"""Deploy and provision a virtual machine.
Input parameters:
:userid: USERID of the guest, no more than 8.
:image_name: path of the image file
:os_version: os ve... | [
"def",
"_run_guest",
"(",
"userid",
",",
"image_path",
",",
"os_version",
",",
"profile",
",",
"cpu",
",",
"memory",
",",
"network_info",
",",
"disks_list",
")",
":",
"# Import image if not exists",
"import_image",
"(",
"image_path",
",",
"os_version",
")",
"# S... | Deploy and provision a virtual machine.
Input parameters:
:userid: USERID of the guest, no more than 8.
:image_name: path of the image file
:os_version: os version of the image file
:profile: profile of the userid
:cpu: the number of vcpus
:m... | [
"Deploy",
"and",
"provision",
"a",
"virtual",
"machine",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/tools/sample.py#L124-L197 |
mfcloud/python-zvm-sdk | tools/sample.py | run_guest | def run_guest():
""" A sample for quick deploy and start a virtual guest."""
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_ADDR
global GATE... | python | def run_guest():
""" A sample for quick deploy and start a virtual guest."""
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_ADDR
global GATE... | [
"def",
"run_guest",
"(",
")",
":",
"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_AD... | A sample for quick deploy and start a virtual guest. | [
"A",
"sample",
"for",
"quick",
"deploy",
"and",
"start",
"a",
"virtual",
"guest",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/tools/sample.py#L200-L224 |
mfcloud/python-zvm-sdk | zvmsdk/sdkwsgi/validation/__init__.py | _remove_unexpected_query_parameters | def _remove_unexpected_query_parameters(schema, req):
"""Remove unexpected properties from the req.GET."""
additional_properties = schema.get('addtionalProperties', True)
if additional_properties:
pattern_regexes = []
patterns = schema.get('patternProperties', None)
if patterns:
... | python | def _remove_unexpected_query_parameters(schema, req):
"""Remove unexpected properties from the req.GET."""
additional_properties = schema.get('addtionalProperties', True)
if additional_properties:
pattern_regexes = []
patterns = schema.get('patternProperties', None)
if patterns:
... | [
"def",
"_remove_unexpected_query_parameters",
"(",
"schema",
",",
"req",
")",
":",
"additional_properties",
"=",
"schema",
".",
"get",
"(",
"'addtionalProperties'",
",",
"True",
")",
"if",
"additional_properties",
":",
"pattern_regexes",
"=",
"[",
"]",
"patterns",
... | Remove unexpected properties from the req.GET. | [
"Remove",
"unexpected",
"properties",
"from",
"the",
"req",
".",
"GET",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/sdkwsgi/validation/__init__.py#L111-L127 |
mfcloud/python-zvm-sdk | zvmsdk/sdkwsgi/validation/__init__.py | query_schema | def query_schema(query_params_schema, min_version=None,
max_version=None):
"""Register a schema to validate request query parameters."""
def add_validator(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
if 'req' in kwargs:
req = kwargs['r... | python | def query_schema(query_params_schema, min_version=None,
max_version=None):
"""Register a schema to validate request query parameters."""
def add_validator(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
if 'req' in kwargs:
req = kwargs['r... | [
"def",
"query_schema",
"(",
"query_params_schema",
",",
"min_version",
"=",
"None",
",",
"max_version",
"=",
"None",
")",
":",
"def",
"add_validator",
"(",
"func",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"*",
"a... | Register a schema to validate request query parameters. | [
"Register",
"a",
"schema",
"to",
"validate",
"request",
"query",
"parameters",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/sdkwsgi/validation/__init__.py#L130-L157 |
mfcloud/python-zvm-sdk | zvmconnector/restclient.py | RESTClient._close_after_stream | def _close_after_stream(self, response, chunk_size):
"""Iterate over the content and ensure the response is closed after."""
# Yield each chunk in the response body
for chunk in response.iter_content(chunk_size=chunk_size):
yield chunk
# Once we're done streaming the body, en... | python | def _close_after_stream(self, response, chunk_size):
"""Iterate over the content and ensure the response is closed after."""
# Yield each chunk in the response body
for chunk in response.iter_content(chunk_size=chunk_size):
yield chunk
# Once we're done streaming the body, en... | [
"def",
"_close_after_stream",
"(",
"self",
",",
"response",
",",
"chunk_size",
")",
":",
"# Yield each chunk in the response body",
"for",
"chunk",
"in",
"response",
".",
"iter_content",
"(",
"chunk_size",
"=",
"chunk_size",
")",
":",
"yield",
"chunk",
"# Once we're... | Iterate over the content and ensure the response is closed after. | [
"Iterate",
"over",
"the",
"content",
"and",
"ensure",
"the",
"response",
"is",
"closed",
"after",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmconnector/restclient.py#L993-L999 |
mfcloud/python-zvm-sdk | zvmconnector/restclient.py | RESTClient._save_file | def _save_file(self, data, path):
"""Save an file to the specified path.
:param data: binary data of the file
:param path: path to save the file to
"""
with open(path, 'wb') as tfile:
for chunk in data:
tfile.write(chunk) | python | def _save_file(self, data, path):
"""Save an file to the specified path.
:param data: binary data of the file
:param path: path to save the file to
"""
with open(path, 'wb') as tfile:
for chunk in data:
tfile.write(chunk) | [
"def",
"_save_file",
"(",
"self",
",",
"data",
",",
"path",
")",
":",
"with",
"open",
"(",
"path",
",",
"'wb'",
")",
"as",
"tfile",
":",
"for",
"chunk",
"in",
"data",
":",
"tfile",
".",
"write",
"(",
"chunk",
")"
] | Save an file to the specified path.
:param data: binary data of the file
:param path: path to save the file to | [
"Save",
"an",
"file",
"to",
"the",
"specified",
"path",
".",
":",
"param",
"data",
":",
"binary",
"data",
"of",
"the",
"file",
":",
"param",
"path",
":",
"path",
"to",
"save",
"the",
"file",
"to"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmconnector/restclient.py#L1001-L1008 |
Chilipp/psyplot | psyplot/sphinxext/extended_napoleon.py | process_docstring | def process_docstring(app, what, name, obj, options, lines):
"""Process the docstring for a given python object.
Called when autodoc has read and processed a docstring. `lines` is a list
of docstring lines that `_process_docstring` modifies in place to change
what Sphinx outputs.
The following set... | python | def process_docstring(app, what, name, obj, options, lines):
"""Process the docstring for a given python object.
Called when autodoc has read and processed a docstring. `lines` is a list
of docstring lines that `_process_docstring` modifies in place to change
what Sphinx outputs.
The following set... | [
"def",
"process_docstring",
"(",
"app",
",",
"what",
",",
"name",
",",
"obj",
",",
"options",
",",
"lines",
")",
":",
"result_lines",
"=",
"lines",
"if",
"app",
".",
"config",
".",
"napoleon_numpy_docstring",
":",
"docstring",
"=",
"ExtendedNumpyDocstring",
... | Process the docstring for a given python object.
Called when autodoc has read and processed a docstring. `lines` is a list
of docstring lines that `_process_docstring` modifies in place to change
what Sphinx outputs.
The following settings in conf.py control what styles of docstrings will
be parse... | [
"Process",
"the",
"docstring",
"for",
"a",
"given",
"python",
"object",
"."
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/sphinxext/extended_napoleon.py#L84-L133 |
Chilipp/psyplot | psyplot/sphinxext/extended_napoleon.py | setup | def setup(app):
"""Sphinx extension setup function
When the extension is loaded, Sphinx imports this module and executes
the ``setup()`` function, which in turn notifies Sphinx of everything
the extension offers.
Parameters
----------
app : sphinx.application.Sphinx
Application obj... | python | def setup(app):
"""Sphinx extension setup function
When the extension is loaded, Sphinx imports this module and executes
the ``setup()`` function, which in turn notifies Sphinx of everything
the extension offers.
Parameters
----------
app : sphinx.application.Sphinx
Application obj... | [
"def",
"setup",
"(",
"app",
")",
":",
"from",
"sphinx",
".",
"application",
"import",
"Sphinx",
"if",
"not",
"isinstance",
"(",
"app",
",",
"Sphinx",
")",
":",
"return",
"# probably called by tests",
"app",
".",
"connect",
"(",
"'autodoc-process-docstring'",
"... | Sphinx extension setup function
When the extension is loaded, Sphinx imports this module and executes
the ``setup()`` function, which in turn notifies Sphinx of everything
the extension offers.
Parameters
----------
app : sphinx.application.Sphinx
Application object representing the Sp... | [
"Sphinx",
"extension",
"setup",
"function"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/sphinxext/extended_napoleon.py#L136-L157 |
Chilipp/psyplot | psyplot/plotter.py | format_time | def format_time(x):
"""Formats date values
This function formats :class:`datetime.datetime` and
:class:`datetime.timedelta` objects (and the corresponding numpy objects)
using the :func:`xarray.core.formatting.format_timestamp` and the
:func:`xarray.core.formatting.format_timedelta` functions.
... | python | def format_time(x):
"""Formats date values
This function formats :class:`datetime.datetime` and
:class:`datetime.timedelta` objects (and the corresponding numpy objects)
using the :func:`xarray.core.formatting.format_timestamp` and the
:func:`xarray.core.formatting.format_timedelta` functions.
... | [
"def",
"format_time",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"(",
"datetime64",
",",
"datetime",
")",
")",
":",
"return",
"format_timestamp",
"(",
"x",
")",
"elif",
"isinstance",
"(",
"x",
",",
"(",
"timedelta64",
",",
"timedelta",
")",... | Formats date values
This function formats :class:`datetime.datetime` and
:class:`datetime.timedelta` objects (and the corresponding numpy objects)
using the :func:`xarray.core.formatting.format_timestamp` and the
:func:`xarray.core.formatting.format_timedelta` functions.
Parameters
----------
... | [
"Formats",
"date",
"values"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L60-L83 |
Chilipp/psyplot | psyplot/plotter.py | is_data_dependent | def is_data_dependent(fmto, data):
"""Check whether a formatoption is data dependent
Parameters
----------
fmto: Formatoption
The :class:`Formatoption` instance to check
data: xarray.DataArray
The data array to use if the :attr:`~Formatoption.data_dependent`
attribute is a c... | python | def is_data_dependent(fmto, data):
"""Check whether a formatoption is data dependent
Parameters
----------
fmto: Formatoption
The :class:`Formatoption` instance to check
data: xarray.DataArray
The data array to use if the :attr:`~Formatoption.data_dependent`
attribute is a c... | [
"def",
"is_data_dependent",
"(",
"fmto",
",",
"data",
")",
":",
"if",
"callable",
"(",
"fmto",
".",
"data_dependent",
")",
":",
"return",
"fmto",
".",
"data_dependent",
"(",
"data",
")",
"return",
"fmto",
".",
"data_dependent"
] | Check whether a formatoption is data dependent
Parameters
----------
fmto: Formatoption
The :class:`Formatoption` instance to check
data: xarray.DataArray
The data array to use if the :attr:`~Formatoption.data_dependent`
attribute is a callable
Returns
-------
bool
... | [
"Check",
"whether",
"a",
"formatoption",
"is",
"data",
"dependent"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L86-L103 |
Chilipp/psyplot | psyplot/plotter.py | DictFormatoption.set_value | def set_value(self, value, validate=True, todefault=False):
"""
Set (and validate) the value in the plotter
Parameters
----------
%(Formatoption.set_value.parameters)s
Notes
-----
- If the current value in the plotter is None, then it will be set with
... | python | def set_value(self, value, validate=True, todefault=False):
"""
Set (and validate) the value in the plotter
Parameters
----------
%(Formatoption.set_value.parameters)s
Notes
-----
- If the current value in the plotter is None, then it will be set with
... | [
"def",
"set_value",
"(",
"self",
",",
"value",
",",
"validate",
"=",
"True",
",",
"todefault",
"=",
"False",
")",
":",
"value",
"=",
"value",
"if",
"not",
"validate",
"else",
"self",
".",
"validate",
"(",
"value",
")",
"# if the key in the plotter is not alr... | Set (and validate) the value in the plotter
Parameters
----------
%(Formatoption.set_value.parameters)s
Notes
-----
- If the current value in the plotter is None, then it will be set with
the given `value`, otherwise the current value in the plotter is
... | [
"Set",
"(",
"and",
"validate",
")",
"the",
"value",
"in",
"the",
"plotter"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L731-L759 |
Chilipp/psyplot | psyplot/plotter.py | Plotter.ax | def ax(self):
"""Axes instance of the plot"""
if self._ax is None:
import matplotlib.pyplot as plt
plt.figure()
self._ax = plt.axes(projection=self._get_sample_projection())
return self._ax | python | def ax(self):
"""Axes instance of the plot"""
if self._ax is None:
import matplotlib.pyplot as plt
plt.figure()
self._ax = plt.axes(projection=self._get_sample_projection())
return self._ax | [
"def",
"ax",
"(",
"self",
")",
":",
"if",
"self",
".",
"_ax",
"is",
"None",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"plt",
".",
"figure",
"(",
")",
"self",
".",
"_ax",
"=",
"plt",
".",
"axes",
"(",
"projection",
"=",
"self",
".",... | Axes instance of the plot | [
"Axes",
"instance",
"of",
"the",
"plot"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L958-L964 |
Chilipp/psyplot | psyplot/plotter.py | Plotter.base_variables | def base_variables(self):
"""A mapping from the base_variable names to the variables"""
if isinstance(self.data, InteractiveList):
return dict(chain(*map(
lambda arr: six.iteritems(arr.psy.base_variables),
self.data)))
else:
return self.dat... | python | def base_variables(self):
"""A mapping from the base_variable names to the variables"""
if isinstance(self.data, InteractiveList):
return dict(chain(*map(
lambda arr: six.iteritems(arr.psy.base_variables),
self.data)))
else:
return self.dat... | [
"def",
"base_variables",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"data",
",",
"InteractiveList",
")",
":",
"return",
"dict",
"(",
"chain",
"(",
"*",
"map",
"(",
"lambda",
"arr",
":",
"six",
".",
"iteritems",
"(",
"arr",
".",
"psy... | A mapping from the base_variable names to the variables | [
"A",
"mapping",
"from",
"the",
"base_variable",
"names",
"to",
"the",
"variables"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L1004-L1011 |
Chilipp/psyplot | psyplot/plotter.py | Plotter.iter_base_variables | def iter_base_variables(self):
"""A mapping from the base_variable names to the variables"""
if isinstance(self.data, InteractiveList):
return chain(*(arr.psy.iter_base_variables for arr in self.data))
else:
return self.data.psy.iter_base_variables | python | def iter_base_variables(self):
"""A mapping from the base_variable names to the variables"""
if isinstance(self.data, InteractiveList):
return chain(*(arr.psy.iter_base_variables for arr in self.data))
else:
return self.data.psy.iter_base_variables | [
"def",
"iter_base_variables",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"data",
",",
"InteractiveList",
")",
":",
"return",
"chain",
"(",
"*",
"(",
"arr",
".",
"psy",
".",
"iter_base_variables",
"for",
"arr",
"in",
"self",
".",
"data",... | A mapping from the base_variable names to the variables | [
"A",
"mapping",
"from",
"the",
"base_variable",
"names",
"to",
"the",
"variables"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L1014-L1019 |
Chilipp/psyplot | psyplot/plotter.py | Plotter.changed | def changed(self):
""":class:`dict` containing the key value pairs that are not the
default"""
return {key: value for key, value in six.iteritems(self)
if getattr(self, key).changed} | python | def changed(self):
""":class:`dict` containing the key value pairs that are not the
default"""
return {key: value for key, value in six.iteritems(self)
if getattr(self, key).changed} | [
"def",
"changed",
"(",
"self",
")",
":",
"return",
"{",
"key",
":",
"value",
"for",
"key",
",",
"value",
"in",
"six",
".",
"iteritems",
"(",
"self",
")",
"if",
"getattr",
"(",
"self",
",",
"key",
")",
".",
"changed",
"}"
] | :class:`dict` containing the key value pairs that are not the
default | [
":",
"class",
":",
"dict",
"containing",
"the",
"key",
"value",
"pairs",
"that",
"are",
"not",
"the",
"default"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L1029-L1033 |
Chilipp/psyplot | psyplot/plotter.py | Plotter._fmto_groups | def _fmto_groups(self):
"""Mapping from group to a set of formatoptions"""
ret = defaultdict(set)
for key in self:
ret[getattr(self, key).group].add(getattr(self, key))
return dict(ret) | python | def _fmto_groups(self):
"""Mapping from group to a set of formatoptions"""
ret = defaultdict(set)
for key in self:
ret[getattr(self, key).group].add(getattr(self, key))
return dict(ret) | [
"def",
"_fmto_groups",
"(",
"self",
")",
":",
"ret",
"=",
"defaultdict",
"(",
"set",
")",
"for",
"key",
"in",
"self",
":",
"ret",
"[",
"getattr",
"(",
"self",
",",
"key",
")",
".",
"group",
"]",
".",
"add",
"(",
"getattr",
"(",
"self",
",",
"key"... | Mapping from group to a set of formatoptions | [
"Mapping",
"from",
"group",
"to",
"a",
"set",
"of",
"formatoptions"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L1059-L1064 |
Chilipp/psyplot | psyplot/plotter.py | Plotter.logger | def logger(self):
""":class:`logging.Logger` of this plotter"""
try:
return self.data.psy.logger.getChild(self.__class__.__name__)
except AttributeError:
name = '%s.%s' % (self.__module__, self.__class__.__name__)
return logging.getLogger(name) | python | def logger(self):
""":class:`logging.Logger` of this plotter"""
try:
return self.data.psy.logger.getChild(self.__class__.__name__)
except AttributeError:
name = '%s.%s' % (self.__module__, self.__class__.__name__)
return logging.getLogger(name) | [
"def",
"logger",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"data",
".",
"psy",
".",
"logger",
".",
"getChild",
"(",
"self",
".",
"__class__",
".",
"__name__",
")",
"except",
"AttributeError",
":",
"name",
"=",
"'%s.%s'",
"%",
"(",
"se... | :class:`logging.Logger` of this plotter | [
":",
"class",
":",
"logging",
".",
"Logger",
"of",
"this",
"plotter"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L1112-L1118 |
Chilipp/psyplot | psyplot/plotter.py | Plotter._try2set | def _try2set(self, fmto, *args, **kwargs):
"""Sets the value in `fmto` and gives additional informations when fail
Parameters
----------
fmto: Formatoption
``*args`` and ``**kwargs``
Anything that is passed to `fmto`s :meth:`~Formatoption.set_value`
metho... | python | def _try2set(self, fmto, *args, **kwargs):
"""Sets the value in `fmto` and gives additional informations when fail
Parameters
----------
fmto: Formatoption
``*args`` and ``**kwargs``
Anything that is passed to `fmto`s :meth:`~Formatoption.set_value`
metho... | [
"def",
"_try2set",
"(",
"self",
",",
"fmto",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"fmto",
".",
"set_value",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"except",
"Exception",
"as",
"e",
":",
"critical",
"(",
"\"Err... | Sets the value in `fmto` and gives additional informations when fail
Parameters
----------
fmto: Formatoption
``*args`` and ``**kwargs``
Anything that is passed to `fmto`s :meth:`~Formatoption.set_value`
method | [
"Sets",
"the",
"value",
"in",
"fmto",
"and",
"gives",
"additional",
"informations",
"when",
"fail"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L1196-L1210 |
Chilipp/psyplot | psyplot/plotter.py | Plotter.check_key | def check_key(self, key, raise_error=True, *args, **kwargs):
"""
Checks whether the key is a valid formatoption
Parameters
----------
%(check_key.parameters.no_possible_keys|name)s
Returns
-------
%(check_key.returns)s
Raises
------
... | python | def check_key(self, key, raise_error=True, *args, **kwargs):
"""
Checks whether the key is a valid formatoption
Parameters
----------
%(check_key.parameters.no_possible_keys|name)s
Returns
-------
%(check_key.returns)s
Raises
------
... | [
"def",
"check_key",
"(",
"self",
",",
"key",
",",
"raise_error",
"=",
"True",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"check_key",
"(",
"key",
",",
"possible_keys",
"=",
"list",
"(",
"self",
")",
",",
"raise_error",
"=",
"raise... | Checks whether the key is a valid formatoption
Parameters
----------
%(check_key.parameters.no_possible_keys|name)s
Returns
-------
%(check_key.returns)s
Raises
------
%(check_key.raises)s | [
"Checks",
"whether",
"the",
"key",
"is",
"a",
"valid",
"formatoption"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L1234-L1251 |
Chilipp/psyplot | psyplot/plotter.py | Plotter.check_data | def check_data(cls, name, dims, is_unstructured):
"""
A validation method for the data shape
The default method does nothing and should be subclassed to validate
the results. If the plotter accepts a :class:`InteractiveList`, it
should accept a list for name and dims
Pa... | python | def check_data(cls, name, dims, is_unstructured):
"""
A validation method for the data shape
The default method does nothing and should be subclassed to validate
the results. If the plotter accepts a :class:`InteractiveList`, it
should accept a list for name and dims
Pa... | [
"def",
"check_data",
"(",
"cls",
",",
"name",
",",
"dims",
",",
"is_unstructured",
")",
":",
"if",
"isinstance",
"(",
"name",
",",
"six",
".",
"string_types",
")",
":",
"name",
"=",
"[",
"name",
"]",
"dims",
"=",
"[",
"dims",
"]",
"is_unstructured",
... | A validation method for the data shape
The default method does nothing and should be subclassed to validate
the results. If the plotter accepts a :class:`InteractiveList`, it
should accept a list for name and dims
Parameters
----------
name: str or list of str
... | [
"A",
"validation",
"method",
"for",
"the",
"data",
"shape"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L1257-L1293 |
Chilipp/psyplot | psyplot/plotter.py | Plotter.initialize_plot | def initialize_plot(self, data=None, ax=None, make_plot=True, clear=False,
draw=False, remove=False, priority=None):
"""
Initialize the plot for a data array
Parameters
----------
data: InteractiveArray or ArrayList, optional
Data object that ... | python | def initialize_plot(self, data=None, ax=None, make_plot=True, clear=False,
draw=False, remove=False, priority=None):
"""
Initialize the plot for a data array
Parameters
----------
data: InteractiveArray or ArrayList, optional
Data object that ... | [
"def",
"initialize_plot",
"(",
"self",
",",
"data",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"make_plot",
"=",
"True",
",",
"clear",
"=",
"False",
",",
"draw",
"=",
"False",
",",
"remove",
"=",
"False",
",",
"priority",
"=",
"None",
")",
":",
"if"... | Initialize the plot for a data array
Parameters
----------
data: InteractiveArray or ArrayList, optional
Data object that shall be visualized.
- If not None and `plot` is True, the given data is visualized.
- If None and the :attr:`data` attribute is not Non... | [
"Initialize",
"the",
"plot",
"for",
"a",
"data",
"array"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L1298-L1369 |
Chilipp/psyplot | psyplot/plotter.py | Plotter._register_update | def _register_update(self, fmt={}, replot=False, force=False,
todefault=False):
"""
Register formatoptions for the update
Parameters
----------
fmt: dict
Keys can be any valid formatoptions with the corresponding values
(see the :... | python | def _register_update(self, fmt={}, replot=False, force=False,
todefault=False):
"""
Register formatoptions for the update
Parameters
----------
fmt: dict
Keys can be any valid formatoptions with the corresponding values
(see the :... | [
"def",
"_register_update",
"(",
"self",
",",
"fmt",
"=",
"{",
"}",
",",
"replot",
"=",
"False",
",",
"force",
"=",
"False",
",",
"todefault",
"=",
"False",
")",
":",
"if",
"self",
".",
"disabled",
":",
"return",
"self",
".",
"replot",
"=",
"self",
... | Register formatoptions for the update
Parameters
----------
fmt: dict
Keys can be any valid formatoptions with the corresponding values
(see the :attr:`formatoptions` attribute)
replot: bool
Boolean that determines whether the data specific formatopti... | [
"Register",
"formatoptions",
"for",
"the",
"update"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L1376-L1400 |
Chilipp/psyplot | psyplot/plotter.py | Plotter.start_update | def start_update(self, draw=None, queues=None, update_shared=True):
"""
Conduct the registered plot updates
This method starts the updates from what has been registered by the
:meth:`update` method. You can call this method if you did not set the
`auto_update` parameter to True ... | python | def start_update(self, draw=None, queues=None, update_shared=True):
"""
Conduct the registered plot updates
This method starts the updates from what has been registered by the
:meth:`update` method. You can call this method if you did not set the
`auto_update` parameter to True ... | [
"def",
"start_update",
"(",
"self",
",",
"draw",
"=",
"None",
",",
"queues",
"=",
"None",
",",
"update_shared",
"=",
"True",
")",
":",
"def",
"update_the_others",
"(",
")",
":",
"for",
"fmto",
"in",
"fmtos",
":",
"for",
"other_fmto",
"in",
"fmto",
".",... | Conduct the registered plot updates
This method starts the updates from what has been registered by the
:meth:`update` method. You can call this method if you did not set the
`auto_update` parameter to True when calling the :meth:`update` method
and when the :attr:`no_auto_update` attri... | [
"Conduct",
"the",
"registered",
"plot",
"updates"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L1410-L1509 |
Chilipp/psyplot | psyplot/plotter.py | Plotter.reinit | def reinit(self, draw=None, clear=False):
"""
Reinitializes the plot with the same data and on the same axes.
Parameters
----------
%(InteractiveBase.start_update.parameters.draw)s
clear: bool
Whether to clear the axes or not
Warnings
-------... | python | def reinit(self, draw=None, clear=False):
"""
Reinitializes the plot with the same data and on the same axes.
Parameters
----------
%(InteractiveBase.start_update.parameters.draw)s
clear: bool
Whether to clear the axes or not
Warnings
-------... | [
"def",
"reinit",
"(",
"self",
",",
"draw",
"=",
"None",
",",
"clear",
"=",
"False",
")",
":",
"# call the initialize_plot method. Note that clear can be set to",
"# False if any fmto has requires_clearing attribute set to True,",
"# because this then has been cleared before",
"self... | Reinitializes the plot with the same data and on the same axes.
Parameters
----------
%(InteractiveBase.start_update.parameters.draw)s
clear: bool
Whether to clear the axes or not
Warnings
--------
The axes may be cleared when calling this method (ev... | [
"Reinitializes",
"the",
"plot",
"with",
"the",
"same",
"data",
"and",
"on",
"the",
"same",
"axes",
"."
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L1566-L1586 |
Chilipp/psyplot | psyplot/plotter.py | Plotter.draw | def draw(self):
"""Draw the figures and those that are shared and have been changed"""
for fig in self.figs2draw:
fig.canvas.draw()
self._figs2draw.clear() | python | def draw(self):
"""Draw the figures and those that are shared and have been changed"""
for fig in self.figs2draw:
fig.canvas.draw()
self._figs2draw.clear() | [
"def",
"draw",
"(",
"self",
")",
":",
"for",
"fig",
"in",
"self",
".",
"figs2draw",
":",
"fig",
".",
"canvas",
".",
"draw",
"(",
")",
"self",
".",
"_figs2draw",
".",
"clear",
"(",
")"
] | Draw the figures and those that are shared and have been changed | [
"Draw",
"the",
"figures",
"and",
"those",
"that",
"are",
"shared",
"and",
"have",
"been",
"changed"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L1588-L1592 |
Chilipp/psyplot | psyplot/plotter.py | Plotter._set_and_filter | def _set_and_filter(self):
"""Filters the registered updates and sort out what is not needed
This method filters out the formatoptions that have not changed, sets
the new value and returns an iterable that is sorted by the priority
(highest priority comes first) and dependencies
... | python | def _set_and_filter(self):
"""Filters the registered updates and sort out what is not needed
This method filters out the formatoptions that have not changed, sets
the new value and returns an iterable that is sorted by the priority
(highest priority comes first) and dependencies
... | [
"def",
"_set_and_filter",
"(",
"self",
")",
":",
"fmtos",
"=",
"[",
"]",
"seen",
"=",
"set",
"(",
")",
"for",
"key",
"in",
"self",
".",
"_force",
":",
"self",
".",
"_registered_updates",
".",
"setdefault",
"(",
"key",
",",
"getattr",
"(",
"self",
","... | Filters the registered updates and sort out what is not needed
This method filters out the formatoptions that have not changed, sets
the new value and returns an iterable that is sorted by the priority
(highest priority comes first) and dependencies
Returns
-------
list... | [
"Filters",
"the",
"registered",
"updates",
"and",
"sort",
"out",
"what",
"is",
"not",
"needed"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L1604-L1656 |
Chilipp/psyplot | psyplot/plotter.py | Plotter._insert_additionals | def _insert_additionals(self, fmtos, seen=None):
"""
Insert additional formatoptions into `fmtos`.
This method inserts those formatoptions into `fmtos` that are required
because one of the following criteria is fullfilled:
1. The :attr:`replot` attribute is True
2. Any ... | python | def _insert_additionals(self, fmtos, seen=None):
"""
Insert additional formatoptions into `fmtos`.
This method inserts those formatoptions into `fmtos` that are required
because one of the following criteria is fullfilled:
1. The :attr:`replot` attribute is True
2. Any ... | [
"def",
"_insert_additionals",
"(",
"self",
",",
"fmtos",
",",
"seen",
"=",
"None",
")",
":",
"def",
"get_dependencies",
"(",
"fmto",
")",
":",
"if",
"fmto",
"is",
"None",
":",
"return",
"[",
"]",
"return",
"fmto",
".",
"dependencies",
"+",
"list",
"(",... | Insert additional formatoptions into `fmtos`.
This method inserts those formatoptions into `fmtos` that are required
because one of the following criteria is fullfilled:
1. The :attr:`replot` attribute is True
2. Any formatoption with START priority is in `fmtos`
3. A dependenc... | [
"Insert",
"additional",
"formatoptions",
"into",
"fmtos",
"."
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L1658-L1720 |
Chilipp/psyplot | psyplot/plotter.py | Plotter._sorted_by_priority | def _sorted_by_priority(self, fmtos, changed=None):
"""Sort the formatoption objects by their priority and dependency
Parameters
----------
fmtos: list
list of :class:`Formatoption` instances
changed: list
the list of formatoption keys that have changed
... | python | def _sorted_by_priority(self, fmtos, changed=None):
"""Sort the formatoption objects by their priority and dependency
Parameters
----------
fmtos: list
list of :class:`Formatoption` instances
changed: list
the list of formatoption keys that have changed
... | [
"def",
"_sorted_by_priority",
"(",
"self",
",",
"fmtos",
",",
"changed",
"=",
"None",
")",
":",
"def",
"pop_fmto",
"(",
"key",
")",
":",
"idx",
"=",
"fmtos_keys",
".",
"index",
"(",
"key",
")",
"del",
"fmtos_keys",
"[",
"idx",
"]",
"return",
"fmtos",
... | Sort the formatoption objects by their priority and dependency
Parameters
----------
fmtos: list
list of :class:`Formatoption` instances
changed: list
the list of formatoption keys that have changed
Yields
------
Formatoption
... | [
"Sort",
"the",
"formatoption",
"objects",
"by",
"their",
"priority",
"and",
"dependency"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L1722-L1773 |
Chilipp/psyplot | psyplot/plotter.py | Plotter._get_formatoptions | def _get_formatoptions(cls, include_bases=True):
"""
Iterator over formatoptions
This class method returns an iterator that contains all the
formatoptions descriptors that are in this class and that are defined
in the base classes
Notes
-----
There is ab... | python | def _get_formatoptions(cls, include_bases=True):
"""
Iterator over formatoptions
This class method returns an iterator that contains all the
formatoptions descriptors that are in this class and that are defined
in the base classes
Notes
-----
There is ab... | [
"def",
"_get_formatoptions",
"(",
"cls",
",",
"include_bases",
"=",
"True",
")",
":",
"def",
"base_fmtos",
"(",
"base",
")",
":",
"return",
"filter",
"(",
"lambda",
"key",
":",
"isinstance",
"(",
"getattr",
"(",
"cls",
",",
"key",
")",
",",
"Formatoption... | Iterator over formatoptions
This class method returns an iterator that contains all the
formatoptions descriptors that are in this class and that are defined
in the base classes
Notes
-----
There is absolutely no need to call this method besides the plotter
init... | [
"Iterator",
"over",
"formatoptions"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L1776-L1808 |
Chilipp/psyplot | psyplot/plotter.py | Plotter._enhance_keys | def _enhance_keys(cls, keys=None, *args, **kwargs):
"""
Enhance the given keys by groups
Parameters
----------
keys: list of str or None
If None, the all formatoptions of the given class are used. Group
names from the :attr:`psyplot.plotter.groups` mappin... | python | def _enhance_keys(cls, keys=None, *args, **kwargs):
"""
Enhance the given keys by groups
Parameters
----------
keys: list of str or None
If None, the all formatoptions of the given class are used. Group
names from the :attr:`psyplot.plotter.groups` mappin... | [
"def",
"_enhance_keys",
"(",
"cls",
",",
"keys",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"all_keys",
"=",
"list",
"(",
"cls",
".",
"_get_formatoptions",
"(",
")",
")",
"if",
"isinstance",
"(",
"keys",
",",
"six",
".",
"str... | Enhance the given keys by groups
Parameters
----------
keys: list of str or None
If None, the all formatoptions of the given class are used. Group
names from the :attr:`psyplot.plotter.groups` mapping are replaced
by the formatoptions
Other Parameter... | [
"Enhance",
"the",
"given",
"keys",
"by",
"groups"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L1816-L1861 |
Chilipp/psyplot | psyplot/plotter.py | Plotter.show_keys | def show_keys(cls, keys=None, indent=0, grouped=False, func=None,
include_links=False, *args, **kwargs):
"""
Classmethod to return a nice looking table with the given formatoptions
Parameters
----------
%(Plotter._enhance_keys.parameters)s
indent: int
... | python | def show_keys(cls, keys=None, indent=0, grouped=False, func=None,
include_links=False, *args, **kwargs):
"""
Classmethod to return a nice looking table with the given formatoptions
Parameters
----------
%(Plotter._enhance_keys.parameters)s
indent: int
... | [
"def",
"show_keys",
"(",
"cls",
",",
"keys",
"=",
"None",
",",
"indent",
"=",
"0",
",",
"grouped",
"=",
"False",
",",
"func",
"=",
"None",
",",
"include_links",
"=",
"False",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"titled_group... | Classmethod to return a nice looking table with the given formatoptions
Parameters
----------
%(Plotter._enhance_keys.parameters)s
indent: int
The indentation of the table
grouped: bool, optional
If True, the formatoptions are grouped corresponding to the... | [
"Classmethod",
"to",
"return",
"a",
"nice",
"looking",
"table",
"with",
"the",
"given",
"formatoptions"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L1868-L1947 |
Chilipp/psyplot | psyplot/plotter.py | Plotter._show_doc | def _show_doc(cls, fmt_func, keys=None, indent=0, grouped=False,
func=None, include_links=False, *args, **kwargs):
"""
Classmethod to print the formatoptions and their documentation
This function is the basis for the :meth:`show_summaries` and
:meth:`show_docs` methods... | python | def _show_doc(cls, fmt_func, keys=None, indent=0, grouped=False,
func=None, include_links=False, *args, **kwargs):
"""
Classmethod to print the formatoptions and their documentation
This function is the basis for the :meth:`show_summaries` and
:meth:`show_docs` methods... | [
"def",
"_show_doc",
"(",
"cls",
",",
"fmt_func",
",",
"keys",
"=",
"None",
",",
"indent",
"=",
"0",
",",
"grouped",
"=",
"False",
",",
"func",
"=",
"None",
",",
"include_links",
"=",
"False",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"... | Classmethod to print the formatoptions and their documentation
This function is the basis for the :meth:`show_summaries` and
:meth:`show_docs` methods
Parameters
----------
fmt_func: function
A function that takes the key, the key as it is printed, and the
... | [
"Classmethod",
"to",
"print",
"the",
"formatoptions",
"and",
"their",
"documentation"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L1951-L2006 |
Chilipp/psyplot | psyplot/plotter.py | Plotter.show_summaries | def show_summaries(cls, keys=None, indent=0, *args, **kwargs):
"""
Classmethod to print the summaries of the formatoptions
Parameters
----------
%(Plotter.show_keys.parameters)s
Other Parameters
----------------
%(Plotter.show_keys.other_parameters)s
... | python | def show_summaries(cls, keys=None, indent=0, *args, **kwargs):
"""
Classmethod to print the summaries of the formatoptions
Parameters
----------
%(Plotter.show_keys.parameters)s
Other Parameters
----------------
%(Plotter.show_keys.other_parameters)s
... | [
"def",
"show_summaries",
"(",
"cls",
",",
"keys",
"=",
"None",
",",
"indent",
"=",
"0",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"find_summary",
"(",
"key",
",",
"key_txt",
",",
"doc",
")",
":",
"return",
"'\\n'",
".",
"join",
... | Classmethod to print the summaries of the formatoptions
Parameters
----------
%(Plotter.show_keys.parameters)s
Other Parameters
----------------
%(Plotter.show_keys.other_parameters)s
Returns
-------
%(Plotter.show_keys.returns)s
See Al... | [
"Classmethod",
"to",
"print",
"the",
"summaries",
"of",
"the",
"formatoptions"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L2010-L2035 |
Chilipp/psyplot | psyplot/plotter.py | Plotter.show_docs | def show_docs(cls, keys=None, indent=0, *args, **kwargs):
"""
Classmethod to print the full documentations of the formatoptions
Parameters
----------
%(Plotter.show_keys.parameters)s
Other Parameters
----------------
%(Plotter.show_keys.other_parameters)... | python | def show_docs(cls, keys=None, indent=0, *args, **kwargs):
"""
Classmethod to print the full documentations of the formatoptions
Parameters
----------
%(Plotter.show_keys.parameters)s
Other Parameters
----------------
%(Plotter.show_keys.other_parameters)... | [
"def",
"show_docs",
"(",
"cls",
",",
"keys",
"=",
"None",
",",
"indent",
"=",
"0",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"full_doc",
"(",
"key",
",",
"key_txt",
",",
"doc",
")",
":",
"return",
"(",
"'='",
"*",
"len",
"(",
... | Classmethod to print the full documentations of the formatoptions
Parameters
----------
%(Plotter.show_keys.parameters)s
Other Parameters
----------------
%(Plotter.show_keys.other_parameters)s
Returns
-------
%(Plotter.show_keys.returns)s
... | [
"Classmethod",
"to",
"print",
"the",
"full",
"documentations",
"of",
"the",
"formatoptions"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L2039-L2061 |
Chilipp/psyplot | psyplot/plotter.py | Plotter._get_rc_strings | def _get_rc_strings(cls):
"""
Recursive method to get the base strings in the rcParams dictionary.
This method takes the :attr:`_rcparams_string` attribute from the given
`class` and combines it with the :attr:`_rcparams_string` attributes
from the base classes.
The retu... | python | def _get_rc_strings(cls):
"""
Recursive method to get the base strings in the rcParams dictionary.
This method takes the :attr:`_rcparams_string` attribute from the given
`class` and combines it with the :attr:`_rcparams_string` attributes
from the base classes.
The retu... | [
"def",
"_get_rc_strings",
"(",
"cls",
")",
":",
"return",
"list",
"(",
"unique_everseen",
"(",
"chain",
"(",
"*",
"map",
"(",
"lambda",
"base",
":",
"getattr",
"(",
"base",
",",
"'_rcparams_string'",
",",
"[",
"]",
")",
",",
"cls",
".",
"__mro__",
")",... | Recursive method to get the base strings in the rcParams dictionary.
This method takes the :attr:`_rcparams_string` attribute from the given
`class` and combines it with the :attr:`_rcparams_string` attributes
from the base classes.
The returned frozenset can be used as base strings for... | [
"Recursive",
"method",
"to",
"get",
"the",
"base",
"strings",
"in",
"the",
"rcParams",
"dictionary",
"."
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L2064-L2083 |
Chilipp/psyplot | psyplot/plotter.py | Plotter._set_rc | def _set_rc(self):
"""Method to set the rcparams and defaultParams for this plotter"""
base_str = self._get_rc_strings()
# to make sure that the '.' is not interpreted as a regex pattern,
# we specify the pattern_base by ourselves
pattern_base = map(lambda s: s.replace('.', '\.')... | python | def _set_rc(self):
"""Method to set the rcparams and defaultParams for this plotter"""
base_str = self._get_rc_strings()
# to make sure that the '.' is not interpreted as a regex pattern,
# we specify the pattern_base by ourselves
pattern_base = map(lambda s: s.replace('.', '\.')... | [
"def",
"_set_rc",
"(",
"self",
")",
":",
"base_str",
"=",
"self",
".",
"_get_rc_strings",
"(",
")",
"# to make sure that the '.' is not interpreted as a regex pattern,",
"# we specify the pattern_base by ourselves",
"pattern_base",
"=",
"map",
"(",
"lambda",
"s",
":",
"s"... | Method to set the rcparams and defaultParams for this plotter | [
"Method",
"to",
"set",
"the",
"rcparams",
"and",
"defaultParams",
"for",
"this",
"plotter"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L2085-L2101 |
Chilipp/psyplot | psyplot/plotter.py | Plotter.update | def update(self, fmt={}, replot=False, auto_update=False, draw=None,
force=False, todefault=False, **kwargs):
"""
Update the formatoptions and the plot
If the :attr:`data` attribute of this plotter is None, the plotter is
updated like a usual dictionary (see :meth:`dict.u... | python | def update(self, fmt={}, replot=False, auto_update=False, draw=None,
force=False, todefault=False, **kwargs):
"""
Update the formatoptions and the plot
If the :attr:`data` attribute of this plotter is None, the plotter is
updated like a usual dictionary (see :meth:`dict.u... | [
"def",
"update",
"(",
"self",
",",
"fmt",
"=",
"{",
"}",
",",
"replot",
"=",
"False",
",",
"auto_update",
"=",
"False",
",",
"draw",
"=",
"None",
",",
"force",
"=",
"False",
",",
"todefault",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",... | Update the formatoptions and the plot
If the :attr:`data` attribute of this plotter is None, the plotter is
updated like a usual dictionary (see :meth:`dict.update`). Otherwise
the update is registered and the plot is updated if `auto_update` is
True or if the :meth:`start_update` metho... | [
"Update",
"the",
"formatoptions",
"and",
"the",
"plot"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L2106-L2143 |
Chilipp/psyplot | psyplot/plotter.py | Plotter._set_sharing_keys | def _set_sharing_keys(self, keys):
"""
Set the keys to share or unshare
Parameters
----------
keys: string or iterable of strings
The iterable may contain formatoptions that shall be shared (or
unshared), or group names of formatoptions to share all
... | python | def _set_sharing_keys(self, keys):
"""
Set the keys to share or unshare
Parameters
----------
keys: string or iterable of strings
The iterable may contain formatoptions that shall be shared (or
unshared), or group names of formatoptions to share all
... | [
"def",
"_set_sharing_keys",
"(",
"self",
",",
"keys",
")",
":",
"if",
"isinstance",
"(",
"keys",
",",
"str",
")",
":",
"keys",
"=",
"{",
"keys",
"}",
"keys",
"=",
"set",
"(",
"self",
")",
"if",
"keys",
"is",
"None",
"else",
"set",
"(",
"keys",
")... | Set the keys to share or unshare
Parameters
----------
keys: string or iterable of strings
The iterable may contain formatoptions that shall be shared (or
unshared), or group names of formatoptions to share all
formatoptions of that group (see the :attr:`fmt_... | [
"Set",
"the",
"keys",
"to",
"share",
"or",
"unshare"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L2145-L2168 |
Chilipp/psyplot | psyplot/plotter.py | Plotter.share | def share(self, plotters, keys=None, draw=None, auto_update=False):
"""
Share the formatoptions of this plotter with others
This method shares the formatoptions of this :class:`Plotter` instance
with others to make sure that, if the formatoption of this changes,
those of the oth... | python | def share(self, plotters, keys=None, draw=None, auto_update=False):
"""
Share the formatoptions of this plotter with others
This method shares the formatoptions of this :class:`Plotter` instance
with others to make sure that, if the formatoption of this changes,
those of the oth... | [
"def",
"share",
"(",
"self",
",",
"plotters",
",",
"keys",
"=",
"None",
",",
"draw",
"=",
"None",
",",
"auto_update",
"=",
"False",
")",
":",
"auto_update",
"=",
"auto_update",
"or",
"not",
"self",
".",
"no_auto_update",
"if",
"isinstance",
"(",
"plotter... | Share the formatoptions of this plotter with others
This method shares the formatoptions of this :class:`Plotter` instance
with others to make sure that, if the formatoption of this changes,
those of the others change as well
Parameters
----------
plotters: list of :cla... | [
"Share",
"the",
"formatoptions",
"of",
"this",
"plotter",
"with",
"others"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L2172-L2225 |
Chilipp/psyplot | psyplot/plotter.py | Plotter.unshare | def unshare(self, plotters, keys=None, auto_update=False, draw=None):
"""
Close the sharing connection of this plotter with others
This method undoes the sharing connections made by the :meth:`share`
method and releases the given `plotters` again, such that the
formatoptions in ... | python | def unshare(self, plotters, keys=None, auto_update=False, draw=None):
"""
Close the sharing connection of this plotter with others
This method undoes the sharing connections made by the :meth:`share`
method and releases the given `plotters` again, such that the
formatoptions in ... | [
"def",
"unshare",
"(",
"self",
",",
"plotters",
",",
"keys",
"=",
"None",
",",
"auto_update",
"=",
"False",
",",
"draw",
"=",
"None",
")",
":",
"auto_update",
"=",
"auto_update",
"or",
"not",
"self",
".",
"no_auto_update",
"if",
"isinstance",
"(",
"plott... | Close the sharing connection of this plotter with others
This method undoes the sharing connections made by the :meth:`share`
method and releases the given `plotters` again, such that the
formatoptions in this plotter may be updated again to values different
from this one.
Para... | [
"Close",
"the",
"sharing",
"connection",
"of",
"this",
"plotter",
"with",
"others"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L2228-L2259 |
Chilipp/psyplot | psyplot/plotter.py | Plotter.unshare_me | def unshare_me(self, keys=None, auto_update=False, draw=None,
update_other=True):
"""
Close the sharing connection of this plotter with others
This method undoes the sharing connections made by the :meth:`share`
method and release this plotter again.
Paramete... | python | def unshare_me(self, keys=None, auto_update=False, draw=None,
update_other=True):
"""
Close the sharing connection of this plotter with others
This method undoes the sharing connections made by the :meth:`share`
method and release this plotter again.
Paramete... | [
"def",
"unshare_me",
"(",
"self",
",",
"keys",
"=",
"None",
",",
"auto_update",
"=",
"False",
",",
"draw",
"=",
"None",
",",
"update_other",
"=",
"True",
")",
":",
"auto_update",
"=",
"auto_update",
"or",
"not",
"self",
".",
"no_auto_update",
"keys",
"="... | Close the sharing connection of this plotter with others
This method undoes the sharing connections made by the :meth:`share`
method and release this plotter again.
Parameters
----------
keys: string or iterable of strings
The formatoptions to unshare, or group name... | [
"Close",
"the",
"sharing",
"connection",
"of",
"this",
"plotter",
"with",
"others"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L2263-L2302 |
Chilipp/psyplot | psyplot/plotter.py | Plotter.has_changed | def has_changed(self, key, include_last=True):
"""
Determine whether a formatoption changed in the last update
Parameters
----------
key: str
A formatoption key contained in this plotter
include_last: bool
if True and the formatoption has been inc... | python | def has_changed(self, key, include_last=True):
"""
Determine whether a formatoption changed in the last update
Parameters
----------
key: str
A formatoption key contained in this plotter
include_last: bool
if True and the formatoption has been inc... | [
"def",
"has_changed",
"(",
"self",
",",
"key",
",",
"include_last",
"=",
"True",
")",
":",
"if",
"self",
".",
"_initializing",
"or",
"key",
"not",
"in",
"self",
":",
"return",
"fmto",
"=",
"getattr",
"(",
"self",
",",
"key",
")",
"if",
"self",
".",
... | Determine whether a formatoption changed in the last update
Parameters
----------
key: str
A formatoption key contained in this plotter
include_last: bool
if True and the formatoption has been included in the last update,
the return value will not be ... | [
"Determine",
"whether",
"a",
"formatoption",
"changed",
"in",
"the",
"last",
"update"
] | train | https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L2328-L2357 |
mfcloud/python-zvm-sdk | zvmsdk/utils.py | execute | def execute(cmd):
""" execute command, return rc and output string.
The cmd argument can be a string or a list composed of
the command name and each of its argument.
eg, ['/usr/bin/cp', '-r', 'src', 'dst'] """
# Parse cmd string to a list
if not isinstance(cmd, list):
cmd = shlex.split(... | python | def execute(cmd):
""" execute command, return rc and output string.
The cmd argument can be a string or a list composed of
the command name and each of its argument.
eg, ['/usr/bin/cp', '-r', 'src', 'dst'] """
# Parse cmd string to a list
if not isinstance(cmd, list):
cmd = shlex.split(... | [
"def",
"execute",
"(",
"cmd",
")",
":",
"# Parse cmd string to a list",
"if",
"not",
"isinstance",
"(",
"cmd",
",",
"list",
")",
":",
"cmd",
"=",
"shlex",
".",
"split",
"(",
"cmd",
")",
"# Execute command",
"rc",
"=",
"0",
"output",
"=",
"\"\"",
"try",
... | execute command, return rc and output string.
The cmd argument can be a string or a list composed of
the command name and each of its argument.
eg, ['/usr/bin/cp', '-r', 'src', 'dst'] | [
"execute",
"command",
"return",
"rc",
"and",
"output",
"string",
".",
"The",
"cmd",
"argument",
"can",
"be",
"a",
"string",
"or",
"a",
"list",
"composed",
"of",
"the",
"command",
"name",
"and",
"each",
"of",
"its",
"argument",
".",
"eg",
"[",
"/",
"usr... | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/utils.py#L43-L66 |
mfcloud/python-zvm-sdk | zvmsdk/utils.py | looping_call | def looping_call(f, sleep=5, inc_sleep=0, max_sleep=60, timeout=600,
exceptions=(), *args, **kwargs):
"""Helper function that to run looping call with fixed/dynamical interval.
:param f: the looping call function or method.
:param sleep: initial interval of the looping calls.... | python | def looping_call(f, sleep=5, inc_sleep=0, max_sleep=60, timeout=600,
exceptions=(), *args, **kwargs):
"""Helper function that to run looping call with fixed/dynamical interval.
:param f: the looping call function or method.
:param sleep: initial interval of the looping calls.... | [
"def",
"looping_call",
"(",
"f",
",",
"sleep",
"=",
"5",
",",
"inc_sleep",
"=",
"0",
",",
"max_sleep",
"=",
"60",
",",
"timeout",
"=",
"600",
",",
"exceptions",
"=",
"(",
")",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"time_start",
"="... | Helper function that to run looping call with fixed/dynamical interval.
:param f: the looping call function or method.
:param sleep: initial interval of the looping calls.
:param inc_sleep: sleep time increment, default as 0.
:param max_sleep: max sleep time.
:param timeout: loop... | [
"Helper",
"function",
"that",
"to",
"run",
"looping",
"call",
"with",
"fixed",
"/",
"dynamical",
"interval",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/utils.py#L74-L110 |
mfcloud/python-zvm-sdk | zvmsdk/utils.py | convert_to_mb | def convert_to_mb(s):
"""Convert memory size from GB to MB."""
s = s.upper()
try:
if s.endswith('G'):
return float(s[:-1].strip()) * 1024
elif s.endswith('T'):
return float(s[:-1].strip()) * 1024 * 1024
else:
return float(s[:-1].strip())
except... | python | def convert_to_mb(s):
"""Convert memory size from GB to MB."""
s = s.upper()
try:
if s.endswith('G'):
return float(s[:-1].strip()) * 1024
elif s.endswith('T'):
return float(s[:-1].strip()) * 1024 * 1024
else:
return float(s[:-1].strip())
except... | [
"def",
"convert_to_mb",
"(",
"s",
")",
":",
"s",
"=",
"s",
".",
"upper",
"(",
")",
"try",
":",
"if",
"s",
".",
"endswith",
"(",
"'G'",
")",
":",
"return",
"float",
"(",
"s",
"[",
":",
"-",
"1",
"]",
".",
"strip",
"(",
")",
")",
"*",
"1024",... | Convert memory size from GB to MB. | [
"Convert",
"memory",
"size",
"from",
"GB",
"to",
"MB",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/utils.py#L113-L125 |
mfcloud/python-zvm-sdk | zvmsdk/utils.py | valid_mac_addr | def valid_mac_addr(addr):
''' Validates a mac address'''
if not isinstance(addr, six.string_types):
return False
valid = re.compile(r'''
(^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$)
''',
re.VERBOSE | re.IGNORECASE)
return valid.match(addr... | python | def valid_mac_addr(addr):
''' Validates a mac address'''
if not isinstance(addr, six.string_types):
return False
valid = re.compile(r'''
(^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$)
''',
re.VERBOSE | re.IGNORECASE)
return valid.match(addr... | [
"def",
"valid_mac_addr",
"(",
"addr",
")",
":",
"if",
"not",
"isinstance",
"(",
"addr",
",",
"six",
".",
"string_types",
")",
":",
"return",
"False",
"valid",
"=",
"re",
".",
"compile",
"(",
"r'''\n (^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$)\n ... | Validates a mac address | [
"Validates",
"a",
"mac",
"address"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/utils.py#L212-L220 |
mfcloud/python-zvm-sdk | zvmsdk/utils.py | check_input_types | def check_input_types(*types, **validkeys):
"""This is a function decorator to check all input parameters given to
decorated function are in expected types.
The checks can be skipped by specify skip_input_checks=True in decorated
function.
:param tuple types: expected types of input parameters to ... | python | def check_input_types(*types, **validkeys):
"""This is a function decorator to check all input parameters given to
decorated function are in expected types.
The checks can be skipped by specify skip_input_checks=True in decorated
function.
:param tuple types: expected types of input parameters to ... | [
"def",
"check_input_types",
"(",
"*",
"types",
",",
"*",
"*",
"validkeys",
")",
":",
"def",
"decorator",
"(",
"function",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"function",
")",
"def",
"wrap_func",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
"... | This is a function decorator to check all input parameters given to
decorated function are in expected types.
The checks can be skipped by specify skip_input_checks=True in decorated
function.
:param tuple types: expected types of input parameters to the decorated
function
... | [
"This",
"is",
"a",
"function",
"decorator",
"to",
"check",
"all",
"input",
"parameters",
"given",
"to",
"decorated",
"function",
"are",
"in",
"expected",
"types",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/utils.py#L253-L332 |
mfcloud/python-zvm-sdk | zvmsdk/utils.py | expect_invalid_resp_data | def expect_invalid_resp_data(data=''):
"""Catch exceptions when using zvm client response data."""
try:
yield
except (ValueError, TypeError, IndexError, AttributeError,
KeyError) as err:
msg = ('Invalid smt response data: %s. Error: %s' %
(data, six.text_type(err))... | python | def expect_invalid_resp_data(data=''):
"""Catch exceptions when using zvm client response data."""
try:
yield
except (ValueError, TypeError, IndexError, AttributeError,
KeyError) as err:
msg = ('Invalid smt response data: %s. Error: %s' %
(data, six.text_type(err))... | [
"def",
"expect_invalid_resp_data",
"(",
"data",
"=",
"''",
")",
":",
"try",
":",
"yield",
"except",
"(",
"ValueError",
",",
"TypeError",
",",
"IndexError",
",",
"AttributeError",
",",
"KeyError",
")",
"as",
"err",
":",
"msg",
"=",
"(",
"'Invalid smt response... | Catch exceptions when using zvm client response data. | [
"Catch",
"exceptions",
"when",
"using",
"zvm",
"client",
"response",
"data",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/utils.py#L353-L362 |
mfcloud/python-zvm-sdk | zvmsdk/utils.py | wrap_invalid_resp_data_error | def wrap_invalid_resp_data_error(function):
"""Catch exceptions when using zvm client response data."""
@functools.wraps(function)
def decorated_function(*arg, **kwargs):
try:
return function(*arg, **kwargs)
except (ValueError, TypeError, IndexError, AttributeError,
... | python | def wrap_invalid_resp_data_error(function):
"""Catch exceptions when using zvm client response data."""
@functools.wraps(function)
def decorated_function(*arg, **kwargs):
try:
return function(*arg, **kwargs)
except (ValueError, TypeError, IndexError, AttributeError,
... | [
"def",
"wrap_invalid_resp_data_error",
"(",
"function",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"function",
")",
"def",
"decorated_function",
"(",
"*",
"arg",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"return",
"function",
"(",
"*",
"arg",
",... | Catch exceptions when using zvm client response data. | [
"Catch",
"exceptions",
"when",
"using",
"zvm",
"client",
"response",
"data",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/utils.py#L365-L379 |
mfcloud/python-zvm-sdk | zvmsdk/utils.py | expect_and_reraise_internal_error | def expect_and_reraise_internal_error(modID='SDK'):
"""Catch all kinds of zvm client request failure and reraise.
modID: the moduleID that the internal error happens in.
"""
try:
yield
except exception.SDKInternalError as err:
msg = err.format_message()
raise exception.SDKIn... | python | def expect_and_reraise_internal_error(modID='SDK'):
"""Catch all kinds of zvm client request failure and reraise.
modID: the moduleID that the internal error happens in.
"""
try:
yield
except exception.SDKInternalError as err:
msg = err.format_message()
raise exception.SDKIn... | [
"def",
"expect_and_reraise_internal_error",
"(",
"modID",
"=",
"'SDK'",
")",
":",
"try",
":",
"yield",
"except",
"exception",
".",
"SDKInternalError",
"as",
"err",
":",
"msg",
"=",
"err",
".",
"format_message",
"(",
")",
"raise",
"exception",
".",
"SDKInternal... | Catch all kinds of zvm client request failure and reraise.
modID: the moduleID that the internal error happens in. | [
"Catch",
"all",
"kinds",
"of",
"zvm",
"client",
"request",
"failure",
"and",
"reraise",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/utils.py#L383-L392 |
mfcloud/python-zvm-sdk | zvmsdk/utils.py | log_and_reraise_smt_request_failed | def log_and_reraise_smt_request_failed(action=None):
"""Catch SDK base exception and print error log before reraise exception.
msg: the error message to be logged.
"""
try:
yield
except exception.SDKSMTRequestFailed as err:
msg = ''
if action is not None:
msg = "... | python | def log_and_reraise_smt_request_failed(action=None):
"""Catch SDK base exception and print error log before reraise exception.
msg: the error message to be logged.
"""
try:
yield
except exception.SDKSMTRequestFailed as err:
msg = ''
if action is not None:
msg = "... | [
"def",
"log_and_reraise_smt_request_failed",
"(",
"action",
"=",
"None",
")",
":",
"try",
":",
"yield",
"except",
"exception",
".",
"SDKSMTRequestFailed",
"as",
"err",
":",
"msg",
"=",
"''",
"if",
"action",
"is",
"not",
"None",
":",
"msg",
"=",
"\"Failed to ... | Catch SDK base exception and print error log before reraise exception.
msg: the error message to be logged. | [
"Catch",
"SDK",
"base",
"exception",
"and",
"print",
"error",
"log",
"before",
"reraise",
"exception",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/utils.py#L410-L423 |
mfcloud/python-zvm-sdk | zvmsdk/utils.py | get_smt_userid | def get_smt_userid():
"""Get the userid of smt server"""
cmd = ["sudo", "/sbin/vmcp", "query userid"]
try:
userid = subprocess.check_output(cmd,
close_fds=True,
stderr=subprocess.STDOUT)
userid = bytes.decode(u... | python | def get_smt_userid():
"""Get the userid of smt server"""
cmd = ["sudo", "/sbin/vmcp", "query userid"]
try:
userid = subprocess.check_output(cmd,
close_fds=True,
stderr=subprocess.STDOUT)
userid = bytes.decode(u... | [
"def",
"get_smt_userid",
"(",
")",
":",
"cmd",
"=",
"[",
"\"sudo\"",
",",
"\"/sbin/vmcp\"",
",",
"\"query userid\"",
"]",
"try",
":",
"userid",
"=",
"subprocess",
".",
"check_output",
"(",
"cmd",
",",
"close_fds",
"=",
"True",
",",
"stderr",
"=",
"subproce... | Get the userid of smt server | [
"Get",
"the",
"userid",
"of",
"smt",
"server"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/utils.py#L437-L449 |
mfcloud/python-zvm-sdk | zvmsdk/utils.py | get_namelist | def get_namelist():
"""Generate namelist.
Either through set CONF.zvm.namelist, or by generate based on smt userid.
"""
if CONF.zvm.namelist is not None:
# namelist length limit should be 64, but there's bug limit to 8
# will change the limit to 8 once the bug fixed
if len(CONF.... | python | def get_namelist():
"""Generate namelist.
Either through set CONF.zvm.namelist, or by generate based on smt userid.
"""
if CONF.zvm.namelist is not None:
# namelist length limit should be 64, but there's bug limit to 8
# will change the limit to 8 once the bug fixed
if len(CONF.... | [
"def",
"get_namelist",
"(",
")",
":",
"if",
"CONF",
".",
"zvm",
".",
"namelist",
"is",
"not",
"None",
":",
"# namelist length limit should be 64, but there's bug limit to 8",
"# will change the limit to 8 once the bug fixed",
"if",
"len",
"(",
"CONF",
".",
"zvm",
".",
... | Generate namelist.
Either through set CONF.zvm.namelist, or by generate based on smt userid. | [
"Generate",
"namelist",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/utils.py#L452-L466 |
mfcloud/python-zvm-sdk | zvmsdk/utils.py | generate_iucv_authfile | def generate_iucv_authfile(fn, client):
"""Generate the iucv_authorized_userid file"""
lines = ['#!/bin/bash\n',
'echo -n %s > /etc/iucv_authorized_userid\n' % client]
with open(fn, 'w') as f:
f.writelines(lines) | python | def generate_iucv_authfile(fn, client):
"""Generate the iucv_authorized_userid file"""
lines = ['#!/bin/bash\n',
'echo -n %s > /etc/iucv_authorized_userid\n' % client]
with open(fn, 'w') as f:
f.writelines(lines) | [
"def",
"generate_iucv_authfile",
"(",
"fn",
",",
"client",
")",
":",
"lines",
"=",
"[",
"'#!/bin/bash\\n'",
",",
"'echo -n %s > /etc/iucv_authorized_userid\\n'",
"%",
"client",
"]",
"with",
"open",
"(",
"fn",
",",
"'w'",
")",
"as",
"f",
":",
"f",
".",
"write... | Generate the iucv_authorized_userid file | [
"Generate",
"the",
"iucv_authorized_userid",
"file"
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/utils.py#L469-L474 |
mfcloud/python-zvm-sdk | zvmsdk/utils.py | translate_response_to_dict | def translate_response_to_dict(rawdata, dirt):
"""Translate SMT response to a python dictionary.
SMT response example:
keyword1: value1\n
keyword2: value2\n
...
keywordn: valuen\n
Will return a python dictionary:
{keyword1: value1,
keyword2: value2,
...
keywordn: valuen,... | python | def translate_response_to_dict(rawdata, dirt):
"""Translate SMT response to a python dictionary.
SMT response example:
keyword1: value1\n
keyword2: value2\n
...
keywordn: valuen\n
Will return a python dictionary:
{keyword1: value1,
keyword2: value2,
...
keywordn: valuen,... | [
"def",
"translate_response_to_dict",
"(",
"rawdata",
",",
"dirt",
")",
":",
"data_list",
"=",
"rawdata",
".",
"split",
"(",
"\"\\n\"",
")",
"data",
"=",
"{",
"}",
"for",
"ls",
"in",
"data_list",
":",
"for",
"k",
"in",
"list",
"(",
"dirt",
".",
"keys",
... | Translate SMT response to a python dictionary.
SMT response example:
keyword1: value1\n
keyword2: value2\n
...
keywordn: valuen\n
Will return a python dictionary:
{keyword1: value1,
keyword2: value2,
...
keywordn: valuen,} | [
"Translate",
"SMT",
"response",
"to",
"a",
"python",
"dictionary",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/zvmsdk/utils.py#L478-L509 |
mfcloud/python-zvm-sdk | sample/simple/sample.py | delete_guest | def delete_guest(userid):
""" Destroy a virtual machine.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8
"""
# Check if the guest exists.
guest_list_info = client.send_request('guest_list')
# the string 'userid' need to be coded as 'u'userid' in case of py2 i... | python | def delete_guest(userid):
""" Destroy a virtual machine.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8
"""
# Check if the guest exists.
guest_list_info = client.send_request('guest_list')
# the string 'userid' need to be coded as 'u'userid' in case of py2 i... | [
"def",
"delete_guest",
"(",
"userid",
")",
":",
"# Check if the guest exists.",
"guest_list_info",
"=",
"client",
".",
"send_request",
"(",
"'guest_list'",
")",
"# the string 'userid' need to be coded as 'u'userid' in case of py2 interpreter.",
"userid_1",
"=",
"(",
"unicode",
... | Destroy a virtual machine.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8 | [
"Destroy",
"a",
"virtual",
"machine",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/sample/simple/sample.py#L15-L36 |
mfcloud/python-zvm-sdk | sample/simple/sample.py | describe_guest | def describe_guest(userid):
""" Get the basic information of virtual machine.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8
"""
# Check if the guest exists.
guest_list_info = client.send_request('guest_list')
userid_1 = (unicode(userid, "utf-8") if sys.version[0] =... | python | def describe_guest(userid):
""" Get the basic information of virtual machine.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8
"""
# Check if the guest exists.
guest_list_info = client.send_request('guest_list')
userid_1 = (unicode(userid, "utf-8") if sys.version[0] =... | [
"def",
"describe_guest",
"(",
"userid",
")",
":",
"# Check if the guest exists.",
"guest_list_info",
"=",
"client",
".",
"send_request",
"(",
"'guest_list'",
")",
"userid_1",
"=",
"(",
"unicode",
"(",
"userid",
",",
"\"utf-8\"",
")",
"if",
"sys",
".",
"version",... | Get the basic information of virtual machine.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8 | [
"Get",
"the",
"basic",
"information",
"of",
"virtual",
"machine",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/sample/simple/sample.py#L39-L54 |
mfcloud/python-zvm-sdk | sample/simple/sample.py | import_image | def import_image(image_path, os_version):
""" Import the specific image.
Input parameters:
:image_path: Image file name
:os_version: Operation System version. e.g. rhel7.4
"""
image_name = os.path.basename(image_path)
print("\nChecking if image %s exists ..." % image_name)
image_... | python | def import_image(image_path, os_version):
""" Import the specific image.
Input parameters:
:image_path: Image file name
:os_version: Operation System version. e.g. rhel7.4
"""
image_name = os.path.basename(image_path)
print("\nChecking if image %s exists ..." % image_name)
image_... | [
"def",
"import_image",
"(",
"image_path",
",",
"os_version",
")",
":",
"image_name",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"image_path",
")",
"print",
"(",
"\"\\nChecking if image %s exists ...\"",
"%",
"image_name",
")",
"image_query_info",
"=",
"client",... | Import the specific image.
Input parameters:
:image_path: Image file name
:os_version: Operation System version. e.g. rhel7.4 | [
"Import",
"the",
"specific",
"image",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/sample/simple/sample.py#L57-L79 |
mfcloud/python-zvm-sdk | sample/simple/sample.py | create_guest | def create_guest(userid, cpu, memory, disks_list, profile):
""" Create the userid.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8
:cpu: the number of vcpus
:memory: memory
:disks_list: list of disks to add
:profile: ... | python | def create_guest(userid, cpu, memory, disks_list, profile):
""" Create the userid.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8
:cpu: the number of vcpus
:memory: memory
:disks_list: list of disks to add
:profile: ... | [
"def",
"create_guest",
"(",
"userid",
",",
"cpu",
",",
"memory",
",",
"disks_list",
",",
"profile",
")",
":",
"# Check if the userid already exists.",
"guest_list_info",
"=",
"client",
".",
"send_request",
"(",
"'guest_list'",
")",
"userid_1",
"=",
"(",
"unicode",... | Create the userid.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8
:cpu: the number of vcpus
:memory: memory
:disks_list: list of disks to add
:profile: profile of the userid | [
"Create",
"the",
"userid",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/sample/simple/sample.py#L82-L109 |
mfcloud/python-zvm-sdk | sample/simple/sample.py | deploy_guest | def deploy_guest(userid, image_name):
""" Deploy image to root disk.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8
:image_path: Image file name
"""
print("\nDeploying %s to %s ..." % (image_name, userid))
guest_deploy_info = client.send_request('gues... | python | def deploy_guest(userid, image_name):
""" Deploy image to root disk.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8
:image_path: Image file name
"""
print("\nDeploying %s to %s ..." % (image_name, userid))
guest_deploy_info = client.send_request('gues... | [
"def",
"deploy_guest",
"(",
"userid",
",",
"image_name",
")",
":",
"print",
"(",
"\"\\nDeploying %s to %s ...\"",
"%",
"(",
"image_name",
",",
"userid",
")",
")",
"guest_deploy_info",
"=",
"client",
".",
"send_request",
"(",
"'guest_deploy'",
",",
"userid",
",",... | Deploy image to root disk.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8
:image_path: Image file name | [
"Deploy",
"image",
"to",
"root",
"disk",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/sample/simple/sample.py#L111-L130 |
mfcloud/python-zvm-sdk | sample/simple/sample.py | create_network | def create_network(userid, os_version, network_info):
""" Create network device and configure network interface.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8
:os_version: os version of the image file
:network_info: dict of network info
"""
prin... | python | def create_network(userid, os_version, network_info):
""" Create network device and configure network interface.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8
:os_version: os version of the image file
:network_info: dict of network info
"""
prin... | [
"def",
"create_network",
"(",
"userid",
",",
"os_version",
",",
"network_info",
")",
":",
"print",
"(",
"\"\\nConfiguring network interface for %s ...\"",
"%",
"userid",
")",
"network_create_info",
"=",
"client",
".",
"send_request",
"(",
"'guest_create_network_interface'... | Create network device and configure network interface.
Input parameters:
:userid: USERID of the guest, last 8 if length > 8
:os_version: os version of the image file
:network_info: dict of network info | [
"Create",
"network",
"device",
"and",
"configure",
"network",
"interface",
"."
] | train | https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/sample/simple/sample.py#L132-L148 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.