repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
brunobord/tdaemon
tdaemon.py
https://github.com/brunobord/tdaemon/blob/733b5bddb4b12bc3db326a192ce5606f28768307/tdaemon.py#L199-L202
def file_sizes(self): """Returns total filesize (in MB)""" size = sum(map(os.path.getsize, self.file_list)) return size / 1024 / 1024
[ "def", "file_sizes", "(", "self", ")", ":", "size", "=", "sum", "(", "map", "(", "os", ".", "path", ".", "getsize", ",", "self", ".", "file_list", ")", ")", "return", "size", "/", "1024", "/", "1024" ]
Returns total filesize (in MB)
[ "Returns", "total", "filesize", "(", "in", "MB", ")" ]
python
train
38.5
jmcarp/robobrowser
robobrowser/browser.py
https://github.com/jmcarp/robobrowser/blob/4284c11d00ae1397983e269aa180e5cf7ee5f4cf/robobrowser/browser.py#L230-L242
def _traverse(self, n=1): """Traverse state history. Used by `back` and `forward` methods. :param int n: Cursor increment. Positive values move forward in the browser history; negative values move backward. """ if not self.history: raise exceptions.RoboError('No...
[ "def", "_traverse", "(", "self", ",", "n", "=", "1", ")", ":", "if", "not", "self", ".", "history", ":", "raise", "exceptions", ".", "RoboError", "(", "'Not tracking history'", ")", "cursor", "=", "self", ".", "_cursor", "+", "n", "if", "cursor", ">=",...
Traverse state history. Used by `back` and `forward` methods. :param int n: Cursor increment. Positive values move forward in the browser history; negative values move backward.
[ "Traverse", "state", "history", ".", "Used", "by", "back", "and", "forward", "methods", "." ]
python
train
39
J535D165/recordlinkage
recordlinkage/utils.py
https://github.com/J535D165/recordlinkage/blob/87a5f4af904e0834047cd07ff1c70146b1e6d693/recordlinkage/utils.py#L139-L174
def index_split(index, chunks): """Function to split pandas.Index and pandas.MultiIndex objects. Split :class:`pandas.Index` and :class:`pandas.MultiIndex` objects into chunks. This function is based on :func:`numpy.array_split`. Parameters ---------- index : pandas.Index, pandas.MultiIndex ...
[ "def", "index_split", "(", "index", ",", "chunks", ")", ":", "Ntotal", "=", "index", ".", "shape", "[", "0", "]", "Nsections", "=", "int", "(", "chunks", ")", "if", "Nsections", "<=", "0", ":", "raise", "ValueError", "(", "'number sections must be larger t...
Function to split pandas.Index and pandas.MultiIndex objects. Split :class:`pandas.Index` and :class:`pandas.MultiIndex` objects into chunks. This function is based on :func:`numpy.array_split`. Parameters ---------- index : pandas.Index, pandas.MultiIndex A pandas.Index or pandas.MultiInd...
[ "Function", "to", "split", "pandas", ".", "Index", "and", "pandas", ".", "MultiIndex", "objects", "." ]
python
train
29.75
ardydedase/pycouchbase
pycouchbase/viewsync.py
https://github.com/ardydedase/pycouchbase/blob/6f010b4d2ef41aead2366878d0cf0b1284c0db0e/pycouchbase/viewsync.py#L117-L176
def upload(cls): """Uploads all the local views from :attr:`VIEW_PATHS` directory to CouchBase server This method **over-writes** all the server-side views with the same named ones coming from :attr:`VIEW_PATHS` folder. """ cls._check_folder() os.chdir(cls.VIEWS_...
[ "def", "upload", "(", "cls", ")", ":", "cls", ".", "_check_folder", "(", ")", "os", ".", "chdir", "(", "cls", ".", "VIEWS_PATH", ")", "buckets", "=", "dict", "(", ")", "# iterate local folders", "for", "bucket_name", "in", "os", ".", "listdir", "(", "c...
Uploads all the local views from :attr:`VIEW_PATHS` directory to CouchBase server This method **over-writes** all the server-side views with the same named ones coming from :attr:`VIEW_PATHS` folder.
[ "Uploads", "all", "the", "local", "views", "from", ":", "attr", ":", "VIEW_PATHS", "directory", "to", "CouchBase", "server" ]
python
train
48.566667
amzn/ion-python
amazon/ion/reader_binary.py
https://github.com/amzn/ion-python/blob/0b21fa3ba7755f55f745e4aa970d86343b82449d/amazon/ion/reader_binary.py#L229-L233
def remaining(self): """Determines how many bytes are remaining in the current context.""" if self.depth == 0: return _STREAM_REMAINING return self.limit - self.queue.position
[ "def", "remaining", "(", "self", ")", ":", "if", "self", ".", "depth", "==", "0", ":", "return", "_STREAM_REMAINING", "return", "self", ".", "limit", "-", "self", ".", "queue", ".", "position" ]
Determines how many bytes are remaining in the current context.
[ "Determines", "how", "many", "bytes", "are", "remaining", "in", "the", "current", "context", "." ]
python
train
41.4
josuebrunel/myql
myql/myql.py
https://github.com/josuebrunel/myql/blob/891bad29cc83a81b3f5ebc4d0401d6f2c22f119e/myql/myql.py#L315-L332
def where(self, *args): ''' This method simulates a where condition. Use as follow: >>> yql.select('mytable').where(['name', '=', 'alain'], ['location', '!=', 'paris']) ''' if not self._table: raise errors.NoTableSelectedError('No Table Selected') clause = [] ...
[ "def", "where", "(", "self", ",", "*", "args", ")", ":", "if", "not", "self", ".", "_table", ":", "raise", "errors", ".", "NoTableSelectedError", "(", "'No Table Selected'", ")", "clause", "=", "[", "]", "self", ".", "_query", "+=", "' WHERE '", "clause"...
This method simulates a where condition. Use as follow: >>> yql.select('mytable').where(['name', '=', 'alain'], ['location', '!=', 'paris'])
[ "This", "method", "simulates", "a", "where", "condition", ".", "Use", "as", "follow", ":", ">>>", "yql", ".", "select", "(", "mytable", ")", ".", "where", "(", "[", "name", "=", "alain", "]", "[", "location", "!", "=", "paris", "]", ")" ]
python
train
31.444444
bxlab/bx-python
lib/bx_extras/pstat.py
https://github.com/bxlab/bx-python/blob/09cb725284803df90a468d910f2274628d8647de/lib/bx_extras/pstat.py#L642-L658
def sortby(listoflists,sortcols): """ Sorts a list of lists on the column(s) specified in the sequence sortcols. Usage: sortby(listoflists,sortcols) Returns: sorted list, unchanged column ordering """ newlist = abut(colex(listoflists,sortcols),listoflists) newlist.sort() try: numcols = len(so...
[ "def", "sortby", "(", "listoflists", ",", "sortcols", ")", ":", "newlist", "=", "abut", "(", "colex", "(", "listoflists", ",", "sortcols", ")", ",", "listoflists", ")", "newlist", ".", "sort", "(", ")", "try", ":", "numcols", "=", "len", "(", "sortcols...
Sorts a list of lists on the column(s) specified in the sequence sortcols. Usage: sortby(listoflists,sortcols) Returns: sorted list, unchanged column ordering
[ "Sorts", "a", "list", "of", "lists", "on", "the", "column", "(", "s", ")", "specified", "in", "the", "sequence", "sortcols", "." ]
python
train
26.058824
SBRG/ssbio
ssbio/io/__init__.py
https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/io/__init__.py#L51-L67
def load_pickle(file, encoding=None): """Load a pickle file. Args: file (str): Path to pickle file Returns: object: Loaded object from pickle file """ # TODO: test set encoding='latin1' for 2/3 incompatibility if encoding: with open(file, 'rb') as f: return...
[ "def", "load_pickle", "(", "file", ",", "encoding", "=", "None", ")", ":", "# TODO: test set encoding='latin1' for 2/3 incompatibility", "if", "encoding", ":", "with", "open", "(", "file", ",", "'rb'", ")", "as", "f", ":", "return", "pickle", ".", "load", "(",...
Load a pickle file. Args: file (str): Path to pickle file Returns: object: Loaded object from pickle file
[ "Load", "a", "pickle", "file", "." ]
python
train
23.529412
bd808/python-iptools
iptools/ipv4.py
https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv4.py#L617-L634
def _block_from_ip_and_prefix(ip, prefix): """Create a tuple of (start, end) dotted-quad addresses from the given ip address and prefix length. :param ip: Ip address in block :type ip: long :param prefix: Prefix size for block :type prefix: int :returns: Tuple of block (start, end) """ ...
[ "def", "_block_from_ip_and_prefix", "(", "ip", ",", "prefix", ")", ":", "# keep left most prefix bits of ip", "shift", "=", "32", "-", "prefix", "block_start", "=", "ip", ">>", "shift", "<<", "shift", "# expand right most 32 - prefix bits to 1", "mask", "=", "(", "1...
Create a tuple of (start, end) dotted-quad addresses from the given ip address and prefix length. :param ip: Ip address in block :type ip: long :param prefix: Prefix size for block :type prefix: int :returns: Tuple of block (start, end)
[ "Create", "a", "tuple", "of", "(", "start", "end", ")", "dotted", "-", "quad", "addresses", "from", "the", "given", "ip", "address", "and", "prefix", "length", "." ]
python
train
31.555556
inasafe/inasafe
safe/gui/widgets/dock.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/widgets/dock.py#L307-L332
def _show_organisation_logo(self): """Show the organisation logo in the dock if possible.""" dock_width = float(self.width()) # Don't let the image be more tha 100px height maximum_height = 100.0 # px pixmap = QPixmap(self.organisation_logo_path) if pixmap.height() < 1 o...
[ "def", "_show_organisation_logo", "(", "self", ")", ":", "dock_width", "=", "float", "(", "self", ".", "width", "(", ")", ")", "# Don't let the image be more tha 100px height", "maximum_height", "=", "100.0", "# px", "pixmap", "=", "QPixmap", "(", "self", ".", "...
Show the organisation logo in the dock if possible.
[ "Show", "the", "organisation", "logo", "in", "the", "dock", "if", "possible", "." ]
python
train
46.5
acsone/setuptools-odoo
setuptools_odoo/core.py
https://github.com/acsone/setuptools-odoo/blob/cc4d7a63cf99fb3651c8c92f66f7dd13bf2afe6b/setuptools_odoo/core.py#L78-L95
def _get_odoo_version_info(addons_dir, odoo_version_override=None): """ Detect Odoo version from an addons directory """ odoo_version_info = None addons = os.listdir(addons_dir) for addon in addons: addon_dir = os.path.join(addons_dir, addon) if is_installable_addon(addon_dir): ...
[ "def", "_get_odoo_version_info", "(", "addons_dir", ",", "odoo_version_override", "=", "None", ")", ":", "odoo_version_info", "=", "None", "addons", "=", "os", ".", "listdir", "(", "addons_dir", ")", "for", "addon", "in", "addons", ":", "addon_dir", "=", "os",...
Detect Odoo version from an addons directory
[ "Detect", "Odoo", "version", "from", "an", "addons", "directory" ]
python
train
51.777778
aodag/WebDispatch
webdispatch/methoddispatcher.py
https://github.com/aodag/WebDispatch/blob/55f8658a2b4100498e098a80303a346c3940f1bc/webdispatch/methoddispatcher.py#L21-L30
def on_view_not_found( self, _, start_response: Callable[[str, List[Tuple[str, str]]], None], ) -> Iterable[bytes]: """ called when valid view is not found """ start_response( "405 Method Not Allowed", [('Content-type', 'text/plain')]) return ...
[ "def", "on_view_not_found", "(", "self", ",", "_", ",", "start_response", ":", "Callable", "[", "[", "str", ",", "List", "[", "Tuple", "[", "str", ",", "str", "]", "]", "]", ",", "None", "]", ",", ")", "->", "Iterable", "[", "bytes", "]", ":", "s...
called when valid view is not found
[ "called", "when", "valid", "view", "is", "not", "found" ]
python
train
33.4
log2timeline/dfvfs
dfvfs/helpers/source_scanner.py
https://github.com/log2timeline/dfvfs/blob/2b3ccd115f9901d89f383397d4a1376a873c83c4/dfvfs/helpers/source_scanner.py#L395-L538
def _ScanNode(self, scan_context, scan_node, auto_recurse=True): """Scans a node for supported formats. Args: scan_context (SourceScannerContext): source scanner context. scan_node (SourceScanNode): source scan node. auto_recurse (Optional[bool]): True if the scan should automatically ...
[ "def", "_ScanNode", "(", "self", ",", "scan_context", ",", "scan_node", ",", "auto_recurse", "=", "True", ")", ":", "if", "not", "scan_context", ":", "raise", "ValueError", "(", "'Invalid scan context.'", ")", "if", "not", "scan_node", ":", "raise", "ValueErro...
Scans a node for supported formats. Args: scan_context (SourceScannerContext): source scanner context. scan_node (SourceScanNode): source scan node. auto_recurse (Optional[bool]): True if the scan should automatically recurse as far as possible. Raises: BackEndError: if the s...
[ "Scans", "a", "node", "for", "supported", "formats", "." ]
python
train
36.048611
saeschdivara/ArangoPy
arangodb/orm/models.py
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/orm/models.py#L580-L619
def get_all_fields(cls, class_obj=None, fields=None): """ TODO: This needs to be properly used """ def return_fields(obj): internal_fields = fields if internal_fields is None: internal_fields = {} for attribute in dir(obj): ...
[ "def", "get_all_fields", "(", "cls", ",", "class_obj", "=", "None", ",", "fields", "=", "None", ")", ":", "def", "return_fields", "(", "obj", ")", ":", "internal_fields", "=", "fields", "if", "internal_fields", "is", "None", ":", "internal_fields", "=", "{...
TODO: This needs to be properly used
[ "TODO", ":", "This", "needs", "to", "be", "properly", "used" ]
python
train
30.125
lemieuxl/pyGenClean
pyGenClean/SexCheck/sex_check.py
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/SexCheck/sex_check.py#L469-L485
def createPedChr23UsingPlink(options): """Run Plink to create a ped format. :param options: the options. :type options: argparse.Namespace Uses Plink to create a ``ped`` file of markers on the chromosome ``23``. It uses the ``recodeA`` options to use additive coding. It also subsets the data ...
[ "def", "createPedChr23UsingPlink", "(", "options", ")", ":", "plinkCommand", "=", "[", "\"plink\"", ",", "\"--noweb\"", ",", "\"--bfile\"", ",", "options", ".", "bfile", ",", "\"--chr\"", ",", "\"23\"", ",", "\"--recodeA\"", ",", "\"--keep\"", ",", "options", ...
Run Plink to create a ped format. :param options: the options. :type options: argparse.Namespace Uses Plink to create a ``ped`` file of markers on the chromosome ``23``. It uses the ``recodeA`` options to use additive coding. It also subsets the data to keep only samples with sex problems.
[ "Run", "Plink", "to", "create", "a", "ped", "format", "." ]
python
train
36.764706
AkihikoITOH/capybara
capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/blueprints.py#L301-L307
def after_app_request(self, f): """Like :meth:`Flask.after_request` but for a blueprint. Such a function is executed after each request, even if outside of the blueprint. """ self.record_once(lambda s: s.app.after_request_funcs .setdefault(None, []).append(f)) return...
[ "def", "after_app_request", "(", "self", ",", "f", ")", ":", "self", ".", "record_once", "(", "lambda", "s", ":", "s", ".", "app", ".", "after_request_funcs", ".", "setdefault", "(", "None", ",", "[", "]", ")", ".", "append", "(", "f", ")", ")", "r...
Like :meth:`Flask.after_request` but for a blueprint. Such a function is executed after each request, even if outside of the blueprint.
[ "Like", ":", "meth", ":", "Flask", ".", "after_request", "but", "for", "a", "blueprint", ".", "Such", "a", "function", "is", "executed", "after", "each", "request", "even", "if", "outside", "of", "the", "blueprint", "." ]
python
test
45.142857
Erotemic/utool
utool/util_inspect.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_inspect.py#L161-L187
def get_internal_call_graph(fpath, with_doctests=False): """ CommandLine: python -m utool.util_inspect get_internal_call_graph --show --modpath=~/code/ibeis/ibeis/init/main_helpers.py --show python -m utool.util_inspect get_internal_call_graph --show --modpath=~/code/dtool/dtool/depcache_table.p...
[ "def", "get_internal_call_graph", "(", "fpath", ",", "with_doctests", "=", "False", ")", ":", "import", "utool", "as", "ut", "fpath", "=", "ut", ".", "truepath", "(", "fpath", ")", "sourcecode", "=", "ut", ".", "readfrom", "(", "fpath", ")", "self", "=",...
CommandLine: python -m utool.util_inspect get_internal_call_graph --show --modpath=~/code/ibeis/ibeis/init/main_helpers.py --show python -m utool.util_inspect get_internal_call_graph --show --modpath=~/code/dtool/dtool/depcache_table.py --show Example: >>> # DISABLE_DOCTEST >>> from...
[ "CommandLine", ":", "python", "-", "m", "utool", ".", "util_inspect", "get_internal_call_graph", "--", "show", "--", "modpath", "=", "~", "/", "code", "/", "ibeis", "/", "ibeis", "/", "init", "/", "main_helpers", ".", "py", "--", "show", "python", "-", "...
python
train
39.888889
harlowja/constructs
constructs/tree.py
https://github.com/harlowja/constructs/blob/53f20a8422bbd56294d5c0161081cb5875511fab/constructs/tree.py#L119-L128
def child_count(self, only_direct=True): """Returns how many children this node has, either only the direct children of this node or inclusive of all children nodes of this node. """ if not only_direct: count = 0 for _node in self.dfs_iter(): count...
[ "def", "child_count", "(", "self", ",", "only_direct", "=", "True", ")", ":", "if", "not", "only_direct", ":", "count", "=", "0", "for", "_node", "in", "self", ".", "dfs_iter", "(", ")", ":", "count", "+=", "1", "return", "count", "return", "len", "(...
Returns how many children this node has, either only the direct children of this node or inclusive of all children nodes of this node.
[ "Returns", "how", "many", "children", "this", "node", "has", "either", "only", "the", "direct", "children", "of", "this", "node", "or", "inclusive", "of", "all", "children", "nodes", "of", "this", "node", "." ]
python
train
37.6
PedalPi/Raspberry-Physical
physical/liquidcristal/liquid_crystal.py
https://github.com/PedalPi/Raspberry-Physical/blob/3dc71b6997ef36d0de256c5db7a1b38178937fd5/physical/liquidcristal/liquid_crystal.py#L206-L209
def left_to_right(self): """This is for text that flows Left to Right""" self._entry_mode |= Command.MODE_INCREMENT self.command(self._entry_mode)
[ "def", "left_to_right", "(", "self", ")", ":", "self", ".", "_entry_mode", "|=", "Command", ".", "MODE_INCREMENT", "self", ".", "command", "(", "self", ".", "_entry_mode", ")" ]
This is for text that flows Left to Right
[ "This", "is", "for", "text", "that", "flows", "Left", "to", "Right" ]
python
train
41.75
geertj/gruvi
lib/gruvi/http.py
https://github.com/geertj/gruvi/blob/1d77ca439600b6ea7a19aa1ee85dca0f3be3f3f8/lib/gruvi/http.py#L188-L203
def parse_te(header): """Parse the "TE" header.""" pos = 0 names = [] while pos < len(header): name, pos = expect_re(re_token, header, pos) _, pos = accept_ws(header, pos) _, pos = accept_lit(';', header, pos) _, pos = accept_ws(header, pos) qvalue, pos = accept_r...
[ "def", "parse_te", "(", "header", ")", ":", "pos", "=", "0", "names", "=", "[", "]", "while", "pos", "<", "len", "(", "header", ")", ":", "name", ",", "pos", "=", "expect_re", "(", "re_token", ",", "header", ",", "pos", ")", "_", ",", "pos", "=...
Parse the "TE" header.
[ "Parse", "the", "TE", "header", "." ]
python
train
33.1875
callowayproject/Transmogrify
transmogrify/utils.py
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/utils.py#L252-L264
def get_cached_files(url, server_name="", document_root=None): """ Given a URL, return a list of paths of all cached variations of that file. Doesn't include the original file. """ import glob url_info = process_url(url, server_name, document_root, check_security=False) # get path to cache...
[ "def", "get_cached_files", "(", "url", ",", "server_name", "=", "\"\"", ",", "document_root", "=", "None", ")", ":", "import", "glob", "url_info", "=", "process_url", "(", "url", ",", "server_name", ",", "document_root", ",", "check_security", "=", "False", ...
Given a URL, return a list of paths of all cached variations of that file. Doesn't include the original file.
[ "Given", "a", "URL", "return", "a", "list", "of", "paths", "of", "all", "cached", "variations", "of", "that", "file", "." ]
python
train
41.769231
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle2.py
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle2.py#L354-L369
def mount(self, app, script_path): ''' Mount a Bottle application to a specific URL prefix ''' if not isinstance(app, Bottle): raise TypeError('Only Bottle instances are supported for now.') script_path = '/'.join(filter(None, script_path.split('/'))) path_depth = script_path...
[ "def", "mount", "(", "self", ",", "app", ",", "script_path", ")", ":", "if", "not", "isinstance", "(", "app", ",", "Bottle", ")", ":", "raise", "TypeError", "(", "'Only Bottle instances are supported for now.'", ")", "script_path", "=", "'/'", ".", "join", "...
Mount a Bottle application to a specific URL prefix
[ "Mount", "a", "Bottle", "application", "to", "a", "specific", "URL", "prefix" ]
python
train
50.6875
tensorflow/tensor2tensor
tensor2tensor/trax/layers/core.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/layers/core.py#L42-L46
def RandomNormalInitializer(stddev=1e-2): """An initializer function for random normal coefficients.""" def init(shape, rng): return (stddev * backend.random.normal(rng, shape)).astype('float32') return init
[ "def", "RandomNormalInitializer", "(", "stddev", "=", "1e-2", ")", ":", "def", "init", "(", "shape", ",", "rng", ")", ":", "return", "(", "stddev", "*", "backend", ".", "random", ".", "normal", "(", "rng", ",", "shape", ")", ")", ".", "astype", "(", ...
An initializer function for random normal coefficients.
[ "An", "initializer", "function", "for", "random", "normal", "coefficients", "." ]
python
train
42.6
sosreport/sos
sos/plugins/vdsm.py
https://github.com/sosreport/sos/blob/2ebc04da53dc871c8dd5243567afa4f8592dca29/sos/plugins/vdsm.py#L144-L150
def _add_vdsm_forbidden_paths(self): """Add confidential sysprep vfds under /var/run/vdsm to forbidden paths """ for file_path in glob.glob("/var/run/vdsm/*"): if file_path.endswith(('.vfd', '/isoUploader', '/storage')): self.add_forbidden_path(file_path)
[ "def", "_add_vdsm_forbidden_paths", "(", "self", ")", ":", "for", "file_path", "in", "glob", ".", "glob", "(", "\"/var/run/vdsm/*\"", ")", ":", "if", "file_path", ".", "endswith", "(", "(", "'.vfd'", ",", "'/isoUploader'", ",", "'/storage'", ")", ")", ":", ...
Add confidential sysprep vfds under /var/run/vdsm to forbidden paths
[ "Add", "confidential", "sysprep", "vfds", "under", "/", "var", "/", "run", "/", "vdsm", "to", "forbidden", "paths" ]
python
train
43.285714
DataONEorg/d1_python
gmn/src/d1_gmn/app/views/decorators.py
https://github.com/DataONEorg/d1_python/blob/3ac4d4f3ca052d3e8641a6a329cab526c8ddcb0d/gmn/src/d1_gmn/app/views/decorators.py#L39-L54
def resolve_sid(f): """View handler decorator that adds SID resolve and PID validation. - For v1 calls, assume that ``did`` is a pid and raise NotFound exception if it's not valid. - For v2 calls, if DID is a valid PID, return it. If not, try to resolve it as a SID and, if successful, return th...
[ "def", "resolve_sid", "(", "f", ")", ":", "@", "functools", ".", "wraps", "(", "f", ")", "def", "wrapper", "(", "request", ",", "did", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "pid", "=", "resolve_sid_func", "(", "request", ",", "did", ...
View handler decorator that adds SID resolve and PID validation. - For v1 calls, assume that ``did`` is a pid and raise NotFound exception if it's not valid. - For v2 calls, if DID is a valid PID, return it. If not, try to resolve it as a SID and, if successful, return the new PID. Else, raise NotF...
[ "View", "handler", "decorator", "that", "adds", "SID", "resolve", "and", "PID", "validation", "." ]
python
train
33.875
lord63/tldr.py
tldr/cli.py
https://github.com/lord63/tldr.py/blob/73cf9f86254691b2476910ea6a743b6d8bd04963/tldr/cli.py#L22-L26
def parse_man_page(command, platform): """Parse the man page and return the parsed lines.""" page_path = find_page_location(command, platform) output_lines = parse_page(page_path) return output_lines
[ "def", "parse_man_page", "(", "command", ",", "platform", ")", ":", "page_path", "=", "find_page_location", "(", "command", ",", "platform", ")", "output_lines", "=", "parse_page", "(", "page_path", ")", "return", "output_lines" ]
Parse the man page and return the parsed lines.
[ "Parse", "the", "man", "page", "and", "return", "the", "parsed", "lines", "." ]
python
train
42.2
SatelliteQE/nailgun
nailgun/entities.py
https://github.com/SatelliteQE/nailgun/blob/c36d8c20862e87bf6975bd48ac1ca40a9e634eaa/nailgun/entities.py#L1649-L1657
def create_payload(self): """Wrap submitted data within an extra dict.""" payload = super(JobTemplate, self).create_payload() effective_user = payload.pop(u'effective_user', None) if effective_user: payload[u'ssh'] = {u'effective_user': effective_user} return {u'job...
[ "def", "create_payload", "(", "self", ")", ":", "payload", "=", "super", "(", "JobTemplate", ",", "self", ")", ".", "create_payload", "(", ")", "effective_user", "=", "payload", ".", "pop", "(", "u'effective_user'", ",", "None", ")", "if", "effective_user", ...
Wrap submitted data within an extra dict.
[ "Wrap", "submitted", "data", "within", "an", "extra", "dict", "." ]
python
train
36.888889
codeforamerica/epa_python
epa/envirofacts/envirofacts_api.py
https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/envirofacts/envirofacts_api.py#L29-L40
def catalog(self, table='', column=''): """Lookup the values available for querying.""" lookup_table = self.lookup_table if lookup_table is not None: if table: if column: column = column.upper() return lookup_table[table][column...
[ "def", "catalog", "(", "self", ",", "table", "=", "''", ",", "column", "=", "''", ")", ":", "lookup_table", "=", "self", ".", "lookup_table", "if", "lookup_table", "is", "not", "None", ":", "if", "table", ":", "if", "column", ":", "column", "=", "col...
Lookup the values available for querying.
[ "Lookup", "the", "values", "available", "for", "querying", "." ]
python
train
38.25
alex-kostirin/pyatomac
atomac/ldtpd/core.py
https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/ldtpd/core.py#L187-L207
def getcpustat(self, process_name): """ get CPU stat for the give process name @param process_name: Process name, ex: firefox-bin. @type process_name: string @return: cpu stat list on success, else empty list If same process name, running multiple instance, ...
[ "def", "getcpustat", "(", "self", ",", "process_name", ")", ":", "# Create an instance of process stat", "_stat_inst", "=", "ProcessStats", "(", "process_name", ")", "_stat_list", "=", "[", "]", "for", "p", "in", "_stat_inst", ".", "get_cpu_memory_stat", "(", ")",...
get CPU stat for the give process name @param process_name: Process name, ex: firefox-bin. @type process_name: string @return: cpu stat list on success, else empty list If same process name, running multiple instance, get the stat of all the process CPU usage ...
[ "get", "CPU", "stat", "for", "the", "give", "process", "name" ]
python
valid
33.952381
belbio/bel
bel/lang/completion.py
https://github.com/belbio/bel/blob/60333e8815625b942b4836903f3b618cf44b3771/bel/lang/completion.py#L494-L582
def add_completions( replace_list: list, belstr: str, replace_span: Span, completion_text: str ) -> List[Mapping[str, Any]]: """Create completions to return given replacement list Args: replace_list: list of completion replacement values belstr: BEL String replace_span: start, stop ...
[ "def", "add_completions", "(", "replace_list", ":", "list", ",", "belstr", ":", "str", ",", "replace_span", ":", "Span", ",", "completion_text", ":", "str", ")", "->", "List", "[", "Mapping", "[", "str", ",", "Any", "]", "]", ":", "completions", "=", "...
Create completions to return given replacement list Args: replace_list: list of completion replacement values belstr: BEL String replace_span: start, stop of belstr to replace completion_text: text to use for completion - used for creating highlight Returns: [{ ...
[ "Create", "completions", "to", "return", "given", "replacement", "list" ]
python
train
35
hydraplatform/hydra-base
hydra_base/lib/users.py
https://github.com/hydraplatform/hydra-base/blob/9251ff7946505f7a272c87837390acd1c435bc6e/hydra_base/lib/users.py#L75-L81
def get_usernames_like(username,**kwargs): """ Return a list of usernames like the given string. """ checkname = "%%%s%%"%username rs = db.DBSession.query(User.username).filter(User.username.like(checkname)).all() return [r.username for r in rs]
[ "def", "get_usernames_like", "(", "username", ",", "*", "*", "kwargs", ")", ":", "checkname", "=", "\"%%%s%%\"", "%", "username", "rs", "=", "db", ".", "DBSession", ".", "query", "(", "User", ".", "username", ")", ".", "filter", "(", "User", ".", "user...
Return a list of usernames like the given string.
[ "Return", "a", "list", "of", "usernames", "like", "the", "given", "string", "." ]
python
train
38.142857
devision-io/metasdk
metasdk/services/ApiProxyService.py
https://github.com/devision-io/metasdk/blob/1a1af5ceeb8ade843fd656c9c27c8b9ff789fc68/metasdk/services/ApiProxyService.py#L102-L114
def call_proxy(self, engine, payload, method, analyze_json_error_param, retry_request_substr_variants, stream=False): """ :param engine: Система :param payload: Данные для запроса :param method: string Может содержать native_call | tsv | json_newline :param ana...
[ "def", "call_proxy", "(", "self", ",", "engine", ",", "payload", ",", "method", ",", "analyze_json_error_param", ",", "retry_request_substr_variants", ",", "stream", "=", "False", ")", ":", "return", "self", ".", "__api_proxy_call", "(", "engine", ",", "payload"...
:param engine: Система :param payload: Данные для запроса :param method: string Может содержать native_call | tsv | json_newline :param analyze_json_error_param: Нужно ли производить анализ параметра error в ответе прокси :param retry_request_substr_variants: Список подстрок, при наличии...
[ ":", "param", "engine", ":", "Система", ":", "param", "payload", ":", "Данные", "для", "запроса", ":", "param", "method", ":", "string", "Может", "содержать", "native_call", "|", "tsv", "|", "json_newline", ":", "param", "analyze_json_error_param", ":", "Нужно...
python
train
55.923077
xiaocong/uiautomator
uiautomator/__init__.py
https://github.com/xiaocong/uiautomator/blob/9a0c892ffd056713f91aa2153d1533c5b0553a1c/uiautomator/__init__.py#L1090-L1095
def child(self, **kwargs): '''set childSelector.''' return AutomatorDeviceObject( self.device, self.selector.clone().child(**kwargs) )
[ "def", "child", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "AutomatorDeviceObject", "(", "self", ".", "device", ",", "self", ".", "selector", ".", "clone", "(", ")", ".", "child", "(", "*", "*", "kwargs", ")", ")" ]
set childSelector.
[ "set", "childSelector", "." ]
python
train
29.5
softlayer/softlayer-python
SoftLayer/CLI/user/detail.py
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/user/detail.py#L28-L56
def cli(env, identifier, keys, permissions, hardware, virtual, logins, events): """User details.""" mgr = SoftLayer.UserManager(env.client) user_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'username') object_mask = "userStatus[name], parent[id, username], apiAuthenticationKeys[authenticationKe...
[ "def", "cli", "(", "env", ",", "identifier", ",", "keys", ",", "permissions", ",", "hardware", ",", "virtual", ",", "logins", ",", "events", ")", ":", "mgr", "=", "SoftLayer", ".", "UserManager", "(", "env", ".", "client", ")", "user_id", "=", "helpers...
User details.
[ "User", "details", "." ]
python
train
40.931034
boriel/zxbasic
symbols/binary.py
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/symbols/binary.py#L68-L135
def make_node(cls, operator, left, right, lineno, func=None, type_=None): """ Creates a binary node for a binary operation, e.g. A + 6 => '+' (A, 6) in prefix notation. Parameters: -operator: the binary operation token. e.g. 'PLUS' for A + 6 -le...
[ "def", "make_node", "(", "cls", ",", "operator", ",", "left", ",", "right", ",", "lineno", ",", "func", "=", "None", ",", "type_", "=", "None", ")", ":", "if", "left", "is", "None", "or", "right", "is", "None", ":", "return", "None", "a", ",", "b...
Creates a binary node for a binary operation, e.g. A + 6 => '+' (A, 6) in prefix notation. Parameters: -operator: the binary operation token. e.g. 'PLUS' for A + 6 -left: left operand -right: right operand -func: is a lambda function used when con...
[ "Creates", "a", "binary", "node", "for", "a", "binary", "operation", "e", ".", "g", ".", "A", "+", "6", "=", ">", "+", "(", "A", "6", ")", "in", "prefix", "notation", "." ]
python
train
43.808824
DataONEorg/d1_python
client_cli/src/d1_cli/impl/command_parser.py
https://github.com/DataONEorg/d1_python/blob/3ac4d4f3ca052d3e8641a6a329cab526c8ddcb0d/client_cli/src/d1_cli/impl/command_parser.py#L507-L511
def do_edit(self, line): """edit Edit the queue of write operations.""" self._split_args(line, 0, 0) self._command_processor.get_operation_queue().edit() self._print_info_if_verbose("The write operation queue was successfully edited")
[ "def", "do_edit", "(", "self", ",", "line", ")", ":", "self", ".", "_split_args", "(", "line", ",", "0", ",", "0", ")", "self", ".", "_command_processor", ".", "get_operation_queue", "(", ")", ".", "edit", "(", ")", "self", ".", "_print_info_if_verbose",...
edit Edit the queue of write operations.
[ "edit", "Edit", "the", "queue", "of", "write", "operations", "." ]
python
train
52.4
cisco-sas/kitty
kitty/model/low_level/container.py
https://github.com/cisco-sas/kitty/blob/cb0760989dcdfe079e43ac574d872d0b18953a32/kitty/model/low_level/container.py#L235-L243
def get_field_by_name(self, name): ''' :param name: name of field to get :return: direct sub-field with the given name :raises: :class:`~kitty.core.KittyException` if no direct subfield with this name ''' if name in self._fields_dict: return self._fields_dict[...
[ "def", "get_field_by_name", "(", "self", ",", "name", ")", ":", "if", "name", "in", "self", ".", "_fields_dict", ":", "return", "self", ".", "_fields_dict", "[", "name", "]", "raise", "KittyException", "(", "'field named (%s) was not found in (%s)'", "%", "(", ...
:param name: name of field to get :return: direct sub-field with the given name :raises: :class:`~kitty.core.KittyException` if no direct subfield with this name
[ ":", "param", "name", ":", "name", "of", "field", "to", "get", ":", "return", ":", "direct", "sub", "-", "field", "with", "the", "given", "name", ":", "raises", ":", ":", "class", ":", "~kitty", ".", "core", ".", "KittyException", "if", "no", "direct...
python
train
44.777778
gem/oq-engine
openquake/hmtk/sources/simple_fault_source.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hmtk/sources/simple_fault_source.py#L147-L189
def create_geometry(self, input_geometry, dip, upper_depth, lower_depth, mesh_spacing=1.0): ''' If geometry is defined as a numpy array then create instance of nhlib.geo.line.Line class, otherwise if already instance of class accept class :param input_geo...
[ "def", "create_geometry", "(", "self", ",", "input_geometry", ",", "dip", ",", "upper_depth", ",", "lower_depth", ",", "mesh_spacing", "=", "1.0", ")", ":", "assert", "(", "(", "dip", ">", "0.", ")", "and", "(", "dip", "<=", "90.", ")", ")", "self", ...
If geometry is defined as a numpy array then create instance of nhlib.geo.line.Line class, otherwise if already instance of class accept class :param input_geometry: Trace (line) of the fault source as either i) instance of nhlib.geo.line.Line class ii) numpy...
[ "If", "geometry", "is", "defined", "as", "a", "numpy", "array", "then", "create", "instance", "of", "nhlib", ".", "geo", ".", "line", ".", "Line", "class", "otherwise", "if", "already", "instance", "of", "class", "accept", "class" ]
python
train
40.697674
inasafe/inasafe
safe/gui/tools/options_dialog.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/options_dialog.py#L766-L790
def restore_population_parameters(self, global_default=True): """Setup UI for population parameter page from setting. :param global_default: If True, set to original default (from the value in definitions). :type global_default: bool """ if global_default: ...
[ "def", "restore_population_parameters", "(", "self", ",", "global_default", "=", "True", ")", ":", "if", "global_default", ":", "data", "=", "generate_default_profile", "(", ")", "else", ":", "data", "=", "setting", "(", "'population_preference'", ",", "generate_d...
Setup UI for population parameter page from setting. :param global_default: If True, set to original default (from the value in definitions). :type global_default: bool
[ "Setup", "UI", "for", "population", "parameter", "page", "from", "setting", "." ]
python
train
40
inveniosoftware-attic/invenio-client
invenio_client/connector.py
https://github.com/inveniosoftware-attic/invenio-client/blob/3f9ddb6f3b3ce3a21d399d1098d6769bf05cdd6c/invenio_client/connector.py#L264-L289
def get_records_from_basket(self, bskid, group_basket=False, read_cache=True): """ Returns the records from the (public) basket with given bskid """ if bskid not in self.cached_baskets or not read_cache: if self.user: if group_b...
[ "def", "get_records_from_basket", "(", "self", ",", "bskid", ",", "group_basket", "=", "False", ",", "read_cache", "=", "True", ")", ":", "if", "bskid", "not", "in", "self", ".", "cached_baskets", "or", "not", "read_cache", ":", "if", "self", ".", "user", ...
Returns the records from the (public) basket with given bskid
[ "Returns", "the", "records", "from", "the", "(", "public", ")", "basket", "with", "given", "bskid" ]
python
train
40.615385
Neurita/boyle
boyle/commands.py
https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/commands.py#L146-L169
def condor_submit(cmd): """ Submits cmd to HTCondor queue Parameters ---------- cmd: string Command to be submitted Returns ------- int returncode value from calling the submission command. """ is_running = subprocess.call('condor_status', shell=True) == 0 i...
[ "def", "condor_submit", "(", "cmd", ")", ":", "is_running", "=", "subprocess", ".", "call", "(", "'condor_status'", ",", "shell", "=", "True", ")", "==", "0", "if", "not", "is_running", ":", "raise", "CalledProcessError", "(", "'HTCondor is not running.'", ")"...
Submits cmd to HTCondor queue Parameters ---------- cmd: string Command to be submitted Returns ------- int returncode value from calling the submission command.
[ "Submits", "cmd", "to", "HTCondor", "queue" ]
python
valid
23.666667
azavea/python-sld
sld/__init__.py
https://github.com/azavea/python-sld/blob/70e363782b39249bc9512a78dbbc45aaee52aaf5/sld/__init__.py#L1227-L1274
def create_rule(self, title, symbolizer=None, MinScaleDenominator=None, MaxScaleDenominator=None): """ Create a L{Rule} object on this style. A rule requires a title and symbolizer. If no symbolizer is specified, a PointSymbolizer will be assigned to the rule. @type title:...
[ "def", "create_rule", "(", "self", ",", "title", ",", "symbolizer", "=", "None", ",", "MinScaleDenominator", "=", "None", ",", "MaxScaleDenominator", "=", "None", ")", ":", "elem", "=", "self", ".", "_node", ".", "makeelement", "(", "'{%s}Rule'", "%", "SLD...
Create a L{Rule} object on this style. A rule requires a title and symbolizer. If no symbolizer is specified, a PointSymbolizer will be assigned to the rule. @type title: string @param title: The name of the new L{Rule}. @type symbolizer: L{Symbolizer} I{class} ...
[ "Create", "a", "L", "{", "Rule", "}", "object", "on", "this", "style", ".", "A", "rule", "requires", "a", "title", "and", "symbolizer", ".", "If", "no", "symbolizer", "is", "specified", "a", "PointSymbolizer", "will", "be", "assigned", "to", "the", "rule...
python
train
38.020833
singularityhub/singularity-python
singularity/build/main.py
https://github.com/singularityhub/singularity-python/blob/498c3433724b332f7493fec632d8daf479f47b82/singularity/build/main.py#L170-L203
def send_build_data(build_dir, data, secret, response_url=None,clean_up=True): '''finish build sends the build and data (response) to a response url :param build_dir: the directory of the build :response_url: where to send the response. If None, won't send :param data: the data obje...
[ "def", "send_build_data", "(", "build_dir", ",", "data", ",", "secret", ",", "response_url", "=", "None", ",", "clean_up", "=", "True", ")", ":", "# Send with Authentication header", "body", "=", "'%s|%s|%s|%s|%s'", "%", "(", "data", "[", "'container_id'", "]", ...
finish build sends the build and data (response) to a response url :param build_dir: the directory of the build :response_url: where to send the response. If None, won't send :param data: the data object to send as a post :param clean_up: If true (default) removes build directory
[ "finish", "build", "sends", "the", "build", "and", "data", "(", "response", ")", "to", "a", "response", "url", ":", "param", "build_dir", ":", "the", "directory", "of", "the", "build", ":", "response_url", ":", "where", "to", "send", "the", "response", "...
python
train
39.794118
Miserlou/django-zappa
django_zappa/management/commands/zappa_command.py
https://github.com/Miserlou/django-zappa/blob/7a8083ab6257a0bf0f5c9ae460afabd4de4e2215/django_zappa/management/commands/zappa_command.py#L168-L210
def create_package(self): """ Ensure that the package can be properly configured, and then create it. """ # Create the Lambda zip package (includes project and virtualenvironment) # Also define the path the handler file so it can be copied to the zip # root for ...
[ "def", "create_package", "(", "self", ")", ":", "# Create the Lambda zip package (includes project and virtualenvironment)", "# Also define the path the handler file so it can be copied to the zip", "# root for Lambda.", "current_file", "=", "os", ".", "path", ".", "dirname", "(", ...
Ensure that the package can be properly configured, and then create it.
[ "Ensure", "that", "the", "package", "can", "be", "properly", "configured", "and", "then", "create", "it", "." ]
python
train
39.906977
michael-lazar/rtv
rtv/packages/praw/objects.py
https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/objects.py#L297-L306
def unignore_reports(self): """Remove ignoring of future reports on this object. Undoes 'ignore_reports'. Future reports will now cause notifications and appear in the various moderation listings. """ url = self.reddit_session.config['unignore_reports'] data = {'id': se...
[ "def", "unignore_reports", "(", "self", ")", ":", "url", "=", "self", ".", "reddit_session", ".", "config", "[", "'unignore_reports'", "]", "data", "=", "{", "'id'", ":", "self", ".", "fullname", "}", "return", "self", ".", "reddit_session", ".", "request_...
Remove ignoring of future reports on this object. Undoes 'ignore_reports'. Future reports will now cause notifications and appear in the various moderation listings.
[ "Remove", "ignoring", "of", "future", "reports", "on", "this", "object", "." ]
python
train
38.7
stitchdata/python-stitch-client
stitchclient/client.py
https://github.com/stitchdata/python-stitch-client/blob/de4dfb3db209e5d0a7b0c0dcef625f3e465c787b/stitchclient/client.py#L136-L152
def _take_batch(self, min_records): '''If we have enough data to build a batch, returns all the data in the buffer and then clears the buffer.''' if not self._buffer: return [] enough_messages = len(self._buffer) >= min_records enough_time = time.time() - self.time_...
[ "def", "_take_batch", "(", "self", ",", "min_records", ")", ":", "if", "not", "self", ".", "_buffer", ":", "return", "[", "]", "enough_messages", "=", "len", "(", "self", ".", "_buffer", ")", ">=", "min_records", "enough_time", "=", "time", ".", "time", ...
If we have enough data to build a batch, returns all the data in the buffer and then clears the buffer.
[ "If", "we", "have", "enough", "data", "to", "build", "a", "batch", "returns", "all", "the", "data", "in", "the", "buffer", "and", "then", "clears", "the", "buffer", "." ]
python
train
31
F5Networks/f5-common-python
f5sdk_plugins/fixtures.py
https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5sdk_plugins/fixtures.py#L108-L112
def vcmp_host(opt_vcmp_host, opt_username, opt_password, opt_port): '''vcmp fixture''' m = ManagementRoot( opt_vcmp_host, opt_username, opt_password, port=opt_port) return m
[ "def", "vcmp_host", "(", "opt_vcmp_host", ",", "opt_username", ",", "opt_password", ",", "opt_port", ")", ":", "m", "=", "ManagementRoot", "(", "opt_vcmp_host", ",", "opt_username", ",", "opt_password", ",", "port", "=", "opt_port", ")", "return", "m" ]
vcmp fixture
[ "vcmp", "fixture" ]
python
train
37.8
tyiannak/pyAudioAnalysis
pyAudioAnalysis/audioFeatureExtraction.py
https://github.com/tyiannak/pyAudioAnalysis/blob/e3da991e7247492deba50648a4c7c0f41e684af4/pyAudioAnalysis/audioFeatureExtraction.py#L521-L614
def stFeatureExtraction(signal, fs, win, step): """ This function implements the shor-term windowing process. For each short-term window a set of features is extracted. This results to a sequence of feature vectors, stored in a numpy matrix. ARGUMENTS signal: the input signal samples ...
[ "def", "stFeatureExtraction", "(", "signal", ",", "fs", ",", "win", ",", "step", ")", ":", "win", "=", "int", "(", "win", ")", "step", "=", "int", "(", "step", ")", "# Signal normalization", "signal", "=", "numpy", ".", "double", "(", "signal", ")", ...
This function implements the shor-term windowing process. For each short-term window a set of features is extracted. This results to a sequence of feature vectors, stored in a numpy matrix. ARGUMENTS signal: the input signal samples fs: the sampling freq (in Hz) win: ...
[ "This", "function", "implements", "the", "shor", "-", "term", "windowing", "process", ".", "For", "each", "short", "-", "term", "window", "a", "set", "of", "features", "is", "extracted", ".", "This", "results", "to", "a", "sequence", "of", "feature", "vect...
python
train
43.925532
nakagami/pyfirebirdsql
firebirdsql/xsqlvar.py
https://github.com/nakagami/pyfirebirdsql/blob/5ce366c2fc8318510444f4a89801442f3e9e52ca/firebirdsql/xsqlvar.py#L118-L138
def _parse_date(self, raw_value): "Convert raw data to datetime.date" nday = bytes_to_bint(raw_value) + 678882 century = (4 * nday - 1) // 146097 nday = 4 * nday - 1 - 146097 * century day = nday // 4 nday = (4 * day + 3) // 1461 day = 4 * day + 3 - 1461 * nday ...
[ "def", "_parse_date", "(", "self", ",", "raw_value", ")", ":", "nday", "=", "bytes_to_bint", "(", "raw_value", ")", "+", "678882", "century", "=", "(", "4", "*", "nday", "-", "1", ")", "//", "146097", "nday", "=", "4", "*", "nday", "-", "1", "-", ...
Convert raw data to datetime.date
[ "Convert", "raw", "data", "to", "datetime", ".", "date" ]
python
train
28.904762
uw-it-aca/uw-restclients-canvas
uw_canvas/roles.py
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/roles.py#L50-L55
def get_role_by_account_sis_id(self, account_sis_id, role_id): """ Get information about a single role, for the passed account SIS ID. """ return self.get_role(self._sis_id(account_sis_id, sis_field="account"), role_id)
[ "def", "get_role_by_account_sis_id", "(", "self", ",", "account_sis_id", ",", "role_id", ")", ":", "return", "self", ".", "get_role", "(", "self", ".", "_sis_id", "(", "account_sis_id", ",", "sis_field", "=", "\"account\"", ")", ",", "role_id", ")" ]
Get information about a single role, for the passed account SIS ID.
[ "Get", "information", "about", "a", "single", "role", "for", "the", "passed", "account", "SIS", "ID", "." ]
python
test
45.833333
pypa/pipenv
pipenv/patched/notpip/_internal/wheel.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/wheel.py#L727-L733
def _contains_egg_info( s, _egg_info_re=re.compile(r'([a-z0-9_.]+)-([a-z0-9_.!+-]+)', re.I)): """Determine whether the string looks like an egg_info. :param s: The string to parse. E.g. foo-2.1 """ return bool(_egg_info_re.search(s))
[ "def", "_contains_egg_info", "(", "s", ",", "_egg_info_re", "=", "re", ".", "compile", "(", "r'([a-z0-9_.]+)-([a-z0-9_.!+-]+)'", ",", "re", ".", "I", ")", ")", ":", "return", "bool", "(", "_egg_info_re", ".", "search", "(", "s", ")", ")" ]
Determine whether the string looks like an egg_info. :param s: The string to parse. E.g. foo-2.1
[ "Determine", "whether", "the", "string", "looks", "like", "an", "egg_info", "." ]
python
train
36
TriOptima/tri.declarative
lib/tri/declarative/__init__.py
https://github.com/TriOptima/tri.declarative/blob/13d90d4c2a10934e37a4139e63d51a859fb3e303/lib/tri/declarative/__init__.py#L154-L209
def declarative(member_class=None, parameter='members', add_init_kwargs=True, sort_key=default_sort_key, is_member=None): """ Class decorator to enable classes to be defined in the style of django models. That is, @declarative classes will get an additional argument to constructor, containin...
[ "def", "declarative", "(", "member_class", "=", "None", ",", "parameter", "=", "'members'", ",", "add_init_kwargs", "=", "True", ",", "sort_key", "=", "default_sort_key", ",", "is_member", "=", "None", ")", ":", "if", "member_class", "is", "None", "and", "is...
Class decorator to enable classes to be defined in the style of django models. That is, @declarative classes will get an additional argument to constructor, containing an OrderedDict with all class members matching the specified type. :param class member_class: Class(es) to collect :par...
[ "Class", "decorator", "to", "enable", "classes", "to", "be", "defined", "in", "the", "style", "of", "django", "models", ".", "That", "is", "@declarative", "classes", "will", "get", "an", "additional", "argument", "to", "constructor", "containing", "an", "Order...
python
train
47.375
quantumlib/Cirq
cirq/google/sim/mem_manager.py
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/cirq/google/sim/mem_manager.py#L53-L91
def _create_array(self, arr: np.ndarray) -> int: """Returns the handle of a RawArray created from the given numpy array. Args: arr: A numpy ndarray. Returns: The handle (int) of the array. Raises: ValueError: if arr is not a ndarray or of an unsupported d...
[ "def", "_create_array", "(", "self", ",", "arr", ":", "np", ".", "ndarray", ")", "->", "int", ":", "if", "not", "isinstance", "(", "arr", ",", "np", ".", "ndarray", ")", ":", "raise", "ValueError", "(", "'Array is not a numpy ndarray.'", ")", "try", ":",...
Returns the handle of a RawArray created from the given numpy array. Args: arr: A numpy ndarray. Returns: The handle (int) of the array. Raises: ValueError: if arr is not a ndarray or of an unsupported dtype. If the array is of an unsupported type, us...
[ "Returns", "the", "handle", "of", "a", "RawArray", "created", "from", "the", "given", "numpy", "array", "." ]
python
train
34.358974
python-bugzilla/python-bugzilla
bugzilla/bug.py
https://github.com/python-bugzilla/python-bugzilla/blob/7de8b225104f24a1eee3e837bf1e02d60aefe69f/bugzilla/bug.py#L294-L299
def getcomments(self): """ Returns an array of comment dictionaries for this bug """ comment_list = self.bugzilla.get_comments([self.bug_id]) return comment_list['bugs'][str(self.bug_id)]['comments']
[ "def", "getcomments", "(", "self", ")", ":", "comment_list", "=", "self", ".", "bugzilla", ".", "get_comments", "(", "[", "self", ".", "bug_id", "]", ")", "return", "comment_list", "[", "'bugs'", "]", "[", "str", "(", "self", ".", "bug_id", ")", "]", ...
Returns an array of comment dictionaries for this bug
[ "Returns", "an", "array", "of", "comment", "dictionaries", "for", "this", "bug" ]
python
train
39
jazzband/django-push-notifications
push_notifications/wns.py
https://github.com/jazzband/django-push-notifications/blob/c4a0d710711fa27bfb6533c0bf3468cb67a62679/push_notifications/wns.py#L325-L357
def _add_sub_elements_from_dict(parent, sub_dict): """ Add SubElements to the parent element. :param parent: ElementTree.Element: The parent element for the newly created SubElement. :param sub_dict: dict: Used to create a new SubElement. See `dict_to_xml_schema` method docstring for more information. e.g.: {"e...
[ "def", "_add_sub_elements_from_dict", "(", "parent", ",", "sub_dict", ")", ":", "for", "key", ",", "value", "in", "sub_dict", ".", "items", "(", ")", ":", "if", "isinstance", "(", "value", ",", "list", ")", ":", "for", "repeated_element", "in", "value", ...
Add SubElements to the parent element. :param parent: ElementTree.Element: The parent element for the newly created SubElement. :param sub_dict: dict: Used to create a new SubElement. See `dict_to_xml_schema` method docstring for more information. e.g.: {"example": { "attrs": { "key1": "value1", ... ...
[ "Add", "SubElements", "to", "the", "parent", "element", "." ]
python
train
33.484848
tgbugs/pyontutils
ilxutils/ilxutils/database_client.py
https://github.com/tgbugs/pyontutils/blob/3d913db29c177db39151592909a4f56170ef8b35/ilxutils/ilxutils/database_client.py#L53-L74
def create_df_file_with_query(self, query, output): """ Dumps in df in chunks to avoid crashes. """ chunk_size = 100000 offset = 0 data = defaultdict(lambda : defaultdict(list)) with open(output, 'wb') as outfile: query = query.replace(';', '') qu...
[ "def", "create_df_file_with_query", "(", "self", ",", "query", ",", "output", ")", ":", "chunk_size", "=", "100000", "offset", "=", "0", "data", "=", "defaultdict", "(", "lambda", ":", "defaultdict", "(", "list", ")", ")", "with", "open", "(", "output", ...
Dumps in df in chunks to avoid crashes.
[ "Dumps", "in", "df", "in", "chunks", "to", "avoid", "crashes", "." ]
python
train
34.590909
saltstack/salt
salt/modules/gpg.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gpg.py#L1226-L1311
def decrypt(user=None, text=None, filename=None, output=None, use_passphrase=False, gnupghome=None, bare=False): ''' Decrypt a message or file user Which user's keychain to access, defaults to user Salt is running as. P...
[ "def", "decrypt", "(", "user", "=", "None", ",", "text", "=", "None", ",", "filename", "=", "None", ",", "output", "=", "None", ",", "use_passphrase", "=", "False", ",", "gnupghome", "=", "None", ",", "bare", "=", "False", ")", ":", "ret", "=", "{"...
Decrypt a message or file user Which user's keychain to access, defaults to user Salt is running as. Passing the user as ``salt`` will set the GnuPG home directory to the ``/etc/salt/gpgkeys``. text The encrypted text to decrypt. filename The encrypted filename to ...
[ "Decrypt", "a", "message", "or", "file" ]
python
train
28.290698
tk0miya/tk.phpautodoc
src/phply/phpparse.py
https://github.com/tk0miya/tk.phpautodoc/blob/cf789f64abaf76351485cee231a075227e665fb6/src/phply/phpparse.py#L1207-L1212
def p_common_scalar_magic_dir(p): 'common_scalar : DIR' value = getattr(p.lexer, 'filename', None) if value is not None: value = os.path.dirname(value) p[0] = ast.MagicConstant(p[1].upper(), value, lineno=p.lineno(1))
[ "def", "p_common_scalar_magic_dir", "(", "p", ")", ":", "value", "=", "getattr", "(", "p", ".", "lexer", ",", "'filename'", ",", "None", ")", "if", "value", "is", "not", "None", ":", "value", "=", "os", ".", "path", ".", "dirname", "(", "value", ")",...
common_scalar : DIR
[ "common_scalar", ":", "DIR" ]
python
train
39.333333
nkavaldj/myhdl_lib
myhdl_lib/simulation/_DUTer.py
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/simulation/_DUTer.py#L66-L98
def _getCosimulation(self, func, **kwargs): ''' Returns a co-simulation instance of func. Uses the _simulator specified by self._simulator. Enables traces if self._trace is True func - MyHDL function to be simulated kwargs - dict of func interface assign...
[ "def", "_getCosimulation", "(", "self", ",", "func", ",", "*", "*", "kwargs", ")", ":", "vals", "=", "{", "}", "vals", "[", "'topname'", "]", "=", "func", ".", "func_name", "vals", "[", "'unitname'", "]", "=", "func", ".", "func_name", ".", "lower", ...
Returns a co-simulation instance of func. Uses the _simulator specified by self._simulator. Enables traces if self._trace is True func - MyHDL function to be simulated kwargs - dict of func interface assignments: for signals and parameters
[ "Returns", "a", "co", "-", "simulation", "instance", "of", "func", ".", "Uses", "the", "_simulator", "specified", "by", "self", ".", "_simulator", ".", "Enables", "traces", "if", "self", ".", "_trace", "is", "True", "func", "-", "MyHDL", "function", "to", ...
python
train
38.454545
twilio/twilio-python
twilio/rest/proxy/v1/service/session/participant/message_interaction.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/proxy/v1/service/session/participant/message_interaction.py#L44-L68
def create(self, body=values.unset, media_url=values.unset): """ Create a new MessageInteractionInstance :param unicode body: Message body :param unicode media_url: Reserved :returns: Newly created MessageInteractionInstance :rtype: twilio.rest.proxy.v1.service.session....
[ "def", "create", "(", "self", ",", "body", "=", "values", ".", "unset", ",", "media_url", "=", "values", ".", "unset", ")", ":", "data", "=", "values", ".", "of", "(", "{", "'Body'", ":", "body", ",", "'MediaUrl'", ":", "serialize", ".", "map", "("...
Create a new MessageInteractionInstance :param unicode body: Message body :param unicode media_url: Reserved :returns: Newly created MessageInteractionInstance :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionInstance
[ "Create", "a", "new", "MessageInteractionInstance" ]
python
train
34.08
ContextLab/quail
quail/helpers.py
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L263-L278
def merge_pres_feats(pres, features): """ Helper function to merge pres and features to support legacy features argument """ sub = [] for psub, fsub in zip(pres, features): exp = [] for pexp, fexp in zip(psub, fsub): lst = [] for p, f in zip(pexp, fexp): ...
[ "def", "merge_pres_feats", "(", "pres", ",", "features", ")", ":", "sub", "=", "[", "]", "for", "psub", ",", "fsub", "in", "zip", "(", "pres", ",", "features", ")", ":", "exp", "=", "[", "]", "for", "pexp", ",", "fexp", "in", "zip", "(", "psub", ...
Helper function to merge pres and features to support legacy features argument
[ "Helper", "function", "to", "merge", "pres", "and", "features", "to", "support", "legacy", "features", "argument" ]
python
train
26.5625
sanger-pathogens/pymummer
pymummer/alignment.py
https://github.com/sanger-pathogens/pymummer/blob/fd97bccfbae62719a7247473d73dd6733d4fa903/pymummer/alignment.py#L90-L93
def reverse_reference(self): '''Changes the coordinates as if the reference sequence has been reverse complemented''' self.ref_start = self.ref_length - self.ref_start - 1 self.ref_end = self.ref_length - self.ref_end - 1
[ "def", "reverse_reference", "(", "self", ")", ":", "self", ".", "ref_start", "=", "self", ".", "ref_length", "-", "self", ".", "ref_start", "-", "1", "self", ".", "ref_end", "=", "self", ".", "ref_length", "-", "self", ".", "ref_end", "-", "1" ]
Changes the coordinates as if the reference sequence has been reverse complemented
[ "Changes", "the", "coordinates", "as", "if", "the", "reference", "sequence", "has", "been", "reverse", "complemented" ]
python
train
60.5
JoelBender/bacpypes
py25/bacpypes/apdu.py
https://github.com/JoelBender/bacpypes/blob/4111b8604a16fa2b7f80d8104a43b9f3e28dfc78/py25/bacpypes/apdu.py#L719-L734
def apdu_contents(self, use_dict=None, as_class=dict): """Return the contents of an object as a dict.""" if _debug: APCISequence._debug("apdu_contents use_dict=%r as_class=%r", use_dict, as_class) # make/extend the dictionary of content if use_dict is None: use_dict = as_cla...
[ "def", "apdu_contents", "(", "self", ",", "use_dict", "=", "None", ",", "as_class", "=", "dict", ")", ":", "if", "_debug", ":", "APCISequence", ".", "_debug", "(", "\"apdu_contents use_dict=%r as_class=%r\"", ",", "use_dict", ",", "as_class", ")", "# make/extend...
Return the contents of an object as a dict.
[ "Return", "the", "contents", "of", "an", "object", "as", "a", "dict", "." ]
python
train
38.25
SAP/PyHDB
pyhdb/protocol/message.py
https://github.com/SAP/PyHDB/blob/826539d06b8bcef74fe755e7489b8a8255628f12/pyhdb/protocol/message.py#L47-L69
def pack(self): """ Pack message to binary stream. """ payload = io.BytesIO() # Advance num bytes equal to header size - the header is written later # after the payload of all segments and parts has been written: payload.seek(self.header_size, io.SEEK_CUR) # Write out pa...
[ "def", "pack", "(", "self", ")", ":", "payload", "=", "io", ".", "BytesIO", "(", ")", "# Advance num bytes equal to header size - the header is written later", "# after the payload of all segments and parts has been written:", "payload", ".", "seek", "(", "self", ".", "head...
Pack message to binary stream.
[ "Pack", "message", "to", "binary", "stream", "." ]
python
train
39.434783
gem/oq-engine
openquake/hmtk/plotting/beachball.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hmtk/plotting/beachball.py#L769-L849
def TDL(AN, BN): """ Helper function for MT2Plane. Adapted from MATLAB script `bb.m <http://www.ceri.memphis.edu/people/olboyd/Software/Software.html>`_ written by Andy Michael and Oliver Boyd. """ XN = AN[0] YN = AN[1] ZN = AN[2] XE = BN[0] YE = BN[1] ZE = BN[2] AAA...
[ "def", "TDL", "(", "AN", ",", "BN", ")", ":", "XN", "=", "AN", "[", "0", "]", "YN", "=", "AN", "[", "1", "]", "ZN", "=", "AN", "[", "2", "]", "XE", "=", "BN", "[", "0", "]", "YE", "=", "BN", "[", "1", "]", "ZE", "=", "BN", "[", "2",...
Helper function for MT2Plane. Adapted from MATLAB script `bb.m <http://www.ceri.memphis.edu/people/olboyd/Software/Software.html>`_ written by Andy Michael and Oliver Boyd.
[ "Helper", "function", "for", "MT2Plane", "." ]
python
train
24.08642
tensorflow/cleverhans
cleverhans/experimental/certification/dual_formulation.py
https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/cleverhans/experimental/certification/dual_formulation.py#L380-L423
def get_full_psd_matrix(self): """Function that returns the tf graph corresponding to the entire matrix M. Returns: matrix_h: unrolled version of tf matrix corresponding to H matrix_m: unrolled tf matrix corresponding to M """ if self.matrix_m is not None: return self.matrix_h, self.m...
[ "def", "get_full_psd_matrix", "(", "self", ")", ":", "if", "self", ".", "matrix_m", "is", "not", "None", ":", "return", "self", ".", "matrix_h", ",", "self", ".", "matrix_m", "# Computing the matrix term", "h_columns", "=", "[", "]", "for", "i", "in", "ran...
Function that returns the tf graph corresponding to the entire matrix M. Returns: matrix_h: unrolled version of tf matrix corresponding to H matrix_m: unrolled tf matrix corresponding to M
[ "Function", "that", "returns", "the", "tf", "graph", "corresponding", "to", "the", "entire", "matrix", "M", "." ]
python
train
37.068182
jrief/django-websocket-redis
ws4redis/websocket.py
https://github.com/jrief/django-websocket-redis/blob/abcddaad2f579d71dbf375e5e34bc35eef795a81/ws4redis/websocket.py#L209-L226
def receive(self): """ Read and return a message from the stream. If `None` is returned, then the socket is considered closed/errored. """ if self._closed: raise WebSocketError("Connection is already closed") try: return self.read_message() ...
[ "def", "receive", "(", "self", ")", ":", "if", "self", ".", "_closed", ":", "raise", "WebSocketError", "(", "\"Connection is already closed\"", ")", "try", ":", "return", "self", ".", "read_message", "(", ")", "except", "UnicodeError", "as", "e", ":", "logge...
Read and return a message from the stream. If `None` is returned, then the socket is considered closed/errored.
[ "Read", "and", "return", "a", "message", "from", "the", "stream", ".", "If", "None", "is", "returned", "then", "the", "socket", "is", "considered", "closed", "/", "errored", "." ]
python
train
38.5
ktbyers/netmiko
netmiko/base_connection.py
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/base_connection.py#L935-L948
def _build_ssh_client(self): """Prepare for Paramiko SSH connection.""" # Create instance of SSHClient object remote_conn_pre = paramiko.SSHClient() # Load host_keys for better SSH security if self.system_host_keys: remote_conn_pre.load_system_host_keys() if ...
[ "def", "_build_ssh_client", "(", "self", ")", ":", "# Create instance of SSHClient object", "remote_conn_pre", "=", "paramiko", ".", "SSHClient", "(", ")", "# Load host_keys for better SSH security", "if", "self", ".", "system_host_keys", ":", "remote_conn_pre", ".", "loa...
Prepare for Paramiko SSH connection.
[ "Prepare", "for", "Paramiko", "SSH", "connection", "." ]
python
train
44.214286
MrYsLab/pymata-aio
pymata_aio/pymata_iot.py
https://github.com/MrYsLab/pymata-aio/blob/015081a4628b9d47dfe3f8d6c698ff903f107810/pymata_aio/pymata_iot.py#L127-L140
async def digital_read(self, command): """ This method reads and returns the last reported value for a digital pin. Normally not used since digital pin updates will be provided automatically as they occur with the digital_message_reply being sent to the client after set_pin_mode is calle...
[ "async", "def", "digital_read", "(", "self", ",", "command", ")", ":", "pin", "=", "int", "(", "command", "[", "0", "]", ")", "data_val", "=", "await", "self", ".", "core", ".", "digital_read", "(", "pin", ")", "reply", "=", "json", ".", "dumps", "...
This method reads and returns the last reported value for a digital pin. Normally not used since digital pin updates will be provided automatically as they occur with the digital_message_reply being sent to the client after set_pin_mode is called.. (see enable_digital_reporting for message forma...
[ "This", "method", "reads", "and", "returns", "the", "last", "reported", "value", "for", "a", "digital", "pin", ".", "Normally", "not", "used", "since", "digital", "pin", "updates", "will", "be", "provided", "automatically", "as", "they", "occur", "with", "th...
python
train
53.5
Metatab/metapack
metapack/cli/index.py
https://github.com/Metatab/metapack/blob/8365f221fbeaa3c0be9091f2eaf3447fd8e2e8d6/metapack/cli/index.py#L223-L248
def dump_index(args, idx): """Create a metatab file for the index""" import csv import sys from metatab import MetatabDoc doc = MetatabDoc() pack_section = doc.new_section('Packages', ['Identifier', 'Name', 'Nvname', 'Version', 'Format']) r = doc['Root'] r.new_term('Root.Title', 'Pa...
[ "def", "dump_index", "(", "args", ",", "idx", ")", ":", "import", "csv", "import", "sys", "from", "metatab", "import", "MetatabDoc", "doc", "=", "MetatabDoc", "(", ")", "pack_section", "=", "doc", ".", "new_section", "(", "'Packages'", ",", "[", "'Identifi...
Create a metatab file for the index
[ "Create", "a", "metatab", "file", "for", "the", "index" ]
python
train
24.269231
anrosent/LT-code
lt/sampler.py
https://github.com/anrosent/LT-code/blob/e13a4c927effc90f9d41ab3884f9fcbd95b9450d/lt/sampler.py#L25-L32
def gen_tau(S, K, delta): """The Robust part of the RSD, we precompute an array for speed """ pivot = floor(K/S) return [S/K * 1/d for d in range(1, pivot)] \ + [S/K * log(S/delta)] \ + [0 for d in range(pivot, K)]
[ "def", "gen_tau", "(", "S", ",", "K", ",", "delta", ")", ":", "pivot", "=", "floor", "(", "K", "/", "S", ")", "return", "[", "S", "/", "K", "*", "1", "/", "d", "for", "d", "in", "range", "(", "1", ",", "pivot", ")", "]", "+", "[", "S", ...
The Robust part of the RSD, we precompute an array for speed
[ "The", "Robust", "part", "of", "the", "RSD", "we", "precompute", "an", "array", "for", "speed" ]
python
train
31.375
docker/docker-py
docker/models/volumes.py
https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/models/volumes.py#L14-L25
def remove(self, force=False): """ Remove this volume. Args: force (bool): Force removal of volumes that were already removed out of band by the volume driver plugin. Raises: :py:class:`docker.errors.APIError` If volume failed to r...
[ "def", "remove", "(", "self", ",", "force", "=", "False", ")", ":", "return", "self", ".", "client", ".", "api", ".", "remove_volume", "(", "self", ".", "id", ",", "force", "=", "force", ")" ]
Remove this volume. Args: force (bool): Force removal of volumes that were already removed out of band by the volume driver plugin. Raises: :py:class:`docker.errors.APIError` If volume failed to remove.
[ "Remove", "this", "volume", "." ]
python
train
32.833333
spyder-ide/spyder
spyder/config/gui.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/gui.py#L142-L147
def get_color_scheme(name): """Get syntax color scheme""" color_scheme = {} for key in sh.COLOR_SCHEME_KEYS: color_scheme[key] = CONF.get("appearance", "%s/%s" % (name, key)) return color_scheme
[ "def", "get_color_scheme", "(", "name", ")", ":", "color_scheme", "=", "{", "}", "for", "key", "in", "sh", ".", "COLOR_SCHEME_KEYS", ":", "color_scheme", "[", "key", "]", "=", "CONF", ".", "get", "(", "\"appearance\"", ",", "\"%s/%s\"", "%", "(", "name",...
Get syntax color scheme
[ "Get", "syntax", "color", "scheme" ]
python
train
35.5
maas/python-libmaas
maas/client/viscera/bcaches.py
https://github.com/maas/python-libmaas/blob/4092c68ef7fb1753efc843569848e2bcc3415002/maas/client/viscera/bcaches.py#L62-L65
async def delete(self): """Delete this Bcache.""" await self._handler.delete( system_id=self.node.system_id, id=self.id)
[ "async", "def", "delete", "(", "self", ")", ":", "await", "self", ".", "_handler", ".", "delete", "(", "system_id", "=", "self", ".", "node", ".", "system_id", ",", "id", "=", "self", ".", "id", ")" ]
Delete this Bcache.
[ "Delete", "this", "Bcache", "." ]
python
train
36.25
vtkiorg/vtki
vtki/container.py
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/container.py#L211-L216
def get_index_by_name(self, name): """Find the index number by block name""" for i in range(self.n_blocks): if self.get_block_name(i) == name: return i raise KeyError('Block name ({}) not found'.format(name))
[ "def", "get_index_by_name", "(", "self", ",", "name", ")", ":", "for", "i", "in", "range", "(", "self", ".", "n_blocks", ")", ":", "if", "self", ".", "get_block_name", "(", "i", ")", "==", "name", ":", "return", "i", "raise", "KeyError", "(", "'Block...
Find the index number by block name
[ "Find", "the", "index", "number", "by", "block", "name" ]
python
train
42.5
pypa/pipenv
pipenv/vendor/requests/sessions.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/sessions.py#L719-L731
def get_adapter(self, url): """ Returns the appropriate connection adapter for the given URL. :rtype: requests.adapters.BaseAdapter """ for (prefix, adapter) in self.adapters.items(): if url.lower().startswith(prefix.lower()): return adapter ...
[ "def", "get_adapter", "(", "self", ",", "url", ")", ":", "for", "(", "prefix", ",", "adapter", ")", "in", "self", ".", "adapters", ".", "items", "(", ")", ":", "if", "url", ".", "lower", "(", ")", ".", "startswith", "(", "prefix", ".", "lower", "...
Returns the appropriate connection adapter for the given URL. :rtype: requests.adapters.BaseAdapter
[ "Returns", "the", "appropriate", "connection", "adapter", "for", "the", "given", "URL", "." ]
python
train
31.538462
ergoithz/unicategories
unicategories/tools.py
https://github.com/ergoithz/unicategories/blob/70ade9fa3662ac3fc62fb2648a29a360a4d82025/unicategories/tools.py#L66-L81
def has(self, character): ''' Get if character (or character code point) is contained by any range on this range group. :param character: character or unicode code point to look for :type character: str or int :returns: True if character is contained by any range, False ...
[ "def", "has", "(", "self", ",", "character", ")", ":", "if", "not", "self", ":", "return", "False", "character", "=", "character", "if", "isinstance", "(", "character", ",", "int", ")", "else", "ord", "(", "character", ")", "last", "=", "self", "[", ...
Get if character (or character code point) is contained by any range on this range group. :param character: character or unicode code point to look for :type character: str or int :returns: True if character is contained by any range, False otherwise :rtype: bool
[ "Get", "if", "character", "(", "or", "character", "code", "point", ")", "is", "contained", "by", "any", "range", "on", "this", "range", "group", "." ]
python
train
38.5625
cloudant/python-cloudant
src/cloudant/_client_session.py
https://github.com/cloudant/python-cloudant/blob/e0ba190f6ba07fe3522a668747128214ad573c7e/src/cloudant/_client_session.py#L164-L184
def request(self, method, url, **kwargs): """ Overrides ``requests.Session.request`` to renew the cookie and then retry the original request (if required). """ resp = super(CookieSession, self).request(method, url, **kwargs) if not self._auto_renew: return re...
[ "def", "request", "(", "self", ",", "method", ",", "url", ",", "*", "*", "kwargs", ")", ":", "resp", "=", "super", "(", "CookieSession", ",", "self", ")", ".", "request", "(", "method", ",", "url", ",", "*", "*", "kwargs", ")", "if", "not", "self...
Overrides ``requests.Session.request`` to renew the cookie and then retry the original request (if required).
[ "Overrides", "requests", ".", "Session", ".", "request", "to", "renew", "the", "cookie", "and", "then", "retry", "the", "original", "request", "(", "if", "required", ")", "." ]
python
train
30.619048
pytest-dev/pluggy
pluggy/manager.py
https://github.com/pytest-dev/pluggy/blob/4de9e440eeadd9f0eb8c5232b349ef64e20e33fb/pluggy/manager.py#L158-L179
def add_hookspecs(self, module_or_class): """ add new hook specifications defined in the given module_or_class. Functions are recognized if they have been decorated accordingly. """ names = [] for name in dir(module_or_class): spec_opts = self.parse_hookspec_opts(module_or_cl...
[ "def", "add_hookspecs", "(", "self", ",", "module_or_class", ")", ":", "names", "=", "[", "]", "for", "name", "in", "dir", "(", "module_or_class", ")", ":", "spec_opts", "=", "self", ".", "parse_hookspec_opts", "(", "module_or_class", ",", "name", ")", "if...
add new hook specifications defined in the given module_or_class. Functions are recognized if they have been decorated accordingly.
[ "add", "new", "hook", "specifications", "defined", "in", "the", "given", "module_or_class", ".", "Functions", "are", "recognized", "if", "they", "have", "been", "decorated", "accordingly", "." ]
python
train
47.454545
Qiskit/qiskit-terra
qiskit/result/postprocess.py
https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/result/postprocess.py#L67-L83
def _list_to_complex_array(complex_list): """Convert nested list of shape (..., 2) to complex numpy array with shape (...) Args: complex_list (list): List to convert. Returns: np.ndarray: Complex numpy aray Raises: QiskitError: If inner most array of input nested list is not o...
[ "def", "_list_to_complex_array", "(", "complex_list", ")", ":", "arr", "=", "np", ".", "asarray", "(", "complex_list", ",", "dtype", "=", "np", ".", "complex_", ")", "if", "not", "arr", ".", "shape", "[", "-", "1", "]", "==", "2", ":", "raise", "Qisk...
Convert nested list of shape (..., 2) to complex numpy array with shape (...) Args: complex_list (list): List to convert. Returns: np.ndarray: Complex numpy aray Raises: QiskitError: If inner most array of input nested list is not of length 2.
[ "Convert", "nested", "list", "of", "shape", "(", "...", "2", ")", "to", "complex", "numpy", "array", "with", "shape", "(", "...", ")" ]
python
test
30.647059
user-cont/conu
conu/backend/origin/backend.py
https://github.com/user-cont/conu/blob/08caae7bb6bdd265b55bb106c3da6a7946a5a352/conu/backend/origin/backend.py#L318-L334
def all_pods_are_ready(self, app_name): """ Check if all pods are ready for specific app :param app_name: str, name of the app :return: bool """ app_pod_exists = False for pod in self.list_pods(namespace=self.project): if app_name in pod.name and 'buil...
[ "def", "all_pods_are_ready", "(", "self", ",", "app_name", ")", ":", "app_pod_exists", "=", "False", "for", "pod", "in", "self", ".", "list_pods", "(", "namespace", "=", "self", ".", "project", ")", ":", "if", "app_name", "in", "pod", ".", "name", "and",...
Check if all pods are ready for specific app :param app_name: str, name of the app :return: bool
[ "Check", "if", "all", "pods", "are", "ready", "for", "specific", "app", ":", "param", "app_name", ":", "str", "name", "of", "the", "app", ":", "return", ":", "bool" ]
python
train
34.235294
spacetelescope/synphot_refactor
synphot/spectrum.py
https://github.com/spacetelescope/synphot_refactor/blob/9c064f3cff0c41dd8acadc0f67c6350931275b9f/synphot/spectrum.py#L579-L606
def force_extrapolation(self): """Force the underlying model to extrapolate. An example where this is useful: You create a source spectrum with non-default extrapolation behavior and you wish to force the underlying empirical model to extrapolate based on nearest point. .. note...
[ "def", "force_extrapolation", "(", "self", ")", ":", "# We use _model here in case the spectrum is redshifted.", "if", "isinstance", "(", "self", ".", "_model", ",", "Empirical1D", ")", ":", "self", ".", "_model", ".", "fill_value", "=", "np", ".", "nan", "is_forc...
Force the underlying model to extrapolate. An example where this is useful: You create a source spectrum with non-default extrapolation behavior and you wish to force the underlying empirical model to extrapolate based on nearest point. .. note:: This is only applicable to...
[ "Force", "the", "underlying", "model", "to", "extrapolate", "." ]
python
train
31.964286
ic-labs/django-icekit
icekit_events/forms.py
https://github.com/ic-labs/django-icekit/blob/c507ea5b1864303732c53ad7c5800571fca5fa94/icekit_events/forms.py#L99-L125
def render(self, name, value, attrs=None): """ Render the ``icekit_events/recurrence_rule_widget/render.html`` template with the following context: rendered_widgets The rendered widgets. id The ``id`` attribute from the ``attrs`` keyword a...
[ "def", "render", "(", "self", ",", "name", ",", "value", ",", "attrs", "=", "None", ")", ":", "rendered_widgets", "=", "super", "(", "RecurrenceRuleWidget", ",", "self", ")", ".", "render", "(", "name", ",", "value", ",", "attrs", ")", "template", "=",...
Render the ``icekit_events/recurrence_rule_widget/render.html`` template with the following context: rendered_widgets The rendered widgets. id The ``id`` attribute from the ``attrs`` keyword argument. recurrence_rules A JSON ob...
[ "Render", "the", "icekit_events", "/", "recurrence_rule_widget", "/", "render", ".", "html", "template", "with", "the", "following", "context", ":" ]
python
train
40.333333
specialunderwear/django-easymode
easymode/utils/languagecode.py
https://github.com/specialunderwear/django-easymode/blob/92f674b91fb8c54d6e379e2664e2000872d9c95e/easymode/utils/languagecode.py#L47-L65
def get_all_language_codes(): """ Returns all language codes defined in settings.LANGUAGES and also the settings.MSGID_LANGUAGE if defined. >>> from django.conf import settings >>> settings.MSGID_LANGUAGE = 'en-us' >>> settings.LANGUAGES = (('en','English'),('de','German'),('nl-be','Belgium...
[ "def", "get_all_language_codes", "(", ")", ":", "languages", "=", "get_language_codes", "(", ")", "if", "hasattr", "(", "settings", ",", "'MSGID_LANGUAGE'", ")", ":", "if", "not", "settings", ".", "MSGID_LANGUAGE", "in", "languages", ":", "languages", ".", "in...
Returns all language codes defined in settings.LANGUAGES and also the settings.MSGID_LANGUAGE if defined. >>> from django.conf import settings >>> settings.MSGID_LANGUAGE = 'en-us' >>> settings.LANGUAGES = (('en','English'),('de','German'),('nl-be','Belgium dutch'),('fr-be','Belgium french'),) ...
[ "Returns", "all", "language", "codes", "defined", "in", "settings", ".", "LANGUAGES", "and", "also", "the", "settings", ".", "MSGID_LANGUAGE", "if", "defined", ".", ">>>", "from", "django", ".", "conf", "import", "settings", ">>>", "settings", ".", "MSGID_LANG...
python
train
37.105263
ClericPy/torequests
torequests/utils.py
https://github.com/ClericPy/torequests/blob/1793261688d7a47e1c3a0830d83f8552f5e3e5d9/torequests/utils.py#L887-L894
def tick(self): """Return the time cost string as expect.""" string = self.passed if self.rounding: string = round(string) if self.readable: string = self.readable(string) return string
[ "def", "tick", "(", "self", ")", ":", "string", "=", "self", ".", "passed", "if", "self", ".", "rounding", ":", "string", "=", "round", "(", "string", ")", "if", "self", ".", "readable", ":", "string", "=", "self", ".", "readable", "(", "string", "...
Return the time cost string as expect.
[ "Return", "the", "time", "cost", "string", "as", "expect", "." ]
python
train
30.25
galaxyproject/pulsar
pulsar/client/staging/__init__.py
https://github.com/galaxyproject/pulsar/blob/9ab6683802884324652da0a9f0808c7eb59d3ab4/pulsar/client/staging/__init__.py#L185-L196
def output_extras(self, output_file): """ Returns dict mapping local path to remote name. """ output_directory = dirname(output_file) def local_path(name): return join(output_directory, self.path_helper.local_name(name)) files_directory = "%s_files%s" % (bas...
[ "def", "output_extras", "(", "self", ",", "output_file", ")", ":", "output_directory", "=", "dirname", "(", "output_file", ")", "def", "local_path", "(", "name", ")", ":", "return", "join", "(", "output_directory", ",", "self", ".", "path_helper", ".", "loca...
Returns dict mapping local path to remote name.
[ "Returns", "dict", "mapping", "local", "path", "to", "remote", "name", "." ]
python
train
44.916667
axialmarket/fsq
libexec/fsq/push.py
https://github.com/axialmarket/fsq/blob/43b84c292cb8a187599d86753b947cf73248f989/libexec/fsq/push.py#L26-L41
def usage(asked_for=0): '''Exit with a usage string, used for bad argument or with -h''' exit = fsq.const('FSQ_SUCCESS') if asked_for else\ fsq.const('FSQ_FAIL_PERM') f = sys.stdout if asked_for else sys.stderr shout('{0} [opts] src_queue trg_queue host item_id [item_id [...]]'.format( ...
[ "def", "usage", "(", "asked_for", "=", "0", ")", ":", "exit", "=", "fsq", ".", "const", "(", "'FSQ_SUCCESS'", ")", "if", "asked_for", "else", "fsq", ".", "const", "(", "'FSQ_FAIL_PERM'", ")", "f", "=", "sys", ".", "stdout", "if", "asked_for", "else", ...
Exit with a usage string, used for bad argument or with -h
[ "Exit", "with", "a", "usage", "string", "used", "for", "bad", "argument", "or", "with", "-", "h" ]
python
train
52.5
tanghaibao/goatools
goatools/obo_parser.py
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/obo_parser.py#L237-L243
def get_all_parent_edges(self): """Return tuples for all parent GO IDs, containing current GO ID and parent GO ID.""" all_parent_edges = set() for parent in self.parents: all_parent_edges.add((self.item_id, parent.item_id)) all_parent_edges |= parent.get_all_parent_edges(...
[ "def", "get_all_parent_edges", "(", "self", ")", ":", "all_parent_edges", "=", "set", "(", ")", "for", "parent", "in", "self", ".", "parents", ":", "all_parent_edges", ".", "add", "(", "(", "self", ".", "item_id", ",", "parent", ".", "item_id", ")", ")",...
Return tuples for all parent GO IDs, containing current GO ID and parent GO ID.
[ "Return", "tuples", "for", "all", "parent", "GO", "IDs", "containing", "current", "GO", "ID", "and", "parent", "GO", "ID", "." ]
python
train
49.571429
gitpython-developers/GitPython
git/util.py
https://github.com/gitpython-developers/GitPython/blob/1f66e25c25cde2423917ee18c4704fff83b837d1/git/util.py#L619-L627
def committer(cls, config_reader=None): """ :return: Actor instance corresponding to the configured committer. It behaves similar to the git implementation, such that the environment will override configuration values of config_reader. If no value is set at all, it will be ...
[ "def", "committer", "(", "cls", ",", "config_reader", "=", "None", ")", ":", "return", "cls", ".", "_main_actor", "(", "cls", ".", "env_committer_name", ",", "cls", ".", "env_committer_email", ",", "config_reader", ")" ]
:return: Actor instance corresponding to the configured committer. It behaves similar to the git implementation, such that the environment will override configuration values of config_reader. If no value is set at all, it will be generated :param config_reader: ConfigReader t...
[ ":", "return", ":", "Actor", "instance", "corresponding", "to", "the", "configured", "committer", ".", "It", "behaves", "similar", "to", "the", "git", "implementation", "such", "that", "the", "environment", "will", "override", "configuration", "values", "of", "c...
python
train
62.111111
saltstack/salt
salt/modules/salt_version.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/salt_version.py#L151-L170
def _check_release_cmp(name): ''' Helper function to compare release codename versions to the minion's current Salt version. If release codename isn't found, the function returns None. Otherwise, it returns the results of the version comparison as documented by the ``versions_cmp`` function in ...
[ "def", "_check_release_cmp", "(", "name", ")", ":", "map_version", "=", "get_release_number", "(", "name", ")", "if", "map_version", "is", "None", ":", "log", ".", "info", "(", "'Release codename %s was not found.'", ",", "name", ")", "return", "None", "current_...
Helper function to compare release codename versions to the minion's current Salt version. If release codename isn't found, the function returns None. Otherwise, it returns the results of the version comparison as documented by the ``versions_cmp`` function in ``salt.utils.versions.py``.
[ "Helper", "function", "to", "compare", "release", "codename", "versions", "to", "the", "minion", "s", "current", "Salt", "version", "." ]
python
train
37.85
cisco-sas/kitty
kitty/model/low_level/container.py
https://github.com/cisco-sas/kitty/blob/cb0760989dcdfe079e43ac574d872d0b18953a32/kitty/model/low_level/container.py#L964-L969
def reset(self): ''' Reset the state of the container and its internal fields ''' super(TakeFrom, self).reset() self.random.seed(self.seed * self.max_elements + self.min_elements)
[ "def", "reset", "(", "self", ")", ":", "super", "(", "TakeFrom", ",", "self", ")", ".", "reset", "(", ")", "self", ".", "random", ".", "seed", "(", "self", ".", "seed", "*", "self", ".", "max_elements", "+", "self", ".", "min_elements", ")" ]
Reset the state of the container and its internal fields
[ "Reset", "the", "state", "of", "the", "container", "and", "its", "internal", "fields" ]
python
train
35.666667
inveniosoftware/invenio-deposit
invenio_deposit/serializers.py
https://github.com/inveniosoftware/invenio-deposit/blob/f243ea1d01ab0a3bc92ade3262d1abdd2bc32447/invenio_deposit/serializers.py#L32-L48
def json_serializer(pid, data, *args): """Build a JSON Flask response using the given data. :param pid: The `invenio_pidstore.models.PersistentIdentifier` of the record. :param data: The record metadata. :returns: A Flask response with JSON data. :rtype: :py:class:`flask.Response`. """ ...
[ "def", "json_serializer", "(", "pid", ",", "data", ",", "*", "args", ")", ":", "if", "data", "is", "not", "None", ":", "response", "=", "Response", "(", "json", ".", "dumps", "(", "data", ".", "dumps", "(", ")", ")", ",", "mimetype", "=", "'applica...
Build a JSON Flask response using the given data. :param pid: The `invenio_pidstore.models.PersistentIdentifier` of the record. :param data: The record metadata. :returns: A Flask response with JSON data. :rtype: :py:class:`flask.Response`.
[ "Build", "a", "JSON", "Flask", "response", "using", "the", "given", "data", "." ]
python
valid
31.294118
coded-by-hand/mass
env/lib/python2.7/site-packages/pip-1.0.2-py2.7.egg/pip/download.py
https://github.com/coded-by-hand/mass/blob/59005479efed3cd8598a8f0c66791a4482071899/env/lib/python2.7/site-packages/pip-1.0.2-py2.7.egg/pip/download.py#L255-L276
def geturl(urllib2_resp): """ Use instead of urllib.addinfourl.geturl(), which appears to have some issues with dropping the double slash for certain schemes (e.g. file://). This implementation is probably over-eager, as it always restores '://' if it is missing, and it appears some url schemat...
[ "def", "geturl", "(", "urllib2_resp", ")", ":", "url", "=", "urllib2_resp", ".", "geturl", "(", ")", "scheme", ",", "rest", "=", "url", ".", "split", "(", "':'", ",", "1", ")", "if", "rest", ".", "startswith", "(", "'//'", ")", ":", "return", "url"...
Use instead of urllib.addinfourl.geturl(), which appears to have some issues with dropping the double slash for certain schemes (e.g. file://). This implementation is probably over-eager, as it always restores '://' if it is missing, and it appears some url schemata aren't always followed by '//' after...
[ "Use", "instead", "of", "urllib", ".", "addinfourl", ".", "geturl", "()", "which", "appears", "to", "have", "some", "issues", "with", "dropping", "the", "double", "slash", "for", "certain", "schemes", "(", "e", ".", "g", ".", "file", ":", "//", ")", "....
python
train
36.272727
ray-project/ray
python/ray/rllib/agents/impala/vtrace.py
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/rllib/agents/impala/vtrace.py#L389-L395
def get_log_rhos(target_action_log_probs, behaviour_action_log_probs): """With the selected log_probs for multi-discrete actions of behaviour and target policies we compute the log_rhos for calculating the vtrace.""" t = tf.stack(target_action_log_probs) b = tf.stack(behaviour_action_log_probs) log_...
[ "def", "get_log_rhos", "(", "target_action_log_probs", ",", "behaviour_action_log_probs", ")", ":", "t", "=", "tf", ".", "stack", "(", "target_action_log_probs", ")", "b", "=", "tf", ".", "stack", "(", "behaviour_action_log_probs", ")", "log_rhos", "=", "tf", "....
With the selected log_probs for multi-discrete actions of behaviour and target policies we compute the log_rhos for calculating the vtrace.
[ "With", "the", "selected", "log_probs", "for", "multi", "-", "discrete", "actions", "of", "behaviour", "and", "target", "policies", "we", "compute", "the", "log_rhos", "for", "calculating", "the", "vtrace", "." ]
python
train
52.714286
chrisspen/burlap
burlap/common.py
https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L981-L988
def local_renderer(self): """ Retrieves the cached local renderer. """ if not self._local_renderer: r = self.create_local_renderer() self._local_renderer = r return self._local_renderer
[ "def", "local_renderer", "(", "self", ")", ":", "if", "not", "self", ".", "_local_renderer", ":", "r", "=", "self", ".", "create_local_renderer", "(", ")", "self", ".", "_local_renderer", "=", "r", "return", "self", ".", "_local_renderer" ]
Retrieves the cached local renderer.
[ "Retrieves", "the", "cached", "local", "renderer", "." ]
python
valid
30.25
brocade/pynos
pynos/versions/base/yang/brocade_sflow.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/base/yang/brocade_sflow.py#L83-L92
def sflow_profile_profile_name(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") sflow_profile = ET.SubElement(config, "sflow-profile", xmlns="urn:brocade.com:mgmt:brocade-sflow") profile_name = ET.SubElement(sflow_profile, "profile-name") profile_...
[ "def", "sflow_profile_profile_name", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "sflow_profile", "=", "ET", ".", "SubElement", "(", "config", ",", "\"sflow-profile\"", ",", "xmlns", "=", "\"...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
44
Clinical-Genomics/scout
scout/adapter/mongo/query.py
https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/query.py#L301-L331
def gene_filter(self, query, mongo_query): """ Adds gene-related filters to the query object Args: query(dict): a dictionary of query filters specified by the users mongo_query(dict): the query that is going to be submitted to the database Returns: mongo_que...
[ "def", "gene_filter", "(", "self", ",", "query", ",", "mongo_query", ")", ":", "LOG", ".", "debug", "(", "'Adding panel and genes-related parameters to the query'", ")", "gene_query", "=", "[", "]", "if", "query", ".", "get", "(", "'hgnc_symbols'", ")", "and", ...
Adds gene-related filters to the query object Args: query(dict): a dictionary of query filters specified by the users mongo_query(dict): the query that is going to be submitted to the database Returns: mongo_query(dict): returned object contains gene and panel-relat...
[ "Adds", "gene", "-", "related", "filters", "to", "the", "query", "object" ]
python
test
38.935484
dnanexus/dx-toolkit
src/python/dxpy/bindings/dxdataobject_functions.py
https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxdataobject_functions.py#L176-L229
def describe(id_or_link, **kwargs): ''' :param id_or_link: String containing an object ID or dict containing a DXLink, or a list of object IDs or dicts containing a DXLink. Given an object ID, calls :meth:`~dxpy.bindings.DXDataObject.describe` on the object. Example:: d...
[ "def", "describe", "(", "id_or_link", ",", "*", "*", "kwargs", ")", ":", "# If this is a list, extract the ids.", "# TODO: modify the procedure to use project ID when possible", "if", "isinstance", "(", "id_or_link", ",", "basestring", ")", "or", "is_dxlink", "(", "id_or_...
:param id_or_link: String containing an object ID or dict containing a DXLink, or a list of object IDs or dicts containing a DXLink. Given an object ID, calls :meth:`~dxpy.bindings.DXDataObject.describe` on the object. Example:: describe("file-1234") Given a list of object...
[ ":", "param", "id_or_link", ":", "String", "containing", "an", "object", "ID", "or", "dict", "containing", "a", "DXLink", "or", "a", "list", "of", "object", "IDs", "or", "dicts", "containing", "a", "DXLink", "." ]
python
train
46.037037
PyGithub/PyGithub
github/Project.py
https://github.com/PyGithub/PyGithub/blob/f716df86bbe7dc276c6596699fa9712b61ef974c/github/Project.py#L160-L174
def create_column(self, name): """ calls: `POST https://developer.github.com/v3/projects/columns/#create-a-project-column>`_ :param name: string """ assert isinstance(name, (str, unicode)), name post_parameters = {"name": name} import_header = {"Accept": Consts.me...
[ "def", "create_column", "(", "self", ",", "name", ")", ":", "assert", "isinstance", "(", "name", ",", "(", "str", ",", "unicode", ")", ")", ",", "name", "post_parameters", "=", "{", "\"name\"", ":", "name", "}", "import_header", "=", "{", "\"Accept\"", ...
calls: `POST https://developer.github.com/v3/projects/columns/#create-a-project-column>`_ :param name: string
[ "calls", ":", "POST", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "projects", "/", "columns", "/", "#create", "-", "a", "-", "project", "-", "column", ">", "_", ":", "param", "name", ":", "string" ]
python
train
41.466667
aws/aws-xray-sdk-python
aws_xray_sdk/core/recorder.py
https://github.com/aws/aws-xray-sdk-python/blob/707358cd3a516d51f2ebf71cf34f00e8d906a667/aws_xray_sdk/core/recorder.py#L383-L392
def stream_subsegments(self): """ Stream all closed subsegments to the daemon and remove reference to the parent segment. No-op for a not sampled segment. """ segment = self.current_segment() if self.streaming.is_eligible(segment): self.streaming.stre...
[ "def", "stream_subsegments", "(", "self", ")", ":", "segment", "=", "self", ".", "current_segment", "(", ")", "if", "self", ".", "streaming", ".", "is_eligible", "(", "segment", ")", ":", "self", ".", "streaming", ".", "stream", "(", "segment", ",", "sel...
Stream all closed subsegments to the daemon and remove reference to the parent segment. No-op for a not sampled segment.
[ "Stream", "all", "closed", "subsegments", "to", "the", "daemon", "and", "remove", "reference", "to", "the", "parent", "segment", ".", "No", "-", "op", "for", "a", "not", "sampled", "segment", "." ]
python
train
35.1