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
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py#L453-L476
def Define(self, name, value = None, comment = None): """ Define a pre processor symbol name, with the optional given value in the current config header. If value is None (default), then #define name is written. If value is not none, then #define name value is written. ...
[ "def", "Define", "(", "self", ",", "name", ",", "value", "=", "None", ",", "comment", "=", "None", ")", ":", "lines", "=", "[", "]", "if", "comment", ":", "comment_str", "=", "\"/* %s */\"", "%", "comment", "lines", ".", "append", "(", "comment_str", ...
Define a pre processor symbol name, with the optional given value in the current config header. If value is None (default), then #define name is written. If value is not none, then #define name value is written. comment is a string which will be put as a C comment in the header, to exp...
[ "Define", "a", "pre", "processor", "symbol", "name", "with", "the", "optional", "given", "value", "in", "the", "current", "config", "header", "." ]
python
train
kodexlab/reliure
reliure/types.py
https://github.com/kodexlab/reliure/blob/0450c7a9254c5c003162738458bbe0c49e777ba5/reliure/types.py#L139-L154
def as_dict(self): """ returns a dictionary view of the option :returns: the option converted in a dict :rtype: dict """ info = {} info["type"] = self.__class__.__name__ info["help"] = self.help info["default"] = self.default info["multi"]...
[ "def", "as_dict", "(", "self", ")", ":", "info", "=", "{", "}", "info", "[", "\"type\"", "]", "=", "self", ".", "__class__", ".", "__name__", "info", "[", "\"help\"", "]", "=", "self", ".", "help", "info", "[", "\"default\"", "]", "=", "self", ".",...
returns a dictionary view of the option :returns: the option converted in a dict :rtype: dict
[ "returns", "a", "dictionary", "view", "of", "the", "option", ":", "returns", ":", "the", "option", "converted", "in", "a", "dict", ":", "rtype", ":", "dict" ]
python
train
iotaledger/iota.lib.py
iota/crypto/kerl/pykerl.py
https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/crypto/kerl/pykerl.py#L27-L80
def absorb(self, trits, offset=0, length=None): # type: (MutableSequence[int], int, Optional[int]) -> None """ Absorb trits into the sponge from a buffer. :param trits: Buffer that contains the trits to absorb. :param offset: Starting offset in ``trits``...
[ "def", "absorb", "(", "self", ",", "trits", ",", "offset", "=", "0", ",", "length", "=", "None", ")", ":", "# type: (MutableSequence[int], int, Optional[int]) -> None", "# Pad input if necessary, so that it can be divided evenly into", "# hashes.", "# Note that this operation c...
Absorb trits into the sponge from a buffer. :param trits: Buffer that contains the trits to absorb. :param offset: Starting offset in ``trits``. :param length: Number of trits to absorb. Defaults to ``len(trits)``.
[ "Absorb", "trits", "into", "the", "sponge", "from", "a", "buffer", "." ]
python
test
steven-lang/bottr
bottr/bot.py
https://github.com/steven-lang/bottr/blob/c1b92becc31adfbd5a7b77179b852a51da70b193/bottr/bot.py#L79-L115
def _listen_comments(self): """Start listening to comments, using a separate thread.""" # Collect comments in a queue comments_queue = Queue(maxsize=self._n_jobs * 4) threads = [] # type: List[BotQueueWorker] try: # Create n_jobs CommentsThreads for i ...
[ "def", "_listen_comments", "(", "self", ")", ":", "# Collect comments in a queue", "comments_queue", "=", "Queue", "(", "maxsize", "=", "self", ".", "_n_jobs", "*", "4", ")", "threads", "=", "[", "]", "# type: List[BotQueueWorker]", "try", ":", "# Create n_jobs Co...
Start listening to comments, using a separate thread.
[ "Start", "listening", "to", "comments", "using", "a", "separate", "thread", "." ]
python
train
ska-sa/purr
Purr/Editors.py
https://github.com/ska-sa/purr/blob/4c848768d0485d0f88b30850d0d5372221b21b66/Purr/Editors.py#L819-L851
def updateEntry(self): """Updates entry object with current content of dialog. In new entry mode (setEntry() not called, so self.entry=None), creates new entry object. In old entry mode (setEntry() called), updates and saves old entry object. """ # form up new entry title...
[ "def", "updateEntry", "(", "self", ")", ":", "# form up new entry", "title", "=", "str", "(", "self", ".", "wtitle", ".", "text", "(", ")", ")", "comment", "=", "str", "(", "self", ".", "comment_doc", ".", "toPlainText", "(", ")", ")", "# process comment...
Updates entry object with current content of dialog. In new entry mode (setEntry() not called, so self.entry=None), creates new entry object. In old entry mode (setEntry() called), updates and saves old entry object.
[ "Updates", "entry", "object", "with", "current", "content", "of", "dialog", ".", "In", "new", "entry", "mode", "(", "setEntry", "()", "not", "called", "so", "self", ".", "entry", "=", "None", ")", "creates", "new", "entry", "object", ".", "In", "old", ...
python
train
bitesofcode/projex
projex/rest.py
https://github.com/bitesofcode/projex/blob/d31743ec456a41428709968ab11a2cf6c6c76247/projex/rest.py#L92-L98
def jsonify(py_data, default=None, indent=4, sort_keys=True): """ Converts the inputted Python data to JSON format. :param py_data | <variant> """ return json.dumps(py_data, default=py2json, indent=indent, sort_keys=sort_keys)
[ "def", "jsonify", "(", "py_data", ",", "default", "=", "None", ",", "indent", "=", "4", ",", "sort_keys", "=", "True", ")", ":", "return", "json", ".", "dumps", "(", "py_data", ",", "default", "=", "py2json", ",", "indent", "=", "indent", ",", "sort_...
Converts the inputted Python data to JSON format. :param py_data | <variant>
[ "Converts", "the", "inputted", "Python", "data", "to", "JSON", "format", ".", ":", "param", "py_data", "|", "<variant", ">" ]
python
train
Chilipp/model-organization
model_organization/__init__.py
https://github.com/Chilipp/model-organization/blob/694d1219c7ed7e1b2b17153afa11bdc21169bca2/model_organization/__init__.py#L1595-L1616
def is_archived(self, experiment, ignore_missing=True): """ Convenience function to determine whether the given experiment has been archived already Parameters ---------- experiment: str The experiment to check Returns ------- str or ...
[ "def", "is_archived", "(", "self", ",", "experiment", ",", "ignore_missing", "=", "True", ")", ":", "if", "ignore_missing", ":", "if", "isinstance", "(", "self", ".", "config", ".", "experiments", ".", "get", "(", "experiment", ",", "True", ")", ",", "Ar...
Convenience function to determine whether the given experiment has been archived already Parameters ---------- experiment: str The experiment to check Returns ------- str or None The path to the archive if it has been archived, otherwise ...
[ "Convenience", "function", "to", "determine", "whether", "the", "given", "experiment", "has", "been", "archived", "already" ]
python
train
newville/wxmplot
examples/tifffile.py
https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/examples/tifffile.py#L497-L561
def series(self): """Return series of TIFFpage with compatible shape and properties.""" if self.is_ome: series = self._omeseries() elif self.is_fluoview: dims = {b'X': 'X', b'Y': 'Y', b'Z': 'Z', b'T': 'T', b'WAVELENGTH': 'C', b'TIME': 'T', b'XY': 'R', ...
[ "def", "series", "(", "self", ")", ":", "if", "self", ".", "is_ome", ":", "series", "=", "self", ".", "_omeseries", "(", ")", "elif", "self", ".", "is_fluoview", ":", "dims", "=", "{", "b'X'", ":", "'X'", ",", "b'Y'", ":", "'Y'", ",", "b'Z'", ":"...
Return series of TIFFpage with compatible shape and properties.
[ "Return", "series", "of", "TIFFpage", "with", "compatible", "shape", "and", "properties", "." ]
python
train
NuGrid/NuGridPy
nugridpy/mesa.py
https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/mesa.py#L2070-L2600
def kip_cont(self, ifig=110, modstart=0, modstop=-1,t0_model=0, outfile='out.png', xlims=None, ylims=None, xres=1000, yres=1000, ixaxis='model_number', mix_zones=20, burn_zones=20, plot_radius=False, engenPlus=True, engenMinus=False, l...
[ "def", "kip_cont", "(", "self", ",", "ifig", "=", "110", ",", "modstart", "=", "0", ",", "modstop", "=", "-", "1", ",", "t0_model", "=", "0", ",", "outfile", "=", "'out.png'", ",", "xlims", "=", "None", ",", "ylims", "=", "None", ",", "xres", "="...
This function creates a Kippenhahn plot with energy flux using contours. This plot uses mixing_regions and burning_regions written to your history.data or star.log. Set both variables in the log_columns.list file to 20 as a start. The output log file should then contain columns...
[ "This", "function", "creates", "a", "Kippenhahn", "plot", "with", "energy", "flux", "using", "contours", "." ]
python
train
ArduPilot/MAVProxy
MAVProxy/modules/lib/wxhorizon_ui.py
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/wxhorizon_ui.py#L569-L675
def on_timer(self, event): '''Main Loop.''' state = self.state self.loopStartTime = time.time() if state.close_event.wait(0.001): self.timer.Stop() self.Destroy() return # Check for resizing self.checkReszie() if self.r...
[ "def", "on_timer", "(", "self", ",", "event", ")", ":", "state", "=", "self", ".", "state", "self", ".", "loopStartTime", "=", "time", ".", "time", "(", ")", "if", "state", ".", "close_event", ".", "wait", "(", "0.001", ")", ":", "self", ".", "time...
Main Loop.
[ "Main", "Loop", "." ]
python
train
DataONEorg/d1_python
lib_common/src/d1_common/checksum.py
https://github.com/DataONEorg/d1_python/blob/3ac4d4f3ca052d3e8641a6a329cab526c8ddcb0d/lib_common/src/d1_common/checksum.py#L65-L84
def create_checksum_object_from_iterator( itr, algorithm=d1_common.const.DEFAULT_CHECKSUM_ALGORITHM ): """Calculate the checksum of an iterator. Args: itr: iterable Object which supports the iterator protocol. algorithm: str Checksum algorithm, ``MD5`` or ``SHA1`` / ``SHA-1``. ...
[ "def", "create_checksum_object_from_iterator", "(", "itr", ",", "algorithm", "=", "d1_common", ".", "const", ".", "DEFAULT_CHECKSUM_ALGORITHM", ")", ":", "checksum_str", "=", "calculate_checksum_on_iterator", "(", "itr", ",", "algorithm", ")", "checksum_pyxb", "=", "d...
Calculate the checksum of an iterator. Args: itr: iterable Object which supports the iterator protocol. algorithm: str Checksum algorithm, ``MD5`` or ``SHA1`` / ``SHA-1``. Returns: Populated Checksum PyXB object.
[ "Calculate", "the", "checksum", "of", "an", "iterator", "." ]
python
train
AkihikoITOH/capybara
capybara/virtualenv/lib/python2.7/site-packages/setuptools/__init__.py
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/__init__.py#L136-L147
def findall(dir = os.curdir): """Find all files under 'dir' and return the list of full filenames (relative to 'dir'). """ all_files = [] for base, dirs, files in os.walk(dir, followlinks=True): if base==os.curdir or base.startswith(os.curdir+os.sep): base = base[2:] if b...
[ "def", "findall", "(", "dir", "=", "os", ".", "curdir", ")", ":", "all_files", "=", "[", "]", "for", "base", ",", "dirs", ",", "files", "in", "os", ".", "walk", "(", "dir", ",", "followlinks", "=", "True", ")", ":", "if", "base", "==", "os", "....
Find all files under 'dir' and return the list of full filenames (relative to 'dir').
[ "Find", "all", "files", "under", "dir", "and", "return", "the", "list", "of", "full", "filenames", "(", "relative", "to", "dir", ")", "." ]
python
test
zero-os/0-core
client/py-client/zeroos/core0/client/client.py
https://github.com/zero-os/0-core/blob/69f6ce845ab8b8ad805a79a415227e7ac566c218/client/py-client/zeroos/core0/client/client.py#L1143-L1174
def nic_add(self, container, nic): """ Hot plug a nic into a container :param container: container ID :param nic: { 'type': nic_type # one of default, bridge, zerotier, macvlan, passthrough, vlan, or vxlan (note, vlan and vxlan only supported by ovs) ...
[ "def", "nic_add", "(", "self", ",", "container", ",", "nic", ")", ":", "args", "=", "{", "'container'", ":", "container", ",", "'nic'", ":", "nic", "}", "self", ".", "_nic_add", ".", "check", "(", "args", ")", "return", "self", ".", "_client", ".", ...
Hot plug a nic into a container :param container: container ID :param nic: { 'type': nic_type # one of default, bridge, zerotier, macvlan, passthrough, vlan, or vxlan (note, vlan and vxlan only supported by ovs) 'id': id # depends on the type ...
[ "Hot", "plug", "a", "nic", "into", "a", "container" ]
python
train
hyperledger/sawtooth-core
validator/sawtooth_validator/execution/scheduler_parallel.py
https://github.com/hyperledger/sawtooth-core/blob/8cf473bc2207e51f02bd182d825158a57d72b098/validator/sawtooth_validator/execution/scheduler_parallel.py#L631-L665
def _get_contexts_for_squash(self, batch_signature): """Starting with the batch referenced by batch_signature, iterate back through the batches and for each valid batch collect the context_id. At the end remove contexts for txns that are other txn's predecessors. Args: batch...
[ "def", "_get_contexts_for_squash", "(", "self", ",", "batch_signature", ")", ":", "batch", "=", "self", ".", "_batches_by_id", "[", "batch_signature", "]", ".", "batch", "index", "=", "self", ".", "_batches", ".", "index", "(", "batch", ")", "contexts", "=",...
Starting with the batch referenced by batch_signature, iterate back through the batches and for each valid batch collect the context_id. At the end remove contexts for txns that are other txn's predecessors. Args: batch_signature (str): The batch to start from, moving back through ...
[ "Starting", "with", "the", "batch", "referenced", "by", "batch_signature", "iterate", "back", "through", "the", "batches", "and", "for", "each", "valid", "batch", "collect", "the", "context_id", ".", "At", "the", "end", "remove", "contexts", "for", "txns", "th...
python
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/service_reflection.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/service_reflection.py#L251-L263
def BuildServiceStub(self, cls): """Constructs the stub class. Args: cls: The class that will be constructed. """ def _ServiceStubInit(stub, rpc_channel): stub.rpc_channel = rpc_channel self.cls = cls cls.__init__ = _ServiceStubInit for method in self.descriptor.methods: ...
[ "def", "BuildServiceStub", "(", "self", ",", "cls", ")", ":", "def", "_ServiceStubInit", "(", "stub", ",", "rpc_channel", ")", ":", "stub", ".", "rpc_channel", "=", "rpc_channel", "self", ".", "cls", "=", "cls", "cls", ".", "__init__", "=", "_ServiceStubIn...
Constructs the stub class. Args: cls: The class that will be constructed.
[ "Constructs", "the", "stub", "class", "." ]
python
train
pyviz/holoviews
holoviews/ipython/display_hooks.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/ipython/display_hooks.py#L230-L266
def display(obj, raw_output=False, **kwargs): """ Renders any HoloViews object to HTML and displays it using the IPython display function. If raw is enabled the raw HTML is returned instead of displaying it directly. """ if not Store.loaded_backends() and isinstance(obj, Dimensioned): ra...
[ "def", "display", "(", "obj", ",", "raw_output", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "not", "Store", ".", "loaded_backends", "(", ")", "and", "isinstance", "(", "obj", ",", "Dimensioned", ")", ":", "raise", "RuntimeError", "(", "'To ...
Renders any HoloViews object to HTML and displays it using the IPython display function. If raw is enabled the raw HTML is returned instead of displaying it directly.
[ "Renders", "any", "HoloViews", "object", "to", "HTML", "and", "displays", "it", "using", "the", "IPython", "display", "function", ".", "If", "raw", "is", "enabled", "the", "raw", "HTML", "is", "returned", "instead", "of", "displaying", "it", "directly", "." ...
python
train
bunq/sdk_python
bunq/sdk/exception_factory.py
https://github.com/bunq/sdk_python/blob/da6c9b83e6d83ee8062617f53c6eb7293c0d863d/bunq/sdk/exception_factory.py#L30-L98
def create_exception_for_response( cls, response_code, messages, response_id ): """ :type response_code: int :type messages: list[str] :type response_id: str :return: The exception according to the status code. :rtype: ...
[ "def", "create_exception_for_response", "(", "cls", ",", "response_code", ",", "messages", ",", "response_id", ")", ":", "error_message", "=", "cls", ".", "_generate_message_error", "(", "response_code", ",", "messages", ",", "response_id", ")", "if", "response_code...
:type response_code: int :type messages: list[str] :type response_id: str :return: The exception according to the status code. :rtype: ApiException
[ ":", "type", "response_code", ":", "int", ":", "type", "messages", ":", "list", "[", "str", "]", ":", "type", "response_id", ":", "str" ]
python
train
OCR-D/core
ocrd_validators/ocrd_validators/json_validator.py
https://github.com/OCR-D/core/blob/57e68c578526cb955fd2e368207f5386c459d91d/ocrd_validators/ocrd_validators/json_validator.py#L65-L78
def _validate(self, obj): """ Do the actual validation Arguments: obj (dict): object to validate Returns: ValidationReport """ report = ValidationReport() if not self.validator.is_valid(obj): for v in self.validator.iter_errors(obj): ...
[ "def", "_validate", "(", "self", ",", "obj", ")", ":", "report", "=", "ValidationReport", "(", ")", "if", "not", "self", ".", "validator", ".", "is_valid", "(", "obj", ")", ":", "for", "v", "in", "self", ".", "validator", ".", "iter_errors", "(", "ob...
Do the actual validation Arguments: obj (dict): object to validate Returns: ValidationReport
[ "Do", "the", "actual", "validation" ]
python
train
tensorflow/tensor2tensor
tensor2tensor/layers/discretization.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/discretization.py#L1429-L1437
def isemhash_unbottleneck(x, hidden_size, isemhash_filter_size_multiplier=1.0): """Improved semantic hashing un-bottleneck.""" filter_size = int(hidden_size * isemhash_filter_size_multiplier) x = 0.5 * (x - 1.0) # Move from [-1, 1] to [0, 1]. with tf.variable_scope("isemhash_unbottleneck"): h1a = tf.layers...
[ "def", "isemhash_unbottleneck", "(", "x", ",", "hidden_size", ",", "isemhash_filter_size_multiplier", "=", "1.0", ")", ":", "filter_size", "=", "int", "(", "hidden_size", "*", "isemhash_filter_size_multiplier", ")", "x", "=", "0.5", "*", "(", "x", "-", "1.0", ...
Improved semantic hashing un-bottleneck.
[ "Improved", "semantic", "hashing", "un", "-", "bottleneck", "." ]
python
train
uw-it-aca/uw-restclients-nws
uw_nws/__init__.py
https://github.com/uw-it-aca/uw-restclients-nws/blob/ec6fd14342ffc883d14bcb53b2fe9bc288696027/uw_nws/__init__.py#L274-L291
def search_subscriptions(self, **kwargs): """ Search for all subscriptions by parameters """ params = [(key, kwargs[key]) for key in sorted(kwargs.keys())] url = "/notification/v1/subscription?{}".format( urlencode(params, doseq=True)) response = NWS_DAO().ge...
[ "def", "search_subscriptions", "(", "self", ",", "*", "*", "kwargs", ")", ":", "params", "=", "[", "(", "key", ",", "kwargs", "[", "key", "]", ")", "for", "key", "in", "sorted", "(", "kwargs", ".", "keys", "(", ")", ")", "]", "url", "=", "\"/noti...
Search for all subscriptions by parameters
[ "Search", "for", "all", "subscriptions", "by", "parameters" ]
python
train
swharden/SWHLab
swhlab/core.py
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/core.py#L175-L179
def setsweeps(self): """iterate over every sweep""" for sweep in range(self.sweeps): self.setsweep(sweep) yield self.sweep
[ "def", "setsweeps", "(", "self", ")", ":", "for", "sweep", "in", "range", "(", "self", ".", "sweeps", ")", ":", "self", ".", "setsweep", "(", "sweep", ")", "yield", "self", ".", "sweep" ]
iterate over every sweep
[ "iterate", "over", "every", "sweep" ]
python
valid
google/grr
grr/core/grr_response_core/lib/rdfvalues/structs.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/rdfvalues/structs.py#L947-L950
def ConvertToWireFormat(self, value): """Encode the nested protobuf into wire format.""" output = _SerializeEntries(_GetOrderedEntries(value.GetRawData())) return (self.encoded_tag, VarintEncode(len(output)), output)
[ "def", "ConvertToWireFormat", "(", "self", ",", "value", ")", ":", "output", "=", "_SerializeEntries", "(", "_GetOrderedEntries", "(", "value", ".", "GetRawData", "(", ")", ")", ")", "return", "(", "self", ".", "encoded_tag", ",", "VarintEncode", "(", "len",...
Encode the nested protobuf into wire format.
[ "Encode", "the", "nested", "protobuf", "into", "wire", "format", "." ]
python
train
Becksteinlab/GromacsWrapper
gromacs/cbook.py
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L1772-L1847
def fit(self, xy=False, **kwargs): """Write xtc that is fitted to the tpr reference structure. Runs :class:`gromacs.tools.trjconv` with appropriate arguments for fitting. The most important *kwargs* are listed here but in most cases the defaults should work. Note that the defau...
[ "def", "fit", "(", "self", ",", "xy", "=", "False", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "setdefault", "(", "'s'", ",", "self", ".", "tpr", ")", "kwargs", ".", "setdefault", "(", "'n'", ",", "self", ".", "ndx", ")", "kwargs", "[", ...
Write xtc that is fitted to the tpr reference structure. Runs :class:`gromacs.tools.trjconv` with appropriate arguments for fitting. The most important *kwargs* are listed here but in most cases the defaults should work. Note that the default settings do *not* include centering or ...
[ "Write", "xtc", "that", "is", "fitted", "to", "the", "tpr", "reference", "structure", "." ]
python
valid
wummel/linkchecker
linkcheck/director/__init__.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/director/__init__.py#L70-L80
def check_url (aggregate): """Helper function waiting for URL queue.""" while True: try: aggregate.urlqueue.join(timeout=30) break except urlqueue.Timeout: # Cleanup threads every 30 seconds aggregate.remove_stopped_threads() if not any...
[ "def", "check_url", "(", "aggregate", ")", ":", "while", "True", ":", "try", ":", "aggregate", ".", "urlqueue", ".", "join", "(", "timeout", "=", "30", ")", "break", "except", "urlqueue", ".", "Timeout", ":", "# Cleanup threads every 30 seconds", "aggregate", ...
Helper function waiting for URL queue.
[ "Helper", "function", "waiting", "for", "URL", "queue", "." ]
python
train
fabioz/PyDev.Debugger
_pydevd_bundle/pydevd_process_net_command_json.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/_pydevd_bundle/pydevd_process_net_command_json.py#L213-L244
def on_completions_request(self, py_db, request): ''' :param CompletionsRequest request: ''' arguments = request.arguments # : :type arguments: CompletionsArguments seq = request.seq text = arguments.text frame_id = arguments.frameId thread_id = py_db.sus...
[ "def", "on_completions_request", "(", "self", ",", "py_db", ",", "request", ")", ":", "arguments", "=", "request", ".", "arguments", "# : :type arguments: CompletionsArguments", "seq", "=", "request", ".", "seq", "text", "=", "arguments", ".", "text", "frame_id", ...
:param CompletionsRequest request:
[ ":", "param", "CompletionsRequest", "request", ":" ]
python
train
dmippolitov/pydnsbl
pydnsbl/checker.py
https://github.com/dmippolitov/pydnsbl/blob/76c460f1118213d66498ddafde2053d8de4ccbdb/pydnsbl/checker.py#L150-L157
def check_ips(self, addrs): """ sync check multiple ips """ tasks = [] for addr in addrs: tasks.append(self._check_ip(addr)) return self._loop.run_until_complete(asyncio.gather(*tasks))
[ "def", "check_ips", "(", "self", ",", "addrs", ")", ":", "tasks", "=", "[", "]", "for", "addr", "in", "addrs", ":", "tasks", ".", "append", "(", "self", ".", "_check_ip", "(", "addr", ")", ")", "return", "self", ".", "_loop", ".", "run_until_complete...
sync check multiple ips
[ "sync", "check", "multiple", "ips" ]
python
train
aliyun/aliyun-odps-python-sdk
odps/console.py
https://github.com/aliyun/aliyun-odps-python-sdk/blob/4b0de18f5864386df6068f26f026e62f932c41e4/odps/console.py#L368-L391
def isatty(file): """ Returns `True` if `file` is a tty. Most built-in Python file-like objects have an `isatty` member, but some user-defined types may not, so this assumes those are not ttys. """ if (multiprocessing.current_process().name != 'MainProcess' or threading.current_thre...
[ "def", "isatty", "(", "file", ")", ":", "if", "(", "multiprocessing", ".", "current_process", "(", ")", ".", "name", "!=", "'MainProcess'", "or", "threading", ".", "current_thread", "(", ")", ".", "getName", "(", ")", "!=", "'MainThread'", ")", ":", "ret...
Returns `True` if `file` is a tty. Most built-in Python file-like objects have an `isatty` member, but some user-defined types may not, so this assumes those are not ttys.
[ "Returns", "True", "if", "file", "is", "a", "tty", "." ]
python
train
yyuu/botornado
boto/cloudfront/distribution.py
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/cloudfront/distribution.py#L448-L463
def set_permissions_all(self, replace=False): """ Sets the S3 ACL grants for all objects in the Distribution to the appropriate value based on the type of Distribution. :type replace: bool :param replace: If False, the Origin Access Identity will be appen...
[ "def", "set_permissions_all", "(", "self", ",", "replace", "=", "False", ")", ":", "bucket", "=", "self", ".", "_get_bucket", "(", ")", "for", "key", "in", "bucket", ":", "self", ".", "set_permissions", "(", "key", ",", "replace", ")" ]
Sets the S3 ACL grants for all objects in the Distribution to the appropriate value based on the type of Distribution. :type replace: bool :param replace: If False, the Origin Access Identity will be appended to the existing ACL for the object. If...
[ "Sets", "the", "S3", "ACL", "grants", "for", "all", "objects", "in", "the", "Distribution", "to", "the", "appropriate", "value", "based", "on", "the", "type", "of", "Distribution", "." ]
python
train
sivakov512/python-static-api-generator
static_api_generator/generator.py
https://github.com/sivakov512/python-static-api-generator/blob/0a7ec27324b9b2a3d1fa9894c4cba73af9ebcc01/static_api_generator/generator.py#L58-L68
def dest_fpath(self, source_fpath: str) -> str: """Calculates full path for end json-api file from source file full path.""" relative_fpath = os.path.join(*source_fpath.split(os.sep)[1:]) relative_dirpath = os.path.dirname(relative_fpath) source_fname = relative_fpath.split(os.s...
[ "def", "dest_fpath", "(", "self", ",", "source_fpath", ":", "str", ")", "->", "str", ":", "relative_fpath", "=", "os", ".", "path", ".", "join", "(", "*", "source_fpath", ".", "split", "(", "os", ".", "sep", ")", "[", "1", ":", "]", ")", "relative_...
Calculates full path for end json-api file from source file full path.
[ "Calculates", "full", "path", "for", "end", "json", "-", "api", "file", "from", "source", "file", "full", "path", "." ]
python
train
shaiguitar/snowclient.py
snowclient/client.py
https://github.com/shaiguitar/snowclient.py/blob/6bb513576d3b37612a7a4da225140d134f3e1c82/snowclient/client.py#L10-L16
def list(self,table, **kparams): """ get a collection of records by table name. returns a collection of SnowRecord obj. """ records = self.api.list(table, **kparams) return records
[ "def", "list", "(", "self", ",", "table", ",", "*", "*", "kparams", ")", ":", "records", "=", "self", ".", "api", ".", "list", "(", "table", ",", "*", "*", "kparams", ")", "return", "records" ]
get a collection of records by table name. returns a collection of SnowRecord obj.
[ "get", "a", "collection", "of", "records", "by", "table", "name", ".", "returns", "a", "collection", "of", "SnowRecord", "obj", "." ]
python
train
knipknap/SpiffWorkflow
SpiffWorkflow/util/event.py
https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/util/event.py#L219-L237
def disconnect(self, callback): """ Disconnects the signal from the given function. :type callback: object :param callback: The callback function. """ if self.weak_subscribers is not None: with self.lock: index = self._weakly_connected_index(...
[ "def", "disconnect", "(", "self", ",", "callback", ")", ":", "if", "self", ".", "weak_subscribers", "is", "not", "None", ":", "with", "self", ".", "lock", ":", "index", "=", "self", ".", "_weakly_connected_index", "(", "callback", ")", "if", "index", "is...
Disconnects the signal from the given function. :type callback: object :param callback: The callback function.
[ "Disconnects", "the", "signal", "from", "the", "given", "function", "." ]
python
valid
estnltk/estnltk
estnltk/text.py
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L564-L568
def word_spans(self): """The list of spans representing ``words`` layer elements.""" if not self.is_tagged(WORDS): self.tokenize_words() return self.spans(WORDS)
[ "def", "word_spans", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "WORDS", ")", ":", "self", ".", "tokenize_words", "(", ")", "return", "self", ".", "spans", "(", "WORDS", ")" ]
The list of spans representing ``words`` layer elements.
[ "The", "list", "of", "spans", "representing", "words", "layer", "elements", "." ]
python
train
nephila/python-taiga
taiga/models/models.py
https://github.com/nephila/python-taiga/blob/5b471d6b8b59e5d410162a6f1c2f0d4188445a56/taiga/models/models.py#L1288-L1298
def import_task(self, subject, status, **attrs): """ Import a Task and return a :class:`Task` object. :param subject: subject of the :class:`Task` :param status: status of the :class:`Task` :param attrs: optional attributes for :class:`Task` """ return Tasks(self...
[ "def", "import_task", "(", "self", ",", "subject", ",", "status", ",", "*", "*", "attrs", ")", ":", "return", "Tasks", "(", "self", ".", "requester", ")", ".", "import_", "(", "self", ".", "id", ",", "subject", ",", "status", ",", "*", "*", "attrs"...
Import a Task and return a :class:`Task` object. :param subject: subject of the :class:`Task` :param status: status of the :class:`Task` :param attrs: optional attributes for :class:`Task`
[ "Import", "a", "Task", "and", "return", "a", ":", "class", ":", "Task", "object", "." ]
python
train
TeamHG-Memex/eli5
eli5/lime/textutils.py
https://github.com/TeamHG-Memex/eli5/blob/371b402a0676295c05e582a2dd591f7af476b86b/eli5/lime/textutils.py#L112-L144
def replace_random_tokens_bow(self, n_samples, # type: int replacement='', # type: str random_state=None, min_replace=1, # type: Union[int, float] ...
[ "def", "replace_random_tokens_bow", "(", "self", ",", "n_samples", ",", "# type: int", "replacement", "=", "''", ",", "# type: str", "random_state", "=", "None", ",", "min_replace", "=", "1", ",", "# type: Union[int, float]", "max_replace", "=", "1.0", ",", "# typ...
Return a list of ``(text, replaced_words_count, mask)`` tuples with n_samples versions of text with some words replaced. If a word is replaced, all duplicate words are also replaced from the text. By default words are replaced with '', i.e. removed.
[ "Return", "a", "list", "of", "(", "text", "replaced_words_count", "mask", ")", "tuples", "with", "n_samples", "versions", "of", "text", "with", "some", "words", "replaced", ".", "If", "a", "word", "is", "replaced", "all", "duplicate", "words", "are", "also",...
python
train
JukeboxPipeline/jukeboxmaya
src/jukeboxmaya/addons/mayagenesis/mayagenesis.py
https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/addons/mayagenesis/mayagenesis.py#L116-L281
def subclass_genesis(self, genesisclass): """Subclass the given genesis class and implement all abstract methods :param genesisclass: the GenesisWin class to subclass :type genesisclass: :class:`GenesisWin` :returns: the subclass :rtype: subclass of :class:`GenesisWin` :...
[ "def", "subclass_genesis", "(", "self", ",", "genesisclass", ")", ":", "class", "MayaGenesisWin", "(", "genesisclass", ")", ":", "\"\"\"Implementation of Genesis for maya\n \"\"\"", "def", "open_shot", "(", "self", ",", "taskfile", ")", ":", "\"\"\"Open the g...
Subclass the given genesis class and implement all abstract methods :param genesisclass: the GenesisWin class to subclass :type genesisclass: :class:`GenesisWin` :returns: the subclass :rtype: subclass of :class:`GenesisWin` :raises: None
[ "Subclass", "the", "given", "genesis", "class", "and", "implement", "all", "abstract", "methods" ]
python
train
andialbrecht/sqlparse
sqlparse/sql.py
https://github.com/andialbrecht/sqlparse/blob/913b56e34edc7e3025feea4744dbd762774805c3/sqlparse/sql.py#L470-L477
def get_identifiers(self): """Returns the identifiers. Whitespaces and punctuations are not included in this generator. """ for token in self.tokens: if not (token.is_whitespace or token.match(T.Punctuation, ',')): yield token
[ "def", "get_identifiers", "(", "self", ")", ":", "for", "token", "in", "self", ".", "tokens", ":", "if", "not", "(", "token", ".", "is_whitespace", "or", "token", ".", "match", "(", "T", ".", "Punctuation", ",", "','", ")", ")", ":", "yield", "token"...
Returns the identifiers. Whitespaces and punctuations are not included in this generator.
[ "Returns", "the", "identifiers", "." ]
python
train
Shizmob/pydle
pydle/features/tls.py
https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/features/tls.py#L28-L35
async def connect(self, hostname=None, port=None, tls=False, **kwargs): """ Connect to a server, optionally over TLS. See pydle.features.RFC1459Support.connect for misc parameters. """ if not port: if tls: port = DEFAULT_TLS_PORT else: port = rfc14...
[ "async", "def", "connect", "(", "self", ",", "hostname", "=", "None", ",", "port", "=", "None", ",", "tls", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "not", "port", ":", "if", "tls", ":", "port", "=", "DEFAULT_TLS_PORT", "else", ":", ...
Connect to a server, optionally over TLS. See pydle.features.RFC1459Support.connect for misc parameters.
[ "Connect", "to", "a", "server", "optionally", "over", "TLS", ".", "See", "pydle", ".", "features", ".", "RFC1459Support", ".", "connect", "for", "misc", "parameters", "." ]
python
train
raamana/hiwenet
docs/example_thickness_hiwenet.py
https://github.com/raamana/hiwenet/blob/b12699b3722fd0a6a835e7d7ca4baf58fb181809/docs/example_thickness_hiwenet.py#L25-L31
def get_parcellation(atlas, parcel_param): "Placeholder to insert your own function to return parcellation in reference space." parc_path = os.path.join(atlas, 'parcellation_param{}.mgh'.format(parcel_param)) parcel = nibabel.freesurfer.io.read_geometry(parc_path) return parcel
[ "def", "get_parcellation", "(", "atlas", ",", "parcel_param", ")", ":", "parc_path", "=", "os", ".", "path", ".", "join", "(", "atlas", ",", "'parcellation_param{}.mgh'", ".", "format", "(", "parcel_param", ")", ")", "parcel", "=", "nibabel", ".", "freesurfe...
Placeholder to insert your own function to return parcellation in reference space.
[ "Placeholder", "to", "insert", "your", "own", "function", "to", "return", "parcellation", "in", "reference", "space", "." ]
python
train
materialsproject/pymatgen
pymatgen/io/lammps/data.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/lammps/data.py#L128-L150
def get_string(self, significant_figures=6): """ Returns the string representation of simulation box in LAMMPS data file format. Args: significant_figures (int): No. of significant figures to output for box settings. Default to 6. Returns: ...
[ "def", "get_string", "(", "self", ",", "significant_figures", "=", "6", ")", ":", "ph", "=", "\"{:.%df}\"", "%", "significant_figures", "lines", "=", "[", "]", "for", "bound", ",", "d", "in", "zip", "(", "self", ".", "bounds", ",", "\"xyz\"", ")", ":",...
Returns the string representation of simulation box in LAMMPS data file format. Args: significant_figures (int): No. of significant figures to output for box settings. Default to 6. Returns: String representation
[ "Returns", "the", "string", "representation", "of", "simulation", "box", "in", "LAMMPS", "data", "file", "format", "." ]
python
train
tomer8007/kik-bot-api-unofficial
kik_unofficial/client.py
https://github.com/tomer8007/kik-bot-api-unofficial/blob/2ae5216bc05e7099a41895382fc8e428a7a5c3ac/kik_unofficial/client.py#L191-L201
def send_is_typing(self, peer_jid: str, is_typing: bool): """ Updates the 'is typing' status of the bot during a conversation. :param peer_jid: The JID that the notification will be sent to :param is_typing: If true, indicates that we're currently typing, or False otherwise. """...
[ "def", "send_is_typing", "(", "self", ",", "peer_jid", ":", "str", ",", "is_typing", ":", "bool", ")", ":", "if", "self", ".", "is_group_jid", "(", "peer_jid", ")", ":", "return", "self", ".", "_send_xmpp_element", "(", "chatting", ".", "OutgoingGroupIsTypin...
Updates the 'is typing' status of the bot during a conversation. :param peer_jid: The JID that the notification will be sent to :param is_typing: If true, indicates that we're currently typing, or False otherwise.
[ "Updates", "the", "is", "typing", "status", "of", "the", "bot", "during", "a", "conversation", "." ]
python
train
profitbricks/profitbricks-sdk-python
profitbricks/client.py
https://github.com/profitbricks/profitbricks-sdk-python/blob/2c804b141688eccb07d6ae56601d5c60a62abebd/profitbricks/client.py#L144-L202
def _get_password(self, password, use_config=True, config_filename=None, use_keyring=HAS_KEYRING): """ Determine the user password If the password is given, this password is used. Otherwise this function will try to get the password from the user's keyring ...
[ "def", "_get_password", "(", "self", ",", "password", ",", "use_config", "=", "True", ",", "config_filename", "=", "None", ",", "use_keyring", "=", "HAS_KEYRING", ")", ":", "if", "not", "password", "and", "use_config", ":", "if", "self", ".", "_config", "i...
Determine the user password If the password is given, this password is used. Otherwise this function will try to get the password from the user's keyring if `use_keyring` is set to True. :param username: Username (used directly if given) :type username: ``str`` ...
[ "Determine", "the", "user", "password" ]
python
valid
webadmin87/midnight
midnight_main/services.py
https://github.com/webadmin87/midnight/blob/b60b3b257b4d633550b82a692f3ea3756c62a0a9/midnight_main/services.py#L85-L104
def get_by_page(query, page, page_size): """ Осуществляет пагинацию :param query: запрос :param page: номер страницы :param page_size: количество объектов на странице :return: """ pager = Paginator(query, page_size) try: models = pager.page(page) except PageNotAnInteger:...
[ "def", "get_by_page", "(", "query", ",", "page", ",", "page_size", ")", ":", "pager", "=", "Paginator", "(", "query", ",", "page_size", ")", "try", ":", "models", "=", "pager", ".", "page", "(", "page", ")", "except", "PageNotAnInteger", ":", "# If page ...
Осуществляет пагинацию :param query: запрос :param page: номер страницы :param page_size: количество объектов на странице :return:
[ "Осуществляет", "пагинацию", ":", "param", "query", ":", "запрос", ":", "param", "page", ":", "номер", "страницы", ":", "param", "page_size", ":", "количество", "объектов", "на", "странице", ":", "return", ":" ]
python
train
delfick/harpoon
harpoon/actions.py
https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/actions.py#L102-L112
def pull(collector, image, **kwargs): """Pull an image""" if not image.image_index: raise BadOption("The chosen image does not have a image_index configuration", wanted=image.name) tag = kwargs["artifact"] if tag is NotSpecified: collector.configuration["harpoon"].tag if tag is not N...
[ "def", "pull", "(", "collector", ",", "image", ",", "*", "*", "kwargs", ")", ":", "if", "not", "image", ".", "image_index", ":", "raise", "BadOption", "(", "\"The chosen image does not have a image_index configuration\"", ",", "wanted", "=", "image", ".", "name"...
Pull an image
[ "Pull", "an", "image" ]
python
train
secynic/ipwhois
ipwhois/rdap.py
https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/rdap.py#L182-L212
def _parse_email(self, val): """ The function for parsing the vcard email addresses. Args: val (:obj:`list`): The value to parse. """ ret = { 'type': None, 'value': None } try: ret['type'] = val[1]['type'] ...
[ "def", "_parse_email", "(", "self", ",", "val", ")", ":", "ret", "=", "{", "'type'", ":", "None", ",", "'value'", ":", "None", "}", "try", ":", "ret", "[", "'type'", "]", "=", "val", "[", "1", "]", "[", "'type'", "]", "except", "(", "KeyError", ...
The function for parsing the vcard email addresses. Args: val (:obj:`list`): The value to parse.
[ "The", "function", "for", "parsing", "the", "vcard", "email", "addresses", "." ]
python
train
teepark/greenhouse
greenhouse/scheduler.py
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/scheduler.py#L381-L442
def schedule_recurring(interval, target=None, maxtimes=0, starting_at=0, args=(), kwargs=None): """insert a greenlet into the scheduler to run regularly at an interval If provided a function, it is wrapped in a new greenlet :param interval: the number of seconds between invocations ...
[ "def", "schedule_recurring", "(", "interval", ",", "target", "=", "None", ",", "maxtimes", "=", "0", ",", "starting_at", "=", "0", ",", "args", "=", "(", ")", ",", "kwargs", "=", "None", ")", ":", "starting_at", "=", "starting_at", "or", "time", ".", ...
insert a greenlet into the scheduler to run regularly at an interval If provided a function, it is wrapped in a new greenlet :param interval: the number of seconds between invocations :type interval: int or float :param target: what to schedule :type target: function or greenlet :param maxtime...
[ "insert", "a", "greenlet", "into", "the", "scheduler", "to", "run", "regularly", "at", "an", "interval" ]
python
train
saltstack/salt
salt/cloud/clouds/linode.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/linode.py#L1455-L1469
def _clean_data(api_response): ''' Returns the DATA response from a Linode API query as a single pre-formatted dictionary api_response The query to be cleaned. ''' data = {} data.update(api_response['DATA']) if not data: response_data = api_response['DATA'] data.upd...
[ "def", "_clean_data", "(", "api_response", ")", ":", "data", "=", "{", "}", "data", ".", "update", "(", "api_response", "[", "'DATA'", "]", ")", "if", "not", "data", ":", "response_data", "=", "api_response", "[", "'DATA'", "]", "data", ".", "update", ...
Returns the DATA response from a Linode API query as a single pre-formatted dictionary api_response The query to be cleaned.
[ "Returns", "the", "DATA", "response", "from", "a", "Linode", "API", "query", "as", "a", "single", "pre", "-", "formatted", "dictionary" ]
python
train
netleibi/fastchunking
fastchunking/__init__.py
https://github.com/netleibi/fastchunking/blob/069b7689d26bc067120907f01d9453ab3d2efa74/fastchunking/__init__.py#L214-L230
def create_multilevel_chunker(self, chunk_sizes): """Create a multi-level chunker performing content-defined chunking (CDC) using Rabin Karp's rolling hash scheme with different specific, expected chunk sizes. Args: chunk_sizes (list): List of (expected) target chunk sizes. ...
[ "def", "create_multilevel_chunker", "(", "self", ",", "chunk_sizes", ")", ":", "rolling_hash", "=", "_rabinkarprh", ".", "RabinKarpMultiThresholdHash", "(", "self", ".", "window_size", ",", "self", ".", "_seed", ",", "[", "1.0", "/", "chunk_size", "for", "chunk_...
Create a multi-level chunker performing content-defined chunking (CDC) using Rabin Karp's rolling hash scheme with different specific, expected chunk sizes. Args: chunk_sizes (list): List of (expected) target chunk sizes. Warning: For performance reasons...
[ "Create", "a", "multi", "-", "level", "chunker", "performing", "content", "-", "defined", "chunking", "(", "CDC", ")", "using", "Rabin", "Karp", "s", "rolling", "hash", "scheme", "with", "different", "specific", "expected", "chunk", "sizes", "." ]
python
valid
dpgaspar/Flask-AppBuilder
flask_appbuilder/api/manager.py
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/api/manager.py#L18-L49
def get(self, version): """ Endpoint that renders an OpenApi spec for all views that belong to a certain version --- get: parameters: - in: path schema: type: string name: version responses: 200: ...
[ "def", "get", "(", "self", ",", "version", ")", ":", "version_found", "=", "False", "api_spec", "=", "self", ".", "_create_api_spec", "(", "version", ")", "for", "base_api", "in", "current_app", ".", "appbuilder", ".", "baseviews", ":", "if", "isinstance", ...
Endpoint that renders an OpenApi spec for all views that belong to a certain version --- get: parameters: - in: path schema: type: string name: version responses: 200: description: Item from Model ...
[ "Endpoint", "that", "renders", "an", "OpenApi", "spec", "for", "all", "views", "that", "belong", "to", "a", "certain", "version", "---", "get", ":", "parameters", ":", "-", "in", ":", "path", "schema", ":", "type", ":", "string", "name", ":", "version", ...
python
train
ewels/MultiQC
multiqc/modules/damageprofiler/damageprofiler.py
https://github.com/ewels/MultiQC/blob/2037d6322b2554146a74efbf869156ad20d4c4ec/multiqc/modules/damageprofiler/damageprofiler.py#L242-L267
def threeprime_plot(self): """Generate a 3' G>A linegraph plot""" data = dict() dict_to_add = dict() # Create tuples out of entries for key in self.threepGtoAfreq_data: pos = list(range(1,len(self.threepGtoAfreq_data.get(key)))) #Multiply values by 100 to...
[ "def", "threeprime_plot", "(", "self", ")", ":", "data", "=", "dict", "(", ")", "dict_to_add", "=", "dict", "(", ")", "# Create tuples out of entries", "for", "key", "in", "self", ".", "threepGtoAfreq_data", ":", "pos", "=", "list", "(", "range", "(", "1",...
Generate a 3' G>A linegraph plot
[ "Generate", "a", "3", "G", ">", "A", "linegraph", "plot" ]
python
train
Erotemic/utool
utool/util_numpy.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_numpy.py#L55-L81
def _pystate_to_npstate(pystate): """ Convert state of a Python Random object to state usable by NumPy RandomState. References: https://stackoverflow.com/questions/44313620/converting-randomstate Example: >>> # ENABLE_DOCTEST >>> from utool.util_numpy import * # NOQA ...
[ "def", "_pystate_to_npstate", "(", "pystate", ")", ":", "NP_VERSION", "=", "'MT19937'", "version", ",", "keys_pos_", ",", "cached_gaussian_", "=", "pystate", "keys", ",", "pos", "=", "keys_pos_", "[", ":", "-", "1", "]", ",", "keys_pos_", "[", "-", "1", ...
Convert state of a Python Random object to state usable by NumPy RandomState. References: https://stackoverflow.com/questions/44313620/converting-randomstate Example: >>> # ENABLE_DOCTEST >>> from utool.util_numpy import * # NOQA >>> from utool.util_numpy import _pystate_t...
[ "Convert", "state", "of", "a", "Python", "Random", "object", "to", "state", "usable", "by", "NumPy", "RandomState", "." ]
python
train
loli/medpy
medpy/graphcut/wrapper.py
https://github.com/loli/medpy/blob/95216b9e22e7ce301f0edf953ee2a2f1b6c6aee5/medpy/graphcut/wrapper.py#L203-L262
def graphcut_stawiaski(regions, gradient = False, foreground = False, background = False): """ Executes a Stawiaski label graph cut. Parameters ---------- regions : ndarray The regions image / label map. gradient : ndarray The gradient image. foreground : ndarray ...
[ "def", "graphcut_stawiaski", "(", "regions", ",", "gradient", "=", "False", ",", "foreground", "=", "False", ",", "background", "=", "False", ")", ":", "# initialize logger", "logger", "=", "Logger", ".", "getInstance", "(", ")", "# unpack images if required", "...
Executes a Stawiaski label graph cut. Parameters ---------- regions : ndarray The regions image / label map. gradient : ndarray The gradient image. foreground : ndarray The foreground markers. background : ndarray The background markers. Returns ...
[ "Executes", "a", "Stawiaski", "label", "graph", "cut", ".", "Parameters", "----------", "regions", ":", "ndarray", "The", "regions", "image", "/", "label", "map", ".", "gradient", ":", "ndarray", "The", "gradient", "image", ".", "foreground", ":", "ndarray", ...
python
train
allenai/allennlp
allennlp/training/scheduler.py
https://github.com/allenai/allennlp/blob/648a36f77db7e45784c047176074f98534c76636/allennlp/training/scheduler.py#L49-L53
def state_dict(self) -> Dict[str, Any]: """ Returns the state of the scheduler as a ``dict``. """ return {key: value for key, value in self.__dict__.items() if key != 'optimizer'}
[ "def", "state_dict", "(", "self", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "return", "{", "key", ":", "value", "for", "key", ",", "value", "in", "self", ".", "__dict__", ".", "items", "(", ")", "if", "key", "!=", "'optimizer'", "}" ]
Returns the state of the scheduler as a ``dict``.
[ "Returns", "the", "state", "of", "the", "scheduler", "as", "a", "dict", "." ]
python
train
websocket-client/websocket-client
websocket/_core.py
https://github.com/websocket-client/websocket-client/blob/3c25814664fef5b78716ed8841123ed1c0d17824/websocket/_core.py#L138-L146
def settimeout(self, timeout): """ Set the timeout to the websocket. timeout: timeout time(second). """ self.sock_opt.timeout = timeout if self.sock: self.sock.settimeout(timeout)
[ "def", "settimeout", "(", "self", ",", "timeout", ")", ":", "self", ".", "sock_opt", ".", "timeout", "=", "timeout", "if", "self", ".", "sock", ":", "self", ".", "sock", ".", "settimeout", "(", "timeout", ")" ]
Set the timeout to the websocket. timeout: timeout time(second).
[ "Set", "the", "timeout", "to", "the", "websocket", "." ]
python
train
KrishnaswamyLab/graphtools
graphtools/base.py
https://github.com/KrishnaswamyLab/graphtools/blob/44685352be7df2005d44722903092207967457f2/graphtools/base.py#L494-L510
def P(self): """Diffusion operator (cached) Return or calculate the diffusion operator Returns ------- P : array-like, shape=[n_samples, n_samples] diffusion operator defined as a row-stochastic form of the kernel matrix """ try: ...
[ "def", "P", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_diff_op", "except", "AttributeError", ":", "self", ".", "_diff_op", "=", "normalize", "(", "self", ".", "kernel", ",", "'l1'", ",", "axis", "=", "1", ")", "return", "self", ".", ...
Diffusion operator (cached) Return or calculate the diffusion operator Returns ------- P : array-like, shape=[n_samples, n_samples] diffusion operator defined as a row-stochastic form of the kernel matrix
[ "Diffusion", "operator", "(", "cached", ")" ]
python
train
peri-source/peri
peri/opt/optimize.py
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/optimize.py#L1684-L1707
def find_expected_error(self, delta_params='calc', adjust=True): """ Returns the error expected after an update if the model were linear. Parameters ---------- delta_params : {numpy.ndarray, 'calc', or 'perfect'}, optional The relative change in parameters. I...
[ "def", "find_expected_error", "(", "self", ",", "delta_params", "=", "'calc'", ",", "adjust", "=", "True", ")", ":", "expected_error", "=", "super", "(", "LMGlobals", ",", "self", ")", ".", "find_expected_error", "(", "delta_params", "=", "delta_params", ")", ...
Returns the error expected after an update if the model were linear. Parameters ---------- delta_params : {numpy.ndarray, 'calc', or 'perfect'}, optional The relative change in parameters. If 'calc', uses update calculated from the current damping, J, etc; if...
[ "Returns", "the", "error", "expected", "after", "an", "update", "if", "the", "model", "were", "linear", "." ]
python
valid
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Environment.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Environment.py#L2027-L2039
def Execute(self, action, *args, **kw): """Directly execute an action through an Environment """ action = self.Action(action, *args, **kw) result = action([], [], self) if isinstance(result, SCons.Errors.BuildError): errstr = result.errstr if result.filena...
[ "def", "Execute", "(", "self", ",", "action", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "action", "=", "self", ".", "Action", "(", "action", ",", "*", "args", ",", "*", "*", "kw", ")", "result", "=", "action", "(", "[", "]", ",", "[", ...
Directly execute an action through an Environment
[ "Directly", "execute", "an", "action", "through", "an", "Environment" ]
python
train
rGunti/CarPi-OBDDaemon
obddaemon/custom/Obd2DataParser.py
https://github.com/rGunti/CarPi-OBDDaemon/blob/6831c477b2a00617a0d2ea98b28f3bc5c1ba8e5f/obddaemon/custom/Obd2DataParser.py#L102-L118
def parse_obj(o): """ Parses a given dictionary with the key being the OBD PID and the value its returned value by the OBD interface :param dict o: :return: """ r = {} for k, v in o.items(): if is_unable_to_connect(v): r[k] = None try: r[k] = pars...
[ "def", "parse_obj", "(", "o", ")", ":", "r", "=", "{", "}", "for", "k", ",", "v", "in", "o", ".", "items", "(", ")", ":", "if", "is_unable_to_connect", "(", "v", ")", ":", "r", "[", "k", "]", "=", "None", "try", ":", "r", "[", "k", "]", "...
Parses a given dictionary with the key being the OBD PID and the value its returned value by the OBD interface :param dict o: :return:
[ "Parses", "a", "given", "dictionary", "with", "the", "key", "being", "the", "OBD", "PID", "and", "the", "value", "its", "returned", "value", "by", "the", "OBD", "interface", ":", "param", "dict", "o", ":", ":", "return", ":" ]
python
train
SuperCowPowers/chains
chains/sources/packet_streamer.py
https://github.com/SuperCowPowers/chains/blob/b0227847b0c43083b456f0bae52daee0b62a3e03/chains/sources/packet_streamer.py#L64-L114
def read_interface(self): """Read Packets from the packet capture interface""" # Spin up the packet capture if self._iface_is_file(): self.pcap = pcapy.open_offline(self.iface_name) else: try: # self.pcap = pcap.pcap(name=self.iface_name, promisc=...
[ "def", "read_interface", "(", "self", ")", ":", "# Spin up the packet capture", "if", "self", ".", "_iface_is_file", "(", ")", ":", "self", ".", "pcap", "=", "pcapy", ".", "open_offline", "(", "self", ".", "iface_name", ")", "else", ":", "try", ":", "# sel...
Read Packets from the packet capture interface
[ "Read", "Packets", "from", "the", "packet", "capture", "interface" ]
python
train
dw/mitogen
mitogen/core.py
https://github.com/dw/mitogen/blob/a7fdb55e1300a7e0a5e404b09eb730cf9a525da7/mitogen/core.py#L1992-L1997
def start_transmit(self, fd, data=None): """ Cause :meth:`poll` to yield `data` when `fd` is writeable. """ self._wfds[fd] = (data or fd, self._generation) self._update(fd)
[ "def", "start_transmit", "(", "self", ",", "fd", ",", "data", "=", "None", ")", ":", "self", ".", "_wfds", "[", "fd", "]", "=", "(", "data", "or", "fd", ",", "self", ".", "_generation", ")", "self", ".", "_update", "(", "fd", ")" ]
Cause :meth:`poll` to yield `data` when `fd` is writeable.
[ "Cause", ":", "meth", ":", "poll", "to", "yield", "data", "when", "fd", "is", "writeable", "." ]
python
train
intuition-io/intuition
intuition/finance.py
https://github.com/intuition-io/intuition/blob/cd517e6b3b315a743eb4d0d0dc294e264ab913ce/intuition/finance.py#L116-L136
def average_returns(ts, **kwargs): ''' Compute geometric average returns from a returns time serie''' average_type = kwargs.get('type', 'net') if average_type == 'net': relative = 0 else: relative = -1 # gross #start = kwargs.get('start', ts.index[0]) #end = kwargs.get('end', ts...
[ "def", "average_returns", "(", "ts", ",", "*", "*", "kwargs", ")", ":", "average_type", "=", "kwargs", ".", "get", "(", "'type'", ",", "'net'", ")", "if", "average_type", "==", "'net'", ":", "relative", "=", "0", "else", ":", "relative", "=", "-", "1...
Compute geometric average returns from a returns time serie
[ "Compute", "geometric", "average", "returns", "from", "a", "returns", "time", "serie" ]
python
train
Asana/python-asana
asana/resources/gen/custom_fields.py
https://github.com/Asana/python-asana/blob/6deb7a34495db23f44858e53b6bb2c9eccff7872/asana/resources/gen/custom_fields.py#L73-L83
def delete(self, custom_field, params={}, **options): """A specific, existing custom field can be deleted by making a DELETE request on the URL for that custom field. Returns an empty data record. Parameters ---------- custom_field : {Id} Globally unique identifier for...
[ "def", "delete", "(", "self", ",", "custom_field", ",", "params", "=", "{", "}", ",", "*", "*", "options", ")", ":", "path", "=", "\"/custom_fields/%s\"", "%", "(", "custom_field", ")", "return", "self", ".", "client", ".", "delete", "(", "path", ",", ...
A specific, existing custom field can be deleted by making a DELETE request on the URL for that custom field. Returns an empty data record. Parameters ---------- custom_field : {Id} Globally unique identifier for the custom field.
[ "A", "specific", "existing", "custom", "field", "can", "be", "deleted", "by", "making", "a", "DELETE", "request", "on", "the", "URL", "for", "that", "custom", "field", ".", "Returns", "an", "empty", "data", "record", "." ]
python
train
nerdvegas/rez
src/rez/util.py
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/util.py#L63-L80
def create_forwarding_script(filepath, module, func_name, *nargs, **kwargs): """Create a 'forwarding' script. A forwarding script is one that executes some arbitrary Rez function. This is used internally by Rez to dynamically create a script that uses Rez, even though the parent environment may not be ...
[ "def", "create_forwarding_script", "(", "filepath", ",", "module", ",", "func_name", ",", "*", "nargs", ",", "*", "*", "kwargs", ")", ":", "doc", "=", "dict", "(", "module", "=", "module", ",", "func_name", "=", "func_name", ")", "if", "nargs", ":", "d...
Create a 'forwarding' script. A forwarding script is one that executes some arbitrary Rez function. This is used internally by Rez to dynamically create a script that uses Rez, even though the parent environment may not be configured to do so.
[ "Create", "a", "forwarding", "script", "." ]
python
train
bapakode/OmMongo
ommongo/query.py
https://github.com/bapakode/OmMongo/blob/52b5a5420516dc709f2d2eb065818c7973991ce3/ommongo/query.py#L337-L347
def in_(self, qfield, *values): ''' Check to see that the value of ``qfield`` is one of ``values`` :param qfield: Instances of :class:`ommongo.query_expression.QueryExpression` :param values: Values should be python values which ``qfield`` \ understands ''' ...
[ "def", "in_", "(", "self", ",", "qfield", ",", "*", "values", ")", ":", "# TODO: make sure that this field represents a list", "qfield", "=", "resolve_name", "(", "self", ".", "type", ",", "qfield", ")", "self", ".", "filter", "(", "QueryExpression", "(", "{",...
Check to see that the value of ``qfield`` is one of ``values`` :param qfield: Instances of :class:`ommongo.query_expression.QueryExpression` :param values: Values should be python values which ``qfield`` \ understands
[ "Check", "to", "see", "that", "the", "value", "of", "qfield", "is", "one", "of", "values" ]
python
train
materialsproject/pymatgen
pymatgen/io/abinit/pseudos.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/pseudos.py#L300-L304
def djrepo_path(self): """The path of the djrepo file. None if file does not exist.""" root, ext = os.path.splitext(self.filepath) path = root + ".djrepo" return path
[ "def", "djrepo_path", "(", "self", ")", ":", "root", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "self", ".", "filepath", ")", "path", "=", "root", "+", "\".djrepo\"", "return", "path" ]
The path of the djrepo file. None if file does not exist.
[ "The", "path", "of", "the", "djrepo", "file", ".", "None", "if", "file", "does", "not", "exist", "." ]
python
train
PSPC-SPAC-buyandsell/von_anchor
von_anchor/nodepool/protocol.py
https://github.com/PSPC-SPAC-buyandsell/von_anchor/blob/78ac1de67be42a676274f4bf71fe12f66e72f309/von_anchor/nodepool/protocol.py#L43-L48
def get(version: str) -> 'Protocol': """ Return enum instance corresponding to input version value ('1.6' etc.) """ return Protocol.V_13 if version == Protocol.V_13.value.name else Protocol.DEFAULT
[ "def", "get", "(", "version", ":", "str", ")", "->", "'Protocol'", ":", "return", "Protocol", ".", "V_13", "if", "version", "==", "Protocol", ".", "V_13", ".", "value", ".", "name", "else", "Protocol", ".", "DEFAULT" ]
Return enum instance corresponding to input version value ('1.6' etc.)
[ "Return", "enum", "instance", "corresponding", "to", "input", "version", "value", "(", "1", ".", "6", "etc", ".", ")" ]
python
train
RedFantom/ttkwidgets
ttkwidgets/itemscanvas.py
https://github.com/RedFantom/ttkwidgets/blob/02150322060f867b6e59a175522ef84b09168019/ttkwidgets/itemscanvas.py#L75-L93
def left_press(self, event): """ Callback for the press of the left mouse button. Selects a new item and sets its highlightcolor. :param event: Tkinter event """ self.current_coords = self.canvas.canvasx(event.x), self.canvas.canvasy(event.y) self.set_cu...
[ "def", "left_press", "(", "self", ",", "event", ")", ":", "self", ".", "current_coords", "=", "self", ".", "canvas", ".", "canvasx", "(", "event", ".", "x", ")", ",", "self", ".", "canvas", ".", "canvasy", "(", "event", ".", "y", ")", "self", ".", ...
Callback for the press of the left mouse button. Selects a new item and sets its highlightcolor. :param event: Tkinter event
[ "Callback", "for", "the", "press", "of", "the", "left", "mouse", "button", "." ]
python
train
ungarj/mapchete
mapchete/io/vector.py
https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/vector.py#L221-L292
def write_vector_window( in_data=None, out_schema=None, out_tile=None, out_path=None, bucket_resource=None ): """ Write features to GeoJSON file. Parameters ---------- in_data : features out_schema : dictionary output schema for fiona out_tile : ``BufferedTile`` tile use...
[ "def", "write_vector_window", "(", "in_data", "=", "None", ",", "out_schema", "=", "None", ",", "out_tile", "=", "None", ",", "out_path", "=", "None", ",", "bucket_resource", "=", "None", ")", ":", "# Delete existing file.", "try", ":", "os", ".", "remove", ...
Write features to GeoJSON file. Parameters ---------- in_data : features out_schema : dictionary output schema for fiona out_tile : ``BufferedTile`` tile used for output extent out_path : string output path for GeoJSON file
[ "Write", "features", "to", "GeoJSON", "file", "." ]
python
valid
pudo-attic/loadkit
loadkit/types/table.py
https://github.com/pudo-attic/loadkit/blob/1fb17e69e2ffaf3dac4f40b574c3b7afb2198b7c/loadkit/types/table.py#L21-L40
def store(self): """ Create a context manager to store records in the cleaned table. """ output = tempfile.NamedTemporaryFile(suffix='.json') try: def write(o): line = json.dumps(o, default=json_default) return output.write(line + '\n') ...
[ "def", "store", "(", "self", ")", ":", "output", "=", "tempfile", ".", "NamedTemporaryFile", "(", "suffix", "=", "'.json'", ")", "try", ":", "def", "write", "(", "o", ")", ":", "line", "=", "json", ".", "dumps", "(", "o", ",", "default", "=", "json...
Create a context manager to store records in the cleaned table.
[ "Create", "a", "context", "manager", "to", "store", "records", "in", "the", "cleaned", "table", "." ]
python
train
tensorflow/cleverhans
cleverhans/utils_tf.py
https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/cleverhans/utils_tf.py#L667-L722
def jacobian_augmentation(sess, x, X_sub_prev, Y_sub, grads, lmbda, aug_batch_size=512, feed=None): """ Augment an adversary's substit...
[ "def", "jacobian_augmentation", "(", "sess", ",", "x", ",", "X_sub_prev", ",", "Y_sub", ",", "grads", ",", "lmbda", ",", "aug_batch_size", "=", "512", ",", "feed", "=", "None", ")", ":", "assert", "len", "(", "x", ".", "get_shape", "(", ")", ")", "==...
Augment an adversary's substitute training set using the Jacobian of a substitute model to generate new synthetic inputs. See https://arxiv.org/abs/1602.02697 for more details. See cleverhans_tutorials/mnist_blackbox.py for example use case :param sess: TF session in which the substitute model is defined :par...
[ "Augment", "an", "adversary", "s", "substitute", "training", "set", "using", "the", "Jacobian", "of", "a", "substitute", "model", "to", "generate", "new", "synthetic", "inputs", ".", "See", "https", ":", "//", "arxiv", ".", "org", "/", "abs", "/", "1602", ...
python
train
jjgomera/iapws
iapws/iapws97.py
https://github.com/jjgomera/iapws/blob/1e5812aab38212fb8a63736f61cdcfa427d223b1/iapws/iapws97.py#L3854-L3925
def _Bound_Ph(P, h): """Region definition for input P y h Parameters ---------- P : float Pressure, [MPa] h : float Specific enthalpy, [kJ/kg] Returns ------- region : float IAPWS-97 region code References ---------- Wagner, W; Kretzschmar, H-J: Int...
[ "def", "_Bound_Ph", "(", "P", ",", "h", ")", ":", "region", "=", "None", "if", "Pmin", "<=", "P", "<=", "Ps_623", ":", "h14", "=", "_Region1", "(", "_TSat_P", "(", "P", ")", ",", "P", ")", "[", "\"h\"", "]", "h24", "=", "_Region2", "(", "_TSat_...
Region definition for input P y h Parameters ---------- P : float Pressure, [MPa] h : float Specific enthalpy, [kJ/kg] Returns ------- region : float IAPWS-97 region code References ---------- Wagner, W; Kretzschmar, H-J: International Steam Tables: Pro...
[ "Region", "definition", "for", "input", "P", "y", "h" ]
python
train
workforce-data-initiative/skills-utils
skills_utils/io.py
https://github.com/workforce-data-initiative/skills-utils/blob/4cf9b7c2938984f34bbcc33d45482d23c52c7539/skills_utils/io.py#L6-L21
def stream_json_file(local_file): """Stream a JSON file (in JSON-per-line format) Args: local_file (file-like object) an open file-handle that contains a JSON string on each line Yields: (dict) JSON objects """ for i, line in enumerate(local_file): try: ...
[ "def", "stream_json_file", "(", "local_file", ")", ":", "for", "i", ",", "line", "in", "enumerate", "(", "local_file", ")", ":", "try", ":", "data", "=", "json", ".", "loads", "(", "line", ".", "decode", "(", "'utf-8'", ")", ")", "yield", "data", "ex...
Stream a JSON file (in JSON-per-line format) Args: local_file (file-like object) an open file-handle that contains a JSON string on each line Yields: (dict) JSON objects
[ "Stream", "a", "JSON", "file", "(", "in", "JSON", "-", "per", "-", "line", "format", ")" ]
python
train
tonyfischetti/sake
sakelib/acts.py
https://github.com/tonyfischetti/sake/blob/b7ad20fe8e7137db99a20ac06b8da26492601b00/sakelib/acts.py#L599-L623
def write_dot_file(G, filename): """ Writes the graph G in dot file format for graphviz visualization. Args: a Networkx graph A filename to name the dot files """ with io.open(filename, "w") as fh: fh.write("strict digraph DependencyDiagram {\n") edge_list = G.edges(...
[ "def", "write_dot_file", "(", "G", ",", "filename", ")", ":", "with", "io", ".", "open", "(", "filename", ",", "\"w\"", ")", "as", "fh", ":", "fh", ".", "write", "(", "\"strict digraph DependencyDiagram {\\n\"", ")", "edge_list", "=", "G", ".", "edges", ...
Writes the graph G in dot file format for graphviz visualization. Args: a Networkx graph A filename to name the dot files
[ "Writes", "the", "graph", "G", "in", "dot", "file", "format", "for", "graphviz", "visualization", "." ]
python
valid
antiboredom/videogrep
videogrep/videogrep.py
https://github.com/antiboredom/videogrep/blob/faffd3446d96242677757f1af7db23b6dfc429cf/videogrep/videogrep.py#L218-L248
def create_supercut_in_batches(composition, outputfile, padding): """Create & concatenate video clips in groups of size BATCH_SIZE and output finished video file to output directory. """ total_clips = len(composition) start_index = 0 end_index = BATCH_SIZE batch_comp = [] while start_ind...
[ "def", "create_supercut_in_batches", "(", "composition", ",", "outputfile", ",", "padding", ")", ":", "total_clips", "=", "len", "(", "composition", ")", "start_index", "=", "0", "end_index", "=", "BATCH_SIZE", "batch_comp", "=", "[", "]", "while", "start_index"...
Create & concatenate video clips in groups of size BATCH_SIZE and output finished video file to output directory.
[ "Create", "&", "concatenate", "video", "clips", "in", "groups", "of", "size", "BATCH_SIZE", "and", "output", "finished", "video", "file", "to", "output", "directory", "." ]
python
train
paulovn/sparql-kernel
sparqlkernel/utils.py
https://github.com/paulovn/sparql-kernel/blob/1d2d155ff5da72070cb2a98fae33ea8113fac782/sparqlkernel/utils.py#L28-L47
def escape( x, lb=False ): """ Ensure a string does not contain HTML-reserved characters (including double quotes) Optionally also insert a linebreak if the string is too long """ # Insert a linebreak? Roughly around the middle of the string, if lb: l = len(x) if l >= 10: ...
[ "def", "escape", "(", "x", ",", "lb", "=", "False", ")", ":", "# Insert a linebreak? Roughly around the middle of the string,", "if", "lb", ":", "l", "=", "len", "(", "x", ")", "if", "l", ">=", "10", ":", "l", ">>=", "1", "# middle of the string", "s1", "=...
Ensure a string does not contain HTML-reserved characters (including double quotes) Optionally also insert a linebreak if the string is too long
[ "Ensure", "a", "string", "does", "not", "contain", "HTML", "-", "reserved", "characters", "(", "including", "double", "quotes", ")", "Optionally", "also", "insert", "a", "linebreak", "if", "the", "string", "is", "too", "long" ]
python
train
cpenv/cpenv
cpenv/utils.py
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L304-L320
def expand_envvars(env): ''' Expand all environment variables in an environment dict :param env: Environment dict ''' out_env = {} for k, v in env.iteritems(): out_env[k] = Template(v).safe_substitute(env) # Expand twice to make sure we expand everything we possibly can for k...
[ "def", "expand_envvars", "(", "env", ")", ":", "out_env", "=", "{", "}", "for", "k", ",", "v", "in", "env", ".", "iteritems", "(", ")", ":", "out_env", "[", "k", "]", "=", "Template", "(", "v", ")", ".", "safe_substitute", "(", "env", ")", "# Exp...
Expand all environment variables in an environment dict :param env: Environment dict
[ "Expand", "all", "environment", "variables", "in", "an", "environment", "dict" ]
python
valid
rkargon/pixelsorter
pixelsorter/paths.py
https://github.com/rkargon/pixelsorter/blob/0775d1e487fbcb023e411e1818ba3290b0e8665e/pixelsorter/paths.py#L28-L36
def horizontal_path(size): """ Creates a generator for progressing horizontally through an image. :param size: A tuple (width, height) of the image size :return: A generator that yields a set of rows through the image. Each row is a generator that yields pixel coordinates. """ width, height ...
[ "def", "horizontal_path", "(", "size", ")", ":", "width", ",", "height", "=", "size", "return", "(", "(", "(", "x", ",", "y", ")", "for", "x", "in", "range", "(", "width", ")", ")", "for", "y", "in", "range", "(", "height", ")", ")" ]
Creates a generator for progressing horizontally through an image. :param size: A tuple (width, height) of the image size :return: A generator that yields a set of rows through the image. Each row is a generator that yields pixel coordinates.
[ "Creates", "a", "generator", "for", "progressing", "horizontally", "through", "an", "image", ".", ":", "param", "size", ":", "A", "tuple", "(", "width", "height", ")", "of", "the", "image", "size", ":", "return", ":", "A", "generator", "that", "yields", ...
python
train
Cue/scales
src/greplin/scales/__init__.py
https://github.com/Cue/scales/blob/0aced26eb050ceb98ee9d5d6cdca8db448666986/src/greplin/scales/__init__.py#L193-L201
def getStat(cls, obj, name): """Gets the stat for the given object with the given name, or None if no such stat exists.""" objClass = type(obj) for theClass in objClass.__mro__: if theClass == object: break for value in theClass.__dict__.values(): if isinstance(value, Stat) and v...
[ "def", "getStat", "(", "cls", ",", "obj", ",", "name", ")", ":", "objClass", "=", "type", "(", "obj", ")", "for", "theClass", "in", "objClass", ".", "__mro__", ":", "if", "theClass", "==", "object", ":", "break", "for", "value", "in", "theClass", "."...
Gets the stat for the given object with the given name, or None if no such stat exists.
[ "Gets", "the", "stat", "for", "the", "given", "object", "with", "the", "given", "name", "or", "None", "if", "no", "such", "stat", "exists", "." ]
python
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_firmware.py
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_firmware.py#L253-L257
def cmd_fw_manifest_purge(self): '''remove all downloaded manifests''' for filepath in self.find_manifests(): os.unlink(filepath) self.manifests_parse()
[ "def", "cmd_fw_manifest_purge", "(", "self", ")", ":", "for", "filepath", "in", "self", ".", "find_manifests", "(", ")", ":", "os", ".", "unlink", "(", "filepath", ")", "self", ".", "manifests_parse", "(", ")" ]
remove all downloaded manifests
[ "remove", "all", "downloaded", "manifests" ]
python
train
bretth/djset
djset/djset.py
https://github.com/bretth/djset/blob/e04cbcadc311f6edec50a718415d0004aa304034/djset/djset.py#L38-L57
def get(self, key, prompt_default='', prompt_help=''): """Return a value from the environ or keyring""" value = os.getenv(key) if not value: ns = self.namespace(key) value = self.keyring.get_password(ns, key) else: ns = 'environ' if not value...
[ "def", "get", "(", "self", ",", "key", ",", "prompt_default", "=", "''", ",", "prompt_help", "=", "''", ")", ":", "value", "=", "os", ".", "getenv", "(", "key", ")", "if", "not", "value", ":", "ns", "=", "self", ".", "namespace", "(", "key", ")",...
Return a value from the environ or keyring
[ "Return", "a", "value", "from", "the", "environ", "or", "keyring" ]
python
train
swharden/SWHLab
swhlab/indexing/index_OLD.py
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/indexing/index_OLD.py#L107-L131
def html_index(self,launch=False,showChildren=False): """ generate list of cells with links. keep this simple. automatically generates splash page and regnerates frames. """ self.makePics() # ensure all pics are converted # generate menu html='<a href="index_splas...
[ "def", "html_index", "(", "self", ",", "launch", "=", "False", ",", "showChildren", "=", "False", ")", ":", "self", ".", "makePics", "(", ")", "# ensure all pics are converted", "# generate menu", "html", "=", "'<a href=\"index_splash.html\" target=\"content\">./%s/</a>...
generate list of cells with links. keep this simple. automatically generates splash page and regnerates frames.
[ "generate", "list", "of", "cells", "with", "links", ".", "keep", "this", "simple", ".", "automatically", "generates", "splash", "page", "and", "regnerates", "frames", "." ]
python
valid
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/docbook/__init__.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/docbook/__init__.py#L809-L829
def DocbookXslt(env, target, source=None, *args, **kw): """ A pseudo-Builder, applying a simple XSL transformation to the input file. """ # Init list of targets/sources target, source = __extend_targets_sources(target, source) # Init XSL stylesheet kw['DOCBOOK_XSL'] = kw.get('xsl', 'tra...
[ "def", "DocbookXslt", "(", "env", ",", "target", ",", "source", "=", "None", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "# Init list of targets/sources", "target", ",", "source", "=", "__extend_targets_sources", "(", "target", ",", "source", ")", "# ...
A pseudo-Builder, applying a simple XSL transformation to the input file.
[ "A", "pseudo", "-", "Builder", "applying", "a", "simple", "XSL", "transformation", "to", "the", "input", "file", "." ]
python
train
gem/oq-engine
openquake/hazardlib/gsim/utils_swiss_gmpe.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/utils_swiss_gmpe.py#L81-L99
def _get_corr_stddevs(C, tau_ss, stddev_types, num_sites, phi_ss, NL=None, tau_value=None): """ Return standard deviations adjusted for single station sigma as the total standard deviation - as proposed to be used in the Swiss Hazard Model [2014]. """ stddevs = [] temp_...
[ "def", "_get_corr_stddevs", "(", "C", ",", "tau_ss", ",", "stddev_types", ",", "num_sites", ",", "phi_ss", ",", "NL", "=", "None", ",", "tau_value", "=", "None", ")", ":", "stddevs", "=", "[", "]", "temp_stddev", "=", "phi_ss", "*", "phi_ss", "if", "ta...
Return standard deviations adjusted for single station sigma as the total standard deviation - as proposed to be used in the Swiss Hazard Model [2014].
[ "Return", "standard", "deviations", "adjusted", "for", "single", "station", "sigma", "as", "the", "total", "standard", "deviation", "-", "as", "proposed", "to", "be", "used", "in", "the", "Swiss", "Hazard", "Model", "[", "2014", "]", "." ]
python
train
mokelly/wabbit_wappa
wabbit_wappa/__init__.py
https://github.com/mokelly/wabbit_wappa/blob/dfe5bf6d6036079e473c4148335cd6f339d0299b/wabbit_wappa/__init__.py#L101-L114
def add_features(self, features): """Add features to this namespace. features: An iterable of features. A feature may be either 1) A VW label (not containing characters from escape_dict.keys(), unless 'escape' mode is on) 2) A tuple (label, value) where value is ...
[ "def", "add_features", "(", "self", ",", "features", ")", ":", "for", "feature", "in", "features", ":", "if", "isinstance", "(", "feature", ",", "basestring", ")", ":", "label", "=", "feature", "value", "=", "None", "else", ":", "label", ",", "value", ...
Add features to this namespace. features: An iterable of features. A feature may be either 1) A VW label (not containing characters from escape_dict.keys(), unless 'escape' mode is on) 2) A tuple (label, value) where value is any float
[ "Add", "features", "to", "this", "namespace", ".", "features", ":", "An", "iterable", "of", "features", ".", "A", "feature", "may", "be", "either", "1", ")", "A", "VW", "label", "(", "not", "containing", "characters", "from", "escape_dict", ".", "keys", ...
python
train
pypa/pipenv
pipenv/vendor/distlib/manifest.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/manifest.py#L57-L82
def findall(self): """Find all files under the base and set ``allfiles`` to the absolute pathnames of files found. """ from stat import S_ISREG, S_ISDIR, S_ISLNK self.allfiles = allfiles = [] root = self.base stack = [root] pop = stack.pop push = ...
[ "def", "findall", "(", "self", ")", ":", "from", "stat", "import", "S_ISREG", ",", "S_ISDIR", ",", "S_ISLNK", "self", ".", "allfiles", "=", "allfiles", "=", "[", "]", "root", "=", "self", ".", "base", "stack", "=", "[", "root", "]", "pop", "=", "st...
Find all files under the base and set ``allfiles`` to the absolute pathnames of files found.
[ "Find", "all", "files", "under", "the", "base", "and", "set", "allfiles", "to", "the", "absolute", "pathnames", "of", "files", "found", "." ]
python
train
gofed/gofedlib
gofedlib/distribution/clients/pkgdb/client.py
https://github.com/gofed/gofedlib/blob/0674c248fe3d8706f98f912996b65af469f96b10/gofedlib/distribution/clients/pkgdb/client.py#L27-L39
def packageExists(self, package): """Check if the package already exists :param package: package name :type package: string """ url = "%s/packages" % self.base_url params = {"pattern": package} response = requests.get(url, params=params) if response.status_code != requests.codes.ok: return False ...
[ "def", "packageExists", "(", "self", ",", "package", ")", ":", "url", "=", "\"%s/packages\"", "%", "self", ".", "base_url", "params", "=", "{", "\"pattern\"", ":", "package", "}", "response", "=", "requests", ".", "get", "(", "url", ",", "params", "=", ...
Check if the package already exists :param package: package name :type package: string
[ "Check", "if", "the", "package", "already", "exists" ]
python
train
kensho-technologies/graphql-compiler
graphql_compiler/compiler/ir_lowering_match/between_lowering.py
https://github.com/kensho-technologies/graphql-compiler/blob/f6079c6d10f64932f6b3af309b79bcea2123ca8f/graphql_compiler/compiler/ir_lowering_match/between_lowering.py#L36-L70
def _construct_field_operator_expression_dict(expression_list): """Construct a mapping from local fields to specified operators, and corresponding expressions. Args: expression_list: list of expressions to analyze Returns: local_field_to_expressions: dict mapping local field na...
[ "def", "_construct_field_operator_expression_dict", "(", "expression_list", ")", ":", "between_operators", "=", "(", "u'<='", ",", "u'>='", ")", "inverse_operator", "=", "{", "u'>='", ":", "u'<='", ",", "u'<='", ":", "u'>='", "}", "local_field_to_expressions", "=", ...
Construct a mapping from local fields to specified operators, and corresponding expressions. Args: expression_list: list of expressions to analyze Returns: local_field_to_expressions: dict mapping local field names to "operator -> list of BinaryComposition" dictionaries, ...
[ "Construct", "a", "mapping", "from", "local", "fields", "to", "specified", "operators", "and", "corresponding", "expressions", "." ]
python
train
rgs1/zk_shell
zk_shell/shell.py
https://github.com/rgs1/zk_shell/blob/bbf34fdfcf1f81100e2a5816fad8af6afc782a54/zk_shell/shell.py#L2503-L2588
def do_json_dupes_for_keys(self, params): """ \x1b[1mNAME\x1b[0m json_duples_for_keys - Gets the duplicate znodes for the given keys \x1b[1mSYNOPSIS\x1b[0m json_dupes_for_keys <path> <keys> [prefix] [report_errors] [first] \x1b[1mDESCRIPTION\x1b[0m Znodes with duplicated keys are sorte...
[ "def", "do_json_dupes_for_keys", "(", "self", ",", "params", ")", ":", "try", ":", "Keys", ".", "validate", "(", "params", ".", "keys", ")", "except", "Keys", ".", "Bad", "as", "ex", ":", "self", ".", "show_output", "(", "str", "(", "ex", ")", ")", ...
\x1b[1mNAME\x1b[0m json_duples_for_keys - Gets the duplicate znodes for the given keys \x1b[1mSYNOPSIS\x1b[0m json_dupes_for_keys <path> <keys> [prefix] [report_errors] [first] \x1b[1mDESCRIPTION\x1b[0m Znodes with duplicated keys are sorted and all but the first (original) one are pri...
[ "\\", "x1b", "[", "1mNAME", "\\", "x1b", "[", "0m", "json_duples_for_keys", "-", "Gets", "the", "duplicate", "znodes", "for", "the", "given", "keys" ]
python
train
marshmallow-code/apispec
src/apispec/ext/marshmallow/__init__.py
https://github.com/marshmallow-code/apispec/blob/e92ceffd12b2e392b8d199ed314bd2a7e6512dff/src/apispec/ext/marshmallow/__init__.py#L100-L107
def resolve_schema_in_request_body(self, request_body): """Function to resolve a schema in a requestBody object - modifies then response dict to convert Marshmallow Schema object or class into dict """ content = request_body["content"] for content_type in content: sch...
[ "def", "resolve_schema_in_request_body", "(", "self", ",", "request_body", ")", ":", "content", "=", "request_body", "[", "\"content\"", "]", "for", "content_type", "in", "content", ":", "schema", "=", "content", "[", "content_type", "]", "[", "\"schema\"", "]",...
Function to resolve a schema in a requestBody object - modifies then response dict to convert Marshmallow Schema object or class into dict
[ "Function", "to", "resolve", "a", "schema", "in", "a", "requestBody", "object", "-", "modifies", "then", "response", "dict", "to", "convert", "Marshmallow", "Schema", "object", "or", "class", "into", "dict" ]
python
train
tanghaibao/jcvi
jcvi/utils/webcolors.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/utils/webcolors.py#L154-L160
def _reversedict(d): """ Internal helper for generating reverse mappings; given a dictionary, returns a new dictionary with keys and values swapped. """ return dict(list(zip(list(d.values()), list(d.keys()))))
[ "def", "_reversedict", "(", "d", ")", ":", "return", "dict", "(", "list", "(", "zip", "(", "list", "(", "d", ".", "values", "(", ")", ")", ",", "list", "(", "d", ".", "keys", "(", ")", ")", ")", ")", ")" ]
Internal helper for generating reverse mappings; given a dictionary, returns a new dictionary with keys and values swapped.
[ "Internal", "helper", "for", "generating", "reverse", "mappings", ";", "given", "a", "dictionary", "returns", "a", "new", "dictionary", "with", "keys", "and", "values", "swapped", "." ]
python
train
libtcod/python-tcod
tcod/libtcodpy.py
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L3187-L3198
def map_set_properties( m: tcod.map.Map, x: int, y: int, isTrans: bool, isWalk: bool ) -> None: """Set the properties of a single cell. .. note:: This function is slow. .. deprecated:: 4.5 Use :any:`tcod.map.Map.transparent` and :any:`tcod.map.Map.walkable` arrays to set these p...
[ "def", "map_set_properties", "(", "m", ":", "tcod", ".", "map", ".", "Map", ",", "x", ":", "int", ",", "y", ":", "int", ",", "isTrans", ":", "bool", ",", "isWalk", ":", "bool", ")", "->", "None", ":", "lib", ".", "TCOD_map_set_properties", "(", "m"...
Set the properties of a single cell. .. note:: This function is slow. .. deprecated:: 4.5 Use :any:`tcod.map.Map.transparent` and :any:`tcod.map.Map.walkable` arrays to set these properties.
[ "Set", "the", "properties", "of", "a", "single", "cell", "." ]
python
train
coursera-dl/coursera-dl
coursera/api.py
https://github.com/coursera-dl/coursera-dl/blob/9b434bcf3c4011bf3181429fe674633ae5fb7d4d/coursera/api.py#L225-L249
def _convert_markup_images(self, soup): """ Convert images of instructions markup. Images are downloaded, base64-encoded and inserted into <img> tags. @param soup: BeautifulSoup instance. @type soup: BeautifulSoup """ # 6. Replace <img> assets with actual image c...
[ "def", "_convert_markup_images", "(", "self", ",", "soup", ")", ":", "# 6. Replace <img> assets with actual image contents", "images", "=", "[", "image", "for", "image", "in", "soup", ".", "find_all", "(", "'img'", ")", "if", "image", ".", "attrs", ".", "get", ...
Convert images of instructions markup. Images are downloaded, base64-encoded and inserted into <img> tags. @param soup: BeautifulSoup instance. @type soup: BeautifulSoup
[ "Convert", "images", "of", "instructions", "markup", ".", "Images", "are", "downloaded", "base64", "-", "encoded", "and", "inserted", "into", "<img", ">", "tags", "." ]
python
train
dancsalo/TensorBase
tensorbase/base.py
https://github.com/dancsalo/TensorBase/blob/3d42a326452bd03427034916ff2fb90730020204/tensorbase/base.py#L373-L380
def check_str(obj): """ Returns a string for various input types """ if isinstance(obj, str): return obj if isinstance(obj, float): return str(int(obj)) else: return str(obj)
[ "def", "check_str", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "str", ")", ":", "return", "obj", "if", "isinstance", "(", "obj", ",", "float", ")", ":", "return", "str", "(", "int", "(", "obj", ")", ")", "else", ":", "return", "st...
Returns a string for various input types
[ "Returns", "a", "string", "for", "various", "input", "types" ]
python
train
mapbox/rio-color
rio_color/operations.py
https://github.com/mapbox/rio-color/blob/4e9d7a9348608e66f9381fcdba98c13050e91c83/rio_color/operations.py#L9-L97
def sigmoidal(arr, contrast, bias): r""" Sigmoidal contrast is type of contrast control that adjusts the contrast without saturating highlights or shadows. It allows control over two factors: the contrast range from light to dark, and where the middle value of the mid-tones falls. The result is ...
[ "def", "sigmoidal", "(", "arr", ",", "contrast", ",", "bias", ")", ":", "if", "(", "arr", ".", "max", "(", ")", ">", "1.0", "+", "epsilon", ")", "or", "(", "arr", ".", "min", "(", ")", "<", "0", "-", "epsilon", ")", ":", "raise", "ValueError", ...
r""" Sigmoidal contrast is type of contrast control that adjusts the contrast without saturating highlights or shadows. It allows control over two factors: the contrast range from light to dark, and where the middle value of the mid-tones falls. The result is a non-linear and smooth contrast cha...
[ "r", "Sigmoidal", "contrast", "is", "type", "of", "contrast", "control", "that", "adjusts", "the", "contrast", "without", "saturating", "highlights", "or", "shadows", ".", "It", "allows", "control", "over", "two", "factors", ":", "the", "contrast", "range", "f...
python
train
rene-aguirre/pywinusb
pywinusb/hid/core.py
https://github.com/rene-aguirre/pywinusb/blob/954c4b2105d9f01cb0c50e24500bb747d4ecdc43/pywinusb/hid/core.py#L1318-L1375
def set_raw_data(self, raw_data): """Set usage values based on given raw data, item[0] is report_id, length should match 'raw_data_length' value, best performance if raw_data is c_ubyte ctypes array object type """ #pre-parsed data should exist assert(self.__hid_obj...
[ "def", "set_raw_data", "(", "self", ",", "raw_data", ")", ":", "#pre-parsed data should exist\r", "assert", "(", "self", ".", "__hid_object", ".", "is_opened", "(", ")", ")", "#valid length\r", "if", "len", "(", "raw_data", ")", "!=", "self", ".", "__raw_repor...
Set usage values based on given raw data, item[0] is report_id, length should match 'raw_data_length' value, best performance if raw_data is c_ubyte ctypes array object type
[ "Set", "usage", "values", "based", "on", "given", "raw", "data", "item", "[", "0", "]", "is", "report_id", "length", "should", "match", "raw_data_length", "value", "best", "performance", "if", "raw_data", "is", "c_ubyte", "ctypes", "array", "object", "type" ]
python
train
jtambasco/modesolverpy
modesolverpy/design.py
https://github.com/jtambasco/modesolverpy/blob/85254a13b5aed2404187c52ac93b9b3ce99ee3a3/modesolverpy/design.py#L29-L60
def grating_coupler_period(wavelength, n_eff, n_clad, incidence_angle_deg, diffration_order=1): ''' Calculate the period needed for a grating coupler. Args: wavelength (float): The target wav...
[ "def", "grating_coupler_period", "(", "wavelength", ",", "n_eff", ",", "n_clad", ",", "incidence_angle_deg", ",", "diffration_order", "=", "1", ")", ":", "k0", "=", "2.", "*", "np", ".", "pi", "/", "wavelength", "beta", "=", "n_eff", ".", "real", "*", "k...
Calculate the period needed for a grating coupler. Args: wavelength (float): The target wavelength for the grating coupler. n_eff (float): The effective index of the mode of a waveguide with the width of the grating coupler. n_clad (float): The refractive...
[ "Calculate", "the", "period", "needed", "for", "a", "grating", "coupler", "." ]
python
train
kivy/python-for-android
pythonforandroid/python.py
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/python.py#L276-L290
def compile_python_files(self, dir): ''' Compile the python files (recursively) for the python files inside a given folder. .. note:: python2 compiles the files into extension .pyo, but in python3, and as of Python 3.5, the .pyo filename extension is no longer us...
[ "def", "compile_python_files", "(", "self", ",", "dir", ")", ":", "args", "=", "[", "self", ".", "ctx", ".", "hostpython", "]", "if", "self", ".", "ctx", ".", "python_recipe", ".", "name", "==", "'python3'", ":", "args", "+=", "[", "'-OO'", ",", "'-m...
Compile the python files (recursively) for the python files inside a given folder. .. note:: python2 compiles the files into extension .pyo, but in python3, and as of Python 3.5, the .pyo filename extension is no longer used...uses .pyc (https://www.python.org/dev/peps/pep-0488)
[ "Compile", "the", "python", "files", "(", "recursively", ")", "for", "the", "python", "files", "inside", "a", "given", "folder", "." ]
python
train
rosenbrockc/fortpy
fortpy/interop/converter.py
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/converter.py#L398-L416
def convert(self, path, version, target = None): """Converts the specified file using the relevant template. :arg path: the full path to the file to convert. :arg version: the new version of the file. :arg target: the optional path to save the file under. If not specified, the...
[ "def", "convert", "(", "self", ",", "path", ",", "version", ",", "target", "=", "None", ")", ":", "#Get the template and values out of the XML input file and", "#write them in the format of the keywordless file.", "values", ",", "template", "=", "self", ".", "parse", "(...
Converts the specified file using the relevant template. :arg path: the full path to the file to convert. :arg version: the new version of the file. :arg target: the optional path to save the file under. If not specified, the file is saved based on the template file name.
[ "Converts", "the", "specified", "file", "using", "the", "relevant", "template", "." ]
python
train
MrYsLab/pymata-aio
examples/sparkfun_redbot/basics/simple_drive.py
https://github.com/MrYsLab/pymata-aio/blob/015081a4628b9d47dfe3f8d6c698ff903f107810/examples/sparkfun_redbot/basics/simple_drive.py#L21-L29
def setup(): """Setup pins""" print("Simple drive") board.set_pin_mode(L_CTRL_1, Constants.OUTPUT) board.set_pin_mode(L_CTRL_2, Constants.OUTPUT) board.set_pin_mode(PWM_L, Constants.PWM) board.set_pin_mode(R_CTRL_1, Constants.OUTPUT) board.set_pin_mode(R_CTRL_2, Constants.OUTPUT) board.s...
[ "def", "setup", "(", ")", ":", "print", "(", "\"Simple drive\"", ")", "board", ".", "set_pin_mode", "(", "L_CTRL_1", ",", "Constants", ".", "OUTPUT", ")", "board", ".", "set_pin_mode", "(", "L_CTRL_2", ",", "Constants", ".", "OUTPUT", ")", "board", ".", ...
Setup pins
[ "Setup", "pins" ]
python
train
wonambi-python/wonambi
wonambi/ioeeg/ktlx.py
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/ktlx.py#L109-L237
def _calculate_conversion(hdr): """Calculate the conversion factor. Returns ------- conv_factor : numpy.ndarray channel-long vector with the channel-specific conversion factor Notes ----- Final units are microvolts It should include all the headbox versions apart from 5 becaus...
[ "def", "_calculate_conversion", "(", "hdr", ")", ":", "discardbits", "=", "hdr", "[", "'discardbits'", "]", "n_chan", "=", "hdr", "[", "'num_channels'", "]", "if", "hdr", "[", "'headbox_type'", "]", "[", "0", "]", "in", "(", "1", ",", "3", ")", ":", ...
Calculate the conversion factor. Returns ------- conv_factor : numpy.ndarray channel-long vector with the channel-specific conversion factor Notes ----- Final units are microvolts It should include all the headbox versions apart from 5 because it depends on subversion.
[ "Calculate", "the", "conversion", "factor", "." ]
python
train
Skype4Py/Skype4Py
Skype4Py/skype.py
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/skype.py#L731-L747
def Property(self, ObjectType, ObjectId, PropName, Set=None): """Queries/sets the properties of an object. :Parameters: ObjectType : str Object type ('USER', 'CALL', 'CHAT', 'CHATMESSAGE', ...). ObjectId : str Object Id, depends on the object type. ...
[ "def", "Property", "(", "self", ",", "ObjectType", ",", "ObjectId", ",", "PropName", ",", "Set", "=", "None", ")", ":", "return", "self", ".", "_Property", "(", "ObjectType", ",", "ObjectId", ",", "PropName", ",", "Set", ")" ]
Queries/sets the properties of an object. :Parameters: ObjectType : str Object type ('USER', 'CALL', 'CHAT', 'CHATMESSAGE', ...). ObjectId : str Object Id, depends on the object type. PropName : str Name of the property to access. Set ...
[ "Queries", "/", "sets", "the", "properties", "of", "an", "object", "." ]
python
train