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
cirruscluster/cirruscluster
cirruscluster/core.py
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/core.py#L618-L634
def __WaitForInstance(instance, desired_state): """ Blocks until instance is in desired_state. """ print 'Waiting for instance %s to change to %s' % (instance.id, desired_state) while True: try: instance.update() state = instance.state sys.stdout.write('.') sys.stdout...
[ "def", "__WaitForInstance", "(", "instance", ",", "desired_state", ")", ":", "print", "'Waiting for instance %s to change to %s'", "%", "(", "instance", ".", "id", ",", "desired_state", ")", "while", "True", ":", "try", ":", "instance", ".", "update", "(", ")", ...
Blocks until instance is in desired_state.
[ "Blocks", "until", "instance", "is", "in", "desired_state", "." ]
python
train
jleclanche/fireplace
fireplace/player.py
https://github.com/jleclanche/fireplace/blob/d0fc0e97e185c0210de86631be20638659c0609e/fireplace/player.py#L168-L175
def get_spell_damage(self, amount: int) -> int: """ Returns the amount of damage \a amount will do, taking SPELLPOWER and SPELLPOWER_DOUBLE into account. """ amount += self.spellpower amount <<= self.controller.spellpower_double return amount
[ "def", "get_spell_damage", "(", "self", ",", "amount", ":", "int", ")", "->", "int", ":", "amount", "+=", "self", ".", "spellpower", "amount", "<<=", "self", ".", "controller", ".", "spellpower_double", "return", "amount" ]
Returns the amount of damage \a amount will do, taking SPELLPOWER and SPELLPOWER_DOUBLE into account.
[ "Returns", "the", "amount", "of", "damage", "\\", "a", "amount", "will", "do", "taking", "SPELLPOWER", "and", "SPELLPOWER_DOUBLE", "into", "account", "." ]
python
train
frejanordsiek/hdf5storage
hdf5storage/__init__.py
https://github.com/frejanordsiek/hdf5storage/blob/539275141dd3a4efbbbfd9bdb978f3ed59e3f05d/hdf5storage/__init__.py#L1855-L1964
def savemat(file_name, mdict, appendmat=True, format='7.3', oned_as='row', store_python_metadata=True, action_for_matlab_incompatible='error', marshaller_collection=None, truncate_existing=False, truncate_invalid_matlab=False, **keywords): """ Save a dictionary of pyt...
[ "def", "savemat", "(", "file_name", ",", "mdict", ",", "appendmat", "=", "True", ",", "format", "=", "'7.3'", ",", "oned_as", "=", "'row'", ",", "store_python_metadata", "=", "True", ",", "action_for_matlab_incompatible", "=", "'error'", ",", "marshaller_collect...
Save a dictionary of python types to a MATLAB MAT file. Saves the data provided in the dictionary `mdict` to a MATLAB MAT file. `format` determines which kind/vesion of file to use. The '7.3' version, which is HDF5 based, is handled by this package and all types that this package can write are supporte...
[ "Save", "a", "dictionary", "of", "python", "types", "to", "a", "MATLAB", "MAT", "file", "." ]
python
train
sepandhaghighi/pycm
pycm/pycm_obj.py
https://github.com/sepandhaghighi/pycm/blob/cb03258afd6a821d10acba73c965aaac174bedcd/pycm/pycm_obj.py#L129-L147
def stat(self, overall_param=None, class_param=None, class_name=None): """ Print statistical measures table. :param overall_param : overall parameters list for print, Example : ["Kappa","Scott PI] :type overall_param : list :param class_param : class parameters list for print, E...
[ "def", "stat", "(", "self", ",", "overall_param", "=", "None", ",", "class_param", "=", "None", ",", "class_name", "=", "None", ")", ":", "classes", "=", "class_filter", "(", "self", ".", "classes", ",", "class_name", ")", "print", "(", "stat_print", "("...
Print statistical measures table. :param overall_param : overall parameters list for print, Example : ["Kappa","Scott PI] :type overall_param : list :param class_param : class parameters list for print, Example : ["TPR","TNR","AUC"] :type class_param : list :param class_name : c...
[ "Print", "statistical", "measures", "table", "." ]
python
train
lbusoni/plico
plico/utils/zernike_generator.py
https://github.com/lbusoni/plico/blob/08a29da8f06e920470516838878a51ac83bab847/plico/utils/zernike_generator.py#L126-L142
def getZernike(self, index): """getZernike Retrieve a map representing the index-th Zernike polynomial Args: index (int): The index of Zernike map to be generated, following Noll 1976 ordering. Returns: np.array: A map representing the index-th ...
[ "def", "getZernike", "(", "self", ",", "index", ")", ":", "if", "index", "not", "in", "list", "(", "self", ".", "_dictCache", ".", "keys", "(", ")", ")", ":", "self", ".", "_dictCache", "[", "index", "]", "=", "self", ".", "_polar", "(", "index", ...
getZernike Retrieve a map representing the index-th Zernike polynomial Args: index (int): The index of Zernike map to be generated, following Noll 1976 ordering. Returns: np.array: A map representing the index-th Zernike polynomial
[ "getZernike" ]
python
train
saltstack/salt
salt/modules/restartcheck.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/restartcheck.py#L360-L384
def _file_changed_nilrt(full_filepath): ''' Detect whether a file changed in an NILinuxRT system using md5sum and timestamp files from a state directory. Returns: - False if md5sum/timestamp state files don't exist - True/False depending if ``base_filename`` got modified/touch...
[ "def", "_file_changed_nilrt", "(", "full_filepath", ")", ":", "rs_state_dir", "=", "\"/var/lib/salt/restartcheck_state\"", "base_filename", "=", "os", ".", "path", ".", "basename", "(", "full_filepath", ")", "timestamp_file", "=", "os", ".", "path", ".", "join", "...
Detect whether a file changed in an NILinuxRT system using md5sum and timestamp files from a state directory. Returns: - False if md5sum/timestamp state files don't exist - True/False depending if ``base_filename`` got modified/touched
[ "Detect", "whether", "a", "file", "changed", "in", "an", "NILinuxRT", "system", "using", "md5sum", "and", "timestamp", "files", "from", "a", "state", "directory", "." ]
python
train
fastmonkeys/stellar
stellar/command.py
https://github.com/fastmonkeys/stellar/blob/79f0353563c35fa6ae46a2f00886ab1dd31c4492/stellar/command.py#L171-L182
def replace(name): """Replaces a snapshot""" app = get_app() snapshot = app.get_snapshot(name) if not snapshot: click.echo("Couldn't find snapshot %s" % name) sys.exit(1) app.remove_snapshot(snapshot) app.create_snapshot(name) click.echo("Replaced snapshot %s" % name)
[ "def", "replace", "(", "name", ")", ":", "app", "=", "get_app", "(", ")", "snapshot", "=", "app", ".", "get_snapshot", "(", "name", ")", "if", "not", "snapshot", ":", "click", ".", "echo", "(", "\"Couldn't find snapshot %s\"", "%", "name", ")", "sys", ...
Replaces a snapshot
[ "Replaces", "a", "snapshot" ]
python
test
idmillington/layout
layout/managers/grid.py
https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/managers/grid.py#L98-L118
def _compile_dimension_size(self, base_index, array, property, sized_elements): """Build one set of col widths or row heights.""" sort_index = base_index + 2 sized_elements.sort(key=lambda x: x[sort_index]) for element_data in sized_elements: s...
[ "def", "_compile_dimension_size", "(", "self", ",", "base_index", ",", "array", ",", "property", ",", "sized_elements", ")", ":", "sort_index", "=", "base_index", "+", "2", "sized_elements", ".", "sort", "(", "key", "=", "lambda", "x", ":", "x", "[", "sort...
Build one set of col widths or row heights.
[ "Build", "one", "set", "of", "col", "widths", "or", "row", "heights", "." ]
python
train
Visgean/urljects
urljects/patterns.py
https://github.com/Visgean/urljects/blob/29a3ca03f639ea7a9ee2f795ed17941c86b278ba/urljects/patterns.py#L22-L40
def render(value): """ This function finishes the url pattern creation by adding starting character ^ end possibly by adding end character at the end :param value: naive URL value :return: raw string """ # Empty urls if not value: # use case: wild card imports return r'^$' ...
[ "def", "render", "(", "value", ")", ":", "# Empty urls", "if", "not", "value", ":", "# use case: wild card imports", "return", "r'^$'", "if", "value", "[", "0", "]", "!=", "beginning", ":", "value", "=", "beginning", "+", "value", "if", "value", "[", "-", ...
This function finishes the url pattern creation by adding starting character ^ end possibly by adding end character at the end :param value: naive URL value :return: raw string
[ "This", "function", "finishes", "the", "url", "pattern", "creation", "by", "adding", "starting", "character", "^", "end", "possibly", "by", "adding", "end", "character", "at", "the", "end" ]
python
train
riga/tfdeploy
tfdeploy.py
https://github.com/riga/tfdeploy/blob/8481f657d6e3a51d76185a195b993e45f448828a/tfdeploy.py#L1114-L1118
def Rank(a): """ Rank op. """ return np.array([len(a.shape)], dtype=np.int32),
[ "def", "Rank", "(", "a", ")", ":", "return", "np", ".", "array", "(", "[", "len", "(", "a", ".", "shape", ")", "]", ",", "dtype", "=", "np", ".", "int32", ")", "," ]
Rank op.
[ "Rank", "op", "." ]
python
train
KeithSSmith/switcheo-python
switcheo/neo/signatures.py
https://github.com/KeithSSmith/switcheo-python/blob/22f943dea1ad7d692b2bfcd9f0822ec80f4641a6/switcheo/neo/signatures.py#L69-L99
def sign_create_deposit(deposit_params, key_pair): """ Function to create a deposit request by generating a transaction request from the Switcheo API. Execution of this function is as follows:: sign_create_deposit(deposit_details=create_deposit, key_pair=key_pair) The expected return result fo...
[ "def", "sign_create_deposit", "(", "deposit_params", ",", "key_pair", ")", ":", "encoded_message", "=", "encode_message", "(", "deposit_params", ")", "create_params", "=", "deposit_params", ".", "copy", "(", ")", "create_params", "[", "'address'", "]", "=", "neo_g...
Function to create a deposit request by generating a transaction request from the Switcheo API. Execution of this function is as follows:: sign_create_deposit(deposit_details=create_deposit, key_pair=key_pair) The expected return result for this function is as follows:: { 'blockch...
[ "Function", "to", "create", "a", "deposit", "request", "by", "generating", "a", "transaction", "request", "from", "the", "Switcheo", "API", ".", "Execution", "of", "this", "function", "is", "as", "follows", "::" ]
python
train
ultrabug/py3status
py3status/storage.py
https://github.com/ultrabug/py3status/blob/4c105f1b44f7384ca4f7da5f821a47e468c7dee2/py3status/storage.py#L66-L77
def get_legacy_storage_path(self): """ Detect and return existing legacy storage path. """ config_dir = os.path.dirname( self.py3_wrapper.config.get("i3status_config_path", "/tmp") ) storage_path = os.path.join(config_dir, "py3status.data") if os.path....
[ "def", "get_legacy_storage_path", "(", "self", ")", ":", "config_dir", "=", "os", ".", "path", ".", "dirname", "(", "self", ".", "py3_wrapper", ".", "config", ".", "get", "(", "\"i3status_config_path\"", ",", "\"/tmp\"", ")", ")", "storage_path", "=", "os", ...
Detect and return existing legacy storage path.
[ "Detect", "and", "return", "existing", "legacy", "storage", "path", "." ]
python
train
rhjdjong/SlipLib
sliplib/slip.py
https://github.com/rhjdjong/SlipLib/blob/8300dba3e512bca282380f234be34d75f4a73ce1/sliplib/slip.py#L43-L60
def decode(packet): """decode(packet) -> message from SLIP-encoded packet Retrieves the message from the SLIP-encoded packet. :param bytes packet: The SLIP-encoded message. Note that this must be exactly one complete packet. The :func:`decode` function does not provide any buf...
[ "def", "decode", "(", "packet", ")", ":", "packet", "=", "bytes", "(", "packet", ")", ".", "strip", "(", "END", ")", "if", "not", "is_valid", "(", "packet", ")", ":", "raise", "ProtocolError", "(", "packet", ")", "return", "packet", ".", "strip", "("...
decode(packet) -> message from SLIP-encoded packet Retrieves the message from the SLIP-encoded packet. :param bytes packet: The SLIP-encoded message. Note that this must be exactly one complete packet. The :func:`decode` function does not provide any buffering for incom...
[ "decode", "(", "packet", ")", "-", ">", "message", "from", "SLIP", "-", "encoded", "packet", "Retrieves", "the", "message", "from", "the", "SLIP", "-", "encoded", "packet", ".", ":", "param", "bytes", "packet", ":", "The", "SLIP", "-", "encoded", "messag...
python
train
ska-sa/katcp-python
katcp/client.py
https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L241-L245
def _next_id(self): """Return the next available message id.""" assert get_thread_ident() == self.ioloop_thread_id self._last_msg_id += 1 return str(self._last_msg_id)
[ "def", "_next_id", "(", "self", ")", ":", "assert", "get_thread_ident", "(", ")", "==", "self", ".", "ioloop_thread_id", "self", ".", "_last_msg_id", "+=", "1", "return", "str", "(", "self", ".", "_last_msg_id", ")" ]
Return the next available message id.
[ "Return", "the", "next", "available", "message", "id", "." ]
python
train
mosdef-hub/foyer
foyer/smarts_graph.py
https://github.com/mosdef-hub/foyer/blob/9e39c71208fc01a6cc7b7cbe5a533c56830681d3/foyer/smarts_graph.py#L57-L75
def _add_edges(self, ast_node, trunk=None): """"Add all bonds in the SMARTS string as edges in the graph.""" atom_indices = self._atom_indices for atom in ast_node.tail: if atom.head == 'atom': atom_idx = atom_indices[id(atom)] if atom.is_first_kid and...
[ "def", "_add_edges", "(", "self", ",", "ast_node", ",", "trunk", "=", "None", ")", ":", "atom_indices", "=", "self", ".", "_atom_indices", "for", "atom", "in", "ast_node", ".", "tail", ":", "if", "atom", ".", "head", "==", "'atom'", ":", "atom_idx", "=...
Add all bonds in the SMARTS string as edges in the graph.
[ "Add", "all", "bonds", "in", "the", "SMARTS", "string", "as", "edges", "in", "the", "graph", "." ]
python
train
poppy-project/pypot
pypot/vrep/remoteApiBindings/vrep.py
https://github.com/poppy-project/pypot/blob/d9c6551bbc87d45d9d1f0bc15e35b616d0002afd/pypot/vrep/remoteApiBindings/vrep.py#L1102-L1107
def simxSetObjectFloatParameter(clientID, objectHandle, parameterID, parameterValue, operationMode): ''' Please have a look at the function description/documentation in the V-REP user manual ''' return c_SetObjectFloatParameter(clientID, objectHandle, parameterID, parameterValue, operationMode)
[ "def", "simxSetObjectFloatParameter", "(", "clientID", ",", "objectHandle", ",", "parameterID", ",", "parameterValue", ",", "operationMode", ")", ":", "return", "c_SetObjectFloatParameter", "(", "clientID", ",", "objectHandle", ",", "parameterID", ",", "parameterValue",...
Please have a look at the function description/documentation in the V-REP user manual
[ "Please", "have", "a", "look", "at", "the", "function", "description", "/", "documentation", "in", "the", "V", "-", "REP", "user", "manual" ]
python
train
authomatic/authomatic
authomatic/providers/__init__.py
https://github.com/authomatic/authomatic/blob/90a9ce60cc405ae8a2bf5c3713acd5d78579a04e/authomatic/providers/__init__.py#L315-L333
def csrf_generator(secret): """ Generates CSRF token. Inspired by this article: http://blog.ptsecurity.com/2012/10/random-number-security-in-python.html :returns: :class:`str` Random unguessable string. """ # Create hash from random string plus sal...
[ "def", "csrf_generator", "(", "secret", ")", ":", "# Create hash from random string plus salt.", "hashed", "=", "hashlib", ".", "md5", "(", "uuid", ".", "uuid4", "(", ")", ".", "bytes", "+", "six", ".", "b", "(", "secret", ")", ")", ".", "hexdigest", "(", ...
Generates CSRF token. Inspired by this article: http://blog.ptsecurity.com/2012/10/random-number-security-in-python.html :returns: :class:`str` Random unguessable string.
[ "Generates", "CSRF", "token", "." ]
python
test
Timusan/wtforms-dynamic-fields
wtforms_dynamic_fields/wtforms_dynamic_fields.py
https://github.com/Timusan/wtforms-dynamic-fields/blob/d984a646075219a6f8a0e931c96035ca3e44be56/wtforms_dynamic_fields/wtforms_dynamic_fields.py#L90-L214
def process(self, form, post): """ Process the given WTForm Form object. Itterate over the POST values and check each field against the configuration that was made. For each field that is valid, check all the validator parameters for possible %field% replacement, then bind ...
[ "def", "process", "(", "self", ",", "form", ",", "post", ")", ":", "if", "not", "isinstance", "(", "form", ",", "FormMeta", ")", ":", "raise", "TypeError", "(", "'Given form is not a valid WTForm.'", ")", "re_field_name", "=", "re", ".", "compile", "(", "r...
Process the given WTForm Form object. Itterate over the POST values and check each field against the configuration that was made. For each field that is valid, check all the validator parameters for possible %field% replacement, then bind these parameters to their validator. ...
[ "Process", "the", "given", "WTForm", "Form", "object", "." ]
python
train
projectatomic/atomic-reactor
atomic_reactor/plugins/exit_koji_promote.py
https://github.com/projectatomic/atomic-reactor/blob/fd31c01b964097210bf169960d051e5f04019a80/atomic_reactor/plugins/exit_koji_promote.py#L142-L180
def get_rpms(self): """ Build a list of installed RPMs in the format required for the metadata. """ tags = [ 'NAME', 'VERSION', 'RELEASE', 'ARCH', 'EPOCH', 'SIGMD5', 'SIGPGP:pgpsig', ...
[ "def", "get_rpms", "(", "self", ")", ":", "tags", "=", "[", "'NAME'", ",", "'VERSION'", ",", "'RELEASE'", ",", "'ARCH'", ",", "'EPOCH'", ",", "'SIGMD5'", ",", "'SIGPGP:pgpsig'", ",", "'SIGGPG:pgpsig'", ",", "]", "cmd", "=", "\"/bin/rpm \"", "+", "rpm_qf_ar...
Build a list of installed RPMs in the format required for the metadata.
[ "Build", "a", "list", "of", "installed", "RPMs", "in", "the", "format", "required", "for", "the", "metadata", "." ]
python
train
python-xlib/python-xlib
Xlib/display.py
https://github.com/python-xlib/python-xlib/blob/8901e831737e79fe5645f48089d70e1d1046d2f2/Xlib/display.py#L835-L842
def set_screen_saver(self, timeout, interval, prefer_blank, allow_exposures, onerror = None): """See XSetScreenSaver(3X11).""" request.SetScreenSaver(display = self.display, onerror = onerror, timeout = timeout, ...
[ "def", "set_screen_saver", "(", "self", ",", "timeout", ",", "interval", ",", "prefer_blank", ",", "allow_exposures", ",", "onerror", "=", "None", ")", ":", "request", ".", "SetScreenSaver", "(", "display", "=", "self", ".", "display", ",", "onerror", "=", ...
See XSetScreenSaver(3X11).
[ "See", "XSetScreenSaver", "(", "3X11", ")", "." ]
python
train
python-cmd2/cmd2
cmd2/utils.py
https://github.com/python-cmd2/cmd2/blob/b22c0bd891ed08c8b09df56df9d91f48166a5e2a/cmd2/utils.py#L211-L223
def alphabetical_sort(list_to_sort: Iterable[str]) -> List[str]: """Sorts a list of strings alphabetically. For example: ['a1', 'A11', 'A2', 'a22', 'a3'] To sort a list in place, don't call this method, which makes a copy. Instead, do this: my_list.sort(key=norm_fold) :param list_to_sort: the li...
[ "def", "alphabetical_sort", "(", "list_to_sort", ":", "Iterable", "[", "str", "]", ")", "->", "List", "[", "str", "]", ":", "return", "sorted", "(", "list_to_sort", ",", "key", "=", "norm_fold", ")" ]
Sorts a list of strings alphabetically. For example: ['a1', 'A11', 'A2', 'a22', 'a3'] To sort a list in place, don't call this method, which makes a copy. Instead, do this: my_list.sort(key=norm_fold) :param list_to_sort: the list being sorted :return: the sorted list
[ "Sorts", "a", "list", "of", "strings", "alphabetically", "." ]
python
train
mojaie/chorus
chorus/molutil.py
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/molutil.py#L117-L120
def rotatable_count(mol): """Rotatable bond count """ mol.require("Rotatable") return sum(1 for _, _, b in mol.bonds_iter() if b.rotatable)
[ "def", "rotatable_count", "(", "mol", ")", ":", "mol", ".", "require", "(", "\"Rotatable\"", ")", "return", "sum", "(", "1", "for", "_", ",", "_", ",", "b", "in", "mol", ".", "bonds_iter", "(", ")", "if", "b", ".", "rotatable", ")" ]
Rotatable bond count
[ "Rotatable", "bond", "count" ]
python
train
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_retriever.py
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/metadata_scripts/script_retriever.py#L94-L116
def _DownloadUrl(self, url, dest_dir): """Download a script from a given URL. Args: url: string, the URL to download. dest_dir: string, the path to a directory for storing metadata scripts. Returns: string, the path to the file storing the metadata script. """ dest_file = tempfil...
[ "def", "_DownloadUrl", "(", "self", ",", "url", ",", "dest_dir", ")", ":", "dest_file", "=", "tempfile", ".", "NamedTemporaryFile", "(", "dir", "=", "dest_dir", ",", "delete", "=", "False", ")", "dest_file", ".", "close", "(", ")", "dest", "=", "dest_fil...
Download a script from a given URL. Args: url: string, the URL to download. dest_dir: string, the path to a directory for storing metadata scripts. Returns: string, the path to the file storing the metadata script.
[ "Download", "a", "script", "from", "a", "given", "URL", "." ]
python
train
onecodex/onecodex
onecodex/viz/_bargraph.py
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/viz/_bargraph.py#L6-L202
def plot_bargraph( self, rank="auto", normalize="auto", top_n="auto", threshold="auto", title=None, xlabel=None, ylabel=None, tooltip=None, return_chart=False, haxis=None, legend="auto", label=None, ): ""...
[ "def", "plot_bargraph", "(", "self", ",", "rank", "=", "\"auto\"", ",", "normalize", "=", "\"auto\"", ",", "top_n", "=", "\"auto\"", ",", "threshold", "=", "\"auto\"", ",", "title", "=", "None", ",", "xlabel", "=", "None", ",", "ylabel", "=", "None", "...
Plot a bargraph of relative abundance of taxa for multiple samples. Parameters ---------- rank : {'auto', 'kingdom', 'phylum', 'class', 'order', 'family', 'genus', 'species'}, optional Analysis will be restricted to abundances of taxa at the specified level. normalize : 'aut...
[ "Plot", "a", "bargraph", "of", "relative", "abundance", "of", "taxa", "for", "multiple", "samples", "." ]
python
train
IdentityPython/pysaml2
src/saml2/mdstore.py
https://github.com/IdentityPython/pysaml2/blob/d3aa78eeb7d37c12688f783cb4db1c7263a14ad6/src/saml2/mdstore.py#L747-L758
def load(self, *args, **kwargs): """ Imports metadata by the use of HTTP GET. If the fingerprint is known the file will be checked for compliance before it is imported. """ response = self.http.send(self.url) if response.status_code == 200: _txt = response.con...
[ "def", "load", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "response", "=", "self", ".", "http", ".", "send", "(", "self", ".", "url", ")", "if", "response", ".", "status_code", "==", "200", ":", "_txt", "=", "response", "."...
Imports metadata by the use of HTTP GET. If the fingerprint is known the file will be checked for compliance before it is imported.
[ "Imports", "metadata", "by", "the", "use", "of", "HTTP", "GET", ".", "If", "the", "fingerprint", "is", "known", "the", "file", "will", "be", "checked", "for", "compliance", "before", "it", "is", "imported", "." ]
python
train
jazzband/django-pipeline
pipeline/compressors/__init__.py
https://github.com/jazzband/django-pipeline/blob/3cd2f93bb47bf8d34447e13ff691f7027e7b07a2/pipeline/compressors/__init__.py#L58-L71
def compress_js(self, paths, templates=None, **kwargs): """Concatenate and compress JS files""" js = self.concatenate(paths) if templates: js = js + self.compile_templates(templates) if not settings.DISABLE_WRAPPER: js = settings.JS_WRAPPER % js compress...
[ "def", "compress_js", "(", "self", ",", "paths", ",", "templates", "=", "None", ",", "*", "*", "kwargs", ")", ":", "js", "=", "self", ".", "concatenate", "(", "paths", ")", "if", "templates", ":", "js", "=", "js", "+", "self", ".", "compile_templates...
Concatenate and compress JS files
[ "Concatenate", "and", "compress", "JS", "files" ]
python
train
nakagami/pyfirebirdsql
firebirdsql/utils.py
https://github.com/nakagami/pyfirebirdsql/blob/5ce366c2fc8318510444f4a89801442f3e9e52ca/firebirdsql/utils.py#L43-L50
def hex_to_bytes(s): """ convert hex string to bytes """ if len(s) % 2: s = b'0' + s ia = [int(s[i:i+2], 16) for i in range(0, len(s), 2)] # int array return bs(ia) if PYTHON_MAJOR_VER == 3 else b''.join([chr(c) for c in ia])
[ "def", "hex_to_bytes", "(", "s", ")", ":", "if", "len", "(", "s", ")", "%", "2", ":", "s", "=", "b'0'", "+", "s", "ia", "=", "[", "int", "(", "s", "[", "i", ":", "i", "+", "2", "]", ",", "16", ")", "for", "i", "in", "range", "(", "0", ...
convert hex string to bytes
[ "convert", "hex", "string", "to", "bytes" ]
python
train
mitsei/dlkit
dlkit/json_/assessment/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/sessions.py#L9221-L9240
def is_descendant_of_bank(self, id_, bank_id): """Tests if an ``Id`` is a descendant of a bank. arg: id (osid.id.Id): an ``Id`` arg: bank_id (osid.id.Id): the ``Id`` of a bank return: (boolean) - ``true`` if the ``id`` is a descendant of the ``bank_id,`` ``false``...
[ "def", "is_descendant_of_bank", "(", "self", ",", "id_", ",", "bank_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.is_descendant_of_bin", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_ca...
Tests if an ``Id`` is a descendant of a bank. arg: id (osid.id.Id): an ``Id`` arg: bank_id (osid.id.Id): the ``Id`` of a bank return: (boolean) - ``true`` if the ``id`` is a descendant of the ``bank_id,`` ``false`` otherwise raise: NotFound - ``bank_id`` not foun...
[ "Tests", "if", "an", "Id", "is", "a", "descendant", "of", "a", "bank", "." ]
python
train
Titan-C/slaveparticles
slaveparticles/utils/plotter.py
https://github.com/Titan-C/slaveparticles/blob/e4c2f5afb1a7b195517ef2f1b5cc758965036aab/slaveparticles/utils/plotter.py#L120-L139
def plot_mean_field_conv(N=1, n=0.5, Uspan=np.arange(0, 3.6, 0.5)): """Generates the plot on the convergenge of the mean field in single site spin hamiltonian under with N degenerate half-filled orbitals """ sl = Spinon(slaves=2*N, orbitals=N, avg_particles=2*n, hopping=[0.5]*2*N,...
[ "def", "plot_mean_field_conv", "(", "N", "=", "1", ",", "n", "=", "0.5", ",", "Uspan", "=", "np", ".", "arange", "(", "0", ",", "3.6", ",", "0.5", ")", ")", ":", "sl", "=", "Spinon", "(", "slaves", "=", "2", "*", "N", ",", "orbitals", "=", "N...
Generates the plot on the convergenge of the mean field in single site spin hamiltonian under with N degenerate half-filled orbitals
[ "Generates", "the", "plot", "on", "the", "convergenge", "of", "the", "mean", "field", "in", "single", "site", "spin", "hamiltonian", "under", "with", "N", "degenerate", "half", "-", "filled", "orbitals" ]
python
train
ModisWorks/modis
modis/discord_modis/main.py
https://github.com/ModisWorks/modis/blob/1f1225c9841835ec1d1831fc196306527567db8b/modis/discord_modis/main.py#L110-L180
def _get_event_handlers(): """ Gets dictionary of event handlers and the modules that define them Returns: event_handlers (dict): Contains "all", "on_ready", "on_message", "on_reaction_add", "on_error" """ import os import importlib event_handlers = { "on_ready": [], ...
[ "def", "_get_event_handlers", "(", ")", ":", "import", "os", "import", "importlib", "event_handlers", "=", "{", "\"on_ready\"", ":", "[", "]", ",", "\"on_resume\"", ":", "[", "]", ",", "\"on_error\"", ":", "[", "]", ",", "\"on_message\"", ":", "[", "]", ...
Gets dictionary of event handlers and the modules that define them Returns: event_handlers (dict): Contains "all", "on_ready", "on_message", "on_reaction_add", "on_error"
[ "Gets", "dictionary", "of", "event", "handlers", "and", "the", "modules", "that", "define", "them" ]
python
train
smarie/python-parsyfiles
parsyfiles/plugins_base/support_for_configparser.py
https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/plugins_base/support_for_configparser.py#L30-L39
def get_default_config_parsers() -> List[AnyParser]: """ Utility method to return the default parsers able to parse a dictionary from a file. :return: """ return [SingleFileParserFunction(parser_function=read_config, streaming_mode=True, ...
[ "def", "get_default_config_parsers", "(", ")", "->", "List", "[", "AnyParser", "]", ":", "return", "[", "SingleFileParserFunction", "(", "parser_function", "=", "read_config", ",", "streaming_mode", "=", "True", ",", "supported_exts", "=", "{", "'.cfg'", ",", "'...
Utility method to return the default parsers able to parse a dictionary from a file. :return:
[ "Utility", "method", "to", "return", "the", "default", "parsers", "able", "to", "parse", "a", "dictionary", "from", "a", "file", ".", ":", "return", ":" ]
python
train
smarie/python-parsyfiles
parsyfiles/plugins_optional/support_for_jprops.py
https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/plugins_optional/support_for_jprops.py#L11-L34
def try_parse_num_and_booleans(num_str): """ Tries to parse the provided string as a number or boolean :param num_str: :return: """ if isinstance(num_str, str): # bool if num_str.lower() == 'true': return True elif num_str.lower() == 'false': retur...
[ "def", "try_parse_num_and_booleans", "(", "num_str", ")", ":", "if", "isinstance", "(", "num_str", ",", "str", ")", ":", "# bool", "if", "num_str", ".", "lower", "(", ")", "==", "'true'", ":", "return", "True", "elif", "num_str", ".", "lower", "(", ")", ...
Tries to parse the provided string as a number or boolean :param num_str: :return:
[ "Tries", "to", "parse", "the", "provided", "string", "as", "a", "number", "or", "boolean", ":", "param", "num_str", ":", ":", "return", ":" ]
python
train
Qiskit/qiskit-terra
qiskit/quantum_info/operators/predicates.py
https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/quantum_info/operators/predicates.py#L86-L95
def is_symmetric_matrix(op, rtol=RTOL_DEFAULT, atol=ATOL_DEFAULT): """Test if an array is a symmetrix matrix""" if atol is None: atol = ATOL_DEFAULT if rtol is None: rtol = RTOL_DEFAULT mat = np.array(op) if mat.ndim != 2: return False return np.allclose(mat, mat.T, rtol=...
[ "def", "is_symmetric_matrix", "(", "op", ",", "rtol", "=", "RTOL_DEFAULT", ",", "atol", "=", "ATOL_DEFAULT", ")", ":", "if", "atol", "is", "None", ":", "atol", "=", "ATOL_DEFAULT", "if", "rtol", "is", "None", ":", "rtol", "=", "RTOL_DEFAULT", "mat", "=",...
Test if an array is a symmetrix matrix
[ "Test", "if", "an", "array", "is", "a", "symmetrix", "matrix" ]
python
test
JoeVirtual/KonFoo
konfoo/core.py
https://github.com/JoeVirtual/KonFoo/blob/0c62ef5c2bed4deaf908b34082e4de2544532fdc/konfoo/core.py#L5276-L5299
def initialize_fields(self, content): """ Initializes the `Pointer` field itself and the :class:`Field` items in the :attr:`data` object referenced by the `Pointer` field with the *values* in the *content* dictionary. The ``['value']`` key in the *content* dictionary refers to the `Poin...
[ "def", "initialize_fields", "(", "self", ",", "content", ")", ":", "for", "name", ",", "value", "in", "content", ".", "items", "(", ")", ":", "if", "name", "is", "'value'", ":", "self", ".", "value", "=", "value", "elif", "name", "is", "'data'", ":",...
Initializes the `Pointer` field itself and the :class:`Field` items in the :attr:`data` object referenced by the `Pointer` field with the *values* in the *content* dictionary. The ``['value']`` key in the *content* dictionary refers to the `Pointer` field itself and the ``['data']`` key...
[ "Initializes", "the", "Pointer", "field", "itself", "and", "the", ":", "class", ":", "Field", "items", "in", "the", ":", "attr", ":", "data", "object", "referenced", "by", "the", "Pointer", "field", "with", "the", "*", "values", "*", "in", "the", "*", ...
python
train
solvebio/solvebio-python
solvebio/resource/apiresource.py
https://github.com/solvebio/solvebio-python/blob/b29614643043afd19c1d8074e8f25c6700d51a73/solvebio/resource/apiresource.py#L54-L65
def instance_url(self): """Get instance URL by ID""" id_ = self.get(self.ID_ATTR) base = self.class_url() if id_: return '/'.join([base, six.text_type(id_)]) else: raise Exception( 'Could not determine which URL to request: %s instance ' ...
[ "def", "instance_url", "(", "self", ")", ":", "id_", "=", "self", ".", "get", "(", "self", ".", "ID_ATTR", ")", "base", "=", "self", ".", "class_url", "(", ")", "if", "id_", ":", "return", "'/'", ".", "join", "(", "[", "base", ",", "six", ".", ...
Get instance URL by ID
[ "Get", "instance", "URL", "by", "ID" ]
python
test
materialsproject/pymatgen
pymatgen/analysis/transition_state.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/transition_state.py#L108-L151
def from_outcars(cls, outcars, structures, **kwargs): """ Initializes an NEBAnalysis from Outcar and Structure objects. Use the static constructors, e.g., :class:`from_dir` instead if you prefer to have these automatically generated from a directory of NEB calculations. ...
[ "def", "from_outcars", "(", "cls", ",", "outcars", ",", "structures", ",", "*", "*", "kwargs", ")", ":", "if", "len", "(", "outcars", ")", "!=", "len", "(", "structures", ")", ":", "raise", "ValueError", "(", "\"# of Outcars must be same as # of Structures\"",...
Initializes an NEBAnalysis from Outcar and Structure objects. Use the static constructors, e.g., :class:`from_dir` instead if you prefer to have these automatically generated from a directory of NEB calculations. Args: outcars ([Outcar]): List of Outcar objects. Note that th...
[ "Initializes", "an", "NEBAnalysis", "from", "Outcar", "and", "Structure", "objects", ".", "Use", "the", "static", "constructors", "e", ".", "g", ".", ":", "class", ":", "from_dir", "instead", "if", "you", "prefer", "to", "have", "these", "automatically", "ge...
python
train
rueckstiess/mtools
mtools/mlaunch/mlaunch.py
https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/mlaunch/mlaunch.py#L113-L144
def shutdown_host(port, username=None, password=None, authdb=None): """ Send the shutdown command to a mongod or mongos on given port. This function can be called as a separate thread. """ host = 'localhost:%i' % port try: mc = MongoConnection(host) try: if username ...
[ "def", "shutdown_host", "(", "port", ",", "username", "=", "None", ",", "password", "=", "None", ",", "authdb", "=", "None", ")", ":", "host", "=", "'localhost:%i'", "%", "port", "try", ":", "mc", "=", "MongoConnection", "(", "host", ")", "try", ":", ...
Send the shutdown command to a mongod or mongos on given port. This function can be called as a separate thread.
[ "Send", "the", "shutdown", "command", "to", "a", "mongod", "or", "mongos", "on", "given", "port", "." ]
python
train
buildbot/buildbot
master/buildbot/schedulers/forcesched.py
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/schedulers/forcesched.py#L180-L182
def updateFromKwargs(self, properties, kwargs, collector, **unused): """Primary entry point to turn 'kwargs' into 'properties'""" properties[self.name] = self.getFromKwargs(kwargs)
[ "def", "updateFromKwargs", "(", "self", ",", "properties", ",", "kwargs", ",", "collector", ",", "*", "*", "unused", ")", ":", "properties", "[", "self", ".", "name", "]", "=", "self", ".", "getFromKwargs", "(", "kwargs", ")" ]
Primary entry point to turn 'kwargs' into 'properties
[ "Primary", "entry", "point", "to", "turn", "kwargs", "into", "properties" ]
python
train
mulkieran/justbases
src/justbases/_rationals.py
https://github.com/mulkieran/justbases/blob/dd52ff4b3d11609f54b2673599ee4eeb20f9734f/src/justbases/_rationals.py#L208-L261
def _validate( # pylint: disable=too-many-arguments cls, sign, integer_part, non_repeating_part, repeating_part, base ): """ Check if radix is valid. :param int sign: -1, 0, or 1 as appropriate :param integer_part: the part on the left...
[ "def", "_validate", "(", "# pylint: disable=too-many-arguments", "cls", ",", "sign", ",", "integer_part", ",", "non_repeating_part", ",", "repeating_part", ",", "base", ")", ":", "if", "any", "(", "x", "<", "0", "or", "x", ">=", "base", "for", "x", "in", "...
Check if radix is valid. :param int sign: -1, 0, or 1 as appropriate :param integer_part: the part on the left side of the radix :type integer_part: list of int :param non_repeating_part: non repeating part on left side :type non_repeating_part: list of int :param repeat...
[ "Check", "if", "radix", "is", "valid", "." ]
python
train
brandonxiang/geojson-python-utils
geojson_utils/geojson_utils.py
https://github.com/brandonxiang/geojson-python-utils/blob/33d0dcd5f16e0567b48c0d49fd292a4f1db16b41/geojson_utils/geojson_utils.py#L126-L143
def point_in_multipolygon(point, multipoly): """ valid whether the point is located in a mulitpolygon (donut polygon is not supported) Keyword arguments: point -- point geojson object multipoly -- multipolygon geojson object if(point inside multipoly) return true else false """ c...
[ "def", "point_in_multipolygon", "(", "point", ",", "multipoly", ")", ":", "coords_array", "=", "[", "multipoly", "[", "'coordinates'", "]", "]", "if", "multipoly", "[", "'type'", "]", "==", "\"MultiPolygon\"", "else", "multipoly", "[", "'coordinates'", "]", "f...
valid whether the point is located in a mulitpolygon (donut polygon is not supported) Keyword arguments: point -- point geojson object multipoly -- multipolygon geojson object if(point inside multipoly) return true else false
[ "valid", "whether", "the", "point", "is", "located", "in", "a", "mulitpolygon", "(", "donut", "polygon", "is", "not", "supported", ")" ]
python
train
ynop/audiomate
audiomate/corpus/validation/label_list.py
https://github.com/ynop/audiomate/blob/61727920b23a708293c3d526fa3000d4de9c6c21/audiomate/corpus/validation/label_list.py#L188-L216
def validate_utterance(self, utterance): """ Validate the given utterance and return a list of uncovered segments (start, end). """ uncovered_segments = [] if self.label_list_idx in utterance.label_lists.keys(): start = 0 end = utterance.duration ...
[ "def", "validate_utterance", "(", "self", ",", "utterance", ")", ":", "uncovered_segments", "=", "[", "]", "if", "self", ".", "label_list_idx", "in", "utterance", ".", "label_lists", ".", "keys", "(", ")", ":", "start", "=", "0", "end", "=", "utterance", ...
Validate the given utterance and return a list of uncovered segments (start, end).
[ "Validate", "the", "given", "utterance", "and", "return", "a", "list", "of", "uncovered", "segments", "(", "start", "end", ")", "." ]
python
train
trailofbits/manticore
manticore/native/cpu/x86.py
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L3434-L3441
def JP(cpu, target): """ Jumps short if parity. :param cpu: current CPU. :param target: destination operand. """ cpu.PC = Operators.ITEBV(cpu.address_bit_size, cpu.PF, target.read(), cpu.PC)
[ "def", "JP", "(", "cpu", ",", "target", ")", ":", "cpu", ".", "PC", "=", "Operators", ".", "ITEBV", "(", "cpu", ".", "address_bit_size", ",", "cpu", ".", "PF", ",", "target", ".", "read", "(", ")", ",", "cpu", ".", "PC", ")" ]
Jumps short if parity. :param cpu: current CPU. :param target: destination operand.
[ "Jumps", "short", "if", "parity", "." ]
python
valid
ereOn/azmq
azmq/context.py
https://github.com/ereOn/azmq/blob/9f40d6d721eea7f7659ec6cc668811976db59854/azmq/context.py#L58-L86
def set_zap_authenticator(self, zap_authenticator): """ Setup a ZAP authenticator. :param zap_authenticator: A ZAP authenticator instance to use. The context takes ownership of the specified instance. It will close it automatically when it stops. If `None` is specified, ...
[ "def", "set_zap_authenticator", "(", "self", ",", "zap_authenticator", ")", ":", "result", "=", "self", ".", "_zap_authenticator", "if", "result", ":", "self", ".", "unregister_child", "(", "result", ")", "self", ".", "_zap_authenticator", "=", "zap_authenticator"...
Setup a ZAP authenticator. :param zap_authenticator: A ZAP authenticator instance to use. The context takes ownership of the specified instance. It will close it automatically when it stops. If `None` is specified, any previously owner instance is disowned and returned. It b...
[ "Setup", "a", "ZAP", "authenticator", "." ]
python
train
dopefishh/pympi
pympi/Praat.py
https://github.com/dopefishh/pympi/blob/79c747cde45b5ba203ed93154d8c123ac9c3ef56/pympi/Praat.py#L167-L178
def remove_tier(self, name_num): """Remove a tier, when multiple tiers exist with that name only the first is removed. :param name_num: Name or number of the tier to remove. :type name_num: int or str :raises IndexError: If there is no tier with that number. """ ...
[ "def", "remove_tier", "(", "self", ",", "name_num", ")", ":", "if", "isinstance", "(", "name_num", ",", "int", ")", ":", "del", "(", "self", ".", "tiers", "[", "name_num", "-", "1", "]", ")", "else", ":", "self", ".", "tiers", "=", "[", "i", "for...
Remove a tier, when multiple tiers exist with that name only the first is removed. :param name_num: Name or number of the tier to remove. :type name_num: int or str :raises IndexError: If there is no tier with that number.
[ "Remove", "a", "tier", "when", "multiple", "tiers", "exist", "with", "that", "name", "only", "the", "first", "is", "removed", "." ]
python
test
SoCo/SoCo
soco/ms_data_structures.py
https://github.com/SoCo/SoCo/blob/671937e07d7973b78c0cbee153d4f3ad68ec48c6/soco/ms_data_structures.py#L61-L148
def from_xml(cls, xml, service, parent_id): """Return a Music Service item generated from xml. :param xml: Object XML. All items containing text are added to the content of the item. The class variable ``valid_fields`` of each of the classes list the valid fields (after translat...
[ "def", "from_xml", "(", "cls", ",", "xml", ",", "service", ",", "parent_id", ")", ":", "# Add a few extra pieces of information", "content", "=", "{", "'description'", ":", "service", ".", "description", ",", "'service_id'", ":", "service", ".", "service_id", ",...
Return a Music Service item generated from xml. :param xml: Object XML. All items containing text are added to the content of the item. The class variable ``valid_fields`` of each of the classes list the valid fields (after translating the camel case to underscore notation)....
[ "Return", "a", "Music", "Service", "item", "generated", "from", "xml", "." ]
python
train
tensorflow/tensor2tensor
tensor2tensor/models/research/adafactor_experiments.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/adafactor_experiments.py#L167-L173
def afx_adafactor(): """Adafactor with recommended learning rate schedule.""" hparams = afx_adam() hparams.optimizer = "Adafactor" hparams.learning_rate_schedule = "rsqrt_decay" hparams.learning_rate_warmup_steps = 10000 return hparams
[ "def", "afx_adafactor", "(", ")", ":", "hparams", "=", "afx_adam", "(", ")", "hparams", ".", "optimizer", "=", "\"Adafactor\"", "hparams", ".", "learning_rate_schedule", "=", "\"rsqrt_decay\"", "hparams", ".", "learning_rate_warmup_steps", "=", "10000", "return", ...
Adafactor with recommended learning rate schedule.
[ "Adafactor", "with", "recommended", "learning", "rate", "schedule", "." ]
python
train
jobovy/galpy
galpy/df/streamdf.py
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/df/streamdf.py#L926-L1063
def _determine_stream_track(self,nTrackChunks): """Determine the track of the stream in real space""" #Determine how much orbital time is necessary for the progenitor's orbit to cover the stream if nTrackChunks is None: #default is floor(self._deltaAngleTrack/0.15)+1 self...
[ "def", "_determine_stream_track", "(", "self", ",", "nTrackChunks", ")", ":", "#Determine how much orbital time is necessary for the progenitor's orbit to cover the stream", "if", "nTrackChunks", "is", "None", ":", "#default is floor(self._deltaAngleTrack/0.15)+1", "self", ".", "_n...
Determine the track of the stream in real space
[ "Determine", "the", "track", "of", "the", "stream", "in", "real", "space" ]
python
train
brocade/pynos
pynos/versions/base/yang/tailf_netconf_transactions.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/base/yang/tailf_netconf_transactions.py#L57-L67
def start_transaction_input_with_inactive(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") start_transaction = ET.Element("start_transaction") config = start_transaction input = ET.SubElement(start_transaction, "input") with_inactive = ET....
[ "def", "start_transaction_input_with_inactive", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "start_transaction", "=", "ET", ".", "Element", "(", "\"start_transaction\"", ")", "config", "=", "star...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
pmacosta/peng
peng/wave_functions.py
https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/peng/wave_functions.py#L1473-L1507
def naverage(wave, indep_min=None, indep_max=None): r""" Return the numerical average of a waveform's dependent variable vector. :param wave: Waveform :type wave: :py:class:`peng.eng.Waveform` :param indep_min: Independent vector start point of computation :type indep_min: integer or float ...
[ "def", "naverage", "(", "wave", ",", "indep_min", "=", "None", ",", "indep_max", "=", "None", ")", ":", "ret", "=", "copy", ".", "copy", "(", "wave", ")", "_bound_waveform", "(", "ret", ",", "indep_min", ",", "indep_max", ")", "delta_x", "=", "ret", ...
r""" Return the numerical average of a waveform's dependent variable vector. :param wave: Waveform :type wave: :py:class:`peng.eng.Waveform` :param indep_min: Independent vector start point of computation :type indep_min: integer or float :param indep_max: Independent vector stop point of c...
[ "r", "Return", "the", "numerical", "average", "of", "a", "waveform", "s", "dependent", "variable", "vector", "." ]
python
test
pantsbuild/pants
src/python/pants/goal/run_tracker.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/goal/run_tracker.py#L522-L557
def get_critical_path_timings(self): """ Get the cumulative timings of each goal and all of the goals it (transitively) depended on. """ setup_workunit = WorkUnitLabel.SETUP.lower() transitive_dependencies = dict() for goal_info in self._sorted_goal_infos: deps = transitive_dependencies.se...
[ "def", "get_critical_path_timings", "(", "self", ")", ":", "setup_workunit", "=", "WorkUnitLabel", ".", "SETUP", ".", "lower", "(", ")", "transitive_dependencies", "=", "dict", "(", ")", "for", "goal_info", "in", "self", ".", "_sorted_goal_infos", ":", "deps", ...
Get the cumulative timings of each goal and all of the goals it (transitively) depended on.
[ "Get", "the", "cumulative", "timings", "of", "each", "goal", "and", "all", "of", "the", "goals", "it", "(", "transitively", ")", "depended", "on", "." ]
python
train
ciena/afkak
afkak/client.py
https://github.com/ciena/afkak/blob/6f5e05ba6f135ea3c29cdb80efda009f7845569a/afkak/client.py#L267-L275
def reset_all_metadata(self): """Clear all cached metadata Metadata will be re-fetched as required to satisfy requests. """ self.topics_to_brokers.clear() self.topic_partitions.clear() self.topic_errors.clear() self.consumer_group_to_brokers.clear()
[ "def", "reset_all_metadata", "(", "self", ")", ":", "self", ".", "topics_to_brokers", ".", "clear", "(", ")", "self", ".", "topic_partitions", ".", "clear", "(", ")", "self", ".", "topic_errors", ".", "clear", "(", ")", "self", ".", "consumer_group_to_broker...
Clear all cached metadata Metadata will be re-fetched as required to satisfy requests.
[ "Clear", "all", "cached", "metadata" ]
python
train
CloverHealth/temple
temple/clean.py
https://github.com/CloverHealth/temple/blob/d7b75da2459f72ba74d6f3b6e1ab95c3d1b92ccd/temple/clean.py#L11-L14
def _get_current_branch(): """Determine the current git branch""" result = temple.utils.shell('git rev-parse --abbrev-ref HEAD', stdout=subprocess.PIPE) return result.stdout.decode('utf8').strip()
[ "def", "_get_current_branch", "(", ")", ":", "result", "=", "temple", ".", "utils", ".", "shell", "(", "'git rev-parse --abbrev-ref HEAD'", ",", "stdout", "=", "subprocess", ".", "PIPE", ")", "return", "result", ".", "stdout", ".", "decode", "(", "'utf8'", "...
Determine the current git branch
[ "Determine", "the", "current", "git", "branch" ]
python
valid
shreyaspotnis/rampage
rampage/daq/gpib.py
https://github.com/shreyaspotnis/rampage/blob/e2565aef7ee16ee06523de975e8aa41aca14e3b2/rampage/daq/gpib.py#L479-L489
def disable_all(self, disable): """Disables all modulation and outputs of the Standford MW func. generator""" commands = ['ENBH 0', #disable high freq. rear output 'ENBL 0', #disable low freq. front bnc 'MODL 0' #disable modulation ] ...
[ "def", "disable_all", "(", "self", ",", "disable", ")", ":", "commands", "=", "[", "'ENBH 0'", ",", "#disable high freq. rear output", "'ENBL 0'", ",", "#disable low freq. front bnc", "'MODL 0'", "#disable modulation", "]", "command_string", "=", "'\\n'", ".", "join",...
Disables all modulation and outputs of the Standford MW func. generator
[ "Disables", "all", "modulation", "and", "outputs", "of", "the", "Standford", "MW", "func", ".", "generator" ]
python
train
corpusops/pdbclone
lib/pdb_clone/pdb.py
https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/pdb.py#L1494-L1506
def do_longlist(self, arg): """longlist | ll List the whole source code for the current function or frame. """ filename = self.curframe.f_code.co_filename breaklist = self.get_file_breaks(filename) try: lines, lineno = getsourcelines(self.curframe, ...
[ "def", "do_longlist", "(", "self", ",", "arg", ")", ":", "filename", "=", "self", ".", "curframe", ".", "f_code", ".", "co_filename", "breaklist", "=", "self", ".", "get_file_breaks", "(", "filename", ")", "try", ":", "lines", ",", "lineno", "=", "getsou...
longlist | ll List the whole source code for the current function or frame.
[ "longlist", "|", "ll", "List", "the", "whole", "source", "code", "for", "the", "current", "function", "or", "frame", "." ]
python
train
singularitti/text-stream
text_stream/__init__.py
https://github.com/singularitti/text-stream/blob/4df53b98e9f61d983dbd46edd96db93122577eb5/text_stream/__init__.py#L127-L139
def generator_between(self, begin: int, end: int) -> Iterator[str]: """ Create a generate that iterates the whole content of the file or string, starting from *begin* index, end by *end* index. **Not byte!** :param begin: An integer labels the starting index. :param end: An inte...
[ "def", "generator_between", "(", "self", ",", "begin", ":", "int", ",", "end", ":", "int", ")", "->", "Iterator", "[", "str", "]", ":", "s", ":", "str", "=", "self", ".", "content", "[", "begin", ":", "end", "+", "1", "]", "for", "line", "in", ...
Create a generate that iterates the whole content of the file or string, starting from *begin* index, end by *end* index. **Not byte!** :param begin: An integer labels the starting index. :param end: An integer labels the ending index. :return: An iterator of string.
[ "Create", "a", "generate", "that", "iterates", "the", "whole", "content", "of", "the", "file", "or", "string", "starting", "from", "*", "begin", "*", "index", "end", "by", "*", "end", "*", "index", ".", "**", "Not", "byte!", "**" ]
python
train
yodle/docker-registry-client
docker_registry_client/_BaseClient.py
https://github.com/yodle/docker-registry-client/blob/8abf6b0200a68bed986f698dcbf02d444257b75c/docker_registry_client/_BaseClient.py#L73-L77
def search(self, q=''): """GET /v1/search""" if q: q = '?q=' + q return self._http_call('/v1/search' + q, get)
[ "def", "search", "(", "self", ",", "q", "=", "''", ")", ":", "if", "q", ":", "q", "=", "'?q='", "+", "q", "return", "self", ".", "_http_call", "(", "'/v1/search'", "+", "q", ",", "get", ")" ]
GET /v1/search
[ "GET", "/", "v1", "/", "search" ]
python
train
materialsproject/pymatgen
pymatgen/io/abinit/works.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/works.py#L429-L432
def register_bec_task(self, *args, **kwargs): """Register a BEC task.""" kwargs["task_class"] = BecTask return self.register_task(*args, **kwargs)
[ "def", "register_bec_task", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "\"task_class\"", "]", "=", "BecTask", "return", "self", ".", "register_task", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
Register a BEC task.
[ "Register", "a", "BEC", "task", "." ]
python
train
pgmpy/pgmpy
pgmpy/readwrite/XMLBIF.py
https://github.com/pgmpy/pgmpy/blob/9381a66aba3c3871d3ccd00672b148d17d63239e/pgmpy/readwrite/XMLBIF.py#L345-L370
def get_properties(self): """ Add property to variables in XMLBIF Return ------ dict: dict of type {variable: property tag} Examples -------- >>> writer = XMLBIFWriter(model) >>> writer.get_property() {'light-on': <Element PROPERTY at 0x7...
[ "def", "get_properties", "(", "self", ")", ":", "variables", "=", "self", ".", "model", ".", "nodes", "(", ")", "property_tag", "=", "{", "}", "for", "var", "in", "sorted", "(", "variables", ")", ":", "properties", "=", "self", ".", "model", ".", "no...
Add property to variables in XMLBIF Return ------ dict: dict of type {variable: property tag} Examples -------- >>> writer = XMLBIFWriter(model) >>> writer.get_property() {'light-on': <Element PROPERTY at 0x7f7a2ffac1c8>, 'family-out': <Element ...
[ "Add", "property", "to", "variables", "in", "XMLBIF" ]
python
train
Kitware/tangelo
tangelo/tangelo/__init__.py
https://github.com/Kitware/tangelo/blob/470034ee9b3d7a01becc1ce5fddc7adc1d5263ef/tangelo/tangelo/__init__.py#L289-L316
def return_type(rettype): """ Decorate a function to automatically convert its return type to a string using a custom function. Web-based service functions must return text to the client. Tangelo contains default logic to convert many kinds of values into string, but this decorator allows the ...
[ "def", "return_type", "(", "rettype", ")", ":", "def", "wrap", "(", "f", ")", ":", "@", "functools", ".", "wraps", "(", "f", ")", "def", "converter", "(", "*", "pargs", ",", "*", "*", "kwargs", ")", ":", "# Run the function to capture the output.", "resu...
Decorate a function to automatically convert its return type to a string using a custom function. Web-based service functions must return text to the client. Tangelo contains default logic to convert many kinds of values into string, but this decorator allows the service writer to specify custom behav...
[ "Decorate", "a", "function", "to", "automatically", "convert", "its", "return", "type", "to", "a", "string", "using", "a", "custom", "function", "." ]
python
train
limix/limix-core
limix_core/mean/mean_efficient.py
https://github.com/limix/limix-core/blob/5c590b4d351409f83ca320844b4897ce92203814/limix_core/mean/mean_efficient.py#L69-L77
def dof(self, index=None): """The number of degrees of freedom""" if index is None: dof = 0 for i in range(self.len): dof += self.A[i].shape[0] * self.F[i].shape[1] return dof else: return self.A[index].shape[0] * self.F[index].shap...
[ "def", "dof", "(", "self", ",", "index", "=", "None", ")", ":", "if", "index", "is", "None", ":", "dof", "=", "0", "for", "i", "in", "range", "(", "self", ".", "len", ")", ":", "dof", "+=", "self", ".", "A", "[", "i", "]", ".", "shape", "["...
The number of degrees of freedom
[ "The", "number", "of", "degrees", "of", "freedom" ]
python
train
radzak/rtv-downloader
rtv/extractors/common.py
https://github.com/radzak/rtv-downloader/blob/b9114b7f4c35fabe6ec9ad1764a65858667a866e/rtv/extractors/common.py#L40-L45
def get_info(self) -> dict: """Get information about the videos from YoutubeDL package.""" with suppress_stdout(): with youtube_dl.YoutubeDL() as ydl: info_dict = ydl.extract_info(self.url, download=False) return info_dict
[ "def", "get_info", "(", "self", ")", "->", "dict", ":", "with", "suppress_stdout", "(", ")", ":", "with", "youtube_dl", ".", "YoutubeDL", "(", ")", "as", "ydl", ":", "info_dict", "=", "ydl", ".", "extract_info", "(", "self", ".", "url", ",", "download"...
Get information about the videos from YoutubeDL package.
[ "Get", "information", "about", "the", "videos", "from", "YoutubeDL", "package", "." ]
python
train
jazzband/sorl-thumbnail
sorl/thumbnail/engines/convert_engine.py
https://github.com/jazzband/sorl-thumbnail/blob/22ccd9781462a820f963f57018ad3dcef85053ed/sorl/thumbnail/engines/convert_engine.py#L174-L180
def _cropbox(self, image, x, y, x2, y2): """ Crops the image to a set of x,y coordinates (x,y) is top left, (x2,y2) is bottom left """ image['options']['crop'] = '%sx%s+%s+%s' % (x2 - x, y2 - y, x, y) image['size'] = (x2 - x, y2 - y) # update image size return image
[ "def", "_cropbox", "(", "self", ",", "image", ",", "x", ",", "y", ",", "x2", ",", "y2", ")", ":", "image", "[", "'options'", "]", "[", "'crop'", "]", "=", "'%sx%s+%s+%s'", "%", "(", "x2", "-", "x", ",", "y2", "-", "y", ",", "x", ",", "y", "...
Crops the image to a set of x,y coordinates (x,y) is top left, (x2,y2) is bottom left
[ "Crops", "the", "image", "to", "a", "set", "of", "x", "y", "coordinates", "(", "x", "y", ")", "is", "top", "left", "(", "x2", "y2", ")", "is", "bottom", "left" ]
python
train
renzon/gaeforms
gaeforms/base.py
https://github.com/renzon/gaeforms/blob/7d3f4d964f087c992fe92bc8d41222010b7f6430/gaeforms/base.py#L86-L95
def normalize_field(self, value): """ Method that must transform the value from string Ex: if the expected type is int, it should return int(self._attr) """ if self.default is not None: if value is None or value == '': value = self.default ret...
[ "def", "normalize_field", "(", "self", ",", "value", ")", ":", "if", "self", ".", "default", "is", "not", "None", ":", "if", "value", "is", "None", "or", "value", "==", "''", ":", "value", "=", "self", ".", "default", "return", "value" ]
Method that must transform the value from string Ex: if the expected type is int, it should return int(self._attr)
[ "Method", "that", "must", "transform", "the", "value", "from", "string", "Ex", ":", "if", "the", "expected", "type", "is", "int", "it", "should", "return", "int", "(", "self", ".", "_attr", ")" ]
python
train
getpelican/pelican-plugins
org_python_reader/org_python_reader.py
https://github.com/getpelican/pelican-plugins/blob/cfc7a3f224f1743063b034561f89a6a712d13587/org_python_reader/org_python_reader.py#L60-L75
def _parse_metadatas(self, text_lines): """ From a given Org text, return the metadatas Keyword Arguments: text_lines -- A list, each item is a line of the texte Return: A dict containing metadatas """ if not text_lines: return {} expr...
[ "def", "_parse_metadatas", "(", "self", ",", "text_lines", ")", ":", "if", "not", "text_lines", ":", "return", "{", "}", "expr_metadata", "=", "re", ".", "compile", "(", "r'^#\\+([a-zA-Z]+):(.*)'", ")", "return", "{", "expr_metadata", ".", "match", "(", "lin...
From a given Org text, return the metadatas Keyword Arguments: text_lines -- A list, each item is a line of the texte Return: A dict containing metadatas
[ "From", "a", "given", "Org", "text", "return", "the", "metadatas", "Keyword", "Arguments", ":", "text_lines", "--", "A", "list", "each", "item", "is", "a", "line", "of", "the", "texte", "Return", ":", "A", "dict", "containing", "metadatas" ]
python
train
HDI-Project/ballet
ballet/util/fs.py
https://github.com/HDI-Project/ballet/blob/6f4d4b87b8234cb6bb38b9e9484a58ef8fe8fdb2/ballet/util/fs.py#L65-L79
def isemptyfile(filepath): """Determine if the file both exists and isempty Args: filepath (str, path): file path Returns: bool """ exists = os.path.exists(safepath(filepath)) if exists: filesize = os.path.getsize(safepath(filepath)) return filesize == 0 els...
[ "def", "isemptyfile", "(", "filepath", ")", ":", "exists", "=", "os", ".", "path", ".", "exists", "(", "safepath", "(", "filepath", ")", ")", "if", "exists", ":", "filesize", "=", "os", ".", "path", ".", "getsize", "(", "safepath", "(", "filepath", "...
Determine if the file both exists and isempty Args: filepath (str, path): file path Returns: bool
[ "Determine", "if", "the", "file", "both", "exists", "and", "isempty" ]
python
train
quandyfactory/dicttoxml
dicttoxml.py
https://github.com/quandyfactory/dicttoxml/blob/2016fe9817ad03b26aa5f1a475f5b79ad6757b96/dicttoxml.py#L324-L339
def convert_kv(key, val, attr_type, attr={}, cdata=False): """Converts a number or string into an XML element""" LOG.info('Inside convert_kv(): key="%s", val="%s", type(val) is: "%s"' % ( unicode_me(key), unicode_me(val), type(val).__name__) ) key, attr = make_valid_xml_name(key, attr) if ...
[ "def", "convert_kv", "(", "key", ",", "val", ",", "attr_type", ",", "attr", "=", "{", "}", ",", "cdata", "=", "False", ")", ":", "LOG", ".", "info", "(", "'Inside convert_kv(): key=\"%s\", val=\"%s\", type(val) is: \"%s\"'", "%", "(", "unicode_me", "(", "key",...
Converts a number or string into an XML element
[ "Converts", "a", "number", "or", "string", "into", "an", "XML", "element" ]
python
train
tradenity/python-sdk
tradenity/resources/return_operation.py
https://github.com/tradenity/python-sdk/blob/d13fbe23f4d6ff22554c6d8d2deaf209371adaf1/tradenity/resources/return_operation.py#L671-L692
def replace_return_operation_by_id(cls, return_operation_id, return_operation, **kwargs): """Replace ReturnOperation Replace all attributes of ReturnOperation This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>...
[ "def", "replace_return_operation_by_id", "(", "cls", ",", "return_operation_id", ",", "return_operation", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async'", ")", ":", "ret...
Replace ReturnOperation Replace all attributes of ReturnOperation This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.replace_return_operation_by_id(return_operation_id, return_operation, async=True) ...
[ "Replace", "ReturnOperation" ]
python
train
hugapi/hug
hug/use.py
https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/use.py#L206-L214
def setsockopt(self, *sockopts): """Add socket options to set""" if type(sockopts[0]) in (list, tuple): for sock_opt in sockopts[0]: level, option, value = sock_opt self.connection.sockopts.add((level, option, value)) else: level, option, v...
[ "def", "setsockopt", "(", "self", ",", "*", "sockopts", ")", ":", "if", "type", "(", "sockopts", "[", "0", "]", ")", "in", "(", "list", ",", "tuple", ")", ":", "for", "sock_opt", "in", "sockopts", "[", "0", "]", ":", "level", ",", "option", ",", ...
Add socket options to set
[ "Add", "socket", "options", "to", "set" ]
python
train
thusoy/headsup
headsup.py
https://github.com/thusoy/headsup/blob/165a63cc6c987f664f2efd901d483ca07b7bc898/headsup.py#L68-L80
def get_device_address(device): """ find the local ip address on the given device """ if device is None: return None command = ['ip', 'route', 'list', 'dev', device] ip_routes = subprocess.check_output(command).strip() for line in ip_routes.split('\n'): seen = '' for a in lin...
[ "def", "get_device_address", "(", "device", ")", ":", "if", "device", "is", "None", ":", "return", "None", "command", "=", "[", "'ip'", ",", "'route'", ",", "'list'", ",", "'dev'", ",", "device", "]", "ip_routes", "=", "subprocess", ".", "check_output", ...
find the local ip address on the given device
[ "find", "the", "local", "ip", "address", "on", "the", "given", "device" ]
python
train
python-openxml/python-docx
docx/oxml/xmlchemy.py
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/xmlchemy.py#L84-L91
def _parse_line(cls, line): """ Return front, attrs, close, text 4-tuple result of parsing XML element string *line*. """ match = cls._xml_elm_line_patt.match(line) front, attrs, close, text = [match.group(n) for n in range(1, 5)] return front, attrs, close, text
[ "def", "_parse_line", "(", "cls", ",", "line", ")", ":", "match", "=", "cls", ".", "_xml_elm_line_patt", ".", "match", "(", "line", ")", "front", ",", "attrs", ",", "close", ",", "text", "=", "[", "match", ".", "group", "(", "n", ")", "for", "n", ...
Return front, attrs, close, text 4-tuple result of parsing XML element string *line*.
[ "Return", "front", "attrs", "close", "text", "4", "-", "tuple", "result", "of", "parsing", "XML", "element", "string", "*", "line", "*", "." ]
python
train
Exanis/django-rest-generators
django_rest_generators/steps/http.py
https://github.com/Exanis/django-rest-generators/blob/fb14ccbba8cb029dc056d852bc13d9216dc924e4/django_rest_generators/steps/http.py#L33-L45
def when_i_send_the_request(context, method): """ :type method: str :type context: behave.runner.Context """ data = context.apiRequestData context.apiRequest = context.apiClient.generic( method, data['url'], data=json.dumps(data['params']), content_type=...
[ "def", "when_i_send_the_request", "(", "context", ",", "method", ")", ":", "data", "=", "context", ".", "apiRequestData", "context", ".", "apiRequest", "=", "context", ".", "apiClient", ".", "generic", "(", "method", ",", "data", "[", "'url'", "]", ",", "d...
:type method: str :type context: behave.runner.Context
[ ":", "type", "method", ":", "str", ":", "type", "context", ":", "behave", ".", "runner", ".", "Context" ]
python
train
rainwoodman/kdcount
kdcount/__init__.py
https://github.com/rainwoodman/kdcount/blob/483548f6d27a4f245cd5d98880b5f4edd6cc8dc1/kdcount/__init__.py#L112-L129
def make_forest(self, chunksize): """ Divide a tree branch to a forest, each subtree of size at most chunksize """ heap = [] heappush(heap, (-self.size, self)) while True: w, x = heappop(heap) if w == 0: heappush(heap, (0, x)) ...
[ "def", "make_forest", "(", "self", ",", "chunksize", ")", ":", "heap", "=", "[", "]", "heappush", "(", "heap", ",", "(", "-", "self", ".", "size", ",", "self", ")", ")", "while", "True", ":", "w", ",", "x", "=", "heappop", "(", "heap", ")", "if...
Divide a tree branch to a forest, each subtree of size at most chunksize
[ "Divide", "a", "tree", "branch", "to", "a", "forest", "each", "subtree", "of", "size", "at", "most", "chunksize" ]
python
train
manns/pyspread
pyspread/src/lib/vlc.py
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L1896-L1908
def vlm_change_media(self, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop): '''Edit the parameters of a media. This will delete all existing inputs and add the specified one. @param psz_name: the name of the new broadcast. @param psz_input: the input MRL. ...
[ "def", "vlm_change_media", "(", "self", ",", "psz_name", ",", "psz_input", ",", "psz_output", ",", "i_options", ",", "ppsz_options", ",", "b_enabled", ",", "b_loop", ")", ":", "return", "libvlc_vlm_change_media", "(", "self", ",", "str_to_bytes", "(", "psz_name"...
Edit the parameters of a media. This will delete all existing inputs and add the specified one. @param psz_name: the name of the new broadcast. @param psz_input: the input MRL. @param psz_output: the output MRL (the parameter to the "sout" variable). @param i_options: number of a...
[ "Edit", "the", "parameters", "of", "a", "media", ".", "This", "will", "delete", "all", "existing", "inputs", "and", "add", "the", "specified", "one", "." ]
python
train
d0ugal/home
home/__main__.py
https://github.com/d0ugal/home/blob/e984716ae6c74dc8e40346584668ac5cfeaaf520/home/__main__.py#L55-L60
def create_user(username): "Create a new user." password = prompt_pass("Enter password") user = User(username=username, password=password) db.session.add(user) db.session.commit()
[ "def", "create_user", "(", "username", ")", ":", "password", "=", "prompt_pass", "(", "\"Enter password\"", ")", "user", "=", "User", "(", "username", "=", "username", ",", "password", "=", "password", ")", "db", ".", "session", ".", "add", "(", "user", ...
Create a new user.
[ "Create", "a", "new", "user", "." ]
python
test
mitsei/dlkit
dlkit/json_/grading/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/grading/sessions.py#L1148-L1208
def update_grade(self, grade_form): """Updates an existing grade. arg: grade_form (osid.grading.GradeForm): the form containing the elements to be updated raise: IllegalState - ``grade_form`` already used in an update transaction raise: InvalidArgume...
[ "def", "update_grade", "(", "self", ",", "grade_form", ")", ":", "# Implemented from template for", "# osid.repository.AssetAdminSession.update_asset_content_template", "from", "dlkit", ".", "abstract_osid", ".", "grading", ".", "objects", "import", "GradeForm", "as", "ABCG...
Updates an existing grade. arg: grade_form (osid.grading.GradeForm): the form containing the elements to be updated raise: IllegalState - ``grade_form`` already used in an update transaction raise: InvalidArgument - the form contains an invalid value ...
[ "Updates", "an", "existing", "grade", "." ]
python
train
ga4gh/ga4gh-server
ga4gh/server/datarepo.py
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datarepo.py#L862-L869
def removeDataset(self, dataset): """ Removes the specified dataset from this repository. This performs a cascading removal of all items within this dataset. """ for datasetRecord in models.Dataset.select().where( models.Dataset.id == dataset.getId()): ...
[ "def", "removeDataset", "(", "self", ",", "dataset", ")", ":", "for", "datasetRecord", "in", "models", ".", "Dataset", ".", "select", "(", ")", ".", "where", "(", "models", ".", "Dataset", ".", "id", "==", "dataset", ".", "getId", "(", ")", ")", ":",...
Removes the specified dataset from this repository. This performs a cascading removal of all items within this dataset.
[ "Removes", "the", "specified", "dataset", "from", "this", "repository", ".", "This", "performs", "a", "cascading", "removal", "of", "all", "items", "within", "this", "dataset", "." ]
python
train
acatton/python-spm
docs/files/shell.py
https://github.com/acatton/python-spm/blob/0d4e7177aef17c90f7676ae2e099bb4137a0226f/docs/files/shell.py#L35-L41
def run(line): """ Run a shell line: run('ls /tmp') will execv('/usr/bin/ls', ['ls', '/tmp']) """ arguments = shlex.split(line) path = lookup(arguments[0]) # Lookup the first arguments in PATH execute(path, arguments)
[ "def", "run", "(", "line", ")", ":", "arguments", "=", "shlex", ".", "split", "(", "line", ")", "path", "=", "lookup", "(", "arguments", "[", "0", "]", ")", "# Lookup the first arguments in PATH", "execute", "(", "path", ",", "arguments", ")" ]
Run a shell line: run('ls /tmp') will execv('/usr/bin/ls', ['ls', '/tmp'])
[ "Run", "a", "shell", "line", ":", "run", "(", "ls", "/", "tmp", ")", "will", "execv", "(", "/", "usr", "/", "bin", "/", "ls", "[", "ls", "/", "tmp", "]", ")" ]
python
train
google/openhtf
openhtf/plugs/usb/filesync_service.py
https://github.com/google/openhtf/blob/655e85df7134db7bdf8f8fdd6ff9a6bf932e7b09/openhtf/plugs/usb/filesync_service.py#L391-L413
def read_until_done(self, command, timeout=None): """Yield messages read until we receive a 'DONE' command. Read messages of the given command until we receive a 'DONE' command. If a command different than the requested one is received, an AdbProtocolError is raised. Args: command: The comm...
[ "def", "read_until_done", "(", "self", ",", "command", ",", "timeout", "=", "None", ")", ":", "message", "=", "self", ".", "read_message", "(", "timeout", ")", "while", "message", ".", "command", "!=", "'DONE'", ":", "message", ".", "assert_command_is", "(...
Yield messages read until we receive a 'DONE' command. Read messages of the given command until we receive a 'DONE' command. If a command different than the requested one is received, an AdbProtocolError is raised. Args: command: The command to expect, like 'DENT' or 'DATA'. timeout: The ...
[ "Yield", "messages", "read", "until", "we", "receive", "a", "DONE", "command", "." ]
python
train
pyQode/pyqode.core
pyqode/core/share.py
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/share.py#L43-L55
def to_dict(self): """ Serializes a definition to a dictionary, ready for json. Children are serialised recursively. """ ddict = {'name': self.name, 'icon': self.icon, 'line': self.line, 'column': self.column, 'children': [], 'description': self...
[ "def", "to_dict", "(", "self", ")", ":", "ddict", "=", "{", "'name'", ":", "self", ".", "name", ",", "'icon'", ":", "self", ".", "icon", ",", "'line'", ":", "self", ".", "line", ",", "'column'", ":", "self", ".", "column", ",", "'children'", ":", ...
Serializes a definition to a dictionary, ready for json. Children are serialised recursively.
[ "Serializes", "a", "definition", "to", "a", "dictionary", "ready", "for", "json", "." ]
python
train
ayust/kitnirc
kitnirc/modular.py
https://github.com/ayust/kitnirc/blob/cf19fe39219da75f053e1a3976bf21331b6fefea/kitnirc/modular.py#L276-L303
def reload_module(self, module_name): """Reloads the specified module without changing its ordering. 1. Calls stop(reloading=True) on the module 2. Reloads the Module object into .loaded_modules 3. Calls start(reloading=True) on the new object If called with a module na...
[ "def", "reload_module", "(", "self", ",", "module_name", ")", ":", "module", "=", "self", ".", "loaded_modules", ".", "get", "(", "module_name", ")", "if", "module", ":", "module", ".", "stop", "(", "reloading", "=", "True", ")", "else", ":", "_log", "...
Reloads the specified module without changing its ordering. 1. Calls stop(reloading=True) on the module 2. Reloads the Module object into .loaded_modules 3. Calls start(reloading=True) on the new object If called with a module name that is not currently loaded, it will load it....
[ "Reloads", "the", "specified", "module", "without", "changing", "its", "ordering", "." ]
python
train
amzn/ion-python
amazon/ion/reader_text.py
https://github.com/amzn/ion-python/blob/0b21fa3ba7755f55f745e4aa970d86343b82449d/amazon/ion/reader_text.py#L1567-L1592
def _short_string_handler_factory(): """Generates the short string (double quoted) handler.""" def before(c, ctx, is_field_name, is_clob): assert not (is_clob and is_field_name) is_string = not is_clob and not is_field_name if is_string: ctx.set_ion_type(IonType.STRING) ...
[ "def", "_short_string_handler_factory", "(", ")", ":", "def", "before", "(", "c", ",", "ctx", ",", "is_field_name", ",", "is_clob", ")", ":", "assert", "not", "(", "is_clob", "and", "is_field_name", ")", "is_string", "=", "not", "is_clob", "and", "not", "i...
Generates the short string (double quoted) handler.
[ "Generates", "the", "short", "string", "(", "double", "quoted", ")", "handler", "." ]
python
train
lazka/hypothesis-fspaths
hypothesis_fspaths.py
https://github.com/lazka/hypothesis-fspaths/blob/19edb40a91ae4055bccf125a1e0b1796fa2e6a5c/hypothesis_fspaths.py#L161-L215
def fspaths(draw, allow_pathlike=None): """A strategy which generates filesystem path values. The generated values include everything which the builtin :func:`python:open` function accepts i.e. which won't lead to :exc:`ValueError` or :exc:`TypeError` being raised. Note that the range of the retur...
[ "def", "fspaths", "(", "draw", ",", "allow_pathlike", "=", "None", ")", ":", "has_pathlike", "=", "hasattr", "(", "os", ",", "'PathLike'", ")", "if", "allow_pathlike", "is", "None", ":", "allow_pathlike", "=", "has_pathlike", "if", "allow_pathlike", "and", "...
A strategy which generates filesystem path values. The generated values include everything which the builtin :func:`python:open` function accepts i.e. which won't lead to :exc:`ValueError` or :exc:`TypeError` being raised. Note that the range of the returned values depends on the operating system,...
[ "A", "strategy", "which", "generates", "filesystem", "path", "values", "." ]
python
valid
eventbrite/pysoa
pysoa/utils.py
https://github.com/eventbrite/pysoa/blob/9c052cae2397d13de3df8ae2c790846a70b53f18/pysoa/utils.py#L12-L32
def dict_to_hashable(d): """ Takes a dict and returns an immutable, hashable version of that dict that can be used as a key in dicts or as a set value. Any two dicts passed in with the same content are guaranteed to return the same value. Any two dicts passed in with different content are guaranteed to ...
[ "def", "dict_to_hashable", "(", "d", ")", ":", "return", "frozenset", "(", "(", "k", ",", "tuple", "(", "v", ")", "if", "isinstance", "(", "v", ",", "list", ")", "else", "(", "dict_to_hashable", "(", "v", ")", "if", "isinstance", "(", "v", ",", "di...
Takes a dict and returns an immutable, hashable version of that dict that can be used as a key in dicts or as a set value. Any two dicts passed in with the same content are guaranteed to return the same value. Any two dicts passed in with different content are guaranteed to return different values. Performs com...
[ "Takes", "a", "dict", "and", "returns", "an", "immutable", "hashable", "version", "of", "that", "dict", "that", "can", "be", "used", "as", "a", "key", "in", "dicts", "or", "as", "a", "set", "value", ".", "Any", "two", "dicts", "passed", "in", "with", ...
python
train
sammchardy/python-binance
binance/depthcache.py
https://github.com/sammchardy/python-binance/blob/31c0d0a32f9edd528c6c2c1dd3044d9a34ce43cc/binance/depthcache.py#L153-L181
def _init_cache(self): """Initialise the depth cache calling REST endpoint :return: """ self._last_update_id = None self._depth_message_buffer = [] res = self._client.get_order_book(symbol=self._symbol, limit=self._limit) # process bid and asks from the order b...
[ "def", "_init_cache", "(", "self", ")", ":", "self", ".", "_last_update_id", "=", "None", "self", ".", "_depth_message_buffer", "=", "[", "]", "res", "=", "self", ".", "_client", ".", "get_order_book", "(", "symbol", "=", "self", ".", "_symbol", ",", "li...
Initialise the depth cache calling REST endpoint :return:
[ "Initialise", "the", "depth", "cache", "calling", "REST", "endpoint" ]
python
train
johnwmillr/LyricsGenius
lyricsgenius/api.py
https://github.com/johnwmillr/LyricsGenius/blob/e36482f7c42235037f3b9b7013edcd54141124e3/lyricsgenius/api.py#L87-L91
def search_genius(self, search_term): """Search documents hosted on Genius.""" endpoint = "search/" params = {'q': search_term} return self._make_request(endpoint, params_=params)
[ "def", "search_genius", "(", "self", ",", "search_term", ")", ":", "endpoint", "=", "\"search/\"", "params", "=", "{", "'q'", ":", "search_term", "}", "return", "self", ".", "_make_request", "(", "endpoint", ",", "params_", "=", "params", ")" ]
Search documents hosted on Genius.
[ "Search", "documents", "hosted", "on", "Genius", "." ]
python
train
heikomuller/sco-client
scocli/__init__.py
https://github.com/heikomuller/sco-client/blob/c4afab71297f73003379bba4c1679be9dcf7cef8/scocli/__init__.py#L126-L138
def cache_clear(self): """Clear local cache by deleting all cached resources and their downloaded files. """ # Delete content of local cache directory for f in os.listdir(self.directory): f = os.path.join(self.directory, f) if os.path.isfile(f): ...
[ "def", "cache_clear", "(", "self", ")", ":", "# Delete content of local cache directory", "for", "f", "in", "os", ".", "listdir", "(", "self", ".", "directory", ")", ":", "f", "=", "os", ".", "path", ".", "join", "(", "self", ".", "directory", ",", "f", ...
Clear local cache by deleting all cached resources and their downloaded files.
[ "Clear", "local", "cache", "by", "deleting", "all", "cached", "resources", "and", "their", "downloaded", "files", "." ]
python
train
adamcharnock/swiftwind
swiftwind/billing_cycle/models.py
https://github.com/adamcharnock/swiftwind/blob/72c715800841c3b2feabded3f3b65b76388b4cea/swiftwind/billing_cycle/models.py#L148-L150
def get_next(self): """Get the billing cycle after this one. May return None""" return BillingCycle.objects.filter(date_range__gt=self.date_range).order_by('date_range').first()
[ "def", "get_next", "(", "self", ")", ":", "return", "BillingCycle", ".", "objects", ".", "filter", "(", "date_range__gt", "=", "self", ".", "date_range", ")", ".", "order_by", "(", "'date_range'", ")", ".", "first", "(", ")" ]
Get the billing cycle after this one. May return None
[ "Get", "the", "billing", "cycle", "after", "this", "one", ".", "May", "return", "None" ]
python
train
BerkeleyAutomation/autolab_core
autolab_core/tensor_dataset.py
https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/tensor_dataset.py#L121-L125
def add(self, datapoint): """ Adds the datapoint to the tensor if room is available. """ if not self.is_full: self.set_datapoint(self.cur_index, datapoint) self.cur_index += 1
[ "def", "add", "(", "self", ",", "datapoint", ")", ":", "if", "not", "self", ".", "is_full", ":", "self", ".", "set_datapoint", "(", "self", ".", "cur_index", ",", "datapoint", ")", "self", ".", "cur_index", "+=", "1" ]
Adds the datapoint to the tensor if room is available.
[ "Adds", "the", "datapoint", "to", "the", "tensor", "if", "room", "is", "available", "." ]
python
train
saltstack/salt
salt/fileserver/__init__.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/__init__.py#L353-L401
def backends(self, back=None): ''' Return the backend list ''' if not back: back = self.opts['fileserver_backend'] else: if not isinstance(back, list): try: back = back.split(',') except AttributeError: ...
[ "def", "backends", "(", "self", ",", "back", "=", "None", ")", ":", "if", "not", "back", ":", "back", "=", "self", ".", "opts", "[", "'fileserver_backend'", "]", "else", ":", "if", "not", "isinstance", "(", "back", ",", "list", ")", ":", "try", ":"...
Return the backend list
[ "Return", "the", "backend", "list" ]
python
train
hobson/aima
aima/mdp.py
https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/mdp.py#L118-L131
def policy_iteration(mdp): "Solve an MDP by policy iteration [Fig. 17.7]" U = dict([(s, 0) for s in mdp.states]) pi = dict([(s, random.choice(mdp.actions(s))) for s in mdp.states]) while True: U = policy_evaluation(pi, U, mdp) unchanged = True for s in mdp.states: a =...
[ "def", "policy_iteration", "(", "mdp", ")", ":", "U", "=", "dict", "(", "[", "(", "s", ",", "0", ")", "for", "s", "in", "mdp", ".", "states", "]", ")", "pi", "=", "dict", "(", "[", "(", "s", ",", "random", ".", "choice", "(", "mdp", ".", "a...
Solve an MDP by policy iteration [Fig. 17.7]
[ "Solve", "an", "MDP", "by", "policy", "iteration", "[", "Fig", ".", "17", ".", "7", "]" ]
python
valid
fkarb/xltable
xltable/expression.py
https://github.com/fkarb/xltable/blob/7a592642d27ad5ee90d2aa8c26338abaa9d84bea/xltable/expression.py#L358-L370
def _to_addr(worksheet, row, col, row_fixed=False, col_fixed=False): """converts a (0,0) based coordinate to an excel address""" addr = "" A = ord('A') col += 1 while col > 0: addr = chr(A + ((col - 1) % 26)) + addr col = (col - 1) // 26 prefix = ("'%s'!" % worksheet) if workshe...
[ "def", "_to_addr", "(", "worksheet", ",", "row", ",", "col", ",", "row_fixed", "=", "False", ",", "col_fixed", "=", "False", ")", ":", "addr", "=", "\"\"", "A", "=", "ord", "(", "'A'", ")", "col", "+=", "1", "while", "col", ">", "0", ":", "addr",...
converts a (0,0) based coordinate to an excel address
[ "converts", "a", "(", "0", "0", ")", "based", "coordinate", "to", "an", "excel", "address" ]
python
train
PyPSA/PyPSA
pypsa/io.py
https://github.com/PyPSA/PyPSA/blob/46954b1b3c21460550f7104681517065279a53b7/pypsa/io.py#L537-L605
def _import_from_importer(network, importer, basename, skip_time=False): """ Import network data from importer. Parameters ---------- skip_time : bool Skip importing time """ attrs = importer.get_attributes() current_pypsa_version = [int(s) for s in network.pypsa_version.split...
[ "def", "_import_from_importer", "(", "network", ",", "importer", ",", "basename", ",", "skip_time", "=", "False", ")", ":", "attrs", "=", "importer", ".", "get_attributes", "(", ")", "current_pypsa_version", "=", "[", "int", "(", "s", ")", "for", "s", "in"...
Import network data from importer. Parameters ---------- skip_time : bool Skip importing time
[ "Import", "network", "data", "from", "importer", "." ]
python
train
Harvard-University-iCommons/dj-log-config-helper
dj_log_config_helper.py
https://github.com/Harvard-University-iCommons/dj-log-config-helper/blob/5e568a65c455ca984d8f6d652986df190ed2a6dd/dj_log_config_helper.py#L110-L135
def configure_installed_apps_logger(level, verbose=False, additional_packages=None, filename=None): """Builds and enables a logger with a logger list of the top-level list of installed app modules (based on package name) plus any additional application packages passed in ...
[ "def", "configure_installed_apps_logger", "(", "level", ",", "verbose", "=", "False", ",", "additional_packages", "=", "None", ",", "filename", "=", "None", ")", ":", "if", "settings", ".", "LOGGING_CONFIG", ":", "raise", "ImproperlyConfigured", "(", "LOGGING_CONF...
Builds and enables a logger with a logger list of the top-level list of installed app modules (based on package name) plus any additional application packages passed in - for example, a user may want to log a dependent package of one the installed apps. The logger will write either to the console or to...
[ "Builds", "and", "enables", "a", "logger", "with", "a", "logger", "list", "of", "the", "top", "-", "level", "list", "of", "installed", "app", "modules", "(", "based", "on", "package", "name", ")", "plus", "any", "additional", "application", "packages", "pa...
python
train
angr/angr
angr/sim_state.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/sim_state.py#L428-L507
def add_constraints(self, *args, **kwargs): """ Add some constraints to the state. You may pass in any number of symbolic booleans as variadic positional arguments. """ if len(args) > 0 and isinstance(args[0], (list, tuple)): raise Exception("Tuple or list passed to ...
[ "def", "add_constraints", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "len", "(", "args", ")", ">", "0", "and", "isinstance", "(", "args", "[", "0", "]", ",", "(", "list", ",", "tuple", ")", ")", ":", "raise", "Excep...
Add some constraints to the state. You may pass in any number of symbolic booleans as variadic positional arguments.
[ "Add", "some", "constraints", "to", "the", "state", "." ]
python
train
biocore/burrito-fillings
bfillings/muscle_v38.py
https://github.com/biocore/burrito-fillings/blob/02ab71a46119b40793bd56a4ae00ca15f6dc3329/bfillings/muscle_v38.py#L457-L499
def aln_tree_seqs(seqs, input_handler=None, tree_type='neighborjoining', params={}, add_seq_names=True, WorkingDir=tempfile.gettempdir(), SuppressStderr=None, SuppressStdout=None, max_...
[ "def", "aln_tree_seqs", "(", "seqs", ",", "input_handler", "=", "None", ",", "tree_type", "=", "'neighborjoining'", ",", "params", "=", "{", "}", ",", "add_seq_names", "=", "True", ",", "WorkingDir", "=", "tempfile", ".", "gettempdir", "(", ")", ",", "Supp...
Muscle align sequences and report tree from iteration2. Unlike cluster_seqs, returns tree2 which is the tree made during the second muscle iteration (it should be more accurate that the cluster from the first iteration which is made fast based on k-mer words) seqs: either file name or list of sequenc...
[ "Muscle", "align", "sequences", "and", "report", "tree", "from", "iteration2", "." ]
python
train
roclark/sportsreference
sportsreference/nba/boxscore.py
https://github.com/roclark/sportsreference/blob/ea0bae432be76450e137671d2998eb38f962dffd/sportsreference/nba/boxscore.py#L139-L153
def two_point_attempts(self): """ Returns an ``int`` of the total number of two point field goals the player attempted during the season. """ if self.field_goal_attempts and self.three_point_attempts: return int(self.field_goal_attempts - self.three_point_attempts) ...
[ "def", "two_point_attempts", "(", "self", ")", ":", "if", "self", ".", "field_goal_attempts", "and", "self", ".", "three_point_attempts", ":", "return", "int", "(", "self", ".", "field_goal_attempts", "-", "self", ".", "three_point_attempts", ")", "# Occurs when t...
Returns an ``int`` of the total number of two point field goals the player attempted during the season.
[ "Returns", "an", "int", "of", "the", "total", "number", "of", "two", "point", "field", "goals", "the", "player", "attempted", "during", "the", "season", "." ]
python
train
useblocks/sphinxcontrib-needs
sphinxcontrib/needs/filter_common.py
https://github.com/useblocks/sphinxcontrib-needs/blob/f49af4859a74e9fe76de5b9133c01335ac6ae191/sphinxcontrib/needs/filter_common.py#L187-L202
def filter_single_need(need, filter_string=""): """ Checks if a single need/need_part passes a filter_string :param need: need or need_part :param filter_string: string, which is used as input for eval() :return: True, if need as passed the filter_string, else False """ filter_context = nee...
[ "def", "filter_single_need", "(", "need", ",", "filter_string", "=", "\"\"", ")", ":", "filter_context", "=", "need", ".", "copy", "(", ")", "filter_context", "[", "\"search\"", "]", "=", "re", ".", "search", "result", "=", "False", "try", ":", "result", ...
Checks if a single need/need_part passes a filter_string :param need: need or need_part :param filter_string: string, which is used as input for eval() :return: True, if need as passed the filter_string, else False
[ "Checks", "if", "a", "single", "need", "/", "need_part", "passes", "a", "filter_string" ]
python
train
biocore/burrito-fillings
bfillings/fastq_join.py
https://github.com/biocore/burrito-fillings/blob/02ab71a46119b40793bd56a4ae00ca15f6dc3329/bfillings/fastq_join.py#L69-L75
def _get_stitch_report_path(self): """Checks if stitch report label / path is set. Returns absolute path.""" if self.Parameters['-r'].isOn(): stitch_path = self._absolute(str(self.Parameters['-r'].Value)) return stitch_path elif self.Parameters['-r'].isOff(): ...
[ "def", "_get_stitch_report_path", "(", "self", ")", ":", "if", "self", ".", "Parameters", "[", "'-r'", "]", ".", "isOn", "(", ")", ":", "stitch_path", "=", "self", ".", "_absolute", "(", "str", "(", "self", ".", "Parameters", "[", "'-r'", "]", ".", "...
Checks if stitch report label / path is set. Returns absolute path.
[ "Checks", "if", "stitch", "report", "label", "/", "path", "is", "set", ".", "Returns", "absolute", "path", "." ]
python
train
aws/sagemaker-python-sdk
src/sagemaker/local/utils.py
https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/local/utils.py#L43-L68
def move_to_destination(source, destination, job_name, sagemaker_session): """move source to destination. Can handle uploading to S3 Args: source (str): root directory to move destination (str): file:// or s3:// URI that source will be moved to. job_name (str): SageMaker job name. ...
[ "def", "move_to_destination", "(", "source", ",", "destination", ",", "job_name", ",", "sagemaker_session", ")", ":", "parsed_uri", "=", "urlparse", "(", "destination", ")", "if", "parsed_uri", ".", "scheme", "==", "'file'", ":", "recursive_copy", "(", "source",...
move source to destination. Can handle uploading to S3 Args: source (str): root directory to move destination (str): file:// or s3:// URI that source will be moved to. job_name (str): SageMaker job name. sagemaker_session (sagemaker.Session): a sagemaker_session to interact with S3 ...
[ "move", "source", "to", "destination", ".", "Can", "handle", "uploading", "to", "S3" ]
python
train
google/grr
grr/core/grr_response_core/lib/parsers/linux_file_parser.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/parsers/linux_file_parser.py#L382-L398
def ReconcileShadow(self, store_type): """Verify that entries that claim to use shadow files have a shadow entry. If the entries of the non-shadowed file indicate that a shadow file is used, check that there is actually an entry for that file in shadow. Args: store_type: The type of password sto...
[ "def", "ReconcileShadow", "(", "self", ",", "store_type", ")", ":", "for", "k", ",", "v", "in", "iteritems", "(", "self", ".", "entry", ")", ":", "if", "v", ".", "pw_entry", ".", "store", "==", "store_type", ":", "shadow_entry", "=", "self", ".", "sh...
Verify that entries that claim to use shadow files have a shadow entry. If the entries of the non-shadowed file indicate that a shadow file is used, check that there is actually an entry for that file in shadow. Args: store_type: The type of password store that should be used (e.g. /etc/shad...
[ "Verify", "that", "entries", "that", "claim", "to", "use", "shadow", "files", "have", "a", "shadow", "entry", "." ]
python
train