Unnamed: 0
int64
0
10k
repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
5
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
100
30.3k
language
stringclasses
1 value
func_code_string
stringlengths
100
30.3k
func_code_tokens
stringlengths
138
33.2k
func_documentation_string
stringlengths
1
15k
func_documentation_tokens
stringlengths
5
5.14k
split_name
stringclasses
1 value
func_code_url
stringlengths
91
315
2,500
QInfer/python-qinfer
src/qinfer/smc.py
SMCUpdater.bayes_risk
def bayes_risk(self, expparams): r""" Calculates the Bayes risk for hypothetical experiments, assuming the quadratic loss function defined by the current model's scale matrix (see :attr:`qinfer.abstract_model.Simulatable.Q`). :param expparams: The experiments at which to compute...
python
def bayes_risk(self, expparams): r""" Calculates the Bayes risk for hypothetical experiments, assuming the quadratic loss function defined by the current model's scale matrix (see :attr:`qinfer.abstract_model.Simulatable.Q`). :param expparams: The experiments at which to compute...
['def', 'bayes_risk', '(', 'self', ',', 'expparams', ')', ':', '# for models whose outcome number changes with experiment, we ', '# take the easy way out and for-loop over experiments', 'n_eps', '=', 'expparams', '.', 'size', 'if', 'n_eps', '>', '1', 'and', 'not', 'self', '.', 'model', '.', 'is_n_outcomes_constant', ':...
r""" Calculates the Bayes risk for hypothetical experiments, assuming the quadratic loss function defined by the current model's scale matrix (see :attr:`qinfer.abstract_model.Simulatable.Q`). :param expparams: The experiments at which to compute the risk. :type expparams: :clas...
['r', 'Calculates', 'the', 'Bayes', 'risk', 'for', 'hypothetical', 'experiments', 'assuming', 'the', 'quadratic', 'loss', 'function', 'defined', 'by', 'the', 'current', 'model', 's', 'scale', 'matrix', '(', 'see', ':', 'attr', ':', 'qinfer', '.', 'abstract_model', '.', 'Simulatable', '.', 'Q', ')', '.']
train
https://github.com/QInfer/python-qinfer/blob/8170c84a0be1723f8c6b09e0d3c7a40a886f1fe3/src/qinfer/smc.py#L553-L612
2,501
bunq/sdk_python
bunq/sdk/model/generated/endpoint.py
SofortMerchantTransaction.is_all_field_none
def is_all_field_none(self): """ :rtype: bool """ if self._monetary_account_id is not None: return False if self._alias is not None: return False if self._counterparty_alias is not None: return False if self._amount_guarante...
python
def is_all_field_none(self): """ :rtype: bool """ if self._monetary_account_id is not None: return False if self._alias is not None: return False if self._counterparty_alias is not None: return False if self._amount_guarante...
['def', 'is_all_field_none', '(', 'self', ')', ':', 'if', 'self', '.', '_monetary_account_id', 'is', 'not', 'None', ':', 'return', 'False', 'if', 'self', '.', '_alias', 'is', 'not', 'None', ':', 'return', 'False', 'if', 'self', '.', '_counterparty_alias', 'is', 'not', 'None', ':', 'return', 'False', 'if', 'self', '.', ...
:rtype: bool
[':', 'rtype', ':', 'bool']
train
https://github.com/bunq/sdk_python/blob/da6c9b83e6d83ee8062617f53c6eb7293c0d863d/bunq/sdk/model/generated/endpoint.py#L15194-L15229
2,502
buildbot/buildbot
master/buildbot/www/hooks/gitlab.py
GitLabHandler.getChanges
def getChanges(self, request): """ Reponds only to POST events and starts the build process :arguments: request the http request object """ expected_secret = isinstance(self.options, dict) and self.options.get('secret') if expected_secret: ...
python
def getChanges(self, request): """ Reponds only to POST events and starts the build process :arguments: request the http request object """ expected_secret = isinstance(self.options, dict) and self.options.get('secret') if expected_secret: ...
['def', 'getChanges', '(', 'self', ',', 'request', ')', ':', 'expected_secret', '=', 'isinstance', '(', 'self', '.', 'options', ',', 'dict', ')', 'and', 'self', '.', 'options', '.', 'get', '(', "'secret'", ')', 'if', 'expected_secret', ':', 'received_secret', '=', 'request', '.', 'getHeader', '(', '_HEADER_GITLAB_TOKEN...
Reponds only to POST events and starts the build process :arguments: request the http request object
['Reponds', 'only', 'to', 'POST', 'events', 'and', 'starts', 'the', 'build', 'process']
train
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/www/hooks/gitlab.py#L157-L202
2,503
pypa/setuptools
setuptools/msvc.py
SystemInfo._guess_vc
def _guess_vc(self): """ Locate Visual C for 2017 """ if self.vc_ver <= 14.0: return default = r'VC\Tools\MSVC' guess_vc = os.path.join(self.VSInstallDir, default) # Subdir with VC exact version as name try: vc_exact_ver = os.listd...
python
def _guess_vc(self): """ Locate Visual C for 2017 """ if self.vc_ver <= 14.0: return default = r'VC\Tools\MSVC' guess_vc = os.path.join(self.VSInstallDir, default) # Subdir with VC exact version as name try: vc_exact_ver = os.listd...
['def', '_guess_vc', '(', 'self', ')', ':', 'if', 'self', '.', 'vc_ver', '<=', '14.0', ':', 'return', 'default', '=', "r'VC\\Tools\\MSVC'", 'guess_vc', '=', 'os', '.', 'path', '.', 'join', '(', 'self', '.', 'VSInstallDir', ',', 'default', ')', '# Subdir with VC exact version as name', 'try', ':', 'vc_exact_ver', '=', '...
Locate Visual C for 2017
['Locate', 'Visual', 'C', 'for', '2017']
train
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/msvc.py#L559-L573
2,504
twilio/twilio-python
twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py
WorkflowCumulativeStatisticsList.get
def get(self): """ Constructs a WorkflowCumulativeStatisticsContext :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsContext :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumul...
python
def get(self): """ Constructs a WorkflowCumulativeStatisticsContext :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsContext :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumul...
['def', 'get', '(', 'self', ')', ':', 'return', 'WorkflowCumulativeStatisticsContext', '(', 'self', '.', '_version', ',', 'workspace_sid', '=', 'self', '.', '_solution', '[', "'workspace_sid'", ']', ',', 'workflow_sid', '=', 'self', '.', '_solution', '[', "'workflow_sid'", ']', ',', ')']
Constructs a WorkflowCumulativeStatisticsContext :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsContext :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsContext
['Constructs', 'a', 'WorkflowCumulativeStatisticsContext']
train
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py#L37-L48
2,505
saltstack/salt
salt/cloud/libcloudfuncs.py
get_node
def get_node(conn, name): ''' Return a libcloud node for the named VM ''' nodes = conn.list_nodes() for node in nodes: if node.name == name: __utils__['cloud.cache_node'](salt.utils.data.simple_types_filter(node.__dict__), __active_provider_name__, __opts__) return no...
python
def get_node(conn, name): ''' Return a libcloud node for the named VM ''' nodes = conn.list_nodes() for node in nodes: if node.name == name: __utils__['cloud.cache_node'](salt.utils.data.simple_types_filter(node.__dict__), __active_provider_name__, __opts__) return no...
['def', 'get_node', '(', 'conn', ',', 'name', ')', ':', 'nodes', '=', 'conn', '.', 'list_nodes', '(', ')', 'for', 'node', 'in', 'nodes', ':', 'if', 'node', '.', 'name', '==', 'name', ':', '__utils__', '[', "'cloud.cache_node'", ']', '(', 'salt', '.', 'utils', '.', 'data', '.', 'simple_types_filter', '(', 'node', '.', '...
Return a libcloud node for the named VM
['Return', 'a', 'libcloud', 'node', 'for', 'the', 'named', 'VM']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/libcloudfuncs.py#L118-L126
2,506
skylander86/ycsettings
ycsettings/settings.py
Settings._load_settings_from_source
def _load_settings_from_source(self, source): """ Loads the relevant settings from the specified ``source``. :returns: a standard :func:`dict` containing the settings from the source :rtype: dict """ if not source: pass elif source == 'env_settings_ur...
python
def _load_settings_from_source(self, source): """ Loads the relevant settings from the specified ``source``. :returns: a standard :func:`dict` containing the settings from the source :rtype: dict """ if not source: pass elif source == 'env_settings_ur...
['def', '_load_settings_from_source', '(', 'self', ',', 'source', ')', ':', 'if', 'not', 'source', ':', 'pass', 'elif', 'source', '==', "'env_settings_uri'", ':', 'for', 'env_settings_uri_key', 'in', 'self', '.', 'env_settings_uri_keys', ':', 'env_settings_uri', '=', 'self', '.', '_search_environ', '(', 'env_settings_u...
Loads the relevant settings from the specified ``source``. :returns: a standard :func:`dict` containing the settings from the source :rtype: dict
['Loads', 'the', 'relevant', 'settings', 'from', 'the', 'specified', 'source', '.']
train
https://github.com/skylander86/ycsettings/blob/3f363673a6cb1823ebb18c4d640d87aa49202344/ycsettings/settings.py#L93-L158
2,507
pyvisa/pyvisa
pyvisa/resources/resource.py
Resource.enable_event
def enable_event(self, event_type, mechanism, context=None): """Enable event occurrences for specified event types and mechanisms in this resource. :param event_type: Logical event identifier. :param mechanism: Specifies event handling mechanisms to be enabled. (Consta...
python
def enable_event(self, event_type, mechanism, context=None): """Enable event occurrences for specified event types and mechanisms in this resource. :param event_type: Logical event identifier. :param mechanism: Specifies event handling mechanisms to be enabled. (Consta...
['def', 'enable_event', '(', 'self', ',', 'event_type', ',', 'mechanism', ',', 'context', '=', 'None', ')', ':', 'self', '.', 'visalib', '.', 'enable_event', '(', 'self', '.', 'session', ',', 'event_type', ',', 'mechanism', ',', 'context', ')']
Enable event occurrences for specified event types and mechanisms in this resource. :param event_type: Logical event identifier. :param mechanism: Specifies event handling mechanisms to be enabled. (Constants.VI_QUEUE, .VI_HNDLR, .VI_SUSPEND_HNDLR) :param context: Not...
['Enable', 'event', 'occurrences', 'for', 'specified', 'event', 'types', 'and', 'mechanisms', 'in', 'this', 'resource', '.']
train
https://github.com/pyvisa/pyvisa/blob/b8b2d4371e1f00782856aa9176ff1ced6bcb3798/pyvisa/resources/resource.py#L321-L329
2,508
manns/pyspread
pyspread/src/lib/_grid_cairo_renderer.py
CellBorders.get_r
def get_r(self): """Returns the right border of the cell""" start_point, end_point = self._get_right_line_coordinates() width = self._get_right_line_width() color = self._get_right_line_color() return CellBorder(start_point, end_point, width, color)
python
def get_r(self): """Returns the right border of the cell""" start_point, end_point = self._get_right_line_coordinates() width = self._get_right_line_width() color = self._get_right_line_color() return CellBorder(start_point, end_point, width, color)
['def', 'get_r', '(', 'self', ')', ':', 'start_point', ',', 'end_point', '=', 'self', '.', '_get_right_line_coordinates', '(', ')', 'width', '=', 'self', '.', '_get_right_line_width', '(', ')', 'color', '=', 'self', '.', '_get_right_line_color', '(', ')', 'return', 'CellBorder', '(', 'start_point', ',', 'end_point', ',...
Returns the right border of the cell
['Returns', 'the', 'right', 'border', 'of', 'the', 'cell']
train
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1202-L1209
2,509
humilis/humilis-lambdautils
lambdautils/kinesis.py
send_to_kinesis_stream
def send_to_kinesis_stream(events, stream_name, partition_key=None, packer=None, serializer=json.dumps): """Sends events to a Kinesis stream.""" if not events: logger.info("No events provided: nothing delivered to Firehose") return records = [] for event in ev...
python
def send_to_kinesis_stream(events, stream_name, partition_key=None, packer=None, serializer=json.dumps): """Sends events to a Kinesis stream.""" if not events: logger.info("No events provided: nothing delivered to Firehose") return records = [] for event in ev...
['def', 'send_to_kinesis_stream', '(', 'events', ',', 'stream_name', ',', 'partition_key', '=', 'None', ',', 'packer', '=', 'None', ',', 'serializer', '=', 'json', '.', 'dumps', ')', ':', 'if', 'not', 'events', ':', 'logger', '.', 'info', '(', '"No events provided: nothing delivered to Firehose"', ')', 'return', 'recor...
Sends events to a Kinesis stream.
['Sends', 'events', 'to', 'a', 'Kinesis', 'stream', '.']
train
https://github.com/humilis/humilis-lambdautils/blob/58f75eb5ace23523c283708d56a9193181ea7e8e/lambdautils/kinesis.py#L108-L136
2,510
saltstack/salt
salt/modules/pagerduty_util.py
get_escalation_policies
def get_escalation_policies(profile='pagerduty', subdomain=None, api_key=None): ''' List escalation_policies belonging to this account CLI Example: salt myminion pagerduty.get_escalation_policies ''' return _list_items( 'escalation_policies', 'id', profile=profile,...
python
def get_escalation_policies(profile='pagerduty', subdomain=None, api_key=None): ''' List escalation_policies belonging to this account CLI Example: salt myminion pagerduty.get_escalation_policies ''' return _list_items( 'escalation_policies', 'id', profile=profile,...
['def', 'get_escalation_policies', '(', 'profile', '=', "'pagerduty'", ',', 'subdomain', '=', 'None', ',', 'api_key', '=', 'None', ')', ':', 'return', '_list_items', '(', "'escalation_policies'", ',', "'id'", ',', 'profile', '=', 'profile', ',', 'subdomain', '=', 'subdomain', ',', 'api_key', '=', 'api_key', ',', ')']
List escalation_policies belonging to this account CLI Example: salt myminion pagerduty.get_escalation_policies
['List', 'escalation_policies', 'belonging', 'to', 'this', 'account']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pagerduty_util.py#L88-L103
2,511
twisted/epsilon
epsilon/expose.py
Exposer.get
def get(self, obj, key): """ Retrieve 'key' from an instance of a class which previously exposed it. @param key: a hashable object, previously passed to L{Exposer.expose}. @return: the object which was exposed with the given name on obj's key. @raise MethodNotExposed: when the...
python
def get(self, obj, key): """ Retrieve 'key' from an instance of a class which previously exposed it. @param key: a hashable object, previously passed to L{Exposer.expose}. @return: the object which was exposed with the given name on obj's key. @raise MethodNotExposed: when the...
['def', 'get', '(', 'self', ',', 'obj', ',', 'key', ')', ':', 'if', 'key', 'not', 'in', 'self', '.', '_exposed', ':', 'raise', 'MethodNotExposed', '(', ')', 'rightFuncs', '=', 'self', '.', '_exposed', '[', 'key', ']', 'T', '=', 'obj', '.', '__class__', 'seen', '=', '{', '}', 'for', 'subT', 'in', 'inspect', '.', 'getmro...
Retrieve 'key' from an instance of a class which previously exposed it. @param key: a hashable object, previously passed to L{Exposer.expose}. @return: the object which was exposed with the given name on obj's key. @raise MethodNotExposed: when the key in question was not exposed with ...
['Retrieve', 'key', 'from', 'an', 'instance', 'of', 'a', 'class', 'which', 'previously', 'exposed', 'it', '.']
train
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/expose.py#L117-L141
2,512
mayfield/shellish
shellish/data.py
ttl_cache
def ttl_cache(maxage, maxsize=128): """ A time-to-live caching decorator that follows after the style of lru_cache. The `maxage` argument is time-to-live in seconds for each cache result. Any cache entries over the maxage are lazily replaced. """ def decorator(inner_func): wrapper = make_ttl_...
python
def ttl_cache(maxage, maxsize=128): """ A time-to-live caching decorator that follows after the style of lru_cache. The `maxage` argument is time-to-live in seconds for each cache result. Any cache entries over the maxage are lazily replaced. """ def decorator(inner_func): wrapper = make_ttl_...
['def', 'ttl_cache', '(', 'maxage', ',', 'maxsize', '=', '128', ')', ':', 'def', 'decorator', '(', 'inner_func', ')', ':', 'wrapper', '=', 'make_ttl_cache_wrapper', '(', 'inner_func', ',', 'maxage', ',', 'maxsize', ')', 'return', 'functools', '.', 'update_wrapper', '(', 'wrapper', ',', 'inner_func', ')', 'return', 'dec...
A time-to-live caching decorator that follows after the style of lru_cache. The `maxage` argument is time-to-live in seconds for each cache result. Any cache entries over the maxage are lazily replaced.
['A', 'time', '-', 'to', '-', 'live', 'caching', 'decorator', 'that', 'follows', 'after', 'the', 'style', 'of', 'lru_cache', '.', 'The', 'maxage', 'argument', 'is', 'time', '-', 'to', '-', 'live', 'in', 'seconds', 'for', 'each', 'cache', 'result', '.', 'Any', 'cache', 'entries', 'over', 'the', 'maxage', 'are', 'lazily'...
train
https://github.com/mayfield/shellish/blob/df0f0e4612d138c34d8cb99b66ab5b8e47f1414a/shellish/data.py#L207-L215
2,513
christophertbrown/bioscripts
ctbBio/compare_aligned.py
to_dictionary
def to_dictionary(pw, print_list): """ - convert list of comparisons to dictionary - print list of pidents (if requested) to stderr """ pairs = {} for p in pw: a, b, pident = p if a not in pairs: pairs[a] = {a: '-'} if b not in pairs: pairs[b] = {b...
python
def to_dictionary(pw, print_list): """ - convert list of comparisons to dictionary - print list of pidents (if requested) to stderr """ pairs = {} for p in pw: a, b, pident = p if a not in pairs: pairs[a] = {a: '-'} if b not in pairs: pairs[b] = {b...
['def', 'to_dictionary', '(', 'pw', ',', 'print_list', ')', ':', 'pairs', '=', '{', '}', 'for', 'p', 'in', 'pw', ':', 'a', ',', 'b', ',', 'pident', '=', 'p', 'if', 'a', 'not', 'in', 'pairs', ':', 'pairs', '[', 'a', ']', '=', '{', 'a', ':', "'-'", '}', 'if', 'b', 'not', 'in', 'pairs', ':', 'pairs', '[', 'b', ']', '=', '...
- convert list of comparisons to dictionary - print list of pidents (if requested) to stderr
['-', 'convert', 'list', 'of', 'comparisons', 'to', 'dictionary', '-', 'print', 'list', 'of', 'pidents', '(', 'if', 'requested', ')', 'to', 'stderr']
train
https://github.com/christophertbrown/bioscripts/blob/83b2566b3a5745437ec651cd6cafddd056846240/ctbBio/compare_aligned.py#L112-L130
2,514
Cito/DBUtils
DBUtils/SteadyDB.py
SteadyDBCursor.close
def close(self): """Close the tough cursor. It will not complain if you close it more than once. """ if not self._closed: try: self._cursor.close() except Exception: pass self._closed = True
python
def close(self): """Close the tough cursor. It will not complain if you close it more than once. """ if not self._closed: try: self._cursor.close() except Exception: pass self._closed = True
['def', 'close', '(', 'self', ')', ':', 'if', 'not', 'self', '.', '_closed', ':', 'try', ':', 'self', '.', '_cursor', '.', 'close', '(', ')', 'except', 'Exception', ':', 'pass', 'self', '.', '_closed', '=', 'True']
Close the tough cursor. It will not complain if you close it more than once.
['Close', 'the', 'tough', 'cursor', '.']
train
https://github.com/Cito/DBUtils/blob/90e8825e038f08c82044b8e50831480175fa026a/DBUtils/SteadyDB.py#L576-L587
2,515
manns/pyspread
pyspread/src/lib/vlc.py
libvlc_media_library_media_list
def libvlc_media_library_media_list(p_mlib): '''Get media library subitems. @param p_mlib: media library object. @return: media list subitems. ''' f = _Cfunctions.get('libvlc_media_library_media_list', None) or \ _Cfunction('libvlc_media_library_media_list', ((1,),), class_result(MediaList),...
python
def libvlc_media_library_media_list(p_mlib): '''Get media library subitems. @param p_mlib: media library object. @return: media list subitems. ''' f = _Cfunctions.get('libvlc_media_library_media_list', None) or \ _Cfunction('libvlc_media_library_media_list', ((1,),), class_result(MediaList),...
['def', 'libvlc_media_library_media_list', '(', 'p_mlib', ')', ':', 'f', '=', '_Cfunctions', '.', 'get', '(', "'libvlc_media_library_media_list'", ',', 'None', ')', 'or', '_Cfunction', '(', "'libvlc_media_library_media_list'", ',', '(', '(', '1', ',', ')', ',', ')', ',', 'class_result', '(', 'MediaList', ')', ',', 'cty...
Get media library subitems. @param p_mlib: media library object. @return: media list subitems.
['Get', 'media', 'library', 'subitems', '.']
train
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/vlc.py#L4592-L4600
2,516
aiscenblue/flask-blueprint
flask_blueprint/package_extractor.py
PackageExtractor.__extract_modules
def __extract_modules(self, loader, name, is_pkg): """ if module found load module and save all attributes in the module found """ mod = loader.find_module(name).load_module(name) """ find the attribute method on each module """ if hasattr(mod, '__method__'): """ register ...
python
def __extract_modules(self, loader, name, is_pkg): """ if module found load module and save all attributes in the module found """ mod = loader.find_module(name).load_module(name) """ find the attribute method on each module """ if hasattr(mod, '__method__'): """ register ...
['def', '__extract_modules', '(', 'self', ',', 'loader', ',', 'name', ',', 'is_pkg', ')', ':', 'mod', '=', 'loader', '.', 'find_module', '(', 'name', ')', '.', 'load_module', '(', 'name', ')', '""" find the attribute method on each module """', 'if', 'hasattr', '(', 'mod', ',', "'__method__'", ')', ':', '""" register t...
if module found load module and save all attributes in the module found
['if', 'module', 'found', 'load', 'module', 'and', 'save', 'all', 'attributes', 'in', 'the', 'module', 'found']
train
https://github.com/aiscenblue/flask-blueprint/blob/c558d9d5d9630bab53c297ce2c33f4ceb3874724/flask_blueprint/package_extractor.py#L59-L78
2,517
kpdyer/regex2dfa
third_party/re2/lib/codereview/codereview.py
mail
def mail(ui, repo, *pats, **opts): """mail a change for review Uploads a patch to the code review server and then sends mail to the reviewer and CC list asking for a review. """ if codereview_disabled: raise hg_util.Abort(codereview_disabled) cl, err = CommandLineCL(ui, repo, pats, opts, op="mail", defaultcc=...
python
def mail(ui, repo, *pats, **opts): """mail a change for review Uploads a patch to the code review server and then sends mail to the reviewer and CC list asking for a review. """ if codereview_disabled: raise hg_util.Abort(codereview_disabled) cl, err = CommandLineCL(ui, repo, pats, opts, op="mail", defaultcc=...
['def', 'mail', '(', 'ui', ',', 'repo', ',', '*', 'pats', ',', '*', '*', 'opts', ')', ':', 'if', 'codereview_disabled', ':', 'raise', 'hg_util', '.', 'Abort', '(', 'codereview_disabled', ')', 'cl', ',', 'err', '=', 'CommandLineCL', '(', 'ui', ',', 'repo', ',', 'pats', ',', 'opts', ',', 'op', '=', '"mail"', ',', 'defaul...
mail a change for review Uploads a patch to the code review server and then sends mail to the reviewer and CC list asking for a review.
['mail', 'a', 'change', 'for', 'review']
train
https://github.com/kpdyer/regex2dfa/blob/109f877e60ef0dfcb430f11516d215930b7b9936/third_party/re2/lib/codereview/codereview.py#L1811-L1838
2,518
kevinconway/daemons
daemons/daemonize/simple.py
SimpleDaemonizeManager.daemonize
def daemonize(self): """Double fork and set the pid.""" self._double_fork() # Write pidfile. self.pid = os.getpid() LOG.info( "Succesfully daemonized process {0}.".format(self.pid) )
python
def daemonize(self): """Double fork and set the pid.""" self._double_fork() # Write pidfile. self.pid = os.getpid() LOG.info( "Succesfully daemonized process {0}.".format(self.pid) )
['def', 'daemonize', '(', 'self', ')', ':', 'self', '.', '_double_fork', '(', ')', '# Write pidfile.', 'self', '.', 'pid', '=', 'os', '.', 'getpid', '(', ')', 'LOG', '.', 'info', '(', '"Succesfully daemonized process {0}."', '.', 'format', '(', 'self', '.', 'pid', ')', ')']
Double fork and set the pid.
['Double', 'fork', 'and', 'set', 'the', 'pid', '.']
train
https://github.com/kevinconway/daemons/blob/b0fe0db5821171a35aa9078596d19d630c570b38/daemons/daemonize/simple.py#L22-L31
2,519
pydata/xarray
xarray/core/indexing.py
get_indexer_nd
def get_indexer_nd(index, labels, method=None, tolerance=None): """ Call pd.Index.get_indexer(labels). """ kwargs = _index_method_kwargs(method, tolerance) flat_labels = np.ravel(labels) flat_indexer = index.get_indexer(flat_labels, **kwargs) indexer = flat_indexer.reshape(labels.shape) return ...
python
def get_indexer_nd(index, labels, method=None, tolerance=None): """ Call pd.Index.get_indexer(labels). """ kwargs = _index_method_kwargs(method, tolerance) flat_labels = np.ravel(labels) flat_indexer = index.get_indexer(flat_labels, **kwargs) indexer = flat_indexer.reshape(labels.shape) return ...
['def', 'get_indexer_nd', '(', 'index', ',', 'labels', ',', 'method', '=', 'None', ',', 'tolerance', '=', 'None', ')', ':', 'kwargs', '=', '_index_method_kwargs', '(', 'method', ',', 'tolerance', ')', 'flat_labels', '=', 'np', '.', 'ravel', '(', 'labels', ')', 'flat_indexer', '=', 'index', '.', 'get_indexer', '(', 'fla...
Call pd.Index.get_indexer(labels).
['Call', 'pd', '.', 'Index', '.', 'get_indexer', '(', 'labels', ')', '.']
train
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/indexing.py#L111-L118
2,520
census-instrumentation/opencensus-python
contrib/opencensus-ext-stackdriver/opencensus/ext/stackdriver/stats_exporter/__init__.py
set_attribute_label
def set_attribute_label(series, resource_labels, attribute_key, canonical_key=None, label_value_prefix=''): """Set a label to timeseries that can be used for monitoring :param series: TimeSeries object based on view data :param resource_labels: collection of labels :param attribu...
python
def set_attribute_label(series, resource_labels, attribute_key, canonical_key=None, label_value_prefix=''): """Set a label to timeseries that can be used for monitoring :param series: TimeSeries object based on view data :param resource_labels: collection of labels :param attribu...
['def', 'set_attribute_label', '(', 'series', ',', 'resource_labels', ',', 'attribute_key', ',', 'canonical_key', '=', 'None', ',', 'label_value_prefix', '=', "''", ')', ':', 'if', 'attribute_key', 'in', 'resource_labels', ':', 'if', 'canonical_key', 'is', 'None', ':', 'canonical_key', '=', 'attribute_key', 'series', '...
Set a label to timeseries that can be used for monitoring :param series: TimeSeries object based on view data :param resource_labels: collection of labels :param attribute_key: actual label key :param canonical_key: exporter specific label key, Optional :param label_value_prefix: exporter specific l...
['Set', 'a', 'label', 'to', 'timeseries', 'that', 'can', 'be', 'used', 'for', 'monitoring', ':', 'param', 'series', ':', 'TimeSeries', 'object', 'based', 'on', 'view', 'data', ':', 'param', 'resource_labels', ':', 'collection', 'of', 'labels', ':', 'param', 'attribute_key', ':', 'actual', 'label', 'key', ':', 'param', ...
train
https://github.com/census-instrumentation/opencensus-python/blob/992b223f7e34c5dcb65922b7d5c827e7a1351e7d/contrib/opencensus-ext-stackdriver/opencensus/ext/stackdriver/stats_exporter/__init__.py#L344-L358
2,521
splunk/splunk-sdk-python
examples/analytics/bottle.py
BaseTemplate.global_config
def global_config(cls, key, *args): ''' This reads or sets the global settings stored in class.settings. ''' if args: cls.settings[key] = args[0] else: return cls.settings[key]
python
def global_config(cls, key, *args): ''' This reads or sets the global settings stored in class.settings. ''' if args: cls.settings[key] = args[0] else: return cls.settings[key]
['def', 'global_config', '(', 'cls', ',', 'key', ',', '*', 'args', ')', ':', 'if', 'args', ':', 'cls', '.', 'settings', '[', 'key', ']', '=', 'args', '[', '0', ']', 'else', ':', 'return', 'cls', '.', 'settings', '[', 'key', ']']
This reads or sets the global settings stored in class.settings.
['This', 'reads', 'or', 'sets', 'the', 'global', 'settings', 'stored', 'in', 'class', '.', 'settings', '.']
train
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/analytics/bottle.py#L2137-L2142
2,522
phareous/insteonlocal
insteonlocal/Hub.py
Hub.id_request
def id_request(self, device_id): """Get the device for the ID. ID request can return device type (cat/subcat), firmware ver, etc. Cat is status['is_high'], sub cat is status['id_mid']""" self.logger.info("\nid_request for device %s", device_id) device_id = device_id.upper() self...
python
def id_request(self, device_id): """Get the device for the ID. ID request can return device type (cat/subcat), firmware ver, etc. Cat is status['is_high'], sub cat is status['id_mid']""" self.logger.info("\nid_request for device %s", device_id) device_id = device_id.upper() self...
['def', 'id_request', '(', 'self', ',', 'device_id', ')', ':', 'self', '.', 'logger', '.', 'info', '(', '"\\nid_request for device %s"', ',', 'device_id', ')', 'device_id', '=', 'device_id', '.', 'upper', '(', ')', 'self', '.', 'direct_command', '(', 'device_id', ',', "'10'", ',', "'00'", ')', 'sleep', '(', '2', ')', '...
Get the device for the ID. ID request can return device type (cat/subcat), firmware ver, etc. Cat is status['is_high'], sub cat is status['id_mid']
['Get', 'the', 'device', 'for', 'the', 'ID', '.', 'ID', 'request', 'can', 'return', 'device', 'type', '(', 'cat', '/', 'subcat', ')', 'firmware', 'ver', 'etc', '.', 'Cat', 'is', 'status', '[', 'is_high', ']', 'sub', 'cat', 'is', 'status', '[', 'id_mid', ']']
train
https://github.com/phareous/insteonlocal/blob/a4544a17d143fb285852cb873e862c270d55dd00/insteonlocal/Hub.py#L301-L316
2,523
foremast/foremast
src/foremast/s3/create_archaius.py
init_properties
def init_properties(env='dev', app='unnecessary', **_): """Make sure _application.properties_ file exists in S3. For Applications with Archaius support, there needs to be a file where the cloud environment variable points to. Args: env (str): Deployment environment/account, i.e. dev, stage, pr...
python
def init_properties(env='dev', app='unnecessary', **_): """Make sure _application.properties_ file exists in S3. For Applications with Archaius support, there needs to be a file where the cloud environment variable points to. Args: env (str): Deployment environment/account, i.e. dev, stage, pr...
['def', 'init_properties', '(', 'env', '=', "'dev'", ',', 'app', '=', "'unnecessary'", ',', '*', '*', '_', ')', ':', 'aws_env', '=', 'boto3', '.', 'session', '.', 'Session', '(', 'profile_name', '=', 'env', ')', 's3client', '=', 'aws_env', '.', 'resource', '(', "'s3'", ')', 'generated', '=', 'get_details', '(', 'app', ...
Make sure _application.properties_ file exists in S3. For Applications with Archaius support, there needs to be a file where the cloud environment variable points to. Args: env (str): Deployment environment/account, i.e. dev, stage, prod. app (str): GitLab Project name. Returns: ...
['Make', 'sure', '_application', '.', 'properties_', 'file', 'exists', 'in', 'S3', '.']
train
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/s3/create_archaius.py#L26-L55
2,524
materialsproject/pymatgen
pymatgen/command_line/critic2_caller.py
Critic2Output._add_edge
def _add_edge(self, idx, from_idx, from_lvec, to_idx, to_lvec): """ Add information about an edge linking two critical points. This actually describes two edges: from_idx ------ idx ------ to_idx However, in practice, from_idx and to_idx will typically be atom nuclei, ...
python
def _add_edge(self, idx, from_idx, from_lvec, to_idx, to_lvec): """ Add information about an edge linking two critical points. This actually describes two edges: from_idx ------ idx ------ to_idx However, in practice, from_idx and to_idx will typically be atom nuclei, ...
['def', '_add_edge', '(', 'self', ',', 'idx', ',', 'from_idx', ',', 'from_lvec', ',', 'to_idx', ',', 'to_lvec', ')', ':', 'self', '.', 'edges', '[', 'idx', ']', '=', '{', "'from_idx'", ':', 'from_idx', ',', "'from_lvec'", ':', 'from_lvec', ',', "'to_idx'", ':', 'to_idx', ',', "'to_lvec'", ':', 'to_lvec', '}']
Add information about an edge linking two critical points. This actually describes two edges: from_idx ------ idx ------ to_idx However, in practice, from_idx and to_idx will typically be atom nuclei, with the center node (idx) referring to a bond critical point. Thus, it will...
['Add', 'information', 'about', 'an', 'edge', 'linking', 'two', 'critical', 'points', '.']
train
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/critic2_caller.py#L541-L565
2,525
lobocv/pyperform
pyperform/customlogger.py
new_log_level
def new_log_level(level, name, logger_name=None): """ Quick way to create a custom log level that behaves like the default levels in the logging module. :param level: level number :param name: level name :param logger_name: optional logger name """ @CustomLogLevel(level, name, logger_name) ...
python
def new_log_level(level, name, logger_name=None): """ Quick way to create a custom log level that behaves like the default levels in the logging module. :param level: level number :param name: level name :param logger_name: optional logger name """ @CustomLogLevel(level, name, logger_name) ...
['def', 'new_log_level', '(', 'level', ',', 'name', ',', 'logger_name', '=', 'None', ')', ':', '@', 'CustomLogLevel', '(', 'level', ',', 'name', ',', 'logger_name', ')', 'def', '_default_template', '(', 'logger', ',', 'msg', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'return', 'msg', ',', 'args', ',', 'kwargs...
Quick way to create a custom log level that behaves like the default levels in the logging module. :param level: level number :param name: level name :param logger_name: optional logger name
['Quick', 'way', 'to', 'create', 'a', 'custom', 'log', 'level', 'that', 'behaves', 'like', 'the', 'default', 'levels', 'in', 'the', 'logging', 'module', '.', ':', 'param', 'level', ':', 'level', 'number', ':', 'param', 'name', ':', 'level', 'name', ':', 'param', 'logger_name', ':', 'optional', 'logger', 'name']
train
https://github.com/lobocv/pyperform/blob/97d87e8b9ddb35bd8f2a6782965fd7735ab0349f/pyperform/customlogger.py#L40-L49
2,526
RedHatInsights/insights-core
insights/client/__init__.py
InsightsClient.delete_cached_branch_info
def delete_cached_branch_info(self): ''' Deletes cached branch_info file ''' if os.path.isfile(constants.cached_branch_info): logger.debug('Deleting cached branch_info file...') os.remove(constants.cached_branch_info) else: logger.debug('Ca...
python
def delete_cached_branch_info(self): ''' Deletes cached branch_info file ''' if os.path.isfile(constants.cached_branch_info): logger.debug('Deleting cached branch_info file...') os.remove(constants.cached_branch_info) else: logger.debug('Ca...
['def', 'delete_cached_branch_info', '(', 'self', ')', ':', 'if', 'os', '.', 'path', '.', 'isfile', '(', 'constants', '.', 'cached_branch_info', ')', ':', 'logger', '.', 'debug', '(', "'Deleting cached branch_info file...'", ')', 'os', '.', 'remove', '(', 'constants', '.', 'cached_branch_info', ')', 'else', ':', 'logge...
Deletes cached branch_info file
['Deletes', 'cached', 'branch_info', 'file']
train
https://github.com/RedHatInsights/insights-core/blob/b57cbf8ed7c089672426ede0441e0a4f789ef4a1/insights/client/__init__.py#L465-L473
2,527
AnimusPEXUS/wayround_i2p_carafe
wayround_i2p/carafe/carafe.py
Router.add2
def add2(self, target, path_settings, method): """ add() with reordered paameters """ return self.add(method, path_settings, target)
python
def add2(self, target, path_settings, method): """ add() with reordered paameters """ return self.add(method, path_settings, target)
['def', 'add2', '(', 'self', ',', 'target', ',', 'path_settings', ',', 'method', ')', ':', 'return', 'self', '.', 'add', '(', 'method', ',', 'path_settings', ',', 'target', ')']
add() with reordered paameters
['add', '()', 'with', 'reordered', 'paameters']
train
https://github.com/AnimusPEXUS/wayround_i2p_carafe/blob/c92a72e1f7b559ac0bd6dc0ce2716ce1e61a9c5e/wayround_i2p/carafe/carafe.py#L198-L202
2,528
tonybaloney/wily
wily/state.py
Index.save
def save(self): """Save the index data back to the wily cache.""" data = [i.asdict() for i in self._revisions.values()] logger.debug("Saving data") cache.store_archiver_index(self.config, self.archiver, data)
python
def save(self): """Save the index data back to the wily cache.""" data = [i.asdict() for i in self._revisions.values()] logger.debug("Saving data") cache.store_archiver_index(self.config, self.archiver, data)
['def', 'save', '(', 'self', ')', ':', 'data', '=', '[', 'i', '.', 'asdict', '(', ')', 'for', 'i', 'in', 'self', '.', '_revisions', '.', 'values', '(', ')', ']', 'logger', '.', 'debug', '(', '"Saving data"', ')', 'cache', '.', 'store_archiver_index', '(', 'self', '.', 'config', ',', 'self', '.', 'archiver', ',', 'data'...
Save the index data back to the wily cache.
['Save', 'the', 'index', 'data', 'back', 'to', 'the', 'wily', 'cache', '.']
train
https://github.com/tonybaloney/wily/blob/bae259354a91b57d56603f0ca7403186f086a84c/wily/state.py#L168-L172
2,529
deontologician/restnavigator
restnavigator/halnav.py
APICore.get_cached
def get_cached(self, link, default=None): '''Retrieves a cached navigator from the id_map. Either a Link object or a bare uri string may be passed in.''' if hasattr(link, 'uri'): return self.id_map.get(link.uri, default) else: return self.id_map.get(link, default...
python
def get_cached(self, link, default=None): '''Retrieves a cached navigator from the id_map. Either a Link object or a bare uri string may be passed in.''' if hasattr(link, 'uri'): return self.id_map.get(link.uri, default) else: return self.id_map.get(link, default...
['def', 'get_cached', '(', 'self', ',', 'link', ',', 'default', '=', 'None', ')', ':', 'if', 'hasattr', '(', 'link', ',', "'uri'", ')', ':', 'return', 'self', '.', 'id_map', '.', 'get', '(', 'link', '.', 'uri', ',', 'default', ')', 'else', ':', 'return', 'self', '.', 'id_map', '.', 'get', '(', 'link', ',', 'default', '...
Retrieves a cached navigator from the id_map. Either a Link object or a bare uri string may be passed in.
['Retrieves', 'a', 'cached', 'navigator', 'from', 'the', 'id_map', '.']
train
https://github.com/deontologician/restnavigator/blob/453b9de4e70e602009d3e3ffafcf77d23c8b07c5/restnavigator/halnav.py#L73-L80
2,530
coins13/twins
twins/misc.py
get_nendo
def get_nendo (): """今は何年度?""" y, m = map(int, time.strftime("%Y %m").split()) return y if m >= 4 else y - 1
python
def get_nendo (): """今は何年度?""" y, m = map(int, time.strftime("%Y %m").split()) return y if m >= 4 else y - 1
['def', 'get_nendo', '(', ')', ':', 'y', ',', 'm', '=', 'map', '(', 'int', ',', 'time', '.', 'strftime', '(', '"%Y %m"', ')', '.', 'split', '(', ')', ')', 'return', 'y', 'if', 'm', '>=', '4', 'else', 'y', '-', '1']
今は何年度?
['今は何年度?']
train
https://github.com/coins13/twins/blob/d66cc850007a25f01812a9d8c7e3efe64a631ca2/twins/misc.py#L5-L8
2,531
mozilla/build-mar
src/mardor/cli.py
do_add_signature
def do_add_signature(input_file, output_file, signature_file): """Add a signature to the MAR file.""" signature = open(signature_file, 'rb').read() if len(signature) == 256: hash_algo = 'sha1' elif len(signature) == 512: hash_algo = 'sha384' else: raise ValueError() with...
python
def do_add_signature(input_file, output_file, signature_file): """Add a signature to the MAR file.""" signature = open(signature_file, 'rb').read() if len(signature) == 256: hash_algo = 'sha1' elif len(signature) == 512: hash_algo = 'sha384' else: raise ValueError() with...
['def', 'do_add_signature', '(', 'input_file', ',', 'output_file', ',', 'signature_file', ')', ':', 'signature', '=', 'open', '(', 'signature_file', ',', "'rb'", ')', '.', 'read', '(', ')', 'if', 'len', '(', 'signature', ')', '==', '256', ':', 'hash_algo', '=', "'sha1'", 'elif', 'len', '(', 'signature', ')', '==', '512...
Add a signature to the MAR file.
['Add', 'a', 'signature', 'to', 'the', 'MAR', 'file', '.']
train
https://github.com/mozilla/build-mar/blob/d8c3b3469e55654d31f430cb343fd89392196c4e/src/mardor/cli.py#L217-L229
2,532
ska-sa/katcp-python
katcp/server.py
DeviceLogger.warn
def warn(self, msg, *args, **kwargs): """Log an warning message.""" self.log(self.WARN, msg, *args, **kwargs)
python
def warn(self, msg, *args, **kwargs): """Log an warning message.""" self.log(self.WARN, msg, *args, **kwargs)
['def', 'warn', '(', 'self', ',', 'msg', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'self', '.', 'log', '(', 'self', '.', 'WARN', ',', 'msg', ',', '*', 'args', ',', '*', '*', 'kwargs', ')']
Log an warning message.
['Log', 'an', 'warning', 'message', '.']
train
https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L2550-L2552
2,533
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/isoline.py
IsolineVisual._compute_iso_color
def _compute_iso_color(self): """ compute LineVisual color from level index and corresponding level color """ level_color = [] colors = self._lc for i, index in enumerate(self._li): level_color.append(np.zeros((index, 4)) + colors[i]) self._cl = np.vst...
python
def _compute_iso_color(self): """ compute LineVisual color from level index and corresponding level color """ level_color = [] colors = self._lc for i, index in enumerate(self._li): level_color.append(np.zeros((index, 4)) + colors[i]) self._cl = np.vst...
['def', '_compute_iso_color', '(', 'self', ')', ':', 'level_color', '=', '[', ']', 'colors', '=', 'self', '.', '_lc', 'for', 'i', ',', 'index', 'in', 'enumerate', '(', 'self', '.', '_li', ')', ':', 'level_color', '.', 'append', '(', 'np', '.', 'zeros', '(', '(', 'index', ',', '4', ')', ')', '+', 'colors', '[', 'i', ']'...
compute LineVisual color from level index and corresponding level color
['compute', 'LineVisual', 'color', 'from', 'level', 'index', 'and', 'corresponding', 'level', 'color']
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/isoline.py#L214-L222
2,534
weblyzard/inscriptis
src/inscriptis/css.py
CssParse.get_style_attribute
def get_style_attribute(style_attribute, html_element): ''' ::param: style_directive \ The attribute value of the given style sheet. Example: display: none ::param: html_element: \ The HtmlElement to which the given style is applied ::returns: ...
python
def get_style_attribute(style_attribute, html_element): ''' ::param: style_directive \ The attribute value of the given style sheet. Example: display: none ::param: html_element: \ The HtmlElement to which the given style is applied ::returns: ...
['def', 'get_style_attribute', '(', 'style_attribute', ',', 'html_element', ')', ':', 'custome_html_element', '=', 'html_element', '.', 'clone', '(', ')', 'for', 'style_directive', 'in', 'style_attribute', '.', 'lower', '(', ')', '.', 'split', '(', "';'", ')', ':', 'if', "':'", 'not', 'in', 'style_directive', ':', 'con...
::param: style_directive \ The attribute value of the given style sheet. Example: display: none ::param: html_element: \ The HtmlElement to which the given style is applied ::returns: A HtmlElement that merges the given element with the style attri...
['::', 'param', ':', 'style_directive', '\\', 'The', 'attribute', 'value', 'of', 'the', 'given', 'style', 'sheet', '.', 'Example', ':', 'display', ':', 'none']
train
https://github.com/weblyzard/inscriptis/blob/0d04f81e69d643bb5f470f33b4ca67b62fc1037c/src/inscriptis/css.py#L62-L89
2,535
dswah/pyGAM
pygam/terms.py
TermList.build_penalties
def build_penalties(self): """ builds the GAM block-diagonal penalty matrix in quadratic form out of penalty matrices specified for each feature. each feature penalty matrix is multiplied by a lambda for that feature. so for m features: P = block_diag[lam0 * P0, lam1 * ...
python
def build_penalties(self): """ builds the GAM block-diagonal penalty matrix in quadratic form out of penalty matrices specified for each feature. each feature penalty matrix is multiplied by a lambda for that feature. so for m features: P = block_diag[lam0 * P0, lam1 * ...
['def', 'build_penalties', '(', 'self', ')', ':', 'P', '=', '[', ']', 'for', 'term', 'in', 'self', '.', '_terms', ':', 'P', '.', 'append', '(', 'term', '.', 'build_penalties', '(', ')', ')', 'return', 'sp', '.', 'sparse', '.', 'block_diag', '(', 'P', ')']
builds the GAM block-diagonal penalty matrix in quadratic form out of penalty matrices specified for each feature. each feature penalty matrix is multiplied by a lambda for that feature. so for m features: P = block_diag[lam0 * P0, lam1 * P1, lam2 * P2, ... , lamm * Pm] Param...
['builds', 'the', 'GAM', 'block', '-', 'diagonal', 'penalty', 'matrix', 'in', 'quadratic', 'form', 'out', 'of', 'penalty', 'matrices', 'specified', 'for', 'each', 'feature', '.']
train
https://github.com/dswah/pyGAM/blob/b3e5c3cd580f0a3ad69f9372861624f67760c325/pygam/terms.py#L1722-L1744
2,536
saltstack/salt
salt/modules/smbios.py
records
def records(rec_type=None, fields=None, clean=True): ''' Return DMI records from SMBIOS type Return only records of type(s) The SMBIOS specification defines the following DMI types: ==== ====================================== Type Information ==== ===============...
python
def records(rec_type=None, fields=None, clean=True): ''' Return DMI records from SMBIOS type Return only records of type(s) The SMBIOS specification defines the following DMI types: ==== ====================================== Type Information ==== ===============...
['def', 'records', '(', 'rec_type', '=', 'None', ',', 'fields', '=', 'None', ',', 'clean', '=', 'True', ')', ':', 'if', 'rec_type', 'is', 'None', ':', 'smbios', '=', '_dmi_parse', '(', '_dmidecoder', '(', ')', ',', 'clean', ',', 'fields', ')', 'else', ':', 'smbios', '=', '_dmi_parse', '(', '_dmidecoder', '(', "'-t {0}'...
Return DMI records from SMBIOS type Return only records of type(s) The SMBIOS specification defines the following DMI types: ==== ====================================== Type Information ==== ====================================== 0 BIOS 1 System ...
['Return', 'DMI', 'records', 'from', 'SMBIOS']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/smbios.py#L92-L167
2,537
KelSolaar/Foundations
foundations/parsers.py
PlistFileParser.filter_values
def filter_values(self, pattern, flags=0): """ | Filters the :meth:`PlistFileParser.elements` class property elements using given pattern. | Will return a list of matching elements values, if you want to get only one element value, use the :meth:`PlistFileParser.get_value` method ins...
python
def filter_values(self, pattern, flags=0): """ | Filters the :meth:`PlistFileParser.elements` class property elements using given pattern. | Will return a list of matching elements values, if you want to get only one element value, use the :meth:`PlistFileParser.get_value` method ins...
['def', 'filter_values', '(', 'self', ',', 'pattern', ',', 'flags', '=', '0', ')', ':', 'values', '=', '[', ']', 'if', 'not', 'self', '.', '__elements', ':', 'return', 'values', 'for', 'item', 'in', 'foundations', '.', 'walkers', '.', 'dictionaries_walker', '(', 'self', '.', '__elements', ')', ':', 'path', ',', 'elemen...
| Filters the :meth:`PlistFileParser.elements` class property elements using given pattern. | Will return a list of matching elements values, if you want to get only one element value, use the :meth:`PlistFileParser.get_value` method instead. Usage:: >>> plist_file_parser = Pli...
['|', 'Filters', 'the', ':', 'meth', ':', 'PlistFileParser', '.', 'elements', 'class', 'property', 'elements', 'using', 'given', 'pattern', '.', '|', 'Will', 'return', 'a', 'list', 'of', 'matching', 'elements', 'values', 'if', 'you', 'want', 'to', 'get', 'only', 'one', 'element', 'value', 'use', 'the', ':', 'meth', ':'...
train
https://github.com/KelSolaar/Foundations/blob/5c141330faf09dad70a12bc321f4c564917d0a91/foundations/parsers.py#L1317-L1349
2,538
twilio/twilio-python
twilio/rest/wireless/v1/sim/__init__.py
SimContext.data_sessions
def data_sessions(self): """ Access the data_sessions :returns: twilio.rest.wireless.v1.sim.data_session.DataSessionList :rtype: twilio.rest.wireless.v1.sim.data_session.DataSessionList """ if self._data_sessions is None: self._data_sessions = DataSessionList...
python
def data_sessions(self): """ Access the data_sessions :returns: twilio.rest.wireless.v1.sim.data_session.DataSessionList :rtype: twilio.rest.wireless.v1.sim.data_session.DataSessionList """ if self._data_sessions is None: self._data_sessions = DataSessionList...
['def', 'data_sessions', '(', 'self', ')', ':', 'if', 'self', '.', '_data_sessions', 'is', 'None', ':', 'self', '.', '_data_sessions', '=', 'DataSessionList', '(', 'self', '.', '_version', ',', 'sim_sid', '=', 'self', '.', '_solution', '[', "'sid'", ']', ',', ')', 'return', 'self', '.', '_data_sessions']
Access the data_sessions :returns: twilio.rest.wireless.v1.sim.data_session.DataSessionList :rtype: twilio.rest.wireless.v1.sim.data_session.DataSessionList
['Access', 'the', 'data_sessions']
train
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/wireless/v1/sim/__init__.py#L357-L366
2,539
jashort/SmartFileSorter
smartfilesorter/smartfilesorter.py
SmartFileSorter.load_rules
def load_rules(self, filename): """ Load rules from YAML configuration in the given stream object :param filename: Filename of rule YAML file :return: rules object """ self.logger.debug('Reading rules from %s', filename) try: in_file = open(filename) ...
python
def load_rules(self, filename): """ Load rules from YAML configuration in the given stream object :param filename: Filename of rule YAML file :return: rules object """ self.logger.debug('Reading rules from %s', filename) try: in_file = open(filename) ...
['def', 'load_rules', '(', 'self', ',', 'filename', ')', ':', 'self', '.', 'logger', '.', 'debug', '(', "'Reading rules from %s'", ',', 'filename', ')', 'try', ':', 'in_file', '=', 'open', '(', 'filename', ')', 'except', 'IOError', ':', 'self', '.', 'logger', '.', 'error', '(', "'Error opening {0}'", '.', 'format', '('...
Load rules from YAML configuration in the given stream object :param filename: Filename of rule YAML file :return: rules object
['Load', 'rules', 'from', 'YAML', 'configuration', 'in', 'the', 'given', 'stream', 'object', ':', 'param', 'filename', ':', 'Filename', 'of', 'rule', 'YAML', 'file', ':', 'return', ':', 'rules', 'object']
train
https://github.com/jashort/SmartFileSorter/blob/77faf09e5a737da93e16e71a64707366b8307910/smartfilesorter/smartfilesorter.py#L107-L130
2,540
nyaruka/smartmin
smartmin/views.py
SmartListView.derive_link_fields
def derive_link_fields(self, context): """ Used to derive which fields should be linked. This should return a set() containing the names of those fields which should be linkable. """ if self.link_fields is not None: return self.link_fields else: ...
python
def derive_link_fields(self, context): """ Used to derive which fields should be linked. This should return a set() containing the names of those fields which should be linkable. """ if self.link_fields is not None: return self.link_fields else: ...
['def', 'derive_link_fields', '(', 'self', ',', 'context', ')', ':', 'if', 'self', '.', 'link_fields', 'is', 'not', 'None', ':', 'return', 'self', '.', 'link_fields', 'else', ':', 'link_fields', '=', 'set', '(', ')', 'if', 'self', '.', 'fields', ':', 'for', 'field', 'in', 'self', '.', 'fields', ':', 'if', 'field', '!='...
Used to derive which fields should be linked. This should return a set() containing the names of those fields which should be linkable.
['Used', 'to', 'derive', 'which', 'fields', 'should', 'be', 'linked', '.', 'This', 'should', 'return', 'a', 'set', '()', 'containing', 'the', 'names', 'of', 'those', 'fields', 'which', 'should', 'be', 'linkable', '.']
train
https://github.com/nyaruka/smartmin/blob/488a676a4960555e4d216a7b95d6e01a4ad4efd8/smartmin/views.py#L542-L558
2,541
booktype/python-ooxml
ooxml/serialize.py
serialize_table
def serialize_table(ctx, document, table, root): """Serializes table element. """ # What we should check really is why do we pass None as root element # There is a good chance some content is missing after the import if root is None: return root if ctx.ilvl != None: root = clo...
python
def serialize_table(ctx, document, table, root): """Serializes table element. """ # What we should check really is why do we pass None as root element # There is a good chance some content is missing after the import if root is None: return root if ctx.ilvl != None: root = clo...
['def', 'serialize_table', '(', 'ctx', ',', 'document', ',', 'table', ',', 'root', ')', ':', '# What we should check really is why do we pass None as root element', '# There is a good chance some content is missing after the import', 'if', 'root', 'is', 'None', ':', 'return', 'root', 'if', 'ctx', '.', 'ilvl', '!=', 'No...
Serializes table element.
['Serializes', 'table', 'element', '.']
train
https://github.com/booktype/python-ooxml/blob/b56990a5bee2e1bc46839cec5161ff3726dc4d87/ooxml/serialize.py#L828-L879
2,542
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
AnyValueMap.append
def append(self, map): """ Appends new elements to this map. :param map: a map with elements to be added. """ if isinstance(map, dict): for (k, v) in map.items(): key = StringConverter.to_string(k) value = v self.put(ke...
python
def append(self, map): """ Appends new elements to this map. :param map: a map with elements to be added. """ if isinstance(map, dict): for (k, v) in map.items(): key = StringConverter.to_string(k) value = v self.put(ke...
['def', 'append', '(', 'self', ',', 'map', ')', ':', 'if', 'isinstance', '(', 'map', ',', 'dict', ')', ':', 'for', '(', 'k', ',', 'v', ')', 'in', 'map', '.', 'items', '(', ')', ':', 'key', '=', 'StringConverter', '.', 'to_string', '(', 'k', ')', 'value', '=', 'v', 'self', '.', 'put', '(', 'key', ',', 'value', ')']
Appends new elements to this map. :param map: a map with elements to be added.
['Appends', 'new', 'elements', 'to', 'this', 'map', '.']
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L86-L96
2,543
quodlibet/mutagen
mutagen/oggvorbis.py
OggVCommentDict._inject
def _inject(self, fileobj, padding_func): """Write tag data into the Vorbis comment packet/page.""" # Find the old pages in the file; we'll need to remove them, # plus grab any stray setup packet data out of them. fileobj.seek(0) page = OggPage(fileobj) while not page.pa...
python
def _inject(self, fileobj, padding_func): """Write tag data into the Vorbis comment packet/page.""" # Find the old pages in the file; we'll need to remove them, # plus grab any stray setup packet data out of them. fileobj.seek(0) page = OggPage(fileobj) while not page.pa...
['def', '_inject', '(', 'self', ',', 'fileobj', ',', 'padding_func', ')', ':', "# Find the old pages in the file; we'll need to remove them,", '# plus grab any stray setup packet data out of them.', 'fileobj', '.', 'seek', '(', '0', ')', 'page', '=', 'OggPage', '(', 'fileobj', ')', 'while', 'not', 'page', '.', 'packets...
Write tag data into the Vorbis comment packet/page.
['Write', 'tag', 'data', 'into', 'the', 'Vorbis', 'comment', 'packet', '/', 'page', '.']
train
https://github.com/quodlibet/mutagen/blob/e393df5971ba41ba5a50de9c2c9e7e5484d82c4e/mutagen/oggvorbis.py#L111-L140
2,544
facelessuser/backrefs
backrefs/uniprops/__init__.py
get_nfkd_quick_check_property
def get_nfkd_quick_check_property(value, is_bytes=False): """Get `NFKD QUICK CHECK` property.""" obj = unidata.ascii_nfkd_quick_check if is_bytes else unidata.unicode_nfkd_quick_check if value.startswith('^'): negated = value[1:] value = '^' + unidata.unicode_alias['nfkdquickcheck'].get(ne...
python
def get_nfkd_quick_check_property(value, is_bytes=False): """Get `NFKD QUICK CHECK` property.""" obj = unidata.ascii_nfkd_quick_check if is_bytes else unidata.unicode_nfkd_quick_check if value.startswith('^'): negated = value[1:] value = '^' + unidata.unicode_alias['nfkdquickcheck'].get(ne...
['def', 'get_nfkd_quick_check_property', '(', 'value', ',', 'is_bytes', '=', 'False', ')', ':', 'obj', '=', 'unidata', '.', 'ascii_nfkd_quick_check', 'if', 'is_bytes', 'else', 'unidata', '.', 'unicode_nfkd_quick_check', 'if', 'value', '.', 'startswith', '(', "'^'", ')', ':', 'negated', '=', 'value', '[', '1', ':', ']',...
Get `NFKD QUICK CHECK` property.
['Get', 'NFKD', 'QUICK', 'CHECK', 'property', '.']
train
https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L257-L268
2,545
intuition-io/intuition
intuition/api/portfolio.py
PortfolioFactory.update
def update(self, portfolio, date, perfs=None): ''' Actualizes the portfolio universe with the alog state ''' # Make the manager aware of current simulation self.portfolio = portfolio self.perfs = perfs self.date = date
python
def update(self, portfolio, date, perfs=None): ''' Actualizes the portfolio universe with the alog state ''' # Make the manager aware of current simulation self.portfolio = portfolio self.perfs = perfs self.date = date
['def', 'update', '(', 'self', ',', 'portfolio', ',', 'date', ',', 'perfs', '=', 'None', ')', ':', '# Make the manager aware of current simulation', 'self', '.', 'portfolio', '=', 'portfolio', 'self', '.', 'perfs', '=', 'perfs', 'self', '.', 'date', '=', 'date']
Actualizes the portfolio universe with the alog state
['Actualizes', 'the', 'portfolio', 'universe', 'with', 'the', 'alog', 'state']
train
https://github.com/intuition-io/intuition/blob/cd517e6b3b315a743eb4d0d0dc294e264ab913ce/intuition/api/portfolio.py#L77-L84
2,546
sanger-pathogens/ariba
ariba/assembly_compare.py
AssemblyCompare._ref_covered_by_at_least_one_full_length_contig
def _ref_covered_by_at_least_one_full_length_contig(nucmer_hits, percent_threshold, max_nt_extend): '''Returns true iff there exists a contig that completely covers the reference sequence nucmer_hits = hits made by self._parse_nucmer_coords_file.''' for l in nucmer_hits.values(): ...
python
def _ref_covered_by_at_least_one_full_length_contig(nucmer_hits, percent_threshold, max_nt_extend): '''Returns true iff there exists a contig that completely covers the reference sequence nucmer_hits = hits made by self._parse_nucmer_coords_file.''' for l in nucmer_hits.values(): ...
['def', '_ref_covered_by_at_least_one_full_length_contig', '(', 'nucmer_hits', ',', 'percent_threshold', ',', 'max_nt_extend', ')', ':', 'for', 'l', 'in', 'nucmer_hits', '.', 'values', '(', ')', ':', 'for', 'hit', 'in', 'l', ':', 'if', '(', '(', '2', '*', 'max_nt_extend', ')', '+', 'len', '(', 'hit', '.', 'ref_coords',...
Returns true iff there exists a contig that completely covers the reference sequence nucmer_hits = hits made by self._parse_nucmer_coords_file.
['Returns', 'true', 'iff', 'there', 'exists', 'a', 'contig', 'that', 'completely', 'covers', 'the', 'reference', 'sequence', 'nucmer_hits', '=', 'hits', 'made', 'by', 'self', '.', '_parse_nucmer_coords_file', '.']
train
https://github.com/sanger-pathogens/ariba/blob/16a0b1916ce0e886bd22550ba2d648542977001b/ariba/assembly_compare.py#L352-L360
2,547
sdispater/cachy
cachy/tagged_cache.py
TaggedCache.decrement
def decrement(self, key, value=1): """ Decrement the value of an item in the cache. :param key: The cache key :type key: str :param value: The decrement value :type value: int :rtype: int or bool """ self._store.decrement(self.tagged_item_key(ke...
python
def decrement(self, key, value=1): """ Decrement the value of an item in the cache. :param key: The cache key :type key: str :param value: The decrement value :type value: int :rtype: int or bool """ self._store.decrement(self.tagged_item_key(ke...
['def', 'decrement', '(', 'self', ',', 'key', ',', 'value', '=', '1', ')', ':', 'self', '.', '_store', '.', 'decrement', '(', 'self', '.', 'tagged_item_key', '(', 'key', ')', ',', 'value', ')']
Decrement the value of an item in the cache. :param key: The cache key :type key: str :param value: The decrement value :type value: int :rtype: int or bool
['Decrement', 'the', 'value', 'of', 'an', 'item', 'in', 'the', 'cache', '.']
train
https://github.com/sdispater/cachy/blob/ee4b044d6aafa80125730a00b1f679a7bd852b8a/cachy/tagged_cache.py#L110-L122
2,548
openstack/horizon
openstack_dashboard/dashboards/project/vg_snapshots/tables.py
GroupSnapshotsFilterAction.filter
def filter(self, table, vg_snapshots, filter_string): """Naive case-insensitive search.""" query = filter_string.lower() return [vg_snapshot for vg_snapshot in vg_snapshots if query in vg_snapshot.name.lower()]
python
def filter(self, table, vg_snapshots, filter_string): """Naive case-insensitive search.""" query = filter_string.lower() return [vg_snapshot for vg_snapshot in vg_snapshots if query in vg_snapshot.name.lower()]
['def', 'filter', '(', 'self', ',', 'table', ',', 'vg_snapshots', ',', 'filter_string', ')', ':', 'query', '=', 'filter_string', '.', 'lower', '(', ')', 'return', '[', 'vg_snapshot', 'for', 'vg_snapshot', 'in', 'vg_snapshots', 'if', 'query', 'in', 'vg_snapshot', '.', 'name', '.', 'lower', '(', ')', ']']
Naive case-insensitive search.
['Naive', 'case', '-', 'insensitive', 'search', '.']
train
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/dashboards/project/vg_snapshots/tables.py#L85-L89
2,549
twisted/mantissa
xmantissa/website.py
PrefixURLMixin.produceResource
def produceResource(self, request, segments, webViewer): """ Return a C{(resource, subsegments)} tuple or None, depending on whether I wish to return an L{IResource} provider for the given set of segments or not. """ def thunk(): cr = getattr(self, 'createReso...
python
def produceResource(self, request, segments, webViewer): """ Return a C{(resource, subsegments)} tuple or None, depending on whether I wish to return an L{IResource} provider for the given set of segments or not. """ def thunk(): cr = getattr(self, 'createReso...
['def', 'produceResource', '(', 'self', ',', 'request', ',', 'segments', ',', 'webViewer', ')', ':', 'def', 'thunk', '(', ')', ':', 'cr', '=', 'getattr', '(', 'self', ',', "'createResource'", ',', 'None', ')', 'if', 'cr', 'is', 'not', 'None', ':', 'return', 'cr', '(', ')', 'else', ':', 'return', 'self', '.', 'createRes...
Return a C{(resource, subsegments)} tuple or None, depending on whether I wish to return an L{IResource} provider for the given set of segments or not.
['Return', 'a', 'C', '{', '(', 'resource', 'subsegments', ')', '}', 'tuple', 'or', 'None', 'depending', 'on', 'whether', 'I', 'wish', 'to', 'return', 'an', 'L', '{', 'IResource', '}', 'provider', 'for', 'the', 'given', 'set', 'of', 'segments', 'or', 'not', '.']
train
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/website.py#L169-L181
2,550
bspaans/python-mingus
mingus/core/chords.py
triad
def triad(note, key): """Return the triad on note in key as a list. Examples: >>> triad('E', 'C') ['E', 'G', 'B'] >>> triad('E', 'B') ['E', 'G#', 'B'] """ return [note, intervals.third(note, key), intervals.fifth(note, key)]
python
def triad(note, key): """Return the triad on note in key as a list. Examples: >>> triad('E', 'C') ['E', 'G', 'B'] >>> triad('E', 'B') ['E', 'G#', 'B'] """ return [note, intervals.third(note, key), intervals.fifth(note, key)]
['def', 'triad', '(', 'note', ',', 'key', ')', ':', 'return', '[', 'note', ',', 'intervals', '.', 'third', '(', 'note', ',', 'key', ')', ',', 'intervals', '.', 'fifth', '(', 'note', ',', 'key', ')', ']']
Return the triad on note in key as a list. Examples: >>> triad('E', 'C') ['E', 'G', 'B'] >>> triad('E', 'B') ['E', 'G#', 'B']
['Return', 'the', 'triad', 'on', 'note', 'in', 'key', 'as', 'a', 'list', '.']
train
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/core/chords.py#L165-L174
2,551
rehandalal/therapist
therapist/utils/filesystem.py
list_files
def list_files(path): """Recursively collects a list of files at a path.""" files = [] if os.path.isdir(path): for stats in os.walk(path): for f in stats[2]: files.append(os.path.join(stats[0], f)) elif os.path.isfile(path): files = [path] return files
python
def list_files(path): """Recursively collects a list of files at a path.""" files = [] if os.path.isdir(path): for stats in os.walk(path): for f in stats[2]: files.append(os.path.join(stats[0], f)) elif os.path.isfile(path): files = [path] return files
['def', 'list_files', '(', 'path', ')', ':', 'files', '=', '[', ']', 'if', 'os', '.', 'path', '.', 'isdir', '(', 'path', ')', ':', 'for', 'stats', 'in', 'os', '.', 'walk', '(', 'path', ')', ':', 'for', 'f', 'in', 'stats', '[', '2', ']', ':', 'files', '.', 'append', '(', 'os', '.', 'path', '.', 'join', '(', 'stats', '['...
Recursively collects a list of files at a path.
['Recursively', 'collects', 'a', 'list', 'of', 'files', 'at', 'a', 'path', '.']
train
https://github.com/rehandalal/therapist/blob/1995a7e396eea2ec8685bb32a779a4110b459b1f/therapist/utils/filesystem.py#L14-L23
2,552
espressif/esptool
ecdsa/numbertheory.py
order_mod
def order_mod( x, m ): """Return the order of x in the multiplicative group mod m. """ # Warning: this implementation is not very clever, and will # take a long time if m is very large. if m <= 1: return 0 assert gcd( x, m ) == 1 z = x result = 1 while z != 1: z = ( z * x ) % m result = re...
python
def order_mod( x, m ): """Return the order of x in the multiplicative group mod m. """ # Warning: this implementation is not very clever, and will # take a long time if m is very large. if m <= 1: return 0 assert gcd( x, m ) == 1 z = x result = 1 while z != 1: z = ( z * x ) % m result = re...
['def', 'order_mod', '(', 'x', ',', 'm', ')', ':', '# Warning: this implementation is not very clever, and will', '# take a long time if m is very large.', 'if', 'm', '<=', '1', ':', 'return', '0', 'assert', 'gcd', '(', 'x', ',', 'm', ')', '==', '1', 'z', '=', 'x', 'result', '=', '1', 'while', 'z', '!=', '1', ':', 'z',...
Return the order of x in the multiplicative group mod m.
['Return', 'the', 'order', 'of', 'x', 'in', 'the', 'multiplicative', 'group', 'mod', 'm', '.']
train
https://github.com/espressif/esptool/blob/c583756c118039cfcfe256f7a3285618914d16a5/ecdsa/numbertheory.py#L346-L362
2,553
pyvec/pyvodb
pyvodb/tables.py
Event.start
def start(self): """The event's start time, as a timezone-aware datetime object""" if self.start_time is None: time = datetime.time(hour=19, tzinfo=CET) else: time = self.start_time.replace(tzinfo=CET) return datetime.datetime.combine(self.date, time)
python
def start(self): """The event's start time, as a timezone-aware datetime object""" if self.start_time is None: time = datetime.time(hour=19, tzinfo=CET) else: time = self.start_time.replace(tzinfo=CET) return datetime.datetime.combine(self.date, time)
['def', 'start', '(', 'self', ')', ':', 'if', 'self', '.', 'start_time', 'is', 'None', ':', 'time', '=', 'datetime', '.', 'time', '(', 'hour', '=', '19', ',', 'tzinfo', '=', 'CET', ')', 'else', ':', 'time', '=', 'self', '.', 'start_time', '.', 'replace', '(', 'tzinfo', '=', 'CET', ')', 'return', 'datetime', '.', 'datet...
The event's start time, as a timezone-aware datetime object
['The', 'event', 's', 'start', 'time', 'as', 'a', 'timezone', '-', 'aware', 'datetime', 'object']
train
https://github.com/pyvec/pyvodb/blob/07183333df26eb12c5c2b98802cde3fb3a6c1339/pyvodb/tables.py#L103-L109
2,554
mcs07/ChemDataExtractor
chemdataextractor/cli/pos.py
evaluate_all
def evaluate_all(ctx, model): """Evaluate POS taggers on WSJ and GENIA.""" click.echo('chemdataextractor.pos.evaluate_all') click.echo('Model: %s' % model) ctx.invoke(evaluate, model='%s_wsj_nocluster.pickle' % model, corpus='wsj', clusters=False) ctx.invoke(evaluate, model='%s_wsj_nocluster.pickle'...
python
def evaluate_all(ctx, model): """Evaluate POS taggers on WSJ and GENIA.""" click.echo('chemdataextractor.pos.evaluate_all') click.echo('Model: %s' % model) ctx.invoke(evaluate, model='%s_wsj_nocluster.pickle' % model, corpus='wsj', clusters=False) ctx.invoke(evaluate, model='%s_wsj_nocluster.pickle'...
['def', 'evaluate_all', '(', 'ctx', ',', 'model', ')', ':', 'click', '.', 'echo', '(', "'chemdataextractor.pos.evaluate_all'", ')', 'click', '.', 'echo', '(', "'Model: %s'", '%', 'model', ')', 'ctx', '.', 'invoke', '(', 'evaluate', ',', 'model', '=', "'%s_wsj_nocluster.pickle'", '%', 'model', ',', 'corpus', '=', "'wsj'...
Evaluate POS taggers on WSJ and GENIA.
['Evaluate', 'POS', 'taggers', 'on', 'WSJ', 'and', 'GENIA', '.']
train
https://github.com/mcs07/ChemDataExtractor/blob/349a3bea965f2073141d62043b89319222e46af1/chemdataextractor/cli/pos.py#L50-L65
2,555
sdispater/cachy
cachy/stores/redis_store.py
RedisStore.get
def get(self, key): """ Retrieve an item from the cache by key. :param key: The cache key :type key: str :return: The cache value """ value = self._redis.get(self._prefix + key) if value is not None: return self.unserialize(value)
python
def get(self, key): """ Retrieve an item from the cache by key. :param key: The cache key :type key: str :return: The cache value """ value = self._redis.get(self._prefix + key) if value is not None: return self.unserialize(value)
['def', 'get', '(', 'self', ',', 'key', ')', ':', 'value', '=', 'self', '.', '_redis', '.', 'get', '(', 'self', '.', '_prefix', '+', 'key', ')', 'if', 'value', 'is', 'not', 'None', ':', 'return', 'self', '.', 'unserialize', '(', 'value', ')']
Retrieve an item from the cache by key. :param key: The cache key :type key: str :return: The cache value
['Retrieve', 'an', 'item', 'from', 'the', 'cache', 'by', 'key', '.']
train
https://github.com/sdispater/cachy/blob/ee4b044d6aafa80125730a00b1f679a7bd852b8a/cachy/stores/redis_store.py#L27-L39
2,556
anchore/anchore
anchore/util/resources.py
ResourceCache._flush
def _flush(self): """ Flush metadata to the backing file :return: """ with open(self.metadata_file, 'w') as f: json.dump(self.metadata, f)
python
def _flush(self): """ Flush metadata to the backing file :return: """ with open(self.metadata_file, 'w') as f: json.dump(self.metadata, f)
['def', '_flush', '(', 'self', ')', ':', 'with', 'open', '(', 'self', '.', 'metadata_file', ',', "'w'", ')', 'as', 'f', ':', 'json', '.', 'dump', '(', 'self', '.', 'metadata', ',', 'f', ')']
Flush metadata to the backing file :return:
['Flush', 'metadata', 'to', 'the', 'backing', 'file', ':', 'return', ':']
train
https://github.com/anchore/anchore/blob/8a4d5b9708e27856312d303aae3f04f3c72039d6/anchore/util/resources.py#L317-L323
2,557
jam31118/vis
vis/layout.py
get_text_position
def get_text_position(fig, ax, ha='left', va='top', pad_scale=1.0): """Return text position inside of the given axis""" ## Check and preprocess input arguments try: pad_scale = float(pad_scale) except: raise TypeError("'pad_scale should be of type 'float'") for arg in [va, ha]: ass...
python
def get_text_position(fig, ax, ha='left', va='top', pad_scale=1.0): """Return text position inside of the given axis""" ## Check and preprocess input arguments try: pad_scale = float(pad_scale) except: raise TypeError("'pad_scale should be of type 'float'") for arg in [va, ha]: ass...
['def', 'get_text_position', '(', 'fig', ',', 'ax', ',', 'ha', '=', "'left'", ',', 'va', '=', "'top'", ',', 'pad_scale', '=', '1.0', ')', ':', '## Check and preprocess input arguments', 'try', ':', 'pad_scale', '=', 'float', '(', 'pad_scale', ')', 'except', ':', 'raise', 'TypeError', '(', '"\'pad_scale should be of typ...
Return text position inside of the given axis
['Return', 'text', 'position', 'inside', 'of', 'the', 'given', 'axis']
train
https://github.com/jam31118/vis/blob/965ebec102c539b323d5756fef04153ac71e50d9/vis/layout.py#L81-L118
2,558
kgori/treeCl
treeCl/parutils.py
processpool_map
def processpool_map(task, args, message, concurrency, batchsize=1, nargs=None): """ See http://stackoverflow.com/a/16071616 """ njobs = get_njobs(nargs, args) show_progress = bool(message) batches = grouper(batchsize, tupleise(args)) def batched_task(*batch): return [task(*job) for j...
python
def processpool_map(task, args, message, concurrency, batchsize=1, nargs=None): """ See http://stackoverflow.com/a/16071616 """ njobs = get_njobs(nargs, args) show_progress = bool(message) batches = grouper(batchsize, tupleise(args)) def batched_task(*batch): return [task(*job) for j...
['def', 'processpool_map', '(', 'task', ',', 'args', ',', 'message', ',', 'concurrency', ',', 'batchsize', '=', '1', ',', 'nargs', '=', 'None', ')', ':', 'njobs', '=', 'get_njobs', '(', 'nargs', ',', 'args', ')', 'show_progress', '=', 'bool', '(', 'message', ')', 'batches', '=', 'grouper', '(', 'batchsize', ',', 'tuple...
See http://stackoverflow.com/a/16071616
['See', 'http', ':', '//', 'stackoverflow', '.', 'com', '/', 'a', '/', '16071616']
train
https://github.com/kgori/treeCl/blob/fed624b3db1c19cc07175ca04e3eda6905a8d305/treeCl/parutils.py#L177-L214
2,559
log2timeline/dfwinreg
dfwinreg/virtual.py
VirtualWinRegistryKey.GetSubkeyByPath
def GetSubkeyByPath(self, key_path): """Retrieves a subkey by path. Args: key_path (str): path of the subkey. Returns: WinRegistryKey: Windows Registry subkey or None if not found. """ if not self._registry_key and self._registry: self._GetKeyFromRegistry() subkey = self ...
python
def GetSubkeyByPath(self, key_path): """Retrieves a subkey by path. Args: key_path (str): path of the subkey. Returns: WinRegistryKey: Windows Registry subkey or None if not found. """ if not self._registry_key and self._registry: self._GetKeyFromRegistry() subkey = self ...
['def', 'GetSubkeyByPath', '(', 'self', ',', 'key_path', ')', ':', 'if', 'not', 'self', '.', '_registry_key', 'and', 'self', '.', '_registry', ':', 'self', '.', '_GetKeyFromRegistry', '(', ')', 'subkey', '=', 'self', 'for', 'path_segment', 'in', 'key_paths', '.', 'SplitKeyPath', '(', 'key_path', ')', ':', 'subkey', '='...
Retrieves a subkey by path. Args: key_path (str): path of the subkey. Returns: WinRegistryKey: Windows Registry subkey or None if not found.
['Retrieves', 'a', 'subkey', 'by', 'path', '.']
train
https://github.com/log2timeline/dfwinreg/blob/9d488bb1db562197dbfb48de9613d6b29dea056e/dfwinreg/virtual.py#L198-L216
2,560
benmoran56/esper
esper.py
World.remove_component
def remove_component(self, entity: int, component_type: Any) -> int: """Remove a Component instance from an Entity, by type. A Component instance can be removed by providing it's type. For example: world.delete_component(enemy_a, Velocity) will remove the Velocity instance from the Enti...
python
def remove_component(self, entity: int, component_type: Any) -> int: """Remove a Component instance from an Entity, by type. A Component instance can be removed by providing it's type. For example: world.delete_component(enemy_a, Velocity) will remove the Velocity instance from the Enti...
['def', 'remove_component', '(', 'self', ',', 'entity', ':', 'int', ',', 'component_type', ':', 'Any', ')', '->', 'int', ':', 'self', '.', '_components', '[', 'component_type', ']', '.', 'discard', '(', 'entity', ')', 'if', 'not', 'self', '.', '_components', '[', 'component_type', ']', ':', 'del', 'self', '.', '_compon...
Remove a Component instance from an Entity, by type. A Component instance can be removed by providing it's type. For example: world.delete_component(enemy_a, Velocity) will remove the Velocity instance from the Entity enemy_a. Raises a KeyError if either the given entity or Component t...
['Remove', 'a', 'Component', 'instance', 'from', 'an', 'Entity', 'by', 'type', '.']
train
https://github.com/benmoran56/esper/blob/5b6cd0c51718d5dcfa0e5613f824b5251cf092ac/esper.py#L199-L222
2,561
borntyping/python-riemann-client
riemann_client/client.py
Client.send_query
def send_query(self, query): """Sends a query to the Riemann server :returns: The response message from Riemann """ message = riemann_client.riemann_pb2.Msg() message.query.string = query return self.transport.send(message)
python
def send_query(self, query): """Sends a query to the Riemann server :returns: The response message from Riemann """ message = riemann_client.riemann_pb2.Msg() message.query.string = query return self.transport.send(message)
['def', 'send_query', '(', 'self', ',', 'query', ')', ':', 'message', '=', 'riemann_client', '.', 'riemann_pb2', '.', 'Msg', '(', ')', 'message', '.', 'query', '.', 'string', '=', 'query', 'return', 'self', '.', 'transport', '.', 'send', '(', 'message', ')']
Sends a query to the Riemann server :returns: The response message from Riemann
['Sends', 'a', 'query', 'to', 'the', 'Riemann', 'server']
train
https://github.com/borntyping/python-riemann-client/blob/3e181d90bdf685afd21c1ec5ee20e6840b011ea5/riemann_client/client.py#L158-L165
2,562
openwisp/django-x509
django_x509/base/models.py
AbstractCa.get_revoked_certs
def get_revoked_certs(self): """ Returns revoked certificates of this CA (does not include expired certificates) """ now = timezone.now() return self.cert_set.filter(revoked=True, validity_start__lte=now, ...
python
def get_revoked_certs(self): """ Returns revoked certificates of this CA (does not include expired certificates) """ now = timezone.now() return self.cert_set.filter(revoked=True, validity_start__lte=now, ...
['def', 'get_revoked_certs', '(', 'self', ')', ':', 'now', '=', 'timezone', '.', 'now', '(', ')', 'return', 'self', '.', 'cert_set', '.', 'filter', '(', 'revoked', '=', 'True', ',', 'validity_start__lte', '=', 'now', ',', 'validity_end__gte', '=', 'now', ')']
Returns revoked certificates of this CA (does not include expired certificates)
['Returns', 'revoked', 'certificates', 'of', 'this', 'CA', '(', 'does', 'not', 'include', 'expired', 'certificates', ')']
train
https://github.com/openwisp/django-x509/blob/7f6cc937d6b13a10ce6511e0bb2a9a1345e45a2c/django_x509/base/models.py#L439-L447
2,563
praekelt/django-simple-autocomplete
simple_autocomplete/views.py
get_json
def get_json(request, token): """Return matching results as JSON""" result = [] searchtext = request.GET['q'] if len(searchtext) >= 3: pickled = _simple_autocomplete_queryset_cache.get(token, None) if pickled is not None: app_label, model_name, query = pickle.loads(pickled) ...
python
def get_json(request, token): """Return matching results as JSON""" result = [] searchtext = request.GET['q'] if len(searchtext) >= 3: pickled = _simple_autocomplete_queryset_cache.get(token, None) if pickled is not None: app_label, model_name, query = pickle.loads(pickled) ...
['def', 'get_json', '(', 'request', ',', 'token', ')', ':', 'result', '=', '[', ']', 'searchtext', '=', 'request', '.', 'GET', '[', "'q'", ']', 'if', 'len', '(', 'searchtext', ')', '>=', '3', ':', 'pickled', '=', '_simple_autocomplete_queryset_cache', '.', 'get', '(', 'token', ',', 'None', ')', 'if', 'pickled', 'is', '...
Return matching results as JSON
['Return', 'matching', 'results', 'as', 'JSON']
train
https://github.com/praekelt/django-simple-autocomplete/blob/925b639a6a7fac2350dda9656845d8bd9aa2e748/simple_autocomplete/views.py#L14-L62
2,564
rehandalal/flask-funnel
flask_funnel/extensions.py
coffee
def coffee(input, output, **kw): """Process CoffeeScript files""" subprocess.call([current_app.config.get('COFFEE_BIN'), '-c', '-o', output, input])
python
def coffee(input, output, **kw): """Process CoffeeScript files""" subprocess.call([current_app.config.get('COFFEE_BIN'), '-c', '-o', output, input])
['def', 'coffee', '(', 'input', ',', 'output', ',', '*', '*', 'kw', ')', ':', 'subprocess', '.', 'call', '(', '[', 'current_app', '.', 'config', '.', 'get', '(', "'COFFEE_BIN'", ')', ',', "'-c'", ',', "'-o'", ',', 'output', ',', 'input', ']', ')']
Process CoffeeScript files
['Process', 'CoffeeScript', 'files']
train
https://github.com/rehandalal/flask-funnel/blob/b635cf52d1c9133c748aab7465edd7caef48e433/flask_funnel/extensions.py#L30-L33
2,565
garyp/sifter
sifter/grammar/grammar.py
p_commands_list
def p_commands_list(p): """commands : commands command""" p[0] = p[1] # section 3.2: REQUIRE command must come before any other commands if p[2].RULE_IDENTIFIER == 'REQUIRE': if any(command.RULE_IDENTIFIER != 'REQUIRE' for command in p[0].commands): print("REQUIRE com...
python
def p_commands_list(p): """commands : commands command""" p[0] = p[1] # section 3.2: REQUIRE command must come before any other commands if p[2].RULE_IDENTIFIER == 'REQUIRE': if any(command.RULE_IDENTIFIER != 'REQUIRE' for command in p[0].commands): print("REQUIRE com...
['def', 'p_commands_list', '(', 'p', ')', ':', 'p', '[', '0', ']', '=', 'p', '[', '1', ']', '# section 3.2: REQUIRE command must come before any other commands', 'if', 'p', '[', '2', ']', '.', 'RULE_IDENTIFIER', '==', "'REQUIRE'", ':', 'if', 'any', '(', 'command', '.', 'RULE_IDENTIFIER', '!=', "'REQUIRE'", 'for', 'comm...
commands : commands command
['commands', ':', 'commands', 'command']
train
https://github.com/garyp/sifter/blob/9c472af76853c1196387141e017114d282637474/sifter/grammar/grammar.py#L17-L36
2,566
nickpandolfi/Cyther
cyther/pathway.py
normalize
def normalize(path_name, override=None): """ Prepares a path name to be worked with. Path name must not be empty. This function will return the 'normpath'ed path and the identity of the path. This function takes an optional overriding argument for the identity. ONLY PROVIDE OVERRIDE IF: 1) ...
python
def normalize(path_name, override=None): """ Prepares a path name to be worked with. Path name must not be empty. This function will return the 'normpath'ed path and the identity of the path. This function takes an optional overriding argument for the identity. ONLY PROVIDE OVERRIDE IF: 1) ...
['def', 'normalize', '(', 'path_name', ',', 'override', '=', 'None', ')', ':', 'identity', '=', 'identify', '(', 'path_name', ',', 'override', '=', 'override', ')', 'new_path_name', '=', 'os', '.', 'path', '.', 'normpath', '(', 'os', '.', 'path', '.', 'expanduser', '(', 'path_name', ')', ')', 'return', 'new_path_name',...
Prepares a path name to be worked with. Path name must not be empty. This function will return the 'normpath'ed path and the identity of the path. This function takes an optional overriding argument for the identity. ONLY PROVIDE OVERRIDE IF: 1) YOU AREWORKING WITH A FOLDER THAT HAS AN EXTENSION IN...
['Prepares', 'a', 'path', 'name', 'to', 'be', 'worked', 'with', '.', 'Path', 'name', 'must', 'not', 'be', 'empty', '.', 'This', 'function', 'will', 'return', 'the', 'normpath', 'ed', 'path', 'and', 'the', 'identity', 'of', 'the', 'path', '.', 'This', 'function', 'takes', 'an', 'optional', 'overriding', 'argument', 'for...
train
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/pathway.py#L36-L50
2,567
ynop/audiomate
audiomate/annotations/label_list.py
LabelList.add
def add(self, label): """ Add a label to the end of the list. Args: label (Label): The label to add. """ label.label_list = self self.label_tree.addi(label.start, label.end, label)
python
def add(self, label): """ Add a label to the end of the list. Args: label (Label): The label to add. """ label.label_list = self self.label_tree.addi(label.start, label.end, label)
['def', 'add', '(', 'self', ',', 'label', ')', ':', 'label', '.', 'label_list', '=', 'self', 'self', '.', 'label_tree', '.', 'addi', '(', 'label', '.', 'start', ',', 'label', '.', 'end', ',', 'label', ')']
Add a label to the end of the list. Args: label (Label): The label to add.
['Add', 'a', 'label', 'to', 'the', 'end', 'of', 'the', 'list', '.']
train
https://github.com/ynop/audiomate/blob/61727920b23a708293c3d526fa3000d4de9c6c21/audiomate/annotations/label_list.py#L90-L98
2,568
ARMmbed/icetea
icetea_lib/tools/GenericProcess.py
GenericProcess.stop_process
def stop_process(self): """ Stop the process. :raises: EnvironmentError if stopping fails due to unknown environment TestStepError if process stops with non-default returncode and return code is not ignored. """ if self.read_thread is not None: self.logger.de...
python
def stop_process(self): """ Stop the process. :raises: EnvironmentError if stopping fails due to unknown environment TestStepError if process stops with non-default returncode and return code is not ignored. """ if self.read_thread is not None: self.logger.de...
['def', 'stop_process', '(', 'self', ')', ':', 'if', 'self', '.', 'read_thread', 'is', 'not', 'None', ':', 'self', '.', 'logger', '.', 'debug', '(', '"stop_process::readThread.stop()-in"', ')', 'self', '.', 'read_thread', '.', 'stop', '(', ')', 'self', '.', 'logger', '.', 'debug', '(', '"stop_process::readThread.stop()...
Stop the process. :raises: EnvironmentError if stopping fails due to unknown environment TestStepError if process stops with non-default returncode and return code is not ignored.
['Stop', 'the', 'process', '.']
train
https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/tools/GenericProcess.py#L503-L548
2,569
spacetelescope/pysynphot
pysynphot/spectrum.py
SpectralElement.check_sig
def check_sig(self, other): """Check overlap insignificance with another spectrum. Also see :ref:`pysynphot-command-checko`. .. note:: Only use when :meth:`check_overlap` returns "partial". Parameters ---------- other : `SourceSpectrum` or `SpectralElement`...
python
def check_sig(self, other): """Check overlap insignificance with another spectrum. Also see :ref:`pysynphot-command-checko`. .. note:: Only use when :meth:`check_overlap` returns "partial". Parameters ---------- other : `SourceSpectrum` or `SpectralElement`...
['def', 'check_sig', '(', 'self', ',', 'other', ')', ':', 'swave', '=', 'self', '.', 'wave', '[', 'N', '.', 'where', '(', 'self', '.', 'throughput', '!=', '0', ')', ']', 's1', ',', 's2', '=', 'swave', '.', 'min', '(', ')', ',', 'swave', '.', 'max', '(', ')', 'owave', '=', 'other', '.', 'wave', 'o1', ',', 'o2', '=', 'ow...
Check overlap insignificance with another spectrum. Also see :ref:`pysynphot-command-checko`. .. note:: Only use when :meth:`check_overlap` returns "partial". Parameters ---------- other : `SourceSpectrum` or `SpectralElement` The other spectrum. ...
['Check', 'overlap', 'insignificance', 'with', 'another', 'spectrum', '.', 'Also', 'see', ':', 'ref', ':', 'pysynphot', '-', 'command', '-', 'checko', '.']
train
https://github.com/spacetelescope/pysynphot/blob/a125ff956f4d94beb157bd51899747a13234bb97/pysynphot/spectrum.py#L1998-L2047
2,570
thiagopbueno/rddl2tf
rddl2tf/compiler.py
Compiler.compile_action_preconditions_checking
def compile_action_preconditions_checking(self, state: Sequence[tf.Tensor], action: Sequence[tf.Tensor]) -> tf.Tensor: '''Combines the action preconditions into an applicability checking op. Args: state (Sequence[tf.Tensor]): The current state fluents. ac...
python
def compile_action_preconditions_checking(self, state: Sequence[tf.Tensor], action: Sequence[tf.Tensor]) -> tf.Tensor: '''Combines the action preconditions into an applicability checking op. Args: state (Sequence[tf.Tensor]): The current state fluents. ac...
['def', 'compile_action_preconditions_checking', '(', 'self', ',', 'state', ':', 'Sequence', '[', 'tf', '.', 'Tensor', ']', ',', 'action', ':', 'Sequence', '[', 'tf', '.', 'Tensor', ']', ')', '->', 'tf', '.', 'Tensor', ':', 'with', 'self', '.', 'graph', '.', 'as_default', '(', ')', ':', 'with', 'tf', '.', 'name_scope',...
Combines the action preconditions into an applicability checking op. Args: state (Sequence[tf.Tensor]): The current state fluents. action (Sequence[tf.Tensor]): The action fluents. Returns: A boolean tensor for checking if `action` is application in `state`.
['Combines', 'the', 'action', 'preconditions', 'into', 'an', 'applicability', 'checking', 'op', '.']
train
https://github.com/thiagopbueno/rddl2tf/blob/f7c03d3a74d2663807c1e23e04eeed2e85166b71/rddl2tf/compiler.py#L321-L338
2,571
cs50/check50
check50/__main__.py
install_translations
def install_translations(config): """Add check translations according to ``config`` as a fallback to existing translations""" if not config: return from . import _translation checks_translation = gettext.translation(domain=config["domain"], localedi...
python
def install_translations(config): """Add check translations according to ``config`` as a fallback to existing translations""" if not config: return from . import _translation checks_translation = gettext.translation(domain=config["domain"], localedi...
['def', 'install_translations', '(', 'config', ')', ':', 'if', 'not', 'config', ':', 'return', 'from', '.', 'import', '_translation', 'checks_translation', '=', 'gettext', '.', 'translation', '(', 'domain', '=', 'config', '[', '"domain"', ']', ',', 'localedir', '=', 'internal', '.', 'check_dir', '/', 'config', '[', '"l...
Add check translations according to ``config`` as a fallback to existing translations
['Add', 'check', 'translations', 'according', 'to', 'config', 'as', 'a', 'fallback', 'to', 'existing', 'translations']
train
https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/__main__.py#L134-L144
2,572
cvxopt/chompack
src/python/symbolic.py
__leaf
def __leaf(i, j, first, maxfirst, prevleaf, ancestor): """ Determine if j is leaf of i'th row subtree. """ jleaf = 0 if i<=j or first[j] <= maxfirst[i]: return -1, jleaf maxfirst[i] = first[j] jprev = prevleaf[i] prevleaf[i] = j if jprev == -1: jleaf = 1 else: jleaf = 2 if jl...
python
def __leaf(i, j, first, maxfirst, prevleaf, ancestor): """ Determine if j is leaf of i'th row subtree. """ jleaf = 0 if i<=j or first[j] <= maxfirst[i]: return -1, jleaf maxfirst[i] = first[j] jprev = prevleaf[i] prevleaf[i] = j if jprev == -1: jleaf = 1 else: jleaf = 2 if jl...
['def', '__leaf', '(', 'i', ',', 'j', ',', 'first', ',', 'maxfirst', ',', 'prevleaf', ',', 'ancestor', ')', ':', 'jleaf', '=', '0', 'if', 'i', '<=', 'j', 'or', 'first', '[', 'j', ']', '<=', 'maxfirst', '[', 'i', ']', ':', 'return', '-', '1', ',', 'jleaf', 'maxfirst', '[', 'i', ']', '=', 'first', '[', 'j', ']', 'jprev',...
Determine if j is leaf of i'th row subtree.
['Determine', 'if', 'j', 'is', 'leaf', 'of', 'i', 'th', 'row', 'subtree', '.']
train
https://github.com/cvxopt/chompack/blob/e07106b58b8055c34f6201e8c954482f86987833/src/python/symbolic.py#L74-L93
2,573
CZ-NIC/yangson
yangson/instance.py
InstanceNode._node_set
def _node_set(self) -> List["InstanceNode"]: """XPath - return the list of all receiver's nodes.""" return list(self) if isinstance(self.value, ArrayValue) else [self]
python
def _node_set(self) -> List["InstanceNode"]: """XPath - return the list of all receiver's nodes.""" return list(self) if isinstance(self.value, ArrayValue) else [self]
['def', '_node_set', '(', 'self', ')', '->', 'List', '[', '"InstanceNode"', ']', ':', 'return', 'list', '(', 'self', ')', 'if', 'isinstance', '(', 'self', '.', 'value', ',', 'ArrayValue', ')', 'else', '[', 'self', ']']
XPath - return the list of all receiver's nodes.
['XPath', '-', 'return', 'the', 'list', 'of', 'all', 'receiver', 's', 'nodes', '.']
train
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L418-L420
2,574
PmagPy/PmagPy
pmagpy/ipmag.py
equi
def equi(map_axis, centerlon, centerlat, radius, color, alpha=1.0): """ This function enables A95 error ellipses to be drawn in cartopy around paleomagnetic poles in conjunction with shoot (modified from: http://www.geophysique.be/2011/02/20/matplotlib-basemap-tutorial-09-drawing-circles/). """ ...
python
def equi(map_axis, centerlon, centerlat, radius, color, alpha=1.0): """ This function enables A95 error ellipses to be drawn in cartopy around paleomagnetic poles in conjunction with shoot (modified from: http://www.geophysique.be/2011/02/20/matplotlib-basemap-tutorial-09-drawing-circles/). """ ...
['def', 'equi', '(', 'map_axis', ',', 'centerlon', ',', 'centerlat', ',', 'radius', ',', 'color', ',', 'alpha', '=', '1.0', ')', ':', 'if', 'not', 'has_cartopy', ':', 'print', '(', "'-W- cartopy must be installed to run ipmag.equi'", ')', 'return', 'glon1', '=', 'centerlon', 'glat1', '=', 'centerlat', 'X', '=', '[', ']...
This function enables A95 error ellipses to be drawn in cartopy around paleomagnetic poles in conjunction with shoot (modified from: http://www.geophysique.be/2011/02/20/matplotlib-basemap-tutorial-09-drawing-circles/).
['This', 'function', 'enables', 'A95', 'error', 'ellipses', 'to', 'be', 'drawn', 'in', 'cartopy', 'around', 'paleomagnetic', 'poles', 'in', 'conjunction', 'with', 'shoot', '(', 'modified', 'from', ':', 'http', ':', '//', 'www', '.', 'geophysique', '.', 'be', '/', '2011', '/', '02', '/', '20', '/', 'matplotlib', '-', 'b...
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/ipmag.py#L2542-L2563
2,575
quiltdata/quilt
compiler/quilt/tools/store.py
PackageStore.create_package_node
def create_package_node(self, team, user, package, dry_run=False): """ Creates a new package and initializes its contents. See `install_package`. """ contents = RootNode(dict()) if dry_run: return contents self.check_name(team, user, package) assert c...
python
def create_package_node(self, team, user, package, dry_run=False): """ Creates a new package and initializes its contents. See `install_package`. """ contents = RootNode(dict()) if dry_run: return contents self.check_name(team, user, package) assert c...
['def', 'create_package_node', '(', 'self', ',', 'team', ',', 'user', ',', 'package', ',', 'dry_run', '=', 'False', ')', ':', 'contents', '=', 'RootNode', '(', 'dict', '(', ')', ')', 'if', 'dry_run', ':', 'return', 'contents', 'self', '.', 'check_name', '(', 'team', ',', 'user', ',', 'package', ')', 'assert', 'contents...
Creates a new package and initializes its contents. See `install_package`.
['Creates', 'a', 'new', 'package', 'and', 'initializes', 'its', 'contents', '.', 'See', 'install_package', '.']
train
https://github.com/quiltdata/quilt/blob/651853e7e89a8af86e0ff26167e752efa5878c12/compiler/quilt/tools/store.py#L243-L262
2,576
DataONEorg/d1_python
lib_common/src/d1_common/cert/subject_info.py
_trim_tree
def _trim_tree(state): """Trim empty leaf nodes from the tree. - To simplify the tree conversion, empty nodes are added before it is known if they will contain items that connect back to the authenticated subject. If there are no connections, the nodes remain empty, which causes them to be removed ...
python
def _trim_tree(state): """Trim empty leaf nodes from the tree. - To simplify the tree conversion, empty nodes are added before it is known if they will contain items that connect back to the authenticated subject. If there are no connections, the nodes remain empty, which causes them to be removed ...
['def', '_trim_tree', '(', 'state', ')', ':', 'for', 'n', 'in', 'list', '(', 'state', '.', 'tree', '.', 'leaf_node_gen', ')', ':', 'if', 'n', '.', 'type_str', '==', 'TYPE_NODE_TAG', ':', 'n', '.', 'parent', '.', 'child_list', '.', 'remove', '(', 'n', ')', 'return', '_trim_tree', '(', 'state', ')']
Trim empty leaf nodes from the tree. - To simplify the tree conversion, empty nodes are added before it is known if they will contain items that connect back to the authenticated subject. If there are no connections, the nodes remain empty, which causes them to be removed here. - Removing a leaf n...
['Trim', 'empty', 'leaf', 'nodes', 'from', 'the', 'tree', '.']
train
https://github.com/DataONEorg/d1_python/blob/3ac4d4f3ca052d3e8641a6a329cab526c8ddcb0d/lib_common/src/d1_common/cert/subject_info.py#L378-L392
2,577
NuGrid/NuGridPy
nugridpy/data_plot.py
DataPlot.iso_abund
def iso_abund(self, cycle, stable=False, amass_range=None, mass_range=None, ylim=[0,0], ref=-1, show=True, log_logic=True, decayed=False, color_plot=True, grid=False, point_set=1, include_title=False, data_provided=False,thedata=None, verbose=True,...
python
def iso_abund(self, cycle, stable=False, amass_range=None, mass_range=None, ylim=[0,0], ref=-1, show=True, log_logic=True, decayed=False, color_plot=True, grid=False, point_set=1, include_title=False, data_provided=False,thedata=None, verbose=True,...
['def', 'iso_abund', '(', 'self', ',', 'cycle', ',', 'stable', '=', 'False', ',', 'amass_range', '=', 'None', ',', 'mass_range', '=', 'None', ',', 'ylim', '=', '[', '0', ',', '0', ']', ',', 'ref', '=', '-', '1', ',', 'show', '=', 'True', ',', 'log_logic', '=', 'True', ',', 'decayed', '=', 'False', ',', 'color_plot', '=...
plot the abundance of all the chemical species Parameters ---------- cycle : string, integer or list The cycle of interest. If it is a list of cycles, this method will do a plot for each cycle and save them to a file. stable : boolean, optional ...
['plot', 'the', 'abundance', 'of', 'all', 'the', 'chemical', 'species']
train
https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/data_plot.py#L3309-L3811
2,578
jason-weirather/py-seq-tools
seqtools/errors.py
ErrorProfileFactory.combine_context_errors
def combine_context_errors(self): """Each alignment contributes some information to the error report. These reports for each alignment need to be gone through and combined into one report. :returns: Dictionary containing the error counts on context base :rtype: dict() """ r = {} if self._tar...
python
def combine_context_errors(self): """Each alignment contributes some information to the error report. These reports for each alignment need to be gone through and combined into one report. :returns: Dictionary containing the error counts on context base :rtype: dict() """ r = {} if self._tar...
['def', 'combine_context_errors', '(', 'self', ')', ':', 'r', '=', '{', '}', 'if', 'self', '.', '_target_context_errors', ':', 'r', '=', 'self', '.', '_target_context_errors', 'for', 'k', 'in', '[', 'x', '.', 'get_context_target_errors', '(', ')', 'for', 'x', 'in', 'self', '.', '_alignment_errors', ']', ':', 'for', 'b'...
Each alignment contributes some information to the error report. These reports for each alignment need to be gone through and combined into one report. :returns: Dictionary containing the error counts on context base :rtype: dict()
['Each', 'alignment', 'contributes', 'some', 'information', 'to', 'the', 'error', 'report', '.', 'These', 'reports', 'for', 'each', 'alignment', 'need', 'to', 'be', 'gone', 'through', 'and', 'combined', 'into', 'one', 'report', '.']
train
https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/errors.py#L199-L240
2,579
fastai/fastai
old/fastai/plots.py
ImageModelResults.most_by_uncertain
def most_by_uncertain(self, y): """ Extracts the predicted classes which correspond to the selected class (y) and have probabilities nearest to 1/number_of_classes (eg. 0.5 for 2 classes, 0.33 for 3 classes) for the selected class. Arguments: y (int): the selected class ...
python
def most_by_uncertain(self, y): """ Extracts the predicted classes which correspond to the selected class (y) and have probabilities nearest to 1/number_of_classes (eg. 0.5 for 2 classes, 0.33 for 3 classes) for the selected class. Arguments: y (int): the selected class ...
['def', 'most_by_uncertain', '(', 'self', ',', 'y', ')', ':', 'return', 'self', '.', 'most_uncertain_by_mask', '(', '(', 'self', '.', 'ds', '.', 'y', '==', 'y', ')', ',', 'y', ')']
Extracts the predicted classes which correspond to the selected class (y) and have probabilities nearest to 1/number_of_classes (eg. 0.5 for 2 classes, 0.33 for 3 classes) for the selected class. Arguments: y (int): the selected class Returns: idxs (numpy.ndarra...
['Extracts', 'the', 'predicted', 'classes', 'which', 'correspond', 'to', 'the', 'selected', 'class', '(', 'y', ')', 'and', 'have', 'probabilities', 'nearest', 'to', '1', '/', 'number_of_classes', '(', 'eg', '.', '0', '.', '5', 'for', '2', 'classes', '0', '.', '33', 'for', '3', 'classes', ')', 'for', 'the', 'selected', ...
train
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/old/fastai/plots.py#L173-L182
2,580
rigetti/pyquil
pyquil/api/_qam.py
QAM.reset
def reset(self): """ Reset the Quantum Abstract Machine to its initial state, which is particularly useful when it has gotten into an unwanted state. This can happen, for example, if the QAM is interrupted in the middle of a run. """ self._variables_shim = {} self...
python
def reset(self): """ Reset the Quantum Abstract Machine to its initial state, which is particularly useful when it has gotten into an unwanted state. This can happen, for example, if the QAM is interrupted in the middle of a run. """ self._variables_shim = {} self...
['def', 'reset', '(', 'self', ')', ':', 'self', '.', '_variables_shim', '=', '{', '}', 'self', '.', '_executable', '=', 'None', 'self', '.', '_bitstrings', '=', 'None', 'self', '.', 'status', '=', "'connected'"]
Reset the Quantum Abstract Machine to its initial state, which is particularly useful when it has gotten into an unwanted state. This can happen, for example, if the QAM is interrupted in the middle of a run.
['Reset', 'the', 'Quantum', 'Abstract', 'Machine', 'to', 'its', 'initial', 'state', 'which', 'is', 'particularly', 'useful', 'when', 'it', 'has', 'gotten', 'into', 'an', 'unwanted', 'state', '.', 'This', 'can', 'happen', 'for', 'example', 'if', 'the', 'QAM', 'is', 'interrupted', 'in', 'the', 'middle', 'of', 'a', 'run',...
train
https://github.com/rigetti/pyquil/blob/ec98e453084b0037d69d8c3245f6822a5422593d/pyquil/api/_qam.py#L137-L147
2,581
PGower/PyCanvas
pycanvas/apis/courses.py
CoursesAPI.reset_course
def reset_course(self, course_id): """ Reset a course. Deletes the current course, and creates a new equivalent course with no content, but all sections and users moved over. """ path = {} data = {} params = {} # REQUIRED - PATH - cour...
python
def reset_course(self, course_id): """ Reset a course. Deletes the current course, and creates a new equivalent course with no content, but all sections and users moved over. """ path = {} data = {} params = {} # REQUIRED - PATH - cour...
['def', 'reset_course', '(', 'self', ',', 'course_id', ')', ':', 'path', '=', '{', '}', 'data', '=', '{', '}', 'params', '=', '{', '}', '# REQUIRED - PATH - course_id\r', '"""ID"""', 'path', '[', '"course_id"', ']', '=', 'course_id', 'self', '.', 'logger', '.', 'debug', '(', '"POST /api/v1/courses/{course_id}/reset_con...
Reset a course. Deletes the current course, and creates a new equivalent course with no content, but all sections and users moved over.
['Reset', 'a', 'course', '.', 'Deletes', 'the', 'current', 'course', 'and', 'creates', 'a', 'new', 'equivalent', 'course', 'with', 'no', 'content', 'but', 'all', 'sections', 'and', 'users', 'moved', 'over', '.']
train
https://github.com/PGower/PyCanvas/blob/68520005382b440a1e462f9df369f54d364e21e8/pycanvas/apis/courses.py#L1182-L1198
2,582
Kronuz/pyScss
scss/cssdefs.py
determine_encoding
def determine_encoding(buf): """Return the appropriate encoding for the given CSS source, according to the CSS charset rules. `buf` may be either a string or bytes. """ # The ultimate default is utf8; bravo, W3C bom_encoding = 'UTF-8' if not buf: # What return bom_encoding ...
python
def determine_encoding(buf): """Return the appropriate encoding for the given CSS source, according to the CSS charset rules. `buf` may be either a string or bytes. """ # The ultimate default is utf8; bravo, W3C bom_encoding = 'UTF-8' if not buf: # What return bom_encoding ...
['def', 'determine_encoding', '(', 'buf', ')', ':', '# The ultimate default is utf8; bravo, W3C', 'bom_encoding', '=', "'UTF-8'", 'if', 'not', 'buf', ':', '# What', 'return', 'bom_encoding', 'if', 'isinstance', '(', 'buf', ',', 'six', '.', 'text_type', ')', ':', '# We got a file that, for whatever reason, produces alre...
Return the appropriate encoding for the given CSS source, according to the CSS charset rules. `buf` may be either a string or bytes.
['Return', 'the', 'appropriate', 'encoding', 'for', 'the', 'given', 'CSS', 'source', 'according', 'to', 'the', 'CSS', 'charset', 'rules', '.']
train
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/cssdefs.py#L358-L432
2,583
archman/beamline
beamline/ui/myappframe.py
MyAppFrame.update_stat
def update_stat(self, mode='open', infostr='', stat=''): """ write operation stats to log :param mode: 'open', 'saveas', 'listtree' :param infostr: string to put into info_st :param stat: 'OK' or 'ERR' """ self._update_stat[mode](mode, infostr, stat)
python
def update_stat(self, mode='open', infostr='', stat=''): """ write operation stats to log :param mode: 'open', 'saveas', 'listtree' :param infostr: string to put into info_st :param stat: 'OK' or 'ERR' """ self._update_stat[mode](mode, infostr, stat)
['def', 'update_stat', '(', 'self', ',', 'mode', '=', "'open'", ',', 'infostr', '=', "''", ',', 'stat', '=', "''", ')', ':', 'self', '.', '_update_stat', '[', 'mode', ']', '(', 'mode', ',', 'infostr', ',', 'stat', ')']
write operation stats to log :param mode: 'open', 'saveas', 'listtree' :param infostr: string to put into info_st :param stat: 'OK' or 'ERR'
['write', 'operation', 'stats', 'to', 'log', ':', 'param', 'mode', ':', 'open', 'saveas', 'listtree', ':', 'param', 'infostr', ':', 'string', 'to', 'put', 'into', 'info_st', ':', 'param', 'stat', ':', 'OK', 'or', 'ERR']
train
https://github.com/archman/beamline/blob/417bc5dc13e754bc89d246427984590fced64d07/beamline/ui/myappframe.py#L621-L627
2,584
saltstack/salt
salt/client/ssh/__init__.py
SSH._key_deploy_run
def _key_deploy_run(self, host, target, re_run=True): ''' The ssh-copy-id routine ''' argv = [ 'ssh.set_auth_key', target.get('user', 'root'), self.get_pubkey(), ] single = Single( self.opts, argv, ...
python
def _key_deploy_run(self, host, target, re_run=True): ''' The ssh-copy-id routine ''' argv = [ 'ssh.set_auth_key', target.get('user', 'root'), self.get_pubkey(), ] single = Single( self.opts, argv, ...
['def', '_key_deploy_run', '(', 'self', ',', 'host', ',', 'target', ',', 're_run', '=', 'True', ')', ':', 'argv', '=', '[', "'ssh.set_auth_key'", ',', 'target', '.', 'get', '(', "'user'", ',', "'root'", ')', ',', 'self', '.', 'get_pubkey', '(', ')', ',', ']', 'single', '=', 'Single', '(', 'self', '.', 'opts', ',', 'arg...
The ssh-copy-id routine
['The', 'ssh', '-', 'copy', '-', 'id', 'routine']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/__init__.py#L463-L506
2,585
oanda/v20-python
src/v20/order.py
UnitsAvailableDetails.from_dict
def from_dict(data, ctx): """ Instantiate a new UnitsAvailableDetails from a dict (generally from loading a JSON response). The data used to instantiate the UnitsAvailableDetails is a shallow copy of the dict passed in, with any complex child types instantiated appropriately. ...
python
def from_dict(data, ctx): """ Instantiate a new UnitsAvailableDetails from a dict (generally from loading a JSON response). The data used to instantiate the UnitsAvailableDetails is a shallow copy of the dict passed in, with any complex child types instantiated appropriately. ...
['def', 'from_dict', '(', 'data', ',', 'ctx', ')', ':', 'data', '=', 'data', '.', 'copy', '(', ')', 'if', 'data', '.', 'get', '(', "'long'", ')', 'is', 'not', 'None', ':', 'data', '[', "'long'", ']', '=', 'ctx', '.', 'convert_decimal_number', '(', 'data', '.', 'get', '(', "'long'", ')', ')', 'if', 'data', '.', 'get', '...
Instantiate a new UnitsAvailableDetails from a dict (generally from loading a JSON response). The data used to instantiate the UnitsAvailableDetails is a shallow copy of the dict passed in, with any complex child types instantiated appropriately.
['Instantiate', 'a', 'new', 'UnitsAvailableDetails', 'from', 'a', 'dict', '(', 'generally', 'from', 'loading', 'a', 'JSON', 'response', ')', '.', 'The', 'data', 'used', 'to', 'instantiate', 'the', 'UnitsAvailableDetails', 'is', 'a', 'shallow', 'copy', 'of', 'the', 'dict', 'passed', 'in', 'with', 'any', 'complex', 'chil...
train
https://github.com/oanda/v20-python/blob/f28192f4a31bce038cf6dfa302f5878bec192fe5/src/v20/order.py#L3324-L3344
2,586
raff/dynash
dynash2/dynash2.py
DynamoDBShell2.do_login
def do_login(self, line): "login aws-acces-key aws-secret" if line: args = self.getargs(line) self.connect(args[0], args[1]) else: self.connect() self.do_tables('')
python
def do_login(self, line): "login aws-acces-key aws-secret" if line: args = self.getargs(line) self.connect(args[0], args[1]) else: self.connect() self.do_tables('')
['def', 'do_login', '(', 'self', ',', 'line', ')', ':', 'if', 'line', ':', 'args', '=', 'self', '.', 'getargs', '(', 'line', ')', 'self', '.', 'connect', '(', 'args', '[', '0', ']', ',', 'args', '[', '1', ']', ')', 'else', ':', 'self', '.', 'connect', '(', ')', 'self', '.', 'do_tables', '(', "''", ')']
login aws-acces-key aws-secret
['login', 'aws', '-', 'acces', '-', 'key', 'aws', '-', 'secret']
train
https://github.com/raff/dynash/blob/a2b4fab67dd85ceaa9c1bb7604ebc1768a7fc28e/dynash2/dynash2.py#L360-L368
2,587
pyinvoke/invocations
invocations/packaging/release.py
_release_line
def _release_line(c): """ Examine current repo state to determine what type of release to prep. :returns: A two-tuple of ``(branch-name, line-type)`` where: - ``branch-name`` is the current branch name, e.g. ``1.1``, ``master``, ``gobbledygook`` (or, usually, ``HEAD`` if not on a...
python
def _release_line(c): """ Examine current repo state to determine what type of release to prep. :returns: A two-tuple of ``(branch-name, line-type)`` where: - ``branch-name`` is the current branch name, e.g. ``1.1``, ``master``, ``gobbledygook`` (or, usually, ``HEAD`` if not on a...
['def', '_release_line', '(', 'c', ')', ':', "# TODO: I don't _think_ this technically overlaps with Releases (because", '# that only ever deals with changelog contents, and therefore full release', '# version numbers) but in case it does, move it there sometime.', '# TODO: this and similar calls in this module may wan...
Examine current repo state to determine what type of release to prep. :returns: A two-tuple of ``(branch-name, line-type)`` where: - ``branch-name`` is the current branch name, e.g. ``1.1``, ``master``, ``gobbledygook`` (or, usually, ``HEAD`` if not on a branch). - ``line-type`` ...
['Examine', 'current', 'repo', 'state', 'to', 'determine', 'what', 'type', 'of', 'release', 'to', 'prep', '.']
train
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/packaging/release.py#L330-L364
2,588
quodlibet/mutagen
mutagen/apev2.py
APEv2.__parse_tag
def __parse_tag(self, tag, count): """Raises IOError and APEBadItemError""" fileobj = cBytesIO(tag) for i in xrange(count): tag_data = fileobj.read(8) # someone writes wrong item counts if not tag_data: break if len(tag_data) != 8...
python
def __parse_tag(self, tag, count): """Raises IOError and APEBadItemError""" fileobj = cBytesIO(tag) for i in xrange(count): tag_data = fileobj.read(8) # someone writes wrong item counts if not tag_data: break if len(tag_data) != 8...
['def', '__parse_tag', '(', 'self', ',', 'tag', ',', 'count', ')', ':', 'fileobj', '=', 'cBytesIO', '(', 'tag', ')', 'for', 'i', 'in', 'xrange', '(', 'count', ')', ':', 'tag_data', '=', 'fileobj', '.', 'read', '(', '8', ')', '# someone writes wrong item counts', 'if', 'not', 'tag_data', ':', 'break', 'if', 'len', '(', ...
Raises IOError and APEBadItemError
['Raises', 'IOError', 'and', 'APEBadItemError']
train
https://github.com/quodlibet/mutagen/blob/e393df5971ba41ba5a50de9c2c9e7e5484d82c4e/mutagen/apev2.py#L306-L349
2,589
saltstack/salt
salt/returners/highstate_return.py
_produce_output
def _produce_output(report, failed, setup): ''' Produce output from the report dictionary generated by _generate_report ''' report_format = setup.get('report_format', 'yaml') log.debug('highstate output format: %s', report_format) if report_format == 'json': report_text = salt.utils.js...
python
def _produce_output(report, failed, setup): ''' Produce output from the report dictionary generated by _generate_report ''' report_format = setup.get('report_format', 'yaml') log.debug('highstate output format: %s', report_format) if report_format == 'json': report_text = salt.utils.js...
['def', '_produce_output', '(', 'report', ',', 'failed', ',', 'setup', ')', ':', 'report_format', '=', 'setup', '.', 'get', '(', "'report_format'", ',', "'yaml'", ')', 'log', '.', 'debug', '(', "'highstate output format: %s'", ',', 'report_format', ')', 'if', 'report_format', '==', "'json'", ':', 'report_text', '=', 's...
Produce output from the report dictionary generated by _generate_report
['Produce', 'output', 'from', 'the', 'report', 'dictionary', 'generated', 'by', '_generate_report']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/highstate_return.py#L425-L493
2,590
wright-group/WrightTools
WrightTools/artists/_helpers.py
plot_margins
def plot_margins(*, fig=None, inches=1., centers=True, edges=True): """Add lines onto a figure indicating the margins, centers, and edges. Useful for ensuring your figure design scripts work as intended, and for laying out figures. Parameters ---------- fig : matplotlib.figure.Figure object (o...
python
def plot_margins(*, fig=None, inches=1., centers=True, edges=True): """Add lines onto a figure indicating the margins, centers, and edges. Useful for ensuring your figure design scripts work as intended, and for laying out figures. Parameters ---------- fig : matplotlib.figure.Figure object (o...
['def', 'plot_margins', '(', '*', ',', 'fig', '=', 'None', ',', 'inches', '=', '1.', ',', 'centers', '=', 'True', ',', 'edges', '=', 'True', ')', ':', 'if', 'fig', 'is', 'None', ':', 'fig', '=', 'plt', '.', 'gcf', '(', ')', 'size', '=', 'fig', '.', 'get_size_inches', '(', ')', '# [H, V]', 'trans_vert', '=', 'inches', '...
Add lines onto a figure indicating the margins, centers, and edges. Useful for ensuring your figure design scripts work as intended, and for laying out figures. Parameters ---------- fig : matplotlib.figure.Figure object (optional) The figure to plot onto. If None, gets current figure. Def...
['Add', 'lines', 'onto', 'a', 'figure', 'indicating', 'the', 'margins', 'centers', 'and', 'edges', '.']
train
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/artists/_helpers.py#L695-L750
2,591
nir0s/serv
serv/init/base.py
Base.generate_file_from_template
def generate_file_from_template(self, template, destination): """Generate a file from a Jinja2 `template` and writes it to `destination` using `params`. `overwrite` allows to overwrite existing files. It is passed to the `generate` method. This is used by the different init imp...
python
def generate_file_from_template(self, template, destination): """Generate a file from a Jinja2 `template` and writes it to `destination` using `params`. `overwrite` allows to overwrite existing files. It is passed to the `generate` method. This is used by the different init imp...
['def', 'generate_file_from_template', '(', 'self', ',', 'template', ',', 'destination', ')', ':', '# We cast the object to a string before passing it on as py3.x', '# will fail on Jinja2 if there are ints/bytes (not strings) in the', '# template which will not allow `env.from_string(template)` to', '# take place.', 't...
Generate a file from a Jinja2 `template` and writes it to `destination` using `params`. `overwrite` allows to overwrite existing files. It is passed to the `generate` method. This is used by the different init implementations to generate init scripts/configs and deploy them to ...
['Generate', 'a', 'file', 'from', 'a', 'Jinja2', 'template', 'and', 'writes', 'it', 'to', 'destination', 'using', 'params', '.']
train
https://github.com/nir0s/serv/blob/7af724ed49c0eb766c37c4b5287b043a8cf99e9c/serv/init/base.py#L163-L198
2,592
rstoneback/pysat
pysat/_constellation.py
Constellation.difference
def difference(self, instrument1, instrument2, bounds, data_labels, cost_function): """ Calculates the difference in signals from multiple instruments within the given bounds. Parameters ---------- instrument1 : Instrument Information must ...
python
def difference(self, instrument1, instrument2, bounds, data_labels, cost_function): """ Calculates the difference in signals from multiple instruments within the given bounds. Parameters ---------- instrument1 : Instrument Information must ...
['def', 'difference', '(', 'self', ',', 'instrument1', ',', 'instrument2', ',', 'bounds', ',', 'data_labels', ',', 'cost_function', ')', ':', '"""\n Draft Pseudocode\n ----------------\n Check integrity of inputs.\n\n Let STD_LABELS be the constant tuple:\n ("time", "lat", "long", "al...
Calculates the difference in signals from multiple instruments within the given bounds. Parameters ---------- instrument1 : Instrument Information must already be loaded into the instrument. instrument2 : Instrument Information must already b...
['Calculates', 'the', 'difference', 'in', 'signals', 'from', 'multiple', 'instruments', 'within', 'the', 'given', 'bounds', '.']
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_constellation.py#L254-L451
2,593
django-haystack/pysolr
pysolr.py
SolrCoreAdmin.create
def create(self, name, instance_dir=None, config='solrconfig.xml', schema='schema.xml'): """http://wiki.apache.org/solr/CoreAdmin#head-7ca1b98a9df8b8ca0dcfbfc49940ed5ac98c4a08""" params = { 'action': 'CREATE', 'name': name, 'config': config, 'schema': sche...
python
def create(self, name, instance_dir=None, config='solrconfig.xml', schema='schema.xml'): """http://wiki.apache.org/solr/CoreAdmin#head-7ca1b98a9df8b8ca0dcfbfc49940ed5ac98c4a08""" params = { 'action': 'CREATE', 'name': name, 'config': config, 'schema': sche...
['def', 'create', '(', 'self', ',', 'name', ',', 'instance_dir', '=', 'None', ',', 'config', '=', "'solrconfig.xml'", ',', 'schema', '=', "'schema.xml'", ')', ':', 'params', '=', '{', "'action'", ':', "'CREATE'", ',', "'name'", ':', 'name', ',', "'config'", ':', 'config', ',', "'schema'", ':', 'schema', ',', '}', 'if',...
http://wiki.apache.org/solr/CoreAdmin#head-7ca1b98a9df8b8ca0dcfbfc49940ed5ac98c4a08
['http', ':', '//', 'wiki', '.', 'apache', '.', 'org', '/', 'solr', '/', 'CoreAdmin#head', '-', '7ca1b98a9df8b8ca0dcfbfc49940ed5ac98c4a08']
train
https://github.com/django-haystack/pysolr/blob/ee28b39324fa21a99842d297e313c1759d8adbd2/pysolr.py#L1145-L1159
2,594
saltstack/salt
salt/states/github.py
team_absent
def team_absent(name, profile="github", **kwargs): ''' Ensure a team is absent. Example: .. code-block:: yaml ensure team test is present in github: github.team_absent: - name: 'test' The following parameters are required: name This is the name o...
python
def team_absent(name, profile="github", **kwargs): ''' Ensure a team is absent. Example: .. code-block:: yaml ensure team test is present in github: github.team_absent: - name: 'test' The following parameters are required: name This is the name o...
['def', 'team_absent', '(', 'name', ',', 'profile', '=', '"github"', ',', '*', '*', 'kwargs', ')', ':', 'ret', '=', '{', "'name'", ':', 'name', ',', "'changes'", ':', '{', '}', ',', "'result'", ':', 'None', ',', "'comment'", ':', "''", '}', 'target', '=', '__salt__', '[', "'github.get_team'", ']', '(', 'name', ',', 'pr...
Ensure a team is absent. Example: .. code-block:: yaml ensure team test is present in github: github.team_absent: - name: 'test' The following parameters are required: name This is the name of the team in the organization. .. versionadded:: 2016.11....
['Ensure', 'a', 'team', 'is', 'absent', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/github.py#L424-L473
2,595
google/transitfeed
transitfeed/problems.py
ExceptionWithContext.GetOrderKey
def GetOrderKey(self): """Return a tuple that can be used to sort problems into a consistent order. Returns: A list of values. """ context_attributes = ['_type'] context_attributes.extend(ExceptionWithContext.CONTEXT_PARTS) context_attributes.extend(self._GetExtraOrderAttributes()) t...
python
def GetOrderKey(self): """Return a tuple that can be used to sort problems into a consistent order. Returns: A list of values. """ context_attributes = ['_type'] context_attributes.extend(ExceptionWithContext.CONTEXT_PARTS) context_attributes.extend(self._GetExtraOrderAttributes()) t...
['def', 'GetOrderKey', '(', 'self', ')', ':', 'context_attributes', '=', '[', "'_type'", ']', 'context_attributes', '.', 'extend', '(', 'ExceptionWithContext', '.', 'CONTEXT_PARTS', ')', 'context_attributes', '.', 'extend', '(', 'self', '.', '_GetExtraOrderAttributes', '(', ')', ')', 'tokens', '=', '[', ']', 'for', 'co...
Return a tuple that can be used to sort problems into a consistent order. Returns: A list of values.
['Return', 'a', 'tuple', 'that', 'can', 'be', 'used', 'to', 'sort', 'problems', 'into', 'a', 'consistent', 'order', '.']
train
https://github.com/google/transitfeed/blob/eb2991a3747ba541b2cb66502b305b6304a1f85f/transitfeed/problems.py#L506-L519
2,596
uw-it-aca/uw-restclients
restclients/bookstore.py
Bookstore.get_verba_link_for_schedule
def get_verba_link_for_schedule(self, schedule): """ Returns a link to verba. The link varies by campus and schedule. Multiple calls to this with the same schedule may result in different urls. """ dao = Book_DAO() url = self.get_verba_url(schedule) res...
python
def get_verba_link_for_schedule(self, schedule): """ Returns a link to verba. The link varies by campus and schedule. Multiple calls to this with the same schedule may result in different urls. """ dao = Book_DAO() url = self.get_verba_url(schedule) res...
['def', 'get_verba_link_for_schedule', '(', 'self', ',', 'schedule', ')', ':', 'dao', '=', 'Book_DAO', '(', ')', 'url', '=', 'self', '.', 'get_verba_url', '(', 'schedule', ')', 'response', '=', 'dao', '.', 'getURL', '(', 'url', ',', '{', '"Accept"', ':', '"application/json"', '}', ')', 'if', 'response', '.', 'status', ...
Returns a link to verba. The link varies by campus and schedule. Multiple calls to this with the same schedule may result in different urls.
['Returns', 'a', 'link', 'to', 'verba', '.', 'The', 'link', 'varies', 'by', 'campus', 'and', 'schedule', '.', 'Multiple', 'calls', 'to', 'this', 'with', 'the', 'same', 'schedule', 'may', 'result', 'in', 'different', 'urls', '.']
train
https://github.com/uw-it-aca/uw-restclients/blob/e12dcd32bf5296b6ebdf71798031594afb7852cb/restclients/bookstore.py#L76-L96
2,597
dask/dask-ml
dask_ml/cluster/spectral.py
_slice_mostly_sorted
def _slice_mostly_sorted(array, keep, rest, ind=None): """Slice dask array `array` that is almost entirely sorted already. We perform approximately `2 * len(keep)` slices on `array`. This is OK, since `keep` is small. Individually, each of these slices is entirely sorted. Parameters ----------...
python
def _slice_mostly_sorted(array, keep, rest, ind=None): """Slice dask array `array` that is almost entirely sorted already. We perform approximately `2 * len(keep)` slices on `array`. This is OK, since `keep` is small. Individually, each of these slices is entirely sorted. Parameters ----------...
['def', '_slice_mostly_sorted', '(', 'array', ',', 'keep', ',', 'rest', ',', 'ind', '=', 'None', ')', ':', 'if', 'ind', 'is', 'None', ':', 'ind', '=', 'np', '.', 'arange', '(', 'len', '(', 'array', ')', ')', 'idx', '=', 'np', '.', 'argsort', '(', 'np', '.', 'concatenate', '(', '[', 'keep', ',', 'ind', '[', 'rest', ']',...
Slice dask array `array` that is almost entirely sorted already. We perform approximately `2 * len(keep)` slices on `array`. This is OK, since `keep` is small. Individually, each of these slices is entirely sorted. Parameters ---------- array : dask.array.Array keep : ndarray[Int] ...
['Slice', 'dask', 'array', 'array', 'that', 'is', 'almost', 'entirely', 'sorted', 'already', '.']
train
https://github.com/dask/dask-ml/blob/cc4837c2c2101f9302cac38354b55754263cd1f3/dask_ml/cluster/spectral.py#L339-L376
2,598
smarie/python-parsyfiles
parsyfiles/parsing_registries.py
AbstractParserCache.get_capabilities_by_type
def get_capabilities_by_type(self, strict_type_matching: bool = False) -> Dict[Type, Dict[str, Dict[str, Parser]]]: """ For all types that are supported, lists all extensions that can be parsed into such a type. For each extension, provides the list of parsers supported. The order is "mo...
python
def get_capabilities_by_type(self, strict_type_matching: bool = False) -> Dict[Type, Dict[str, Dict[str, Parser]]]: """ For all types that are supported, lists all extensions that can be parsed into such a type. For each extension, provides the list of parsers supported. The order is "mo...
['def', 'get_capabilities_by_type', '(', 'self', ',', 'strict_type_matching', ':', 'bool', '=', 'False', ')', '->', 'Dict', '[', 'Type', ',', 'Dict', '[', 'str', ',', 'Dict', '[', 'str', ',', 'Parser', ']', ']', ']', ':', 'check_var', '(', 'strict_type_matching', ',', 'var_types', '=', 'bool', ',', 'var_name', '=', "'s...
For all types that are supported, lists all extensions that can be parsed into such a type. For each extension, provides the list of parsers supported. The order is "most pertinent first" This method is for monitoring and debug, so we prefer to not rely on the cache, but rather on the query eng...
['For', 'all', 'types', 'that', 'are', 'supported', 'lists', 'all', 'extensions', 'that', 'can', 'be', 'parsed', 'into', 'such', 'a', 'type', '.', 'For', 'each', 'extension', 'provides', 'the', 'list', 'of', 'parsers', 'supported', '.', 'The', 'order', 'is', 'most', 'pertinent', 'first']
train
https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/parsing_registries.py#L279-L300
2,599
erdc/RAPIDpy
RAPIDpy/gis/taudem.py
TauDEM.rasterToPolygon
def rasterToPolygon(raster_file, polygon_file): """ Converts watershed raster to polygon and then dissolves it. It dissolves features based on the LINKNO attribute. """ log("Process: Raster to Polygon ...") time_start = datetime.utcnow() temp_polygon_file = \ ...
python
def rasterToPolygon(raster_file, polygon_file): """ Converts watershed raster to polygon and then dissolves it. It dissolves features based on the LINKNO attribute. """ log("Process: Raster to Polygon ...") time_start = datetime.utcnow() temp_polygon_file = \ ...
['def', 'rasterToPolygon', '(', 'raster_file', ',', 'polygon_file', ')', ':', 'log', '(', '"Process: Raster to Polygon ..."', ')', 'time_start', '=', 'datetime', '.', 'utcnow', '(', ')', 'temp_polygon_file', '=', '"{0}_temp.shp"', '.', 'format', '(', 'os', '.', 'path', '.', 'splitext', '(', 'os', '.', 'path', '.', 'bas...
Converts watershed raster to polygon and then dissolves it. It dissolves features based on the LINKNO attribute.
['Converts', 'watershed', 'raster', 'to', 'polygon', 'and', 'then', 'dissolves', 'it', '.', 'It', 'dissolves', 'features', 'based', 'on', 'the', 'LINKNO', 'attribute', '.']
train
https://github.com/erdc/RAPIDpy/blob/50e14e130554b254a00ff23b226cd7e4c6cfe91a/RAPIDpy/gis/taudem.py#L453-L525