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
3,200
noahbenson/neuropythy
neuropythy/vision/retinotopy.py
occipital_flatmap
def occipital_flatmap(cortex, radius=None): ''' occipital_flatmap(cortex) yields a flattened mesh of the occipital cortex of the given cortex object. Note that if the cortex is not registrered to fsaverage, this will fail. The option radius may be given to specify the fraction of the corti...
python
def occipital_flatmap(cortex, radius=None): ''' occipital_flatmap(cortex) yields a flattened mesh of the occipital cortex of the given cortex object. Note that if the cortex is not registrered to fsaverage, this will fail. The option radius may be given to specify the fraction of the corti...
['def', 'occipital_flatmap', '(', 'cortex', ',', 'radius', '=', 'None', ')', ':', 'mdl', '=', 'retinotopy_model', '(', "'benson17'", ',', 'hemi', '=', 'cortex', '.', 'chirality', ')', 'mp', '=', 'mdl', '.', 'map_projection', 'if', 'radius', 'is', 'not', 'None', ':', 'mp', '=', 'mp', '.', 'copy', '(', 'radius', '=', 'ra...
occipital_flatmap(cortex) yields a flattened mesh of the occipital cortex of the given cortex object. Note that if the cortex is not registrered to fsaverage, this will fail. The option radius may be given to specify the fraction of the cortical sphere (in radians) to include in the map.
['occipital_flatmap', '(', 'cortex', ')', 'yields', 'a', 'flattened', 'mesh', 'of', 'the', 'occipital', 'cortex', 'of', 'the', 'given', 'cortex', 'object', '.', 'Note', 'that', 'if', 'the', 'cortex', 'is', 'not', 'registrered', 'to', 'fsaverage', 'this', 'will', 'fail', '.']
train
https://github.com/noahbenson/neuropythy/blob/b588889f6db36ddb9602ae4a72c1c0d3f41586b2/neuropythy/vision/retinotopy.py#L645-L658
3,201
ramrod-project/database-brain
schema/brain/controller/plugins.py
find_plugin
def find_plugin(value, key=DEFAULT_LOOKUP_KEY, conn=None): """ get's the plugin matching the key and value example: find_plugin("plugin1", "ServiceName") => list of 0 or 1 item example: find_plugin("plugin1", "Name") => list of 0-to-many items :param value: :par...
python
def find_plugin(value, key=DEFAULT_LOOKUP_KEY, conn=None): """ get's the plugin matching the key and value example: find_plugin("plugin1", "ServiceName") => list of 0 or 1 item example: find_plugin("plugin1", "Name") => list of 0-to-many items :param value: :par...
['def', 'find_plugin', '(', 'value', ',', 'key', '=', 'DEFAULT_LOOKUP_KEY', ',', 'conn', '=', 'None', ')', ':', '# cast to list to hide rethink internals from caller', 'result', '=', 'list', '(', 'RPC', '.', 'filter', '(', '{', 'key', ':', 'value', '}', ')', '.', 'run', '(', 'conn', ')', ')', 'return', 'result']
get's the plugin matching the key and value example: find_plugin("plugin1", "ServiceName") => list of 0 or 1 item example: find_plugin("plugin1", "Name") => list of 0-to-many items :param value: :param key: <str> (default "Name") :param conn: :return:
['get', 's', 'the', 'plugin', 'matching', 'the', 'key', 'and', 'value']
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/controller/plugins.py#L57-L75
3,202
kpdyer/regex2dfa
third_party/re2/lib/codereview/codereview.py
MySend
def MySend(request_path, payload=None, content_type="application/octet-stream", timeout=None, force_auth=True, **kwargs): """Run MySend1 maybe twice, because Rietveld is unreliable.""" try: return MySend1(request_path, payload, content_type, timeout, force_auth, **kwargs) except Exception, e: if type(e) !=...
python
def MySend(request_path, payload=None, content_type="application/octet-stream", timeout=None, force_auth=True, **kwargs): """Run MySend1 maybe twice, because Rietveld is unreliable.""" try: return MySend1(request_path, payload, content_type, timeout, force_auth, **kwargs) except Exception, e: if type(e) !=...
['def', 'MySend', '(', 'request_path', ',', 'payload', '=', 'None', ',', 'content_type', '=', '"application/octet-stream"', ',', 'timeout', '=', 'None', ',', 'force_auth', '=', 'True', ',', '*', '*', 'kwargs', ')', ':', 'try', ':', 'return', 'MySend1', '(', 'request_path', ',', 'payload', ',', 'content_type', ',', 'tim...
Run MySend1 maybe twice, because Rietveld is unreliable.
['Run', 'MySend1', 'maybe', 'twice', 'because', 'Rietveld', 'is', 'unreliable', '.']
train
https://github.com/kpdyer/regex2dfa/blob/109f877e60ef0dfcb430f11516d215930b7b9936/third_party/re2/lib/codereview/codereview.py#L2444-L2456
3,203
miLibris/flask-rest-jsonapi
flask_rest_jsonapi/schema.py
get_relationships
def get_relationships(schema, model_field=False): """Return relationship fields of a schema :param Schema schema: a marshmallow schema :param list: list of relationship fields of a schema """ relationships = [key for (key, value) in schema._declared_fields.items() if isinstance(value, Relationship)...
python
def get_relationships(schema, model_field=False): """Return relationship fields of a schema :param Schema schema: a marshmallow schema :param list: list of relationship fields of a schema """ relationships = [key for (key, value) in schema._declared_fields.items() if isinstance(value, Relationship)...
['def', 'get_relationships', '(', 'schema', ',', 'model_field', '=', 'False', ')', ':', 'relationships', '=', '[', 'key', 'for', '(', 'key', ',', 'value', ')', 'in', 'schema', '.', '_declared_fields', '.', 'items', '(', ')', 'if', 'isinstance', '(', 'value', ',', 'Relationship', ')', ']', 'if', 'model_field', 'is', 'Tr...
Return relationship fields of a schema :param Schema schema: a marshmallow schema :param list: list of relationship fields of a schema
['Return', 'relationship', 'fields', 'of', 'a', 'schema']
train
https://github.com/miLibris/flask-rest-jsonapi/blob/ecc8f2cd2b54cc0bfae7acd6cffcda0ba1140c43/flask_rest_jsonapi/schema.py#L119-L130
3,204
Azure/msrest-for-python
msrest/polling/poller.py
LROPoller._start
def _start(self): """Start the long running operation. On completion, runs any callbacks. :param callable update_cmd: The API reuqest to check the status of the operation. """ try: self._polling_method.run() except Exception as err: self....
python
def _start(self): """Start the long running operation. On completion, runs any callbacks. :param callable update_cmd: The API reuqest to check the status of the operation. """ try: self._polling_method.run() except Exception as err: self....
['def', '_start', '(', 'self', ')', ':', 'try', ':', 'self', '.', '_polling_method', '.', 'run', '(', ')', 'except', 'Exception', 'as', 'err', ':', 'self', '.', '_exception', '=', 'err', 'finally', ':', 'self', '.', '_done', '.', 'set', '(', ')', 'callbacks', ',', 'self', '.', '_callbacks', '=', 'self', '.', '_callback...
Start the long running operation. On completion, runs any callbacks. :param callable update_cmd: The API reuqest to check the status of the operation.
['Start', 'the', 'long', 'running', 'operation', '.', 'On', 'completion', 'runs', 'any', 'callbacks', '.']
train
https://github.com/Azure/msrest-for-python/blob/0732bc90bdb290e5f58c675ffdd7dbfa9acefc93/msrest/polling/poller.py#L144-L163
3,205
jxtech/wechatpy
wechatpy/utils.py
timezone
def timezone(zone): """Try to get timezone using pytz or python-dateutil :param zone: timezone str :return: timezone tzinfo or None """ try: import pytz return pytz.timezone(zone) except ImportError: pass try: from dateutil.tz import gettz return gett...
python
def timezone(zone): """Try to get timezone using pytz or python-dateutil :param zone: timezone str :return: timezone tzinfo or None """ try: import pytz return pytz.timezone(zone) except ImportError: pass try: from dateutil.tz import gettz return gett...
['def', 'timezone', '(', 'zone', ')', ':', 'try', ':', 'import', 'pytz', 'return', 'pytz', '.', 'timezone', '(', 'zone', ')', 'except', 'ImportError', ':', 'pass', 'try', ':', 'from', 'dateutil', '.', 'tz', 'import', 'gettz', 'return', 'gettz', '(', 'zone', ')', 'except', 'ImportError', ':', 'return', 'None']
Try to get timezone using pytz or python-dateutil :param zone: timezone str :return: timezone tzinfo or None
['Try', 'to', 'get', 'timezone', 'using', 'pytz', 'or', 'python', '-', 'dateutil']
train
https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/utils.py#L106-L121
3,206
IdentityPython/pysaml2
src/saml2/httpbase.py
HTTPBase.send_using_soap
def send_using_soap(self, request, destination, headers=None, sign=False): """ Send a message using SOAP+POST :param request: :param destination: :param headers: :param sign: :return: """ # _response = self.server.post(soap_message, headers, path...
python
def send_using_soap(self, request, destination, headers=None, sign=False): """ Send a message using SOAP+POST :param request: :param destination: :param headers: :param sign: :return: """ # _response = self.server.post(soap_message, headers, path...
['def', 'send_using_soap', '(', 'self', ',', 'request', ',', 'destination', ',', 'headers', '=', 'None', ',', 'sign', '=', 'False', ')', ':', '# _response = self.server.post(soap_message, headers, path=path)', 'try', ':', 'args', '=', 'self', '.', 'use_soap', '(', 'request', ',', 'destination', ',', 'headers', ',', 'si...
Send a message using SOAP+POST :param request: :param destination: :param headers: :param sign: :return:
['Send', 'a', 'message', 'using', 'SOAP', '+', 'POST']
train
https://github.com/IdentityPython/pysaml2/blob/d3aa78eeb7d37c12688f783cb4db1c7263a14ad6/src/saml2/httpbase.py#L361-L385
3,207
Parsl/libsubmit
libsubmit/providers/local/local.py
LocalProvider.status
def status(self, job_ids): ''' Get the status of a list of jobs identified by their ids. Args: - job_ids (List of ids) : List of identifiers for the jobs Returns: - List of status codes. ''' logging.debug("Checking status of : {0}".format(job_ids)) ...
python
def status(self, job_ids): ''' Get the status of a list of jobs identified by their ids. Args: - job_ids (List of ids) : List of identifiers for the jobs Returns: - List of status codes. ''' logging.debug("Checking status of : {0}".format(job_ids)) ...
['def', 'status', '(', 'self', ',', 'job_ids', ')', ':', 'logging', '.', 'debug', '(', '"Checking status of : {0}"', '.', 'format', '(', 'job_ids', ')', ')', 'for', 'job_id', 'in', 'self', '.', 'resources', ':', 'poll_code', '=', 'self', '.', 'resources', '[', 'job_id', ']', '[', "'proc'", ']', '.', 'poll', '(', ')', '...
Get the status of a list of jobs identified by their ids. Args: - job_ids (List of ids) : List of identifiers for the jobs Returns: - List of status codes.
['Get', 'the', 'status', 'of', 'a', 'list', 'of', 'jobs', 'identified', 'by', 'their', 'ids', '.']
train
https://github.com/Parsl/libsubmit/blob/27a41c16dd6f1c16d830a9ce1c97804920a59f64/libsubmit/providers/local/local.py#L77-L101
3,208
pywbem/pywbem
attic/cim_provider.py
CIMProvider.MI_referenceNames
def MI_referenceNames(self, env, objectName, resultClassName, role): # pylint: disable=invalid-name """Return instance names of an association class. Implements the WBEM operation ReferenceNa...
python
def MI_referenceNames(self, env, objectName, resultClassName, role): # pylint: disable=invalid-name """Return instance names of an association class. Implements the WBEM operation ReferenceNa...
['def', 'MI_referenceNames', '(', 'self', ',', 'env', ',', 'objectName', ',', 'resultClassName', ',', 'role', ')', ':', '# pylint: disable=invalid-name', 'logger', '=', 'env', '.', 'get_logger', '(', ')', 'logger', '.', 'log_debug', '(', "'CIMProvider MI_referenceNames <2> called. '", "'resultClass: %s'", '%', '(', 're...
Return instance names of an association class. Implements the WBEM operation ReferenceNames in terms of the references method. A derived class will not normally override this method.
['Return', 'instance', 'names', 'of', 'an', 'association', 'class', '.']
train
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/attic/cim_provider.py#L892-L950
3,209
django-treebeard/django-treebeard
treebeard/mp_tree.py
MP_Node.get_siblings
def get_siblings(self): """ :returns: A queryset of all the node's siblings, including the node itself. """ qset = get_result_class(self.__class__).objects.filter( depth=self.depth ).order_by( 'path' ) if self.depth > 1: ...
python
def get_siblings(self): """ :returns: A queryset of all the node's siblings, including the node itself. """ qset = get_result_class(self.__class__).objects.filter( depth=self.depth ).order_by( 'path' ) if self.depth > 1: ...
['def', 'get_siblings', '(', 'self', ')', ':', 'qset', '=', 'get_result_class', '(', 'self', '.', '__class__', ')', '.', 'objects', '.', 'filter', '(', 'depth', '=', 'self', '.', 'depth', ')', '.', 'order_by', '(', "'path'", ')', 'if', 'self', '.', 'depth', '>', '1', ':', '# making sure the non-root nodes share a paren...
:returns: A queryset of all the node's siblings, including the node itself.
[':', 'returns', ':', 'A', 'queryset', 'of', 'all', 'the', 'node', 's', 'siblings', 'including', 'the', 'node', 'itself', '.']
train
https://github.com/django-treebeard/django-treebeard/blob/8042ee939cb45394909237da447f8925e3cc6aa3/treebeard/mp_tree.py#L920-L935
3,210
LinuxChristian/pyW215
pyW215/pyW215.py
SmartPlug.total_consumption
def total_consumption(self): """Get the total power consumpuntion in the device lifetime.""" if self.use_legacy_protocol: # TotalConsumption currently fails on the legacy protocol and # creates a mess in the logs. Just return 'N/A' for now. return 'N/A' res =...
python
def total_consumption(self): """Get the total power consumpuntion in the device lifetime.""" if self.use_legacy_protocol: # TotalConsumption currently fails on the legacy protocol and # creates a mess in the logs. Just return 'N/A' for now. return 'N/A' res =...
['def', 'total_consumption', '(', 'self', ')', ':', 'if', 'self', '.', 'use_legacy_protocol', ':', '# TotalConsumption currently fails on the legacy protocol and', "# creates a mess in the logs. Just return 'N/A' for now.", 'return', "'N/A'", 'res', '=', "'N/A'", 'try', ':', 'res', '=', 'self', '.', 'SOAPAction', '(', ...
Get the total power consumpuntion in the device lifetime.
['Get', 'the', 'total', 'power', 'consumpuntion', 'in', 'the', 'device', 'lifetime', '.']
train
https://github.com/LinuxChristian/pyW215/blob/63e50b8ee11bc38ed66554f9b92429b552dda550/pyW215/pyW215.py#L229-L250
3,211
viralogic/py-enumerable
py_linq/py_linq3.py
Enumerable3.order_by_descending
def order_by_descending(self, key): """ Returns new Enumerable sorted in descending order by given key :param key: key to sort by as lambda expression :return: new Enumerable object """ if key is None: raise NullArgumentError(u"No key for sorting given") ...
python
def order_by_descending(self, key): """ Returns new Enumerable sorted in descending order by given key :param key: key to sort by as lambda expression :return: new Enumerable object """ if key is None: raise NullArgumentError(u"No key for sorting given") ...
['def', 'order_by_descending', '(', 'self', ',', 'key', ')', ':', 'if', 'key', 'is', 'None', ':', 'raise', 'NullArgumentError', '(', 'u"No key for sorting given"', ')', 'kf', '=', '[', 'OrderingDirection', '(', 'key', ',', 'reverse', '=', 'True', ')', ']', 'return', 'SortedEnumerable3', '(', 'kf', ',', 'self', '.', '_d...
Returns new Enumerable sorted in descending order by given key :param key: key to sort by as lambda expression :return: new Enumerable object
['Returns', 'new', 'Enumerable', 'sorted', 'in', 'descending', 'order', 'by', 'given', 'key', ':', 'param', 'key', ':', 'key', 'to', 'sort', 'by', 'as', 'lambda', 'expression', ':', 'return', ':', 'new', 'Enumerable', 'object']
train
https://github.com/viralogic/py-enumerable/blob/63363649bccef223379e1e87056747240c83aa9d/py_linq/py_linq3.py#L188-L197
3,212
yatiml/yatiml
yatiml/representers.py
Representer.__sweeten
def __sweeten(self, dumper: 'Dumper', class_: Type, node: Node) -> None: """Applies the user's yatiml_sweeten() function(s), if any. Sweetening is done for the base classes first, then for the \ derived classes, down the hierarchy to the class we're \ constructing. Args: ...
python
def __sweeten(self, dumper: 'Dumper', class_: Type, node: Node) -> None: """Applies the user's yatiml_sweeten() function(s), if any. Sweetening is done for the base classes first, then for the \ derived classes, down the hierarchy to the class we're \ constructing. Args: ...
['def', '__sweeten', '(', 'self', ',', 'dumper', ':', "'Dumper'", ',', 'class_', ':', 'Type', ',', 'node', ':', 'Node', ')', '->', 'None', ':', 'for', 'base_class', 'in', 'class_', '.', '__bases__', ':', 'if', 'base_class', 'in', 'dumper', '.', 'yaml_representers', ':', 'logger', '.', 'debug', '(', "'Sweetening for cla...
Applies the user's yatiml_sweeten() function(s), if any. Sweetening is done for the base classes first, then for the \ derived classes, down the hierarchy to the class we're \ constructing. Args: dumper: The dumper that is dumping this object. class_: The type o...
['Applies', 'the', 'user', 's', 'yatiml_sweeten', '()', 'function', '(', 's', ')', 'if', 'any', '.']
train
https://github.com/yatiml/yatiml/blob/4f55c058b72388350f0af3076ac3ea9bc1c142b0/yatiml/representers.py#L80-L98
3,213
sirfoga/pyhal
hal/maths/primes.py
Integer.is_probably_prime
def is_probably_prime(self): """Tests with miller-rabin :return: True iff prime """ if self.is_naive_prime(): return True # check if multiple pf low primes for prime in LOW_PRIMES: if self.to_int % prime == 0: return False ...
python
def is_probably_prime(self): """Tests with miller-rabin :return: True iff prime """ if self.is_naive_prime(): return True # check if multiple pf low primes for prime in LOW_PRIMES: if self.to_int % prime == 0: return False ...
['def', 'is_probably_prime', '(', 'self', ')', ':', 'if', 'self', '.', 'is_naive_prime', '(', ')', ':', 'return', 'True', '# check if multiple pf low primes', 'for', 'prime', 'in', 'LOW_PRIMES', ':', 'if', 'self', '.', 'to_int', '%', 'prime', '==', '0', ':', 'return', 'False', '# if all else fails, call rabin to determ...
Tests with miller-rabin :return: True iff prime
['Tests', 'with', 'miller', '-', 'rabin', ':', 'return', ':', 'True', 'iff', 'prime']
train
https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/maths/primes.py#L44-L58
3,214
google/grr
grr/core/grr_response_core/stats/default_stats_collector.py
DefaultStatsCollector.RecordEvent
def RecordEvent(self, metric_name, value, fields=None): """See base class.""" self._event_metrics[metric_name].Record(value, fields)
python
def RecordEvent(self, metric_name, value, fields=None): """See base class.""" self._event_metrics[metric_name].Record(value, fields)
['def', 'RecordEvent', '(', 'self', ',', 'metric_name', ',', 'value', ',', 'fields', '=', 'None', ')', ':', 'self', '.', '_event_metrics', '[', 'metric_name', ']', '.', 'Record', '(', 'value', ',', 'fields', ')']
See base class.
['See', 'base', 'class', '.']
train
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/stats/default_stats_collector.py#L190-L192
3,215
saltstack/salt
salt/utils/data.py
compare_lists
def compare_lists(old=None, new=None): ''' Compare before and after results from various salt functions, returning a dict describing the changes that were made ''' ret = dict() for item in new: if item not in old: ret['new'] = item for item in old: if item not in ...
python
def compare_lists(old=None, new=None): ''' Compare before and after results from various salt functions, returning a dict describing the changes that were made ''' ret = dict() for item in new: if item not in old: ret['new'] = item for item in old: if item not in ...
['def', 'compare_lists', '(', 'old', '=', 'None', ',', 'new', '=', 'None', ')', ':', 'ret', '=', 'dict', '(', ')', 'for', 'item', 'in', 'new', ':', 'if', 'item', 'not', 'in', 'old', ':', 'ret', '[', "'new'", ']', '=', 'item', 'for', 'item', 'in', 'old', ':', 'if', 'item', 'not', 'in', 'new', ':', 'ret', '[', "'old'", '...
Compare before and after results from various salt functions, returning a dict describing the changes that were made
['Compare', 'before', 'and', 'after', 'results', 'from', 'various', 'salt', 'functions', 'returning', 'a', 'dict', 'describing', 'the', 'changes', 'that', 'were', 'made']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/data.py#L147-L159
3,216
textbook/atmdb
atmdb/core.py
Service.calculate_timeout
def calculate_timeout(http_date): """Extract request timeout from e.g. ``Retry-After`` header. Notes: Per :rfc:`2616#section-14.37`, the ``Retry-After`` header can be either an integer number of seconds or an HTTP date. This function can handle either. Arguments: ...
python
def calculate_timeout(http_date): """Extract request timeout from e.g. ``Retry-After`` header. Notes: Per :rfc:`2616#section-14.37`, the ``Retry-After`` header can be either an integer number of seconds or an HTTP date. This function can handle either. Arguments: ...
['def', 'calculate_timeout', '(', 'http_date', ')', ':', 'try', ':', 'return', 'int', '(', 'http_date', ')', 'except', 'ValueError', ':', 'date_after', '=', 'parse', '(', 'http_date', ')', 'utc_now', '=', 'datetime', '.', 'now', '(', 'tz', '=', 'timezone', '.', 'utc', ')', 'return', 'int', '(', '(', 'date_after', '-', ...
Extract request timeout from e.g. ``Retry-After`` header. Notes: Per :rfc:`2616#section-14.37`, the ``Retry-After`` header can be either an integer number of seconds or an HTTP date. This function can handle either. Arguments: http_date (:py:class:`str`): The da...
['Extract', 'request', 'timeout', 'from', 'e', '.', 'g', '.', 'Retry', '-', 'After', 'header', '.']
train
https://github.com/textbook/atmdb/blob/cab14547d2e777a1e26c2560266365c484855789/atmdb/core.py#L65-L85
3,217
GPflow/GPflow
gpflow/conditionals.py
_sample_conditional
def _sample_conditional(Xnew, feat, kern, f, *, full_cov=False, full_output_cov=False, q_sqrt=None, white=False, num_samples=None): """ `sample_conditional` will return a sample from the conditional distribution. In most cases this means calculating the conditional mean m and variance v and then returni...
python
def _sample_conditional(Xnew, feat, kern, f, *, full_cov=False, full_output_cov=False, q_sqrt=None, white=False, num_samples=None): """ `sample_conditional` will return a sample from the conditional distribution. In most cases this means calculating the conditional mean m and variance v and then returni...
['def', '_sample_conditional', '(', 'Xnew', ',', 'feat', ',', 'kern', ',', 'f', ',', '*', ',', 'full_cov', '=', 'False', ',', 'full_output_cov', '=', 'False', ',', 'q_sqrt', '=', 'None', ',', 'white', '=', 'False', ',', 'num_samples', '=', 'None', ')', ':', 'if', 'full_cov', 'and', 'full_output_cov', ':', 'raise', 'Not...
`sample_conditional` will return a sample from the conditional distribution. In most cases this means calculating the conditional mean m and variance v and then returning m + sqrt(v) * eps, with eps ~ N(0, 1). However, for some combinations of Mok and Mof more efficient sampling routines exists. The dis...
['sample_conditional', 'will', 'return', 'a', 'sample', 'from', 'the', 'conditional', 'distribution', '.', 'In', 'most', 'cases', 'this', 'means', 'calculating', 'the', 'conditional', 'mean', 'm', 'and', 'variance', 'v', 'and', 'then', 'returning', 'm', '+', 'sqrt', '(', 'v', ')', '*', 'eps', 'with', 'eps', '~', 'N', '...
train
https://github.com/GPflow/GPflow/blob/549394f0b1b0696c7b521a065e49bdae6e7acf27/gpflow/conditionals.py#L138-L170
3,218
cisco-sas/kitty
kitty/model/low_level/encoder.py
StrNullTerminatedEncoder.encode
def encode(self, value): ''' :param value: value to encode ''' encoded = strToBytes(value) + b'\x00' return Bits(bytes=encoded)
python
def encode(self, value): ''' :param value: value to encode ''' encoded = strToBytes(value) + b'\x00' return Bits(bytes=encoded)
['def', 'encode', '(', 'self', ',', 'value', ')', ':', 'encoded', '=', 'strToBytes', '(', 'value', ')', '+', "b'\\x00'", 'return', 'Bits', '(', 'bytes', '=', 'encoded', ')']
:param value: value to encode
[':', 'param', 'value', ':', 'value', 'to', 'encode']
train
https://github.com/cisco-sas/kitty/blob/cb0760989dcdfe079e43ac574d872d0b18953a32/kitty/model/low_level/encoder.py#L158-L163
3,219
bwhite/hadoopy
hadoopy/thirdparty/pyinstaller/PyInstaller/build.py
set_dependencies
def set_dependencies(analysis, dependencies, path): """ Syncronize the Analysis result with the needed dependencies. """ for toc in (analysis.binaries, analysis.datas): for i, tpl in enumerate(toc): if not tpl[1] in dependencies.keys(): logger.info("Adding dependency...
python
def set_dependencies(analysis, dependencies, path): """ Syncronize the Analysis result with the needed dependencies. """ for toc in (analysis.binaries, analysis.datas): for i, tpl in enumerate(toc): if not tpl[1] in dependencies.keys(): logger.info("Adding dependency...
['def', 'set_dependencies', '(', 'analysis', ',', 'dependencies', ',', 'path', ')', ':', 'for', 'toc', 'in', '(', 'analysis', '.', 'binaries', ',', 'analysis', '.', 'datas', ')', ':', 'for', 'i', ',', 'tpl', 'in', 'enumerate', '(', 'toc', ')', ':', 'if', 'not', 'tpl', '[', '1', ']', 'in', 'dependencies', '.', 'keys', '...
Syncronize the Analysis result with the needed dependencies.
['Syncronize', 'the', 'Analysis', 'result', 'with', 'the', 'needed', 'dependencies', '.']
train
https://github.com/bwhite/hadoopy/blob/ff39b4e6d4e6efaf1f571cf0f2c0e0d7ab28c2d6/hadoopy/thirdparty/pyinstaller/PyInstaller/build.py#L1458-L1474
3,220
rmed/flask-waffleconf
flask_waffleconf/core.py
_WaffleState.update_conf
def update_conf(self): """Update configuration values from database. This method should be called when there is an update notification. """ parsed = self.parse_conf() if not parsed: return None # Update app config self.app.config.update(parsed)
python
def update_conf(self): """Update configuration values from database. This method should be called when there is an update notification. """ parsed = self.parse_conf() if not parsed: return None # Update app config self.app.config.update(parsed)
['def', 'update_conf', '(', 'self', ')', ':', 'parsed', '=', 'self', '.', 'parse_conf', '(', ')', 'if', 'not', 'parsed', ':', 'return', 'None', '# Update app config', 'self', '.', 'app', '.', 'config', '.', 'update', '(', 'parsed', ')']
Update configuration values from database. This method should be called when there is an update notification.
['Update', 'configuration', 'values', 'from', 'database', '.']
train
https://github.com/rmed/flask-waffleconf/blob/a75ed69101796c9f3f42eff9f91e91dc6dd13869/flask_waffleconf/core.py#L146-L157
3,221
markovmodel/msmtools
msmtools/flux/dense/tpt.py
coarsegrain
def coarsegrain(F, sets): r"""Coarse-grains the flux to the given sets $fc_{i,j} = \sum_{i \in I,j \in J} f_{i,j}$ Note that if you coarse-grain a net flux, it does not necessarily have a net flux property anymore. If want to make sure you get a netflux, use to_netflux(coarsegrain(F,sets)). Pa...
python
def coarsegrain(F, sets): r"""Coarse-grains the flux to the given sets $fc_{i,j} = \sum_{i \in I,j \in J} f_{i,j}$ Note that if you coarse-grain a net flux, it does not necessarily have a net flux property anymore. If want to make sure you get a netflux, use to_netflux(coarsegrain(F,sets)). Pa...
['def', 'coarsegrain', '(', 'F', ',', 'sets', ')', ':', 'nnew', '=', 'len', '(', 'sets', ')', 'Fc', '=', 'np', '.', 'zeros', '(', '(', 'nnew', ',', 'nnew', ')', ')', 'for', 'i', 'in', 'range', '(', '0', ',', 'nnew', '-', '1', ')', ':', 'for', 'j', 'in', 'range', '(', 'i', '+', '1', ',', 'nnew', ')', ':', 'I', '=', 'lis...
r"""Coarse-grains the flux to the given sets $fc_{i,j} = \sum_{i \in I,j \in J} f_{i,j}$ Note that if you coarse-grain a net flux, it does not necessarily have a net flux property anymore. If want to make sure you get a netflux, use to_netflux(coarsegrain(F,sets)). Parameters ---------- F ...
['r', 'Coarse', '-', 'grains', 'the', 'flux', 'to', 'the', 'given', 'sets']
train
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/dense/tpt.py#L186-L210
3,222
lrq3000/pyFileFixity
pyFileFixity/lib/reedsolomon/reedsolo.py
rs_find_error_evaluator
def rs_find_error_evaluator(synd, err_loc, nsym): '''Compute the error (or erasures if you supply sigma=erasures locator polynomial, or errata) evaluator polynomial Omega from the syndrome and the error/erasures/errata locator Sigma. Omega is already computed at the same time as Sigma inside the Berlekamp-Massey im...
python
def rs_find_error_evaluator(synd, err_loc, nsym): '''Compute the error (or erasures if you supply sigma=erasures locator polynomial, or errata) evaluator polynomial Omega from the syndrome and the error/erasures/errata locator Sigma. Omega is already computed at the same time as Sigma inside the Berlekamp-Massey im...
['def', 'rs_find_error_evaluator', '(', 'synd', ',', 'err_loc', ',', 'nsym', ')', ':', '# Omega(x) = [ Synd(x) * Error_loc(x) ] mod x^(n-k+1)', '_', ',', 'remainder', '=', 'gf_poly_div', '(', 'gf_poly_mul', '(', 'synd', ',', 'err_loc', ')', ',', '(', '[', '1', ']', '+', '[', '0', ']', '*', '(', 'nsym', '+', '1', ')', '...
Compute the error (or erasures if you supply sigma=erasures locator polynomial, or errata) evaluator polynomial Omega from the syndrome and the error/erasures/errata locator Sigma. Omega is already computed at the same time as Sigma inside the Berlekamp-Massey implemented above, but in case you modify Sigma, you can re...
['Compute', 'the', 'error', '(', 'or', 'erasures', 'if', 'you', 'supply', 'sigma', '=', 'erasures', 'locator', 'polynomial', 'or', 'errata', ')', 'evaluator', 'polynomial', 'Omega', 'from', 'the', 'syndrome', 'and', 'the', 'error', '/', 'erasures', '/', 'errata', 'locator', 'Sigma', '.', 'Omega', 'is', 'already', 'comp...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/reedsolomon/reedsolo.py#L577-L586
3,223
MaxHalford/starboost
starboost/boosting.py
BoostingClassifier.iter_predict_proba
def iter_predict_proba(self, X, include_init=False): """Returns the predicted probabilities for ``X`` at every stage of the boosting procedure. Arguments: X (array-like or sparse matrix of shape (n_samples, n_features)): The input samples. Sparse matrices are accepted only i...
python
def iter_predict_proba(self, X, include_init=False): """Returns the predicted probabilities for ``X`` at every stage of the boosting procedure. Arguments: X (array-like or sparse matrix of shape (n_samples, n_features)): The input samples. Sparse matrices are accepted only i...
['def', 'iter_predict_proba', '(', 'self', ',', 'X', ',', 'include_init', '=', 'False', ')', ':', 'utils', '.', 'validation', '.', 'check_is_fitted', '(', 'self', ',', "'init_estimator_'", ')', 'X', '=', 'utils', '.', 'check_array', '(', 'X', ',', 'accept_sparse', '=', '[', "'csr'", ',', "'csc'", ']', ',', 'dtype', '='...
Returns the predicted probabilities for ``X`` at every stage of the boosting procedure. Arguments: X (array-like or sparse matrix of shape (n_samples, n_features)): The input samples. Sparse matrices are accepted only if they are supported by the weak model. include_init...
['Returns', 'the', 'predicted', 'probabilities', 'for', 'X', 'at', 'every', 'stage', 'of', 'the', 'boosting', 'procedure', '.']
train
https://github.com/MaxHalford/starboost/blob/59d96dcc983404cbc326878facd8171fd2655ce1/starboost/boosting.py#L343-L367
3,224
creare-com/pydem
pydem/processing_manager.py
TileEdgeFile.get_edge_init_data
def get_edge_init_data(self, fn, save_path=None): """ Creates the initialization data from the edge structure """ edge_init_data = {key: self.edges[fn][key].get('data') for key in self.edges[fn].keys()} edge_init_done = {key: self.edges[fn][key].get('do...
python
def get_edge_init_data(self, fn, save_path=None): """ Creates the initialization data from the edge structure """ edge_init_data = {key: self.edges[fn][key].get('data') for key in self.edges[fn].keys()} edge_init_done = {key: self.edges[fn][key].get('do...
['def', 'get_edge_init_data', '(', 'self', ',', 'fn', ',', 'save_path', '=', 'None', ')', ':', 'edge_init_data', '=', '{', 'key', ':', 'self', '.', 'edges', '[', 'fn', ']', '[', 'key', ']', '.', 'get', '(', "'data'", ')', 'for', 'key', 'in', 'self', '.', 'edges', '[', 'fn', ']', '.', 'keys', '(', ')', '}', 'edge_init_d...
Creates the initialization data from the edge structure
['Creates', 'the', 'initialization', 'data', 'from', 'the', 'edge', 'structure']
train
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/processing_manager.py#L503-L514
3,225
erikvw/django-collect-offline-files
django_collect_offline_files/transaction/transaction_importer.py
JSONLoadFile.deserialized_objects
def deserialized_objects(self): """Returns a generator of deserialized objects. """ if not self._deserialized_objects: json_text = self.read() self._deserialized_objects = self.deserialize(json_text=json_text) return self._deserialized_objects
python
def deserialized_objects(self): """Returns a generator of deserialized objects. """ if not self._deserialized_objects: json_text = self.read() self._deserialized_objects = self.deserialize(json_text=json_text) return self._deserialized_objects
['def', 'deserialized_objects', '(', 'self', ')', ':', 'if', 'not', 'self', '.', '_deserialized_objects', ':', 'json_text', '=', 'self', '.', 'read', '(', ')', 'self', '.', '_deserialized_objects', '=', 'self', '.', 'deserialize', '(', 'json_text', '=', 'json_text', ')', 'return', 'self', '.', '_deserialized_objects']
Returns a generator of deserialized objects.
['Returns', 'a', 'generator', 'of', 'deserialized', 'objects', '.']
train
https://github.com/erikvw/django-collect-offline-files/blob/78f61c823ea3926eb88206b019b5dca3c36017da/django_collect_offline_files/transaction/transaction_importer.py#L78-L84
3,226
PlaidWeb/Publ
publ/category.py
Category.description
def description(self): """ Get the textual description of the category """ if self._meta and self._meta.get_payload(): return utils.TrueCallableProxy(self._description) return utils.CallableProxy(None)
python
def description(self): """ Get the textual description of the category """ if self._meta and self._meta.get_payload(): return utils.TrueCallableProxy(self._description) return utils.CallableProxy(None)
['def', 'description', '(', 'self', ')', ':', 'if', 'self', '.', '_meta', 'and', 'self', '.', '_meta', '.', 'get_payload', '(', ')', ':', 'return', 'utils', '.', 'TrueCallableProxy', '(', 'self', '.', '_description', ')', 'return', 'utils', '.', 'CallableProxy', '(', 'None', ')']
Get the textual description of the category
['Get', 'the', 'textual', 'description', 'of', 'the', 'category']
train
https://github.com/PlaidWeb/Publ/blob/ce7893632ddc3cb70b4978a41ffd7dd06fa13565/publ/category.py#L127-L131
3,227
welbornprod/colr
colr/trans.py
hex2termhex
def hex2termhex(hexval: str, allow_short: bool = False) -> str: """ Convert a hex value into the nearest terminal color matched hex. """ return rgb2termhex(*hex2rgb(hexval, allow_short=allow_short))
python
def hex2termhex(hexval: str, allow_short: bool = False) -> str: """ Convert a hex value into the nearest terminal color matched hex. """ return rgb2termhex(*hex2rgb(hexval, allow_short=allow_short))
['def', 'hex2termhex', '(', 'hexval', ':', 'str', ',', 'allow_short', ':', 'bool', '=', 'False', ')', '->', 'str', ':', 'return', 'rgb2termhex', '(', '*', 'hex2rgb', '(', 'hexval', ',', 'allow_short', '=', 'allow_short', ')', ')']
Convert a hex value into the nearest terminal color matched hex.
['Convert', 'a', 'hex', 'value', 'into', 'the', 'nearest', 'terminal', 'color', 'matched', 'hex', '.']
train
https://github.com/welbornprod/colr/blob/417117fdbddbc53142096685ac2af006b2bd0220/colr/trans.py#L385-L387
3,228
CybOXProject/mixbox
mixbox/fields.py
iterfields
def iterfields(klass): """Iterate over the input class members and yield its TypedFields. Args: klass: A class (usually an Entity subclass). Yields: (class attribute name, TypedField instance) tuples. """ is_field = lambda x: isinstance(x, TypedField) for name, field in inspec...
python
def iterfields(klass): """Iterate over the input class members and yield its TypedFields. Args: klass: A class (usually an Entity subclass). Yields: (class attribute name, TypedField instance) tuples. """ is_field = lambda x: isinstance(x, TypedField) for name, field in inspec...
['def', 'iterfields', '(', 'klass', ')', ':', 'is_field', '=', 'lambda', 'x', ':', 'isinstance', '(', 'x', ',', 'TypedField', ')', 'for', 'name', ',', 'field', 'in', 'inspect', '.', 'getmembers', '(', 'klass', ',', 'predicate', '=', 'is_field', ')', ':', 'yield', 'name', ',', 'field']
Iterate over the input class members and yield its TypedFields. Args: klass: A class (usually an Entity subclass). Yields: (class attribute name, TypedField instance) tuples.
['Iterate', 'over', 'the', 'input', 'class', 'members', 'and', 'yield', 'its', 'TypedFields', '.']
train
https://github.com/CybOXProject/mixbox/blob/9097dae7a433f5b98c18171c4a5598f69a7d30af/mixbox/fields.py#L50-L62
3,229
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/type.py
change_generated_target_suffix
def change_generated_target_suffix (type, properties, suffix): """ Change the suffix previously registered for this type/properties combination. If suffix is not yet specified, sets it. """ assert isinstance(type, basestring) assert is_iterable_typed(properties, basestring) assert isinstance...
python
def change_generated_target_suffix (type, properties, suffix): """ Change the suffix previously registered for this type/properties combination. If suffix is not yet specified, sets it. """ assert isinstance(type, basestring) assert is_iterable_typed(properties, basestring) assert isinstance...
['def', 'change_generated_target_suffix', '(', 'type', ',', 'properties', ',', 'suffix', ')', ':', 'assert', 'isinstance', '(', 'type', ',', 'basestring', ')', 'assert', 'is_iterable_typed', '(', 'properties', ',', 'basestring', ')', 'assert', 'isinstance', '(', 'suffix', ',', 'basestring', ')', 'change_generated_targe...
Change the suffix previously registered for this type/properties combination. If suffix is not yet specified, sets it.
['Change', 'the', 'suffix', 'previously', 'registered', 'for', 'this', 'type', '/', 'properties', 'combination', '.', 'If', 'suffix', 'is', 'not', 'yet', 'specified', 'sets', 'it', '.']
train
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/type.py#L242-L249
3,230
rigetti/pyquil
pyquil/quil.py
merge_programs
def merge_programs(prog_list): """ Merges a list of pyQuil programs into a single one by appending them in sequence. If multiple programs in the list contain the same gate and/or noisy gate definition with identical name, this definition will only be applied once. If different definitions with the s...
python
def merge_programs(prog_list): """ Merges a list of pyQuil programs into a single one by appending them in sequence. If multiple programs in the list contain the same gate and/or noisy gate definition with identical name, this definition will only be applied once. If different definitions with the s...
['def', 'merge_programs', '(', 'prog_list', ')', ':', 'definitions', '=', '[', 'gate', 'for', 'prog', 'in', 'prog_list', 'for', 'gate', 'in', 'Program', '(', 'prog', ')', '.', 'defined_gates', ']', 'seen', '=', '{', '}', '# Collect definitions in reverse order and reapply definitions in reverse', '# collected order to ...
Merges a list of pyQuil programs into a single one by appending them in sequence. If multiple programs in the list contain the same gate and/or noisy gate definition with identical name, this definition will only be applied once. If different definitions with the same name appear multiple times in the progr...
['Merges', 'a', 'list', 'of', 'pyQuil', 'programs', 'into', 'a', 'single', 'one', 'by', 'appending', 'them', 'in', 'sequence', '.', 'If', 'multiple', 'programs', 'in', 'the', 'list', 'contain', 'the', 'same', 'gate', 'and', '/', 'or', 'noisy', 'gate', 'definition', 'with', 'identical', 'name', 'this', 'definition', 'wi...
train
https://github.com/rigetti/pyquil/blob/ec98e453084b0037d69d8c3245f6822a5422593d/pyquil/quil.py#L941-L974
3,231
NikolayDachev/jadm
lib/paramiko-1.14.1/paramiko/hostkeys.py
HostKeys.hash_host
def hash_host(hostname, salt=None): """ Return a "hashed" form of the hostname, as used by OpenSSH when storing hashed hostnames in the known_hosts file. :param str hostname: the hostname to hash :param str salt: optional salt to use when hashing (must be 20 bytes long) ...
python
def hash_host(hostname, salt=None): """ Return a "hashed" form of the hostname, as used by OpenSSH when storing hashed hostnames in the known_hosts file. :param str hostname: the hostname to hash :param str salt: optional salt to use when hashing (must be 20 bytes long) ...
['def', 'hash_host', '(', 'hostname', ',', 'salt', '=', 'None', ')', ':', 'if', 'salt', 'is', 'None', ':', 'salt', '=', 'os', '.', 'urandom', '(', 'sha1', '(', ')', '.', 'digest_size', ')', 'else', ':', 'if', 'salt', '.', 'startswith', '(', "'|1|'", ')', ':', 'salt', '=', 'salt', '.', 'split', '(', "'|'", ')', '[', '2'...
Return a "hashed" form of the hostname, as used by OpenSSH when storing hashed hostnames in the known_hosts file. :param str hostname: the hostname to hash :param str salt: optional salt to use when hashing (must be 20 bytes long) :return: the hashed hostname as a `str`
['Return', 'a', 'hashed', 'form', 'of', 'the', 'hostname', 'as', 'used', 'by', 'OpenSSH', 'when', 'storing', 'hashed', 'hostnames', 'in', 'the', 'known_hosts', 'file', '.']
train
https://github.com/NikolayDachev/jadm/blob/12bb550445edfcd87506f7cba7a6a35d413c5511/lib/paramiko-1.14.1/paramiko/hostkeys.py#L258-L276
3,232
BD2KOnFHIR/fhirtordf
fhirtordf/rdfsupport/rdfcompare.py
skolemize
def skolemize(gin: Graph) -> Graph: """ Replace all of the blank nodes in graph gin with FHIR paths :param gin: input graph :return: output graph """ gout = Graph() # Emit any unreferenced subject BNodes (boxes) anon_subjs = [s for s in gin.subjects() if isinstance(s, BNode) and len([gi...
python
def skolemize(gin: Graph) -> Graph: """ Replace all of the blank nodes in graph gin with FHIR paths :param gin: input graph :return: output graph """ gout = Graph() # Emit any unreferenced subject BNodes (boxes) anon_subjs = [s for s in gin.subjects() if isinstance(s, BNode) and len([gi...
['def', 'skolemize', '(', 'gin', ':', 'Graph', ')', '->', 'Graph', ':', 'gout', '=', 'Graph', '(', ')', '# Emit any unreferenced subject BNodes (boxes)', 'anon_subjs', '=', '[', 's', 'for', 's', 'in', 'gin', '.', 'subjects', '(', ')', 'if', 'isinstance', '(', 's', ',', 'BNode', ')', 'and', 'len', '(', '[', 'gin', '.', ...
Replace all of the blank nodes in graph gin with FHIR paths :param gin: input graph :return: output graph
['Replace', 'all', 'of', 'the', 'blank', 'nodes', 'in', 'graph', 'gin', 'with', 'FHIR', 'paths', ':', 'param', 'gin', ':', 'input', 'graph', ':', 'return', ':', 'output', 'graph']
train
https://github.com/BD2KOnFHIR/fhirtordf/blob/f97b3df683fa4caacf5cf4f29699ab060bcc0fbf/fhirtordf/rdfsupport/rdfcompare.py#L66-L86
3,233
tanghaibao/goatools
goatools/obo_parser.py
GODag.draw_lineage
def draw_lineage(self, recs, nodecolor="mediumseagreen", edgecolor="lightslateblue", dpi=96, lineage_img="GO_lineage.png", engine="pygraphviz", gml=False, draw_parents=True, draw_children=True): """Draw GO DAG subplot.""" assert engine in Gr...
python
def draw_lineage(self, recs, nodecolor="mediumseagreen", edgecolor="lightslateblue", dpi=96, lineage_img="GO_lineage.png", engine="pygraphviz", gml=False, draw_parents=True, draw_children=True): """Draw GO DAG subplot.""" assert engine in Gr...
['def', 'draw_lineage', '(', 'self', ',', 'recs', ',', 'nodecolor', '=', '"mediumseagreen"', ',', 'edgecolor', '=', '"lightslateblue"', ',', 'dpi', '=', '96', ',', 'lineage_img', '=', '"GO_lineage.png"', ',', 'engine', '=', '"pygraphviz"', ',', 'gml', '=', 'False', ',', 'draw_parents', '=', 'True', ',', 'draw_children'...
Draw GO DAG subplot.
['Draw', 'GO', 'DAG', 'subplot', '.']
train
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/obo_parser.py#L601-L633
3,234
timothycrosley/deprecated.frosted
frosted/checker.py
Checker.add_binding
def add_binding(self, node, value, report_redef=True): """Called when a binding is altered. - `node` is the statement responsible for the change - `value` is the optional new value, a Binding instance, associated with the binding; if None, the binding is deleted if it exists. - ...
python
def add_binding(self, node, value, report_redef=True): """Called when a binding is altered. - `node` is the statement responsible for the change - `value` is the optional new value, a Binding instance, associated with the binding; if None, the binding is deleted if it exists. - ...
['def', 'add_binding', '(', 'self', ',', 'node', ',', 'value', ',', 'report_redef', '=', 'True', ')', ':', 'redefinedWhileUnused', '=', 'False', 'if', 'not', 'isinstance', '(', 'self', '.', 'scope', ',', 'ClassScope', ')', ':', 'for', 'scope', 'in', 'self', '.', 'scope_stack', '[', ':', ':', '-', '1', ']', ':', 'existi...
Called when a binding is altered. - `node` is the statement responsible for the change - `value` is the optional new value, a Binding instance, associated with the binding; if None, the binding is deleted if it exists. - if `report_redef` is True (default), rebinding while unused will b...
['Called', 'when', 'a', 'binding', 'is', 'altered', '.']
train
https://github.com/timothycrosley/deprecated.frosted/blob/61ba7f341fc55676c3580c8c4e52117986cd5e12/frosted/checker.py#L407-L445
3,235
pudo/banal
banal/dicts.py
keys_values
def keys_values(data, *keys): """Get an entry as a list from a dict. Provide a fallback key.""" values = [] if is_mapping(data): for key in keys: if key in data: values.extend(ensure_list(data[key])) return values
python
def keys_values(data, *keys): """Get an entry as a list from a dict. Provide a fallback key.""" values = [] if is_mapping(data): for key in keys: if key in data: values.extend(ensure_list(data[key])) return values
['def', 'keys_values', '(', 'data', ',', '*', 'keys', ')', ':', 'values', '=', '[', ']', 'if', 'is_mapping', '(', 'data', ')', ':', 'for', 'key', 'in', 'keys', ':', 'if', 'key', 'in', 'data', ':', 'values', '.', 'extend', '(', 'ensure_list', '(', 'data', '[', 'key', ']', ')', ')', 'return', 'values']
Get an entry as a list from a dict. Provide a fallback key.
['Get', 'an', 'entry', 'as', 'a', 'list', 'from', 'a', 'dict', '.', 'Provide', 'a', 'fallback', 'key', '.']
train
https://github.com/pudo/banal/blob/528c339be5138458e387a058581cf7d261285447/banal/dicts.py#L32-L39
3,236
dhermes/bezier
src/bezier/surface.py
Surface.evaluate_barycentric_multi
def evaluate_barycentric_multi(self, param_vals, _verify=True): r"""Compute multiple points on the surface. Assumes ``param_vals`` has three columns of barycentric coordinates. See :meth:`evaluate_barycentric` for more details on how each row of parameter values is evaluated. ....
python
def evaluate_barycentric_multi(self, param_vals, _verify=True): r"""Compute multiple points on the surface. Assumes ``param_vals`` has three columns of barycentric coordinates. See :meth:`evaluate_barycentric` for more details on how each row of parameter values is evaluated. ....
['def', 'evaluate_barycentric_multi', '(', 'self', ',', 'param_vals', ',', '_verify', '=', 'True', ')', ':', 'if', '_verify', ':', 'if', 'param_vals', '.', 'ndim', '!=', '2', ':', 'raise', 'ValueError', '(', '"Parameter values must be 2D array"', ')', 'for', 'lambda1', ',', 'lambda2', ',', 'lambda3', 'in', 'param_vals'...
r"""Compute multiple points on the surface. Assumes ``param_vals`` has three columns of barycentric coordinates. See :meth:`evaluate_barycentric` for more details on how each row of parameter values is evaluated. .. image:: ../../images/surface_evaluate_barycentric_multi.png ...
['r', 'Compute', 'multiple', 'points', 'on', 'the', 'surface', '.']
train
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/surface.py#L477-L536
3,237
NuGrid/NuGridPy
nugridpy/utils.py
Utils._process_abundance_vector
def _process_abundance_vector(self, a, z, isomers, yps): ''' This private method takes as input one vector definition and processes it, including sorting by charge number and mass number. It returns the processed input variables plus an element and isotope vector and a list of ...
python
def _process_abundance_vector(self, a, z, isomers, yps): ''' This private method takes as input one vector definition and processes it, including sorting by charge number and mass number. It returns the processed input variables plus an element and isotope vector and a list of ...
['def', '_process_abundance_vector', '(', 'self', ',', 'a', ',', 'z', ',', 'isomers', ',', 'yps', ')', ':', 'def', 'cmp_to_key', '(', 'mycmp', ')', ':', "'Convert a cmp= function into a key= function'", 'class', 'K', '(', 'object', ')', ':', 'def', '__init__', '(', 'self', ',', 'obj', ',', '*', 'args', ')', ':', 'self'...
This private method takes as input one vector definition and processes it, including sorting by charge number and mass number. It returns the processed input variables plus an element and isotope vector and a list of isomers.
['This', 'private', 'method', 'takes', 'as', 'input', 'one', 'vector', 'definition', 'and', 'processes', 'it', 'including', 'sorting', 'by', 'charge', 'number', 'and', 'mass', 'number', '.', 'It', 'returns', 'the', 'processed', 'input', 'variables', 'plus', 'an', 'element', 'and', 'isotope', 'vector', 'and', 'a', 'list...
train
https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/utils.py#L274-L326
3,238
nickoala/telepot
telepot/delegate.py
pave_event_space
def pave_event_space(fn=pair): """ :return: a pair producer that ensures the seeder and delegator share the same event space. """ global _event_space event_space = next(_event_space) @_ensure_seeders_list def p(seeders, delegator_factory, *args, **kwargs): return fn(seeders ...
python
def pave_event_space(fn=pair): """ :return: a pair producer that ensures the seeder and delegator share the same event space. """ global _event_space event_space = next(_event_space) @_ensure_seeders_list def p(seeders, delegator_factory, *args, **kwargs): return fn(seeders ...
['def', 'pave_event_space', '(', 'fn', '=', 'pair', ')', ':', 'global', '_event_space', 'event_space', '=', 'next', '(', '_event_space', ')', '@', '_ensure_seeders_list', 'def', 'p', '(', 'seeders', ',', 'delegator_factory', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'return', 'fn', '(', 'seeders', '+', '[', ...
:return: a pair producer that ensures the seeder and delegator share the same event space.
[':', 'return', ':', 'a', 'pair', 'producer', 'that', 'ensures', 'the', 'seeder', 'and', 'delegator', 'share', 'the', 'same', 'event', 'space', '.']
train
https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/delegate.py#L347-L359
3,239
erdc/RAPIDpy
RAPIDpy/postprocess/generate_seasonal_averages.py
generate_seasonal_averages
def generate_seasonal_averages(qout_file, seasonal_average_file, num_cpus=multiprocessing.cpu_count()): """ This function loops through a CF compliant rapid streamflow file to produce a netCDF file with a seasonal average for 365 days a year """ with RAPIDDataset(q...
python
def generate_seasonal_averages(qout_file, seasonal_average_file, num_cpus=multiprocessing.cpu_count()): """ This function loops through a CF compliant rapid streamflow file to produce a netCDF file with a seasonal average for 365 days a year """ with RAPIDDataset(q...
['def', 'generate_seasonal_averages', '(', 'qout_file', ',', 'seasonal_average_file', ',', 'num_cpus', '=', 'multiprocessing', '.', 'cpu_count', '(', ')', ')', ':', 'with', 'RAPIDDataset', '(', 'qout_file', ')', 'as', 'qout_nc_file', ':', 'print', '(', '"Generating seasonal average file ..."', ')', 'seasonal_avg_nc', '...
This function loops through a CF compliant rapid streamflow file to produce a netCDF file with a seasonal average for 365 days a year
['This', 'function', 'loops', 'through', 'a', 'CF', 'compliant', 'rapid', 'streamflow', 'file', 'to', 'produce', 'a', 'netCDF', 'file', 'with', 'a', 'seasonal', 'average', 'for', '365', 'days', 'a', 'year']
train
https://github.com/erdc/RAPIDpy/blob/50e14e130554b254a00ff23b226cd7e4c6cfe91a/RAPIDpy/postprocess/generate_seasonal_averages.py#L70-L143
3,240
ibis-project/ibis
ibis/config.py
_build_option_description
def _build_option_description(k): """Builds a formatted description of a registered option and prints it.""" o = _get_registered_option(k) d = _get_deprecated_option(k) buf = ['{} '.format(k)] if o.doc: doc = '\n'.join(o.doc.strip().splitlines()) else: doc = 'No description ava...
python
def _build_option_description(k): """Builds a formatted description of a registered option and prints it.""" o = _get_registered_option(k) d = _get_deprecated_option(k) buf = ['{} '.format(k)] if o.doc: doc = '\n'.join(o.doc.strip().splitlines()) else: doc = 'No description ava...
['def', '_build_option_description', '(', 'k', ')', ':', 'o', '=', '_get_registered_option', '(', 'k', ')', 'd', '=', '_get_deprecated_option', '(', 'k', ')', 'buf', '=', '[', "'{} '", '.', 'format', '(', 'k', ')', ']', 'if', 'o', '.', 'doc', ':', 'doc', '=', "'\\n'", '.', 'join', '(', 'o', '.', 'doc', '.', 'strip', '(...
Builds a formatted description of a registered option and prints it.
['Builds', 'a', 'formatted', 'description', 'of', 'a', 'registered', 'option', 'and', 'prints', 'it', '.']
train
https://github.com/ibis-project/ibis/blob/1e39a5fd9ef088b45c155e8a5f541767ee8ef2e7/ibis/config.py#L567-L596
3,241
quantmind/pulsar-odm
odm/mapper.py
copy_models
def copy_models(module_from, module_to): """Copy models from one module to another :param module_from: :param module_to: :return: """ module_from = get_module(module_from) module_to = get_module(module_to) models = get_models(module_from) if models: models = models.copy() ...
python
def copy_models(module_from, module_to): """Copy models from one module to another :param module_from: :param module_to: :return: """ module_from = get_module(module_from) module_to = get_module(module_to) models = get_models(module_from) if models: models = models.copy() ...
['def', 'copy_models', '(', 'module_from', ',', 'module_to', ')', ':', 'module_from', '=', 'get_module', '(', 'module_from', ')', 'module_to', '=', 'get_module', '(', 'module_to', ')', 'models', '=', 'get_models', '(', 'module_from', ')', 'if', 'models', ':', 'models', '=', 'models', '.', 'copy', '(', ')', 'models', '....
Copy models from one module to another :param module_from: :param module_to: :return:
['Copy', 'models', 'from', 'one', 'module', 'to', 'another', ':', 'param', 'module_from', ':', ':', 'param', 'module_to', ':', ':', 'return', ':']
train
https://github.com/quantmind/pulsar-odm/blob/5955c20beca0a89270c2b390335838deb7d5915e/odm/mapper.py#L131-L144
3,242
kennethreitz/omnijson
omnijson/packages/simplejson/__init__.py
load
def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, use_decimal=False, **kw): """Deserialize ``fp`` (a ``.read()``-supporting file-like object containing a JSON document) to a Python object. *encoding* determ...
python
def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, use_decimal=False, **kw): """Deserialize ``fp`` (a ``.read()``-supporting file-like object containing a JSON document) to a Python object. *encoding* determ...
['def', 'load', '(', 'fp', ',', 'encoding', '=', 'None', ',', 'cls', '=', 'None', ',', 'object_hook', '=', 'None', ',', 'parse_float', '=', 'None', ',', 'parse_int', '=', 'None', ',', 'parse_constant', '=', 'None', ',', 'object_pairs_hook', '=', 'None', ',', 'use_decimal', '=', 'False', ',', '*', '*', 'kw', ')', ':', '...
Deserialize ``fp`` (a ``.read()``-supporting file-like object containing a JSON document) to a Python object. *encoding* determines the encoding used to interpret any :class:`str` objects decoded by this instance (``'utf-8'`` by default). It has no effect when decoding :class:`unicode` objects. N...
['Deserialize', 'fp', '(', 'a', '.', 'read', '()', '-', 'supporting', 'file', '-', 'like', 'object', 'containing', 'a', 'JSON', 'document', ')', 'to', 'a', 'Python', 'object', '.']
train
https://github.com/kennethreitz/omnijson/blob/a5890a51a59ad76f78a61f5bf91fa86b784cf694/omnijson/packages/simplejson/__init__.py#L276-L329
3,243
jtwhite79/pyemu
pyemu/pst/pst_handler.py
Pst.enforce_bounds
def enforce_bounds(self): """ enforce bounds violation resulting from the parameter pertubation calculations """ too_big = self.parameter_data.loc[:,"parval1"] > \ self.parameter_data.loc[:,"parubnd"] self.parameter_data.loc[too_big,"parval1"] = \ self.pa...
python
def enforce_bounds(self): """ enforce bounds violation resulting from the parameter pertubation calculations """ too_big = self.parameter_data.loc[:,"parval1"] > \ self.parameter_data.loc[:,"parubnd"] self.parameter_data.loc[too_big,"parval1"] = \ self.pa...
['def', 'enforce_bounds', '(', 'self', ')', ':', 'too_big', '=', 'self', '.', 'parameter_data', '.', 'loc', '[', ':', ',', '"parval1"', ']', '>', 'self', '.', 'parameter_data', '.', 'loc', '[', ':', ',', '"parubnd"', ']', 'self', '.', 'parameter_data', '.', 'loc', '[', 'too_big', ',', '"parval1"', ']', '=', 'self', '.'...
enforce bounds violation resulting from the parameter pertubation calculations
['enforce', 'bounds', 'violation', 'resulting', 'from', 'the', 'parameter', 'pertubation', 'calculations']
train
https://github.com/jtwhite79/pyemu/blob/c504d8e7a4097cec07655a6318d275739bd8148a/pyemu/pst/pst_handler.py#L2051-L2064
3,244
Julius2342/pyvlx
pyvlx/frames/frame_activate_scene.py
FrameActivateSceneRequest.from_payload
def from_payload(self, payload): """Init frame from binary data.""" self.session_id = payload[0]*256 + payload[1] self.originator = Originator(payload[2]) self.priority = Priority(payload[3]) self.scene_id = payload[4] self.velocity = Velocity(payload[5])
python
def from_payload(self, payload): """Init frame from binary data.""" self.session_id = payload[0]*256 + payload[1] self.originator = Originator(payload[2]) self.priority = Priority(payload[3]) self.scene_id = payload[4] self.velocity = Velocity(payload[5])
['def', 'from_payload', '(', 'self', ',', 'payload', ')', ':', 'self', '.', 'session_id', '=', 'payload', '[', '0', ']', '*', '256', '+', 'payload', '[', '1', ']', 'self', '.', 'originator', '=', 'Originator', '(', 'payload', '[', '2', ']', ')', 'self', '.', 'priority', '=', 'Priority', '(', 'payload', '[', '3', ']', '...
Init frame from binary data.
['Init', 'frame', 'from', 'binary', 'data', '.']
train
https://github.com/Julius2342/pyvlx/blob/ee78e1324bcb1be5b8d1a9d05ab5496b72eae848/pyvlx/frames/frame_activate_scene.py#L32-L38
3,245
clement-alexandre/TotemBionet
totembionet/src/discrete_model/influence_graph.py
InfluenceGraph._transform_list_of_states_to_state
def _transform_list_of_states_to_state(self, state: List[int]) -> State: """ Private method which transform a list which contains the state of the gene in the models to a State object. Examples -------- The model contains 2 genes: operon = {0, 1, 2} ...
python
def _transform_list_of_states_to_state(self, state: List[int]) -> State: """ Private method which transform a list which contains the state of the gene in the models to a State object. Examples -------- The model contains 2 genes: operon = {0, 1, 2} ...
['def', '_transform_list_of_states_to_state', '(', 'self', ',', 'state', ':', 'List', '[', 'int', ']', ')', '->', 'State', ':', 'return', 'State', '(', '{', 'gene', ':', 'state', '[', 'i', ']', 'for', 'i', ',', 'gene', 'in', 'enumerate', '(', 'self', '.', 'genes', ')', '}', ')']
Private method which transform a list which contains the state of the gene in the models to a State object. Examples -------- The model contains 2 genes: operon = {0, 1, 2} mucuB = {0, 1} >>> graph._transform_list_of_states_to_dict_of_states(...
['Private', 'method', 'which', 'transform', 'a', 'list', 'which', 'contains', 'the', 'state', 'of', 'the', 'gene', 'in', 'the', 'models', 'to', 'a', 'State', 'object', '.']
train
https://github.com/clement-alexandre/TotemBionet/blob/f37a2f9358c1ce49f21c4a868b904da5dcd4614f/totembionet/src/discrete_model/influence_graph.py#L71-L86
3,246
Robpol86/libnl
libnl/linux_private/rtnetlink.py
rtgenmsg.rtgen_family
def rtgen_family(self, value): """Family setter.""" self.bytearray[self._get_slicers(0)] = bytearray(c_ubyte(value or 0))
python
def rtgen_family(self, value): """Family setter.""" self.bytearray[self._get_slicers(0)] = bytearray(c_ubyte(value or 0))
['def', 'rtgen_family', '(', 'self', ',', 'value', ')', ':', 'self', '.', 'bytearray', '[', 'self', '.', '_get_slicers', '(', '0', ')', ']', '=', 'bytearray', '(', 'c_ubyte', '(', 'value', 'or', '0', ')', ')']
Family setter.
['Family', 'setter', '.']
train
https://github.com/Robpol86/libnl/blob/274e9fdaa39822d06ef70b799ed4a95937a4d923/libnl/linux_private/rtnetlink.py#L150-L152
3,247
spyder-ide/spyder-kernels
spyder_kernels/utils/nsview.py
make_remote_view
def make_remote_view(data, settings, more_excluded_names=None): """ Make a remote view of dictionary *data* -> globals explorer """ data = get_remote_data(data, settings, mode='editable', more_excluded_names=more_excluded_names) remote = {} for key, value in list(d...
python
def make_remote_view(data, settings, more_excluded_names=None): """ Make a remote view of dictionary *data* -> globals explorer """ data = get_remote_data(data, settings, mode='editable', more_excluded_names=more_excluded_names) remote = {} for key, value in list(d...
['def', 'make_remote_view', '(', 'data', ',', 'settings', ',', 'more_excluded_names', '=', 'None', ')', ':', 'data', '=', 'get_remote_data', '(', 'data', ',', 'settings', ',', 'mode', '=', "'editable'", ',', 'more_excluded_names', '=', 'more_excluded_names', ')', 'remote', '=', '{', '}', 'for', 'key', ',', 'value', 'in...
Make a remote view of dictionary *data* -> globals explorer
['Make', 'a', 'remote', 'view', 'of', 'dictionary', '*', 'data', '*', '-', '>', 'globals', 'explorer']
train
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/nsview.py#L661-L675
3,248
pysathq/pysat
pysat/pb.py
PBEnc.atmost
def atmost(cls, lits, weights=None, bound=1, top_id=None, encoding=EncType.best): """ A synonim for :meth:`PBEnc.leq`. """ return cls.leq(lits, weights, bound, top_id, encoding)
python
def atmost(cls, lits, weights=None, bound=1, top_id=None, encoding=EncType.best): """ A synonim for :meth:`PBEnc.leq`. """ return cls.leq(lits, weights, bound, top_id, encoding)
['def', 'atmost', '(', 'cls', ',', 'lits', ',', 'weights', '=', 'None', ',', 'bound', '=', '1', ',', 'top_id', '=', 'None', ',', 'encoding', '=', 'EncType', '.', 'best', ')', ':', 'return', 'cls', '.', 'leq', '(', 'lits', ',', 'weights', ',', 'bound', ',', 'top_id', ',', 'encoding', ')']
A synonim for :meth:`PBEnc.leq`.
['A', 'synonim', 'for', ':', 'meth', ':', 'PBEnc', '.', 'leq', '.']
train
https://github.com/pysathq/pysat/blob/522742e8f2d4c6ac50ecd9087f7a346206774c67/pysat/pb.py#L284-L290
3,249
johnbywater/eventsourcing
eventsourcing/contrib/suffixtrees/domain/model/suffixtree.py
register_new_suffix_tree
def register_new_suffix_tree(case_insensitive=False): """Factory method, returns new suffix tree object. """ assert isinstance(case_insensitive, bool) root_node = register_new_node() suffix_tree_id = uuid4() event = SuffixTree.Created( originator_id=suffix_tree_id, root_node_id=...
python
def register_new_suffix_tree(case_insensitive=False): """Factory method, returns new suffix tree object. """ assert isinstance(case_insensitive, bool) root_node = register_new_node() suffix_tree_id = uuid4() event = SuffixTree.Created( originator_id=suffix_tree_id, root_node_id=...
['def', 'register_new_suffix_tree', '(', 'case_insensitive', '=', 'False', ')', ':', 'assert', 'isinstance', '(', 'case_insensitive', ',', 'bool', ')', 'root_node', '=', 'register_new_node', '(', ')', 'suffix_tree_id', '=', 'uuid4', '(', ')', 'event', '=', 'SuffixTree', '.', 'Created', '(', 'originator_id', '=', 'suffi...
Factory method, returns new suffix tree object.
['Factory', 'method', 'returns', 'new', 'suffix', 'tree', 'object', '.']
train
https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/contrib/suffixtrees/domain/model/suffixtree.py#L349-L369
3,250
project-ncl/pnc-cli
pnc_cli/tools/utils.py
required
def required(field): """Decorator that checks if return value is set, if not, raises exception. """ def wrap(f): def wrappedf(*args): result = f(*args) if result is None or result == "": raise Exception( "Config option '%s' is required." %...
python
def required(field): """Decorator that checks if return value is set, if not, raises exception. """ def wrap(f): def wrappedf(*args): result = f(*args) if result is None or result == "": raise Exception( "Config option '%s' is required." %...
['def', 'required', '(', 'field', ')', ':', 'def', 'wrap', '(', 'f', ')', ':', 'def', 'wrappedf', '(', '*', 'args', ')', ':', 'result', '=', 'f', '(', '*', 'args', ')', 'if', 'result', 'is', 'None', 'or', 'result', '==', '""', ':', 'raise', 'Exception', '(', '"Config option \'%s\' is required."', '%', 'field', ')', 'el...
Decorator that checks if return value is set, if not, raises exception.
['Decorator', 'that', 'checks', 'if', 'return', 'value', 'is', 'set', 'if', 'not', 'raises', 'exception', '.']
train
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/tools/utils.py#L144-L157
3,251
Calysto/calysto
calysto/ai/conx.py
SRN.addContext
def addContext(self, layer, hiddenLayerName = 'hidden', verbosity = 0): """ Adds a context layer. Necessary to keep self.contextLayers dictionary up to date. """ # better not add context layer first if using sweep() without mapInput SRN.add(self, layer, verbosity) if hid...
python
def addContext(self, layer, hiddenLayerName = 'hidden', verbosity = 0): """ Adds a context layer. Necessary to keep self.contextLayers dictionary up to date. """ # better not add context layer first if using sweep() without mapInput SRN.add(self, layer, verbosity) if hid...
['def', 'addContext', '(', 'self', ',', 'layer', ',', 'hiddenLayerName', '=', "'hidden'", ',', 'verbosity', '=', '0', ')', ':', '# better not add context layer first if using sweep() without mapInput', 'SRN', '.', 'add', '(', 'self', ',', 'layer', ',', 'verbosity', ')', 'if', 'hiddenLayerName', 'in', 'self', '.', 'cont...
Adds a context layer. Necessary to keep self.contextLayers dictionary up to date.
['Adds', 'a', 'context', 'layer', '.', 'Necessary', 'to', 'keep', 'self', '.', 'contextLayers', 'dictionary', 'up', 'to', 'date', '.']
train
https://github.com/Calysto/calysto/blob/20813c0f48096317aa775d03a5c6b20f12fafc93/calysto/ai/conx.py#L4686-L4697
3,252
newville/wxmplot
examples/tifffile.py
reorient
def reorient(image, orientation): """Return reoriented view of image array. Parameters ---------- image : numpy array Non-squeezed output of asarray() functions. Axes -3 and -2 must be image length and width respectively. orientation : int or str One of TIFF_ORIENTATIONS key...
python
def reorient(image, orientation): """Return reoriented view of image array. Parameters ---------- image : numpy array Non-squeezed output of asarray() functions. Axes -3 and -2 must be image length and width respectively. orientation : int or str One of TIFF_ORIENTATIONS key...
['def', 'reorient', '(', 'image', ',', 'orientation', ')', ':', 'o', '=', 'TIFF_ORIENTATIONS', '.', 'get', '(', 'orientation', ',', 'orientation', ')', 'if', 'o', '==', "'top_left'", ':', 'return', 'image', 'elif', 'o', '==', "'top_right'", ':', 'return', 'image', '[', '...', ',', ':', ':', '-', '1', ',', ':', ']', 'el...
Return reoriented view of image array. Parameters ---------- image : numpy array Non-squeezed output of asarray() functions. Axes -3 and -2 must be image length and width respectively. orientation : int or str One of TIFF_ORIENTATIONS keys or values.
['Return', 'reoriented', 'view', 'of', 'image', 'array', '.']
train
https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/examples/tifffile.py#L1757-L1785
3,253
earwig/mwparserfromhell
mwparserfromhell/wikicode.py
Wikicode._is_child_wikicode
def _is_child_wikicode(self, obj, recursive=True): """Return whether the given :class:`.Wikicode` is a descendant.""" def deref(nodes): if isinstance(nodes, _ListProxy): return nodes._parent # pylint: disable=protected-access return nodes target = deref(...
python
def _is_child_wikicode(self, obj, recursive=True): """Return whether the given :class:`.Wikicode` is a descendant.""" def deref(nodes): if isinstance(nodes, _ListProxy): return nodes._parent # pylint: disable=protected-access return nodes target = deref(...
['def', '_is_child_wikicode', '(', 'self', ',', 'obj', ',', 'recursive', '=', 'True', ')', ':', 'def', 'deref', '(', 'nodes', ')', ':', 'if', 'isinstance', '(', 'nodes', ',', '_ListProxy', ')', ':', 'return', 'nodes', '.', '_parent', '# pylint: disable=protected-access', 'return', 'nodes', 'target', '=', 'deref', '(', ...
Return whether the given :class:`.Wikicode` is a descendant.
['Return', 'whether', 'the', 'given', ':', 'class', ':', '.', 'Wikicode', 'is', 'a', 'descendant', '.']
train
https://github.com/earwig/mwparserfromhell/blob/98dc30902d35c714a70aca8e6616f49d71cb24cc/mwparserfromhell/wikicode.py#L112-L130
3,254
limix/limix-core
limix_core/linalg/linalg_matrix.py
solve_chol
def solve_chol(A,B): """ Solve cholesky decomposition:: return A\(A'\B) """ # X = linalg.solve(A,linalg.solve(A.transpose(),B)) # much faster version X = linalg.cho_solve((A, True), B) return X
python
def solve_chol(A,B): """ Solve cholesky decomposition:: return A\(A'\B) """ # X = linalg.solve(A,linalg.solve(A.transpose(),B)) # much faster version X = linalg.cho_solve((A, True), B) return X
['def', 'solve_chol', '(', 'A', ',', 'B', ')', ':', '# X = linalg.solve(A,linalg.solve(A.transpose(),B))', '# much faster version', 'X', '=', 'linalg', '.', 'cho_solve', '(', '(', 'A', ',', 'True', ')', ',', 'B', ')', 'return', 'X']
Solve cholesky decomposition:: return A\(A'\B)
['Solve', 'cholesky', 'decomposition', '::']
train
https://github.com/limix/limix-core/blob/5c590b4d351409f83ca320844b4897ce92203814/limix_core/linalg/linalg_matrix.py#L29-L39
3,255
saltstack/salt
salt/modules/mac_user.py
chhome
def chhome(name, home, **kwargs): ''' Change the home directory of the user CLI Example: .. code-block:: bash salt '*' user.chhome foo /Users/foo ''' kwargs = salt.utils.args.clean_kwargs(**kwargs) persist = kwargs.pop('persist', False) if kwargs: salt.utils.args.inval...
python
def chhome(name, home, **kwargs): ''' Change the home directory of the user CLI Example: .. code-block:: bash salt '*' user.chhome foo /Users/foo ''' kwargs = salt.utils.args.clean_kwargs(**kwargs) persist = kwargs.pop('persist', False) if kwargs: salt.utils.args.inval...
['def', 'chhome', '(', 'name', ',', 'home', ',', '*', '*', 'kwargs', ')', ':', 'kwargs', '=', 'salt', '.', 'utils', '.', 'args', '.', 'clean_kwargs', '(', '*', '*', 'kwargs', ')', 'persist', '=', 'kwargs', '.', 'pop', '(', "'persist'", ',', 'False', ')', 'if', 'kwargs', ':', 'salt', '.', 'utils', '.', 'args', '.', 'inv...
Change the home directory of the user CLI Example: .. code-block:: bash salt '*' user.chhome foo /Users/foo
['Change', 'the', 'home', 'directory', 'of', 'the', 'user']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_user.py#L268-L298
3,256
Tenchi2xh/Almonds
almonds/plane.py
Plane.extrema
def extrema(self, x0, y0, w, h): """ Returns the minimum and maximum values contained in a given area. :param x0: Starting x index. :param y0: Starting y index. :param w: Width of the area to scan. :param h: Height of the area to scan. :return: Tuple containi...
python
def extrema(self, x0, y0, w, h): """ Returns the minimum and maximum values contained in a given area. :param x0: Starting x index. :param y0: Starting y index. :param w: Width of the area to scan. :param h: Height of the area to scan. :return: Tuple containi...
['def', 'extrema', '(', 'self', ',', 'x0', ',', 'y0', ',', 'w', ',', 'h', ')', ':', 'minimum', '=', '9223372036854775807', 'maximum', '=', '0', 'for', 'y', 'in', 'range', '(', 'y0', ',', 'y0', '+', 'h', ')', ':', 'for', 'x', 'in', 'range', '(', 'x0', ',', 'x0', '+', 'w', ')', ':', 'value', '=', 'self', '[', 'x', ',', '...
Returns the minimum and maximum values contained in a given area. :param x0: Starting x index. :param y0: Starting y index. :param w: Width of the area to scan. :param h: Height of the area to scan. :return: Tuple containing the minimum and maximum values of the given area.
['Returns', 'the', 'minimum', 'and', 'maximum', 'values', 'contained', 'in', 'a', 'given', 'area', '.']
train
https://github.com/Tenchi2xh/Almonds/blob/6b27024729f055f2cb5e14ae3ca3cb428ae054bc/almonds/plane.py#L25-L43
3,257
jadolg/rocketchat_API
rocketchat_API/rocketchat.py
RocketChat.rooms_favorite
def rooms_favorite(self, room_id=None, room_name=None, favorite=True): """Favorite or unfavorite room.""" if room_id is not None: return self.__call_api_post('rooms.favorite', roomId=room_id, favorite=favorite) elif room_name is not None: return self.__call_api_post('room...
python
def rooms_favorite(self, room_id=None, room_name=None, favorite=True): """Favorite or unfavorite room.""" if room_id is not None: return self.__call_api_post('rooms.favorite', roomId=room_id, favorite=favorite) elif room_name is not None: return self.__call_api_post('room...
['def', 'rooms_favorite', '(', 'self', ',', 'room_id', '=', 'None', ',', 'room_name', '=', 'None', ',', 'favorite', '=', 'True', ')', ':', 'if', 'room_id', 'is', 'not', 'None', ':', 'return', 'self', '.', '__call_api_post', '(', "'rooms.favorite'", ',', 'roomId', '=', 'room_id', ',', 'favorite', '=', 'favorite', ')', '...
Favorite or unfavorite room.
['Favorite', 'or', 'unfavorite', 'room', '.']
train
https://github.com/jadolg/rocketchat_API/blob/f220d094434991cb9892418245f054ea06f28aad/rocketchat_API/rocketchat.py#L659-L666
3,258
openvax/isovar
isovar/reference_context.py
reference_contexts_for_variants
def reference_contexts_for_variants( variants, context_size, transcript_id_whitelist=None): """ Extract a set of reference contexts for each variant in the collection. Parameters ---------- variants : varcode.VariantCollection context_size : int Max of nucleotid...
python
def reference_contexts_for_variants( variants, context_size, transcript_id_whitelist=None): """ Extract a set of reference contexts for each variant in the collection. Parameters ---------- variants : varcode.VariantCollection context_size : int Max of nucleotid...
['def', 'reference_contexts_for_variants', '(', 'variants', ',', 'context_size', ',', 'transcript_id_whitelist', '=', 'None', ')', ':', 'result', '=', 'OrderedDict', '(', ')', 'for', 'variant', 'in', 'variants', ':', 'result', '[', 'variant', ']', '=', 'reference_contexts_for_variant', '(', 'variant', '=', 'variant', '...
Extract a set of reference contexts for each variant in the collection. Parameters ---------- variants : varcode.VariantCollection context_size : int Max of nucleotides to include to the left and right of the variant in the context sequence. transcript_id_whitelist : set, optional...
['Extract', 'a', 'set', 'of', 'reference', 'contexts', 'for', 'each', 'variant', 'in', 'the', 'collection', '.']
train
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/reference_context.py#L141-L168
3,259
gem/oq-engine
openquake/risklib/asset.py
Exposure.get_mesh_assets_by_site
def get_mesh_assets_by_site(self): """ :returns: (Mesh instance, assets_by_site list) """ assets_by_loc = general.groupby(self, key=lambda a: a.location) mesh = geo.Mesh.from_coords(list(assets_by_loc)) assets_by_site = [ assets_by_loc[lonlat] for lonlat in zi...
python
def get_mesh_assets_by_site(self): """ :returns: (Mesh instance, assets_by_site list) """ assets_by_loc = general.groupby(self, key=lambda a: a.location) mesh = geo.Mesh.from_coords(list(assets_by_loc)) assets_by_site = [ assets_by_loc[lonlat] for lonlat in zi...
['def', 'get_mesh_assets_by_site', '(', 'self', ')', ':', 'assets_by_loc', '=', 'general', '.', 'groupby', '(', 'self', ',', 'key', '=', 'lambda', 'a', ':', 'a', '.', 'location', ')', 'mesh', '=', 'geo', '.', 'Mesh', '.', 'from_coords', '(', 'list', '(', 'assets_by_loc', ')', ')', 'assets_by_site', '=', '[', 'assets_by...
:returns: (Mesh instance, assets_by_site list)
[':', 'returns', ':', '(', 'Mesh', 'instance', 'assets_by_site', 'list', ')']
train
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/risklib/asset.py#L1049-L1057
3,260
SUSE-Enceladus/ipa
ipa/ipa_utils.py
extract_archive
def extract_archive(client, archive_path, extract_path=None): """ Extract the archive in current path using the provided client. If extract_path is provided extract the archive there. """ command = 'tar -xf {path}'.format(path=archive_path) if extract_path: command += ' -C {extract_pat...
python
def extract_archive(client, archive_path, extract_path=None): """ Extract the archive in current path using the provided client. If extract_path is provided extract the archive there. """ command = 'tar -xf {path}'.format(path=archive_path) if extract_path: command += ' -C {extract_pat...
['def', 'extract_archive', '(', 'client', ',', 'archive_path', ',', 'extract_path', '=', 'None', ')', ':', 'command', '=', "'tar -xf {path}'", '.', 'format', '(', 'path', '=', 'archive_path', ')', 'if', 'extract_path', ':', 'command', '+=', "' -C {extract_path}'", '.', 'format', '(', 'extract_path', '=', 'extract_path'...
Extract the archive in current path using the provided client. If extract_path is provided extract the archive there.
['Extract', 'the', 'archive', 'in', 'current', 'path', 'using', 'the', 'provided', 'client', '.']
train
https://github.com/SUSE-Enceladus/ipa/blob/0845eed0ea25a27dbb059ad1016105fa60002228/ipa/ipa_utils.py#L150-L162
3,261
mitsei/dlkit
dlkit/json_/resource/objects.py
ResourceForm.get_group_metadata
def get_group_metadata(self): """Gets the metadata for a group. return: (osid.Metadata) - metadata for the group *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template metada...
python
def get_group_metadata(self): """Gets the metadata for a group. return: (osid.Metadata) - metadata for the group *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template metada...
['def', 'get_group_metadata', '(', 'self', ')', ':', '# Implemented from template for osid.resource.ResourceForm.get_group_metadata_template', 'metadata', '=', 'dict', '(', 'self', '.', '_mdata', '[', "'group'", ']', ')', 'metadata', '.', 'update', '(', '{', "'existing_boolean_values'", ':', 'self', '.', '_my_map', '['...
Gets the metadata for a group. return: (osid.Metadata) - metadata for the group *compliance: mandatory -- This method must be implemented.*
['Gets', 'the', 'metadata', 'for', 'a', 'group', '.']
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/objects.py#L192-L202
3,262
saltstack/salt
salt/modules/nacl.py
dec
def dec(data, **kwargs): ''' Alias to `{box_type}_decrypt` box_type: secretbox, sealedbox(default) ''' kwargs['opts'] = __opts__ return salt.utils.nacl.dec(data, **kwargs)
python
def dec(data, **kwargs): ''' Alias to `{box_type}_decrypt` box_type: secretbox, sealedbox(default) ''' kwargs['opts'] = __opts__ return salt.utils.nacl.dec(data, **kwargs)
['def', 'dec', '(', 'data', ',', '*', '*', 'kwargs', ')', ':', 'kwargs', '[', "'opts'", ']', '=', '__opts__', 'return', 'salt', '.', 'utils', '.', 'nacl', '.', 'dec', '(', 'data', ',', '*', '*', 'kwargs', ')']
Alias to `{box_type}_decrypt` box_type: secretbox, sealedbox(default)
['Alias', 'to', '{', 'box_type', '}', '_decrypt']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nacl.py#L221-L228
3,263
ff0000/scarlet
scarlet/cache/views.py
CacheView.dispatch
def dispatch(self, request, *args, **kwargs): """ Overrides Django's default dispatch to provide caching. If the should_cache method returns True, this will call two functions get_cache_version and get_cache_prefix the results of those two functions are combined and passed to ...
python
def dispatch(self, request, *args, **kwargs): """ Overrides Django's default dispatch to provide caching. If the should_cache method returns True, this will call two functions get_cache_version and get_cache_prefix the results of those two functions are combined and passed to ...
['def', 'dispatch', '(', 'self', ',', 'request', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'self', '.', 'request', '=', 'request', 'self', '.', 'args', '=', 'args', 'self', '.', 'kwargs', '=', 'kwargs', 'self', '.', 'cache_middleware', '=', 'None', 'response', '=', 'None', 'if', 'self', '.', 'should_cache', ...
Overrides Django's default dispatch to provide caching. If the should_cache method returns True, this will call two functions get_cache_version and get_cache_prefix the results of those two functions are combined and passed to the standard django caching middleware.
['Overrides', 'Django', 's', 'default', 'dispatch', 'to', 'provide', 'caching', '.']
train
https://github.com/ff0000/scarlet/blob/6c37befd810916a2d7ffff2cdb2dab57bcb6d12e/scarlet/cache/views.py#L179-L211
3,264
sassoftware/saspy
saspy/sasqc.py
SASqc.shewhart
def shewhart(self, data: ['SASdata', str] = None, boxchart: str = None, cchart: str = None, irchart: str = None, mchart: str = None, mrchart: str = None, npchart: str = None, pchart: str = None, ...
python
def shewhart(self, data: ['SASdata', str] = None, boxchart: str = None, cchart: str = None, irchart: str = None, mchart: str = None, mrchart: str = None, npchart: str = None, pchart: str = None, ...
['def', 'shewhart', '(', 'self', ',', 'data', ':', '[', "'SASdata'", ',', 'str', ']', '=', 'None', ',', 'boxchart', ':', 'str', '=', 'None', ',', 'cchart', ':', 'str', '=', 'None', ',', 'irchart', ':', 'str', '=', 'None', ',', 'mchart', ':', 'str', '=', 'None', ',', 'mrchart', ':', 'str', '=', 'None', ',', 'npchart', '...
Python method to call the SHEWHART procedure Documentation link: https://go.documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=qcug&docsetTarget=qcug_shewhart_toc.htm&locale=en :param data: SASdata object or string. This parameter is required. :parm boxchart: The boxcha...
['Python', 'method', 'to', 'call', 'the', 'SHEWHART', 'procedure']
train
https://github.com/sassoftware/saspy/blob/e433f71990f249d3a6c3db323ceb11cb2d462cf9/saspy/sasqc.py#L175-L213
3,265
raamana/hiwenet
hiwenet/more_metrics.py
diff_medians
def diff_medians(array_one, array_two): """ Computes the difference in medians between two arrays of values. Given arrays will be flattened (to 1D array) regardless of dimension, and any non-finite/NaN values will be ignored. Parameters ---------- array_one, array_two : iterable ...
python
def diff_medians(array_one, array_two): """ Computes the difference in medians between two arrays of values. Given arrays will be flattened (to 1D array) regardless of dimension, and any non-finite/NaN values will be ignored. Parameters ---------- array_one, array_two : iterable ...
['def', 'diff_medians', '(', 'array_one', ',', 'array_two', ')', ':', 'array_one', '=', 'check_array', '(', 'array_one', ')', 'array_two', '=', 'check_array', '(', 'array_two', ')', 'diff_medians', '=', 'np', '.', 'ma', '.', 'median', '(', 'array_one', ')', '-', 'np', '.', 'ma', '.', 'median', '(', 'array_two', ')', 'r...
Computes the difference in medians between two arrays of values. Given arrays will be flattened (to 1D array) regardless of dimension, and any non-finite/NaN values will be ignored. Parameters ---------- array_one, array_two : iterable Two arrays of values, possibly of different length...
['Computes', 'the', 'difference', 'in', 'medians', 'between', 'two', 'arrays', 'of', 'values', '.']
train
https://github.com/raamana/hiwenet/blob/b12699b3722fd0a6a835e7d7ca4baf58fb181809/hiwenet/more_metrics.py#L21-L49
3,266
tornadoweb/tornado
tornado/gen.py
multi_future
def multi_future( children: Union[List[_Yieldable], Dict[Any, _Yieldable]], quiet_exceptions: "Union[Type[Exception], Tuple[Type[Exception], ...]]" = (), ) -> "Union[Future[List], Future[Dict]]": """Wait for multiple asynchronous futures in parallel. Since Tornado 6.0, this function is exactly the same...
python
def multi_future( children: Union[List[_Yieldable], Dict[Any, _Yieldable]], quiet_exceptions: "Union[Type[Exception], Tuple[Type[Exception], ...]]" = (), ) -> "Union[Future[List], Future[Dict]]": """Wait for multiple asynchronous futures in parallel. Since Tornado 6.0, this function is exactly the same...
['def', 'multi_future', '(', 'children', ':', 'Union', '[', 'List', '[', '_Yieldable', ']', ',', 'Dict', '[', 'Any', ',', '_Yieldable', ']', ']', ',', 'quiet_exceptions', ':', '"Union[Type[Exception], Tuple[Type[Exception], ...]]"', '=', '(', ')', ',', ')', '->', '"Union[Future[List], Future[Dict]]"', ':', 'if', 'isins...
Wait for multiple asynchronous futures in parallel. Since Tornado 6.0, this function is exactly the same as `multi`. .. versionadded:: 4.0 .. versionchanged:: 4.2 If multiple ``Futures`` fail, any exceptions after the first (which is raised) will be logged. Added the ``quiet_exceptions`` ...
['Wait', 'for', 'multiple', 'asynchronous', 'futures', 'in', 'parallel', '.']
train
https://github.com/tornadoweb/tornado/blob/b8b481770bcdb333a69afde5cce7eaa449128326/tornado/gen.py#L463-L523
3,267
zetaops/zengine
zengine/lib/camunda_parser.py
CamundaProcessParser._get_description
def _get_description(self): """ Tries to get WF description from 'collabration' or 'process' or 'pariticipant' Returns: """ ns = {'ns': '{%s}' % BPMN_MODEL_NS} desc = ( self.doc_xpath('.//{ns}collaboration/{ns}documentation'.format(**ns)) or self....
python
def _get_description(self): """ Tries to get WF description from 'collabration' or 'process' or 'pariticipant' Returns: """ ns = {'ns': '{%s}' % BPMN_MODEL_NS} desc = ( self.doc_xpath('.//{ns}collaboration/{ns}documentation'.format(**ns)) or self....
['def', '_get_description', '(', 'self', ')', ':', 'ns', '=', '{', "'ns'", ':', "'{%s}'", '%', 'BPMN_MODEL_NS', '}', 'desc', '=', '(', 'self', '.', 'doc_xpath', '(', "'.//{ns}collaboration/{ns}documentation'", '.', 'format', '(', '*', '*', 'ns', ')', ')', 'or', 'self', '.', 'doc_xpath', '(', "'.//{ns}process/{ns}docume...
Tries to get WF description from 'collabration' or 'process' or 'pariticipant' Returns:
['Tries', 'to', 'get', 'WF', 'description', 'from', 'collabration', 'or', 'process', 'or', 'pariticipant', 'Returns', ':']
train
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/lib/camunda_parser.py#L66-L79
3,268
ubc/ubcpi
ubcpi/serialize.py
serialize_seeds
def serialize_seeds(seeds, block): """ Serialize the seeds in peer instruction XBlock to xml Args: seeds (lxml.etree.Element): The <seeds> XML element. block (PeerInstructionXBlock): The XBlock with configuration to serialize. Returns: None """ for seed_dict in block.se...
python
def serialize_seeds(seeds, block): """ Serialize the seeds in peer instruction XBlock to xml Args: seeds (lxml.etree.Element): The <seeds> XML element. block (PeerInstructionXBlock): The XBlock with configuration to serialize. Returns: None """ for seed_dict in block.se...
['def', 'serialize_seeds', '(', 'seeds', ',', 'block', ')', ':', 'for', 'seed_dict', 'in', 'block', '.', 'seeds', ':', 'seed', '=', 'etree', '.', 'SubElement', '(', 'seeds', ',', "'seed'", ')', '# options in xml starts with 1', 'seed', '.', 'set', '(', "'option'", ',', 'unicode', '(', 'seed_dict', '.', 'get', '(', "'an...
Serialize the seeds in peer instruction XBlock to xml Args: seeds (lxml.etree.Element): The <seeds> XML element. block (PeerInstructionXBlock): The XBlock with configuration to serialize. Returns: None
['Serialize', 'the', 'seeds', 'in', 'peer', 'instruction', 'XBlock', 'to', 'xml']
train
https://github.com/ubc/ubcpi/blob/7b6de03f93f3a4a8af4b92dfde7c69eeaf21f46e/ubcpi/serialize.py#L292-L307
3,269
coldfix/udiskie
udiskie/udisks2.py
Daemon._interfaces_removed
def _interfaces_removed(self, object_path, interfaces): """Internal method.""" old_state = copy(self._objects[object_path]) for interface in interfaces: del self._objects[object_path][interface] new_state = self._objects[object_path] if Interface['Drive'] in interfac...
python
def _interfaces_removed(self, object_path, interfaces): """Internal method.""" old_state = copy(self._objects[object_path]) for interface in interfaces: del self._objects[object_path][interface] new_state = self._objects[object_path] if Interface['Drive'] in interfac...
['def', '_interfaces_removed', '(', 'self', ',', 'object_path', ',', 'interfaces', ')', ':', 'old_state', '=', 'copy', '(', 'self', '.', '_objects', '[', 'object_path', ']', ')', 'for', 'interface', 'in', 'interfaces', ':', 'del', 'self', '.', '_objects', '[', 'object_path', ']', '[', 'interface', ']', 'new_state', '='...
Internal method.
['Internal', 'method', '.']
train
https://github.com/coldfix/udiskie/blob/804c9d27df6f7361fec3097c432398f2d702f911/udiskie/udisks2.py#L821-L850
3,270
santoshphilip/eppy
eppy/useful_scripts/loopdiagram.py
makediagram
def makediagram(edges): """make the diagram with the edges""" graph = pydot.Dot(graph_type='digraph') nodes = edges2nodes(edges) epnodes = [(node, makeanode(node[0])) for node in nodes if nodetype(node)=="epnode"] endnodes = [(node, makeendnode(node[0])) for node in nodes if nodety...
python
def makediagram(edges): """make the diagram with the edges""" graph = pydot.Dot(graph_type='digraph') nodes = edges2nodes(edges) epnodes = [(node, makeanode(node[0])) for node in nodes if nodetype(node)=="epnode"] endnodes = [(node, makeendnode(node[0])) for node in nodes if nodety...
['def', 'makediagram', '(', 'edges', ')', ':', 'graph', '=', 'pydot', '.', 'Dot', '(', 'graph_type', '=', "'digraph'", ')', 'nodes', '=', 'edges2nodes', '(', 'edges', ')', 'epnodes', '=', '[', '(', 'node', ',', 'makeanode', '(', 'node', '[', '0', ']', ')', ')', 'for', 'node', 'in', 'nodes', 'if', 'nodetype', '(', 'node...
make the diagram with the edges
['make', 'the', 'diagram', 'with', 'the', 'edges']
train
https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/loopdiagram.py#L140-L154
3,271
swimlane/swimlane-python
swimlane/core/cursor.py
PaginatedCursor._evaluate
def _evaluate(self): """Lazily retrieve and paginate report results and build Record instances from returned data""" if self._elements: for element in self._elements: yield element else: for page in itertools.count(): raw_elements = self._r...
python
def _evaluate(self): """Lazily retrieve and paginate report results and build Record instances from returned data""" if self._elements: for element in self._elements: yield element else: for page in itertools.count(): raw_elements = self._r...
['def', '_evaluate', '(', 'self', ')', ':', 'if', 'self', '.', '_elements', ':', 'for', 'element', 'in', 'self', '.', '_elements', ':', 'yield', 'element', 'else', ':', 'for', 'page', 'in', 'itertools', '.', 'count', '(', ')', ':', 'raw_elements', '=', 'self', '.', '_retrieve_raw_elements', '(', 'page', ')', 'for', 'ra...
Lazily retrieve and paginate report results and build Record instances from returned data
['Lazily', 'retrieve', 'and', 'paginate', 'report', 'results', 'and', 'build', 'Record', 'instances', 'from', 'returned', 'data']
train
https://github.com/swimlane/swimlane-python/blob/588fc503a76799bcdb5aecdf2f64a6ee05e3922d/swimlane/core/cursor.py#L44-L64
3,272
carpedm20/fbchat
fbchat/_client.py
Client.sendRemoteVoiceClips
def sendRemoteVoiceClips( self, clip_urls, message=None, thread_id=None, thread_type=ThreadType.USER ): """ Sends voice clips from URLs to a thread :param clip_urls: URLs of clips to upload and send :param message: Additional message :param thread_id: User/Group ID t...
python
def sendRemoteVoiceClips( self, clip_urls, message=None, thread_id=None, thread_type=ThreadType.USER ): """ Sends voice clips from URLs to a thread :param clip_urls: URLs of clips to upload and send :param message: Additional message :param thread_id: User/Group ID t...
['def', 'sendRemoteVoiceClips', '(', 'self', ',', 'clip_urls', ',', 'message', '=', 'None', ',', 'thread_id', '=', 'None', ',', 'thread_type', '=', 'ThreadType', '.', 'USER', ')', ':', 'clip_urls', '=', 'require_list', '(', 'clip_urls', ')', 'files', '=', 'self', '.', '_upload', '(', 'get_files_from_urls', '(', 'clip_u...
Sends voice clips from URLs to a thread :param clip_urls: URLs of clips to upload and send :param message: Additional message :param thread_id: User/Group ID to send to. See :ref:`intro_threads` :param thread_type: See :ref:`intro_threads` :type thread_type: models.ThreadType ...
['Sends', 'voice', 'clips', 'from', 'URLs', 'to', 'a', 'thread']
train
https://github.com/carpedm20/fbchat/blob/f480d68b5773473e6daba7f66075ee30e8d737a8/fbchat/_client.py#L1610-L1628
3,273
emc-openstack/storops
storops/vnx/block_cli.py
duel_command
def duel_command(f): """ indicate it's a command need to be called on both SP :param f: function that returns the command in list :return: command execution result on both sps (tuple of 2) """ @functools.wraps(f) def func_wrapper(self, *argv, **kwargs): commands = _get_commands(f, self...
python
def duel_command(f): """ indicate it's a command need to be called on both SP :param f: function that returns the command in list :return: command execution result on both sps (tuple of 2) """ @functools.wraps(f) def func_wrapper(self, *argv, **kwargs): commands = _get_commands(f, self...
['def', 'duel_command', '(', 'f', ')', ':', '@', 'functools', '.', 'wraps', '(', 'f', ')', 'def', 'func_wrapper', '(', 'self', ',', '*', 'argv', ',', '*', '*', 'kwargs', ')', ':', 'commands', '=', '_get_commands', '(', 'f', ',', 'self', ',', '*', 'argv', ',', '*', '*', 'kwargs', ')', 'return', 'self', '.', 'execute_dua...
indicate it's a command need to be called on both SP :param f: function that returns the command in list :return: command execution result on both sps (tuple of 2)
['indicate', 'it', 's', 'a', 'command', 'need', 'to', 'be', 'called', 'on', 'both', 'SP']
train
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/block_cli.py#L78-L90
3,274
linnarsson-lab/loompy
loompy/loompy.py
create
def create(filename: str, layers: Union[np.ndarray, Dict[str, np.ndarray], loompy.LayerManager], row_attrs: Union[loompy.AttributeManager, Dict[str, np.ndarray]], col_attrs: Union[loompy.AttributeManager, Dict[str, np.ndarray]], *, file_attrs: Dict[str, str] = None) -> None: """ Create a new Loom file from the given ...
python
def create(filename: str, layers: Union[np.ndarray, Dict[str, np.ndarray], loompy.LayerManager], row_attrs: Union[loompy.AttributeManager, Dict[str, np.ndarray]], col_attrs: Union[loompy.AttributeManager, Dict[str, np.ndarray]], *, file_attrs: Dict[str, str] = None) -> None: """ Create a new Loom file from the given ...
['def', 'create', '(', 'filename', ':', 'str', ',', 'layers', ':', 'Union', '[', 'np', '.', 'ndarray', ',', 'Dict', '[', 'str', ',', 'np', '.', 'ndarray', ']', ',', 'loompy', '.', 'LayerManager', ']', ',', 'row_attrs', ':', 'Union', '[', 'loompy', '.', 'AttributeManager', ',', 'Dict', '[', 'str', ',', 'np', '.', 'ndarr...
Create a new Loom file from the given data. Args: filename (str): The filename (typically using a ``.loom`` file extension) layers: One of the following: * Two-dimensional (N-by-M) numpy ndarray of float values * Sparse matrix (e.g. :class:`scipy.sparse.csr_matrix`) * Dictiona...
['Create', 'a', 'new', 'Loom', 'file', 'from', 'the', 'given', 'data', '.']
train
https://github.com/linnarsson-lab/loompy/blob/62c8373a92b058753baa3a95331fb541f560f599/loompy/loompy.py#L1023-L1089
3,275
bykof/billomapy
billomapy/billomapy.py
Billomapy.confirmation_pdf
def confirmation_pdf(self, confirmation_id): """ Opens a pdf of a confirmation :param confirmation_id: the confirmation id :return: dict """ return self._create_get_request(resource=CONFIRMATIONS, billomat_id=confirmation_id, command=PDF)
python
def confirmation_pdf(self, confirmation_id): """ Opens a pdf of a confirmation :param confirmation_id: the confirmation id :return: dict """ return self._create_get_request(resource=CONFIRMATIONS, billomat_id=confirmation_id, command=PDF)
['def', 'confirmation_pdf', '(', 'self', ',', 'confirmation_id', ')', ':', 'return', 'self', '.', '_create_get_request', '(', 'resource', '=', 'CONFIRMATIONS', ',', 'billomat_id', '=', 'confirmation_id', ',', 'command', '=', 'PDF', ')']
Opens a pdf of a confirmation :param confirmation_id: the confirmation id :return: dict
['Opens', 'a', 'pdf', 'of', 'a', 'confirmation']
train
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L2933-L2940
3,276
python-diamond/Diamond
src/collectors/icinga_stats/icinga_stats.py
IcingaStatsCollector._get_externalcmd_stats
def _get_externalcmd_stats(self, app_stats): """ Process: * high_external_command_buffer_slots * total_external_command_buffer_slots * used_external_command_buffer_slots * external_command_stats= """ khigh = "high_external_command_buffer_slots" ...
python
def _get_externalcmd_stats(self, app_stats): """ Process: * high_external_command_buffer_slots * total_external_command_buffer_slots * used_external_command_buffer_slots * external_command_stats= """ khigh = "high_external_command_buffer_slots" ...
['def', '_get_externalcmd_stats', '(', 'self', ',', 'app_stats', ')', ':', 'khigh', '=', '"high_external_command_buffer_slots"', 'ktotal', '=', '"total_external_command_buffer_slots"', 'kused', '=', '"used_external_command_buffer_slots"', 'kstats', '=', '"external_command_stats"', 'aliases', '=', '{', 'khigh', ':', '"e...
Process: * high_external_command_buffer_slots * total_external_command_buffer_slots * used_external_command_buffer_slots * external_command_stats=
['Process', ':', '*', 'high_external_command_buffer_slots', '*', 'total_external_command_buffer_slots', '*', 'used_external_command_buffer_slots', '*', 'external_command_stats', '=']
train
https://github.com/python-diamond/Diamond/blob/0f3eb04327d6d3ed5e53a9967d6c9d2c09714a47/src/collectors/icinga_stats/icinga_stats.py#L282-L321
3,277
dailymuse/oz
oz/core/actions.py
server
def server(): """Runs the server""" tornado.log.enable_pretty_logging() # Get and validate the server_type server_type = oz.settings["server_type"] if server_type not in [None, "wsgi", "asyncio", "twisted"]: raise Exception("Unknown server type: %s" % server_type) # Install the correc...
python
def server(): """Runs the server""" tornado.log.enable_pretty_logging() # Get and validate the server_type server_type = oz.settings["server_type"] if server_type not in [None, "wsgi", "asyncio", "twisted"]: raise Exception("Unknown server type: %s" % server_type) # Install the correc...
['def', 'server', '(', ')', ':', 'tornado', '.', 'log', '.', 'enable_pretty_logging', '(', ')', '# Get and validate the server_type', 'server_type', '=', 'oz', '.', 'settings', '[', '"server_type"', ']', 'if', 'server_type', 'not', 'in', '[', 'None', ',', '"wsgi"', ',', '"asyncio"', ',', '"twisted"', ']', ':', 'raise',...
Runs the server
['Runs', 'the', 'server']
train
https://github.com/dailymuse/oz/blob/4329f6a207dc9d2a8fbeb4d16d415dbe4570b5bd/oz/core/actions.py#L65-L141
3,278
SCIP-Interfaces/PySCIPOpt
examples/unfinished/portfolio_soco.py
p_portfolio
def p_portfolio(I,sigma,r,alpha,beta): """p_portfolio -- modified markowitz model for portfolio optimization. Parameters: - I: set of items - sigma[i]: standard deviation of item i - r[i]: revenue of item i - alpha: acceptance threshold - beta: desired confidence level ...
python
def p_portfolio(I,sigma,r,alpha,beta): """p_portfolio -- modified markowitz model for portfolio optimization. Parameters: - I: set of items - sigma[i]: standard deviation of item i - r[i]: revenue of item i - alpha: acceptance threshold - beta: desired confidence level ...
['def', 'p_portfolio', '(', 'I', ',', 'sigma', ',', 'r', ',', 'alpha', ',', 'beta', ')', ':', 'model', '=', 'Model', '(', '"p_portfolio"', ')', 'x', '=', '{', '}', 'for', 'i', 'in', 'I', ':', 'x', '[', 'i', ']', '=', 'model', '.', 'addVar', '(', 'vtype', '=', '"C"', ',', 'name', '=', '"x(%s)"', '%', 'i', ')', '# quanti...
p_portfolio -- modified markowitz model for portfolio optimization. Parameters: - I: set of items - sigma[i]: standard deviation of item i - r[i]: revenue of item i - alpha: acceptance threshold - beta: desired confidence level Returns a model, ready to be solved.
['p_portfolio', '--', 'modified', 'markowitz', 'model', 'for', 'portfolio', 'optimization', '.', 'Parameters', ':', '-', 'I', ':', 'set', 'of', 'items', '-', 'sigma', '[', 'i', ']', ':', 'standard', 'deviation', 'of', 'item', 'i', '-', 'r', '[', 'i', ']', ':', 'revenue', 'of', 'item', 'i', '-', 'alpha', ':', 'acceptanc...
train
https://github.com/SCIP-Interfaces/PySCIPOpt/blob/9c960b40d94a48b0304d73dbe28b467b9c065abe/examples/unfinished/portfolio_soco.py#L27-L55
3,279
roboogle/gtkmvc3
gtkmvco/gtkmvc3/progen/model.py
ProgenModel.generate_project
def generate_project(self): """ Generate the whole project. Returns True if at least one file has been generated, False otherwise.""" # checks needed properties if not self.name or not self.destdir or \ not os.path.isdir(self.destdir): raise ValueError(...
python
def generate_project(self): """ Generate the whole project. Returns True if at least one file has been generated, False otherwise.""" # checks needed properties if not self.name or not self.destdir or \ not os.path.isdir(self.destdir): raise ValueError(...
['def', 'generate_project', '(', 'self', ')', ':', '# checks needed properties', 'if', 'not', 'self', '.', 'name', 'or', 'not', 'self', '.', 'destdir', 'or', 'not', 'os', '.', 'path', '.', 'isdir', '(', 'self', '.', 'destdir', ')', ':', 'raise', 'ValueError', '(', '"Empty or invalid property values: run with \'help\' c...
Generate the whole project. Returns True if at least one file has been generated, False otherwise.
['Generate', 'the', 'whole', 'project', '.', 'Returns', 'True', 'if', 'at', 'least', 'one', 'file', 'has', 'been', 'generated', 'False', 'otherwise', '.']
train
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/progen/model.py#L97-L141
3,280
dfujim/bdata
bdata/bdata.py
bdata._get_asym_comb
def _get_asym_comb(self,d): """ Find the combined asymmetry for slr runs. Elegant 4-counter method. """ # get data d0 = d[0]; d1 = d[2]; d2 = d[1]; d3 = d[3] # pre-calcs r_denom = d0*d3 r_denom[r_denom==0] = np.nan r = np.sqrt((d1...
python
def _get_asym_comb(self,d): """ Find the combined asymmetry for slr runs. Elegant 4-counter method. """ # get data d0 = d[0]; d1 = d[2]; d2 = d[1]; d3 = d[3] # pre-calcs r_denom = d0*d3 r_denom[r_denom==0] = np.nan r = np.sqrt((d1...
['def', '_get_asym_comb', '(', 'self', ',', 'd', ')', ':', '# get data', 'd0', '=', 'd', '[', '0', ']', 'd1', '=', 'd', '[', '2', ']', 'd2', '=', 'd', '[', '1', ']', 'd3', '=', 'd', '[', '3', ']', '# pre-calcs', 'r_denom', '=', 'd0', '*', 'd3', 'r_denom', '[', 'r_denom', '==', '0', ']', '=', 'np', '.', 'nan', 'r', '=',...
Find the combined asymmetry for slr runs. Elegant 4-counter method.
['Find', 'the', 'combined', 'asymmetry', 'for', 'slr', 'runs', '.', 'Elegant', '4', '-', 'counter', 'method', '.']
train
https://github.com/dfujim/bdata/blob/86af7b091e5cc167d2b9a3146953da347cc38614/bdata/bdata.py#L580-L610
3,281
watson-developer-cloud/python-sdk
ibm_watson/speech_to_text_v1.py
SpeechToTextV1.recognize
def recognize(self, audio, model=None, language_customization_id=None, acoustic_customization_id=None, base_model_version=None, customization_weight=None, inactivity_timeout=None, ...
python
def recognize(self, audio, model=None, language_customization_id=None, acoustic_customization_id=None, base_model_version=None, customization_weight=None, inactivity_timeout=None, ...
['def', 'recognize', '(', 'self', ',', 'audio', ',', 'model', '=', 'None', ',', 'language_customization_id', '=', 'None', ',', 'acoustic_customization_id', '=', 'None', ',', 'base_model_version', '=', 'None', ',', 'customization_weight', '=', 'None', ',', 'inactivity_timeout', '=', 'None', ',', 'keywords', '=', 'None',...
Recognize audio. Sends audio and returns transcription results for a recognition request. You can pass a maximum of 100 MB and a minimum of 100 bytes of audio with a request. The service automatically detects the endianness of the incoming audio and, for audio that includes multiple cha...
['Recognize', 'audio', '.']
train
https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/speech_to_text_v1.py#L171-L438
3,282
saltstack/salt
salt/minion.py
SyndicManager._return_pub_syndic
def _return_pub_syndic(self, values, master_id=None): ''' Wrapper to call the '_return_pub_multi' a syndic, best effort to get the one you asked for ''' func = '_return_pub_multi' for master, syndic_future in self.iter_master_options(master_id): if not syndic_future.d...
python
def _return_pub_syndic(self, values, master_id=None): ''' Wrapper to call the '_return_pub_multi' a syndic, best effort to get the one you asked for ''' func = '_return_pub_multi' for master, syndic_future in self.iter_master_options(master_id): if not syndic_future.d...
['def', '_return_pub_syndic', '(', 'self', ',', 'values', ',', 'master_id', '=', 'None', ')', ':', 'func', '=', "'_return_pub_multi'", 'for', 'master', ',', 'syndic_future', 'in', 'self', '.', 'iter_master_options', '(', 'master_id', ')', ':', 'if', 'not', 'syndic_future', '.', 'done', '(', ')', 'or', 'syndic_future', ...
Wrapper to call the '_return_pub_multi' a syndic, best effort to get the one you asked for
['Wrapper', 'to', 'call', 'the', '_return_pub_multi', 'a', 'syndic', 'best', 'effort', 'to', 'get', 'the', 'one', 'you', 'asked', 'for']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L3255-L3295
3,283
tomi77/django-extra-tools
django_extra_tools/wsgi_request.py
get_client_ip
def get_client_ip(request): """ Get the client IP from the request """ # set the default value of the ip to be the REMOTE_ADDR if available # else None ip = request.META.get('REMOTE_ADDR') # try to get the first non-proxy ip (not a private ip) from the # HTTP_X_FORWARDED_FOR x_forwar...
python
def get_client_ip(request): """ Get the client IP from the request """ # set the default value of the ip to be the REMOTE_ADDR if available # else None ip = request.META.get('REMOTE_ADDR') # try to get the first non-proxy ip (not a private ip) from the # HTTP_X_FORWARDED_FOR x_forwar...
['def', 'get_client_ip', '(', 'request', ')', ':', '# set the default value of the ip to be the REMOTE_ADDR if available', '# else None', 'ip', '=', 'request', '.', 'META', '.', 'get', '(', "'REMOTE_ADDR'", ')', '# try to get the first non-proxy ip (not a private ip) from the', '# HTTP_X_FORWARDED_FOR', 'x_forwarded_fo...
Get the client IP from the request
['Get', 'the', 'client', 'IP', 'from', 'the', 'request']
train
https://github.com/tomi77/django-extra-tools/blob/fb6d226bc5cf3fc0eb8abe61a512c3f5c7dcc8a8/django_extra_tools/wsgi_request.py#L4-L23
3,284
mryellow/maze_explorer
mazeexp/engine/world.py
WorldLayer.update_sensors
def update_sensors(self): """ Check path for each sensor and record wall proximity """ assert isinstance(self.player.cshape.center, eu.Vector2) pos = self.player.cshape.center a = math.radians(self.player.rotation) for sensor in self.player.sensors: s...
python
def update_sensors(self): """ Check path for each sensor and record wall proximity """ assert isinstance(self.player.cshape.center, eu.Vector2) pos = self.player.cshape.center a = math.radians(self.player.rotation) for sensor in self.player.sensors: s...
['def', 'update_sensors', '(', 'self', ')', ':', 'assert', 'isinstance', '(', 'self', '.', 'player', '.', 'cshape', '.', 'center', ',', 'eu', '.', 'Vector2', ')', 'pos', '=', 'self', '.', 'player', '.', 'cshape', '.', 'center', 'a', '=', 'math', '.', 'radians', '(', 'self', '.', 'player', '.', 'rotation', ')', 'for', '...
Check path for each sensor and record wall proximity
['Check', 'path', 'for', 'each', 'sensor', 'and', 'record', 'wall', 'proximity']
train
https://github.com/mryellow/maze_explorer/blob/ab8a25ccd05105d2fe57e0213d690cfc07e45827/mazeexp/engine/world.py#L355-L400
3,285
RudolfCardinal/pythonlib
cardinal_pythonlib/sqlalchemy/schema.py
columns_equal
def columns_equal(a: Column, b: Column) -> bool: """ Are two SQLAlchemy columns are equal? Checks based on: - column ``name`` - column ``type`` (see :func:`column_types_equal`) - ``nullable`` """ return ( a.name == b.name and column_types_equal(a.type, b.type) and a....
python
def columns_equal(a: Column, b: Column) -> bool: """ Are two SQLAlchemy columns are equal? Checks based on: - column ``name`` - column ``type`` (see :func:`column_types_equal`) - ``nullable`` """ return ( a.name == b.name and column_types_equal(a.type, b.type) and a....
['def', 'columns_equal', '(', 'a', ':', 'Column', ',', 'b', ':', 'Column', ')', '->', 'bool', ':', 'return', '(', 'a', '.', 'name', '==', 'b', '.', 'name', 'and', 'column_types_equal', '(', 'a', '.', 'type', ',', 'b', '.', 'type', ')', 'and', 'a', '.', 'nullable', '==', 'b', '.', 'nullable', ')']
Are two SQLAlchemy columns are equal? Checks based on: - column ``name`` - column ``type`` (see :func:`column_types_equal`) - ``nullable``
['Are', 'two', 'SQLAlchemy', 'columns', 'are', 'equal?', 'Checks', 'based', 'on', ':']
train
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/sqlalchemy/schema.py#L1101-L1113
3,286
pmacosta/pexdoc
pexdoc/pinspect.py
Callables.get_callable_from_line
def get_callable_from_line(self, module_file, lineno): """Get the callable that the line number belongs to.""" module_name = _get_module_name_from_fname(module_file) if module_name not in self._modules_dict: self.trace([module_file]) ret = None # Sort callables by sta...
python
def get_callable_from_line(self, module_file, lineno): """Get the callable that the line number belongs to.""" module_name = _get_module_name_from_fname(module_file) if module_name not in self._modules_dict: self.trace([module_file]) ret = None # Sort callables by sta...
['def', 'get_callable_from_line', '(', 'self', ',', 'module_file', ',', 'lineno', ')', ':', 'module_name', '=', '_get_module_name_from_fname', '(', 'module_file', ')', 'if', 'module_name', 'not', 'in', 'self', '.', '_modules_dict', ':', 'self', '.', 'trace', '(', '[', 'module_file', ']', ')', 'ret', '=', 'None', '# Sor...
Get the callable that the line number belongs to.
['Get', 'the', 'callable', 'that', 'the', 'line', 'number', 'belongs', 'to', '.']
train
https://github.com/pmacosta/pexdoc/blob/201ac243e5781347feb75896a4231429fe6da4b1/pexdoc/pinspect.py#L512-L525
3,287
jf-parent/brome
brome/core/selector.py
Selector.resolve_selector
def resolve_selector(self): """Resolve the selector variable in place """ effective_selector_list = [] for current_selector in self._selector_list: # INLINE SELECTOR if self.get_type(current_selector) != 'selector_variable': effective_selector_li...
python
def resolve_selector(self): """Resolve the selector variable in place """ effective_selector_list = [] for current_selector in self._selector_list: # INLINE SELECTOR if self.get_type(current_selector) != 'selector_variable': effective_selector_li...
['def', 'resolve_selector', '(', 'self', ')', ':', 'effective_selector_list', '=', '[', ']', 'for', 'current_selector', 'in', 'self', '.', '_selector_list', ':', '# INLINE SELECTOR', 'if', 'self', '.', 'get_type', '(', 'current_selector', ')', '!=', "'selector_variable'", ':', 'effective_selector_list', '.', 'append', ...
Resolve the selector variable in place
['Resolve', 'the', 'selector', 'variable', 'in', 'place']
train
https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/core/selector.py#L105-L174
3,288
wright-group/WrightTools
WrightTools/data/_data.py
Data.print_tree
def print_tree(self, *, verbose=True): """Print a ascii-formatted tree representation of the data contents.""" print("{0} ({1})".format(self.natural_name, self.filepath)) self._print_branch("", depth=0, verbose=verbose)
python
def print_tree(self, *, verbose=True): """Print a ascii-formatted tree representation of the data contents.""" print("{0} ({1})".format(self.natural_name, self.filepath)) self._print_branch("", depth=0, verbose=verbose)
['def', 'print_tree', '(', 'self', ',', '*', ',', 'verbose', '=', 'True', ')', ':', 'print', '(', '"{0} ({1})"', '.', 'format', '(', 'self', '.', 'natural_name', ',', 'self', '.', 'filepath', ')', ')', 'self', '.', '_print_branch', '(', '""', ',', 'depth', '=', '0', ',', 'verbose', '=', 'verbose', ')']
Print a ascii-formatted tree representation of the data contents.
['Print', 'a', 'ascii', '-', 'formatted', 'tree', 'representation', 'of', 'the', 'data', 'contents', '.']
train
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L1314-L1317
3,289
MolSSI-BSE/basis_set_exchange
basis_set_exchange/cli/bsecurate_handlers.py
_bsecurate_cli_compare_basis_sets
def _bsecurate_cli_compare_basis_sets(args): '''Handles compare-basis-sets subcommand''' ret = curate.compare_basis_sets(args.basis1, args.basis2, args.version1, args.version2, args.uncontract_general, args.data_dir, args.data_dir) if ret: return "No difference found" else: ret...
python
def _bsecurate_cli_compare_basis_sets(args): '''Handles compare-basis-sets subcommand''' ret = curate.compare_basis_sets(args.basis1, args.basis2, args.version1, args.version2, args.uncontract_general, args.data_dir, args.data_dir) if ret: return "No difference found" else: ret...
['def', '_bsecurate_cli_compare_basis_sets', '(', 'args', ')', ':', 'ret', '=', 'curate', '.', 'compare_basis_sets', '(', 'args', '.', 'basis1', ',', 'args', '.', 'basis2', ',', 'args', '.', 'version1', ',', 'args', '.', 'version2', ',', 'args', '.', 'uncontract_general', ',', 'args', '.', 'data_dir', ',', 'args', '.',...
Handles compare-basis-sets subcommand
['Handles', 'compare', '-', 'basis', '-', 'sets', 'subcommand']
train
https://github.com/MolSSI-BSE/basis_set_exchange/blob/e79110aaeb65f392ed5032420322dee3336948f7/basis_set_exchange/cli/bsecurate_handlers.py#L51-L58
3,290
DataBiosphere/toil
src/toil/leader.py
Leader.checkForDeadlocks
def checkForDeadlocks(self): """ Checks if the system is deadlocked running service jobs. """ totalRunningJobs = len(self.batchSystem.getRunningBatchJobIDs()) totalServicesIssued = self.serviceJobsIssued + self.preemptableServiceJobsIssued # If there are no updated jobs a...
python
def checkForDeadlocks(self): """ Checks if the system is deadlocked running service jobs. """ totalRunningJobs = len(self.batchSystem.getRunningBatchJobIDs()) totalServicesIssued = self.serviceJobsIssued + self.preemptableServiceJobsIssued # If there are no updated jobs a...
['def', 'checkForDeadlocks', '(', 'self', ')', ':', 'totalRunningJobs', '=', 'len', '(', 'self', '.', 'batchSystem', '.', 'getRunningBatchJobIDs', '(', ')', ')', 'totalServicesIssued', '=', 'self', '.', 'serviceJobsIssued', '+', 'self', '.', 'preemptableServiceJobsIssued', '# If there are no updated jobs and at least s...
Checks if the system is deadlocked running service jobs.
['Checks', 'if', 'the', 'system', 'is', 'deadlocked', 'running', 'service', 'jobs', '.']
train
https://github.com/DataBiosphere/toil/blob/a8252277ff814e7bee0971139c2344f88e44b644/src/toil/leader.py#L569-L596
3,291
chaoss/grimoirelab-manuscripts
manuscripts/esquery.py
ElasticQuery.__get_query_filters
def __get_query_filters(cls, filters={}, inverse=False): """ Convert a dict with the filters to be applied ({"name1":"value1", "name2":"value2"}) to a list of query objects which can be used together in a query using boolean combination logic. :param filters: dict with the filte...
python
def __get_query_filters(cls, filters={}, inverse=False): """ Convert a dict with the filters to be applied ({"name1":"value1", "name2":"value2"}) to a list of query objects which can be used together in a query using boolean combination logic. :param filters: dict with the filte...
['def', '__get_query_filters', '(', 'cls', ',', 'filters', '=', '{', '}', ',', 'inverse', '=', 'False', ')', ':', 'query_filters', '=', '[', ']', 'for', 'name', 'in', 'filters', ':', 'if', 'name', '[', '0', ']', '==', "'*'", 'and', 'not', 'inverse', ':', '# An inverse filter and not inverse mode', 'continue', 'if', 'na...
Convert a dict with the filters to be applied ({"name1":"value1", "name2":"value2"}) to a list of query objects which can be used together in a query using boolean combination logic. :param filters: dict with the filters to be applied :param inverse: if True include all the inverse filt...
['Convert', 'a', 'dict', 'with', 'the', 'filters', 'to', 'be', 'applied', '(', '{', 'name1', ':', 'value1', 'name2', ':', 'value2', '}', ')', 'to', 'a', 'list', 'of', 'query', 'objects', 'which', 'can', 'be', 'used', 'together', 'in', 'a', 'query', 'using', 'boolean', 'combination', 'logic', '.']
train
https://github.com/chaoss/grimoirelab-manuscripts/blob/94a3ad4f11bfbcd6c5190e01cb5d3e47a5187cd9/manuscripts/esquery.py#L41-L68
3,292
pyQode/pyqode.core
pyqode/core/modes/indenter.py
IndenterMode.indent_selection
def indent_selection(self, cursor): """ Indent selected text :param cursor: QTextCursor """ doc = self.editor.document() tab_len = self.editor.tab_length cursor.beginEditBlock() nb_lines = len(cursor.selection().toPlainText().splitlines()) c = sel...
python
def indent_selection(self, cursor): """ Indent selected text :param cursor: QTextCursor """ doc = self.editor.document() tab_len = self.editor.tab_length cursor.beginEditBlock() nb_lines = len(cursor.selection().toPlainText().splitlines()) c = sel...
['def', 'indent_selection', '(', 'self', ',', 'cursor', ')', ':', 'doc', '=', 'self', '.', 'editor', '.', 'document', '(', ')', 'tab_len', '=', 'self', '.', 'editor', '.', 'tab_length', 'cursor', '.', 'beginEditBlock', '(', ')', 'nb_lines', '=', 'len', '(', 'cursor', '.', 'selection', '(', ')', '.', 'toPlainText', '(',...
Indent selected text :param cursor: QTextCursor
['Indent', 'selected', 'text']
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/modes/indenter.py#L41-L68
3,293
raiden-network/raiden
raiden/network/proxies/token_network_registry.py
TokenNetworkRegistry.get_token_network
def get_token_network( self, token_address: TokenAddress, block_identifier: BlockSpecification = 'latest', ) -> Optional[Address]: """ Return the token network address for the given token or None if there is no correspoding address. """ if not isin...
python
def get_token_network( self, token_address: TokenAddress, block_identifier: BlockSpecification = 'latest', ) -> Optional[Address]: """ Return the token network address for the given token or None if there is no correspoding address. """ if not isin...
['def', 'get_token_network', '(', 'self', ',', 'token_address', ':', 'TokenAddress', ',', 'block_identifier', ':', 'BlockSpecification', '=', "'latest'", ',', ')', '->', 'Optional', '[', 'Address', ']', ':', 'if', 'not', 'isinstance', '(', 'token_address', ',', 'T_TargetAddress', ')', ':', 'raise', 'ValueError', '(', "...
Return the token network address for the given token or None if there is no correspoding address.
['Return', 'the', 'token', 'network', 'address', 'for', 'the', 'given', 'token', 'or', 'None', 'if', 'there', 'is', 'no', 'correspoding', 'address', '.']
train
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/proxies/token_network_registry.py#L79-L98
3,294
google/tangent
tangent/cfg.py
CFG.build_cfg
def build_cfg(cls, node): """Build a CFG for a function. Args: node: A function definition the body of which to analyze. Returns: A CFG object. Raises: TypeError: If the input is not a function definition. """ if not isinstance(node, gast.FunctionDef): raise TypeError(...
python
def build_cfg(cls, node): """Build a CFG for a function. Args: node: A function definition the body of which to analyze. Returns: A CFG object. Raises: TypeError: If the input is not a function definition. """ if not isinstance(node, gast.FunctionDef): raise TypeError(...
['def', 'build_cfg', '(', 'cls', ',', 'node', ')', ':', 'if', 'not', 'isinstance', '(', 'node', ',', 'gast', '.', 'FunctionDef', ')', ':', 'raise', 'TypeError', '(', "'input must be a function definition'", ')', 'cfg', '=', 'cls', '(', ')', 'cfg', '.', 'entry', '=', 'Node', '(', 'node', '.', 'args', ')', 'cfg', '.', 'h...
Build a CFG for a function. Args: node: A function definition the body of which to analyze. Returns: A CFG object. Raises: TypeError: If the input is not a function definition.
['Build', 'a', 'CFG', 'for', 'a', 'function', '.']
train
https://github.com/google/tangent/blob/6533e83af09de7345d1b438512679992f080dcc9/tangent/cfg.py#L87-L108
3,295
apache/spark
python/pyspark/mllib/feature.py
IDF.fit
def fit(self, dataset): """ Computes the inverse document frequency. :param dataset: an RDD of term frequency vectors """ if not isinstance(dataset, RDD): raise TypeError("dataset should be an RDD of term frequency vectors") jmodel = callMLlibFunc("fitIDF", s...
python
def fit(self, dataset): """ Computes the inverse document frequency. :param dataset: an RDD of term frequency vectors """ if not isinstance(dataset, RDD): raise TypeError("dataset should be an RDD of term frequency vectors") jmodel = callMLlibFunc("fitIDF", s...
['def', 'fit', '(', 'self', ',', 'dataset', ')', ':', 'if', 'not', 'isinstance', '(', 'dataset', ',', 'RDD', ')', ':', 'raise', 'TypeError', '(', '"dataset should be an RDD of term frequency vectors"', ')', 'jmodel', '=', 'callMLlibFunc', '(', '"fitIDF"', ',', 'self', '.', 'minDocFreq', ',', 'dataset', '.', 'map', '(',...
Computes the inverse document frequency. :param dataset: an RDD of term frequency vectors
['Computes', 'the', 'inverse', 'document', 'frequency', '.']
train
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/mllib/feature.py#L577-L586
3,296
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/colorbar.py
_CoreColorBarVisual._update
def _update(self): """Rebuilds the shaders, and repositions the objects that are used internally by the ColorBarVisual """ x, y = self._pos halfw, halfh = self._halfdim # test that width and height are non-zero if halfw <= 0: raise ValueError("hal...
python
def _update(self): """Rebuilds the shaders, and repositions the objects that are used internally by the ColorBarVisual """ x, y = self._pos halfw, halfh = self._halfdim # test that width and height are non-zero if halfw <= 0: raise ValueError("hal...
['def', '_update', '(', 'self', ')', ':', 'x', ',', 'y', '=', 'self', '.', '_pos', 'halfw', ',', 'halfh', '=', 'self', '.', '_halfdim', '# test that width and height are non-zero', 'if', 'halfw', '<=', '0', ':', 'raise', 'ValueError', '(', '"half-width must be positive and non-zero"', '", not %s"', '%', 'halfw', ')', '...
Rebuilds the shaders, and repositions the objects that are used internally by the ColorBarVisual
['Rebuilds', 'the', 'shaders', 'and', 'repositions', 'the', 'objects', 'that', 'are', 'used', 'internally', 'by', 'the', 'ColorBarVisual']
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/colorbar.py#L117-L158
3,297
mlperf/training
reinforcement/tensorflow/minigo/bigtable_input.py
make_single_array
def make_single_array(ds, batch_size=8*1024): """Create a single numpy array from a dataset. The dataset must have only one dimension, that is, the length of its `output_shapes` and `output_types` is 1, and its output shape must be `[]`, that is, every tensor in the dataset must be a scalar. A...
python
def make_single_array(ds, batch_size=8*1024): """Create a single numpy array from a dataset. The dataset must have only one dimension, that is, the length of its `output_shapes` and `output_types` is 1, and its output shape must be `[]`, that is, every tensor in the dataset must be a scalar. A...
['def', 'make_single_array', '(', 'ds', ',', 'batch_size', '=', '8', '*', '1024', ')', ':', 'if', 'isinstance', '(', 'ds', '.', 'output_types', ',', 'tuple', ')', 'or', 'isinstance', '(', 'ds', '.', 'output_shapes', ',', 'tuple', ')', ':', 'raise', 'ValueError', '(', "'Dataset must have a single type and shape'", ')', ...
Create a single numpy array from a dataset. The dataset must have only one dimension, that is, the length of its `output_shapes` and `output_types` is 1, and its output shape must be `[]`, that is, every tensor in the dataset must be a scalar. Args: ds: a TF Dataset. batch_size: how ...
['Create', 'a', 'single', 'numpy', 'array', 'from', 'a', 'dataset', '.']
train
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/bigtable_input.py#L106-L141
3,298
numenta/htmresearch
projects/sequence_learning/sequence_simulations.py
printOptions
def printOptions(options, tm, outFile): """ Pretty print the set of options """ print >>outFile, "TM parameters:" printTemporalMemory(tm, outFile) print >>outFile, "Experiment parameters:" for k,v in options.__dict__.iteritems(): print >>outFile, " %s : %s" % (k,str(v)) outFile.flush()
python
def printOptions(options, tm, outFile): """ Pretty print the set of options """ print >>outFile, "TM parameters:" printTemporalMemory(tm, outFile) print >>outFile, "Experiment parameters:" for k,v in options.__dict__.iteritems(): print >>outFile, " %s : %s" % (k,str(v)) outFile.flush()
['def', 'printOptions', '(', 'options', ',', 'tm', ',', 'outFile', ')', ':', 'print', '>>', 'outFile', ',', '"TM parameters:"', 'printTemporalMemory', '(', 'tm', ',', 'outFile', ')', 'print', '>>', 'outFile', ',', '"Experiment parameters:"', 'for', 'k', ',', 'v', 'in', 'options', '.', '__dict__', '.', 'iteritems', '(',...
Pretty print the set of options
['Pretty', 'print', 'the', 'set', 'of', 'options']
train
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/projects/sequence_learning/sequence_simulations.py#L326-L335
3,299
aaugustin/django-sequences
sequences/__init__.py
get_next_value
def get_next_value( sequence_name='default', initial_value=1, reset_value=None, *, nowait=False, using=None): """ Return the next value for a given sequence. """ # Inner import because models cannot be imported before their application. from .models import Sequence if reset_val...
python
def get_next_value( sequence_name='default', initial_value=1, reset_value=None, *, nowait=False, using=None): """ Return the next value for a given sequence. """ # Inner import because models cannot be imported before their application. from .models import Sequence if reset_val...
['def', 'get_next_value', '(', 'sequence_name', '=', "'default'", ',', 'initial_value', '=', '1', ',', 'reset_value', '=', 'None', ',', '*', ',', 'nowait', '=', 'False', ',', 'using', '=', 'None', ')', ':', '# Inner import because models cannot be imported before their application.', 'from', '.', 'models', 'import', 'S...
Return the next value for a given sequence.
['Return', 'the', 'next', 'value', 'for', 'a', 'given', 'sequence', '.']
train
https://github.com/aaugustin/django-sequences/blob/0228ae003540ccb63be4a456fb8f63a2f4038de6/sequences/__init__.py#L13-L59