repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
hvac/hvac
hvac/v1/__init__.py
https://github.com/hvac/hvac/blob/cce5b86889193f622c2a72a4a1b7e1c9c8aff1ce/hvac/v1/__init__.py#L566-L576
def auth_tls(self, mount_point='cert', use_token=True): """POST /auth/<mount point>/login :param mount_point: :type mount_point: :param use_token: :type use_token: :return: :rtype: """ return self.login('/v1/auth/{0}/login'.format(mount_point), us...
[ "def", "auth_tls", "(", "self", ",", "mount_point", "=", "'cert'", ",", "use_token", "=", "True", ")", ":", "return", "self", ".", "login", "(", "'/v1/auth/{0}/login'", ".", "format", "(", "mount_point", ")", ",", "use_token", "=", "use_token", ")" ]
POST /auth/<mount point>/login :param mount_point: :type mount_point: :param use_token: :type use_token: :return: :rtype:
[ "POST", "/", "auth", "/", "<mount", "point", ">", "/", "login" ]
python
train
astropy/regions
regions/_utils/examples.py
https://github.com/astropy/regions/blob/452d962c417e4ff20d1268f99535c6ff89c83437/regions/_utils/examples.py#L17-L64
def make_example_dataset(data='simulated', config=None): """Make example dataset. This is a factory function for ``ExampleDataset`` objects. The following config options are available (default values shown): * ``crval = 0, 0`` * ``crpix = 180, 90`` * ``cdelt = -1, 1`` * ``shape = 180, 360...
[ "def", "make_example_dataset", "(", "data", "=", "'simulated'", ",", "config", "=", "None", ")", ":", "if", "data", "==", "'simulated'", ":", "return", "ExampleDatasetSimulated", "(", "config", "=", "config", ")", "elif", "data", "==", "'fermi'", ":", "retur...
Make example dataset. This is a factory function for ``ExampleDataset`` objects. The following config options are available (default values shown): * ``crval = 0, 0`` * ``crpix = 180, 90`` * ``cdelt = -1, 1`` * ``shape = 180, 360`` * ``ctype = 'GLON-AIT', 'GLAT-AIT'`` Parameters ...
[ "Make", "example", "dataset", "." ]
python
train
Nic30/hwt
hwt/simulator/vcdHdlSimConfig.py
https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/simulator/vcdHdlSimConfig.py#L24-L33
def vcdTypeInfoForHType(t) -> Tuple[str, int, Callable[[RtlSignalBase, Value], str]]: """ :return: (vcd type name, vcd width) """ if isinstance(t, (SimBitsT, Bits, HBool)): return (VCD_SIG_TYPE.WIRE, t.bit_length(), vcdBitsFormatter) elif isinstance(t, HEnum): return (VCD_SIG_TYPE.RE...
[ "def", "vcdTypeInfoForHType", "(", "t", ")", "->", "Tuple", "[", "str", ",", "int", ",", "Callable", "[", "[", "RtlSignalBase", ",", "Value", "]", ",", "str", "]", "]", ":", "if", "isinstance", "(", "t", ",", "(", "SimBitsT", ",", "Bits", ",", "HBo...
:return: (vcd type name, vcd width)
[ ":", "return", ":", "(", "vcd", "type", "name", "vcd", "width", ")" ]
python
test
danimaribeiro/PyTrustNFe
pytrustnfe/xml/filters.py
https://github.com/danimaribeiro/PyTrustNFe/blob/710490dc1d35a78c0ebd22d4fa69ee36ea318745/pytrustnfe/xml/filters.py#L54-L61
def format_date(value): """ Format date """ dt_format = '%Y-%m-%d' if isinstance(value, date): return value.strftime(dt_format) return value
[ "def", "format_date", "(", "value", ")", ":", "dt_format", "=", "'%Y-%m-%d'", "if", "isinstance", "(", "value", ",", "date", ")", ":", "return", "value", ".", "strftime", "(", "dt_format", ")", "return", "value" ]
Format date
[ "Format", "date" ]
python
train
sorgerlab/indra
indra/sources/bel/api.py
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/bel/api.py#L167-L187
def process_pybel_graph(graph): """Return a PybelProcessor by processing a PyBEL graph. Parameters ---------- graph : pybel.struct.BELGraph A PyBEL graph to process Returns ------- bp : PybelProcessor A PybelProcessor object which contains INDRA Statements in bp.sta...
[ "def", "process_pybel_graph", "(", "graph", ")", ":", "bp", "=", "PybelProcessor", "(", "graph", ")", "bp", ".", "get_statements", "(", ")", "if", "bp", ".", "annot_manager", ".", "failures", ":", "logger", ".", "warning", "(", "'missing %d annotation pairs'",...
Return a PybelProcessor by processing a PyBEL graph. Parameters ---------- graph : pybel.struct.BELGraph A PyBEL graph to process Returns ------- bp : PybelProcessor A PybelProcessor object which contains INDRA Statements in bp.statements.
[ "Return", "a", "PybelProcessor", "by", "processing", "a", "PyBEL", "graph", "." ]
python
train
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L11357-L11367
def file_transfer_protocol_encode(self, target_network, target_system, target_component, payload): ''' File transfer message target_network : Network ID (0 for broadcast) (uint8_t) target_system : System ID (0 for broadcast) (uint8_...
[ "def", "file_transfer_protocol_encode", "(", "self", ",", "target_network", ",", "target_system", ",", "target_component", ",", "payload", ")", ":", "return", "MAVLink_file_transfer_protocol_message", "(", "target_network", ",", "target_system", ",", "target_component", "...
File transfer message target_network : Network ID (0 for broadcast) (uint8_t) target_system : System ID (0 for broadcast) (uint8_t) target_component : Component ID (0 for broadcast) (uint8_t) payload : Var...
[ "File", "transfer", "message" ]
python
train
trevisanj/f311
f311/filetypes/filespectrum.py
https://github.com/trevisanj/f311/blob/9e502a3d1e1f74d4290a8a0bae9a34ef8d7b29f7/f311/filetypes/filespectrum.py#L74-L83
def _do_save_as(self, filename): """Saves spectrum back to FITS file.""" if len(self.spectrum.x) < 2: raise RuntimeError("Spectrum must have at least two points") if os.path.isfile(filename): os.unlink(filename) # PyFITS does not overwrite file hdu = self.spect...
[ "def", "_do_save_as", "(", "self", ",", "filename", ")", ":", "if", "len", "(", "self", ".", "spectrum", ".", "x", ")", "<", "2", ":", "raise", "RuntimeError", "(", "\"Spectrum must have at least two points\"", ")", "if", "os", ".", "path", ".", "isfile", ...
Saves spectrum back to FITS file.
[ "Saves", "spectrum", "back", "to", "FITS", "file", "." ]
python
train
hydroshare/hs_restclient
hs_restclient/__init__.py
https://github.com/hydroshare/hs_restclient/blob/9cd106238b512e01ecd3e33425fe48c13b7f63d5/hs_restclient/__init__.py#L775-L795
def deleteResource(self, pid): """ Delete a resource. :param pid: The HydroShare ID of the resource """ url = "{url_base}/resource/{pid}/".format(url_base=self.url_base, pid=pid) r = self._request('DELETE', url) ...
[ "def", "deleteResource", "(", "self", ",", "pid", ")", ":", "url", "=", "\"{url_base}/resource/{pid}/\"", ".", "format", "(", "url_base", "=", "self", ".", "url_base", ",", "pid", "=", "pid", ")", "r", "=", "self", ".", "_request", "(", "'DELETE'", ",", ...
Delete a resource. :param pid: The HydroShare ID of the resource
[ "Delete", "a", "resource", "." ]
python
train
zimeon/iiif
iiif/manipulator_netpbm.py
https://github.com/zimeon/iiif/blob/9d10018d01202fa2a76dfa61598dc6eca07b471f/iiif/manipulator_netpbm.py#L263-L280
def image_size(self, pnmfile): """Get width and height of pnm file. simeon@homebox src>pnmfile /tmp/214-2.png /tmp/214-2.png:PPM raw, 100 by 100 maxval 255 """ pout = os.popen(self.shellsetup + self.pnmfile + ' ' + pnmfile, 'r') pnmfileout = pout.read(200) pout....
[ "def", "image_size", "(", "self", ",", "pnmfile", ")", ":", "pout", "=", "os", ".", "popen", "(", "self", ".", "shellsetup", "+", "self", ".", "pnmfile", "+", "' '", "+", "pnmfile", ",", "'r'", ")", "pnmfileout", "=", "pout", ".", "read", "(", "200...
Get width and height of pnm file. simeon@homebox src>pnmfile /tmp/214-2.png /tmp/214-2.png:PPM raw, 100 by 100 maxval 255
[ "Get", "width", "and", "height", "of", "pnm", "file", "." ]
python
train
spyder-ide/spyder
spyder/py3compat.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/py3compat.py#L150-L160
def to_binary_string(obj, encoding=None): """Convert `obj` to binary string (bytes in Python 3, str in Python 2)""" if PY2: # Python 2 if encoding is None: return str(obj) else: return obj.encode(encoding) else: # Python 3 return byte...
[ "def", "to_binary_string", "(", "obj", ",", "encoding", "=", "None", ")", ":", "if", "PY2", ":", "# Python 2\r", "if", "encoding", "is", "None", ":", "return", "str", "(", "obj", ")", "else", ":", "return", "obj", ".", "encode", "(", "encoding", ")", ...
Convert `obj` to binary string (bytes in Python 3, str in Python 2)
[ "Convert", "obj", "to", "binary", "string", "(", "bytes", "in", "Python", "3", "str", "in", "Python", "2", ")" ]
python
train
econ-ark/HARK
HARK/cAndCwithStickyE/StickyEmodel.py
https://github.com/econ-ark/HARK/blob/3d184153a189e618a87c9540df1cd12044039cc5/HARK/cAndCwithStickyE/StickyEmodel.py#L134-L163
def getStates(self): ''' Gets simulated consumers pLvl and mNrm for this period, but with the alteration that these represent perceived rather than actual values. Also calculates mLvlTrue, the true level of market resources that the individual has on hand. Parameters --...
[ "def", "getStates", "(", "self", ")", ":", "# Update consumers' perception of their permanent income level", "pLvlPrev", "=", "self", ".", "pLvlNow", "self", ".", "pLvlNow", "=", "pLvlPrev", "*", "self", ".", "PermShkNow", "# Perceived permanent income level (only correct i...
Gets simulated consumers pLvl and mNrm for this period, but with the alteration that these represent perceived rather than actual values. Also calculates mLvlTrue, the true level of market resources that the individual has on hand. Parameters ---------- None Returns ...
[ "Gets", "simulated", "consumers", "pLvl", "and", "mNrm", "for", "this", "period", "but", "with", "the", "alteration", "that", "these", "represent", "perceived", "rather", "than", "actual", "values", ".", "Also", "calculates", "mLvlTrue", "the", "true", "level", ...
python
train
dourvaris/nano-python
src/nano/rpc.py
https://github.com/dourvaris/nano-python/blob/f26b8bc895b997067780f925049a70e82c0c2479/src/nano/rpc.py#L1971-L2008
def unchecked(self, count=None): """ Returns a list of pairs of unchecked synchronizing block hash and its json representation up to **count** .. version 8.0 required :param count: Max amount of unchecked blocks to return :type count: int :raises: :py:exc:`nano...
[ "def", "unchecked", "(", "self", ",", "count", "=", "None", ")", ":", "payload", "=", "{", "}", "if", "count", "is", "not", "None", ":", "payload", "[", "\"count\"", "]", "=", "self", ".", "_process_value", "(", "count", ",", "'int'", ")", "resp", ...
Returns a list of pairs of unchecked synchronizing block hash and its json representation up to **count** .. version 8.0 required :param count: Max amount of unchecked blocks to return :type count: int :raises: :py:exc:`nano.rpc.RPCException` >>> rpc.unchecked(count=1...
[ "Returns", "a", "list", "of", "pairs", "of", "unchecked", "synchronizing", "block", "hash", "and", "its", "json", "representation", "up", "to", "**", "count", "**" ]
python
train
rix0rrr/gcl
gcl/ast.py
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast.py#L528-L540
def mkApplications(location, *atoms): """Make a sequence of applications from a list of tokens. atoms is a list of atoms, which will be handled left-associatively. E.g: ['foo', [], []] == foo()() ==> Application(Application('foo', []), []) """ atoms = list(atoms) while len(atoms) > 1: atoms[0:2] =...
[ "def", "mkApplications", "(", "location", ",", "*", "atoms", ")", ":", "atoms", "=", "list", "(", "atoms", ")", "while", "len", "(", "atoms", ")", ">", "1", ":", "atoms", "[", "0", ":", "2", "]", "=", "[", "Application", "(", "location", ",", "at...
Make a sequence of applications from a list of tokens. atoms is a list of atoms, which will be handled left-associatively. E.g: ['foo', [], []] == foo()() ==> Application(Application('foo', []), [])
[ "Make", "a", "sequence", "of", "applications", "from", "a", "list", "of", "tokens", "." ]
python
train
google/grumpy
third_party/stdlib/string.py
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/string.py#L497-L513
def translate(s, table, deletions=""): """translate(s,table [,deletions]) -> string Return a copy of the string s, where all characters occurring in the optional argument deletions are removed, and the remaining characters have been mapped through the given translation table, which must be a string...
[ "def", "translate", "(", "s", ",", "table", ",", "deletions", "=", "\"\"", ")", ":", "if", "deletions", "or", "table", "is", "None", ":", "return", "s", ".", "translate", "(", "table", ",", "deletions", ")", "else", ":", "# Add s[:0] so that if s is Unicod...
translate(s,table [,deletions]) -> string Return a copy of the string s, where all characters occurring in the optional argument deletions are removed, and the remaining characters have been mapped through the given translation table, which must be a string of length 256. The deletions argument is...
[ "translate", "(", "s", "table", "[", "deletions", "]", ")", "-", ">", "string" ]
python
valid
CalebBell/thermo
thermo/unifac.py
https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/unifac.py#L1026-L1101
def UNIFAC_psi(T, subgroup1, subgroup2, subgroup_data, interaction_data, modified=False): r'''Calculates the interaction parameter psi(m, n) for two UNIFAC subgroups, given the system temperature, the UNIFAC subgroups considered for the variant of UNIFAC used, the interaction parameters fo...
[ "def", "UNIFAC_psi", "(", "T", ",", "subgroup1", ",", "subgroup2", ",", "subgroup_data", ",", "interaction_data", ",", "modified", "=", "False", ")", ":", "main1", "=", "subgroup_data", "[", "subgroup1", "]", ".", "main_group_id", "main2", "=", "subgroup_data"...
r'''Calculates the interaction parameter psi(m, n) for two UNIFAC subgroups, given the system temperature, the UNIFAC subgroups considered for the variant of UNIFAC used, the interaction parameters for the variant of UNIFAC used, and whether or not the temperature dependence is modified from the ori...
[ "r", "Calculates", "the", "interaction", "parameter", "psi", "(", "m", "n", ")", "for", "two", "UNIFAC", "subgroups", "given", "the", "system", "temperature", "the", "UNIFAC", "subgroups", "considered", "for", "the", "variant", "of", "UNIFAC", "used", "the", ...
python
valid
iotile/coretools
iotileship/iotile/ship/actions/verify_device_step.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileship/iotile/ship/actions/verify_device_step.py#L33-L40
def _verify_tile_versions(self, hw): """Verify that the tiles have the correct versions """ for tile, expected_tile_version in self._tile_versions.items(): actual_tile_version = str(hw.get(tile).tile_version()) if expected_tile_version != actual_tile_version: ...
[ "def", "_verify_tile_versions", "(", "self", ",", "hw", ")", ":", "for", "tile", ",", "expected_tile_version", "in", "self", ".", "_tile_versions", ".", "items", "(", ")", ":", "actual_tile_version", "=", "str", "(", "hw", ".", "get", "(", "tile", ")", "...
Verify that the tiles have the correct versions
[ "Verify", "that", "the", "tiles", "have", "the", "correct", "versions" ]
python
train
ethereum/py-evm
eth/db/diff.py
https://github.com/ethereum/py-evm/blob/58346848f076116381d3274bbcea96b9e2cfcbdf/eth/db/diff.py#L160-L166
def deleted_keys(self) -> Iterable[bytes]: """ List all the keys that have been deleted. """ for key, value in self._changes.items(): if value is DELETED: yield key
[ "def", "deleted_keys", "(", "self", ")", "->", "Iterable", "[", "bytes", "]", ":", "for", "key", ",", "value", "in", "self", ".", "_changes", ".", "items", "(", ")", ":", "if", "value", "is", "DELETED", ":", "yield", "key" ]
List all the keys that have been deleted.
[ "List", "all", "the", "keys", "that", "have", "been", "deleted", "." ]
python
train
spyder-ide/spyder
spyder/plugins/plots/plugin.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/plugin.py#L53-L63
def set_current_widget(self, fig_browser): """ Set the currently visible fig_browser in the stack widget, refresh the actions of the cog menu button and move it to the layout of the new fig_browser. """ self.stack.setCurrentWidget(fig_browser) # We update the acti...
[ "def", "set_current_widget", "(", "self", ",", "fig_browser", ")", ":", "self", ".", "stack", ".", "setCurrentWidget", "(", "fig_browser", ")", "# We update the actions of the options button (cog menu) and", "# we move it to the layout of the current widget.", "self", ".", "r...
Set the currently visible fig_browser in the stack widget, refresh the actions of the cog menu button and move it to the layout of the new fig_browser.
[ "Set", "the", "currently", "visible", "fig_browser", "in", "the", "stack", "widget", "refresh", "the", "actions", "of", "the", "cog", "menu", "button", "and", "move", "it", "to", "the", "layout", "of", "the", "new", "fig_browser", "." ]
python
train
johntruckenbrodt/spatialist
spatialist/raster.py
https://github.com/johntruckenbrodt/spatialist/blob/007f49296a156de8d7168ad235b5a5b8e8d3633d/spatialist/raster.py#L590-L607
def is_valid(self): """ Check image integrity. Tries to compute the checksum for each raster layer and returns False if this fails. See this forum entry: `How to check if image is valid? <https://lists.osgeo.org/pipermail/gdal-dev/2013-November/037520.html>`_. Returns ...
[ "def", "is_valid", "(", "self", ")", ":", "for", "i", "in", "range", "(", "self", ".", "raster", ".", "RasterCount", ")", ":", "try", ":", "checksum", "=", "self", ".", "raster", ".", "GetRasterBand", "(", "i", "+", "1", ")", ".", "Checksum", "(", ...
Check image integrity. Tries to compute the checksum for each raster layer and returns False if this fails. See this forum entry: `How to check if image is valid? <https://lists.osgeo.org/pipermail/gdal-dev/2013-November/037520.html>`_. Returns ------- bool i...
[ "Check", "image", "integrity", ".", "Tries", "to", "compute", "the", "checksum", "for", "each", "raster", "layer", "and", "returns", "False", "if", "this", "fails", ".", "See", "this", "forum", "entry", ":", "How", "to", "check", "if", "image", "is", "va...
python
train
EelcoHoogendoorn/Numpy_arraysetops_EP
numpy_indexed/arraysetops.py
https://github.com/EelcoHoogendoorn/Numpy_arraysetops_EP/blob/84dc8114bf8a79c3acb3f7f59128247b9fc97243/numpy_indexed/arraysetops.py#L86-L112
def in_(this, that, axis=semantics.axis_default): """Returns bool for each element of `this`, indicating if it is present in `that` Parameters ---------- this : indexable key sequence sequence of items to test for that : indexable key sequence sequence of items to test against ...
[ "def", "in_", "(", "this", ",", "that", ",", "axis", "=", "semantics", ".", "axis_default", ")", ":", "this", "=", "as_index", "(", "this", ",", "axis", "=", "axis", ",", "lex_as_struct", "=", "True", ",", "base", "=", "True", ")", "that", "=", "as...
Returns bool for each element of `this`, indicating if it is present in `that` Parameters ---------- this : indexable key sequence sequence of items to test for that : indexable key sequence sequence of items to test against Returns ------- ndarray, [that.size], bool ...
[ "Returns", "bool", "for", "each", "element", "of", "this", "indicating", "if", "it", "is", "present", "in", "that" ]
python
train
econ-ark/HARK
HARK/ConsumptionSaving/ConsAggShockModel.py
https://github.com/econ-ark/HARK/blob/3d184153a189e618a87c9540df1cd12044039cc5/HARK/ConsumptionSaving/ConsAggShockModel.py#L91-L105
def reset(self): ''' Initialize this type for a new simulated history of K/L ratio. Parameters ---------- None Returns ------- None ''' self.initializeSim() self.aLvlNow = self.kInit*np.ones(self.AgentCount) # Start simulation nea...
[ "def", "reset", "(", "self", ")", ":", "self", ".", "initializeSim", "(", ")", "self", ".", "aLvlNow", "=", "self", ".", "kInit", "*", "np", ".", "ones", "(", "self", ".", "AgentCount", ")", "# Start simulation near SS", "self", ".", "aNrmNow", "=", "s...
Initialize this type for a new simulated history of K/L ratio. Parameters ---------- None Returns ------- None
[ "Initialize", "this", "type", "for", "a", "new", "simulated", "history", "of", "K", "/", "L", "ratio", "." ]
python
train
Xion/taipan
taipan/collections/dicts.py
https://github.com/Xion/taipan/blob/f333f0287c8bd0915182c7d5308e5f05ef0cca78/taipan/collections/dicts.py#L294-L317
def starmapitems(function, dict_): """Return a new dictionary where the keys and values come from applying ``function`` to the keys and values of given dictionary. .. warning:: If ``function`` returns a key-value pair with the same key more than once, it is undefined which value will be ch...
[ "def", "starmapitems", "(", "function", ",", "dict_", ")", ":", "ensure_mapping", "(", "dict_", ")", "if", "function", "is", "None", ":", "function", "=", "lambda", "k", ",", "v", ":", "(", "k", ",", "v", ")", "else", ":", "ensure_callable", "(", "fu...
Return a new dictionary where the keys and values come from applying ``function`` to the keys and values of given dictionary. .. warning:: If ``function`` returns a key-value pair with the same key more than once, it is undefined which value will be chosen for that key in the resulting...
[ "Return", "a", "new", "dictionary", "where", "the", "keys", "and", "values", "come", "from", "applying", "function", "to", "the", "keys", "and", "values", "of", "given", "dictionary", "." ]
python
train
SiLab-Bonn/pyBAR
pybar/analysis/plotting/plotting.py
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/plotting/plotting.py#L352-L374
def round_to_multiple(number, multiple): '''Rounding up to the nearest multiple of any positive integer Parameters ---------- number : int, float Input number. multiple : int Round up to multiple of multiple. Will be converted to int. Must not be equal zero. Returns ...
[ "def", "round_to_multiple", "(", "number", ",", "multiple", ")", ":", "multiple", "=", "int", "(", "multiple", ")", "if", "multiple", "==", "0", ":", "multiple", "=", "1", "ceil_mod_number", "=", "number", "-", "number", "%", "(", "-", "multiple", ")", ...
Rounding up to the nearest multiple of any positive integer Parameters ---------- number : int, float Input number. multiple : int Round up to multiple of multiple. Will be converted to int. Must not be equal zero. Returns ------- ceil_mod_number : int Rou...
[ "Rounding", "up", "to", "the", "nearest", "multiple", "of", "any", "positive", "integer", "Parameters", "----------", "number", ":", "int", "float", "Input", "number", ".", "multiple", ":", "int", "Round", "up", "to", "multiple", "of", "multiple", ".", "Will...
python
train
apache/incubator-mxnet
example/gluon/lipnet/infer.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/example/gluon/lipnet/infer.py#L26-L48
def main(): """ Description : run lipnet training code using argument info """ parser = argparse.ArgumentParser() parser.add_argument('--batch_size', type=int, default=64) parser.add_argument('--image_path', type=str, default='./data/datasets/') parser.add_argument('--align_path', type=str, ...
[ "def", "main", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "'--batch_size'", ",", "type", "=", "int", ",", "default", "=", "64", ")", "parser", ".", "add_argument", "(", "'--image_path'", ...
Description : run lipnet training code using argument info
[ "Description", ":", "run", "lipnet", "training", "code", "using", "argument", "info" ]
python
train
dancsalo/TensorBase
tensorbase/layers.py
https://github.com/dancsalo/TensorBase/blob/3d42a326452bd03427034916ff2fb90730020204/tensorbase/layers.py#L86-L156
def deconv2d(self, filter_size, output_channels, stride=1, padding='SAME', stoch=False, ladder=None, activation_fn=tf.nn.relu, b_value=0.0, s_value=1.0, bn=True): """ 2D Deconvolutional Layer :param filter_size: int. assumes square filter :param output_channels: int ...
[ "def", "deconv2d", "(", "self", ",", "filter_size", ",", "output_channels", ",", "stride", "=", "1", ",", "padding", "=", "'SAME'", ",", "stoch", "=", "False", ",", "ladder", "=", "None", ",", "activation_fn", "=", "tf", ".", "nn", ".", "relu", ",", ...
2D Deconvolutional Layer :param filter_size: int. assumes square filter :param output_channels: int :param stride: int :param padding: 'VALID' or 'SAME' :param activation_fn: tf.nn function :param b_value: float :param s_value: float
[ "2D", "Deconvolutional", "Layer", ":", "param", "filter_size", ":", "int", ".", "assumes", "square", "filter", ":", "param", "output_channels", ":", "int", ":", "param", "stride", ":", "int", ":", "param", "padding", ":", "VALID", "or", "SAME", ":", "param...
python
train
python-rope/rope
rope/refactor/restructure.py
https://github.com/python-rope/rope/blob/1c9f9cd5964b099a99a9111e998f0dc728860688/rope/refactor/restructure.py#L177-L190
def make_checks(self, string_checks): """Convert str to str dicts to str to PyObject dicts This function is here to ease writing a UI. """ checks = {} for key, value in string_checks.items(): is_pyname = not key.endswith('.object') and \ not key.ends...
[ "def", "make_checks", "(", "self", ",", "string_checks", ")", ":", "checks", "=", "{", "}", "for", "key", ",", "value", "in", "string_checks", ".", "items", "(", ")", ":", "is_pyname", "=", "not", "key", ".", "endswith", "(", "'.object'", ")", "and", ...
Convert str to str dicts to str to PyObject dicts This function is here to ease writing a UI.
[ "Convert", "str", "to", "str", "dicts", "to", "str", "to", "PyObject", "dicts" ]
python
train
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L1180-L1225
def copy(self): """Copy text to clipboard""" clipboard = QApplication.clipboard() clipl = [] for idx in self.selectedIndexes(): if not idx.isValid(): continue obj = self.delegate.get_value(idx) # Check if we are trying to copy a...
[ "def", "copy", "(", "self", ")", ":", "clipboard", "=", "QApplication", ".", "clipboard", "(", ")", "clipl", "=", "[", "]", "for", "idx", "in", "self", ".", "selectedIndexes", "(", ")", ":", "if", "not", "idx", ".", "isValid", "(", ")", ":", "conti...
Copy text to clipboard
[ "Copy", "text", "to", "clipboard" ]
python
train
avihad/twistes
twistes/client.py
https://github.com/avihad/twistes/blob/9ab8f5aa088b8886aefe3dec85a400e5035e034a/twistes/client.py#L286-L330
def explain(self, index, doc_type, id, body=None, **query_params): """ The explain api computes a score explanation for a query and a specific document. This can give useful feedback whether a document matches or didn't match a specific query. `<http://www.elastic.co/guide/en/ela...
[ "def", "explain", "(", "self", ",", "index", ",", "doc_type", ",", "id", ",", "body", "=", "None", ",", "*", "*", "query_params", ")", ":", "self", ".", "_es_parser", ".", "is_not_empty_params", "(", "index", ",", "doc_type", ",", "id", ")", "path", ...
The explain api computes a score explanation for a query and a specific document. This can give useful feedback whether a document matches or didn't match a specific query. `<http://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html>`_ :param index: The name of t...
[ "The", "explain", "api", "computes", "a", "score", "explanation", "for", "a", "query", "and", "a", "specific", "document", ".", "This", "can", "give", "useful", "feedback", "whether", "a", "document", "matches", "or", "didn", "t", "match", "a", "specific", ...
python
train
PyThaiNLP/pythainlp
pythainlp/corpus/tnc.py
https://github.com/PyThaiNLP/pythainlp/blob/e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca/pythainlp/corpus/tnc.py#L19-L58
def word_freq(word: str, domain: str = "all") -> int: """ **Not officially supported.** Get word frequency of a word by domain. This function will make a query to the server of Thai National Corpus. Internet connection is required. **IMPORTANT:** Currently (as of 29 April 2019) always return 0,...
[ "def", "word_freq", "(", "word", ":", "str", ",", "domain", ":", "str", "=", "\"all\"", ")", "->", "int", ":", "listdomain", "=", "{", "\"all\"", ":", "\"\"", ",", "\"imaginative\"", ":", "\"1\"", ",", "\"natural-pure-science\"", ":", "\"2\"", ",", "\"ap...
**Not officially supported.** Get word frequency of a word by domain. This function will make a query to the server of Thai National Corpus. Internet connection is required. **IMPORTANT:** Currently (as of 29 April 2019) always return 0, as the service URL has been changed and the code is not updat...
[ "**", "Not", "officially", "supported", ".", "**", "Get", "word", "frequency", "of", "a", "word", "by", "domain", ".", "This", "function", "will", "make", "a", "query", "to", "the", "server", "of", "Thai", "National", "Corpus", ".", "Internet", "connection...
python
train
KelSolaar/Foundations
foundations/nodes.py
https://github.com/KelSolaar/Foundations/blob/5c141330faf09dad70a12bc321f4c564917d0a91/foundations/nodes.py#L931-L946
def find_family(self, pattern=r".*", flags=0, node=None): """ Returns the Nodes from given family. :param pattern: Matching pattern. :type pattern: unicode :param flags: Matching regex flags. :type flags: int :param node: Node to start walking from. :type...
[ "def", "find_family", "(", "self", ",", "pattern", "=", "r\".*\"", ",", "flags", "=", "0", ",", "node", "=", "None", ")", ":", "return", "[", "node", "for", "node", "in", "foundations", ".", "walkers", ".", "nodes_walker", "(", "node", "or", "self", ...
Returns the Nodes from given family. :param pattern: Matching pattern. :type pattern: unicode :param flags: Matching regex flags. :type flags: int :param node: Node to start walking from. :type node: AbstractNode or AbstractCompositeNode or Object :return: Family...
[ "Returns", "the", "Nodes", "from", "given", "family", "." ]
python
train
IdentityPython/pysaml2
src/saml2/pack.py
https://github.com/IdentityPython/pysaml2/blob/d3aa78eeb7d37c12688f783cb4db1c7263a14ad6/src/saml2/pack.py#L135-L189
def http_redirect_message(message, location, relay_state="", typ="SAMLRequest", sigalg='', signer=None, **kwargs): """The HTTP Redirect binding defines a mechanism by which SAML protocol messages can be transmitted within URL parameters. Messages are encoded for use with this bindi...
[ "def", "http_redirect_message", "(", "message", ",", "location", ",", "relay_state", "=", "\"\"", ",", "typ", "=", "\"SAMLRequest\"", ",", "sigalg", "=", "''", ",", "signer", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "isinstance", "(",...
The HTTP Redirect binding defines a mechanism by which SAML protocol messages can be transmitted within URL parameters. Messages are encoded for use with this binding using a URL encoding technique, and transmitted using the HTTP GET method. The DEFLATE Encoding is used in this function. :param me...
[ "The", "HTTP", "Redirect", "binding", "defines", "a", "mechanism", "by", "which", "SAML", "protocol", "messages", "can", "be", "transmitted", "within", "URL", "parameters", ".", "Messages", "are", "encoded", "for", "use", "with", "this", "binding", "using", "a...
python
train
wavefrontHQ/python-client
wavefront_api_client/models/alert.py
https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/models/alert.py#L1378-L1394
def severity_list(self, severity_list): """Sets the severity_list of this Alert. Alert severity list for multi-threshold type. # noqa: E501 :param severity_list: The severity_list of this Alert. # noqa: E501 :type: list[str] """ allowed_values = ["INFO", "SMOKE", "WAR...
[ "def", "severity_list", "(", "self", ",", "severity_list", ")", ":", "allowed_values", "=", "[", "\"INFO\"", ",", "\"SMOKE\"", ",", "\"WARN\"", ",", "\"SEVERE\"", "]", "# noqa: E501", "if", "not", "set", "(", "severity_list", ")", ".", "issubset", "(", "set"...
Sets the severity_list of this Alert. Alert severity list for multi-threshold type. # noqa: E501 :param severity_list: The severity_list of this Alert. # noqa: E501 :type: list[str]
[ "Sets", "the", "severity_list", "of", "this", "Alert", "." ]
python
train
saltstack/salt
salt/modules/boto_cloudtrail.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_cloudtrail.py#L469-L499
def list_tags(Name, region=None, key=None, keyid=None, profile=None): ''' List tags of a trail Returns: tags: - {...} - {...} CLI Example: .. code-block:: bash salt myminion boto_cloudtrail.list_tags my_trail ''' try: conn = _get_c...
[ "def", "list_tags", "(", "Name", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "try", ":", "conn", "=", "_get_conn", "(", "region", "=", "region", ",", "key", "=", "key", ",...
List tags of a trail Returns: tags: - {...} - {...} CLI Example: .. code-block:: bash salt myminion boto_cloudtrail.list_tags my_trail
[ "List", "tags", "of", "a", "trail" ]
python
train
nerdvegas/rez
src/rez/vendor/sortedcontainers/sortedset.py
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/sortedcontainers/sortedset.py#L199-L205
def remove(self, value): """ Remove first occurrence of *value*. Raises ValueError if *value* is not present. """ self._set.remove(value) self._list.remove(value)
[ "def", "remove", "(", "self", ",", "value", ")", ":", "self", ".", "_set", ".", "remove", "(", "value", ")", "self", ".", "_list", ".", "remove", "(", "value", ")" ]
Remove first occurrence of *value*. Raises ValueError if *value* is not present.
[ "Remove", "first", "occurrence", "of", "*", "value", "*", ".", "Raises", "ValueError", "if", "*", "value", "*", "is", "not", "present", "." ]
python
train
redhat-cip/dci-control-server
dci/api/v1/analytics.py
https://github.com/redhat-cip/dci-control-server/blob/b416cf935ec93e4fdd5741f61a21cabecf8454d2/dci/api/v1/analytics.py#L53-L70
def get_all_analytics(user, job_id): """Get all analytics of a job.""" args = schemas.args(flask.request.args.to_dict()) v1_utils.verify_existence_and_get(job_id, models.JOBS) query = v1_utils.QueryBuilder(_TABLE, args, _A_COLUMNS) # If not admin nor rh employee then restrict the view to the team ...
[ "def", "get_all_analytics", "(", "user", ",", "job_id", ")", ":", "args", "=", "schemas", ".", "args", "(", "flask", ".", "request", ".", "args", ".", "to_dict", "(", ")", ")", "v1_utils", ".", "verify_existence_and_get", "(", "job_id", ",", "models", "....
Get all analytics of a job.
[ "Get", "all", "analytics", "of", "a", "job", "." ]
python
train
glyphobet/fragments
fragments/commands.py
https://github.com/glyphobet/fragments/blob/b58473604e2db47b98703260b8ee8605264247e3/fragments/commands.py#L307-L375
def fork(*args): """ Create a new file in TARGET_FILENAME based on one or more SOURCE_FILENAME(s). Large common sections are preserved; differing sections, and common sections shorter than NUM lines between differing sections, are replaced with one newline for each line or conflict. """ parser =...
[ "def", "fork", "(", "*", "args", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "\"%s %s\"", "%", "(", "__package__", ",", "fork", ".", "__name__", ")", ",", "description", "=", "fork", ".", "__doc__", ")", "parser", ".",...
Create a new file in TARGET_FILENAME based on one or more SOURCE_FILENAME(s). Large common sections are preserved; differing sections, and common sections shorter than NUM lines between differing sections, are replaced with one newline for each line or conflict.
[ "Create", "a", "new", "file", "in", "TARGET_FILENAME", "based", "on", "one", "or", "more", "SOURCE_FILENAME", "(", "s", ")", ".", "Large", "common", "sections", "are", "preserved", ";", "differing", "sections", "and", "common", "sections", "shorter", "than", ...
python
train
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/reftrackitemdata.py
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/reftrackitemdata.py#L98-L112
def reftrack_rtype_data(rt, role): """Return the data for the releasetype that is loaded by the reftrack :param rt: the :class:`jukeboxcore.reftrack.Reftrack` holds the data :type rt: :class:`jukeboxcore.reftrack.Reftrack` :param role: item data role :type role: QtCore.Qt.ItemDataRole :returns:...
[ "def", "reftrack_rtype_data", "(", "rt", ",", "role", ")", ":", "tfi", "=", "rt", ".", "get_taskfileinfo", "(", ")", "if", "not", "tfi", ":", "return", "return", "filesysitemdata", ".", "taskfileinfo_rtype_data", "(", "tfi", ",", "role", ")" ]
Return the data for the releasetype that is loaded by the reftrack :param rt: the :class:`jukeboxcore.reftrack.Reftrack` holds the data :type rt: :class:`jukeboxcore.reftrack.Reftrack` :param role: item data role :type role: QtCore.Qt.ItemDataRole :returns: data for the releasetype :rtype: depe...
[ "Return", "the", "data", "for", "the", "releasetype", "that", "is", "loaded", "by", "the", "reftrack" ]
python
train
google/apitools
apitools/base/py/buffered_stream.py
https://github.com/google/apitools/blob/f3745a7ea535aa0e88b0650c16479b696d6fd446/apitools/base/py/buffered_stream.py#L58-L74
def read(self, size=None): # pylint: disable=invalid-name """Reads from the buffer.""" if size is None or size < 0: raise exceptions.NotYetImplementedError( 'Illegal read of size %s requested on BufferedStream. ' 'Wrapped stream %s is at position %s-%s, ' ...
[ "def", "read", "(", "self", ",", "size", "=", "None", ")", ":", "# pylint: disable=invalid-name", "if", "size", "is", "None", "or", "size", "<", "0", ":", "raise", "exceptions", ".", "NotYetImplementedError", "(", "'Illegal read of size %s requested on BufferedStrea...
Reads from the buffer.
[ "Reads", "from", "the", "buffer", "." ]
python
train
rigetti/pyquil
pyquil/noise.py
https://github.com/rigetti/pyquil/blob/ec98e453084b0037d69d8c3245f6822a5422593d/pyquil/noise.py#L292-L301
def tensor_kraus_maps(k1, k2): """ Generate the Kraus map corresponding to the composition of two maps on different qubits. :param list k1: The Kraus operators for the first qubit. :param list k2: The Kraus operators for the second qubit. :return: A list of tensored Kraus operators. """ ...
[ "def", "tensor_kraus_maps", "(", "k1", ",", "k2", ")", ":", "return", "[", "np", ".", "kron", "(", "k1j", ",", "k2l", ")", "for", "k1j", "in", "k1", "for", "k2l", "in", "k2", "]" ]
Generate the Kraus map corresponding to the composition of two maps on different qubits. :param list k1: The Kraus operators for the first qubit. :param list k2: The Kraus operators for the second qubit. :return: A list of tensored Kraus operators.
[ "Generate", "the", "Kraus", "map", "corresponding", "to", "the", "composition", "of", "two", "maps", "on", "different", "qubits", "." ]
python
train
sdispater/eloquent
eloquent/orm/relations/has_one_or_many.py
https://github.com/sdispater/eloquent/blob/0638b688d5fd0c1a46b7471dd465eeb4c2f84666/eloquent/orm/relations/has_one_or_many.py#L42-L57
def match_one(self, models, results, relation): """ Match the eargerly loaded resuls to their single parents. :param models: The parents :type models: list :param results: The results collection :type results: Collection :param relation: The relation :t...
[ "def", "match_one", "(", "self", ",", "models", ",", "results", ",", "relation", ")", ":", "return", "self", ".", "_match_one_or_many", "(", "models", ",", "results", ",", "relation", ",", "'one'", ")" ]
Match the eargerly loaded resuls to their single parents. :param models: The parents :type models: list :param results: The results collection :type results: Collection :param relation: The relation :type relation: str :rtype: list
[ "Match", "the", "eargerly", "loaded", "resuls", "to", "their", "single", "parents", "." ]
python
train
saltstack/salt
salt/utils/docker/translate/container.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/docker/translate/container.py#L360-L514
def port_bindings(val, **kwargs): ''' On the CLI, these are passed as multiple instances of a given CLI option. In Salt, we accept these as a comma-delimited list but the API expects a Python dictionary mapping ports to their bindings. The format the API expects is complicated depending on whether o...
[ "def", "port_bindings", "(", "val", ",", "*", "*", "kwargs", ")", ":", "validate_ip_addrs", "=", "kwargs", ".", "get", "(", "'validate_ip_addrs'", ",", "True", ")", "if", "not", "isinstance", "(", "val", ",", "dict", ")", ":", "if", "not", "isinstance", ...
On the CLI, these are passed as multiple instances of a given CLI option. In Salt, we accept these as a comma-delimited list but the API expects a Python dictionary mapping ports to their bindings. The format the API expects is complicated depending on whether or not the external port maps to a differen...
[ "On", "the", "CLI", "these", "are", "passed", "as", "multiple", "instances", "of", "a", "given", "CLI", "option", ".", "In", "Salt", "we", "accept", "these", "as", "a", "comma", "-", "delimited", "list", "but", "the", "API", "expects", "a", "Python", "...
python
train
mitsei/dlkit
dlkit/json_/authorization/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/authorization/sessions.py#L735-L755
def get_authorizations_on_date(self, from_, to): """Gets an ``AuthorizationList`` effective during the entire given date range inclusive but not confined to the date range. arg: from (osid.calendaring.DateTime): starting date arg: to (osid.calendaring.DateTime): ending date return...
[ "def", "get_authorizations_on_date", "(", "self", ",", "from_", ",", "to", ")", ":", "# Implemented from template for", "# osid.relationship.RelationshipLookupSession.get_relationships_on_date", "authorization_list", "=", "[", "]", "for", "authorization", "in", "self", ".", ...
Gets an ``AuthorizationList`` effective during the entire given date range inclusive but not confined to the date range. arg: from (osid.calendaring.DateTime): starting date arg: to (osid.calendaring.DateTime): ending date return: (osid.authorization.AuthorizationList) - the returned ...
[ "Gets", "an", "AuthorizationList", "effective", "during", "the", "entire", "given", "date", "range", "inclusive", "but", "not", "confined", "to", "the", "date", "range", "." ]
python
train
rkhleics/wagtailmenus
wagtailmenus/utils/version.py
https://github.com/rkhleics/wagtailmenus/blob/a41f240bed0d362e0d4dd4ef04a230f2b1827a93/wagtailmenus/utils/version.py#L18-L21
def get_main_version(version): "Returns main version (X.Y[.Z]) from VERSION." parts = 2 if version[2] == 0 else 3 return '.'.join(str(x) for x in version[:parts])
[ "def", "get_main_version", "(", "version", ")", ":", "parts", "=", "2", "if", "version", "[", "2", "]", "==", "0", "else", "3", "return", "'.'", ".", "join", "(", "str", "(", "x", ")", "for", "x", "in", "version", "[", ":", "parts", "]", ")" ]
Returns main version (X.Y[.Z]) from VERSION.
[ "Returns", "main", "version", "(", "X", ".", "Y", "[", ".", "Z", "]", ")", "from", "VERSION", "." ]
python
train
pymc-devs/pymc
pymc/distributions.py
https://github.com/pymc-devs/pymc/blob/c6e530210bff4c0d7189b35b2c971bc53f93f7cd/pymc/distributions.py#L2065-L2073
def rnegative_binomial(mu, alpha, size=None): """ Random negative binomial variates. """ # Using gamma-poisson mixture rather than numpy directly # because numpy apparently rounds mu = np.asarray(mu, dtype=float) pois_mu = np.random.gamma(alpha, mu / alpha, size) return np.random.poisson...
[ "def", "rnegative_binomial", "(", "mu", ",", "alpha", ",", "size", "=", "None", ")", ":", "# Using gamma-poisson mixture rather than numpy directly", "# because numpy apparently rounds", "mu", "=", "np", ".", "asarray", "(", "mu", ",", "dtype", "=", "float", ")", ...
Random negative binomial variates.
[ "Random", "negative", "binomial", "variates", "." ]
python
train
hyperledger/sawtooth-core
validator/sawtooth_validator/journal/chain.py
https://github.com/hyperledger/sawtooth-core/blob/8cf473bc2207e51f02bd182d825158a57d72b098/validator/sawtooth_validator/journal/chain.py#L163-L167
def on_block_received(self, block_id): """This is exposed for unit tests, and should not be called directly. """ _libexec('chain_controller_on_block_received', self.pointer, ctypes.c_char_p(block_id.encode('utf-8')))
[ "def", "on_block_received", "(", "self", ",", "block_id", ")", ":", "_libexec", "(", "'chain_controller_on_block_received'", ",", "self", ".", "pointer", ",", "ctypes", ".", "c_char_p", "(", "block_id", ".", "encode", "(", "'utf-8'", ")", ")", ")" ]
This is exposed for unit tests, and should not be called directly.
[ "This", "is", "exposed", "for", "unit", "tests", "and", "should", "not", "be", "called", "directly", "." ]
python
train
ANTsX/ANTsPy
ants/core/ants_metric.py
https://github.com/ANTsX/ANTsPy/blob/638020af2cdfc5ff4bdb9809ffe67aa505727a3b/ants/core/ants_metric.py#L74-L85
def set_moving_image(self, image): """ Set Moving ANTsImage for metric """ if not isinstance(image, iio.ANTsImage): raise ValueError('image must be ANTsImage type') if image.dimension != self.dimension: raise ValueError('image dim (%i) does not match metr...
[ "def", "set_moving_image", "(", "self", ",", "image", ")", ":", "if", "not", "isinstance", "(", "image", ",", "iio", ".", "ANTsImage", ")", ":", "raise", "ValueError", "(", "'image must be ANTsImage type'", ")", "if", "image", ".", "dimension", "!=", "self",...
Set Moving ANTsImage for metric
[ "Set", "Moving", "ANTsImage", "for", "metric" ]
python
train
azogue/esiosdata
esiosdata/perfilesconsumopvpc.py
https://github.com/azogue/esiosdata/blob/680c7918955bc6ceee5bded92b3a4485f5ea8151/esiosdata/perfilesconsumopvpc.py#L44-L72
def get_data_coeficientes_perfilado_2017(force_download=False): """Extrae la información de las dos hojas del Excel proporcionado por REE con los perfiles iniciales para 2017. :param force_download: Descarga el fichero 'raw' del servidor, en vez de acudir a la copia local. :return: perfiles_2017, coefs_...
[ "def", "get_data_coeficientes_perfilado_2017", "(", "force_download", "=", "False", ")", ":", "path_perfs", "=", "os", ".", "path", ".", "join", "(", "STORAGE_DIR", ",", "'perfiles_consumo_2017.h5'", ")", "if", "force_download", "or", "not", "os", ".", "path", "...
Extrae la información de las dos hojas del Excel proporcionado por REE con los perfiles iniciales para 2017. :param force_download: Descarga el fichero 'raw' del servidor, en vez de acudir a la copia local. :return: perfiles_2017, coefs_alpha_beta_gamma :rtype: tuple
[ "Extrae", "la", "información", "de", "las", "dos", "hojas", "del", "Excel", "proporcionado", "por", "REE", "con", "los", "perfiles", "iniciales", "para", "2017", ".", ":", "param", "force_download", ":", "Descarga", "el", "fichero", "raw", "del", "servidor", ...
python
valid
xolox/python-coloredlogs
coloredlogs/__init__.py
https://github.com/xolox/python-coloredlogs/blob/1cbf0c6bbee400c6ddbc43008143809934ec3e79/coloredlogs/__init__.py#L810-L833
def replace_handler(logger, match_handler, reconfigure): """ Prepare to replace a handler. :param logger: Refer to :func:`find_handler()`. :param match_handler: Refer to :func:`find_handler()`. :param reconfigure: :data:`True` if an existing handler should be replaced, :data...
[ "def", "replace_handler", "(", "logger", ",", "match_handler", ",", "reconfigure", ")", ":", "handler", ",", "other_logger", "=", "find_handler", "(", "logger", ",", "match_handler", ")", "if", "handler", "and", "other_logger", "and", "reconfigure", ":", "# Remo...
Prepare to replace a handler. :param logger: Refer to :func:`find_handler()`. :param match_handler: Refer to :func:`find_handler()`. :param reconfigure: :data:`True` if an existing handler should be replaced, :data:`False` otherwise. :returns: A tuple of two values: ...
[ "Prepare", "to", "replace", "a", "handler", "." ]
python
train
spyder-ide/spyder
spyder/plugins/explorer/widgets.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L661-L671
def convert_notebook(self, fname): """Convert an IPython notebook to a Python script in editor""" try: script = nbexporter().from_filename(fname)[0] except Exception as e: QMessageBox.critical(self, _('Conversion error'), _("It was...
[ "def", "convert_notebook", "(", "self", ",", "fname", ")", ":", "try", ":", "script", "=", "nbexporter", "(", ")", ".", "from_filename", "(", "fname", ")", "[", "0", "]", "except", "Exception", "as", "e", ":", "QMessageBox", ".", "critical", "(", "self...
Convert an IPython notebook to a Python script in editor
[ "Convert", "an", "IPython", "notebook", "to", "a", "Python", "script", "in", "editor" ]
python
train
sorgerlab/indra
indra/sources/biopax/processor.py
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L187-L259
def get_regulate_activities(self): """Get Activation/Inhibition INDRA Statements from the BioPAX model. This method extracts Activation/Inhibition Statements and reuses the structure of BioPAX Pattern's org.biopax.paxtools.pattern.PatternBox.constrolsStateChange pattern with add...
[ "def", "get_regulate_activities", "(", "self", ")", ":", "mcc", "=", "_bpp", "(", "'constraint.ModificationChangeConstraint'", ")", "mcct", "=", "_bpp", "(", "'constraint.ModificationChangeConstraint$Type'", ")", "mod_filter", "=", "'residue modification, active'", "# Start...
Get Activation/Inhibition INDRA Statements from the BioPAX model. This method extracts Activation/Inhibition Statements and reuses the structure of BioPAX Pattern's org.biopax.paxtools.pattern.PatternBox.constrolsStateChange pattern with additional constraints to specify the gain or los...
[ "Get", "Activation", "/", "Inhibition", "INDRA", "Statements", "from", "the", "BioPAX", "model", "." ]
python
train
miyakogi/wdom
wdom/css.py
https://github.com/miyakogi/wdom/blob/a21bcd23e94baceee71161829f6897bee3fd39c1/wdom/css.py#L118-L124
def setProperty(self, prop: str, value: str, priority: str = None ) -> None: """Set property as the value. The third argument ``priority`` is not implemented yet. """ self[prop] = value
[ "def", "setProperty", "(", "self", ",", "prop", ":", "str", ",", "value", ":", "str", ",", "priority", ":", "str", "=", "None", ")", "->", "None", ":", "self", "[", "prop", "]", "=", "value" ]
Set property as the value. The third argument ``priority`` is not implemented yet.
[ "Set", "property", "as", "the", "value", "." ]
python
train
pypa/pipenv
pipenv/vendor/distlib/database.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L804-L831
def get_distinfo_file(self, path): """ Returns a path located under the ``.dist-info`` directory. Returns a string representing the path. :parameter path: a ``'/'``-separated path relative to the ``.dist-info`` directory or an absolute path; ...
[ "def", "get_distinfo_file", "(", "self", ",", "path", ")", ":", "# Check if it is an absolute path # XXX use relpath, add tests", "if", "path", ".", "find", "(", "os", ".", "sep", ")", ">=", "0", ":", "# it's an absolute path?", "distinfo_dirname", ",", "path", "="...
Returns a path located under the ``.dist-info`` directory. Returns a string representing the path. :parameter path: a ``'/'``-separated path relative to the ``.dist-info`` directory or an absolute path; If *path* is an absolute path and doesn't start ...
[ "Returns", "a", "path", "located", "under", "the", ".", "dist", "-", "info", "directory", ".", "Returns", "a", "string", "representing", "the", "path", "." ]
python
train
ev3dev/ev3dev-lang-python
ev3dev2/sensor/lego.py
https://github.com/ev3dev/ev3dev-lang-python/blob/afc98d35004b533dc161a01f7c966e78607d7c1e/ev3dev2/sensor/lego.py#L450-L461
def distance_centimeters_continuous(self): """ Measurement of the distance detected by the sensor, in centimeters. The sensor will continue to take measurements so they are available for future reads. Prefer using the equivalent :meth:`UltrasonicSensor.distance_centimet...
[ "def", "distance_centimeters_continuous", "(", "self", ")", ":", "self", ".", "_ensure_mode", "(", "self", ".", "MODE_US_DIST_CM", ")", "return", "self", ".", "value", "(", "0", ")", "*", "self", ".", "_scale", "(", "'US_DIST_CM'", ")" ]
Measurement of the distance detected by the sensor, in centimeters. The sensor will continue to take measurements so they are available for future reads. Prefer using the equivalent :meth:`UltrasonicSensor.distance_centimeters` property.
[ "Measurement", "of", "the", "distance", "detected", "by", "the", "sensor", "in", "centimeters", "." ]
python
train
scott-maddox/openbandparams
src/openbandparams/iii_v_zinc_blende_strained.py
https://github.com/scott-maddox/openbandparams/blob/bc24e59187326bcb8948117434536082c9055777/src/openbandparams/iii_v_zinc_blende_strained.py#L150-L156
def CBO_Gamma(self, **kwargs): ''' Returns the strain-shifted Gamma-valley conduction band offset (CBO), assuming the strain affects all conduction band valleys equally. ''' return (self.unstrained.CBO_Gamma(**kwargs) + self.CBO_strain_shift(**kwargs))
[ "def", "CBO_Gamma", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "(", "self", ".", "unstrained", ".", "CBO_Gamma", "(", "*", "*", "kwargs", ")", "+", "self", ".", "CBO_strain_shift", "(", "*", "*", "kwargs", ")", ")" ]
Returns the strain-shifted Gamma-valley conduction band offset (CBO), assuming the strain affects all conduction band valleys equally.
[ "Returns", "the", "strain", "-", "shifted", "Gamma", "-", "valley", "conduction", "band", "offset", "(", "CBO", ")", "assuming", "the", "strain", "affects", "all", "conduction", "band", "valleys", "equally", "." ]
python
train
MozillaSecurity/laniakea
laniakea/core/common.py
https://github.com/MozillaSecurity/laniakea/blob/7e80adc6ae92c6c1332d4c08473bb271fb3b6833/laniakea/core/common.py#L155-L162
def load(self, root, module_path, pkg_name): """Load modules dynamically. """ root = os.path.join(root, module_path) import_name = os.path.join(pkg_name, module_path).replace(os.sep, '.') for (_, name, _) in pkgutil.iter_modules([root]): self.modules[name] = import_mo...
[ "def", "load", "(", "self", ",", "root", ",", "module_path", ",", "pkg_name", ")", ":", "root", "=", "os", ".", "path", ".", "join", "(", "root", ",", "module_path", ")", "import_name", "=", "os", ".", "path", ".", "join", "(", "pkg_name", ",", "mo...
Load modules dynamically.
[ "Load", "modules", "dynamically", "." ]
python
train
google/apitools
apitools/base/py/base_api.py
https://github.com/google/apitools/blob/f3745a7ea535aa0e88b0650c16479b696d6fd446/apitools/base/py/base_api.py#L370-L375
def JsonResponseModel(self): """In this context, return raw JSON instead of proto.""" old_model = self.response_type_model self.__response_type_model = 'json' yield self.__response_type_model = old_model
[ "def", "JsonResponseModel", "(", "self", ")", ":", "old_model", "=", "self", ".", "response_type_model", "self", ".", "__response_type_model", "=", "'json'", "yield", "self", ".", "__response_type_model", "=", "old_model" ]
In this context, return raw JSON instead of proto.
[ "In", "this", "context", "return", "raw", "JSON", "instead", "of", "proto", "." ]
python
train
rwl/godot
godot/component/component_viewer.py
https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/component/component_viewer.py#L67-L72
def _viewport_default(self): """ Trait initialiser """ viewport = Viewport(component=self.canvas, enable_zoom=True) viewport.tools.append(ViewportPanTool(viewport)) return viewport
[ "def", "_viewport_default", "(", "self", ")", ":", "viewport", "=", "Viewport", "(", "component", "=", "self", ".", "canvas", ",", "enable_zoom", "=", "True", ")", "viewport", ".", "tools", ".", "append", "(", "ViewportPanTool", "(", "viewport", ")", ")", ...
Trait initialiser
[ "Trait", "initialiser" ]
python
test
pesaply/sarafu
pesaply.py
https://github.com/pesaply/sarafu/blob/8c1296d48427a6cf17ffc5600d100b49acc9c5b7/pesaply.py#L235-L251
def post_url(self, url, form): """ Internally used to retrieve the contents of a URL using the POST request method. The `form` parameter is a mechanize.HTMLForm object This method will use a POST request type regardless of the method used in the `form`. """ ...
[ "def", "post_url", "(", "self", ",", "url", ",", "form", ")", ":", "_r", "=", "self", ".", "br", ".", "open", "(", "url", ",", "form", ".", "click_request_data", "(", ")", "[", "1", "]", ")", "# check that we've not been redirected to the login page or an er...
Internally used to retrieve the contents of a URL using the POST request method. The `form` parameter is a mechanize.HTMLForm object This method will use a POST request type regardless of the method used in the `form`.
[ "Internally", "used", "to", "retrieve", "the", "contents", "of", "a", "URL", "using", "the", "POST", "request", "method", ".", "The", "form", "parameter", "is", "a", "mechanize", ".", "HTMLForm", "object", "This", "method", "will", "use", "a", "POST", "req...
python
train
radujica/baloo
baloo/core/frame.py
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/core/frame.py#L1100-L1126
def from_pandas(cls, df): """Create baloo DataFrame from pandas DataFrame. Parameters ---------- df : pandas.frame.DataFrame Returns ------- DataFrame """ from pandas import DataFrame as PandasDataFrame, Index as PandasIndex, MultiIndex as Panda...
[ "def", "from_pandas", "(", "cls", ",", "df", ")", ":", "from", "pandas", "import", "DataFrame", "as", "PandasDataFrame", ",", "Index", "as", "PandasIndex", ",", "MultiIndex", "as", "PandasMultiIndex", "check_type", "(", "df", ",", "PandasDataFrame", ")", "if",...
Create baloo DataFrame from pandas DataFrame. Parameters ---------- df : pandas.frame.DataFrame Returns ------- DataFrame
[ "Create", "baloo", "DataFrame", "from", "pandas", "DataFrame", "." ]
python
train
Unity-Technologies/ml-agents
ml-agents/mlagents/trainers/bc/trainer.py
https://github.com/Unity-Technologies/ml-agents/blob/37d139af636e4a2351751fbf0f2fca5a9ed7457f/ml-agents/mlagents/trainers/bc/trainer.py#L134-L143
def end_episode(self): """ A signal that the Episode has ended. The buffer must be reset. Get only called when the academy resets. """ self.evaluation_buffer.reset_local_buffers() for agent_id in self.cumulative_rewards: self.cumulative_rewards[agent_id] = 0 ...
[ "def", "end_episode", "(", "self", ")", ":", "self", ".", "evaluation_buffer", ".", "reset_local_buffers", "(", ")", "for", "agent_id", "in", "self", ".", "cumulative_rewards", ":", "self", ".", "cumulative_rewards", "[", "agent_id", "]", "=", "0", "for", "a...
A signal that the Episode has ended. The buffer must be reset. Get only called when the academy resets.
[ "A", "signal", "that", "the", "Episode", "has", "ended", ".", "The", "buffer", "must", "be", "reset", ".", "Get", "only", "called", "when", "the", "academy", "resets", "." ]
python
train
inveniosoftware/invenio-files-rest
invenio_files_rest/views.py
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/views.py#L679-L715
def multipart_uploadpart(self, multipart): """Upload a part. :param multipart: A :class:`invenio_files_rest.models.MultipartObject` instance. :returns: A Flask response. """ content_length, part_number, stream, content_type, content_md5, tags =\ current_f...
[ "def", "multipart_uploadpart", "(", "self", ",", "multipart", ")", ":", "content_length", ",", "part_number", ",", "stream", ",", "content_type", ",", "content_md5", ",", "tags", "=", "current_files_rest", ".", "multipart_partfactory", "(", ")", "if", "content_len...
Upload a part. :param multipart: A :class:`invenio_files_rest.models.MultipartObject` instance. :returns: A Flask response.
[ "Upload", "a", "part", "." ]
python
train
Alignak-monitoring/alignak
alignak/http/arbiter_interface.py
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/http/arbiter_interface.py#L1143-L1155
def external_commands(self): """Get the external commands from the daemon Use a lock for this function to protect :return: serialized external command list :rtype: str """ res = [] with self.app.external_commands_lock: for cmd in self.app.get_externa...
[ "def", "external_commands", "(", "self", ")", ":", "res", "=", "[", "]", "with", "self", ".", "app", ".", "external_commands_lock", ":", "for", "cmd", "in", "self", ".", "app", ".", "get_external_commands", "(", ")", ":", "res", ".", "append", "(", "cm...
Get the external commands from the daemon Use a lock for this function to protect :return: serialized external command list :rtype: str
[ "Get", "the", "external", "commands", "from", "the", "daemon" ]
python
train
BlueBrain/nat
nat/zotero_wrap.py
https://github.com/BlueBrain/nat/blob/0934f06e48e6efedf55a9617b15becae0d7b277c/nat/zotero_wrap.py#L142-L151
def reference_extra_field(self, field, index): """Return the value of the field in 'extra', otherwise ''.""" ref_data = self.reference_data(index) extra_fields = ref_data["extra"].split("\n") field_id = field + ":" matched = next((x for x in extra_fields if x.startswith(field_id)...
[ "def", "reference_extra_field", "(", "self", ",", "field", ",", "index", ")", ":", "ref_data", "=", "self", ".", "reference_data", "(", "index", ")", "extra_fields", "=", "ref_data", "[", "\"extra\"", "]", ".", "split", "(", "\"\\n\"", ")", "field_id", "="...
Return the value of the field in 'extra', otherwise ''.
[ "Return", "the", "value", "of", "the", "field", "in", "extra", "otherwise", "." ]
python
train
henzk/django-productline
django_productline/context.py
https://github.com/henzk/django-productline/blob/24ff156924c1a8c07b99cbb8a1de0a42b8d81f60/django_productline/context.py#L59-L90
def bind_context(context_filename): """ loads context from file and binds to it :param: context_filename absolute path of the context file called by featuredjango.startup.select_product prior to selecting the individual features """ global PRODUCT_CONTEXT if PRODUCT_CONTEXT is None: ...
[ "def", "bind_context", "(", "context_filename", ")", ":", "global", "PRODUCT_CONTEXT", "if", "PRODUCT_CONTEXT", "is", "None", ":", "with", "open", "(", "context_filename", ")", "as", "contextfile", ":", "try", ":", "context", "=", "json", ".", "loads", "(", ...
loads context from file and binds to it :param: context_filename absolute path of the context file called by featuredjango.startup.select_product prior to selecting the individual features
[ "loads", "context", "from", "file", "and", "binds", "to", "it" ]
python
train
python-cmd2/cmd2
examples/async_printing.py
https://github.com/python-cmd2/cmd2/blob/b22c0bd891ed08c8b09df56df9d91f48166a5e2a/examples/async_printing.py#L60-L68
def _postloop_hook(self) -> None: """ Stops the alerter thread """ # After this function returns, cmdloop() releases self.terminal_lock which could make the alerter # thread think the prompt is on screen. Therefore this is the best place to stop the alerter thread. # You can also stop i...
[ "def", "_postloop_hook", "(", "self", ")", "->", "None", ":", "# After this function returns, cmdloop() releases self.terminal_lock which could make the alerter", "# thread think the prompt is on screen. Therefore this is the best place to stop the alerter thread.", "# You can also stop it via a...
Stops the alerter thread
[ "Stops", "the", "alerter", "thread" ]
python
train
log2timeline/dfvfs
dfvfs/vfs/file_system.py
https://github.com/log2timeline/dfvfs/blob/2b3ccd115f9901d89f383397d4a1376a873c83c4/dfvfs/vfs/file_system.py#L177-L201
def GetPathSegmentAndSuffix(self, base_path, path): """Determines the path segment and suffix of the path. None is returned if the path does not start with the base path and an empty string if the path exactly matches the base path. Args: base_path (str): base path. path (str): path. ...
[ "def", "GetPathSegmentAndSuffix", "(", "self", ",", "base_path", ",", "path", ")", ":", "if", "path", "is", "None", "or", "base_path", "is", "None", "or", "not", "path", ".", "startswith", "(", "base_path", ")", ":", "return", "None", ",", "None", "path_...
Determines the path segment and suffix of the path. None is returned if the path does not start with the base path and an empty string if the path exactly matches the base path. Args: base_path (str): base path. path (str): path. Returns: tuple[str, str]: path segment and suffix str...
[ "Determines", "the", "path", "segment", "and", "suffix", "of", "the", "path", "." ]
python
train
orb-framework/orb
orb/core/database.py
https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/database.py#L206-L221
def setConnection(self, connection): """ Assigns the backend connection for this database instance. :param connection: <str> || <orb.Connection> """ # define custom properties if not isinstance(connection, orb.Connection): conn = orb.Connection.byName(connect...
[ "def", "setConnection", "(", "self", ",", "connection", ")", ":", "# define custom properties", "if", "not", "isinstance", "(", "connection", ",", "orb", ".", "Connection", ")", ":", "conn", "=", "orb", ".", "Connection", ".", "byName", "(", "connection", ")...
Assigns the backend connection for this database instance. :param connection: <str> || <orb.Connection>
[ "Assigns", "the", "backend", "connection", "for", "this", "database", "instance", "." ]
python
train
hydpy-dev/hydpy
hydpy/core/netcdftools.py
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/netcdftools.py#L287-L308
def chars2str(chars) -> List[str]: """Inversion function of function |str2chars|. >>> from hydpy.core.netcdftools import chars2str >>> chars2str([[b'z', b'e', b'r', b'o', b's'], ... [b'o', b'n', b'e', b's', b'']]) ['zeros', 'ones'] >>> chars2str([]) [] """ strings = col...
[ "def", "chars2str", "(", "chars", ")", "->", "List", "[", "str", "]", ":", "strings", "=", "collections", ".", "deque", "(", ")", "for", "subchars", "in", "chars", ":", "substrings", "=", "collections", ".", "deque", "(", ")", "for", "char", "in", "s...
Inversion function of function |str2chars|. >>> from hydpy.core.netcdftools import chars2str >>> chars2str([[b'z', b'e', b'r', b'o', b's'], ... [b'o', b'n', b'e', b's', b'']]) ['zeros', 'ones'] >>> chars2str([]) []
[ "Inversion", "function", "of", "function", "|str2chars|", "." ]
python
train
santoshphilip/eppy
eppy/bunchhelpers.py
https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/bunchhelpers.py#L55-L64
def replaceint(fname, replacewith='%s'): """replace int in lst""" words = fname.split() for i, word in enumerate(words): try: word = int(word) words[i] = replacewith except ValueError: pass return ' '.join(words)
[ "def", "replaceint", "(", "fname", ",", "replacewith", "=", "'%s'", ")", ":", "words", "=", "fname", ".", "split", "(", ")", "for", "i", ",", "word", "in", "enumerate", "(", "words", ")", ":", "try", ":", "word", "=", "int", "(", "word", ")", "wo...
replace int in lst
[ "replace", "int", "in", "lst" ]
python
train
linkedin/pyexchange
pyexchange/exchange2010/__init__.py
https://github.com/linkedin/pyexchange/blob/d568f4edd326adb451b915ddf66cf1a37820e3ca/pyexchange/exchange2010/__init__.py#L355-L381
def move_to(self, folder_id): """ :param str folder_id: The Calendar ID to where you want to move the event to. Moves an event to a different folder (calendar). :: event = service.calendar().get_event(id='KEY HERE') event.move_to(folder_id='NEW CALENDAR KEY HERE') """ if not folder_id:...
[ "def", "move_to", "(", "self", ",", "folder_id", ")", ":", "if", "not", "folder_id", ":", "raise", "TypeError", "(", "u\"You can't move an event to a non-existant folder\"", ")", "if", "not", "isinstance", "(", "folder_id", ",", "BASESTRING_TYPES", ")", ":", "rais...
:param str folder_id: The Calendar ID to where you want to move the event to. Moves an event to a different folder (calendar). :: event = service.calendar().get_event(id='KEY HERE') event.move_to(folder_id='NEW CALENDAR KEY HERE')
[ ":", "param", "str", "folder_id", ":", "The", "Calendar", "ID", "to", "where", "you", "want", "to", "move", "the", "event", "to", ".", "Moves", "an", "event", "to", "a", "different", "folder", "(", "calendar", ")", ".", "::" ]
python
train
Microsoft/nni
tools/nni_cmd/nnictl_utils.py
https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_cmd/nnictl_utils.py#L36-L42
def get_experiment_time(port): '''get the startTime and endTime of an experiment''' response = rest_get(experiment_url(port), REST_TIME_OUT) if response and check_response(response): content = convert_time_stamp_to_date(json.loads(response.text)) return content.get('startTime'), content.get(...
[ "def", "get_experiment_time", "(", "port", ")", ":", "response", "=", "rest_get", "(", "experiment_url", "(", "port", ")", ",", "REST_TIME_OUT", ")", "if", "response", "and", "check_response", "(", "response", ")", ":", "content", "=", "convert_time_stamp_to_dat...
get the startTime and endTime of an experiment
[ "get", "the", "startTime", "and", "endTime", "of", "an", "experiment" ]
python
train
IBMStreams/pypi.streamsx
streamsx/rest_primitives.py
https://github.com/IBMStreams/pypi.streamsx/blob/abd67b4757120f6f805787fba390f53e9df9cdd8/streamsx/rest_primitives.py#L840-L858
def get_views(self, name=None): """Get the list of :py:class:`~streamsx.rest_primitives.View` elements associated with this job. Args: name(str, optional): Returns view(s) matching `name`. `name` can be a regular expression. If `name` is not supplied, then all views associated...
[ "def", "get_views", "(", "self", ",", "name", "=", "None", ")", ":", "return", "self", ".", "_get_elements", "(", "self", ".", "views", ",", "'views'", ",", "View", ",", "name", "=", "name", ")" ]
Get the list of :py:class:`~streamsx.rest_primitives.View` elements associated with this job. Args: name(str, optional): Returns view(s) matching `name`. `name` can be a regular expression. If `name` is not supplied, then all views associated with this instance are returned. ...
[ "Get", "the", "list", "of", ":", "py", ":", "class", ":", "~streamsx", ".", "rest_primitives", ".", "View", "elements", "associated", "with", "this", "job", "." ]
python
train
tgbugs/pyontutils
ilxutils/ilxutils/simple_scicrunch_client.py
https://github.com/tgbugs/pyontutils/blob/3d913db29c177db39151592909a4f56170ef8b35/ilxutils/ilxutils/simple_scicrunch_client.py#L130-L132
def is_equal(self, string1, string2): ''' Simple string comparator ''' return string1.lower().strip() == string2.lower().strip()
[ "def", "is_equal", "(", "self", ",", "string1", ",", "string2", ")", ":", "return", "string1", ".", "lower", "(", ")", ".", "strip", "(", ")", "==", "string2", ".", "lower", "(", ")", ".", "strip", "(", ")" ]
Simple string comparator
[ "Simple", "string", "comparator" ]
python
train
bokeh/bokeh
_setup_support.py
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/_setup_support.py#L245-L258
def jsbuild_prompt(): ''' Prompt users whether to build a new BokehJS or install an existing one. Returns: bool : True, if a new build is requested, False otherwise ''' print(BOKEHJS_BUILD_PROMPT) mapping = {"1": True, "2": False} value = input("Choice? ") while value not in mappin...
[ "def", "jsbuild_prompt", "(", ")", ":", "print", "(", "BOKEHJS_BUILD_PROMPT", ")", "mapping", "=", "{", "\"1\"", ":", "True", ",", "\"2\"", ":", "False", "}", "value", "=", "input", "(", "\"Choice? \"", ")", "while", "value", "not", "in", "mapping", ":",...
Prompt users whether to build a new BokehJS or install an existing one. Returns: bool : True, if a new build is requested, False otherwise
[ "Prompt", "users", "whether", "to", "build", "a", "new", "BokehJS", "or", "install", "an", "existing", "one", "." ]
python
train
dswah/pyGAM
pygam/terms.py
https://github.com/dswah/pyGAM/blob/b3e5c3cd580f0a3ad69f9372861624f67760c325/pygam/terms.py#L1251-L1273
def compile(self, X, verbose=False): """method to validate and prepare data-dependent parameters Parameters --------- X : array-like Input dataset verbose : bool whether to show warnings Returns ------- None """ f...
[ "def", "compile", "(", "self", ",", "X", ",", "verbose", "=", "False", ")", ":", "for", "term", "in", "self", ".", "_terms", ":", "term", ".", "compile", "(", "X", ",", "verbose", "=", "False", ")", "if", "self", ".", "by", "is", "not", "None", ...
method to validate and prepare data-dependent parameters Parameters --------- X : array-like Input dataset verbose : bool whether to show warnings Returns ------- None
[ "method", "to", "validate", "and", "prepare", "data", "-", "dependent", "parameters" ]
python
train
chrisspen/burlap
burlap/rabbitmq.py
https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/rabbitmq.py#L281-L313
def _configure_users(self, site=None, full=0, only_data=0): """ Installs and configures RabbitMQ. """ site = site or ALL full = int(full) if full and not only_data: packager = self.get_satchel('packager') packager.install_required(type=SYSTEM, s...
[ "def", "_configure_users", "(", "self", ",", "site", "=", "None", ",", "full", "=", "0", ",", "only_data", "=", "0", ")", ":", "site", "=", "site", "or", "ALL", "full", "=", "int", "(", "full", ")", "if", "full", "and", "not", "only_data", ":", "...
Installs and configures RabbitMQ.
[ "Installs", "and", "configures", "RabbitMQ", "." ]
python
valid
fermiPy/fermipy
fermipy/diffuse/name_policy.py
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/name_policy.py#L481-L493
def template_sunmoon(self, **kwargs): """ return the file name for sun or moon template files """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) kwargs_copy['dataset'] = kwargs.get('dataset', self.dataset(**kwargs)) kwargs_copy['component'] = kwargs.get(...
[ "def", "template_sunmoon", "(", "self", ",", "*", "*", "kwargs", ")", ":", "kwargs_copy", "=", "self", ".", "base_dict", ".", "copy", "(", ")", "kwargs_copy", ".", "update", "(", "*", "*", "kwargs", ")", "kwargs_copy", "[", "'dataset'", "]", "=", "kwar...
return the file name for sun or moon template files
[ "return", "the", "file", "name", "for", "sun", "or", "moon", "template", "files" ]
python
train
saltstack/salt
salt/cloud/__init__.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L285-L292
def list_locations(self, provider=None): ''' List all available locations in configured cloud systems ''' mapper = salt.cloud.Map(self._opts_defaults()) return salt.utils.data.simple_types_filter( mapper.location_list(provider) )
[ "def", "list_locations", "(", "self", ",", "provider", "=", "None", ")", ":", "mapper", "=", "salt", ".", "cloud", ".", "Map", "(", "self", ".", "_opts_defaults", "(", ")", ")", "return", "salt", ".", "utils", ".", "data", ".", "simple_types_filter", "...
List all available locations in configured cloud systems
[ "List", "all", "available", "locations", "in", "configured", "cloud", "systems" ]
python
train
dhermes/bezier
src/bezier/_algebraic_intersection.py
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_algebraic_intersection.py#L301-L339
def _to_power_basis13(nodes1, nodes2): r"""Compute the coefficients of an **intersection polynomial**. Helper for :func:`to_power_basis` in the case that the first curve is degree one and the second is degree three. In this case, B |eacute| zout's `theorem`_ tells us that the **intersection polynomial*...
[ "def", "_to_power_basis13", "(", "nodes1", ",", "nodes2", ")", ":", "# We manually invert the Vandermonde matrix:", "# Use exact f.p. numbers to avoid round-off wherever possible.", "# [1 0 0 0 ][c0] = [n0]", "# [1 1/4 1/16 1/64 ][c1] [n1]", "# [1 3/4 9/16 27/64][c2] [n2]", "# ...
r"""Compute the coefficients of an **intersection polynomial**. Helper for :func:`to_power_basis` in the case that the first curve is degree one and the second is degree three. In this case, B |eacute| zout's `theorem`_ tells us that the **intersection polynomial** is degree :math:`1 \cdot 3` hence we ...
[ "r", "Compute", "the", "coefficients", "of", "an", "**", "intersection", "polynomial", "**", "." ]
python
train
jpablo128/simplystatic
bin/s2.py
https://github.com/jpablo128/simplystatic/blob/91ac579c8f34fa240bef9b87adb0116c6b40b24d/bin/s2.py#L116-L120
def dispatch(argdict): '''Call the command-specific function, depending on the command.''' cmd = argdict['command'] ftc = getattr(THIS_MODULE, 'do_'+cmd) ftc(argdict)
[ "def", "dispatch", "(", "argdict", ")", ":", "cmd", "=", "argdict", "[", "'command'", "]", "ftc", "=", "getattr", "(", "THIS_MODULE", ",", "'do_'", "+", "cmd", ")", "ftc", "(", "argdict", ")" ]
Call the command-specific function, depending on the command.
[ "Call", "the", "command", "-", "specific", "function", "depending", "on", "the", "command", "." ]
python
train
sosy-lab/benchexec
benchexec/tablegenerator/util.py
https://github.com/sosy-lab/benchexec/blob/44428f67f41384c03aea13e7e25f884764653617/benchexec/tablegenerator/util.py#L198-L213
def collapse_equal_values(values, counts): """ Take a tuple (values, counts), remove consecutive values and increment their count instead. """ assert len(values) == len(counts) previousValue = values[0] previousCount = 0 for value, count in zip(values, counts): if value != previousV...
[ "def", "collapse_equal_values", "(", "values", ",", "counts", ")", ":", "assert", "len", "(", "values", ")", "==", "len", "(", "counts", ")", "previousValue", "=", "values", "[", "0", "]", "previousCount", "=", "0", "for", "value", ",", "count", "in", ...
Take a tuple (values, counts), remove consecutive values and increment their count instead.
[ "Take", "a", "tuple", "(", "values", "counts", ")", "remove", "consecutive", "values", "and", "increment", "their", "count", "instead", "." ]
python
train
gebn/nibble
nibble/expression/parser.py
https://github.com/gebn/nibble/blob/e82a2c43509ed38f3d039040591cc630fa676cb0/nibble/expression/parser.py#L67-L70
def p_information_duration_speed(self, p): 'information : duration AT speed' logger.debug('information = duration %s at speed %s', p[1], p[3]) p[0] = p[3].for_duration(p[1])
[ "def", "p_information_duration_speed", "(", "self", ",", "p", ")", ":", "logger", ".", "debug", "(", "'information = duration %s at speed %s'", ",", "p", "[", "1", "]", ",", "p", "[", "3", "]", ")", "p", "[", "0", "]", "=", "p", "[", "3", "]", ".", ...
information : duration AT speed
[ "information", ":", "duration", "AT", "speed" ]
python
train
pyroscope/pyrobase
src/pyrobase/bencode.py
https://github.com/pyroscope/pyrobase/blob/7a2591baa492c3d8997ab4801b97c7b1f2ebc6b1/src/pyrobase/bencode.py#L170-L180
def bread(stream): """ Decode a file or stream to an object. """ if hasattr(stream, "read"): return bdecode(stream.read()) else: handle = open(stream, "rb") try: return bdecode(handle.read()) finally: handle.close()
[ "def", "bread", "(", "stream", ")", ":", "if", "hasattr", "(", "stream", ",", "\"read\"", ")", ":", "return", "bdecode", "(", "stream", ".", "read", "(", ")", ")", "else", ":", "handle", "=", "open", "(", "stream", ",", "\"rb\"", ")", "try", ":", ...
Decode a file or stream to an object.
[ "Decode", "a", "file", "or", "stream", "to", "an", "object", "." ]
python
train
ets-labs/python-domain-models
domain_models/views.py
https://github.com/ets-labs/python-domain-models/blob/7de1816ba0338f20fdb3e0f57fad0ffd5bea13f9/domain_models/views.py#L18-L24
def validate(mcs, bases, attributes): """Check attributes.""" if bases[0] is object: return None mcs.check_model_cls(attributes) mcs.check_include_exclude(attributes) mcs.check_properties(attributes)
[ "def", "validate", "(", "mcs", ",", "bases", ",", "attributes", ")", ":", "if", "bases", "[", "0", "]", "is", "object", ":", "return", "None", "mcs", ".", "check_model_cls", "(", "attributes", ")", "mcs", ".", "check_include_exclude", "(", "attributes", ...
Check attributes.
[ "Check", "attributes", "." ]
python
train
genialis/resolwe
resolwe/flow/consumers.py
https://github.com/genialis/resolwe/blob/f7bb54932c81ec0cfc5b5e80d238fceaeaa48d86/resolwe/flow/consumers.py#L15-L24
def purge_run(self, event): """Run purge for the object with ``location_id`` specified in ``event`` argument.""" location_id = event['location_id'] verbosity = event['verbosity'] try: logger.info(__("Running purge for location id {}.", location_id)) location_purg...
[ "def", "purge_run", "(", "self", ",", "event", ")", ":", "location_id", "=", "event", "[", "'location_id'", "]", "verbosity", "=", "event", "[", "'verbosity'", "]", "try", ":", "logger", ".", "info", "(", "__", "(", "\"Running purge for location id {}.\"", "...
Run purge for the object with ``location_id`` specified in ``event`` argument.
[ "Run", "purge", "for", "the", "object", "with", "location_id", "specified", "in", "event", "argument", "." ]
python
train
BD2KGenomics/protect
src/protect/addons/assess_mhc_pathway.py
https://github.com/BD2KGenomics/protect/blob/06310682c50dcf8917b912c8e551299ff7ee41ce/src/protect/addons/assess_mhc_pathway.py#L27-L39
def run_mhc_gene_assessment(job, rsem_files, rna_haplotype, univ_options, reports_options): """ A wrapper for assess_mhc_genes. :param dict rsem_files: Results from running rsem :param str rna_haplotype: The job store id for the rna haplotype file :param dict univ_options: Dict of universal options...
[ "def", "run_mhc_gene_assessment", "(", "job", ",", "rsem_files", ",", "rna_haplotype", ",", "univ_options", ",", "reports_options", ")", ":", "return", "job", ".", "addChildJobFn", "(", "assess_mhc_genes", ",", "rsem_files", "[", "'rsem.genes.results'", "]", ",", ...
A wrapper for assess_mhc_genes. :param dict rsem_files: Results from running rsem :param str rna_haplotype: The job store id for the rna haplotype file :param dict univ_options: Dict of universal options used by almost all tools :param dict reports_options: Options specific to reporting modules :re...
[ "A", "wrapper", "for", "assess_mhc_genes", "." ]
python
train
rocky/python-xdis
xdis/load.py
https://github.com/rocky/python-xdis/blob/46a2902ae8f5d8eee495eed67ac0690fd545453d/xdis/load.py#L109-L207
def load_module_from_file_object(fp, filename='<unknown>', code_objects=None, fast_load=False, get_code=True): """load a module from a file object without importing it. See :func:load_module for a list of return values. """ if code_objects is None: code_objects = {} timest...
[ "def", "load_module_from_file_object", "(", "fp", ",", "filename", "=", "'<unknown>'", ",", "code_objects", "=", "None", ",", "fast_load", "=", "False", ",", "get_code", "=", "True", ")", ":", "if", "code_objects", "is", "None", ":", "code_objects", "=", "{"...
load a module from a file object without importing it. See :func:load_module for a list of return values.
[ "load", "a", "module", "from", "a", "file", "object", "without", "importing", "it", "." ]
python
train
fprimex/zdesk
zdesk/zdesk_api.py
https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L119-L122
def agent_create(self, data, **kwargs): "https://developer.zendesk.com/rest_api/docs/chat/agents#create-agent" api_path = "/api/v2/agents" return self.call(api_path, method="POST", data=data, **kwargs)
[ "def", "agent_create", "(", "self", ",", "data", ",", "*", "*", "kwargs", ")", ":", "api_path", "=", "\"/api/v2/agents\"", "return", "self", ".", "call", "(", "api_path", ",", "method", "=", "\"POST\"", ",", "data", "=", "data", ",", "*", "*", "kwargs"...
https://developer.zendesk.com/rest_api/docs/chat/agents#create-agent
[ "https", ":", "//", "developer", ".", "zendesk", ".", "com", "/", "rest_api", "/", "docs", "/", "chat", "/", "agents#create", "-", "agent" ]
python
train
spyder-ide/spyder
spyder/plugins/editor/plugin.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L348-L382
def closing_plugin(self, cancelable=False): """Perform actions before parent main window is closed""" state = self.splitter.saveState() self.set_option('splitter_state', qbytearray_to_str(state)) filenames = [] editorstack = self.editorstacks[0] active_project_pat...
[ "def", "closing_plugin", "(", "self", ",", "cancelable", "=", "False", ")", ":", "state", "=", "self", ".", "splitter", ".", "saveState", "(", ")", "self", ".", "set_option", "(", "'splitter_state'", ",", "qbytearray_to_str", "(", "state", ")", ")", "filen...
Perform actions before parent main window is closed
[ "Perform", "actions", "before", "parent", "main", "window", "is", "closed" ]
python
train
BerkeleyAutomation/autolab_core
autolab_core/transformations.py
https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/transformations.py#L1245-L1255
def quaternion_conjugate(quaternion): """Return conjugate of quaternion. >>> q0 = random_quaternion() >>> q1 = quaternion_conjugate(q0) >>> q1[3] == q0[3] and all(q1[:3] == -q0[:3]) True """ return numpy.array((-quaternion[0], -quaternion[1], -quaternion[2], quatern...
[ "def", "quaternion_conjugate", "(", "quaternion", ")", ":", "return", "numpy", ".", "array", "(", "(", "-", "quaternion", "[", "0", "]", ",", "-", "quaternion", "[", "1", "]", ",", "-", "quaternion", "[", "2", "]", ",", "quaternion", "[", "3", "]", ...
Return conjugate of quaternion. >>> q0 = random_quaternion() >>> q1 = quaternion_conjugate(q0) >>> q1[3] == q0[3] and all(q1[:3] == -q0[:3]) True
[ "Return", "conjugate", "of", "quaternion", "." ]
python
train
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/ietf_netconf_acm.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/ietf_netconf_acm.py#L23-L32
def nacm_read_default(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") nacm = ET.SubElement(config, "nacm", xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-acm") read_default = ET.SubElement(nacm, "read-default") read_default.text = kwargs.pop('re...
[ "def", "nacm_read_default", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "nacm", "=", "ET", ".", "SubElement", "(", "config", ",", "\"nacm\"", ",", "xmlns", "=", "\"urn:ietf:params:xml:ns:yang...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
symphonyoss/python-symphony
symphony/Pod/streams.py
https://github.com/symphonyoss/python-symphony/blob/b939f35fbda461183ec0c01790c754f89a295be0/symphony/Pod/streams.py#L117-L127
def list_streams(self, types=[], inactive=False): ''' list user streams ''' req_hook = 'pod/v1/streams/list' json_query = { "streamTypes": types, "includeInactiveStreams": inactive } req_args = json.dumps(json_query) ...
[ "def", "list_streams", "(", "self", ",", "types", "=", "[", "]", ",", "inactive", "=", "False", ")", ":", "req_hook", "=", "'pod/v1/streams/list'", "json_query", "=", "{", "\"streamTypes\"", ":", "types", ",", "\"includeInactiveStreams\"", ":", "inactive", "}"...
list user streams
[ "list", "user", "streams" ]
python
train
facetoe/zenpy
zenpy/lib/api.py
https://github.com/facetoe/zenpy/blob/34c54c7e408b9ed01604ddf8b3422204c8bf31ea/zenpy/lib/api.py#L1365-L1369
def comments(self, request_id): """ Return comments for request """ return self._query_zendesk(self.endpoint.comments, 'comment', id=request_id)
[ "def", "comments", "(", "self", ",", "request_id", ")", ":", "return", "self", ".", "_query_zendesk", "(", "self", ".", "endpoint", ".", "comments", ",", "'comment'", ",", "id", "=", "request_id", ")" ]
Return comments for request
[ "Return", "comments", "for", "request" ]
python
train
davenquinn/Attitude
attitude/display/plot/__init__.py
https://github.com/davenquinn/Attitude/blob/2ce97b9aba0aa5deedc6617c2315e07e6396d240/attitude/display/plot/__init__.py#L150-L163
def error_asymptotes(pca,**kwargs): """ Plots asymptotic error bounds for hyperbola on a stereonet. """ ax = kwargs.pop("ax",current_axes()) lon,lat = pca.plane_errors('upper', n=1000) ax.plot(lon,lat,'-') lon,lat = pca.plane_errors('lower', n=1000) ax.plot(lon,lat,'-') ax.pla...
[ "def", "error_asymptotes", "(", "pca", ",", "*", "*", "kwargs", ")", ":", "ax", "=", "kwargs", ".", "pop", "(", "\"ax\"", ",", "current_axes", "(", ")", ")", "lon", ",", "lat", "=", "pca", ".", "plane_errors", "(", "'upper'", ",", "n", "=", "1000",...
Plots asymptotic error bounds for hyperbola on a stereonet.
[ "Plots", "asymptotic", "error", "bounds", "for", "hyperbola", "on", "a", "stereonet", "." ]
python
train
apple/turicreate
src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_autovectorizer.py#L645-L671
def fit_transform(self, data): """ Fits and transforms the SFrame `data` using a fitted model. Parameters ---------- data : SFrame The data to be transformed. Returns ------- A transformed SFrame. Returns ------- out...
[ "def", "fit_transform", "(", "self", ",", "data", ")", ":", "self", ".", "_setup_from_data", "(", "data", ")", "ret", "=", "self", ".", "transform_chain", ".", "fit_transform", "(", "data", ")", "self", ".", "__proxy__", ".", "update", "(", "{", "\"fitte...
Fits and transforms the SFrame `data` using a fitted model. Parameters ---------- data : SFrame The data to be transformed. Returns ------- A transformed SFrame. Returns ------- out: SFrame A transformed SFrame. ...
[ "Fits", "and", "transforms", "the", "SFrame", "data", "using", "a", "fitted", "model", "." ]
python
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/load.py
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/load.py#L392-L423
def __load_identities(self, identities, uuid, verbose): """Store identities""" self.log("-- loading identities", verbose) for identity in identities: try: api.add_identity(self.db, identity.source, identity.email, identity.name, iden...
[ "def", "__load_identities", "(", "self", ",", "identities", ",", "uuid", ",", "verbose", ")", ":", "self", ".", "log", "(", "\"-- loading identities\"", ",", "verbose", ")", "for", "identity", "in", "identities", ":", "try", ":", "api", ".", "add_identity", ...
Store identities
[ "Store", "identities" ]
python
train
Azure/azure-sdk-for-python
azure-applicationinsights/azure/applicationinsights/operations/metrics_operations.py
https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-applicationinsights/azure/applicationinsights/operations/metrics_operations.py#L166-L225
def get_multiple( self, app_id, body, custom_headers=None, raw=False, **operation_config): """Retrieve metric data. Gets metric values for multiple metrics. :param app_id: ID of the application. This is Application ID from the API Access settings blade in the Azure portal....
[ "def", "get_multiple", "(", "self", ",", "app_id", ",", "body", ",", "custom_headers", "=", "None", ",", "raw", "=", "False", ",", "*", "*", "operation_config", ")", ":", "# Construct URL", "url", "=", "self", ".", "get_multiple", ".", "metadata", "[", "...
Retrieve metric data. Gets metric values for multiple metrics. :param app_id: ID of the application. This is Application ID from the API Access settings blade in the Azure portal. :type app_id: str :param body: The batched metrics query. :type body: list[~azur...
[ "Retrieve", "metric", "data", "." ]
python
test
atlassian-api/atlassian-python-api
atlassian/jira.py
https://github.com/atlassian-api/atlassian-python-api/blob/540d269905c3e7547b666fe30c647b2d512cf358/atlassian/jira.py#L1037-L1050
def tempo_account_add_customer(self, data=None): """ Gets all or some Attribute whose key or name contain a specific substring. Attributes can be a Category or Customer. :param data: :return: if error will show in error log, like validation unsuccessful. If success will good. ...
[ "def", "tempo_account_add_customer", "(", "self", ",", "data", "=", "None", ")", ":", "if", "data", "is", "None", ":", "return", "\"\"\"Please, set the data as { isNew:boolean\n name:string\n ...
Gets all or some Attribute whose key or name contain a specific substring. Attributes can be a Category or Customer. :param data: :return: if error will show in error log, like validation unsuccessful. If success will good.
[ "Gets", "all", "or", "some", "Attribute", "whose", "key", "or", "name", "contain", "a", "specific", "substring", ".", "Attributes", "can", "be", "a", "Category", "or", "Customer", ".", ":", "param", "data", ":", ":", "return", ":", "if", "error", "will",...
python
train
DistrictDataLabs/yellowbrick
yellowbrick/target/class_balance.py
https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/target/class_balance.py#L249-L302
def class_balance(y_train, y_test=None, ax=None, labels=None, **kwargs): """Quick method: One of the biggest challenges for classification models is an imbalance of classes in the training data. This function vizualizes the relationship of the support for each class in both the training and test data b...
[ "def", "class_balance", "(", "y_train", ",", "y_test", "=", "None", ",", "ax", "=", "None", ",", "labels", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# Instantiate the visualizer", "visualizer", "=", "ClassBalance", "(", "ax", "=", "ax", ",", "labe...
Quick method: One of the biggest challenges for classification models is an imbalance of classes in the training data. This function vizualizes the relationship of the support for each class in both the training and test data by displaying how frequently each class occurs as a bar graph. The figur...
[ "Quick", "method", ":" ]
python
train
wavycloud/pyboto3
pyboto3/appstream.py
https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/appstream.py#L798-L904
def update_fleet(ImageName=None, Name=None, InstanceType=None, ComputeCapacity=None, VpcConfig=None, MaxUserDurationInSeconds=None, DisconnectTimeoutInSeconds=None, DeleteVpcConfig=None, Description=None, DisplayName=None, EnableDefaultInternetAccess=None): """ Updates an existing fleet. All the attributes exce...
[ "def", "update_fleet", "(", "ImageName", "=", "None", ",", "Name", "=", "None", ",", "InstanceType", "=", "None", ",", "ComputeCapacity", "=", "None", ",", "VpcConfig", "=", "None", ",", "MaxUserDurationInSeconds", "=", "None", ",", "DisconnectTimeoutInSeconds",...
Updates an existing fleet. All the attributes except the fleet name can be updated in the STOPPED state. When a fleet is in the RUNNING state, only DisplayName and ComputeCapacity can be updated. A fleet cannot be updated in a status of STARTING or STOPPING . See also: AWS API Documentation :example: ...
[ "Updates", "an", "existing", "fleet", ".", "All", "the", "attributes", "except", "the", "fleet", "name", "can", "be", "updated", "in", "the", "STOPPED", "state", ".", "When", "a", "fleet", "is", "in", "the", "RUNNING", "state", "only", "DisplayName", "and"...
python
train