repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
wmayner/pyphi
pyphi/subsystem.py
https://github.com/wmayner/pyphi/blob/deeca69a084d782a6fde7bf26f59e93b593c5d77/pyphi/subsystem.py#L500-L506
def cause_effect_info(self, mechanism, purview): """Return the cause-effect information for a mechanism over a purview. This is the minimum of the cause and effect information. """ return min(self.cause_info(mechanism, purview), self.effect_info(mechanism, purview))
[ "def", "cause_effect_info", "(", "self", ",", "mechanism", ",", "purview", ")", ":", "return", "min", "(", "self", ".", "cause_info", "(", "mechanism", ",", "purview", ")", ",", "self", ".", "effect_info", "(", "mechanism", ",", "purview", ")", ")" ]
Return the cause-effect information for a mechanism over a purview. This is the minimum of the cause and effect information.
[ "Return", "the", "cause", "-", "effect", "information", "for", "a", "mechanism", "over", "a", "purview", "." ]
python
train
jobovy/galpy
galpy/util/bovy_coords.py
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/util/bovy_coords.py#L2137-L2179
def lambdanu_to_Rz(l,n,ac=5.,Delta=1.): """ NAME: lambdanu_to_Rz PURPOSE: calculate galactocentric cylindrical coordinates (R,z) from prolate spheroidal coordinates (lambda,nu), cf. eq. (2.2) in Dejonghe & de Zeeuw (1988a) INPUT: l - prolate spheroidal co...
[ "def", "lambdanu_to_Rz", "(", "l", ",", "n", ",", "ac", "=", "5.", ",", "Delta", "=", "1.", ")", ":", "g", "=", "Delta", "**", "2", "/", "(", "1.", "-", "ac", "**", "2", ")", "a", "=", "g", "-", "Delta", "**", "2", "r2", "=", "(", "l", ...
NAME: lambdanu_to_Rz PURPOSE: calculate galactocentric cylindrical coordinates (R,z) from prolate spheroidal coordinates (lambda,nu), cf. eq. (2.2) in Dejonghe & de Zeeuw (1988a) INPUT: l - prolate spheroidal coordinate lambda n - prolate spheroidal c...
[ "NAME", ":" ]
python
train
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/window.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/window.py#L606-L620
def hide(self, bAsync = True): """ Make the window invisible. @see: L{show} @type bAsync: bool @param bAsync: Perform the request asynchronously. @raise WindowsError: An error occured while processing this request. """ if bAsync: win32.Show...
[ "def", "hide", "(", "self", ",", "bAsync", "=", "True", ")", ":", "if", "bAsync", ":", "win32", ".", "ShowWindowAsync", "(", "self", ".", "get_handle", "(", ")", ",", "win32", ".", "SW_HIDE", ")", "else", ":", "win32", ".", "ShowWindow", "(", "self",...
Make the window invisible. @see: L{show} @type bAsync: bool @param bAsync: Perform the request asynchronously. @raise WindowsError: An error occured while processing this request.
[ "Make", "the", "window", "invisible", "." ]
python
train
tornadoweb/tornado
tornado/web.py
https://github.com/tornadoweb/tornado/blob/b8b481770bcdb333a69afde5cce7eaa449128326/tornado/web.py#L1162-L1175
def detach(self) -> iostream.IOStream: """Take control of the underlying stream. Returns the underlying `.IOStream` object and stops all further HTTP processing. Intended for implementing protocols like websockets that tunnel over an HTTP handshake. This method is only supporte...
[ "def", "detach", "(", "self", ")", "->", "iostream", ".", "IOStream", ":", "self", ".", "_finished", "=", "True", "# TODO: add detach to HTTPConnection?", "return", "self", ".", "request", ".", "connection", ".", "detach", "(", ")" ]
Take control of the underlying stream. Returns the underlying `.IOStream` object and stops all further HTTP processing. Intended for implementing protocols like websockets that tunnel over an HTTP handshake. This method is only supported when HTTP/1.1 is used. .. versionadded:...
[ "Take", "control", "of", "the", "underlying", "stream", "." ]
python
train
inasafe/inasafe
safe/gis/raster/contour.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gis/raster/contour.py#L276-L339
def smooth_shakemap( shakemap_layer_path, output_file_path='', active_band=1, smoothing_method=NUMPY_SMOOTHING, smoothing_sigma=0.9): """Make a smoother shakemap layer from a shake map. :param shakemap_layer_path: The shake map raster layer path. :type shakemap_layer...
[ "def", "smooth_shakemap", "(", "shakemap_layer_path", ",", "output_file_path", "=", "''", ",", "active_band", "=", "1", ",", "smoothing_method", "=", "NUMPY_SMOOTHING", ",", "smoothing_sigma", "=", "0.9", ")", ":", "# Set output path", "if", "not", "output_file_path...
Make a smoother shakemap layer from a shake map. :param shakemap_layer_path: The shake map raster layer path. :type shakemap_layer_path: basestring :param active_band: The band which the data located, default to 1. :type active_band: int :param smoothing_method: The smoothing method that wanted t...
[ "Make", "a", "smoother", "shakemap", "layer", "from", "a", "shake", "map", "." ]
python
train
tweepy/tweepy
tweepy/cache.py
https://github.com/tweepy/tweepy/blob/cc3894073905811c4d9fd816202f93454ed932da/tweepy/cache.py#L378-L386
def cleanup(self): """Cleanup all the expired keys""" keys = self.client.smembers(self.keys_container) for key in keys: entry = self.client.get(key) if entry: entry = pickle.loads(entry) if self._is_expired(entry, self.timeout): ...
[ "def", "cleanup", "(", "self", ")", ":", "keys", "=", "self", ".", "client", ".", "smembers", "(", "self", ".", "keys_container", ")", "for", "key", "in", "keys", ":", "entry", "=", "self", ".", "client", ".", "get", "(", "key", ")", "if", "entry",...
Cleanup all the expired keys
[ "Cleanup", "all", "the", "expired", "keys" ]
python
train
google/pyringe
pyringe/payload/libpython.py
https://github.com/google/pyringe/blob/76dff5d1ac29cd5e7bf32677654a83291a15ad8a/pyringe/payload/libpython.py#L592-L611
def addr2line(self, addrq): ''' Get the line number for a given bytecode offset Analogous to PyCode_Addr2Line; translated from pseudocode in Objects/lnotab_notes.txt ''' co_lnotab = self.pyop_field('co_lnotab').proxyval(set()) # Initialize lineno to co_firstline...
[ "def", "addr2line", "(", "self", ",", "addrq", ")", ":", "co_lnotab", "=", "self", ".", "pyop_field", "(", "'co_lnotab'", ")", ".", "proxyval", "(", "set", "(", ")", ")", "# Initialize lineno to co_firstlineno as per PyCode_Addr2Line", "# not 0, as lnotab_notes.txt ha...
Get the line number for a given bytecode offset Analogous to PyCode_Addr2Line; translated from pseudocode in Objects/lnotab_notes.txt
[ "Get", "the", "line", "number", "for", "a", "given", "bytecode", "offset" ]
python
train
draperjames/qtpandas
qtpandas/ui/fallback/easygui/boxes/derived_boxes.py
https://github.com/draperjames/qtpandas/blob/64294fb69f1839e53dee5ea453337266bfaf24f4/qtpandas/ui/fallback/easygui/boxes/derived_boxes.py#L122-L160
def boolbox(msg="Shall I continue?", title=" ", choices=("[Y]es", "[N]o"), image=None, default_choice='Yes', cancel_choice='No'): """ Display a boolean msgbox. The returned value is calculated this way:: if the first choice is chosen, or if the dialog is cancelled: ...
[ "def", "boolbox", "(", "msg", "=", "\"Shall I continue?\"", ",", "title", "=", "\" \"", ",", "choices", "=", "(", "\"[Y]es\"", ",", "\"[N]o\"", ")", ",", "image", "=", "None", ",", "default_choice", "=", "'Yes'", ",", "cancel_choice", "=", "'No'", ")", "...
Display a boolean msgbox. The returned value is calculated this way:: if the first choice is chosen, or if the dialog is cancelled: returns True else: returns False :param str msg: the msg to be displayed :param str title: the window title :param list choices: ...
[ "Display", "a", "boolean", "msgbox", "." ]
python
train
git-afsantos/bonsai
bonsai/cpp/clang_parser.py
https://github.com/git-afsantos/bonsai/blob/aa5af3f535b3b506bfc95c107c501fc9c4bcd072/bonsai/cpp/clang_parser.py#L565-L609
def _build_for_statement(self): """NOTE: this is not a complete implementation of for loop parsing. Turns out for loops allow a number of wacky things going on, such as declaring a variable in place of a condition. These more peculiar cases are not covered. See ht...
[ "def", "_build_for_statement", "(", "self", ")", ":", "cppobj", "=", "CppLoop", "(", "self", ".", "scope", ",", "self", ".", "parent", ",", "\"for\"", ")", "cppobj", ".", "file", "=", "self", ".", "file", "cppobj", ".", "line", "=", "self", ".", "lin...
NOTE: this is not a complete implementation of for loop parsing. Turns out for loops allow a number of wacky things going on, such as declaring a variable in place of a condition. These more peculiar cases are not covered. See http://en.cppreference.com/w/cpp/language/for
[ "NOTE", ":", "this", "is", "not", "a", "complete", "implementation", "of", "for", "loop", "parsing", ".", "Turns", "out", "for", "loops", "allow", "a", "number", "of", "wacky", "things", "going", "on", "such", "as", "declaring", "a", "variable", "in", "p...
python
train
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/position_model/future_position.py#L329-L333
def sell_avg_holding_price(self): """ [float] 卖方向持仓均价 """ return 0 if self.sell_quantity == 0 else self._sell_holding_cost / self.sell_quantity / self.contract_multiplier
[ "def", "sell_avg_holding_price", "(", "self", ")", ":", "return", "0", "if", "self", ".", "sell_quantity", "==", "0", "else", "self", ".", "_sell_holding_cost", "/", "self", ".", "sell_quantity", "/", "self", ".", "contract_multiplier" ]
[float] 卖方向持仓均价
[ "[", "float", "]", "卖方向持仓均价" ]
python
train
xapple/plumbing
plumbing/common.py
https://github.com/xapple/plumbing/blob/4a7706c7722f5996d0ca366f191aff9ac145880a/plumbing/common.py#L448-L458
def reversed_lines(path): """Generate the lines of file in reverse order.""" with open(path, 'r') as handle: part = '' for block in reversed_blocks(handle): for c in reversed(block): if c == '\n' and part: yield part[::-1] part ...
[ "def", "reversed_lines", "(", "path", ")", ":", "with", "open", "(", "path", ",", "'r'", ")", "as", "handle", ":", "part", "=", "''", "for", "block", "in", "reversed_blocks", "(", "handle", ")", ":", "for", "c", "in", "reversed", "(", "block", ")", ...
Generate the lines of file in reverse order.
[ "Generate", "the", "lines", "of", "file", "in", "reverse", "order", "." ]
python
train
heikomuller/sco-datastore
scodata/__init__.py
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/__init__.py#L429-L463
def experiments_predictions_create(self, experiment_id, model_id, argument_defs, name, arguments=None, properties=None): """Create new model run for given experiment. Parameters ---------- experiment_id : string Unique experiment identifier model_id : string ...
[ "def", "experiments_predictions_create", "(", "self", ",", "experiment_id", ",", "model_id", ",", "argument_defs", ",", "name", ",", "arguments", "=", "None", ",", "properties", "=", "None", ")", ":", "# Get experiment to ensure that it exists", "if", "self", ".", ...
Create new model run for given experiment. Parameters ---------- experiment_id : string Unique experiment identifier model_id : string Unique identifier of model to run name : string User-provided name for the model run argument_defs :...
[ "Create", "new", "model", "run", "for", "given", "experiment", "." ]
python
train
numenta/nupic
src/nupic/swarming/permutations_runner.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/permutations_runner.py#L618-L635
def _launchWorkers(self, cmdLine, numWorkers): """ Launch worker processes to execute the given command line Parameters: ----------------------------------------------- cmdLine: The command line for each worker numWorkers: number of workers to launch """ self._workers = [] for i in ran...
[ "def", "_launchWorkers", "(", "self", ",", "cmdLine", ",", "numWorkers", ")", ":", "self", ".", "_workers", "=", "[", "]", "for", "i", "in", "range", "(", "numWorkers", ")", ":", "stdout", "=", "tempfile", ".", "NamedTemporaryFile", "(", "delete", "=", ...
Launch worker processes to execute the given command line Parameters: ----------------------------------------------- cmdLine: The command line for each worker numWorkers: number of workers to launch
[ "Launch", "worker", "processes", "to", "execute", "the", "given", "command", "line" ]
python
valid
pymacaron/pymacaron
pymacaron/__init__.py
https://github.com/pymacaron/pymacaron/blob/af244f203f8216108b39d374d46bf8e1813f13d5/pymacaron/__init__.py#L53-L81
def load_clients(self, path=None, apis=[]): """Generate client libraries for the given apis, without starting an api server""" if not path: raise Exception("Missing path to api swagger files") if type(apis) is not list: raise Exception("'apis' should be a list o...
[ "def", "load_clients", "(", "self", ",", "path", "=", "None", ",", "apis", "=", "[", "]", ")", ":", "if", "not", "path", ":", "raise", "Exception", "(", "\"Missing path to api swagger files\"", ")", "if", "type", "(", "apis", ")", "is", "not", "list", ...
Generate client libraries for the given apis, without starting an api server
[ "Generate", "client", "libraries", "for", "the", "given", "apis", "without", "starting", "an", "api", "server" ]
python
train
MycroftAI/mycroft-skills-manager
msm/mycroft_skills_manager.py
https://github.com/MycroftAI/mycroft-skills-manager/blob/5acef240de42e8ceae2e82bc7492ffee33288b00/msm/mycroft_skills_manager.py#L240-L258
def apply(self, func, skills): """Run a function on all skills in parallel""" def run_item(skill): try: func(skill) return True except MsmException as e: LOG.error('Error running {} on {}: {}'.format( func.__nam...
[ "def", "apply", "(", "self", ",", "func", ",", "skills", ")", ":", "def", "run_item", "(", "skill", ")", ":", "try", ":", "func", "(", "skill", ")", "return", "True", "except", "MsmException", "as", "e", ":", "LOG", ".", "error", "(", "'Error running...
Run a function on all skills in parallel
[ "Run", "a", "function", "on", "all", "skills", "in", "parallel" ]
python
train
dnanexus/dx-toolkit
src/python/dxpy/scripts/dx_build_app.py
https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/scripts/dx_build_app.py#L225-L242
def _check_syntax(code, lang, temp_dir, enforce=True): """ Checks that the code whose text is in CODE parses as LANG. Raises DXSyntaxError if there is a problem and "enforce" is True. """ # This function needs the language to be explicitly set, so we can # generate an appropriate temp filename....
[ "def", "_check_syntax", "(", "code", ",", "lang", ",", "temp_dir", ",", "enforce", "=", "True", ")", ":", "# This function needs the language to be explicitly set, so we can", "# generate an appropriate temp filename.", "if", "lang", "==", "'python2.7'", ":", "temp_basename...
Checks that the code whose text is in CODE parses as LANG. Raises DXSyntaxError if there is a problem and "enforce" is True.
[ "Checks", "that", "the", "code", "whose", "text", "is", "in", "CODE", "parses", "as", "LANG", "." ]
python
train
pypa/pipenv
pipenv/vendor/requests/sessions.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/sessions.py#L690-L717
def merge_environment_settings(self, url, proxies, stream, verify, cert): """ Check the environment and merge it with some settings. :rtype: dict """ # Gather clues from the surrounding environment. if self.trust_env: # Set environment's proxies. ...
[ "def", "merge_environment_settings", "(", "self", ",", "url", ",", "proxies", ",", "stream", ",", "verify", ",", "cert", ")", ":", "# Gather clues from the surrounding environment.", "if", "self", ".", "trust_env", ":", "# Set environment's proxies.", "no_proxy", "=",...
Check the environment and merge it with some settings. :rtype: dict
[ "Check", "the", "environment", "and", "merge", "it", "with", "some", "settings", "." ]
python
train
saltstack/salt
salt/states/trafficserver.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/trafficserver.py#L136-L160
def restart_cluster(name): ''' Restart the traffic_manager process and the traffic_server process on all the nodes in a cluster. .. code-block:: bash restart_ats_cluster: trafficserver.restart_cluster ''' ret = {'name': name, 'changes': {}, 'result': No...
[ "def", "restart_cluster", "(", "name", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "None", ",", "'comment'", ":", "''", "}", "if", "__opts__", "[", "'test'", "]", ":", "ret", "[", "'comme...
Restart the traffic_manager process and the traffic_server process on all the nodes in a cluster. .. code-block:: bash restart_ats_cluster: trafficserver.restart_cluster
[ "Restart", "the", "traffic_manager", "process", "and", "the", "traffic_server", "process", "on", "all", "the", "nodes", "in", "a", "cluster", "." ]
python
train
ionelmc/python-cogen
cogen/core/schedulers.py
https://github.com/ionelmc/python-cogen/blob/83b0edb88425eba6e5bfda9f1dcd34642517e2a8/cogen/core/schedulers.py#L162-L176
def process_op(self, op, coro): "Process a (op, coro) pair and return another pair. Handles exceptions." if op is None: if self.active: self.active.append((op, coro)) else: return op, coro else: try: res...
[ "def", "process_op", "(", "self", ",", "op", ",", "coro", ")", ":", "if", "op", "is", "None", ":", "if", "self", ".", "active", ":", "self", ".", "active", ".", "append", "(", "(", "op", ",", "coro", ")", ")", "else", ":", "return", "op", ",", ...
Process a (op, coro) pair and return another pair. Handles exceptions.
[ "Process", "a", "(", "op", "coro", ")", "pair", "and", "return", "another", "pair", ".", "Handles", "exceptions", "." ]
python
train
wandb/client
wandb/vendor/prompt_toolkit/shortcuts.py
https://github.com/wandb/client/blob/7d08954ed5674fee223cd85ed0d8518fe47266b2/wandb/vendor/prompt_toolkit/shortcuts.py#L551-L631
def run_application( application, patch_stdout=False, return_asyncio_coroutine=False, true_color=False, refresh_interval=0, eventloop=None): """ Run a prompt toolkit application. :param patch_stdout: Replace ``sys.stdout`` by a proxy that ensures that print statements from other...
[ "def", "run_application", "(", "application", ",", "patch_stdout", "=", "False", ",", "return_asyncio_coroutine", "=", "False", ",", "true_color", "=", "False", ",", "refresh_interval", "=", "0", ",", "eventloop", "=", "None", ")", ":", "assert", "isinstance", ...
Run a prompt toolkit application. :param patch_stdout: Replace ``sys.stdout`` by a proxy that ensures that print statements from other threads won't destroy the prompt. (They will be printed above the prompt instead.) :param return_asyncio_coroutine: When True, return a asyncio coroutin...
[ "Run", "a", "prompt", "toolkit", "application", "." ]
python
train
pypa/pipenv
pipenv/vendor/vistir/path.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L367-L397
def _wait_for_files(path): """ Retry with backoff up to 1 second to delete files from a directory. :param str path: The path to crawl to delete files from :return: A list of remaining paths or None :rtype: Optional[List[str]] """ timeout = 0.001 remaining = [] while timeout < 1.0: ...
[ "def", "_wait_for_files", "(", "path", ")", ":", "timeout", "=", "0.001", "remaining", "=", "[", "]", "while", "timeout", "<", "1.0", ":", "remaining", "=", "[", "]", "if", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "L", "=", "os", "...
Retry with backoff up to 1 second to delete files from a directory. :param str path: The path to crawl to delete files from :return: A list of remaining paths or None :rtype: Optional[List[str]]
[ "Retry", "with", "backoff", "up", "to", "1", "second", "to", "delete", "files", "from", "a", "directory", "." ]
python
train
benoitkugler/abstractDataLibrary
pyDLib/GUI/tabs.py
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/tabs.py#L37-L53
def set_callbacks(self, **dic_functions): """Register callbacks needed by the interface object""" for action in self.interface.CALLBACKS: try: f = dic_functions[action] except KeyError: pass else: setattr(self.interface....
[ "def", "set_callbacks", "(", "self", ",", "*", "*", "dic_functions", ")", ":", "for", "action", "in", "self", ".", "interface", ".", "CALLBACKS", ":", "try", ":", "f", "=", "dic_functions", "[", "action", "]", "except", "KeyError", ":", "pass", "else", ...
Register callbacks needed by the interface object
[ "Register", "callbacks", "needed", "by", "the", "interface", "object" ]
python
train
Alignak-monitoring/alignak
alignak/external_command.py
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/external_command.py#L1669-L1684
def change_svc_notification_timeperiod(self, service, notification_timeperiod): """Change service notification timeperiod Format of the line that triggers function call:: CHANGE_SVC_NOTIFICATION_TIMEPERIOD;<host_name>;<service_description>; <notification_timeperiod> :param serv...
[ "def", "change_svc_notification_timeperiod", "(", "self", ",", "service", ",", "notification_timeperiod", ")", ":", "service", ".", "modified_attributes", "|=", "DICT_MODATTR", "[", "\"MODATTR_NOTIFICATION_TIMEPERIOD\"", "]", ".", "value", "service", ".", "notification_pe...
Change service notification timeperiod Format of the line that triggers function call:: CHANGE_SVC_NOTIFICATION_TIMEPERIOD;<host_name>;<service_description>; <notification_timeperiod> :param service: service to edit :type service: alignak.objects.service.Service :param ...
[ "Change", "service", "notification", "timeperiod", "Format", "of", "the", "line", "that", "triggers", "function", "call", "::" ]
python
train
interedition/collatex
collatex-pythonport/ClusterShell/RangeSet.py
https://github.com/interedition/collatex/blob/76dd1fcc36047bc66a87d31142e72e98b5347821/collatex-pythonport/ClusterShell/RangeSet.py#L209-L218
def set_autostep(self, val): """Set autostep value (property)""" if val is None: # disabled by default for pdsh compat (+inf is 1E400, but a bug in # python 2.4 makes it impossible to be pickled, so we use less) # NOTE: Later, we could consider sys.maxint here ...
[ "def", "set_autostep", "(", "self", ",", "val", ")", ":", "if", "val", "is", "None", ":", "# disabled by default for pdsh compat (+inf is 1E400, but a bug in", "# python 2.4 makes it impossible to be pickled, so we use less)", "# NOTE: Later, we could consider sys.maxint here", "self...
Set autostep value (property)
[ "Set", "autostep", "value", "(", "property", ")" ]
python
train
saulpw/visidata
visidata/vdtui.py
https://github.com/saulpw/visidata/blob/32771e0cea6c24fc7902683d14558391395c591f/visidata/vdtui.py#L1476-L1480
def statusLine(self): 'String of row and column stats.' rowinfo = 'row %d/%d (%d selected)' % (self.cursorRowIndex, self.nRows, len(self._selectedRows)) colinfo = 'col %d/%d (%d visible)' % (self.cursorColIndex, self.nCols, len(self.visibleCols)) return '%s %s' % (rowinfo, colinfo)
[ "def", "statusLine", "(", "self", ")", ":", "rowinfo", "=", "'row %d/%d (%d selected)'", "%", "(", "self", ".", "cursorRowIndex", ",", "self", ".", "nRows", ",", "len", "(", "self", ".", "_selectedRows", ")", ")", "colinfo", "=", "'col %d/%d (%d visible)'", ...
String of row and column stats.
[ "String", "of", "row", "and", "column", "stats", "." ]
python
train
openfisca/openfisca-core
openfisca_core/taxbenefitsystems.py
https://github.com/openfisca/openfisca-core/blob/92ce9396e29ae5d9bac5ea604cfce88517c6b35c/openfisca_core/taxbenefitsystems.py#L243-L265
def load_extension(self, extension): """ Loads an extension to the tax and benefit system. :param string extension: The extension to load. Can be an absolute path pointing to an extension directory, or the name of an OpenFisca extension installed as a pip package. """ # Load ex...
[ "def", "load_extension", "(", "self", ",", "extension", ")", ":", "# Load extension from installed pip package", "try", ":", "package", "=", "importlib", ".", "import_module", "(", "extension", ")", "extension_directory", "=", "package", ".", "__path__", "[", "0", ...
Loads an extension to the tax and benefit system. :param string extension: The extension to load. Can be an absolute path pointing to an extension directory, or the name of an OpenFisca extension installed as a pip package.
[ "Loads", "an", "extension", "to", "the", "tax", "and", "benefit", "system", "." ]
python
train
Lucretiel/autocommand
src/autocommand/autoparse.py
https://github.com/Lucretiel/autocommand/blob/bd3c58a210fdfcc943c729cc5579033add68d0b3/src/autocommand/autoparse.py#L83-L188
def _add_arguments(param, parser, used_char_args, add_nos): ''' Add the argument(s) to an ArgumentParser (using add_argument) for a given parameter. used_char_args is the set of -short options currently already in use, and is updated (if necessary) by this function. If add_nos is True, this will als...
[ "def", "_add_arguments", "(", "param", ",", "parser", ",", "used_char_args", ",", "add_nos", ")", ":", "# Impl note: This function is kept separate from make_parser because it's", "# already very long and I wanted to separate out as much as possible into", "# its own call scope, to preve...
Add the argument(s) to an ArgumentParser (using add_argument) for a given parameter. used_char_args is the set of -short options currently already in use, and is updated (if necessary) by this function. If add_nos is True, this will also add an inverse switch for all boolean options. For instance, for t...
[ "Add", "the", "argument", "(", "s", ")", "to", "an", "ArgumentParser", "(", "using", "add_argument", ")", "for", "a", "given", "parameter", ".", "used_char_args", "is", "the", "set", "of", "-", "short", "options", "currently", "already", "in", "use", "and"...
python
train
mapillary/mapillary_tools
mapillary_tools/geo.py
https://github.com/mapillary/mapillary_tools/blob/816785e90c589cae6e8e34a5530ce8417d29591c/mapillary_tools/geo.py#L102-L111
def dms_to_decimal(degrees, minutes, seconds, hemisphere): ''' Convert from degrees, minutes, seconds to decimal degrees. @author: mprins ''' dms = float(degrees) + float(minutes) / 60 + float(seconds) / 3600 if hemisphere in "WwSs": dms = -1 * dms return dms
[ "def", "dms_to_decimal", "(", "degrees", ",", "minutes", ",", "seconds", ",", "hemisphere", ")", ":", "dms", "=", "float", "(", "degrees", ")", "+", "float", "(", "minutes", ")", "/", "60", "+", "float", "(", "seconds", ")", "/", "3600", "if", "hemis...
Convert from degrees, minutes, seconds to decimal degrees. @author: mprins
[ "Convert", "from", "degrees", "minutes", "seconds", "to", "decimal", "degrees", "." ]
python
train
gem/oq-engine
openquake/commands/shell.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/commands/shell.py#L57-L73
def shell(script=None, args=()): """ Start an embedded (i)python instance with a global object "o" or run a Python script in the engine environment. """ if script: sys.argv = sys.argv[2:] # strip ['oq', 'shell'] runpy.run_path(script, run_name='__main__') return o = Open...
[ "def", "shell", "(", "script", "=", "None", ",", "args", "=", "(", ")", ")", ":", "if", "script", ":", "sys", ".", "argv", "=", "sys", ".", "argv", "[", "2", ":", "]", "# strip ['oq', 'shell']", "runpy", ".", "run_path", "(", "script", ",", "run_na...
Start an embedded (i)python instance with a global object "o" or run a Python script in the engine environment.
[ "Start", "an", "embedded", "(", "i", ")", "python", "instance", "with", "a", "global", "object", "o", "or", "run", "a", "Python", "script", "in", "the", "engine", "environment", "." ]
python
train
fermiPy/fermipy
fermipy/gtanalysis.py
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L796-L835
def get_source_dnde(self, name): """Return differential flux distribution of a source. For sources with FileFunction spectral type this returns the internal differential flux array. Returns ------- loge : `~numpy.ndarray` Array of energies at which the differ...
[ "def", "get_source_dnde", "(", "self", ",", "name", ")", ":", "name", "=", "self", ".", "roi", ".", "get_source_by_name", "(", "name", ")", ".", "name", "if", "self", ".", "roi", "[", "name", "]", "[", "'SpectrumType'", "]", "!=", "'FileFunction'", ":"...
Return differential flux distribution of a source. For sources with FileFunction spectral type this returns the internal differential flux array. Returns ------- loge : `~numpy.ndarray` Array of energies at which the differential flux is evaluated (log10(E...
[ "Return", "differential", "flux", "distribution", "of", "a", "source", ".", "For", "sources", "with", "FileFunction", "spectral", "type", "this", "returns", "the", "internal", "differential", "flux", "array", "." ]
python
train
neherlab/treetime
treetime/merger_models.py
https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/merger_models.py#L153-L168
def optimize_Tc(self): ''' determines the coalescent time scale that optimizes the coalescent likelihood of the tree ''' from scipy.optimize import minimize_scalar initial_Tc = self.Tc def cost(Tc): self.set_Tc(Tc) return -self.total_LH() ...
[ "def", "optimize_Tc", "(", "self", ")", ":", "from", "scipy", ".", "optimize", "import", "minimize_scalar", "initial_Tc", "=", "self", ".", "Tc", "def", "cost", "(", "Tc", ")", ":", "self", ".", "set_Tc", "(", "Tc", ")", "return", "-", "self", ".", "...
determines the coalescent time scale that optimizes the coalescent likelihood of the tree
[ "determines", "the", "coalescent", "time", "scale", "that", "optimizes", "the", "coalescent", "likelihood", "of", "the", "tree" ]
python
test
useblocks/sphinxcontrib-needs
sphinxcontrib/needs/directives/need.py
https://github.com/useblocks/sphinxcontrib-needs/blob/f49af4859a74e9fe76de5b9133c01335ac6ae191/sphinxcontrib/needs/directives/need.py#L326-L347
def _get_full_title(self): """Determines the title for the need in order of precedence: directive argument, first sentence of requirement (if `:title_from_content:` was set, and '' if no title is to be derived.""" if len(self.arguments) > 0: # a title was passed if 'title_fr...
[ "def", "_get_full_title", "(", "self", ")", ":", "if", "len", "(", "self", ".", "arguments", ")", ">", "0", ":", "# a title was passed", "if", "'title_from_content'", "in", "self", ".", "options", ":", "self", ".", "log", ".", "warning", "(", "'Needs: need...
Determines the title for the need in order of precedence: directive argument, first sentence of requirement (if `:title_from_content:` was set, and '' if no title is to be derived.
[ "Determines", "the", "title", "for", "the", "need", "in", "order", "of", "precedence", ":", "directive", "argument", "first", "sentence", "of", "requirement", "(", "if", ":", "title_from_content", ":", "was", "set", "and", "if", "no", "title", "is", "to", ...
python
train
ionelmc/python-cogen
cogen/web/wsgi.py
https://github.com/ionelmc/python-cogen/blob/83b0edb88425eba6e5bfda9f1dcd34642517e2a8/cogen/web/wsgi.py#L230-L245
def simple_response(self, status, msg=""): """Return a operation for writing simple response back to the client.""" status = str(status) buf = ["%s %s\r\n" % (self.environ['ACTUAL_SERVER_PROTOCOL'], status), "Content-Length: %s\r\n" % len(msg), "Content-Type: text/plain\r\n"] i...
[ "def", "simple_response", "(", "self", ",", "status", ",", "msg", "=", "\"\"", ")", ":", "status", "=", "str", "(", "status", ")", "buf", "=", "[", "\"%s %s\\r\\n\"", "%", "(", "self", ".", "environ", "[", "'ACTUAL_SERVER_PROTOCOL'", "]", ",", "status", ...
Return a operation for writing simple response back to the client.
[ "Return", "a", "operation", "for", "writing", "simple", "response", "back", "to", "the", "client", "." ]
python
train
inveniosoftware/invenio-marc21
invenio_marc21/serializers/dojson.py
https://github.com/inveniosoftware/invenio-marc21/blob/b91347b5b000757b6dc9dc1be88d76ca09611905/invenio_marc21/serializers/dojson.py#L51-L62
def transform_search_hit(self, pid, record_hit, links_factory=None): """Transform search result hit into an intermediate representation. :param pid: The :class:`invenio_pidstore.models.PersistentIdentifier` instance. :param record_hit: A dictionary containing a ``'_source'`` key wit...
[ "def", "transform_search_hit", "(", "self", ",", "pid", ",", "record_hit", ",", "links_factory", "=", "None", ")", ":", "return", "self", ".", "dump", "(", "self", ".", "preprocess_search_hit", "(", "pid", ",", "record_hit", ",", "links_factory", "=", "links...
Transform search result hit into an intermediate representation. :param pid: The :class:`invenio_pidstore.models.PersistentIdentifier` instance. :param record_hit: A dictionary containing a ``'_source'`` key with the record data. :param links_factory: The link factory. (...
[ "Transform", "search", "result", "hit", "into", "an", "intermediate", "representation", "." ]
python
train
rmohr/static3
static.py
https://github.com/rmohr/static3/blob/e5f88c5e91789bd4db7fde0cf59e4a15c3326f11/static.py#L233-L236
def _body(self, full_path, environ, file_like): """Return an iterator over the body of the response.""" way_to_send = environ.get('wsgi.file_wrapper', iter_and_close) return way_to_send(file_like, self.block_size)
[ "def", "_body", "(", "self", ",", "full_path", ",", "environ", ",", "file_like", ")", ":", "way_to_send", "=", "environ", ".", "get", "(", "'wsgi.file_wrapper'", ",", "iter_and_close", ")", "return", "way_to_send", "(", "file_like", ",", "self", ".", "block_...
Return an iterator over the body of the response.
[ "Return", "an", "iterator", "over", "the", "body", "of", "the", "response", "." ]
python
train
spyder-ide/spyder
spyder/plugins/editor/panels/codefolding.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/codefolding.py#L657-L677
def _highlight_caret_scope(self): """ Highlight the scope of the current caret position. This get called only if :attr:` spyder.widgets.panels.FoldingPanel.highlight_care_scope` is True. """ cursor = self.editor.textCursor() block_nbr = cursor.blockNumber() ...
[ "def", "_highlight_caret_scope", "(", "self", ")", ":", "cursor", "=", "self", ".", "editor", ".", "textCursor", "(", ")", "block_nbr", "=", "cursor", ".", "blockNumber", "(", ")", "if", "self", ".", "_block_nbr", "!=", "block_nbr", ":", "block", "=", "F...
Highlight the scope of the current caret position. This get called only if :attr:` spyder.widgets.panels.FoldingPanel.highlight_care_scope` is True.
[ "Highlight", "the", "scope", "of", "the", "current", "caret", "position", "." ]
python
train
niklasf/python-chess
chess/__init__.py
https://github.com/niklasf/python-chess/blob/d91f986ca3e046b300a0d7d9ee2a13b07610fe1a/chess/__init__.py#L2398-L2435
def epd(self, *, shredder: bool = False, en_passant: str = "legal", promoted: Optional[bool] = None, **operations: Union[None, str, int, float, Move, Iterable[Move]]) -> str: """ Gets an EPD representation of the current position. See :func:`~chess.Board.fen()` for FEN formatting options (*shre...
[ "def", "epd", "(", "self", ",", "*", ",", "shredder", ":", "bool", "=", "False", ",", "en_passant", ":", "str", "=", "\"legal\"", ",", "promoted", ":", "Optional", "[", "bool", "]", "=", "None", ",", "*", "*", "operations", ":", "Union", "[", "None...
Gets an EPD representation of the current position. See :func:`~chess.Board.fen()` for FEN formatting options (*shredder*, *ep_square* and *promoted*). EPD operations can be given as keyword arguments. Supported operands are strings, integers, floats, moves, lists of moves and ``None``...
[ "Gets", "an", "EPD", "representation", "of", "the", "current", "position", "." ]
python
train
mouradmourafiq/pandas2sklearn
pandas_sklearn/__init__.py
https://github.com/mouradmourafiq/pandas2sklearn/blob/dbaf5180a893f4612852c1c217551b161fd519d4/pandas_sklearn/__init__.py#L208-L216
def fit(self, X, y=None): """ Fit a transformation from the pipeline :param X (DataSet): the data to fit """ for columns, transformer in self.mapping: if transformer is not None: transformer.fit(self._get_columns(X, columns)) return self
[ "def", "fit", "(", "self", ",", "X", ",", "y", "=", "None", ")", ":", "for", "columns", ",", "transformer", "in", "self", ".", "mapping", ":", "if", "transformer", "is", "not", "None", ":", "transformer", ".", "fit", "(", "self", ".", "_get_columns",...
Fit a transformation from the pipeline :param X (DataSet): the data to fit
[ "Fit", "a", "transformation", "from", "the", "pipeline", ":", "param", "X", "(", "DataSet", ")", ":", "the", "data", "to", "fit" ]
python
train
Erotemic/ubelt
setup.py
https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/setup.py#L90-L105
def parse_description(): """ Parse the description in the README file CommandLine: pandoc --from=markdown --to=rst --output=README.rst README.md python -c "import setup; print(setup.parse_description())" """ from os.path import dirname, join, exists readme_fpath = join(dirname(_...
[ "def", "parse_description", "(", ")", ":", "from", "os", ".", "path", "import", "dirname", ",", "join", ",", "exists", "readme_fpath", "=", "join", "(", "dirname", "(", "__file__", ")", ",", "'README.rst'", ")", "# This breaks on pip install, so check that it exis...
Parse the description in the README file CommandLine: pandoc --from=markdown --to=rst --output=README.rst README.md python -c "import setup; print(setup.parse_description())"
[ "Parse", "the", "description", "in", "the", "README", "file" ]
python
valid
fiesta/fiesta-python
fiesta/fiesta.py
https://github.com/fiesta/fiesta-python/blob/cfcc11e4ae4c76b1007794604c33dde877f62cfb/fiesta/fiesta.py#L111-L115
def hello(self): """http://docs.fiesta.cc/index.html#getting-started""" path = 'hello' response = self.request(path, do_authentication=False) return response
[ "def", "hello", "(", "self", ")", ":", "path", "=", "'hello'", "response", "=", "self", ".", "request", "(", "path", ",", "do_authentication", "=", "False", ")", "return", "response" ]
http://docs.fiesta.cc/index.html#getting-started
[ "http", ":", "//", "docs", ".", "fiesta", ".", "cc", "/", "index", ".", "html#getting", "-", "started" ]
python
train
PhilippeFerreiraDeSousa/bitext-matching
lib/enpc_aligner/IBM2_func.py
https://github.com/PhilippeFerreiraDeSousa/bitext-matching/blob/195c3e98775cfa5e63e4bb0bb1da6f741880d980/lib/enpc_aligner/IBM2_func.py#L85-L102
def viterbi_alignment(es, fs, t, a): ''' return dictionary e in es -> f in fs ''' max_a = collections.defaultdict(float) l_e = len(es) l_f = len(fs) for (j, e) in enumerate(es, 1): current_max = (0, -1) for (i, f) in enumerate(fs, 1): ...
[ "def", "viterbi_alignment", "(", "es", ",", "fs", ",", "t", ",", "a", ")", ":", "max_a", "=", "collections", ".", "defaultdict", "(", "float", ")", "l_e", "=", "len", "(", "es", ")", "l_f", "=", "len", "(", "fs", ")", "for", "(", "j", ",", "e",...
return dictionary e in es -> f in fs
[ "return", "dictionary", "e", "in", "es", "-", ">", "f", "in", "fs" ]
python
train
pjamesjoyce/lcopt
lcopt/model.py
https://github.com/pjamesjoyce/lcopt/blob/3f1caca31fece4a3068a384900707e6d21d04597/lcopt/model.py#L653-L684
def list_parameters_as_df(self): """ Only really useful when running from a jupyter notebook. Lists the parameters in the model in a pandas dataframe Columns: id, matrix coordinates, description, function """ to_df = [] for i, e in enumerate(self.ext_params): ...
[ "def", "list_parameters_as_df", "(", "self", ")", ":", "to_df", "=", "[", "]", "for", "i", ",", "e", "in", "enumerate", "(", "self", ".", "ext_params", ")", ":", "row", "=", "{", "}", "row", "[", "'id'", "]", "=", "e", "[", "'name'", "]", "row", ...
Only really useful when running from a jupyter notebook. Lists the parameters in the model in a pandas dataframe Columns: id, matrix coordinates, description, function
[ "Only", "really", "useful", "when", "running", "from", "a", "jupyter", "notebook", "." ]
python
train
openego/eTraGo
etrago/tools/io.py
https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/tools/io.py#L705-L764
def extension (network, session, version, scn_extension, start_snapshot, end_snapshot, **kwargs): """ Function that adds an additional network to the existing network container. The new network can include every PyPSA-component (e.g. buses, lines, links). To connect it to the existing ...
[ "def", "extension", "(", "network", ",", "session", ",", "version", ",", "scn_extension", ",", "start_snapshot", ",", "end_snapshot", ",", "*", "*", "kwargs", ")", ":", "if", "version", "is", "None", ":", "ormcls_prefix", "=", "'EgoGridPfHvExtension'", "else",...
Function that adds an additional network to the existing network container. The new network can include every PyPSA-component (e.g. buses, lines, links). To connect it to the existing network, transformers are needed. All components and its timeseries of the additional scenario need to be insert...
[ "Function", "that", "adds", "an", "additional", "network", "to", "the", "existing", "network", "container", ".", "The", "new", "network", "can", "include", "every", "PyPSA", "-", "component", "(", "e", ".", "g", ".", "buses", "lines", "links", ")", ".", ...
python
train
GoogleCloudPlatform/python-repo-tools
gcp_devrel/tools/appengine.py
https://github.com/GoogleCloudPlatform/python-repo-tools/blob/87422ba91814529848a2b8bf8be4294283a3e041/gcp_devrel/tools/appengine.py#L66-L86
def is_existing_up_to_date(destination, latest_version): """Returns False if there is no existing install or if the existing install is out of date. Otherwise, returns True.""" version_path = os.path.join( destination, 'google_appengine', 'VERSION') if not os.path.exists(version_path): ...
[ "def", "is_existing_up_to_date", "(", "destination", ",", "latest_version", ")", ":", "version_path", "=", "os", ".", "path", ".", "join", "(", "destination", ",", "'google_appengine'", ",", "'VERSION'", ")", "if", "not", "os", ".", "path", ".", "exists", "(...
Returns False if there is no existing install or if the existing install is out of date. Otherwise, returns True.
[ "Returns", "False", "if", "there", "is", "no", "existing", "install", "or", "if", "the", "existing", "install", "is", "out", "of", "date", ".", "Otherwise", "returns", "True", "." ]
python
train
coldfix/udiskie
udiskie/notify.py
https://github.com/coldfix/udiskie/blob/804c9d27df6f7361fec3097c432398f2d702f911/udiskie/notify.py#L84-L92
def device_locked(self, device): """Show lock notification for specified device object.""" if not self._mounter.is_handleable(device): return self._show_notification( 'device_locked', _('Device locked'), _('{0.device_presentation} locked', device),...
[ "def", "device_locked", "(", "self", ",", "device", ")", ":", "if", "not", "self", ".", "_mounter", ".", "is_handleable", "(", "device", ")", ":", "return", "self", ".", "_show_notification", "(", "'device_locked'", ",", "_", "(", "'Device locked'", ")", "...
Show lock notification for specified device object.
[ "Show", "lock", "notification", "for", "specified", "device", "object", "." ]
python
train
westurner/pyrpo
pyrpo/pyrpo.py
https://github.com/westurner/pyrpo/blob/2a910af055dc405b761571a52ef87842397ddadf/pyrpo/pyrpo.py#L1186-L1207
def log(self, n=None, **kwargs): """ Run the repository log command Returns: str: output of log command (``git log -n <n> <--kwarg=value>``) """ kwargs['format'] = kwargs.pop('template', self.template) cmd = ['git', 'log'] if n: cmd.append...
[ "def", "log", "(", "self", ",", "n", "=", "None", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'format'", "]", "=", "kwargs", ".", "pop", "(", "'template'", ",", "self", ".", "template", ")", "cmd", "=", "[", "'git'", ",", "'log'", "]", "...
Run the repository log command Returns: str: output of log command (``git log -n <n> <--kwarg=value>``)
[ "Run", "the", "repository", "log", "command" ]
python
train
psphere-project/psphere
psphere/__init__.py
https://github.com/psphere-project/psphere/blob/83a252e037c3d6e4f18bcd37380998bc9535e591/psphere/__init__.py#L260-L310
def _set_view_data(self, object_content): """Update the local object from the passed in object_content.""" # A debugging convenience, allows inspection of the object_content # that was used to create the object logger.info("Setting view data for a %s", self.__class__) self._objec...
[ "def", "_set_view_data", "(", "self", ",", "object_content", ")", ":", "# A debugging convenience, allows inspection of the object_content", "# that was used to create the object", "logger", ".", "info", "(", "\"Setting view data for a %s\"", ",", "self", ".", "__class__", ")",...
Update the local object from the passed in object_content.
[ "Update", "the", "local", "object", "from", "the", "passed", "in", "object_content", "." ]
python
train
pcdinh/greenclock
greenclock/__init__.py
https://github.com/pcdinh/greenclock/blob/52df4f5bdfae296e01d253ae7a177c7fc90ba6c5/greenclock/__init__.py#L142-L151
def schedule(self, name, timer, func, *args, **kwargs): ''' ts = Scheduler('my_task') ts.schedule(every(seconds=10), handle_message, "Every 10 seconds") ts.schedule(every(seconds=30), fetch_url, url="http://yahoo.com", section="stock_ticker") ts.run_forever() ''' ...
[ "def", "schedule", "(", "self", ",", "name", ",", "timer", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "tasks", ".", "append", "(", "Task", "(", "name", ",", "func", ",", "timer", ",", "*", "args", ",", "*", ...
ts = Scheduler('my_task') ts.schedule(every(seconds=10), handle_message, "Every 10 seconds") ts.schedule(every(seconds=30), fetch_url, url="http://yahoo.com", section="stock_ticker") ts.run_forever()
[ "ts", "=", "Scheduler", "(", "my_task", ")", "ts", ".", "schedule", "(", "every", "(", "seconds", "=", "10", ")", "handle_message", "Every", "10", "seconds", ")", "ts", ".", "schedule", "(", "every", "(", "seconds", "=", "30", ")", "fetch_url", "url", ...
python
train
jeongyoonlee/Kaggler
kaggler/data_io.py
https://github.com/jeongyoonlee/Kaggler/blob/20661105b61958dc9a3c529c1d3b2313ab23ae32/kaggler/data_io.py#L106-L127
def load_data(path, dense=False): """Load data from a CSV, LibSVM or HDF5 file based on the file extension. Args: path (str): A path to the CSV, LibSVM or HDF5 format file containing data. dense (boolean): An optional variable indicating if the return matrix should be d...
[ "def", "load_data", "(", "path", ",", "dense", "=", "False", ")", ":", "catalog", "=", "{", "'.csv'", ":", "load_csv", ",", "'.sps'", ":", "load_svmlight_file", ",", "'.h5'", ":", "load_hdf5", "}", "ext", "=", "os", ".", "path", ".", "splitext", "(", ...
Load data from a CSV, LibSVM or HDF5 file based on the file extension. Args: path (str): A path to the CSV, LibSVM or HDF5 format file containing data. dense (boolean): An optional variable indicating if the return matrix should be dense. By default, it is false. Retu...
[ "Load", "data", "from", "a", "CSV", "LibSVM", "or", "HDF5", "file", "based", "on", "the", "file", "extension", "." ]
python
train
Gandi/gandi.cli
gandi/cli/core/utils/__init__.py
https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/core/utils/__init__.py#L106-L131
def output_account(gandi, account, output_keys, justify=17): """ Helper to output an account information.""" output_generic(gandi, account, output_keys, justify) if 'prepaid' in output_keys: prepaid = '%s %s' % (account['prepaid_info']['amount'], account['prepaid_info']...
[ "def", "output_account", "(", "gandi", ",", "account", ",", "output_keys", ",", "justify", "=", "17", ")", ":", "output_generic", "(", "gandi", ",", "account", ",", "output_keys", ",", "justify", ")", "if", "'prepaid'", "in", "output_keys", ":", "prepaid", ...
Helper to output an account information.
[ "Helper", "to", "output", "an", "account", "information", "." ]
python
train
juju/python-libjuju
juju/model.py
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L115-L124
def _live_entity_map(self, entity_type): """Return an id:Entity map of all the living entities of type ``entity_type``. """ return { entity_id: self.get_entity(entity_type, entity_id) for entity_id, history in self.state.get(entity_type, {}).items() i...
[ "def", "_live_entity_map", "(", "self", ",", "entity_type", ")", ":", "return", "{", "entity_id", ":", "self", ".", "get_entity", "(", "entity_type", ",", "entity_id", ")", "for", "entity_id", ",", "history", "in", "self", ".", "state", ".", "get", "(", ...
Return an id:Entity map of all the living entities of type ``entity_type``.
[ "Return", "an", "id", ":", "Entity", "map", "of", "all", "the", "living", "entities", "of", "type", "entity_type", "." ]
python
train
pymc-devs/pymc
pymc/database/hdf5.py
https://github.com/pymc-devs/pymc/blob/c6e530210bff4c0d7189b35b2c971bc53f93f7cd/pymc/database/hdf5.py#L195-L205
def hdf5_col(self, chain=-1): """Return a pytables column object. :Parameters: chain : integer The index of the chain. .. note:: This method is specific to the ``hdf5`` backend. """ return self.db._tables[chain].colinstances[self.name]
[ "def", "hdf5_col", "(", "self", ",", "chain", "=", "-", "1", ")", ":", "return", "self", ".", "db", ".", "_tables", "[", "chain", "]", ".", "colinstances", "[", "self", ".", "name", "]" ]
Return a pytables column object. :Parameters: chain : integer The index of the chain. .. note:: This method is specific to the ``hdf5`` backend.
[ "Return", "a", "pytables", "column", "object", "." ]
python
train
google/grr
grr/server/grr_response_server/aff4_objects/filestore.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/filestore.py#L212-L228
def Query(cls, index_urn, target_prefix="", limit=100, token=None): """Search the index for matches starting with target_prefix. Args: index_urn: The index to use. Should be a urn that points to the sha256 namespace. target_prefix: The prefix to match against the index. limit: Eit...
[ "def", "Query", "(", "cls", ",", "index_urn", ",", "target_prefix", "=", "\"\"", ",", "limit", "=", "100", ",", "token", "=", "None", ")", ":", "return", "data_store", ".", "DB", ".", "FileHashIndexQuery", "(", "index_urn", ",", "target_prefix", ",", "li...
Search the index for matches starting with target_prefix. Args: index_urn: The index to use. Should be a urn that points to the sha256 namespace. target_prefix: The prefix to match against the index. limit: Either a tuple of (start, limit) or a maximum number of results to re...
[ "Search", "the", "index", "for", "matches", "starting", "with", "target_prefix", "." ]
python
train
Unidata/MetPy
metpy/io/_nexrad_msgs/parse_spec.py
https://github.com/Unidata/MetPy/blob/16f68a94919b9a82dcf9cada2169cf039129e67b/metpy/io/_nexrad_msgs/parse_spec.py#L25-L54
def process_msg3(fname): """Handle information for message type 3.""" with open(fname, 'r') as infile: info = [] for lineno, line in enumerate(infile): parts = line.split(' ') try: var_name, desc, typ, units = parts[:4] size_hw = parts[-1]...
[ "def", "process_msg3", "(", "fname", ")", ":", "with", "open", "(", "fname", ",", "'r'", ")", "as", "infile", ":", "info", "=", "[", "]", "for", "lineno", ",", "line", "in", "enumerate", "(", "infile", ")", ":", "parts", "=", "line", ".", "split", ...
Handle information for message type 3.
[ "Handle", "information", "for", "message", "type", "3", "." ]
python
train
yyuu/botornado
boto/s3/resumable_download_handler.py
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/s3/resumable_download_handler.py#L171-L213
def _attempt_resumable_download(self, key, fp, headers, cb, num_cb, torrent, version_id): """ Attempts a resumable download. Raises ResumableDownloadException if any problems occur. """ cur_file_size = get_cur_file_size(fp, position_to_eof=Tru...
[ "def", "_attempt_resumable_download", "(", "self", ",", "key", ",", "fp", ",", "headers", ",", "cb", ",", "num_cb", ",", "torrent", ",", "version_id", ")", ":", "cur_file_size", "=", "get_cur_file_size", "(", "fp", ",", "position_to_eof", "=", "True", ")", ...
Attempts a resumable download. Raises ResumableDownloadException if any problems occur.
[ "Attempts", "a", "resumable", "download", "." ]
python
train
sdispater/orator
orator/orm/relations/belongs_to_many.py
https://github.com/sdispater/orator/blob/bd90bf198ee897751848f9a92e49d18e60a74136/orator/orm/relations/belongs_to_many.py#L201-L215
def get_relation_count_query(self, query, parent): """ Add the constraints for a relationship count query. :type query: orator.orm.Builder :type parent: orator.orm.Builder :rtype: orator.orm.Builder """ if parent.get_query().from__ == query.get_query().from__: ...
[ "def", "get_relation_count_query", "(", "self", ",", "query", ",", "parent", ")", ":", "if", "parent", ".", "get_query", "(", ")", ".", "from__", "==", "query", ".", "get_query", "(", ")", ".", "from__", ":", "return", "self", ".", "get_relation_count_quer...
Add the constraints for a relationship count query. :type query: orator.orm.Builder :type parent: orator.orm.Builder :rtype: orator.orm.Builder
[ "Add", "the", "constraints", "for", "a", "relationship", "count", "query", "." ]
python
train
Azure/azure-sdk-for-python
azure-batch/azure/batch/operations/job_operations.py
https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-batch/azure/batch/operations/job_operations.py#L1015-L1118
def list( self, job_list_options=None, custom_headers=None, raw=False, **operation_config): """Lists all of the jobs in the specified account. :param job_list_options: Additional parameters for the operation :type job_list_options: ~azure.batch.models.JobListOptions :param d...
[ "def", "list", "(", "self", ",", "job_list_options", "=", "None", ",", "custom_headers", "=", "None", ",", "raw", "=", "False", ",", "*", "*", "operation_config", ")", ":", "filter", "=", "None", "if", "job_list_options", "is", "not", "None", ":", "filte...
Lists all of the jobs in the specified account. :param job_list_options: Additional parameters for the operation :type job_list_options: ~azure.batch.models.JobListOptions :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response ...
[ "Lists", "all", "of", "the", "jobs", "in", "the", "specified", "account", "." ]
python
test
awacha/sastool
sastool/utils2d/centering.py
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/utils2d/centering.py#L358-L400
def findbeam_powerlaw(data, orig_initial, mask, rmin, rmax, maxiter=100, drive_by='R2', extent=10, callback=None): """Find the beam by minimizing the width of a Gaussian centered at the origin (i.e. maximizing the radius of gyration in a Guinier scattering). Inputs: data: scat...
[ "def", "findbeam_powerlaw", "(", "data", ",", "orig_initial", ",", "mask", ",", "rmin", ",", "rmax", ",", "maxiter", "=", "100", ",", "drive_by", "=", "'R2'", ",", "extent", "=", "10", ",", "callback", "=", "None", ")", ":", "orig_initial", "=", "np", ...
Find the beam by minimizing the width of a Gaussian centered at the origin (i.e. maximizing the radius of gyration in a Guinier scattering). Inputs: data: scattering matrix orig_initial: first guess for the origin mask: mask matrix. Nonzero is non-masked. rmin,rmax: distance fro...
[ "Find", "the", "beam", "by", "minimizing", "the", "width", "of", "a", "Gaussian", "centered", "at", "the", "origin", "(", "i", ".", "e", ".", "maximizing", "the", "radius", "of", "gyration", "in", "a", "Guinier", "scattering", ")", "." ]
python
train
klen/muffin-peewee
muffin_peewee/plugin.py
https://github.com/klen/muffin-peewee/blob/8e893e3ea1dfc82fbcfc6efe784308c8d4e2852e/muffin_peewee/plugin.py#L117-L120
def cleanup(self, app): """Close all connections.""" if hasattr(self.database.obj, 'close_all'): self.database.close_all()
[ "def", "cleanup", "(", "self", ",", "app", ")", ":", "if", "hasattr", "(", "self", ".", "database", ".", "obj", ",", "'close_all'", ")", ":", "self", ".", "database", ".", "close_all", "(", ")" ]
Close all connections.
[ "Close", "all", "connections", "." ]
python
valid
pandas-dev/pandas
pandas/io/formats/format.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/format.py#L720-L747
def to_html(self, classes=None, notebook=False, border=None): """ Render a DataFrame to a html table. Parameters ---------- classes : str or list-like classes to include in the `class` attribute of the opening ``<table>`` tag, in addition to the default "...
[ "def", "to_html", "(", "self", ",", "classes", "=", "None", ",", "notebook", "=", "False", ",", "border", "=", "None", ")", ":", "from", "pandas", ".", "io", ".", "formats", ".", "html", "import", "HTMLFormatter", ",", "NotebookFormatter", "Klass", "=", ...
Render a DataFrame to a html table. Parameters ---------- classes : str or list-like classes to include in the `class` attribute of the opening ``<table>`` tag, in addition to the default "dataframe". notebook : {True, False}, optional, default False ...
[ "Render", "a", "DataFrame", "to", "a", "html", "table", "." ]
python
train
MacHu-GWU/inspect_mate-project
dev/analysis.py
https://github.com/MacHu-GWU/inspect_mate-project/blob/a3d0980ee259daf578bb2226fea311af08ab435b/dev/analysis.py#L107-L114
def merge_true_table(): """Merge all true table into single excel file. """ writer = pd.ExcelWriter("True Table.xlsx") for p in Path(__file__).parent.select_by_ext(".csv"): df = pd.read_csv(p.abspath, index_col=0) df.to_excel(writer, p.fname, index=True) writer.save()
[ "def", "merge_true_table", "(", ")", ":", "writer", "=", "pd", ".", "ExcelWriter", "(", "\"True Table.xlsx\"", ")", "for", "p", "in", "Path", "(", "__file__", ")", ".", "parent", ".", "select_by_ext", "(", "\".csv\"", ")", ":", "df", "=", "pd", ".", "r...
Merge all true table into single excel file.
[ "Merge", "all", "true", "table", "into", "single", "excel", "file", "." ]
python
train
annoviko/pyclustering
pyclustering/nnet/examples/legion_examples.py
https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/nnet/examples/legion_examples.py#L99-L106
def sixteen_oscillator_two_stimulated_ensembles_grid(): "Not accurate false due to spikes are observed" parameters = legion_parameters(); parameters.teta_x = -1.1; template_dynamic_legion(16, 2000, 1500, conn_type = conn_type.GRID_FOUR, params = parameters, stimulus = [1, 1, 1, 0, ...
[ "def", "sixteen_oscillator_two_stimulated_ensembles_grid", "(", ")", ":", "parameters", "=", "legion_parameters", "(", ")", "parameters", ".", "teta_x", "=", "-", "1.1", "template_dynamic_legion", "(", "16", ",", "2000", ",", "1500", ",", "conn_type", "=", "conn_t...
Not accurate false due to spikes are observed
[ "Not", "accurate", "false", "due", "to", "spikes", "are", "observed" ]
python
valid
shazow/unstdlib.py
unstdlib/standard/string_.py
https://github.com/shazow/unstdlib.py/blob/e0632fe165cfbfdb5a7e4bc7b412c9d6f2ebad83/unstdlib/standard/string_.py#L86-L112
def string_to_number(s, alphabet): """ Given a string ``s``, convert it to an integer composed of the given ``alphabet`` mapping, where the position of each element in ``alphabet`` is its radix value. Examples:: >>> string_to_number('101111000110000101001110', '01') 12345678 ...
[ "def", "string_to_number", "(", "s", ",", "alphabet", ")", ":", "base", "=", "len", "(", "alphabet", ")", "inverse_alphabet", "=", "dict", "(", "zip", "(", "alphabet", ",", "xrange", "(", "0", ",", "base", ")", ")", ")", "n", "=", "0", "exp", "=", ...
Given a string ``s``, convert it to an integer composed of the given ``alphabet`` mapping, where the position of each element in ``alphabet`` is its radix value. Examples:: >>> string_to_number('101111000110000101001110', '01') 12345678 >>> string_to_number('babbbbaaabbaaaababaabb...
[ "Given", "a", "string", "s", "convert", "it", "to", "an", "integer", "composed", "of", "the", "given", "alphabet", "mapping", "where", "the", "position", "of", "each", "element", "in", "alphabet", "is", "its", "radix", "value", "." ]
python
train
diefans/docker-events
src/docker_events/__init__.py
https://github.com/diefans/docker-events/blob/cc07591d908fefcc265285ba7fc0047632e06dea/src/docker_events/__init__.py#L40-L47
def matches(self, client, event_data): """True if all filters are matching.""" for f in self.filters: if not f(client, event_data): return False return True
[ "def", "matches", "(", "self", ",", "client", ",", "event_data", ")", ":", "for", "f", "in", "self", ".", "filters", ":", "if", "not", "f", "(", "client", ",", "event_data", ")", ":", "return", "False", "return", "True" ]
True if all filters are matching.
[ "True", "if", "all", "filters", "are", "matching", "." ]
python
train
chrislit/abydos
abydos/stats/_confusion_table.py
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/stats/_confusion_table.py#L641-L666
def accuracy_gain(self): r"""Return gain in accuracy. The gain in accuracy is defined as: :math:`G(accuracy) = \frac{accuracy}{random~ accuracy}` Cf. https://en.wikipedia.org/wiki/Gain_(information_retrieval) Returns ------- float The gain in accura...
[ "def", "accuracy_gain", "(", "self", ")", ":", "if", "self", ".", "population", "(", ")", "==", "0", ":", "return", "float", "(", "'NaN'", ")", "random_accuracy", "=", "(", "self", ".", "cond_pos_pop", "(", ")", "/", "self", ".", "population", "(", "...
r"""Return gain in accuracy. The gain in accuracy is defined as: :math:`G(accuracy) = \frac{accuracy}{random~ accuracy}` Cf. https://en.wikipedia.org/wiki/Gain_(information_retrieval) Returns ------- float The gain in accuracy of the confusion table ...
[ "r", "Return", "gain", "in", "accuracy", "." ]
python
valid
miguelgrinberg/python-engineio
engineio/asyncio_socket.py
https://github.com/miguelgrinberg/python-engineio/blob/261fd67103cb5d9a44369415748e66fdf62de6fb/engineio/asyncio_socket.py#L120-L128
async def _upgrade_websocket(self, environ): """Upgrade the connection from polling to websocket.""" if self.upgraded: raise IOError('Socket has been upgraded already') if self.server._async['websocket'] is None: # the selected async mode does not support websocket ...
[ "async", "def", "_upgrade_websocket", "(", "self", ",", "environ", ")", ":", "if", "self", ".", "upgraded", ":", "raise", "IOError", "(", "'Socket has been upgraded already'", ")", "if", "self", ".", "server", ".", "_async", "[", "'websocket'", "]", "is", "N...
Upgrade the connection from polling to websocket.
[ "Upgrade", "the", "connection", "from", "polling", "to", "websocket", "." ]
python
train
mlperf/training
rnn_translator/pytorch/seq2seq/inference/inference.py
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/rnn_translator/pytorch/seq2seq/inference/inference.py#L72-L85
def build_eval_path(self, epoch, iteration): """ Appends index of the current epoch and index of the current iteration to the name of the file with results. :param epoch: index of the current epoch :param iteration: index of the current iteration """ if iteration...
[ "def", "build_eval_path", "(", "self", ",", "epoch", ",", "iteration", ")", ":", "if", "iteration", "is", "not", "None", ":", "eval_fname", "=", "f'eval_epoch_{epoch}_iter_{iteration}'", "else", ":", "eval_fname", "=", "f'eval_epoch_{epoch}'", "eval_path", "=", "o...
Appends index of the current epoch and index of the current iteration to the name of the file with results. :param epoch: index of the current epoch :param iteration: index of the current iteration
[ "Appends", "index", "of", "the", "current", "epoch", "and", "index", "of", "the", "current", "iteration", "to", "the", "name", "of", "the", "file", "with", "results", "." ]
python
train
pypa/pipenv
pipenv/vendor/vistir/path.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/vistir/path.py#L188-L195
def is_valid_url(url): """Checks if a given string is an url""" from .misc import to_text if not url: return url pieces = urllib_parse.urlparse(to_text(url)) return all([pieces.scheme, pieces.netloc])
[ "def", "is_valid_url", "(", "url", ")", ":", "from", ".", "misc", "import", "to_text", "if", "not", "url", ":", "return", "url", "pieces", "=", "urllib_parse", ".", "urlparse", "(", "to_text", "(", "url", ")", ")", "return", "all", "(", "[", "pieces", ...
Checks if a given string is an url
[ "Checks", "if", "a", "given", "string", "is", "an", "url" ]
python
train
projectatomic/osbs-client
osbs/api.py
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1034-L1050
def import_image_tags(self, name, tags, repository, insecure=False): """Import image tags from specified container repository. :param name: str, name of ImageStream object :param tags: iterable, tags to be imported :param repository: str, remote location of container image ...
[ "def", "import_image_tags", "(", "self", ",", "name", ",", "tags", ",", "repository", ",", "insecure", "=", "False", ")", ":", "stream_import_file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "os_conf", ".", "get_build_json_store", "(", ")", ...
Import image tags from specified container repository. :param name: str, name of ImageStream object :param tags: iterable, tags to be imported :param repository: str, remote location of container image in the format <registry>/<repository> :param insecure...
[ "Import", "image", "tags", "from", "specified", "container", "repository", "." ]
python
train
bcbio/bcbio-nextgen
bcbio/structural/pindel.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/pindel.py#L47-L57
def is_installed(config): """Check for pindel installation on machine. :param config: (dict) information from yaml(items[0]['config']) :returns: (boolean) if pindel is installed """ try: config_utils.get_program("pindel2vcf", config) config_utils.get_program("pindel", config) ...
[ "def", "is_installed", "(", "config", ")", ":", "try", ":", "config_utils", ".", "get_program", "(", "\"pindel2vcf\"", ",", "config", ")", "config_utils", ".", "get_program", "(", "\"pindel\"", ",", "config", ")", "return", "True", "except", "config_utils", "....
Check for pindel installation on machine. :param config: (dict) information from yaml(items[0]['config']) :returns: (boolean) if pindel is installed
[ "Check", "for", "pindel", "installation", "on", "machine", ".", ":", "param", "config", ":", "(", "dict", ")", "information", "from", "yaml", "(", "items", "[", "0", "]", "[", "config", "]", ")", ":", "returns", ":", "(", "boolean", ")", "if", "pinde...
python
train
pyupio/pyup
pyup/config.py
https://github.com/pyupio/pyup/blob/b20fa88e03cfdf5dc409a9f00d27629188171c31/pyup/config.py#L126-L134
def can_update_insecure(self, path): """ Checks if requirements in `path` can be updated if insecure. :param path: string, path to requirement file :return: bool """ return self._get_requirement_attr("update", path=path) in (Config.UPDATE_ALL, ...
[ "def", "can_update_insecure", "(", "self", ",", "path", ")", ":", "return", "self", ".", "_get_requirement_attr", "(", "\"update\"", ",", "path", "=", "path", ")", "in", "(", "Config", ".", "UPDATE_ALL", ",", "Config", ".", "UPDATE_INSECURE", ",", "Config", ...
Checks if requirements in `path` can be updated if insecure. :param path: string, path to requirement file :return: bool
[ "Checks", "if", "requirements", "in", "path", "can", "be", "updated", "if", "insecure", ".", ":", "param", "path", ":", "string", "path", "to", "requirement", "file", ":", "return", ":", "bool" ]
python
train
ska-sa/montblanc
montblanc/impl/rime/tensorflow/sinks/sink_provider.py
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sinks/sink_provider.py#L53-L73
def find_sinks(obj): """ Returns a dictionary of sink methods found on this object, keyed on method name. Sink methods are identified by (self, context) arguments on this object. For example: def f(self, context): ... is a sink method, but def f(self, ctx): ... is not...
[ "def", "find_sinks", "(", "obj", ")", ":", "SINK_ARGSPEC", "=", "[", "'self'", ",", "'context'", "]", "return", "{", "n", ":", "m", "for", "n", ",", "m", "in", "inspect", ".", "getmembers", "(", "obj", ",", "inspect", ".", "ismethod", ")", "if", "i...
Returns a dictionary of sink methods found on this object, keyed on method name. Sink methods are identified by (self, context) arguments on this object. For example: def f(self, context): ... is a sink method, but def f(self, ctx): ... is not.
[ "Returns", "a", "dictionary", "of", "sink", "methods", "found", "on", "this", "object", "keyed", "on", "method", "name", ".", "Sink", "methods", "are", "identified", "by", "(", "self", "context", ")", "arguments", "on", "this", "object", ".", "For", "examp...
python
train
tensorflow/tensorboard
tensorboard/plugins/pr_curve/pr_curves_plugin.py
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/pr_curve/pr_curves_plugin.py#L360-L399
def _make_pr_entry(self, step, wall_time, data_array, thresholds): """Creates an entry for PR curve data. Each entry corresponds to 1 step. Args: step: The step. wall_time: The wall time. data_array: A numpy array of PR curve data stored in the summary format. thresholds: An array of fl...
[ "def", "_make_pr_entry", "(", "self", ",", "step", ",", "wall_time", ",", "data_array", ",", "thresholds", ")", ":", "# Trim entries for which TP + FP = 0 (precision is undefined) at the tail of", "# the data.", "true_positives", "=", "[", "int", "(", "v", ")", "for", ...
Creates an entry for PR curve data. Each entry corresponds to 1 step. Args: step: The step. wall_time: The wall time. data_array: A numpy array of PR curve data stored in the summary format. thresholds: An array of floating point thresholds. Returns: A PR curve entry.
[ "Creates", "an", "entry", "for", "PR", "curve", "data", ".", "Each", "entry", "corresponds", "to", "1", "step", "." ]
python
train
Desiiii/weeb.py
weeb/client.py
https://github.com/Desiiii/weeb.py/blob/5174c22e0cd34cb77f69ad18fbe87ee1fad51859/weeb/client.py#L18-L29
async def get_types(self): """Gets all available types. This function is a coroutine. Return Type: `list`""" async with aiohttp.ClientSession() as session: async with session.get('https://api.weeb.sh/images/types', headers=self.__headers) as resp: if resp.st...
[ "async", "def", "get_types", "(", "self", ")", ":", "async", "with", "aiohttp", ".", "ClientSession", "(", ")", "as", "session", ":", "async", "with", "session", ".", "get", "(", "'https://api.weeb.sh/images/types'", ",", "headers", "=", "self", ".", "__head...
Gets all available types. This function is a coroutine. Return Type: `list`
[ "Gets", "all", "available", "types", "." ]
python
train
CivicSpleen/ambry
ambry/bundle/bundle.py
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/bundle/bundle.py#L1533-L1548
def sync_sources(self, force=False): """Sync in only the sources.csv file""" from ambry.orm.file import File self.dstate = self.STATES.BUILDING synced = 0 for fc in [File.BSFILE.SOURCES]: bsf = self.build_source_files.file(fc) if bsf.fs_is_newer or forc...
[ "def", "sync_sources", "(", "self", ",", "force", "=", "False", ")", ":", "from", "ambry", ".", "orm", ".", "file", "import", "File", "self", ".", "dstate", "=", "self", ".", "STATES", ".", "BUILDING", "synced", "=", "0", "for", "fc", "in", "[", "F...
Sync in only the sources.csv file
[ "Sync", "in", "only", "the", "sources", ".", "csv", "file" ]
python
train
lesscpy/lesscpy
lesscpy/lessc/parser.py
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/parser.py#L1032-L1048
def p_error(self, t): """ Internal error handler args: t (Lex token): Error token """ if t: error_msg = "E: %s line: %d, Syntax Error, token: `%s`, `%s`" % \ (self.target, t.lineno, t.type, t.value) self.register.register(error_ms...
[ "def", "p_error", "(", "self", ",", "t", ")", ":", "if", "t", ":", "error_msg", "=", "\"E: %s line: %d, Syntax Error, token: `%s`, `%s`\"", "%", "(", "self", ".", "target", ",", "t", ".", "lineno", ",", "t", ".", "type", ",", "t", ".", "value", ")", "s...
Internal error handler args: t (Lex token): Error token
[ "Internal", "error", "handler", "args", ":", "t", "(", "Lex", "token", ")", ":", "Error", "token" ]
python
valid
globocom/GloboNetworkAPI-client-python
networkapiclient/EquipamentoAcesso.py
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/EquipamentoAcesso.py#L92-L120
def list_by_equip(self, name): """ List all equipment access by equipment name :return: Dictionary with the following structure: :: {‘equipamento_acesso’:[ {'id': <id_equiptos_access>, 'equipamento': <id_equip>, 'fqdn': <fqdn>, 'user': <...
[ "def", "list_by_equip", "(", "self", ",", "name", ")", ":", "equip_access_map", "=", "dict", "(", ")", "equip_access_map", "[", "'name'", "]", "=", "name", "code", ",", "xml", "=", "self", ".", "submit", "(", "{", "\"equipamento_acesso\"", ":", "equip_acce...
List all equipment access by equipment name :return: Dictionary with the following structure: :: {‘equipamento_acesso’:[ {'id': <id_equiptos_access>, 'equipamento': <id_equip>, 'fqdn': <fqdn>, 'user': <user>, 'password': <pass> '...
[ "List", "all", "equipment", "access", "by", "equipment", "name" ]
python
train
google/grr
grr/server/grr_response_server/aff4_objects/users.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/users.py#L54-L59
def _CheckLegacyPassword(self, password): """Check password with legacy crypt based method.""" # This import will fail on Windows. import crypt # pylint: disable=g-import-not-at-top salt = self._value[:2] return crypt.crypt(password, salt) == self._value
[ "def", "_CheckLegacyPassword", "(", "self", ",", "password", ")", ":", "# This import will fail on Windows.", "import", "crypt", "# pylint: disable=g-import-not-at-top", "salt", "=", "self", ".", "_value", "[", ":", "2", "]", "return", "crypt", ".", "crypt", "(", ...
Check password with legacy crypt based method.
[ "Check", "password", "with", "legacy", "crypt", "based", "method", "." ]
python
train
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiNetworkIPv6.py
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiNetworkIPv6.py#L143-L152
def create(self, networkipv6s): """ Method to create network-ipv6's :param networkipv6s: List containing networkipv6's desired to be created on database :return: None """ data = {'networks': networkipv6s} return super(ApiNetworkIPv6, self).post('api/v3/networkv6...
[ "def", "create", "(", "self", ",", "networkipv6s", ")", ":", "data", "=", "{", "'networks'", ":", "networkipv6s", "}", "return", "super", "(", "ApiNetworkIPv6", ",", "self", ")", ".", "post", "(", "'api/v3/networkv6/'", ",", "data", ")" ]
Method to create network-ipv6's :param networkipv6s: List containing networkipv6's desired to be created on database :return: None
[ "Method", "to", "create", "network", "-", "ipv6", "s" ]
python
train
GluuFederation/oxd-python
oxdpython/messenger.py
https://github.com/GluuFederation/oxd-python/blob/a0448cda03b4384bc50a8c20bd65eacd983bceb8/oxdpython/messenger.py#L139-L160
def request(self, command, **kwargs): """Function that builds the request and returns the response from oxd-server Parameters: * **command (str):** The command that has to be sent to the oxd-server * ** **kwargs:** The parameters that should accompany the request ...
[ "def", "request", "(", "self", ",", "command", ",", "*", "*", "kwargs", ")", ":", "payload", "=", "{", "\"command\"", ":", "command", ",", "\"params\"", ":", "dict", "(", ")", "}", "for", "item", "in", "kwargs", ".", "keys", "(", ")", ":", "payload...
Function that builds the request and returns the response from oxd-server Parameters: * **command (str):** The command that has to be sent to the oxd-server * ** **kwargs:** The parameters that should accompany the request Returns: **dict:** the returned res...
[ "Function", "that", "builds", "the", "request", "and", "returns", "the", "response", "from", "oxd", "-", "server" ]
python
train
Delgan/loguru
loguru/_logger.py
https://github.com/Delgan/loguru/blob/6571879c37904e3a18567e694d70651c6886b860/loguru/_logger.py#L1255-L1330
def configure(self, *, handlers=None, levels=None, extra=None, activation=None): """Configure the core logger. It should be noted that ``extra`` values set using this function are available across all modules, so this is the best way to set overall default values. Parameters --...
[ "def", "configure", "(", "self", ",", "*", ",", "handlers", "=", "None", ",", "levels", "=", "None", ",", "extra", "=", "None", ",", "activation", "=", "None", ")", ":", "if", "handlers", "is", "not", "None", ":", "self", ".", "remove", "(", ")", ...
Configure the core logger. It should be noted that ``extra`` values set using this function are available across all modules, so this is the best way to set overall default values. Parameters ---------- handlers : |list| of |dict|, optional A list of each handler to...
[ "Configure", "the", "core", "logger", "." ]
python
train
BerkeleyAutomation/perception
perception/kinect2_sensor.py
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/kinect2_sensor.py#L123-L130
def color_intrinsics(self): """:obj:`CameraIntrinsics` : The camera intrinsics for the Kinect's color camera. """ if self._device is None: raise RuntimeError('Kinect2 device %s not runnning. Cannot return color intrinsics') camera_params = self._device.getColorCameraParams() ...
[ "def", "color_intrinsics", "(", "self", ")", ":", "if", "self", ".", "_device", "is", "None", ":", "raise", "RuntimeError", "(", "'Kinect2 device %s not runnning. Cannot return color intrinsics'", ")", "camera_params", "=", "self", ".", "_device", ".", "getColorCamera...
:obj:`CameraIntrinsics` : The camera intrinsics for the Kinect's color camera.
[ ":", "obj", ":", "CameraIntrinsics", ":", "The", "camera", "intrinsics", "for", "the", "Kinect", "s", "color", "camera", "." ]
python
train
TomasTomecek/sen
sen/tui/widgets/list/util.py
https://github.com/TomasTomecek/sen/blob/239b4868125814e8bf5527708119fc08b35f6cc0/sen/tui/widgets/list/util.py#L46-L59
def get_time_attr_map(t): """ now -> | hour ago -> | day ago -> | |--------------|--------------------|---------------------| """ now = datetime.datetime.now() if t + datetime.timedelta(hours=3) > now: ...
[ "def", "get_time_attr_map", "(", "t", ")", ":", "now", "=", "datetime", ".", "datetime", ".", "now", "(", ")", "if", "t", "+", "datetime", ".", "timedelta", "(", "hours", "=", "3", ")", ">", "now", ":", "return", "get_map", "(", "\"main_list_white\"", ...
now -> | hour ago -> | day ago -> | |--------------|--------------------|---------------------|
[ "now", "-", ">", "|", "hour", "ago", "-", ">", "|", "day", "ago", "-", ">", "|", "|", "--------------", "|", "--------------------", "|", "---------------------", "|" ]
python
train
brainiak/brainiak
brainiak/fcma/classifier.py
https://github.com/brainiak/brainiak/blob/408f12dec2ff56559a26873a848a09e4c8facfeb/brainiak/fcma/classifier.py#L506-L566
def predict(self, X=None): """Use a trained model to predict correlation data. first compute the correlation of the input data, and then normalize across all samples in the list if there are more than one sample, and then predict via self.clf. If X is None, use the simil...
[ "def", "predict", "(", "self", ",", "X", "=", "None", ")", ":", "time1", "=", "time", ".", "time", "(", ")", "if", "X", "is", "not", "None", ":", "for", "x", "in", "X", ":", "assert", "len", "(", "x", ")", "==", "2", ",", "'there must be two pa...
Use a trained model to predict correlation data. first compute the correlation of the input data, and then normalize across all samples in the list if there are more than one sample, and then predict via self.clf. If X is None, use the similarity vectors produced in fit ...
[ "Use", "a", "trained", "model", "to", "predict", "correlation", "data", "." ]
python
train
AnthonyBloomer/daftlistings
daftlistings/listing.py
https://github.com/AnthonyBloomer/daftlistings/blob/f6c1b52425bc740f443b5efe6632a4bf18ee997f/daftlistings/listing.py#L365-L380
def daft_link(self): """ This method returns the url of the listing. :return: """ try: if self._data_from_search: link = self._data_from_search.find('a', href=True) return 'http://www.daft.ie' + link['href'] else: ...
[ "def", "daft_link", "(", "self", ")", ":", "try", ":", "if", "self", ".", "_data_from_search", ":", "link", "=", "self", ".", "_data_from_search", ".", "find", "(", "'a'", ",", "href", "=", "True", ")", "return", "'http://www.daft.ie'", "+", "link", "[",...
This method returns the url of the listing. :return:
[ "This", "method", "returns", "the", "url", "of", "the", "listing", ".", ":", "return", ":" ]
python
train
zerok/flask-compass
flaskext/compass.py
https://github.com/zerok/flask-compass/blob/633ef4bcbfbf0882a337d84f776b3c090ef5f464/flaskext/compass.py#L92-L104
def _check_configs(self): """ Reloads the configuration files. """ configs = set(self._find_configs()) known_configs = set(self.configs.keys()) new_configs = configs - known_configs for cfg in (known_configs - configs): self.log.debug("Compass configur...
[ "def", "_check_configs", "(", "self", ")", ":", "configs", "=", "set", "(", "self", ".", "_find_configs", "(", ")", ")", "known_configs", "=", "set", "(", "self", ".", "configs", ".", "keys", "(", ")", ")", "new_configs", "=", "configs", "-", "known_co...
Reloads the configuration files.
[ "Reloads", "the", "configuration", "files", "." ]
python
train
bokeh/bokeh
bokeh/core/property/bases.py
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/property/bases.py#L375-L398
def asserts(self, fn, msg_or_fn): ''' Assert that prepared values satisfy given conditions. Assertions are intended in enforce conditions beyond simple value type validation. For instance, this method can be use to assert that the columns of a ``ColumnDataSource`` all collectively have ...
[ "def", "asserts", "(", "self", ",", "fn", ",", "msg_or_fn", ")", ":", "self", ".", "assertions", ".", "append", "(", "(", "fn", ",", "msg_or_fn", ")", ")", "return", "self" ]
Assert that prepared values satisfy given conditions. Assertions are intended in enforce conditions beyond simple value type validation. For instance, this method can be use to assert that the columns of a ``ColumnDataSource`` all collectively have the same length at all times. ...
[ "Assert", "that", "prepared", "values", "satisfy", "given", "conditions", "." ]
python
train
caffeinehit/django-oauth2-provider
provider/views.py
https://github.com/caffeinehit/django-oauth2-provider/blob/6b5bc0d3ad706d2aaa47fa476f38406cddd01236/provider/views.py#L78-L87
def authenticate(self, request): """ Authenticate a client against all the backends configured in :attr:`authentication`. """ for backend in self.authentication: client = backend().authenticate(request) if client is not None: return client ...
[ "def", "authenticate", "(", "self", ",", "request", ")", ":", "for", "backend", "in", "self", ".", "authentication", ":", "client", "=", "backend", "(", ")", ".", "authenticate", "(", "request", ")", "if", "client", "is", "not", "None", ":", "return", ...
Authenticate a client against all the backends configured in :attr:`authentication`.
[ "Authenticate", "a", "client", "against", "all", "the", "backends", "configured", "in", ":", "attr", ":", "authentication", "." ]
python
train
rocky/python-spark
example/python2/py2_scan.py
https://github.com/rocky/python-spark/blob/8899954bcf0e166726841a43e87c23790eb3441f/example/python2/py2_scan.py#L119-L124
def t_name(self, s): r'[A-Za-z_][A-Za-z_0-9]*' if s in RESERVED_WORDS: self.add_token(s.upper(), s) else: self.add_token('NAME', s)
[ "def", "t_name", "(", "self", ",", "s", ")", ":", "if", "s", "in", "RESERVED_WORDS", ":", "self", ".", "add_token", "(", "s", ".", "upper", "(", ")", ",", "s", ")", "else", ":", "self", ".", "add_token", "(", "'NAME'", ",", "s", ")" ]
r'[A-Za-z_][A-Za-z_0-9]*
[ "r", "[", "A", "-", "Za", "-", "z_", "]", "[", "A", "-", "Za", "-", "z_0", "-", "9", "]", "*" ]
python
train
tensorlayer/tensorlayer
tensorlayer/nlp.py
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/nlp.py#L795-L830
def save_vocab(count=None, name='vocab.txt'): """Save the vocabulary to a file so the model can be reloaded. Parameters ---------- count : a list of tuple and list count[0] is a list : the number of rare words, count[1:] are tuples : the number of occurrence of each word, e.g. [...
[ "def", "save_vocab", "(", "count", "=", "None", ",", "name", "=", "'vocab.txt'", ")", ":", "if", "count", "is", "None", ":", "count", "=", "[", "]", "pwd", "=", "os", ".", "getcwd", "(", ")", "vocabulary_size", "=", "len", "(", "count", ")", "with"...
Save the vocabulary to a file so the model can be reloaded. Parameters ---------- count : a list of tuple and list count[0] is a list : the number of rare words, count[1:] are tuples : the number of occurrence of each word, e.g. [['UNK', 418391], (b'the', 1061396), (b'of', 593677), ...
[ "Save", "the", "vocabulary", "to", "a", "file", "so", "the", "model", "can", "be", "reloaded", "." ]
python
valid
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_aaa.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_aaa.py#L587-L596
def banner_login(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") banner = ET.SubElement(config, "banner", xmlns="urn:brocade.com:mgmt:brocade-aaa") login = ET.SubElement(banner, "login") login.text = kwargs.pop('login') callback = kwargs...
[ "def", "banner_login", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "banner", "=", "ET", ".", "SubElement", "(", "config", ",", "\"banner\"", ",", "xmlns", "=", "\"urn:brocade.com:mgmt:brocade...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
sammchardy/python-kucoin
kucoin/client.py
https://github.com/sammchardy/python-kucoin/blob/a4cacde413804784bd313f27a0ad37234888be29/kucoin/client.py#L809-L856
def create_withdrawal(self, currency, amount, address, memo=None, is_inner=False, remark=None): """Process a withdrawal https://docs.kucoin.com/#apply-withdraw :param currency: Name of currency :type currency: string :param amount: Amount to withdraw :type amount: numbe...
[ "def", "create_withdrawal", "(", "self", ",", "currency", ",", "amount", ",", "address", ",", "memo", "=", "None", ",", "is_inner", "=", "False", ",", "remark", "=", "None", ")", ":", "data", "=", "{", "'currency'", ":", "currency", ",", "'amount'", ":...
Process a withdrawal https://docs.kucoin.com/#apply-withdraw :param currency: Name of currency :type currency: string :param amount: Amount to withdraw :type amount: number :param address: Address to withdraw to :type address: string :param memo: (option...
[ "Process", "a", "withdrawal" ]
python
train
manns/pyspread
pyspread/src/lib/vlc.py
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L5855-L5863
def libvlc_video_get_track_description(p_mi): '''Get the description of available video tracks. @param p_mi: media player. @return: list with description of available video tracks, or NULL on error. ''' f = _Cfunctions.get('libvlc_video_get_track_description', None) or \ _Cfunction('libvlc_v...
[ "def", "libvlc_video_get_track_description", "(", "p_mi", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_video_get_track_description'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_video_get_track_description'", ",", "(", "(", "1", ",", ")", "...
Get the description of available video tracks. @param p_mi: media player. @return: list with description of available video tracks, or NULL on error.
[ "Get", "the", "description", "of", "available", "video", "tracks", "." ]
python
train
Nic30/hwt
hwt/serializer/utils.py
https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/serializer/utils.py#L7-L19
def getMaxStmIdForStm(stm): """ Get maximum _instId from all assigments in statement """ maxId = 0 if isinstance(stm, Assignment): return stm._instId elif isinstance(stm, WaitStm): return maxId else: for _stm in stm._iter_stms(): maxId = max(maxId, getMaxS...
[ "def", "getMaxStmIdForStm", "(", "stm", ")", ":", "maxId", "=", "0", "if", "isinstance", "(", "stm", ",", "Assignment", ")", ":", "return", "stm", ".", "_instId", "elif", "isinstance", "(", "stm", ",", "WaitStm", ")", ":", "return", "maxId", "else", ":...
Get maximum _instId from all assigments in statement
[ "Get", "maximum", "_instId", "from", "all", "assigments", "in", "statement" ]
python
test
jmbhughes/suvi-trainer
suvitrainer/gui.py
https://github.com/jmbhughes/suvi-trainer/blob/3d89894a4a037286221974c7eb5634d229b4f5d4/suvitrainer/gui.py#L222-L232
def make_gui(self): """ Setups the general structure of the gui, the first function called """ self.option_window = Toplevel() self.option_window.protocol("WM_DELETE_WINDOW", self.on_exit) self.canvas_frame = tk.Frame(self, height=500) self.option_frame = tk.Frame(self.option_win...
[ "def", "make_gui", "(", "self", ")", ":", "self", ".", "option_window", "=", "Toplevel", "(", ")", "self", ".", "option_window", ".", "protocol", "(", "\"WM_DELETE_WINDOW\"", ",", "self", ".", "on_exit", ")", "self", ".", "canvas_frame", "=", "tk", ".", ...
Setups the general structure of the gui, the first function called
[ "Setups", "the", "general", "structure", "of", "the", "gui", "the", "first", "function", "called" ]
python
train
MKLab-ITI/reveal-user-annotation
reveal_user_annotation/pserver/request.py
https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/pserver/request.py#L63-L86
def delete_features(host_name, client_name, client_pass, feature_names=None): """ Remove a number of numerical features in the client. If a list is not provided, remove all features. Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted. - cli...
[ "def", "delete_features", "(", "host_name", ",", "client_name", ",", "client_pass", ",", "feature_names", "=", "None", ")", ":", "# Get all features.", "if", "feature_names", "is", "None", ":", "feature_names", "=", "get_feature_names", "(", "host_name", ",", "cli...
Remove a number of numerical features in the client. If a list is not provided, remove all features. Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted. - client_name: The PServer client name. - client_pass: The PServer client's passwor...
[ "Remove", "a", "number", "of", "numerical", "features", "in", "the", "client", ".", "If", "a", "list", "is", "not", "provided", "remove", "all", "features", "." ]
python
train
bitcraze/crazyflie-lib-python
cflib/crazyflie/param.py
https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/param.py#L340-L350
def request_param_update(self, var_id): """Place a param update request on the queue""" self._useV2 = self.cf.platform.get_protocol_version() >= 4 pk = CRTPPacket() pk.set_header(CRTPPort.PARAM, READ_CHANNEL) if self._useV2: pk.data = struct.pack('<H', var_id) ...
[ "def", "request_param_update", "(", "self", ",", "var_id", ")", ":", "self", ".", "_useV2", "=", "self", ".", "cf", ".", "platform", ".", "get_protocol_version", "(", ")", ">=", "4", "pk", "=", "CRTPPacket", "(", ")", "pk", ".", "set_header", "(", "CRT...
Place a param update request on the queue
[ "Place", "a", "param", "update", "request", "on", "the", "queue" ]
python
train
python-security/pyt
pyt/cfg/expr_visitor.py
https://github.com/python-security/pyt/blob/efc0cfb716e40e0c8df4098f1cc8cf43723cd31f/pyt/cfg/expr_visitor.py#L331-L362
def create_local_scope_from_def_args( self, call_args, def_args, line_number, saved_function_call_index ): """Create the local scope before entering the body of a function call. Args: call_args(list[ast.Name]): Of the call being made. ...
[ "def", "create_local_scope_from_def_args", "(", "self", ",", "call_args", ",", "def_args", ",", "line_number", ",", "saved_function_call_index", ")", ":", "# Create e.g. def_arg1 = temp_N_def_arg1 for each argument", "for", "i", "in", "range", "(", "len", "(", "call_args"...
Create the local scope before entering the body of a function call. Args: call_args(list[ast.Name]): Of the call being made. def_args(ast_helper.Arguments): Of the definition being called. line_number(int): Of the def of the function call about to be entered into. ...
[ "Create", "the", "local", "scope", "before", "entering", "the", "body", "of", "a", "function", "call", "." ]
python
train
beetbox/audioread
audioread/macca.py
https://github.com/beetbox/audioread/blob/c8bedf7880f13a7b7488b108aaf245d648674818/audioread/macca.py#L299-L325
def read_data(self, blocksize=4096): """Generates byte strings reflecting the audio data in the file. """ frames = ctypes.c_uint(blocksize // self._client_fmt.mBytesPerFrame) buf = ctypes.create_string_buffer(blocksize) buflist = AudioBufferList() buflist.mNumberBuffers ...
[ "def", "read_data", "(", "self", ",", "blocksize", "=", "4096", ")", ":", "frames", "=", "ctypes", ".", "c_uint", "(", "blocksize", "//", "self", ".", "_client_fmt", ".", "mBytesPerFrame", ")", "buf", "=", "ctypes", ".", "create_string_buffer", "(", "block...
Generates byte strings reflecting the audio data in the file.
[ "Generates", "byte", "strings", "reflecting", "the", "audio", "data", "in", "the", "file", "." ]
python
train
JoelBender/bacpypes
py25/bacpypes/core.py
https://github.com/JoelBender/bacpypes/blob/4111b8604a16fa2b7f80d8104a43b9f3e28dfc78/py25/bacpypes/core.py#L66-L95
def print_stack(sig, frame): """Signal handler to print a stack trace and some interesting values.""" if _debug: print_stack._debug("print_stack %r %r", sig, frame) global running, deferredFns, sleeptime sys.stderr.write("==== USR1 Signal, %s\n" % time.strftime("%d-%b-%Y %H:%M:%S")) sys.stderr.wri...
[ "def", "print_stack", "(", "sig", ",", "frame", ")", ":", "if", "_debug", ":", "print_stack", ".", "_debug", "(", "\"print_stack %r %r\"", ",", "sig", ",", "frame", ")", "global", "running", ",", "deferredFns", ",", "sleeptime", "sys", ".", "stderr", ".", ...
Signal handler to print a stack trace and some interesting values.
[ "Signal", "handler", "to", "print", "a", "stack", "trace", "and", "some", "interesting", "values", "." ]
python
train