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
8,600
googleads/googleads-python-lib
examples/adwords/v201809/campaign_management/add_keywords_using_incremental_batch_job.py
GetBatchJob
def GetBatchJob(client, batch_job_id): """Retrieves the BatchJob with the given id. Args: client: an instantiated AdWordsClient used to retrieve the BatchJob. batch_job_id: a long identifying the BatchJob to be retrieved. Returns: The BatchJob associated with the given id. """ batch_job_service =...
python
def GetBatchJob(client, batch_job_id): """Retrieves the BatchJob with the given id. Args: client: an instantiated AdWordsClient used to retrieve the BatchJob. batch_job_id: a long identifying the BatchJob to be retrieved. Returns: The BatchJob associated with the given id. """ batch_job_service =...
['def', 'GetBatchJob', '(', 'client', ',', 'batch_job_id', ')', ':', 'batch_job_service', '=', 'client', '.', 'GetService', '(', "'BatchJobService'", ',', "'v201809'", ')', 'selector', '=', '{', "'fields'", ':', '[', "'Id'", ',', "'Status'", ',', "'DownloadUrl'", ']', ',', "'predicates'", ':', '[', '{', "'field'", ':',...
Retrieves the BatchJob with the given id. Args: client: an instantiated AdWordsClient used to retrieve the BatchJob. batch_job_id: a long identifying the BatchJob to be retrieved. Returns: The BatchJob associated with the given id.
['Retrieves', 'the', 'BatchJob', 'with', 'the', 'given', 'id', '.']
train
https://github.com/googleads/googleads-python-lib/blob/aa3b1b474b0f9789ca55ca46f4b2b57aeae38874/examples/adwords/v201809/campaign_management/add_keywords_using_incremental_batch_job.py#L163-L185
8,601
PolicyStat/jobtastic
jobtastic/task.py
JobtasticTask.on_success
def on_success(self, retval, task_id, args, kwargs): """ Store results in the backend even if we're always eager. This ensures the `delay_or_run` calls always at least have results. """ if self.request.is_eager: # Store the result because celery wouldn't otherwise ...
python
def on_success(self, retval, task_id, args, kwargs): """ Store results in the backend even if we're always eager. This ensures the `delay_or_run` calls always at least have results. """ if self.request.is_eager: # Store the result because celery wouldn't otherwise ...
['def', 'on_success', '(', 'self', ',', 'retval', ',', 'task_id', ',', 'args', ',', 'kwargs', ')', ':', 'if', 'self', '.', 'request', '.', 'is_eager', ':', "# Store the result because celery wouldn't otherwise", 'self', '.', 'update_state', '(', 'task_id', ',', 'SUCCESS', ',', 'retval', ')']
Store results in the backend even if we're always eager. This ensures the `delay_or_run` calls always at least have results.
['Store', 'results', 'in', 'the', 'backend', 'even', 'if', 'we', 're', 'always', 'eager', '.', 'This', 'ensures', 'the', 'delay_or_run', 'calls', 'always', 'at', 'least', 'have', 'results', '.']
train
https://github.com/PolicyStat/jobtastic/blob/19cd3137ebf46877cee1ee5155d318bb6261ee1c/jobtastic/task.py#L392-L399
8,602
bslatkin/dpxdt
dpxdt/server/work_queue_handlers.py
handle_add
def handle_add(queue_name): """Adds a task to a queue.""" source = request.form.get('source', request.remote_addr, type=str) try: task_id = work_queue.add( queue_name, payload=request.form.get('payload', type=str), content_type=request.form.get('content_type', typ...
python
def handle_add(queue_name): """Adds a task to a queue.""" source = request.form.get('source', request.remote_addr, type=str) try: task_id = work_queue.add( queue_name, payload=request.form.get('payload', type=str), content_type=request.form.get('content_type', typ...
['def', 'handle_add', '(', 'queue_name', ')', ':', 'source', '=', 'request', '.', 'form', '.', 'get', '(', "'source'", ',', 'request', '.', 'remote_addr', ',', 'type', '=', 'str', ')', 'try', ':', 'task_id', '=', 'work_queue', '.', 'add', '(', 'queue_name', ',', 'payload', '=', 'request', '.', 'form', '.', 'get', '(', ...
Adds a task to a queue.
['Adds', 'a', 'task', 'to', 'a', 'queue', '.']
train
https://github.com/bslatkin/dpxdt/blob/9f860de1731021d99253670429e5f2157e1f6297/dpxdt/server/work_queue_handlers.py#L37-L53
8,603
google/tangent
tangent/grad_util.py
grad
def grad(func, wrt=(0,), optimized=True, preserve_result=False, check_dims=True, verbose=0): """Return the gradient of a function `func`. Args: func: The function to take the gradient of. wrt: A tuple of argument indices to differentiate with respect to. By ...
python
def grad(func, wrt=(0,), optimized=True, preserve_result=False, check_dims=True, verbose=0): """Return the gradient of a function `func`. Args: func: The function to take the gradient of. wrt: A tuple of argument indices to differentiate with respect to. By ...
['def', 'grad', '(', 'func', ',', 'wrt', '=', '(', '0', ',', ')', ',', 'optimized', '=', 'True', ',', 'preserve_result', '=', 'False', ',', 'check_dims', '=', 'True', ',', 'verbose', '=', '0', ')', ':', 'return', 'autodiff', '(', 'func', ',', 'wrt', '=', 'wrt', ',', 'motion', '=', "'joint'", ',', 'mode', '=', "'reverse...
Return the gradient of a function `func`. Args: func: The function to take the gradient of. wrt: A tuple of argument indices to differentiate with respect to. By default the derivative is taken with respect to the first argument. optimized: Whether to optimize the gradient function (`True` by defa...
['Return', 'the', 'gradient', 'of', 'a', 'function', 'func', '.', 'Args', ':', 'func', ':', 'The', 'function', 'to', 'take', 'the', 'gradient', 'of', '.', 'wrt', ':', 'A', 'tuple', 'of', 'argument', 'indices', 'to', 'differentiate', 'with', 'respect', 'to', '.', 'By', 'default', 'the', 'derivative', 'is', 'taken', 'wit...
train
https://github.com/google/tangent/blob/6533e83af09de7345d1b438512679992f080dcc9/tangent/grad_util.py#L335-L388
8,604
ANTsX/ANTsPy
ants/core/ants_image_io.py
images_to_matrix
def images_to_matrix(image_list, mask=None, sigma=None, epsilon=0.5 ): """ Read images into rows of a matrix, given a mask - much faster for large datasets as it is based on C++ implementations. ANTsR function: `imagesToMatrix` Arguments --------- image_list : list of ANTsImage types ...
python
def images_to_matrix(image_list, mask=None, sigma=None, epsilon=0.5 ): """ Read images into rows of a matrix, given a mask - much faster for large datasets as it is based on C++ implementations. ANTsR function: `imagesToMatrix` Arguments --------- image_list : list of ANTsImage types ...
['def', 'images_to_matrix', '(', 'image_list', ',', 'mask', '=', 'None', ',', 'sigma', '=', 'None', ',', 'epsilon', '=', '0.5', ')', ':', 'def', 'listfunc', '(', 'x', ')', ':', 'if', 'np', '.', 'sum', '(', 'np', '.', 'array', '(', 'x', '.', 'shape', ')', '-', 'np', '.', 'array', '(', 'mask', '.', 'shape', ')', ')', '!=...
Read images into rows of a matrix, given a mask - much faster for large datasets as it is based on C++ implementations. ANTsR function: `imagesToMatrix` Arguments --------- image_list : list of ANTsImage types images to convert to ndarray mask : ANTsImage (optional) image cont...
['Read', 'images', 'into', 'rows', 'of', 'a', 'matrix', 'given', 'a', 'mask', '-', 'much', 'faster', 'for', 'large', 'datasets', 'as', 'it', 'is', 'based', 'on', 'C', '++', 'implementations', '.']
train
https://github.com/ANTsX/ANTsPy/blob/638020af2cdfc5ff4bdb9809ffe67aa505727a3b/ants/core/ants_image_io.py#L247-L301
8,605
soravux/scoop
examples/image_resize.py
resizeTile
def resizeTile(index, size): """Apply Antialiasing resizing to tile""" resized = tiles[index].resize(size, Image.ANTIALIAS) return sImage(resized.tostring(), resized.size, resized.mode)
python
def resizeTile(index, size): """Apply Antialiasing resizing to tile""" resized = tiles[index].resize(size, Image.ANTIALIAS) return sImage(resized.tostring(), resized.size, resized.mode)
['def', 'resizeTile', '(', 'index', ',', 'size', ')', ':', 'resized', '=', 'tiles', '[', 'index', ']', '.', 'resize', '(', 'size', ',', 'Image', '.', 'ANTIALIAS', ')', 'return', 'sImage', '(', 'resized', '.', 'tostring', '(', ')', ',', 'resized', '.', 'size', ',', 'resized', '.', 'mode', ')']
Apply Antialiasing resizing to tile
['Apply', 'Antialiasing', 'resizing', 'to', 'tile']
train
https://github.com/soravux/scoop/blob/d391dfa62f47e49d48328ee9cf08aa114256fd33/examples/image_resize.py#L61-L64
8,606
hydpy-dev/hydpy
hydpy/models/dam/dam_model.py
update_actualremoterelieve_v1
def update_actualremoterelieve_v1(self): """Constrain the actual relieve discharge to a remote location. Required control parameter: |HighestRemoteDischarge| Required derived parameter: |HighestRemoteSmoothPar| Updated flux sequence: |ActualRemoteRelieve| Basic equation - disco...
python
def update_actualremoterelieve_v1(self): """Constrain the actual relieve discharge to a remote location. Required control parameter: |HighestRemoteDischarge| Required derived parameter: |HighestRemoteSmoothPar| Updated flux sequence: |ActualRemoteRelieve| Basic equation - disco...
['def', 'update_actualremoterelieve_v1', '(', 'self', ')', ':', 'con', '=', 'self', '.', 'parameters', '.', 'control', '.', 'fastaccess', 'der', '=', 'self', '.', 'parameters', '.', 'derived', '.', 'fastaccess', 'flu', '=', 'self', '.', 'sequences', '.', 'fluxes', '.', 'fastaccess', 'd_smooth', '=', 'der', '.', 'highes...
Constrain the actual relieve discharge to a remote location. Required control parameter: |HighestRemoteDischarge| Required derived parameter: |HighestRemoteSmoothPar| Updated flux sequence: |ActualRemoteRelieve| Basic equation - discontinous: :math:`ActualRemoteRelieve = min(...
['Constrain', 'the', 'actual', 'relieve', 'discharge', 'to', 'a', 'remote', 'location', '.']
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/dam/dam_model.py#L1765-L1869
8,607
fprimex/zdesk
zdesk/zdesk_api.py
ZendeskAPI.stream_agents_list
def stream_agents_list(self, department_id=None, **kwargs): "https://developer.zendesk.com/rest_api/docs/chat/apis#get-all-agents-status" api_path = "/stream/agents" api_query = {} if "query" in kwargs.keys(): api_query.update(kwargs["query"]) del kwargs["query"] ...
python
def stream_agents_list(self, department_id=None, **kwargs): "https://developer.zendesk.com/rest_api/docs/chat/apis#get-all-agents-status" api_path = "/stream/agents" api_query = {} if "query" in kwargs.keys(): api_query.update(kwargs["query"]) del kwargs["query"] ...
['def', 'stream_agents_list', '(', 'self', ',', 'department_id', '=', 'None', ',', '*', '*', 'kwargs', ')', ':', 'api_path', '=', '"/stream/agents"', 'api_query', '=', '{', '}', 'if', '"query"', 'in', 'kwargs', '.', 'keys', '(', ')', ':', 'api_query', '.', 'update', '(', 'kwargs', '[', '"query"', ']', ')', 'del', 'kwar...
https://developer.zendesk.com/rest_api/docs/chat/apis#get-all-agents-status
['https', ':', '//', 'developer', '.', 'zendesk', '.', 'com', '/', 'rest_api', '/', 'docs', '/', 'chat', '/', 'apis#get', '-', 'all', '-', 'agents', '-', 'status']
train
https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L3191-L3202
8,608
RedFantom/ttkwidgets
ttkwidgets/timeline.py
TimeLine._time_marker_move
def _time_marker_move(self, event): """Callback for <B1-Motion> Event: Move the selected marker""" limit = self.pixel_width x = self._canvas_ticks.canvasx(event.x) x = min(max(x, 0), limit) _, y = self._canvas_ticks.coords(self._time_marker_image) self._canvas_ticks.coord...
python
def _time_marker_move(self, event): """Callback for <B1-Motion> Event: Move the selected marker""" limit = self.pixel_width x = self._canvas_ticks.canvasx(event.x) x = min(max(x, 0), limit) _, y = self._canvas_ticks.coords(self._time_marker_image) self._canvas_ticks.coord...
['def', '_time_marker_move', '(', 'self', ',', 'event', ')', ':', 'limit', '=', 'self', '.', 'pixel_width', 'x', '=', 'self', '.', '_canvas_ticks', '.', 'canvasx', '(', 'event', '.', 'x', ')', 'x', '=', 'min', '(', 'max', '(', 'x', ',', '0', ')', ',', 'limit', ')', '_', ',', 'y', '=', 'self', '.', '_canvas_ticks', '.',...
Callback for <B1-Motion> Event: Move the selected marker
['Callback', 'for', '<B1', '-', 'Motion', '>', 'Event', ':', 'Move', 'the', 'selected', 'marker']
train
https://github.com/RedFantom/ttkwidgets/blob/02150322060f867b6e59a175522ef84b09168019/ttkwidgets/timeline.py#L649-L657
8,609
bxlab/bx-python
lib/bx/align/maf.py
parse_attributes
def parse_attributes( fields ): """Parse list of key=value strings into a dict""" attributes = {} for field in fields: pair = field.split( '=' ) attributes[ pair[0] ] = pair[1] return attributes
python
def parse_attributes( fields ): """Parse list of key=value strings into a dict""" attributes = {} for field in fields: pair = field.split( '=' ) attributes[ pair[0] ] = pair[1] return attributes
['def', 'parse_attributes', '(', 'fields', ')', ':', 'attributes', '=', '{', '}', 'for', 'field', 'in', 'fields', ':', 'pair', '=', 'field', '.', 'split', '(', "'='", ')', 'attributes', '[', 'pair', '[', '0', ']', ']', '=', 'pair', '[', '1', ']', 'return', 'attributes']
Parse list of key=value strings into a dict
['Parse', 'list', 'of', 'key', '=', 'value', 'strings', 'into', 'a', 'dict']
train
https://github.com/bxlab/bx-python/blob/09cb725284803df90a468d910f2274628d8647de/lib/bx/align/maf.py#L212-L218
8,610
carta/ldap_tools
src/ldap_tools/client.py
Client.get_max_id
def get_max_id(self, object_type, role): """Get the highest used ID.""" if object_type == 'user': objectclass = 'posixAccount' ldap_attr = 'uidNumber' elif object_type == 'group': # pragma: no cover objectclass = 'posixGroup' ldap_attr = 'gidNumbe...
python
def get_max_id(self, object_type, role): """Get the highest used ID.""" if object_type == 'user': objectclass = 'posixAccount' ldap_attr = 'uidNumber' elif object_type == 'group': # pragma: no cover objectclass = 'posixGroup' ldap_attr = 'gidNumbe...
['def', 'get_max_id', '(', 'self', ',', 'object_type', ',', 'role', ')', ':', 'if', 'object_type', '==', "'user'", ':', 'objectclass', '=', "'posixAccount'", 'ldap_attr', '=', "'uidNumber'", 'elif', 'object_type', '==', "'group'", ':', '# pragma: no cover', 'objectclass', '=', "'posixGroup'", 'ldap_attr', '=', "'gidNum...
Get the highest used ID.
['Get', 'the', 'highest', 'used', 'ID', '.']
train
https://github.com/carta/ldap_tools/blob/7c039304a5abaf836c7afc35cf068b4471306264/src/ldap_tools/client.py#L110-L142
8,611
hozn/stravalib
stravalib/client.py
Client.get_activity_comments
def get_activity_comments(self, activity_id, markdown=False, limit=None): """ Gets the comments for an activity. http://strava.github.io/api/v3/comments/#list :param activity_id: The activity for which to fetch comments. :type activity_id: int :param markdown: Whether ...
python
def get_activity_comments(self, activity_id, markdown=False, limit=None): """ Gets the comments for an activity. http://strava.github.io/api/v3/comments/#list :param activity_id: The activity for which to fetch comments. :type activity_id: int :param markdown: Whether ...
['def', 'get_activity_comments', '(', 'self', ',', 'activity_id', ',', 'markdown', '=', 'False', ',', 'limit', '=', 'None', ')', ':', 'result_fetcher', '=', 'functools', '.', 'partial', '(', 'self', '.', 'protocol', '.', 'get', ',', "'/activities/{id}/comments'", ',', 'id', '=', 'activity_id', ',', 'markdown', '=', 'in...
Gets the comments for an activity. http://strava.github.io/api/v3/comments/#list :param activity_id: The activity for which to fetch comments. :type activity_id: int :param markdown: Whether to include markdown in comments (default is false/filterout). :type markdown: bool ...
['Gets', 'the', 'comments', 'for', 'an', 'activity', '.']
train
https://github.com/hozn/stravalib/blob/5500ebc39e0bf4706bb1ca4c27b25e56becaaa5f/stravalib/client.py#L742-L766
8,612
SeabornGames/RequestClient
seaborn/request_client/repr_wrapper.py
ReprListList.append
def append(self, obj): """ If it is a list it will append the obj, if it is a dictionary it will convert it to a list and append :param obj: dict or list of the object to append :return: None """ if isinstance(obj, dict) and self._col_names: obj = [obj...
python
def append(self, obj): """ If it is a list it will append the obj, if it is a dictionary it will convert it to a list and append :param obj: dict or list of the object to append :return: None """ if isinstance(obj, dict) and self._col_names: obj = [obj...
['def', 'append', '(', 'self', ',', 'obj', ')', ':', 'if', 'isinstance', '(', 'obj', ',', 'dict', ')', 'and', 'self', '.', '_col_names', ':', 'obj', '=', '[', 'obj', '.', 'get', '(', 'col', ',', 'None', ')', 'for', 'col', 'in', 'self', '.', '_col_names', ']', 'assert', 'isinstance', '(', 'obj', ',', 'list', ')', ',', '...
If it is a list it will append the obj, if it is a dictionary it will convert it to a list and append :param obj: dict or list of the object to append :return: None
['If', 'it', 'is', 'a', 'list', 'it', 'will', 'append', 'the', 'obj', 'if', 'it', 'is', 'a', 'dictionary', 'it', 'will', 'convert', 'it', 'to', 'a', 'list', 'and', 'append', ':', 'param', 'obj', ':', 'dict', 'or', 'list', 'of', 'the', 'object', 'to', 'append', ':', 'return', ':', 'None']
train
https://github.com/SeabornGames/RequestClient/blob/21aeb951ddfdb6ee453ad0edc896ff224e06425d/seaborn/request_client/repr_wrapper.py#L271-L282
8,613
AntagonistHQ/openprovider.py
openprovider/modules/ssl.py
SSLModule.retrieve_product
def retrieve_product(self, product_id): """Retrieve details on a single product.""" response = self.request(E.retrieveProductSslCertRequest( E.id(product_id) )) return response.as_model(SSLProduct)
python
def retrieve_product(self, product_id): """Retrieve details on a single product.""" response = self.request(E.retrieveProductSslCertRequest( E.id(product_id) )) return response.as_model(SSLProduct)
['def', 'retrieve_product', '(', 'self', ',', 'product_id', ')', ':', 'response', '=', 'self', '.', 'request', '(', 'E', '.', 'retrieveProductSslCertRequest', '(', 'E', '.', 'id', '(', 'product_id', ')', ')', ')', 'return', 'response', '.', 'as_model', '(', 'SSLProduct', ')']
Retrieve details on a single product.
['Retrieve', 'details', 'on', 'a', 'single', 'product', '.']
train
https://github.com/AntagonistHQ/openprovider.py/blob/5871c3d5b3661e23667f147f49f20389c817a0a4/openprovider/modules/ssl.py#L36-L43
8,614
Ingener74/Silly-Crossbow
SillyCrossbow/SillyCrossbow/crop.py
crop_image
def crop_image(image, threshold): """ Найти непрозрачную область на изображении и вырезать её :param image: Изображение :param threshold: Порог прозрачности для обрезания :return: cropped_image - вырезанное изображение x, y, width, height - координаты и размер вырезаннго прямоугольника ...
python
def crop_image(image, threshold): """ Найти непрозрачную область на изображении и вырезать её :param image: Изображение :param threshold: Порог прозрачности для обрезания :return: cropped_image - вырезанное изображение x, y, width, height - координаты и размер вырезаннго прямоугольника ...
['def', 'crop_image', '(', 'image', ',', 'threshold', ')', ':', 'cropper', '=', 'CropTransparent', '(', 'image', '.', 'width', '(', ')', ',', 'image', '.', 'height', '(', ')', ',', 'threshold', ',', 'str', '(', 'image', '.', 'constBits', '(', ')', ')', ')', 'x', '=', 'cropper', '.', 'getCroppedOffsetX', '(', ')', 'y', ...
Найти непрозрачную область на изображении и вырезать её :param image: Изображение :param threshold: Порог прозрачности для обрезания :return: cropped_image - вырезанное изображение x, y, width, height - координаты и размер вырезаннго прямоугольника
['Найти', 'непрозрачную', 'область', 'на', 'изображении', 'и', 'вырезать', 'её', ':', 'param', 'image', ':', 'Изображение', ':', 'param', 'threshold', ':', 'Порог', 'прозрачности', 'для', 'обрезания', ':', 'return', ':', 'cropped_image', '-', 'вырезанное', 'изображение', 'x', 'y', 'width', 'height', '-', 'координаты', ...
train
https://github.com/Ingener74/Silly-Crossbow/blob/ac70265f885ea6bdcea04c737b0f8528be023263/SillyCrossbow/SillyCrossbow/crop.py#L19-L35
8,615
MAVENSDC/PyTplot
pytplot/tplot_restore.py
tplot_restore
def tplot_restore(filename): """ This function will restore tplot variables that have been saved with the "tplot_save" command. .. note:: This function is compatible with the IDL tplot_save routine. If you have a ".tplot" file generated from IDL, this procedure will restore the data c...
python
def tplot_restore(filename): """ This function will restore tplot variables that have been saved with the "tplot_save" command. .. note:: This function is compatible with the IDL tplot_save routine. If you have a ".tplot" file generated from IDL, this procedure will restore the data c...
['def', 'tplot_restore', '(', 'filename', ')', ':', '#Error check', 'if', 'not', '(', 'os', '.', 'path', '.', 'isfile', '(', 'filename', ')', ')', ':', 'print', '(', '"Not a valid file name"', ')', 'return', '#Check if the restored file was an IDL file', 'if', 'filename', '.', 'endswith', '(', "'.tplot'", ')', ':', 'te...
This function will restore tplot variables that have been saved with the "tplot_save" command. .. note:: This function is compatible with the IDL tplot_save routine. If you have a ".tplot" file generated from IDL, this procedure will restore the data contained in the file. Not all plo...
['This', 'function', 'will', 'restore', 'tplot', 'variables', 'that', 'have', 'been', 'saved', 'with', 'the', 'tplot_save', 'command', '.', '..', 'note', '::', 'This', 'function', 'is', 'compatible', 'with', 'the', 'IDL', 'tplot_save', 'routine', '.', 'If', 'you', 'have', 'a', '.', 'tplot', 'file', 'generated', 'from',...
train
https://github.com/MAVENSDC/PyTplot/blob/d76cdb95363a4bd4fea6bca7960f8523efa7fa83/pytplot/tplot_restore.py#L16-L114
8,616
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_serial.py
SerialModule.cmd_serial
def cmd_serial(self, args): '''serial control commands''' usage = "Usage: serial <lock|unlock|set|send>" if len(args) < 1: print(usage) return if args[0] == "lock": self.serial_lock(True) elif args[0] == "unlock": self.serial_lock(F...
python
def cmd_serial(self, args): '''serial control commands''' usage = "Usage: serial <lock|unlock|set|send>" if len(args) < 1: print(usage) return if args[0] == "lock": self.serial_lock(True) elif args[0] == "unlock": self.serial_lock(F...
['def', 'cmd_serial', '(', 'self', ',', 'args', ')', ':', 'usage', '=', '"Usage: serial <lock|unlock|set|send>"', 'if', 'len', '(', 'args', ')', '<', '1', ':', 'print', '(', 'usage', ')', 'return', 'if', 'args', '[', '0', ']', '==', '"lock"', ':', 'self', '.', 'serial_lock', '(', 'True', ')', 'elif', 'args', '[', '0', ...
serial control commands
['serial', 'control', 'commands']
train
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_serial.py#L67-L82
8,617
pantsbuild/pants
src/python/pants/base/build_file.py
BuildFile.scan_build_files
def scan_build_files(project_tree, base_relpath, build_ignore_patterns=None): """Looks for all BUILD files :param project_tree: Project tree to scan in. :type project_tree: :class:`pants.base.project_tree.ProjectTree` :param base_relpath: Directory under root_dir to scan. :param build_ignore_pattern...
python
def scan_build_files(project_tree, base_relpath, build_ignore_patterns=None): """Looks for all BUILD files :param project_tree: Project tree to scan in. :type project_tree: :class:`pants.base.project_tree.ProjectTree` :param base_relpath: Directory under root_dir to scan. :param build_ignore_pattern...
['def', 'scan_build_files', '(', 'project_tree', ',', 'base_relpath', ',', 'build_ignore_patterns', '=', 'None', ')', ':', 'if', 'base_relpath', 'and', 'os', '.', 'path', '.', 'isabs', '(', 'base_relpath', ')', ':', 'raise', 'BuildFile', '.', 'BadPathError', '(', "'base_relpath parameter ({}) should be a relative path....
Looks for all BUILD files :param project_tree: Project tree to scan in. :type project_tree: :class:`pants.base.project_tree.ProjectTree` :param base_relpath: Directory under root_dir to scan. :param build_ignore_patterns: .gitignore like patterns to exclude from BUILD files scan. :type build_ignore_...
['Looks', 'for', 'all', 'BUILD', 'files', ':', 'param', 'project_tree', ':', 'Project', 'tree', 'to', 'scan', 'in', '.', ':', 'type', 'project_tree', ':', ':', 'class', ':', 'pants', '.', 'base', '.', 'project_tree', '.', 'ProjectTree', ':', 'param', 'base_relpath', ':', 'Directory', 'under', 'root_dir', 'to', 'scan', ...
train
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/base/build_file.py#L55-L84
8,618
NiklasRosenstein-Python/nr-deprecated
nr/concurrency.py
Job.get
def get(self, default=None): """ Get the result of the Job, or return *default* if the job is not finished or errored. This function will never explicitly raise an exception. Note that the *default* value is also returned if the job was cancelled. # Arguments default (any): The value to return ...
python
def get(self, default=None): """ Get the result of the Job, or return *default* if the job is not finished or errored. This function will never explicitly raise an exception. Note that the *default* value is also returned if the job was cancelled. # Arguments default (any): The value to return ...
['def', 'get', '(', 'self', ',', 'default', '=', 'None', ')', ':', 'if', 'not', 'self', '.', '__cancelled', 'and', 'self', '.', '__state', '==', 'Job', '.', 'SUCCESS', ':', 'return', 'self', '.', '__result', 'else', ':', 'return', 'default']
Get the result of the Job, or return *default* if the job is not finished or errored. This function will never explicitly raise an exception. Note that the *default* value is also returned if the job was cancelled. # Arguments default (any): The value to return when the result can not be obtained.
['Get', 'the', 'result', 'of', 'the', 'Job', 'or', 'return', '*', 'default', '*', 'if', 'the', 'job', 'is', 'not', 'finished', 'or', 'errored', '.', 'This', 'function', 'will', 'never', 'explicitly', 'raise', 'an', 'exception', '.', 'Note', 'that', 'the', '*', 'default', '*', 'value', 'is', 'also', 'returned', 'if', 't...
train
https://github.com/NiklasRosenstein-Python/nr-deprecated/blob/f9f8b89ea1b084841a8ab65784eaf68852686b2a/nr/concurrency.py#L443-L456
8,619
delfick/aws_syncr
aws_syncr/actions.py
deploy_gateway
def deploy_gateway(collector): """Deploy the apigateway to a particular stage""" configuration = collector.configuration aws_syncr = configuration['aws_syncr'] aws_syncr, amazon, stage, gateway = find_gateway(aws_syncr, configuration) gateway.deploy(aws_syncr, amazon, stage) if not configuratio...
python
def deploy_gateway(collector): """Deploy the apigateway to a particular stage""" configuration = collector.configuration aws_syncr = configuration['aws_syncr'] aws_syncr, amazon, stage, gateway = find_gateway(aws_syncr, configuration) gateway.deploy(aws_syncr, amazon, stage) if not configuratio...
['def', 'deploy_gateway', '(', 'collector', ')', ':', 'configuration', '=', 'collector', '.', 'configuration', 'aws_syncr', '=', 'configuration', '[', "'aws_syncr'", ']', 'aws_syncr', ',', 'amazon', ',', 'stage', ',', 'gateway', '=', 'find_gateway', '(', 'aws_syncr', ',', 'configuration', ')', 'gateway', '.', 'deploy',...
Deploy the apigateway to a particular stage
['Deploy', 'the', 'apigateway', 'to', 'a', 'particular', 'stage']
train
https://github.com/delfick/aws_syncr/blob/8cd214b27c1eee98dfba4632cbb8bc0ae36356bd/aws_syncr/actions.py#L188-L196
8,620
DataBiosphere/toil
src/toil/provisioners/azure/azureProvisioner.py
AzureProvisioner._checkIfClusterExists
def _checkIfClusterExists(self): """ Try deleting the resource group. This will fail if it exists and raise an exception. """ ansibleArgs = { 'resgrp': self.clusterName, 'region': self._zone } try: self.callPlaybook(self.playbook['check...
python
def _checkIfClusterExists(self): """ Try deleting the resource group. This will fail if it exists and raise an exception. """ ansibleArgs = { 'resgrp': self.clusterName, 'region': self._zone } try: self.callPlaybook(self.playbook['check...
['def', '_checkIfClusterExists', '(', 'self', ')', ':', 'ansibleArgs', '=', '{', "'resgrp'", ':', 'self', '.', 'clusterName', ',', "'region'", ':', 'self', '.', '_zone', '}', 'try', ':', 'self', '.', 'callPlaybook', '(', 'self', '.', 'playbook', '[', "'check-cluster'", ']', ',', 'ansibleArgs', ',', 'wait', '=', 'True',...
Try deleting the resource group. This will fail if it exists and raise an exception.
['Try', 'deleting', 'the', 'resource', 'group', '.', 'This', 'will', 'fail', 'if', 'it', 'exists', 'and', 'raise', 'an', 'exception', '.']
train
https://github.com/DataBiosphere/toil/blob/a8252277ff814e7bee0971139c2344f88e44b644/src/toil/provisioners/azure/azureProvisioner.py#L206-L218
8,621
jeremyschulman/halutz
halutz/class_factory.py
SchemaObjectFactory.schema_class
def schema_class(self, object_schema, model_name, classes=False): """ Create a object-class based on the object_schema. Use this class to create specific instances, and validate the data values. See the "python-jsonschema-objects" package for details on further usage. ...
python
def schema_class(self, object_schema, model_name, classes=False): """ Create a object-class based on the object_schema. Use this class to create specific instances, and validate the data values. See the "python-jsonschema-objects" package for details on further usage. ...
['def', 'schema_class', '(', 'self', ',', 'object_schema', ',', 'model_name', ',', 'classes', '=', 'False', ')', ':', '# if not model_name:', '# model_name = SchemaObjectFactory.schema_model_name(object_schema)', 'cls_bldr', '=', 'ClassBuilder', '(', 'self', '.', 'resolver', ')', 'model_cls', '=', 'cls_bldr', '.', ...
Create a object-class based on the object_schema. Use this class to create specific instances, and validate the data values. See the "python-jsonschema-objects" package for details on further usage. Parameters ---------- object_schema : dict The JSON-schema...
['Create', 'a', 'object', '-', 'class', 'based', 'on', 'the', 'object_schema', '.', 'Use', 'this', 'class', 'to', 'create', 'specific', 'instances', 'and', 'validate', 'the', 'data', 'values', '.', 'See', 'the', 'python', '-', 'jsonschema', '-', 'objects', 'package', 'for', 'details', 'on', 'further', 'usage', '.']
train
https://github.com/jeremyschulman/halutz/blob/6bb398dc99bf723daabd9eda02494a11252ee109/halutz/class_factory.py#L45-L90
8,622
contentful/contentful-management.py
contentful_management/resource.py
Resource.base_url
def base_url(klass, space_id='', resource_id=None, environment_id=None, **kwargs): """ Returns the URI for the resource. """ url = "spaces/{0}".format( space_id) if environment_id is not None: url = url = "{0}/environments/{1}".format(url, environment_id...
python
def base_url(klass, space_id='', resource_id=None, environment_id=None, **kwargs): """ Returns the URI for the resource. """ url = "spaces/{0}".format( space_id) if environment_id is not None: url = url = "{0}/environments/{1}".format(url, environment_id...
['def', 'base_url', '(', 'klass', ',', 'space_id', '=', "''", ',', 'resource_id', '=', 'None', ',', 'environment_id', '=', 'None', ',', '*', '*', 'kwargs', ')', ':', 'url', '=', '"spaces/{0}"', '.', 'format', '(', 'space_id', ')', 'if', 'environment_id', 'is', 'not', 'None', ':', 'url', '=', 'url', '=', '"{0}/environme...
Returns the URI for the resource.
['Returns', 'the', 'URI', 'for', 'the', 'resource', '.']
train
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L37-L56
8,623
softlayer/softlayer-python
SoftLayer/managers/vs.py
VSManager.edit
def edit(self, instance_id, userdata=None, hostname=None, domain=None, notes=None, tags=None): """Edit hostname, domain name, notes, and/or the user data of a VS. Parameters set to None will be ignored and not attempted to be updated. :param integer instance_id: the instance ID to...
python
def edit(self, instance_id, userdata=None, hostname=None, domain=None, notes=None, tags=None): """Edit hostname, domain name, notes, and/or the user data of a VS. Parameters set to None will be ignored and not attempted to be updated. :param integer instance_id: the instance ID to...
['def', 'edit', '(', 'self', ',', 'instance_id', ',', 'userdata', '=', 'None', ',', 'hostname', '=', 'None', ',', 'domain', '=', 'None', ',', 'notes', '=', 'None', ',', 'tags', '=', 'None', ')', ':', 'obj', '=', '{', '}', 'if', 'userdata', ':', 'self', '.', 'guest', '.', 'setUserMetadata', '(', '[', 'userdata', ']', ',...
Edit hostname, domain name, notes, and/or the user data of a VS. Parameters set to None will be ignored and not attempted to be updated. :param integer instance_id: the instance ID to edit :param string userdata: user data on VS to edit. If none exist it will be...
['Edit', 'hostname', 'domain', 'name', 'notes', 'and', '/', 'or', 'the', 'user', 'data', 'of', 'a', 'VS', '.']
train
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/vs.py#L694-L735
8,624
materialsproject/pymatgen
pymatgen/apps/borg/queen.py
order_assimilation
def order_assimilation(args): """ Internal helper method for BorgQueen to process assimilation """ (path, drone, data, status) = args newdata = drone.assimilate(path) if newdata: data.append(json.dumps(newdata, cls=MontyEncoder)) status['count'] += 1 count = status['count'] t...
python
def order_assimilation(args): """ Internal helper method for BorgQueen to process assimilation """ (path, drone, data, status) = args newdata = drone.assimilate(path) if newdata: data.append(json.dumps(newdata, cls=MontyEncoder)) status['count'] += 1 count = status['count'] t...
['def', 'order_assimilation', '(', 'args', ')', ':', '(', 'path', ',', 'drone', ',', 'data', ',', 'status', ')', '=', 'args', 'newdata', '=', 'drone', '.', 'assimilate', '(', 'path', ')', 'if', 'newdata', ':', 'data', '.', 'append', '(', 'json', '.', 'dumps', '(', 'newdata', ',', 'cls', '=', 'MontyEncoder', ')', ')', '...
Internal helper method for BorgQueen to process assimilation
['Internal', 'helper', 'method', 'for', 'BorgQueen', 'to', 'process', 'assimilation']
train
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/apps/borg/queen.py#L131-L143
8,625
osilkin98/PyBRY
generator.py
get_lbry_api_function_docs
def get_lbry_api_function_docs(url=LBRY_API_RAW_JSON_URL): """ Scrapes the given URL to a page in JSON format to obtain the documentation for the LBRY API :param str url: URL to the documentation we need to obtain, pybry.constants.LBRY_API_RAW_JSON_URL by default :return: List of functions retrieved f...
python
def get_lbry_api_function_docs(url=LBRY_API_RAW_JSON_URL): """ Scrapes the given URL to a page in JSON format to obtain the documentation for the LBRY API :param str url: URL to the documentation we need to obtain, pybry.constants.LBRY_API_RAW_JSON_URL by default :return: List of functions retrieved f...
['def', 'get_lbry_api_function_docs', '(', 'url', '=', 'LBRY_API_RAW_JSON_URL', ')', ':', 'try', ':', '# Grab the page content', 'docs_page', '=', 'urlopen', '(', 'url', ')', '# Read the contents of the actual url we grabbed and decode them into UTF-8', 'contents', '=', 'docs_page', '.', 'read', '(', ')', '.', 'decode'...
Scrapes the given URL to a page in JSON format to obtain the documentation for the LBRY API :param str url: URL to the documentation we need to obtain, pybry.constants.LBRY_API_RAW_JSON_URL by default :return: List of functions retrieved from the `url` given :rtype: list
['Scrapes', 'the', 'given', 'URL', 'to', 'a', 'page', 'in', 'JSON', 'format', 'to', 'obtain', 'the', 'documentation', 'for', 'the', 'LBRY', 'API']
train
https://github.com/osilkin98/PyBRY/blob/af86805a8077916f72f3fe980943d4cd741e61f0/generator.py#L10-L36
8,626
JoelBender/bacpypes
py25/bacpypes/bsllservice.py
ProxyServiceNetworkAdapter.process_npdu
def process_npdu(self, npdu): """encode NPDUs from the network service access point and send them to the proxy.""" if _debug: ProxyServiceNetworkAdapter._debug("process_npdu %r", npdu) # encode the npdu as if it was about to be delivered to the network pdu = PDU() npdu.encode(pd...
python
def process_npdu(self, npdu): """encode NPDUs from the network service access point and send them to the proxy.""" if _debug: ProxyServiceNetworkAdapter._debug("process_npdu %r", npdu) # encode the npdu as if it was about to be delivered to the network pdu = PDU() npdu.encode(pd...
['def', 'process_npdu', '(', 'self', ',', 'npdu', ')', ':', 'if', '_debug', ':', 'ProxyServiceNetworkAdapter', '.', '_debug', '(', '"process_npdu %r"', ',', 'npdu', ')', '# encode the npdu as if it was about to be delivered to the network', 'pdu', '=', 'PDU', '(', ')', 'npdu', '.', 'encode', '(', 'pdu', ')', 'if', '_de...
encode NPDUs from the network service access point and send them to the proxy.
['encode', 'NPDUs', 'from', 'the', 'network', 'service', 'access', 'point', 'and', 'send', 'them', 'to', 'the', 'proxy', '.']
train
https://github.com/JoelBender/bacpypes/blob/4111b8604a16fa2b7f80d8104a43b9f3e28dfc78/py25/bacpypes/bsllservice.py#L1129-L1148
8,627
tensorflow/tensor2tensor
tensor2tensor/layers/common_attention.py
gather_blocks_2d
def gather_blocks_2d(x, indices): """Gathers flattened blocks from x.""" x_shape = common_layers.shape_list(x) x = reshape_range(x, 2, 4, [tf.reduce_prod(x_shape[2:4])]) # [length, batch, heads, dim] x_t = tf.transpose(x, [2, 0, 1, 3]) x_new = tf.gather(x_t, indices) # returns [batch, heads, num_blocks, b...
python
def gather_blocks_2d(x, indices): """Gathers flattened blocks from x.""" x_shape = common_layers.shape_list(x) x = reshape_range(x, 2, 4, [tf.reduce_prod(x_shape[2:4])]) # [length, batch, heads, dim] x_t = tf.transpose(x, [2, 0, 1, 3]) x_new = tf.gather(x_t, indices) # returns [batch, heads, num_blocks, b...
['def', 'gather_blocks_2d', '(', 'x', ',', 'indices', ')', ':', 'x_shape', '=', 'common_layers', '.', 'shape_list', '(', 'x', ')', 'x', '=', 'reshape_range', '(', 'x', ',', '2', ',', '4', ',', '[', 'tf', '.', 'reduce_prod', '(', 'x_shape', '[', '2', ':', '4', ']', ')', ']', ')', '# [length, batch, heads, dim]', 'x_t', ...
Gathers flattened blocks from x.
['Gathers', 'flattened', 'blocks', 'from', 'x', '.']
train
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_attention.py#L3561-L3569
8,628
biosustain/optlang
optlang/interface.py
Model.remove
def remove(self, stuff): """Remove variables and constraints. Parameters ---------- stuff : iterable, str, Variable, Constraint Either an iterable containing variables and constraints to be removed from the model or a single variable or contstraint (or their names). ...
python
def remove(self, stuff): """Remove variables and constraints. Parameters ---------- stuff : iterable, str, Variable, Constraint Either an iterable containing variables and constraints to be removed from the model or a single variable or contstraint (or their names). ...
['def', 'remove', '(', 'self', ',', 'stuff', ')', ':', 'if', 'self', '.', '_pending_modifications', '.', 'toggle', '==', "'add'", ':', 'self', '.', 'update', '(', ')', 'self', '.', '_pending_modifications', '.', 'toggle', '=', "'remove'", 'if', 'isinstance', '(', 'stuff', ',', 'str', ')', ':', 'try', ':', 'variable', '...
Remove variables and constraints. Parameters ---------- stuff : iterable, str, Variable, Constraint Either an iterable containing variables and constraints to be removed from the model or a single variable or contstraint (or their names). Returns ------- Non...
['Remove', 'variables', 'and', 'constraints', '.']
train
https://github.com/biosustain/optlang/blob/13673ac26f6b3ba37a2ef392489722c52e3c5ff1/optlang/interface.py#L1377-L1415
8,629
google/openhtf
openhtf/plugs/usb/filesync_service.py
AbstractFilesyncTransport.read_until_done
def read_until_done(self, command, timeout=None): """Yield messages read until we receive a 'DONE' command. Read messages of the given command until we receive a 'DONE' command. If a command different than the requested one is received, an AdbProtocolError is raised. Args: command: The comm...
python
def read_until_done(self, command, timeout=None): """Yield messages read until we receive a 'DONE' command. Read messages of the given command until we receive a 'DONE' command. If a command different than the requested one is received, an AdbProtocolError is raised. Args: command: The comm...
['def', 'read_until_done', '(', 'self', ',', 'command', ',', 'timeout', '=', 'None', ')', ':', 'message', '=', 'self', '.', 'read_message', '(', 'timeout', ')', 'while', 'message', '.', 'command', '!=', "'DONE'", ':', 'message', '.', 'assert_command_is', '(', 'command', ')', 'yield', 'message', 'message', '=', 'self', ...
Yield messages read until we receive a 'DONE' command. Read messages of the given command until we receive a 'DONE' command. If a command different than the requested one is received, an AdbProtocolError is raised. Args: command: The command to expect, like 'DENT' or 'DATA'. timeout: The ...
['Yield', 'messages', 'read', 'until', 'we', 'receive', 'a', 'DONE', 'command', '.']
train
https://github.com/google/openhtf/blob/655e85df7134db7bdf8f8fdd6ff9a6bf932e7b09/openhtf/plugs/usb/filesync_service.py#L391-L413
8,630
deepmind/sonnet
sonnet/python/ops/initializers.py
_Restore._partition_spec
def _partition_spec(self, shape, partition_info): """Build magic (and sparsely documented) shapes_and_slices spec string.""" if partition_info is None: return '' # Empty string indicates a non-partitioned tensor. ssi = tf.Variable.SaveSliceInfo( full_name=self._var_name, full_shape=pa...
python
def _partition_spec(self, shape, partition_info): """Build magic (and sparsely documented) shapes_and_slices spec string.""" if partition_info is None: return '' # Empty string indicates a non-partitioned tensor. ssi = tf.Variable.SaveSliceInfo( full_name=self._var_name, full_shape=pa...
['def', '_partition_spec', '(', 'self', ',', 'shape', ',', 'partition_info', ')', ':', 'if', 'partition_info', 'is', 'None', ':', 'return', "''", '# Empty string indicates a non-partitioned tensor.', 'ssi', '=', 'tf', '.', 'Variable', '.', 'SaveSliceInfo', '(', 'full_name', '=', 'self', '.', '_var_name', ',', 'full_sha...
Build magic (and sparsely documented) shapes_and_slices spec string.
['Build', 'magic', '(', 'and', 'sparsely', 'documented', ')', 'shapes_and_slices', 'spec', 'string', '.']
train
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/ops/initializers.py#L58-L67
8,631
gambogi/CSHLDAP
CSHLDAP.py
CSHLDAP.search
def search( self, base=False, trim=False, objects=False, **kwargs ): """ Returns matching entries for search in ldap structured as [(dn, {attributes})] UNLESS searching by dn, in which case the first match is returned """ scope = pyldap.SCOPE_SUBTREE i...
python
def search( self, base=False, trim=False, objects=False, **kwargs ): """ Returns matching entries for search in ldap structured as [(dn, {attributes})] UNLESS searching by dn, in which case the first match is returned """ scope = pyldap.SCOPE_SUBTREE i...
['def', 'search', '(', 'self', ',', 'base', '=', 'False', ',', 'trim', '=', 'False', ',', 'objects', '=', 'False', ',', '*', '*', 'kwargs', ')', ':', 'scope', '=', 'pyldap', '.', 'SCOPE_SUBTREE', 'if', 'not', 'base', ':', 'base', '=', 'self', '.', 'users', 'filterstr', '=', "''", 'for', 'key', ',', 'value', 'in', 'kwar...
Returns matching entries for search in ldap structured as [(dn, {attributes})] UNLESS searching by dn, in which case the first match is returned
['Returns', 'matching', 'entries', 'for', 'search', 'in', 'ldap', 'structured', 'as', '[', '(', 'dn', '{', 'attributes', '}', ')', ']', 'UNLESS', 'searching', 'by', 'dn', 'in', 'which', 'case', 'the', 'first', 'match', 'is', 'returned']
train
https://github.com/gambogi/CSHLDAP/blob/09cb754b1e72437834e0d8cb4c7ac1830cfa6829/CSHLDAP.py#L112-L145
8,632
Crunch-io/crunch-cube
src/cr/cube/cube_slice.py
CubeSlice.min_base_size_mask
def min_base_size_mask(self, size, hs_dims=None, prune=False): """Returns MinBaseSizeMask object with correct row, col and table masks. The returned object stores the necessary information about the base size, as well as about the base values. It can create corresponding masks in teh row, ...
python
def min_base_size_mask(self, size, hs_dims=None, prune=False): """Returns MinBaseSizeMask object with correct row, col and table masks. The returned object stores the necessary information about the base size, as well as about the base values. It can create corresponding masks in teh row, ...
['def', 'min_base_size_mask', '(', 'self', ',', 'size', ',', 'hs_dims', '=', 'None', ',', 'prune', '=', 'False', ')', ':', 'return', 'MinBaseSizeMask', '(', 'self', ',', 'size', ',', 'hs_dims', '=', 'hs_dims', ',', 'prune', '=', 'prune', ')']
Returns MinBaseSizeMask object with correct row, col and table masks. The returned object stores the necessary information about the base size, as well as about the base values. It can create corresponding masks in teh row, column, and table directions, based on the corresponding base values ...
['Returns', 'MinBaseSizeMask', 'object', 'with', 'correct', 'row', 'col', 'and', 'table', 'masks', '.']
train
https://github.com/Crunch-io/crunch-cube/blob/a837840755690eb14b2ec8e8d93b4104e01c854f/src/cr/cube/cube_slice.py#L348-L362
8,633
CodyKochmann/time_limit
commit-update.py
sync_readmes
def sync_readmes(): """ just copies README.md into README for pypi documentation """ print("syncing README") with open("README.md", 'r') as reader: file_text = reader.read() with open("README", 'w') as writer: writer.write(file_text)
python
def sync_readmes(): """ just copies README.md into README for pypi documentation """ print("syncing README") with open("README.md", 'r') as reader: file_text = reader.read() with open("README", 'w') as writer: writer.write(file_text)
['def', 'sync_readmes', '(', ')', ':', 'print', '(', '"syncing README"', ')', 'with', 'open', '(', '"README.md"', ',', "'r'", ')', 'as', 'reader', ':', 'file_text', '=', 'reader', '.', 'read', '(', ')', 'with', 'open', '(', '"README"', ',', "'w'", ')', 'as', 'writer', ':', 'writer', '.', 'write', '(', 'file_text', ')']
just copies README.md into README for pypi documentation
['just', 'copies', 'README', '.', 'md', 'into', 'README', 'for', 'pypi', 'documentation']
train
https://github.com/CodyKochmann/time_limit/blob/447a640d3e187bb4775d780b757c6d9bdc88ae34/commit-update.py#L50-L56
8,634
BD2KGenomics/protect
src/protect/mutation_calling/common.py
merge_perchrom_mutations
def merge_perchrom_mutations(job, chrom, mutations, univ_options): """ Merge the mutation calls for a single chromosome. :param str chrom: Chromosome to process :param dict mutations: dict of dicts of the various mutation caller names as keys, and a dict of per chromosome job store ids for v...
python
def merge_perchrom_mutations(job, chrom, mutations, univ_options): """ Merge the mutation calls for a single chromosome. :param str chrom: Chromosome to process :param dict mutations: dict of dicts of the various mutation caller names as keys, and a dict of per chromosome job store ids for v...
['def', 'merge_perchrom_mutations', '(', 'job', ',', 'chrom', ',', 'mutations', ',', 'univ_options', ')', ':', 'work_dir', '=', 'os', '.', 'getcwd', '(', ')', 'from', 'protect', '.', 'mutation_calling', '.', 'muse', 'import', 'process_muse_vcf', 'from', 'protect', '.', 'mutation_calling', '.', 'mutect', 'import', 'proc...
Merge the mutation calls for a single chromosome. :param str chrom: Chromosome to process :param dict mutations: dict of dicts of the various mutation caller names as keys, and a dict of per chromosome job store ids for vcfs as value :param dict univ_options: Dict of universal options used by al...
['Merge', 'the', 'mutation', 'calls', 'for', 'a', 'single', 'chromosome', '.']
train
https://github.com/BD2KGenomics/protect/blob/06310682c50dcf8917b912c8e551299ff7ee41ce/src/protect/mutation_calling/common.py#L74-L143
8,635
sharibarboza/py_zap
py_zap/utils.py
convert_month
def convert_month(date, shorten=True, cable=True): """Replace month by shortening or lengthening it. :param shorten: Set to True to shorten month name. :param cable: Set to True if category is Cable. """ month = date.split()[0].lower() if 'sept' in month: shorten = False if cable else T...
python
def convert_month(date, shorten=True, cable=True): """Replace month by shortening or lengthening it. :param shorten: Set to True to shorten month name. :param cable: Set to True if category is Cable. """ month = date.split()[0].lower() if 'sept' in month: shorten = False if cable else T...
['def', 'convert_month', '(', 'date', ',', 'shorten', '=', 'True', ',', 'cable', '=', 'True', ')', ':', 'month', '=', 'date', '.', 'split', '(', ')', '[', '0', ']', '.', 'lower', '(', ')', 'if', "'sept'", 'in', 'month', ':', 'shorten', '=', 'False', 'if', 'cable', 'else', 'True', 'try', ':', 'if', 'shorten', ':', 'mont...
Replace month by shortening or lengthening it. :param shorten: Set to True to shorten month name. :param cable: Set to True if category is Cable.
['Replace', 'month', 'by', 'shortening', 'or', 'lengthening', 'it', '.']
train
https://github.com/sharibarboza/py_zap/blob/ce90853efcad66d3e28b8f1ac910f275349d016c/py_zap/utils.py#L71-L89
8,636
mfcloud/python-zvm-sdk
smtLayer/powerVM.py
softDeactivate
def softDeactivate(rh): """ Deactivate a virtual machine by first shutting down Linux and then log it off. Input: Request Handle with the following properties: function - 'POWERVM' subfunction - 'SOFTOFF' userid - userid of the virtual machine parm...
python
def softDeactivate(rh): """ Deactivate a virtual machine by first shutting down Linux and then log it off. Input: Request Handle with the following properties: function - 'POWERVM' subfunction - 'SOFTOFF' userid - userid of the virtual machine parm...
['def', 'softDeactivate', '(', 'rh', ')', ':', 'rh', '.', 'printSysLog', '(', '"Enter powerVM.softDeactivate, userid: "', '+', 'rh', '.', 'userid', ')', 'strCmd', '=', '"echo \'ping\'"', 'iucvResults', '=', 'execCmdThruIUCV', '(', 'rh', ',', 'rh', '.', 'userid', ',', 'strCmd', ')', 'if', 'iucvResults', '[', "'overallRC...
Deactivate a virtual machine by first shutting down Linux and then log it off. Input: Request Handle with the following properties: function - 'POWERVM' subfunction - 'SOFTOFF' userid - userid of the virtual machine parms['maxQueries'] - Maximum number...
['Deactivate', 'a', 'virtual', 'machine', 'by', 'first', 'shutting', 'down', 'Linux', 'and', 'then', 'log', 'it', 'off', '.']
train
https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/powerVM.py#L743-L820
8,637
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/metadata_watcher.py
MetadataWatcher._GetMetadataRequest
def _GetMetadataRequest(self, metadata_url, params=None, timeout=None): """Performs a GET request with the metadata headers. Args: metadata_url: string, the URL to perform a GET request on. params: dictionary, the query parameters in the GET request. timeout: int, timeout in seconds for metad...
python
def _GetMetadataRequest(self, metadata_url, params=None, timeout=None): """Performs a GET request with the metadata headers. Args: metadata_url: string, the URL to perform a GET request on. params: dictionary, the query parameters in the GET request. timeout: int, timeout in seconds for metad...
['def', '_GetMetadataRequest', '(', 'self', ',', 'metadata_url', ',', 'params', '=', 'None', ',', 'timeout', '=', 'None', ')', ':', 'headers', '=', '{', "'Metadata-Flavor'", ':', "'Google'", '}', 'params', '=', 'urlparse', '.', 'urlencode', '(', 'params', 'or', '{', '}', ')', 'url', '=', "'%s?%s'", '%', '(', 'metadata_...
Performs a GET request with the metadata headers. Args: metadata_url: string, the URL to perform a GET request on. params: dictionary, the query parameters in the GET request. timeout: int, timeout in seconds for metadata requests. Returns: HTTP response from the GET request. Rais...
['Performs', 'a', 'GET', 'request', 'with', 'the', 'metadata', 'headers', '.']
train
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/metadata_watcher.py#L82-L102
8,638
avalente/appmetrics
appmetrics/metrics.py
new_histogram_with_implicit_reservoir
def new_histogram_with_implicit_reservoir(name, reservoir_type='uniform', *reservoir_args, **reservoir_kwargs): """ Build a new histogram metric and a reservoir from the given parameters """ reservoir = new_reservoir(reservoir_type, *reservoir_args, **reservoir_kwargs) return new_histogram(name, re...
python
def new_histogram_with_implicit_reservoir(name, reservoir_type='uniform', *reservoir_args, **reservoir_kwargs): """ Build a new histogram metric and a reservoir from the given parameters """ reservoir = new_reservoir(reservoir_type, *reservoir_args, **reservoir_kwargs) return new_histogram(name, re...
['def', 'new_histogram_with_implicit_reservoir', '(', 'name', ',', 'reservoir_type', '=', "'uniform'", ',', '*', 'reservoir_args', ',', '*', '*', 'reservoir_kwargs', ')', ':', 'reservoir', '=', 'new_reservoir', '(', 'reservoir_type', ',', '*', 'reservoir_args', ',', '*', '*', 'reservoir_kwargs', ')', 'return', 'new_his...
Build a new histogram metric and a reservoir from the given parameters
['Build', 'a', 'new', 'histogram', 'metric', 'and', 'a', 'reservoir', 'from', 'the', 'given', 'parameters']
train
https://github.com/avalente/appmetrics/blob/366fc7e1ca897e49a2227cbfa43bfa02a47f1acc/appmetrics/metrics.py#L142-L148
8,639
artefactual-labs/agentarchives
agentarchives/archivists_toolkit/client.py
ArchivistsToolkitClient.get_resource_component_and_children
def get_resource_component_and_children( self, resource_id, resource_type="collection", level=1, sort_data={}, **kwargs ): """ Fetch detailed metadata for the specified resource_id and all of its children. :param long resource_id: The resource for which to fetch metadata. :p...
python
def get_resource_component_and_children( self, resource_id, resource_type="collection", level=1, sort_data={}, **kwargs ): """ Fetch detailed metadata for the specified resource_id and all of its children. :param long resource_id: The resource for which to fetch metadata. :p...
['def', 'get_resource_component_and_children', '(', 'self', ',', 'resource_id', ',', 'resource_type', '=', '"collection"', ',', 'level', '=', '1', ',', 'sort_data', '=', '{', '}', ',', '*', '*', 'kwargs', ')', ':', '# we pass the sort position as a dict so it passes by reference and we', '# can use it to share state du...
Fetch detailed metadata for the specified resource_id and all of its children. :param long resource_id: The resource for which to fetch metadata. :param string resource_type: The level of description of the record. :param int recurse_max_level: The maximum depth level to fetch when fetching chi...
['Fetch', 'detailed', 'metadata', 'for', 'the', 'specified', 'resource_id', 'and', 'all', 'of', 'its', 'children', '.']
train
https://github.com/artefactual-labs/agentarchives/blob/af19ade56a90c64069cf46b50972fe72b6f10a45/agentarchives/archivists_toolkit/client.py#L159-L332
8,640
OCHA-DAP/hdx-python-country
src/hdx/location/country.py
Country.expand_countryname_abbrevs
def expand_countryname_abbrevs(cls, country): # type: (str) -> List[str] """Expands abbreviation(s) in country name in various ways (eg. FED -> FEDERATED, FEDERAL etc.) Args: country (str): Country with abbreviation(s)to expand Returns: List[str]: Uppercase coun...
python
def expand_countryname_abbrevs(cls, country): # type: (str) -> List[str] """Expands abbreviation(s) in country name in various ways (eg. FED -> FEDERATED, FEDERAL etc.) Args: country (str): Country with abbreviation(s)to expand Returns: List[str]: Uppercase coun...
['def', 'expand_countryname_abbrevs', '(', 'cls', ',', 'country', ')', ':', '# type: (str) -> List[str]', 'def', 'replace_ensure_space', '(', 'word', ',', 'replace', ',', 'replacement', ')', ':', 'return', 'word', '.', 'replace', '(', 'replace', ',', "'%s '", '%', 'replacement', ')', '.', 'replace', '(', "' '", ',', "...
Expands abbreviation(s) in country name in various ways (eg. FED -> FEDERATED, FEDERAL etc.) Args: country (str): Country with abbreviation(s)to expand Returns: List[str]: Uppercase country name with abbreviation(s) expanded in various ways
['Expands', 'abbreviation', '(', 's', ')', 'in', 'country', 'name', 'in', 'various', 'ways', '(', 'eg', '.', 'FED', '-', '>', 'FEDERATED', 'FEDERAL', 'etc', '.', ')']
train
https://github.com/OCHA-DAP/hdx-python-country/blob/e86a0b5f182a5d010c4cd7faa36a213cfbcc01f6/src/hdx/location/country.py#L386-L406
8,641
python-gitlab/python-gitlab
gitlab/v4/objects.py
Project.languages
def languages(self, **kwargs): """Get languages used in the project with percentage value. Args: **kwargs: Extra options to send to the server (e.g. sudo) Raises: GitlabAuthenticationError: If authentication is not correct GitlabGetError: If the server faile...
python
def languages(self, **kwargs): """Get languages used in the project with percentage value. Args: **kwargs: Extra options to send to the server (e.g. sudo) Raises: GitlabAuthenticationError: If authentication is not correct GitlabGetError: If the server faile...
['def', 'languages', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'path', '=', "'/projects/%s/languages'", '%', 'self', '.', 'get_id', '(', ')', 'return', 'self', '.', 'manager', '.', 'gitlab', '.', 'http_get', '(', 'path', ',', '*', '*', 'kwargs', ')']
Get languages used in the project with percentage value. Args: **kwargs: Extra options to send to the server (e.g. sudo) Raises: GitlabAuthenticationError: If authentication is not correct GitlabGetError: If the server failed to perform the request
['Get', 'languages', 'used', 'in', 'the', 'project', 'with', 'percentage', 'value', '.']
train
https://github.com/python-gitlab/python-gitlab/blob/16de1b03fde3dbbe8f851614dd1d8c09de102fe5/gitlab/v4/objects.py#L3503-L3514
8,642
PierreRust/apigpio
apigpio/apigpio.py
Pi.script_status
def script_status(self, script_id): """ Returns the run status of a stored script as well as the current values of parameters 0 to 9. script_id:= id of stored script. The run status may be . . PI_SCRIPT_INITING PI_SCRIPT_HALTED PI_SCRIPT_RUNNING...
python
def script_status(self, script_id): """ Returns the run status of a stored script as well as the current values of parameters 0 to 9. script_id:= id of stored script. The run status may be . . PI_SCRIPT_INITING PI_SCRIPT_HALTED PI_SCRIPT_RUNNING...
['def', 'script_status', '(', 'self', ',', 'script_id', ')', ':', 'res', '=', 'yield', 'from', 'self', '.', '_pigpio_aio_command', '(', '_PI_CMD_PROCP', ',', 'script_id', ',', '0', ')', 'bytes', '=', 'u2i', '(', 'res', ')', 'if', 'bytes', '>', '0', ':', '# Fixme : this sould be the same a _rxbuf', '# data = self._rxbuf...
Returns the run status of a stored script as well as the current values of parameters 0 to 9. script_id:= id of stored script. The run status may be . . PI_SCRIPT_INITING PI_SCRIPT_HALTED PI_SCRIPT_RUNNING PI_SCRIPT_WAITING PI_SCRIPT_FAILED ...
['Returns', 'the', 'run', 'status', 'of', 'a', 'stored', 'script', 'as', 'well', 'as', 'the', 'current', 'values', 'of', 'parameters', '0', 'to', '9', '.']
train
https://github.com/PierreRust/apigpio/blob/2b969f40e06219b43a43498d8baf87f5935ceab2/apigpio/apigpio.py#L659-L702
8,643
IntegralDefense/cbinterface
cbinterface/modules/response.py
hyperLiveResponse.dump_sensor_memory
def dump_sensor_memory(self, cb_compress=False, custom_compress=False, custom_compress_file=None, auto_collect_result=False): """Customized function for dumping sensor memory. :arguments cb_compress: If True, use CarbonBlack's built-in compression. :arguments custom_compress_file: Supply path t...
python
def dump_sensor_memory(self, cb_compress=False, custom_compress=False, custom_compress_file=None, auto_collect_result=False): """Customized function for dumping sensor memory. :arguments cb_compress: If True, use CarbonBlack's built-in compression. :arguments custom_compress_file: Supply path t...
['def', 'dump_sensor_memory', '(', 'self', ',', 'cb_compress', '=', 'False', ',', 'custom_compress', '=', 'False', ',', 'custom_compress_file', '=', 'None', ',', 'auto_collect_result', '=', 'False', ')', ':', 'print', '(', '"~ dumping contents of memory on {}"', '.', 'format', '(', 'self', '.', 'sensor', '.', 'computer...
Customized function for dumping sensor memory. :arguments cb_compress: If True, use CarbonBlack's built-in compression. :arguments custom_compress_file: Supply path to lr_tools/compress_file.bat to fork powershell compression :collect_mem_file: If True, wait for memdump + and compression to com...
['Customized', 'function', 'for', 'dumping', 'sensor', 'memory', '.']
train
https://github.com/IntegralDefense/cbinterface/blob/30af06b56d723443b6fcf156756a2a20d395dd7f/cbinterface/modules/response.py#L187-L249
8,644
etingof/pysnmp
pysnmp/smi/instrum.py
MibInstrumController.readNextMibObjects
def readNextMibObjects(self, *varBinds, **context): """Read Managed Objects Instances next to the given ones. Given one or more py:class:`~pysnmp.smi.rfc1902.ObjectType` objects, read all or none of the Managed Objects Instances next to the referenced ones. Parameters ---------...
python
def readNextMibObjects(self, *varBinds, **context): """Read Managed Objects Instances next to the given ones. Given one or more py:class:`~pysnmp.smi.rfc1902.ObjectType` objects, read all or none of the Managed Objects Instances next to the referenced ones. Parameters ---------...
['def', 'readNextMibObjects', '(', 'self', ',', '*', 'varBinds', ',', '*', '*', 'context', ')', ':', 'if', "'cbFun'", 'not', 'in', 'context', ':', 'context', '[', "'cbFun'", ']', '=', 'self', '.', '_defaultErrorHandler', 'self', '.', 'flipFlopFsm', '(', 'self', '.', 'FSM_READ_NEXT_VAR', ',', '*', 'varBinds', ',', '*', ...
Read Managed Objects Instances next to the given ones. Given one or more py:class:`~pysnmp.smi.rfc1902.ObjectType` objects, read all or none of the Managed Objects Instances next to the referenced ones. Parameters ---------- varBinds: :py:class:`tuple` of :py:class:`~pysnmp.smi...
['Read', 'Managed', 'Objects', 'Instances', 'next', 'to', 'the', 'given', 'ones', '.']
train
https://github.com/etingof/pysnmp/blob/cde062dd42f67dfd2d7686286a322d40e9c3a4b7/pysnmp/smi/instrum.py#L437-L495
8,645
pycontribs/pyrax
pyrax/http.py
http_log_resp
def http_log_resp(resp, body): """ When pyrax.get_http_debug() is True, outputs the response received from the API request. """ if not pyrax.get_http_debug(): return log = logging.getLogger("pyrax") log.debug("RESP: %s\n%s", resp, resp.headers) if body: log.debug("RESP BO...
python
def http_log_resp(resp, body): """ When pyrax.get_http_debug() is True, outputs the response received from the API request. """ if not pyrax.get_http_debug(): return log = logging.getLogger("pyrax") log.debug("RESP: %s\n%s", resp, resp.headers) if body: log.debug("RESP BO...
['def', 'http_log_resp', '(', 'resp', ',', 'body', ')', ':', 'if', 'not', 'pyrax', '.', 'get_http_debug', '(', ')', ':', 'return', 'log', '=', 'logging', '.', 'getLogger', '(', '"pyrax"', ')', 'log', '.', 'debug', '(', '"RESP: %s\\n%s"', ',', 'resp', ',', 'resp', '.', 'headers', ')', 'if', 'body', ':', 'log', '.', 'deb...
When pyrax.get_http_debug() is True, outputs the response received from the API request.
['When', 'pyrax', '.', 'get_http_debug', '()', 'is', 'True', 'outputs', 'the', 'response', 'received', 'from', 'the', 'API', 'request', '.']
train
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/http.py#L103-L113
8,646
python-diamond/Diamond
src/diamond/handler/graphitepickle.py
GraphitePickleHandler.get_default_config
def get_default_config(self): """ Return the default config for the handler """ config = super(GraphitePickleHandler, self).get_default_config() config.update({ 'port': 2004, }) return config
python
def get_default_config(self): """ Return the default config for the handler """ config = super(GraphitePickleHandler, self).get_default_config() config.update({ 'port': 2004, }) return config
['def', 'get_default_config', '(', 'self', ')', ':', 'config', '=', 'super', '(', 'GraphitePickleHandler', ',', 'self', ')', '.', 'get_default_config', '(', ')', 'config', '.', 'update', '(', '{', "'port'", ':', '2004', ',', '}', ')', 'return', 'config']
Return the default config for the handler
['Return', 'the', 'default', 'config', 'for', 'the', 'handler']
train
https://github.com/python-diamond/Diamond/blob/0f3eb04327d6d3ed5e53a9967d6c9d2c09714a47/src/diamond/handler/graphitepickle.py#L57-L67
8,647
datastax/python-driver
cassandra/cluster.py
ResultSet.one
def one(self): """ Return a single row of the results or None if empty. This is basically a shortcut to `result_set.current_rows[0]` and should only be used when you know a query returns a single row. Consider using an iterator if the ResultSet contains more than one row. ...
python
def one(self): """ Return a single row of the results or None if empty. This is basically a shortcut to `result_set.current_rows[0]` and should only be used when you know a query returns a single row. Consider using an iterator if the ResultSet contains more than one row. ...
['def', 'one', '(', 'self', ')', ':', 'row', '=', 'None', 'if', 'self', '.', '_current_rows', ':', 'try', ':', 'row', '=', 'self', '.', '_current_rows', '[', '0', ']', 'except', 'TypeError', ':', '# generator object is not subscriptable, PYTHON-1026', 'row', '=', 'next', '(', 'iter', '(', 'self', '.', '_current_rows', ...
Return a single row of the results or None if empty. This is basically a shortcut to `result_set.current_rows[0]` and should only be used when you know a query returns a single row. Consider using an iterator if the ResultSet contains more than one row.
['Return', 'a', 'single', 'row', 'of', 'the', 'results', 'or', 'None', 'if', 'empty', '.', 'This', 'is', 'basically', 'a', 'shortcut', 'to', 'result_set', '.', 'current_rows', '[', '0', ']', 'and', 'should', 'only', 'be', 'used', 'when', 'you', 'know', 'a', 'query', 'returns', 'a', 'single', 'row', '.', 'Consider', 'us...
train
https://github.com/datastax/python-driver/blob/30a80d0b798b1f45f8cb77163b1fa791f3e3ca29/cassandra/cluster.py#L4386-L4400
8,648
drj11/pypng
code/mkiccp.py
black
def black(m): """Return a function that maps all values from [0.0,m] to 0, and maps the range [m,1.0] into [0.0, 1.0] linearly. """ m = float(m) def f(x): if x <= m: return 0.0 return (x - m) / (1.0 - m) return f
python
def black(m): """Return a function that maps all values from [0.0,m] to 0, and maps the range [m,1.0] into [0.0, 1.0] linearly. """ m = float(m) def f(x): if x <= m: return 0.0 return (x - m) / (1.0 - m) return f
['def', 'black', '(', 'm', ')', ':', 'm', '=', 'float', '(', 'm', ')', 'def', 'f', '(', 'x', ')', ':', 'if', 'x', '<=', 'm', ':', 'return', '0.0', 'return', '(', 'x', '-', 'm', ')', '/', '(', '1.0', '-', 'm', ')', 'return', 'f']
Return a function that maps all values from [0.0,m] to 0, and maps the range [m,1.0] into [0.0, 1.0] linearly.
['Return', 'a', 'function', 'that', 'maps', 'all', 'values', 'from', '[', '0', '.', '0', 'm', ']', 'to', '0', 'and', 'maps', 'the', 'range', '[', 'm', '1', '.', '0', ']', 'into', '[', '0', '.', '0', '1', '.', '0', ']', 'linearly', '.']
train
https://github.com/drj11/pypng/blob/b8220ca9f58e4c5bc1d507e713744fcb8c049225/code/mkiccp.py#L15-L26
8,649
razor-x/scipy-data_fitting
scipy_data_fitting/plot.py
Plot.figure
def figure(self): """ The [`matplotlib.pyplot.figure`][1] instance. [1]: http://matplotlib.org/api/figure_api.html#matplotlib.figure.Figure """ if not hasattr(self, '_figure'): self._figure = matplotlib.pyplot.figure() return self._figure
python
def figure(self): """ The [`matplotlib.pyplot.figure`][1] instance. [1]: http://matplotlib.org/api/figure_api.html#matplotlib.figure.Figure """ if not hasattr(self, '_figure'): self._figure = matplotlib.pyplot.figure() return self._figure
['def', 'figure', '(', 'self', ')', ':', 'if', 'not', 'hasattr', '(', 'self', ',', "'_figure'", ')', ':', 'self', '.', '_figure', '=', 'matplotlib', '.', 'pyplot', '.', 'figure', '(', ')', 'return', 'self', '.', '_figure']
The [`matplotlib.pyplot.figure`][1] instance. [1]: http://matplotlib.org/api/figure_api.html#matplotlib.figure.Figure
['The', '[', 'matplotlib', '.', 'pyplot', '.', 'figure', ']', '[', '1', ']', 'instance', '.']
train
https://github.com/razor-x/scipy-data_fitting/blob/c756a645da8629699b3f22244bfb7d5d4d88b179/scipy_data_fitting/plot.py#L75-L82
8,650
YosaiProject/yosai
yosai/web/subject/subject.py
WebYosai.requires_role
def requires_role(role_s, logical_operator=all): """ Requires that the calling Subject be authorized to the extent that is required to satisfy the role_s specified and the logical operation upon them. :param role_s: a collection of the role(s) required, specified by ...
python
def requires_role(role_s, logical_operator=all): """ Requires that the calling Subject be authorized to the extent that is required to satisfy the role_s specified and the logical operation upon them. :param role_s: a collection of the role(s) required, specified by ...
['def', 'requires_role', '(', 'role_s', ',', 'logical_operator', '=', 'all', ')', ':', 'def', 'outer_wrap', '(', 'fn', ')', ':', '@', 'functools', '.', 'wraps', '(', 'fn', ')', 'def', 'inner_wrap', '(', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'subject', '=', 'WebYosai', '.', 'get_current_subject', '(', ')', 'tr...
Requires that the calling Subject be authorized to the extent that is required to satisfy the role_s specified and the logical operation upon them. :param role_s: a collection of the role(s) required, specified by identifiers (such as a role name) :type role...
['Requires', 'that', 'the', 'calling', 'Subject', 'be', 'authorized', 'to', 'the', 'extent', 'that', 'is', 'required', 'to', 'satisfy', 'the', 'role_s', 'specified', 'and', 'the', 'logical', 'operation', 'upon', 'them', '.']
train
https://github.com/YosaiProject/yosai/blob/7f96aa6b837ceae9bf3d7387cd7e35f5ab032575/yosai/web/subject/subject.py#L395-L437
8,651
saltstack/salt
salt/modules/lxc.py
_ensure_running
def _ensure_running(name, no_start=False, path=None): ''' If the container is not currently running, start it. This function returns the state that the container was in before changing path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: ...
python
def _ensure_running(name, no_start=False, path=None): ''' If the container is not currently running, start it. This function returns the state that the container was in before changing path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: ...
['def', '_ensure_running', '(', 'name', ',', 'no_start', '=', 'False', ',', 'path', '=', 'None', ')', ':', '_ensure_exists', '(', 'name', ',', 'path', '=', 'path', ')', 'pre', '=', 'state', '(', 'name', ',', 'path', '=', 'path', ')', 'if', 'pre', '==', "'running'", ':', '# This will be a no-op but running the function ...
If the container is not currently running, start it. This function returns the state that the container was in before changing path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0
['If', 'the', 'container', 'is', 'not', 'currently', 'running', 'start', 'it', '.', 'This', 'function', 'returns', 'the', 'state', 'that', 'the', 'container', 'was', 'in', 'before', 'changing']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxc.py#L2312-L2340
8,652
ARMmbed/mbed-cloud-sdk-python
src/mbed_cloud/certificates/certificates.py
CertificatesAPI.update_certificate
def update_certificate(self, certificate_id, **kwargs): """Update a certificate. :param str certificate_id: The certificate id (Required) :param str certificate_data: X509.v3 trusted certificate in PEM format. :param str signature: This parameter has been DEPRECATED in the API and does ...
python
def update_certificate(self, certificate_id, **kwargs): """Update a certificate. :param str certificate_id: The certificate id (Required) :param str certificate_data: X509.v3 trusted certificate in PEM format. :param str signature: This parameter has been DEPRECATED in the API and does ...
['def', 'update_certificate', '(', 'self', ',', 'certificate_id', ',', '*', '*', 'kwargs', ')', ':', 'api', '=', 'self', '.', '_get_api', '(', 'iam', '.', 'DeveloperApi', ')', 'cert', '=', 'Certificate', '.', '_create_request_map', '(', 'kwargs', ')', 'body', '=', 'iam', '.', 'TrustedCertificateReq', '(', '*', '*', 'ce...
Update a certificate. :param str certificate_id: The certificate id (Required) :param str certificate_data: X509.v3 trusted certificate in PEM format. :param str signature: This parameter has been DEPRECATED in the API and does not need to be provided. :param str type: type ...
['Update', 'a', 'certificate', '.']
train
https://github.com/ARMmbed/mbed-cloud-sdk-python/blob/c0af86fb2cdd4dc7ed26f236139241067d293509/src/mbed_cloud/certificates/certificates.py#L176-L195
8,653
radzak/rtv-downloader
rtv/utils.py
clean_title
def clean_title(title): """ Clean title -> remove dates, remove duplicated spaces and strip title. Args: title (str): Title. Returns: str: Clean title without dates, duplicated, trailing and leading spaces. """ date_pattern = re.compile(r'\W*' r'\...
python
def clean_title(title): """ Clean title -> remove dates, remove duplicated spaces and strip title. Args: title (str): Title. Returns: str: Clean title without dates, duplicated, trailing and leading spaces. """ date_pattern = re.compile(r'\W*' r'\...
['def', 'clean_title', '(', 'title', ')', ':', 'date_pattern', '=', 're', '.', 'compile', '(', "r'\\W*'", "r'\\d{1,2}'", "r'[/\\-.]'", "r'\\d{1,2}'", "r'[/\\-.]'", "r'(?=\\d*)(?:.{4}|.{2})'", "r'\\W*'", ')', 'title', '=', 'date_pattern', '.', 'sub', '(', "' '", ',', 'title', ')', 'title', '=', 're', '.', 'sub', '(', "r...
Clean title -> remove dates, remove duplicated spaces and strip title. Args: title (str): Title. Returns: str: Clean title without dates, duplicated, trailing and leading spaces.
['Clean', 'title', '-', '>', 'remove', 'dates', 'remove', 'duplicated', 'spaces', 'and', 'strip', 'title', '.']
train
https://github.com/radzak/rtv-downloader/blob/b9114b7f4c35fabe6ec9ad1764a65858667a866e/rtv/utils.py#L122-L143
8,654
Datary/scrapbag
scrapbag/csvs.py
row_csv_limiter
def row_csv_limiter(rows, limits=None): """ Limit row passing a value or detect limits making the best effort. """ limits = [None, None] if limits is None else limits if len(exclude_empty_values(limits)) == 2: upper_limit = limits[0] lower_limit = limits[1] elif len(exclude_emp...
python
def row_csv_limiter(rows, limits=None): """ Limit row passing a value or detect limits making the best effort. """ limits = [None, None] if limits is None else limits if len(exclude_empty_values(limits)) == 2: upper_limit = limits[0] lower_limit = limits[1] elif len(exclude_emp...
['def', 'row_csv_limiter', '(', 'rows', ',', 'limits', '=', 'None', ')', ':', 'limits', '=', '[', 'None', ',', 'None', ']', 'if', 'limits', 'is', 'None', 'else', 'limits', 'if', 'len', '(', 'exclude_empty_values', '(', 'limits', ')', ')', '==', '2', ':', 'upper_limit', '=', 'limits', '[', '0', ']', 'lower_limit', '=', ...
Limit row passing a value or detect limits making the best effort.
['Limit', 'row', 'passing', 'a', 'value', 'or', 'detect', 'limits', 'making', 'the', 'best', 'effort', '.']
train
https://github.com/Datary/scrapbag/blob/3a4f9824ab6fe21121214ba9963690618da2c9de/scrapbag/csvs.py#L244-L261
8,655
quantmind/pulsar
pulsar/utils/pylib/websocket.py
FrameParser.close
def close(self, code=None): '''return a `close` :class:`Frame`. ''' code = code or 1000 body = pack('!H', code) body += self._close_codes.get(code, '').encode('utf-8') return self.encode(body, opcode=0x8)
python
def close(self, code=None): '''return a `close` :class:`Frame`. ''' code = code or 1000 body = pack('!H', code) body += self._close_codes.get(code, '').encode('utf-8') return self.encode(body, opcode=0x8)
['def', 'close', '(', 'self', ',', 'code', '=', 'None', ')', ':', 'code', '=', 'code', 'or', '1000', 'body', '=', 'pack', '(', "'!H'", ',', 'code', ')', 'body', '+=', 'self', '.', '_close_codes', '.', 'get', '(', 'code', ',', "''", ')', '.', 'encode', '(', "'utf-8'", ')', 'return', 'self', '.', 'encode', '(', 'body', '...
return a `close` :class:`Frame`.
['return', 'a', 'close', ':', 'class', ':', 'Frame', '.']
train
https://github.com/quantmind/pulsar/blob/fee44e871954aa6ca36d00bb5a3739abfdb89b26/pulsar/utils/pylib/websocket.py#L128-L134
8,656
eldarion/formly
formly/views/design.py
survey_change_name
def survey_change_name(request, pk): """ Works well with: http://www.appelsiini.net/projects/jeditable """ survey = get_object_or_404(Survey, pk=pk) if not request.user.has_perm("formly.change_survey_name", obj=survey): raise PermissionDenied() survey.name = request.POST.get("nam...
python
def survey_change_name(request, pk): """ Works well with: http://www.appelsiini.net/projects/jeditable """ survey = get_object_or_404(Survey, pk=pk) if not request.user.has_perm("formly.change_survey_name", obj=survey): raise PermissionDenied() survey.name = request.POST.get("nam...
['def', 'survey_change_name', '(', 'request', ',', 'pk', ')', ':', 'survey', '=', 'get_object_or_404', '(', 'Survey', ',', 'pk', '=', 'pk', ')', 'if', 'not', 'request', '.', 'user', '.', 'has_perm', '(', '"formly.change_survey_name"', ',', 'obj', '=', 'survey', ')', ':', 'raise', 'PermissionDenied', '(', ')', 'survey',...
Works well with: http://www.appelsiini.net/projects/jeditable
['Works', 'well', 'with', ':', 'http', ':', '//', 'www', '.', 'appelsiini', '.', 'net', '/', 'projects', '/', 'jeditable']
train
https://github.com/eldarion/formly/blob/05dfefbbf93ded48e560a6bacf1fc77487a0a4e3/formly/views/design.py#L99-L114
8,657
openfisca/openfisca-web-api
openfisca_web_api/controllers/__init__.py
make_router
def make_router(): """Return a WSGI application that searches requests to controllers """ global router routings = [ ('GET', '^/$', index), ('GET', '^/api/?$', index), ('POST', '^/api/1/calculate/?$', calculate.api1_calculate), ('GET', '^/api/2/entities/?$', entities.api2_ent...
python
def make_router(): """Return a WSGI application that searches requests to controllers """ global router routings = [ ('GET', '^/$', index), ('GET', '^/api/?$', index), ('POST', '^/api/1/calculate/?$', calculate.api1_calculate), ('GET', '^/api/2/entities/?$', entities.api2_ent...
['def', 'make_router', '(', ')', ':', 'global', 'router', 'routings', '=', '[', '(', "'GET'", ',', "'^/$'", ',', 'index', ')', ',', '(', "'GET'", ',', "'^/api/?$'", ',', 'index', ')', ',', '(', "'POST'", ',', "'^/api/1/calculate/?$'", ',', 'calculate', '.', 'api1_calculate', ')', ',', '(', "'GET'", ',', "'^/api/2/entit...
Return a WSGI application that searches requests to controllers
['Return', 'a', 'WSGI', 'application', 'that', 'searches', 'requests', 'to', 'controllers']
train
https://github.com/openfisca/openfisca-web-api/blob/d1cd3bfacac338e80bb0df7e0465b65649dd893b/openfisca_web_api/controllers/__init__.py#L31-L49
8,658
druids/django-chamber
chamber/utils/__init__.py
get_class_method
def get_class_method(cls_or_inst, method_name): """ Returns a method from a given class or instance. When the method doest not exist, it returns `None`. Also works with properties and cached properties. """ cls = cls_or_inst if isinstance(cls_or_inst, type) else cls_or_inst.__class__ meth = geta...
python
def get_class_method(cls_or_inst, method_name): """ Returns a method from a given class or instance. When the method doest not exist, it returns `None`. Also works with properties and cached properties. """ cls = cls_or_inst if isinstance(cls_or_inst, type) else cls_or_inst.__class__ meth = geta...
['def', 'get_class_method', '(', 'cls_or_inst', ',', 'method_name', ')', ':', 'cls', '=', 'cls_or_inst', 'if', 'isinstance', '(', 'cls_or_inst', ',', 'type', ')', 'else', 'cls_or_inst', '.', '__class__', 'meth', '=', 'getattr', '(', 'cls', ',', 'method_name', ',', 'None', ')', 'if', 'isinstance', '(', 'meth', ',', 'pro...
Returns a method from a given class or instance. When the method doest not exist, it returns `None`. Also works with properties and cached properties.
['Returns', 'a', 'method', 'from', 'a', 'given', 'class', 'or', 'instance', '.', 'When', 'the', 'method', 'doest', 'not', 'exist', 'it', 'returns', 'None', '.', 'Also', 'works', 'with', 'properties', 'and', 'cached', 'properties', '.']
train
https://github.com/druids/django-chamber/blob/eef4169923557e96877a664fa254e8c0814f3f23/chamber/utils/__init__.py#L17-L28
8,659
resync/resync
resync/capability_list.py
CapabilityList.capability_info
def capability_info(self, name=None): """Return information about the requested capability from this list. Will return None if there is no information about the requested capability. """ for r in self.resources: if (r.capability == name): return(r) re...
python
def capability_info(self, name=None): """Return information about the requested capability from this list. Will return None if there is no information about the requested capability. """ for r in self.resources: if (r.capability == name): return(r) re...
['def', 'capability_info', '(', 'self', ',', 'name', '=', 'None', ')', ':', 'for', 'r', 'in', 'self', '.', 'resources', ':', 'if', '(', 'r', '.', 'capability', '==', 'name', ')', ':', 'return', '(', 'r', ')', 'return', '(', 'None', ')']
Return information about the requested capability from this list. Will return None if there is no information about the requested capability.
['Return', 'information', 'about', 'the', 'requested', 'capability', 'from', 'this', 'list', '.']
train
https://github.com/resync/resync/blob/98292c17b2c00f2d6f5191c6ab51fef8c292a018/resync/capability_list.py#L117-L125
8,660
OnroerendErfgoed/oe_utils
oe_utils/validation/validators_actor.py
TelefoonSchemaNode.preparer
def preparer(telefoon): ''' Edit a phone value to a value that can be validated as a phone number. This takes the incoming value and : Removes all whitespace ( space, tab , newline , ... ) characters Removes the following characters: " / - . " If no + ...
python
def preparer(telefoon): ''' Edit a phone value to a value that can be validated as a phone number. This takes the incoming value and : Removes all whitespace ( space, tab , newline , ... ) characters Removes the following characters: " / - . " If no + ...
['def', 'preparer', '(', 'telefoon', ')', ':', 'if', 'telefoon', 'is', 'None', 'or', 'telefoon', '==', 'colander', '.', 'null', ':', 'return', 'colander', '.', 'null', 'if', "'landcode'", 'in', 'telefoon', 'and', 'telefoon', '.', 'get', '(', "'landcode'", ')', 'is', 'not', 'None', ':', 'landcode', '=', 'telefoon', '.',...
Edit a phone value to a value that can be validated as a phone number. This takes the incoming value and : Removes all whitespace ( space, tab , newline , ... ) characters Removes the following characters: " / - . " If no + is present at frond, add the country code ...
['Edit', 'a', 'phone', 'value', 'to', 'a', 'value', 'that', 'can', 'be', 'validated', 'as', 'a', 'phone', 'number', '.', 'This', 'takes', 'the', 'incoming', 'value', 'and', ':', 'Removes', 'all', 'whitespace', '(', 'space', 'tab', 'newline', '...', ')', 'characters', 'Removes', 'the', 'following', 'characters', ':', '/...
train
https://github.com/OnroerendErfgoed/oe_utils/blob/7b2014bda8ac6bb71b7138eaa06ac17ef3ff4a6d/oe_utils/validation/validators_actor.py#L96-L118
8,661
myusuf3/delorean
delorean/dates.py
move_datetime_year
def move_datetime_year(dt, direction, num_shifts): """ Move datetime 1 year in the chosen direction. unit is a no-op, to keep the API the same as the day case """ delta = relativedelta(years=+num_shifts) return _move_datetime(dt, direction, delta)
python
def move_datetime_year(dt, direction, num_shifts): """ Move datetime 1 year in the chosen direction. unit is a no-op, to keep the API the same as the day case """ delta = relativedelta(years=+num_shifts) return _move_datetime(dt, direction, delta)
['def', 'move_datetime_year', '(', 'dt', ',', 'direction', ',', 'num_shifts', ')', ':', 'delta', '=', 'relativedelta', '(', 'years', '=', '+', 'num_shifts', ')', 'return', '_move_datetime', '(', 'dt', ',', 'direction', ',', 'delta', ')']
Move datetime 1 year in the chosen direction. unit is a no-op, to keep the API the same as the day case
['Move', 'datetime', '1', 'year', 'in', 'the', 'chosen', 'direction', '.', 'unit', 'is', 'a', 'no', '-', 'op', 'to', 'keep', 'the', 'API', 'the', 'same', 'as', 'the', 'day', 'case']
train
https://github.com/myusuf3/delorean/blob/3e8a7b8cfd4c26546f62bde2f34002893adfa08a/delorean/dates.py#L113-L119
8,662
roclark/sportsreference
sportsreference/nhl/schedule.py
Schedule.dataframe
def dataframe(self): """ Returns a pandas DataFrame where each row is a representation of the Game class. Rows are indexed by the boxscore string. """ frames = [] for game in self.__iter__(): df = game.dataframe if df is not None: f...
python
def dataframe(self): """ Returns a pandas DataFrame where each row is a representation of the Game class. Rows are indexed by the boxscore string. """ frames = [] for game in self.__iter__(): df = game.dataframe if df is not None: f...
['def', 'dataframe', '(', 'self', ')', ':', 'frames', '=', '[', ']', 'for', 'game', 'in', 'self', '.', '__iter__', '(', ')', ':', 'df', '=', 'game', '.', 'dataframe', 'if', 'df', 'is', 'not', 'None', ':', 'frames', '.', 'append', '(', 'df', ')', 'if', 'frames', '==', '[', ']', ':', 'return', 'None', 'return', 'pd', '.'...
Returns a pandas DataFrame where each row is a representation of the Game class. Rows are indexed by the boxscore string.
['Returns', 'a', 'pandas', 'DataFrame', 'where', 'each', 'row', 'is', 'a', 'representation', 'of', 'the', 'Game', 'class', '.', 'Rows', 'are', 'indexed', 'by', 'the', 'boxscore', 'string', '.']
train
https://github.com/roclark/sportsreference/blob/ea0bae432be76450e137671d2998eb38f962dffd/sportsreference/nhl/schedule.py#L588-L600
8,663
inveniosoftware/invenio-pidstore
invenio_pidstore/ext.py
InvenioPIDStore.init_app
def init_app(self, app, minters_entry_point_group=None, fetchers_entry_point_group=None): """Flask application initialization. Initialize: * The CLI commands. * Initialize the logger (Default: `app.debug`). * Initialize the default admin object link endpoint....
python
def init_app(self, app, minters_entry_point_group=None, fetchers_entry_point_group=None): """Flask application initialization. Initialize: * The CLI commands. * Initialize the logger (Default: `app.debug`). * Initialize the default admin object link endpoint....
['def', 'init_app', '(', 'self', ',', 'app', ',', 'minters_entry_point_group', '=', 'None', ',', 'fetchers_entry_point_group', '=', 'None', ')', ':', 'self', '.', 'init_config', '(', 'app', ')', '# Initialize CLI', 'app', '.', 'cli', '.', 'add_command', '(', 'cmd', ')', '# Initialize logger', 'app', '.', 'config', '.',...
Flask application initialization. Initialize: * The CLI commands. * Initialize the logger (Default: `app.debug`). * Initialize the default admin object link endpoint. (Default: `{"rec": "recordmetadata.details_view"}` if `invenio-records` is installed, otherwi...
['Flask', 'application', 'initialization', '.']
train
https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/ext.py#L103-L157
8,664
materialsproject/pymatgen
pymatgen/entries/entry_tools.py
EntrySet.chemsys
def chemsys(self) -> set: """ Returns: set representing the chemical system, e.g., {"Li", "Fe", "P", "O"} """ chemsys = set() for e in self.entries: chemsys.update([el.symbol for el in e.composition.keys()]) return chemsys
python
def chemsys(self) -> set: """ Returns: set representing the chemical system, e.g., {"Li", "Fe", "P", "O"} """ chemsys = set() for e in self.entries: chemsys.update([el.symbol for el in e.composition.keys()]) return chemsys
['def', 'chemsys', '(', 'self', ')', '->', 'set', ':', 'chemsys', '=', 'set', '(', ')', 'for', 'e', 'in', 'self', '.', 'entries', ':', 'chemsys', '.', 'update', '(', '[', 'el', '.', 'symbol', 'for', 'el', 'in', 'e', '.', 'composition', '.', 'keys', '(', ')', ']', ')', 'return', 'chemsys']
Returns: set representing the chemical system, e.g., {"Li", "Fe", "P", "O"}
['Returns', ':', 'set', 'representing', 'the', 'chemical', 'system', 'e', '.', 'g', '.', '{', 'Li', 'Fe', 'P', 'O', '}']
train
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/entries/entry_tools.py#L179-L187
8,665
Stranger6667/postmarker
postmarker/models/emails.py
EmailBatch._construct_email
def _construct_email(self, email, **extra): """ Converts incoming data to properly structured dictionary. """ if isinstance(email, dict): email = Email(manager=self._manager, **email) elif isinstance(email, (MIMEText, MIMEMultipart)): email = Email.from_mi...
python
def _construct_email(self, email, **extra): """ Converts incoming data to properly structured dictionary. """ if isinstance(email, dict): email = Email(manager=self._manager, **email) elif isinstance(email, (MIMEText, MIMEMultipart)): email = Email.from_mi...
['def', '_construct_email', '(', 'self', ',', 'email', ',', '*', '*', 'extra', ')', ':', 'if', 'isinstance', '(', 'email', ',', 'dict', ')', ':', 'email', '=', 'Email', '(', 'manager', '=', 'self', '.', '_manager', ',', '*', '*', 'email', ')', 'elif', 'isinstance', '(', 'email', ',', '(', 'MIMEText', ',', 'MIMEMultipar...
Converts incoming data to properly structured dictionary.
['Converts', 'incoming', 'data', 'to', 'properly', 'structured', 'dictionary', '.']
train
https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/emails.py#L243-L254
8,666
julienr/meshcut
examples/utils.py
show_plane
def show_plane(orig, n, scale=1.0, **kwargs): """ Show the plane with the given origin and normal. scale give its size """ b1 = orthogonal_vector(n) b1 /= la.norm(b1) b2 = np.cross(b1, n) b2 /= la.norm(b2) verts = [orig + scale*(-b1 - b2), orig + scale*(b1 - b2), ...
python
def show_plane(orig, n, scale=1.0, **kwargs): """ Show the plane with the given origin and normal. scale give its size """ b1 = orthogonal_vector(n) b1 /= la.norm(b1) b2 = np.cross(b1, n) b2 /= la.norm(b2) verts = [orig + scale*(-b1 - b2), orig + scale*(b1 - b2), ...
['def', 'show_plane', '(', 'orig', ',', 'n', ',', 'scale', '=', '1.0', ',', '*', '*', 'kwargs', ')', ':', 'b1', '=', 'orthogonal_vector', '(', 'n', ')', 'b1', '/=', 'la', '.', 'norm', '(', 'b1', ')', 'b2', '=', 'np', '.', 'cross', '(', 'b1', ',', 'n', ')', 'b2', '/=', 'la', '.', 'norm', '(', 'b2', ')', 'verts', '=', '[...
Show the plane with the given origin and normal. scale give its size
['Show', 'the', 'plane', 'with', 'the', 'given', 'origin', 'and', 'normal', '.', 'scale', 'give', 'its', 'size']
train
https://github.com/julienr/meshcut/blob/226c79d8da52b657d904f783940c258093c929a5/examples/utils.py#L27-L40
8,667
hydpy-dev/hydpy
hydpy/models/dam/dam_derived.py
HighestRemoteSmoothPar.update
def update(self): """Calculate the smoothing parameter value. The following example is explained in some detail in module |smoothtools|: >>> from hydpy.models.dam import * >>> parameterstep() >>> highestremotedischarge(1.0) >>> highestremotetolerance(0.0) ...
python
def update(self): """Calculate the smoothing parameter value. The following example is explained in some detail in module |smoothtools|: >>> from hydpy.models.dam import * >>> parameterstep() >>> highestremotedischarge(1.0) >>> highestremotetolerance(0.0) ...
['def', 'update', '(', 'self', ')', ':', 'control', '=', 'self', '.', 'subpars', '.', 'pars', '.', 'control', 'if', 'numpy', '.', 'isinf', '(', 'control', '.', 'highestremotedischarge', ')', ':', 'self', '(', '0.0', ')', 'else', ':', 'self', '(', 'control', '.', 'highestremotedischarge', '*', 'smoothtools', '.', 'calc_...
Calculate the smoothing parameter value. The following example is explained in some detail in module |smoothtools|: >>> from hydpy.models.dam import * >>> parameterstep() >>> highestremotedischarge(1.0) >>> highestremotetolerance(0.0) >>> derived.highestremotesm...
['Calculate', 'the', 'smoothing', 'parameter', 'value', '.']
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/dam/dam_derived.py#L246-L303
8,668
google/transitfeed
kmlparser.py
KmlParser.ParseDom
def ParseDom(self, dom, feed): """ Parses the given kml dom tree and updates the Google transit feed object. Args: dom - kml dom tree feed - an instance of Schedule class to be updated """ shape_num = 0 for node in dom.getElementsByTagName('Placemark'): p = self.ParsePlacemark...
python
def ParseDom(self, dom, feed): """ Parses the given kml dom tree and updates the Google transit feed object. Args: dom - kml dom tree feed - an instance of Schedule class to be updated """ shape_num = 0 for node in dom.getElementsByTagName('Placemark'): p = self.ParsePlacemark...
['def', 'ParseDom', '(', 'self', ',', 'dom', ',', 'feed', ')', ':', 'shape_num', '=', '0', 'for', 'node', 'in', 'dom', '.', 'getElementsByTagName', '(', "'Placemark'", ')', ':', 'p', '=', 'self', '.', 'ParsePlacemark', '(', 'node', ')', 'if', 'p', '.', 'IsPoint', '(', ')', ':', '(', 'lon', ',', 'lat', ')', '=', 'p', '....
Parses the given kml dom tree and updates the Google transit feed object. Args: dom - kml dom tree feed - an instance of Schedule class to be updated
['Parses', 'the', 'given', 'kml', 'dom', 'tree', 'and', 'updates', 'the', 'Google', 'transit', 'feed', 'object', '.']
train
https://github.com/google/transitfeed/blob/eb2991a3747ba541b2cb66502b305b6304a1f85f/kmlparser.py#L73-L89
8,669
brainiak/brainiak
brainiak/image.py
mask_image
def mask_image(image: SpatialImage, mask: np.ndarray, data_type: type = None ) -> np.ndarray: """Mask image after optionally casting its type. Parameters ---------- image Image to mask. Can include time as the last dimension. mask Mask to apply. Must have the same sha...
python
def mask_image(image: SpatialImage, mask: np.ndarray, data_type: type = None ) -> np.ndarray: """Mask image after optionally casting its type. Parameters ---------- image Image to mask. Can include time as the last dimension. mask Mask to apply. Must have the same sha...
['def', 'mask_image', '(', 'image', ':', 'SpatialImage', ',', 'mask', ':', 'np', '.', 'ndarray', ',', 'data_type', ':', 'type', '=', 'None', ')', '->', 'np', '.', 'ndarray', ':', 'image_data', '=', 'image', '.', 'get_data', '(', ')', 'if', 'image_data', '.', 'shape', '[', ':', '3', ']', '!=', 'mask', '.', 'shape', ':',...
Mask image after optionally casting its type. Parameters ---------- image Image to mask. Can include time as the last dimension. mask Mask to apply. Must have the same shape as the image data. data_type Type to cast image to. Returns ------- np.ndarray M...
['Mask', 'image', 'after', 'optionally', 'casting', 'its', 'type', '.']
train
https://github.com/brainiak/brainiak/blob/408f12dec2ff56559a26873a848a09e4c8facfeb/brainiak/image.py#L107-L137
8,670
fastmonkeys/pontus
pontus/_compat.py
unicode_compatible
def unicode_compatible(cls): """ A decorator that defines ``__str__`` and ``__unicode__`` methods under Python 2. """ if not is_py3: cls.__unicode__ = cls.__str__ cls.__str__ = lambda self: self.__unicode__().encode('utf-8') return cls
python
def unicode_compatible(cls): """ A decorator that defines ``__str__`` and ``__unicode__`` methods under Python 2. """ if not is_py3: cls.__unicode__ = cls.__str__ cls.__str__ = lambda self: self.__unicode__().encode('utf-8') return cls
['def', 'unicode_compatible', '(', 'cls', ')', ':', 'if', 'not', 'is_py3', ':', 'cls', '.', '__unicode__', '=', 'cls', '.', '__str__', 'cls', '.', '__str__', '=', 'lambda', 'self', ':', 'self', '.', '__unicode__', '(', ')', '.', 'encode', '(', "'utf-8'", ')', 'return', 'cls']
A decorator that defines ``__str__`` and ``__unicode__`` methods under Python 2.
['A', 'decorator', 'that', 'defines', '__str__', 'and', '__unicode__', 'methods', 'under', 'Python', '2', '.']
train
https://github.com/fastmonkeys/pontus/blob/cf02fb22c4558b899e2dcbe437a1a525321c4f12/pontus/_compat.py#L25-L33
8,671
bxlab/bx-python
lib/bx_extras/stats.py
lgeometricmean
def lgeometricmean (inlist): """ Calculates the geometric mean of the values in the passed list. That is: n-th root of (x1 * x2 * ... * xn). Assumes a '1D' list. Usage: lgeometricmean(inlist) """ mult = 1.0 one_over_n = 1.0/len(inlist) for item in inlist: mult = mult * pow(item,one_over_n) ...
python
def lgeometricmean (inlist): """ Calculates the geometric mean of the values in the passed list. That is: n-th root of (x1 * x2 * ... * xn). Assumes a '1D' list. Usage: lgeometricmean(inlist) """ mult = 1.0 one_over_n = 1.0/len(inlist) for item in inlist: mult = mult * pow(item,one_over_n) ...
['def', 'lgeometricmean', '(', 'inlist', ')', ':', 'mult', '=', '1.0', 'one_over_n', '=', '1.0', '/', 'len', '(', 'inlist', ')', 'for', 'item', 'in', 'inlist', ':', 'mult', '=', 'mult', '*', 'pow', '(', 'item', ',', 'one_over_n', ')', 'return', 'mult']
Calculates the geometric mean of the values in the passed list. That is: n-th root of (x1 * x2 * ... * xn). Assumes a '1D' list. Usage: lgeometricmean(inlist)
['Calculates', 'the', 'geometric', 'mean', 'of', 'the', 'values', 'in', 'the', 'passed', 'list', '.', 'That', 'is', ':', 'n', '-', 'th', 'root', 'of', '(', 'x1', '*', 'x2', '*', '...', '*', 'xn', ')', '.', 'Assumes', 'a', '1D', 'list', '.']
train
https://github.com/bxlab/bx-python/blob/09cb725284803df90a468d910f2274628d8647de/lib/bx_extras/stats.py#L271-L282
8,672
Yelp/kafka-utils
kafka_utils/main.py
parse_args
def parse_args(): """Parse the arguments.""" parser = argparse.ArgumentParser( description='Show available clusters.' ) parser.add_argument( '-v', '--version', action='version', version="%(prog)s {0}".format(__version__), ) parser.add_argument( '--...
python
def parse_args(): """Parse the arguments.""" parser = argparse.ArgumentParser( description='Show available clusters.' ) parser.add_argument( '-v', '--version', action='version', version="%(prog)s {0}".format(__version__), ) parser.add_argument( '--...
['def', 'parse_args', '(', ')', ':', 'parser', '=', 'argparse', '.', 'ArgumentParser', '(', 'description', '=', "'Show available clusters.'", ')', 'parser', '.', 'add_argument', '(', "'-v'", ',', "'--version'", ',', 'action', '=', "'version'", ',', 'version', '=', '"%(prog)s {0}"', '.', 'format', '(', '__version__', ')...
Parse the arguments.
['Parse', 'the', 'arguments', '.']
train
https://github.com/Yelp/kafka-utils/blob/cdb4d64308f3079ee0873250bf7b34d0d94eca50/kafka_utils/main.py#L29-L49
8,673
hhatto/autopep8
autopep8.py
FixPEP8.fix_e702
def fix_e702(self, result, logical): """Put semicolon-separated compound statement on separate lines.""" if not logical: return [] # pragma: no cover logical_lines = logical[2] # Avoid applying this when indented. # https://docs.python.org/reference/compound_stmts.h...
python
def fix_e702(self, result, logical): """Put semicolon-separated compound statement on separate lines.""" if not logical: return [] # pragma: no cover logical_lines = logical[2] # Avoid applying this when indented. # https://docs.python.org/reference/compound_stmts.h...
['def', 'fix_e702', '(', 'self', ',', 'result', ',', 'logical', ')', ':', 'if', 'not', 'logical', ':', 'return', '[', ']', '# pragma: no cover', 'logical_lines', '=', 'logical', '[', '2', ']', '# Avoid applying this when indented.', '# https://docs.python.org/reference/compound_stmts.html', 'for', 'line', 'in', 'logica...
Put semicolon-separated compound statement on separate lines.
['Put', 'semicolon', '-', 'separated', 'compound', 'statement', 'on', 'separate', 'lines', '.']
train
https://github.com/hhatto/autopep8/blob/fda3bb39181437b6b8a0aa0185f21ae5f14385dd/autopep8.py#L1001-L1041
8,674
jjmontesl/python-clementine-remote
clementineremote/clementine.py
ClementineRemote.set_volume
def set_volume(self, volume): """ Sets player volume (note, this does not change host computer main volume). """ msg = cr.Message() msg.type = cr.SET_VOLUME msg.request_set_volume.volume = int(volume) self.send_message(msg)
python
def set_volume(self, volume): """ Sets player volume (note, this does not change host computer main volume). """ msg = cr.Message() msg.type = cr.SET_VOLUME msg.request_set_volume.volume = int(volume) self.send_message(msg)
['def', 'set_volume', '(', 'self', ',', 'volume', ')', ':', 'msg', '=', 'cr', '.', 'Message', '(', ')', 'msg', '.', 'type', '=', 'cr', '.', 'SET_VOLUME', 'msg', '.', 'request_set_volume', '.', 'volume', '=', 'int', '(', 'volume', ')', 'self', '.', 'send_message', '(', 'msg', ')']
Sets player volume (note, this does not change host computer main volume).
['Sets', 'player', 'volume', '(', 'note', 'this', 'does', 'not', 'change', 'host', 'computer', 'main', 'volume', ')', '.']
train
https://github.com/jjmontesl/python-clementine-remote/blob/af5198f8bb56a4845f4e081fd8a553f935c94cde/clementineremote/clementine.py#L195-L202
8,675
gwastro/pycbc
pycbc/inference/models/base.py
BaseModel.update
def update(self, **params): """Updates the current parameter positions and resets stats. If any sampling transforms are specified, they are applied to the params before being stored. """ self._current_params = self._transform_params(**params) self._current_stats = ModelS...
python
def update(self, **params): """Updates the current parameter positions and resets stats. If any sampling transforms are specified, they are applied to the params before being stored. """ self._current_params = self._transform_params(**params) self._current_stats = ModelS...
['def', 'update', '(', 'self', ',', '*', '*', 'params', ')', ':', 'self', '.', '_current_params', '=', 'self', '.', '_transform_params', '(', '*', '*', 'params', ')', 'self', '.', '_current_stats', '=', 'ModelStats', '(', ')']
Updates the current parameter positions and resets stats. If any sampling transforms are specified, they are applied to the params before being stored.
['Updates', 'the', 'current', 'parameter', 'positions', 'and', 'resets', 'stats', '.']
train
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/inference/models/base.py#L409-L416
8,676
pypa/pipenv
pipenv/vendor/shellingham/nt.py
_iter_process
def _iter_process(): """Iterate through processes, yielding process ID and properties of each. Example usage:: >>> for pid, info in _iter_process(): ... print(pid, '->', info) 1509 -> {'parent_pid': 1201, 'executable': 'python.exe'} """ # TODO: Process32{First,Next} does no...
python
def _iter_process(): """Iterate through processes, yielding process ID and properties of each. Example usage:: >>> for pid, info in _iter_process(): ... print(pid, '->', info) 1509 -> {'parent_pid': 1201, 'executable': 'python.exe'} """ # TODO: Process32{First,Next} does no...
['def', '_iter_process', '(', ')', ':', '# TODO: Process32{First,Next} does not return full executable path, only', '# the name. To get the full path, Module32{First,Next} is needed, but that', '# does not contain parent process information. We probably need to call', '# BOTH to build the correct process tree.', 'h_pro...
Iterate through processes, yielding process ID and properties of each. Example usage:: >>> for pid, info in _iter_process(): ... print(pid, '->', info) 1509 -> {'parent_pid': 1201, 'executable': 'python.exe'}
['Iterate', 'through', 'processes', 'yielding', 'process', 'ID', 'and', 'properties', 'of', 'each', '.']
train
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/shellingham/nt.py#L44-L93
8,677
pandas-dev/pandas
pandas/core/indexing.py
_NDFrameIndexer._validate_read_indexer
def _validate_read_indexer(self, key, indexer, axis, raise_missing=False): """ Check that indexer can be used to return a result (e.g. at least one element was found, unless the list of keys was actually empty). Parameters ---------- key : list-like Target la...
python
def _validate_read_indexer(self, key, indexer, axis, raise_missing=False): """ Check that indexer can be used to return a result (e.g. at least one element was found, unless the list of keys was actually empty). Parameters ---------- key : list-like Target la...
['def', '_validate_read_indexer', '(', 'self', ',', 'key', ',', 'indexer', ',', 'axis', ',', 'raise_missing', '=', 'False', ')', ':', 'ax', '=', 'self', '.', 'obj', '.', '_get_axis', '(', 'axis', ')', 'if', 'len', '(', 'key', ')', '==', '0', ':', 'return', '# Count missing values:', 'missing', '=', '(', 'indexer', '<',...
Check that indexer can be used to return a result (e.g. at least one element was found, unless the list of keys was actually empty). Parameters ---------- key : list-like Target labels (only used to show correct error message) indexer: array-like of booleans ...
['Check', 'that', 'indexer', 'can', 'be', 'used', 'to', 'return', 'a', 'result', '(', 'e', '.', 'g', '.', 'at', 'least', 'one', 'element', 'was', 'found', 'unless', 'the', 'list', 'of', 'keys', 'was', 'actually', 'empty', ')', '.']
train
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexing.py#L1213-L1273
8,678
epfl-lts2/pygsp
pygsp/graphs/_io.py
IOMixIn.from_networkx
def from_networkx(cls, graph, weight='weight'): r"""Import a graph from NetworkX. Edge weights are retrieved as an edge attribute, under the name specified by the ``weight`` parameter. Signals are retrieved from node attributes, and stored in the :attr:`signals` dictionary unde...
python
def from_networkx(cls, graph, weight='weight'): r"""Import a graph from NetworkX. Edge weights are retrieved as an edge attribute, under the name specified by the ``weight`` parameter. Signals are retrieved from node attributes, and stored in the :attr:`signals` dictionary unde...
['def', 'from_networkx', '(', 'cls', ',', 'graph', ',', 'weight', '=', "'weight'", ')', ':', 'nx', '=', '_import_networkx', '(', ')', 'from', '.', 'graph', 'import', 'Graph', 'adjacency', '=', 'nx', '.', 'to_scipy_sparse_matrix', '(', 'graph', ',', 'weight', '=', 'weight', ')', 'graph_pg', '=', 'Graph', '(', 'adjacency...
r"""Import a graph from NetworkX. Edge weights are retrieved as an edge attribute, under the name specified by the ``weight`` parameter. Signals are retrieved from node attributes, and stored in the :attr:`signals` dictionary under the attribute name. `N`-dimensional signals th...
['r', 'Import', 'a', 'graph', 'from', 'NetworkX', '.']
train
https://github.com/epfl-lts2/pygsp/blob/8ce5bde39206129287375af24fdbcd7edddca8c5/pygsp/graphs/_io.py#L252-L330
8,679
StackStorm/pybind
pybind/slxos/v17r_1_01a/interface/port_channel/qos/random_detect/__init__.py
random_detect._set_traffic_class
def _set_traffic_class(self, v, load=False): """ Setter method for traffic_class, mapped from YANG variable /interface/port_channel/qos/random_detect/traffic_class (list) If this variable is read-only (config: false) in the source YANG file, then _set_traffic_class is considered as a private method....
python
def _set_traffic_class(self, v, load=False): """ Setter method for traffic_class, mapped from YANG variable /interface/port_channel/qos/random_detect/traffic_class (list) If this variable is read-only (config: false) in the source YANG file, then _set_traffic_class is considered as a private method....
['def', '_set_traffic_class', '(', 'self', ',', 'v', ',', 'load', '=', 'False', ')', ':', 'if', 'hasattr', '(', 'v', ',', '"_utype"', ')', ':', 'v', '=', 'v', '.', '_utype', '(', 'v', ')', 'try', ':', 't', '=', 'YANGDynClass', '(', 'v', ',', 'base', '=', 'YANGListType', '(', '"red_tc_value red_dp_value"', ',', 'traffic...
Setter method for traffic_class, mapped from YANG variable /interface/port_channel/qos/random_detect/traffic_class (list) If this variable is read-only (config: false) in the source YANG file, then _set_traffic_class is considered as a private method. Backends looking to populate this variable should do...
['Setter', 'method', 'for', 'traffic_class', 'mapped', 'from', 'YANG', 'variable', '/', 'interface', '/', 'port_channel', '/', 'qos', '/', 'random_detect', '/', 'traffic_class', '(', 'list', ')', 'If', 'this', 'variable', 'is', 'read', '-', 'only', '(', 'config', ':', 'false', ')', 'in', 'the', 'source', 'YANG', 'file'...
train
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17r_1_01a/interface/port_channel/qos/random_detect/__init__.py#L92-L113
8,680
Opentrons/opentrons
scripts/python_build_utils.py
dump_br_version
def dump_br_version(project): """ Dump an enhanced version json including - The version from package.json - The current branch (if it can be found) - The current sha """ normalized = get_version(project) sha = subprocess.check_output( ['git', 'rev-parse', 'HEAD'], cwd=HERE).strip() ...
python
def dump_br_version(project): """ Dump an enhanced version json including - The version from package.json - The current branch (if it can be found) - The current sha """ normalized = get_version(project) sha = subprocess.check_output( ['git', 'rev-parse', 'HEAD'], cwd=HERE).strip() ...
['def', 'dump_br_version', '(', 'project', ')', ':', 'normalized', '=', 'get_version', '(', 'project', ')', 'sha', '=', 'subprocess', '.', 'check_output', '(', '[', "'git'", ',', "'rev-parse'", ',', "'HEAD'", ']', ',', 'cwd', '=', 'HERE', ')', '.', 'strip', '(', ')', 'branch', '=', 'subprocess', '.', 'check_output', '(...
Dump an enhanced version json including - The version from package.json - The current branch (if it can be found) - The current sha
['Dump', 'an', 'enhanced', 'version', 'json', 'including', '-', 'The', 'version', 'from', 'package', '.', 'json', '-', 'The', 'current', 'branch', '(', 'if', 'it', 'can', 'be', 'found', ')', '-', 'The', 'current', 'sha']
train
https://github.com/Opentrons/opentrons/blob/a7c15cc2636ecb64ab56c7edc1d8a57163aaeadf/scripts/python_build_utils.py#L47-L61
8,681
jcrist/skein
skein/ui.py
ProxiedPage.address
def address(self): """The full proxied address to this page""" path = urlsplit(self.target).path suffix = '/' if not path or path.endswith('/') else '' return '%s%s/%s%s' % (self._ui_address[:-1], self._proxy_prefix, self.route, suffix)
python
def address(self): """The full proxied address to this page""" path = urlsplit(self.target).path suffix = '/' if not path or path.endswith('/') else '' return '%s%s/%s%s' % (self._ui_address[:-1], self._proxy_prefix, self.route, suffix)
['def', 'address', '(', 'self', ')', ':', 'path', '=', 'urlsplit', '(', 'self', '.', 'target', ')', '.', 'path', 'suffix', '=', "'/'", 'if', 'not', 'path', 'or', 'path', '.', 'endswith', '(', "'/'", ')', 'else', "''", 'return', "'%s%s/%s%s'", '%', '(', 'self', '.', '_ui_address', '[', ':', '-', '1', ']', ',', 'self', '...
The full proxied address to this page
['The', 'full', 'proxied', 'address', 'to', 'this', 'page']
train
https://github.com/jcrist/skein/blob/16f8b1d3b3d9f79f36e2f152e45893339a1793e8/skein/ui.py#L43-L48
8,682
guaix-ucm/pyemir
emirdrp/processing/wavecal/slitlet2d.py
Slitlet2D.extract_slitlet2d
def extract_slitlet2d(self, image_2k2k): """Extract slitlet 2d image from image with original EMIR dimensions. Parameters ---------- image_2k2k : numpy array Original image (dimensions EMIR_NAXIS1 * EMIR_NAXIS2) Returns ------- slitlet2d : numpy arra...
python
def extract_slitlet2d(self, image_2k2k): """Extract slitlet 2d image from image with original EMIR dimensions. Parameters ---------- image_2k2k : numpy array Original image (dimensions EMIR_NAXIS1 * EMIR_NAXIS2) Returns ------- slitlet2d : numpy arra...
['def', 'extract_slitlet2d', '(', 'self', ',', 'image_2k2k', ')', ':', '# protections', 'naxis2', ',', 'naxis1', '=', 'image_2k2k', '.', 'shape', 'if', 'naxis1', '!=', 'EMIR_NAXIS1', ':', 'raise', 'ValueError', '(', "'Unexpected naxis1'", ')', 'if', 'naxis2', '!=', 'EMIR_NAXIS2', ':', 'raise', 'ValueError', '(', "'Unex...
Extract slitlet 2d image from image with original EMIR dimensions. Parameters ---------- image_2k2k : numpy array Original image (dimensions EMIR_NAXIS1 * EMIR_NAXIS2) Returns ------- slitlet2d : numpy array Image corresponding to the slitlet reg...
['Extract', 'slitlet', '2d', 'image', 'from', 'image', 'with', 'original', 'EMIR', 'dimensions', '.']
train
https://github.com/guaix-ucm/pyemir/blob/fef6bbabcb13f80123cafd1800a0f508a3c21702/emirdrp/processing/wavecal/slitlet2d.py#L316-L351
8,683
noahbenson/neuropythy
neuropythy/geometry/util.py
prism_barycentric_coordinates
def prism_barycentric_coordinates(tri1, tri2, pt): ''' prism_barycentric_coordinates(tri1, tri2, point) yields a list of weights for each vertex in the given tetrahedron in the same order as the vertices given. If all weights are 0, then the point is not inside the tetrahedron. The returned weights ...
python
def prism_barycentric_coordinates(tri1, tri2, pt): ''' prism_barycentric_coordinates(tri1, tri2, point) yields a list of weights for each vertex in the given tetrahedron in the same order as the vertices given. If all weights are 0, then the point is not inside the tetrahedron. The returned weights ...
['def', 'prism_barycentric_coordinates', '(', 'tri1', ',', 'tri2', ',', 'pt', ')', ':', 'pt', '=', 'np', '.', 'asarray', '(', 'pt', ')', 'tri1', '=', 'np', '.', 'asarray', '(', 'tri1', ')', 'tri2', '=', 'np', '.', 'asarray', '(', 'tri2', ')', '(', 'tri1', ',', 'tri2', ')', '=', '[', '(', 'np', '.', 'transpose', '(', 't...
prism_barycentric_coordinates(tri1, tri2, point) yields a list of weights for each vertex in the given tetrahedron in the same order as the vertices given. If all weights are 0, then the point is not inside the tetrahedron. The returned weights are (a,b,d) in a numpy array; the values a, b, and c are ...
['prism_barycentric_coordinates', '(', 'tri1', 'tri2', 'point', ')', 'yields', 'a', 'list', 'of', 'weights', 'for', 'each', 'vertex', 'in', 'the', 'given', 'tetrahedron', 'in', 'the', 'same', 'order', 'as', 'the', 'vertices', 'given', '.', 'If', 'all', 'weights', 'are', '0', 'then', 'the', 'point', 'is', 'not', 'inside...
train
https://github.com/noahbenson/neuropythy/blob/b588889f6db36ddb9602ae4a72c1c0d3f41586b2/neuropythy/geometry/util.py#L693-L727
8,684
hozn/stravalib
stravalib/client.py
Client.get_gear
def get_gear(self, gear_id): """ Get details for an item of gear. http://strava.github.io/api/v3/gear/#show :param gear_id: The gear id. :type gear_id: str :return: The Bike or Shoe subclass object. :rtype: :class:`stravalib.model.Gear` """ retu...
python
def get_gear(self, gear_id): """ Get details for an item of gear. http://strava.github.io/api/v3/gear/#show :param gear_id: The gear id. :type gear_id: str :return: The Bike or Shoe subclass object. :rtype: :class:`stravalib.model.Gear` """ retu...
['def', 'get_gear', '(', 'self', ',', 'gear_id', ')', ':', 'return', 'model', '.', 'Gear', '.', 'deserialize', '(', 'self', '.', 'protocol', '.', 'get', '(', "'/gear/{id}'", ',', 'id', '=', 'gear_id', ')', ')']
Get details for an item of gear. http://strava.github.io/api/v3/gear/#show :param gear_id: The gear id. :type gear_id: str :return: The Bike or Shoe subclass object. :rtype: :class:`stravalib.model.Gear`
['Get', 'details', 'for', 'an', 'item', 'of', 'gear', '.']
train
https://github.com/hozn/stravalib/blob/5500ebc39e0bf4706bb1ca4c27b25e56becaaa5f/stravalib/client.py#L871-L883
8,685
atlassian-api/atlassian-python-api
atlassian/confluence.py
Confluence.delete_page_property
def delete_page_property(self, page_id, page_property): """ Delete the page (content) property e.g. delete key of hash :param page_id: content_id format :param page_property: key of property :return: """ url = 'rest/api/content/{page_id}/property/{page_property}'....
python
def delete_page_property(self, page_id, page_property): """ Delete the page (content) property e.g. delete key of hash :param page_id: content_id format :param page_property: key of property :return: """ url = 'rest/api/content/{page_id}/property/{page_property}'....
['def', 'delete_page_property', '(', 'self', ',', 'page_id', ',', 'page_property', ')', ':', 'url', '=', "'rest/api/content/{page_id}/property/{page_property}'", '.', 'format', '(', 'page_id', '=', 'page_id', ',', 'page_property', '=', 'str', '(', 'page_property', ')', ')', 'return', 'self', '.', 'delete', '(', 'path',...
Delete the page (content) property e.g. delete key of hash :param page_id: content_id format :param page_property: key of property :return:
['Delete', 'the', 'page', '(', 'content', ')', 'property', 'e', '.', 'g', '.', 'delete', 'key', 'of', 'hash', ':', 'param', 'page_id', ':', 'content_id', 'format', ':', 'param', 'page_property', ':', 'key', 'of', 'property', ':', 'return', ':']
train
https://github.com/atlassian-api/atlassian-python-api/blob/540d269905c3e7547b666fe30c647b2d512cf358/atlassian/confluence.py#L540-L549
8,686
Workiva/furious
furious/async.py
AsyncResult._payload_to_dict
def _payload_to_dict(self): """When an error status the payload is holding an AsyncException that is converted to a serializable dict. """ if self.status != self.ERROR or not self.payload: return self.payload import traceback return { "error": se...
python
def _payload_to_dict(self): """When an error status the payload is holding an AsyncException that is converted to a serializable dict. """ if self.status != self.ERROR or not self.payload: return self.payload import traceback return { "error": se...
['def', '_payload_to_dict', '(', 'self', ')', ':', 'if', 'self', '.', 'status', '!=', 'self', '.', 'ERROR', 'or', 'not', 'self', '.', 'payload', ':', 'return', 'self', '.', 'payload', 'import', 'traceback', 'return', '{', '"error"', ':', 'self', '.', 'payload', '.', 'error', ',', '"args"', ':', 'self', '.', 'payload', ...
When an error status the payload is holding an AsyncException that is converted to a serializable dict.
['When', 'an', 'error', 'status', 'the', 'payload', 'is', 'holding', 'an', 'AsyncException', 'that', 'is', 'converted', 'to', 'a', 'serializable', 'dict', '.']
train
https://github.com/Workiva/furious/blob/c29823ec8b98549e7439d7273aa064d1e5830632/furious/async.py#L574-L587
8,687
bitesofcode/projexui
projexui/menus/xrecentfilesmenu.py
XRecentFilesMenu.refresh
def refresh( self ): """ Clears out the actions for this menu and then loads the files. """ self.clear() for i, filename in enumerate(self.filenames()): name = '%i. %s' % (i+1, os.path.basename(filename)) action = self.addAction(name) ...
python
def refresh( self ): """ Clears out the actions for this menu and then loads the files. """ self.clear() for i, filename in enumerate(self.filenames()): name = '%i. %s' % (i+1, os.path.basename(filename)) action = self.addAction(name) ...
['def', 'refresh', '(', 'self', ')', ':', 'self', '.', 'clear', '(', ')', 'for', 'i', ',', 'filename', 'in', 'enumerate', '(', 'self', '.', 'filenames', '(', ')', ')', ':', 'name', '=', "'%i. %s'", '%', '(', 'i', '+', '1', ',', 'os', '.', 'path', '.', 'basename', '(', 'filename', ')', ')', 'action', '=', 'self', '.', '...
Clears out the actions for this menu and then loads the files.
['Clears', 'out', 'the', 'actions', 'for', 'this', 'menu', 'and', 'then', 'loads', 'the', 'files', '.']
train
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/menus/xrecentfilesmenu.py#L84-L93
8,688
jwkvam/bowtie
bowtie/_component.py
json_conversion
def json_conversion(obj: Any) -> JSON: """Encode additional objects to JSON.""" try: # numpy isn't an explicit dependency of bowtie # so we can't assume it's available import numpy as np if isinstance(obj, (np.ndarray, np.generic)): return obj.tolist() except Impo...
python
def json_conversion(obj: Any) -> JSON: """Encode additional objects to JSON.""" try: # numpy isn't an explicit dependency of bowtie # so we can't assume it's available import numpy as np if isinstance(obj, (np.ndarray, np.generic)): return obj.tolist() except Impo...
['def', 'json_conversion', '(', 'obj', ':', 'Any', ')', '->', 'JSON', ':', 'try', ':', "# numpy isn't an explicit dependency of bowtie", "# so we can't assume it's available", 'import', 'numpy', 'as', 'np', 'if', 'isinstance', '(', 'obj', ',', '(', 'np', '.', 'ndarray', ',', 'np', '.', 'generic', ')', ')', ':', 'return...
Encode additional objects to JSON.
['Encode', 'additional', 'objects', 'to', 'JSON', '.']
train
https://github.com/jwkvam/bowtie/blob/c494850671ac805bf186fbf2bdb07d2a34ae876d/bowtie/_component.py#L79-L108
8,689
LPgenerator/django-db-mailer
dbmail/providers/twilio/sms.py
send
def send(sms_to, sms_body, **kwargs): """ Site: https://www.twilio.com/ API: https://www.twilio.com/docs/api/rest/sending-messages """ headers = { "Content-type": "application/x-www-form-urlencoded", "User-Agent": "DBMail/%s" % get_version(), 'Authorization': 'Basic %s' % b64...
python
def send(sms_to, sms_body, **kwargs): """ Site: https://www.twilio.com/ API: https://www.twilio.com/docs/api/rest/sending-messages """ headers = { "Content-type": "application/x-www-form-urlencoded", "User-Agent": "DBMail/%s" % get_version(), 'Authorization': 'Basic %s' % b64...
['def', 'send', '(', 'sms_to', ',', 'sms_body', ',', '*', '*', 'kwargs', ')', ':', 'headers', '=', '{', '"Content-type"', ':', '"application/x-www-form-urlencoded"', ',', '"User-Agent"', ':', '"DBMail/%s"', '%', 'get_version', '(', ')', ',', "'Authorization'", ':', "'Basic %s'", '%', 'b64encode', '(', '"%s:%s"', '%', '...
Site: https://www.twilio.com/ API: https://www.twilio.com/docs/api/rest/sending-messages
['Site', ':', 'https', ':', '//', 'www', '.', 'twilio', '.', 'com', '/', 'API', ':', 'https', ':', '//', 'www', '.', 'twilio', '.', 'com', '/', 'docs', '/', 'api', '/', 'rest', '/', 'sending', '-', 'messages']
train
https://github.com/LPgenerator/django-db-mailer/blob/217a73c21ba5c6b68738f74b2c55a6dd2c1afe35/dbmail/providers/twilio/sms.py#L23-L55
8,690
google/apitools
apitools/gen/message_registry.py
MessageRegistry.WriteFile
def WriteFile(self, printer): """Write the messages file to out.""" self.Validate() extended_descriptor.WritePythonFile( self.__file_descriptor, self.__package, self.__client_info.version, printer)
python
def WriteFile(self, printer): """Write the messages file to out.""" self.Validate() extended_descriptor.WritePythonFile( self.__file_descriptor, self.__package, self.__client_info.version, printer)
['def', 'WriteFile', '(', 'self', ',', 'printer', ')', ':', 'self', '.', 'Validate', '(', ')', 'extended_descriptor', '.', 'WritePythonFile', '(', 'self', '.', '__file_descriptor', ',', 'self', '.', '__package', ',', 'self', '.', '__client_info', '.', 'version', ',', 'printer', ')']
Write the messages file to out.
['Write', 'the', 'messages', 'file', 'to', 'out', '.']
train
https://github.com/google/apitools/blob/f3745a7ea535aa0e88b0650c16479b696d6fd446/apitools/gen/message_registry.py#L120-L125
8,691
blockstack/blockstack-core
blockstack/lib/atlas.py
AtlasPeerCrawler.remove_unhealthy_peers
def remove_unhealthy_peers( self, count, con=None, path=None, peer_table=None, min_request_count=10, min_health=MIN_PEER_HEALTH ): """ Remove up to @count unhealthy peers Return the list of peers we removed """ if path is None: path = self.atlasdb_path ...
python
def remove_unhealthy_peers( self, count, con=None, path=None, peer_table=None, min_request_count=10, min_health=MIN_PEER_HEALTH ): """ Remove up to @count unhealthy peers Return the list of peers we removed """ if path is None: path = self.atlasdb_path ...
['def', 'remove_unhealthy_peers', '(', 'self', ',', 'count', ',', 'con', '=', 'None', ',', 'path', '=', 'None', ',', 'peer_table', '=', 'None', ',', 'min_request_count', '=', '10', ',', 'min_health', '=', 'MIN_PEER_HEALTH', ')', ':', 'if', 'path', 'is', 'None', ':', 'path', '=', 'self', '.', 'atlasdb_path', 'removed', ...
Remove up to @count unhealthy peers Return the list of peers we removed
['Remove', 'up', 'to']
train
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/atlas.py#L2836-L2860
8,692
spulec/moto
moto/cognitoidp/models.py
paginate
def paginate(limit, start_arg="next_token", limit_arg="max_results"): """Returns a limited result list, and an offset into list of remaining items Takes the next_token, and max_results kwargs given to a function and handles the slicing of the results. The kwarg `next_token` is the offset into the list ...
python
def paginate(limit, start_arg="next_token", limit_arg="max_results"): """Returns a limited result list, and an offset into list of remaining items Takes the next_token, and max_results kwargs given to a function and handles the slicing of the results. The kwarg `next_token` is the offset into the list ...
['def', 'paginate', '(', 'limit', ',', 'start_arg', '=', '"next_token"', ',', 'limit_arg', '=', '"max_results"', ')', ':', 'default_start', '=', '0', 'def', 'outer_wrapper', '(', 'func', ')', ':', '@', 'functools', '.', 'wraps', '(', 'func', ')', 'def', 'wrapper', '(', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 's...
Returns a limited result list, and an offset into list of remaining items Takes the next_token, and max_results kwargs given to a function and handles the slicing of the results. The kwarg `next_token` is the offset into the list to begin slicing from. `max_results` is the size of the result required ...
['Returns', 'a', 'limited', 'result', 'list', 'and', 'an', 'offset', 'into', 'list', 'of', 'remaining', 'items']
train
https://github.com/spulec/moto/blob/4a286c4bc288933bb023396e2784a6fdbb966bc9/moto/cognitoidp/models.py#L24-L54
8,693
softwarefactory-project/rdopkg
rdopkg/utils/specfile.py
Spec.get_magic_comment
def get_magic_comment(self, name, expand_macros=False): """Return a value of # name=value comment in spec or None.""" match = re.search(r'^#\s*?%s\s?=\s?(\S+)' % re.escape(name), self.txt, flags=re.M) if not match: return None val = match.group(1) ...
python
def get_magic_comment(self, name, expand_macros=False): """Return a value of # name=value comment in spec or None.""" match = re.search(r'^#\s*?%s\s?=\s?(\S+)' % re.escape(name), self.txt, flags=re.M) if not match: return None val = match.group(1) ...
['def', 'get_magic_comment', '(', 'self', ',', 'name', ',', 'expand_macros', '=', 'False', ')', ':', 'match', '=', 're', '.', 'search', '(', "r'^#\\s*?%s\\s?=\\s?(\\S+)'", '%', 're', '.', 'escape', '(', 'name', ')', ',', 'self', '.', 'txt', ',', 'flags', '=', 're', '.', 'M', ')', 'if', 'not', 'match', ':', 'return', 'N...
Return a value of # name=value comment in spec or None.
['Return', 'a', 'value', 'of', '#', 'name', '=', 'value', 'comment', 'in', 'spec', 'or', 'None', '.']
train
https://github.com/softwarefactory-project/rdopkg/blob/2d2bed4e7cd329558a36d0dd404ec4ac8f9f254c/rdopkg/utils/specfile.py#L272-L283
8,694
iqbal-lab-org/cluster_vcf_records
cluster_vcf_records/vcf_clusterer.py
VcfClusterer._expand_alts_in_vcf_record_list
def _expand_alts_in_vcf_record_list(cls, vcf_records): '''Input: list of vcf_records. Returns new list, where any records with >ALT is replaced with one vcf record per ALT. This doesn't change FORMAT or INFO columns, which means they are now broken for those records''' new_vcf_re...
python
def _expand_alts_in_vcf_record_list(cls, vcf_records): '''Input: list of vcf_records. Returns new list, where any records with >ALT is replaced with one vcf record per ALT. This doesn't change FORMAT or INFO columns, which means they are now broken for those records''' new_vcf_re...
['def', '_expand_alts_in_vcf_record_list', '(', 'cls', ',', 'vcf_records', ')', ':', 'new_vcf_records', '=', '[', ']', 'for', 'record', 'in', 'vcf_records', ':', 'new_vcf_records', '.', 'extend', '(', 'record', '.', 'to_record_per_alt', '(', ')', ')', 'return', 'new_vcf_records']
Input: list of vcf_records. Returns new list, where any records with >ALT is replaced with one vcf record per ALT. This doesn't change FORMAT or INFO columns, which means they are now broken for those records
['Input', ':', 'list', 'of', 'vcf_records', '.', 'Returns', 'new', 'list', 'where', 'any', 'records', 'with', '>', 'ALT', 'is', 'replaced', 'with', 'one', 'vcf', 'record', 'per', 'ALT', '.', 'This', 'doesn', 't', 'change', 'FORMAT', 'or', 'INFO', 'columns', 'which', 'means', 'they', 'are', 'now', 'broken', 'for', 'thos...
train
https://github.com/iqbal-lab-org/cluster_vcf_records/blob/0db26af36b6da97a7361364457d2152dc756055c/cluster_vcf_records/vcf_clusterer.py#L115-L123
8,695
hydraplatform/hydra-base
hydra_base/util/permissions.py
required_role
def required_role(req_role): """ Decorator applied to functions requiring caller to possess the specified role """ def dec_wrapper(wfunc): @wraps(wfunc) def wrapped(*args, **kwargs): user_id = kwargs.get("user_id") try: res = db.DBSession.query...
python
def required_role(req_role): """ Decorator applied to functions requiring caller to possess the specified role """ def dec_wrapper(wfunc): @wraps(wfunc) def wrapped(*args, **kwargs): user_id = kwargs.get("user_id") try: res = db.DBSession.query...
['def', 'required_role', '(', 'req_role', ')', ':', 'def', 'dec_wrapper', '(', 'wfunc', ')', ':', '@', 'wraps', '(', 'wfunc', ')', 'def', 'wrapped', '(', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'user_id', '=', 'kwargs', '.', 'get', '(', '"user_id"', ')', 'try', ':', 'res', '=', 'db', '.', 'DBSession', '.', 'que...
Decorator applied to functions requiring caller to possess the specified role
['Decorator', 'applied', 'to', 'functions', 'requiring', 'caller', 'to', 'possess', 'the', 'specified', 'role']
train
https://github.com/hydraplatform/hydra-base/blob/9251ff7946505f7a272c87837390acd1c435bc6e/hydra_base/util/permissions.py#L70-L87
8,696
Demonware/jose
jose.py
legacy_decrypt
def legacy_decrypt(jwe, jwk, adata='', validate_claims=True, expiry_seconds=None): """ Decrypts a deserialized :class:`~jose.JWE` :param jwe: An instance of :class:`~jose.JWE` :param jwk: A `dict` representing the JWK required to decrypt the content of the :class:`~jose.J...
python
def legacy_decrypt(jwe, jwk, adata='', validate_claims=True, expiry_seconds=None): """ Decrypts a deserialized :class:`~jose.JWE` :param jwe: An instance of :class:`~jose.JWE` :param jwk: A `dict` representing the JWK required to decrypt the content of the :class:`~jose.J...
['def', 'legacy_decrypt', '(', 'jwe', ',', 'jwk', ',', 'adata', '=', "''", ',', 'validate_claims', '=', 'True', ',', 'expiry_seconds', '=', 'None', ')', ':', 'protected_header', ',', 'encrypted_key', ',', 'iv', ',', 'ciphertext', ',', 'authentication_tag', '=', 'map', '(', 'b64decode_url', ',', 'jwe', ')', 'header', '=...
Decrypts a deserialized :class:`~jose.JWE` :param jwe: An instance of :class:`~jose.JWE` :param jwk: A `dict` representing the JWK required to decrypt the content of the :class:`~jose.JWE`. :param adata: Arbitrary string data used during encryption for additional authentic...
['Decrypts', 'a', 'deserialized', ':', 'class', ':', '~jose', '.', 'JWE']
train
https://github.com/Demonware/jose/blob/5835ec9c9fcab17eddea3c3169881ec12df552d4/jose.py#L315-L380
8,697
saltstack/salt
salt/modules/iosconfig.py
merge_text
def merge_text(initial_config=None, initial_path=None, merge_config=None, merge_path=None, saltenv='base'): ''' Return the merge result of the ``initial_config`` with the ``merge_config``, as plain text. initial_config The initial conf...
python
def merge_text(initial_config=None, initial_path=None, merge_config=None, merge_path=None, saltenv='base'): ''' Return the merge result of the ``initial_config`` with the ``merge_config``, as plain text. initial_config The initial conf...
['def', 'merge_text', '(', 'initial_config', '=', 'None', ',', 'initial_path', '=', 'None', ',', 'merge_config', '=', 'None', ',', 'merge_path', '=', 'None', ',', 'saltenv', '=', "'base'", ')', ':', 'candidate_tree', '=', 'merge_tree', '(', 'initial_config', '=', 'initial_config', ',', 'initial_path', '=', 'initial_pat...
Return the merge result of the ``initial_config`` with the ``merge_config``, as plain text. initial_config The initial configuration sent as text. This argument is ignored when ``initial_path`` is set. initial_path Absolute or remote path from where to load the initial configuratio...
['Return', 'the', 'merge', 'result', 'of', 'the', 'initial_config', 'with', 'the', 'merge_config', 'as', 'plain', 'text', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/iosconfig.py#L261-L305
8,698
libtcod/python-tcod
tdl/__init__.py
_format_char
def _format_char(char): """Prepares a single character for passing to ctypes calls, needs to return an integer but can also pass None which will keep the current character instead of overwriting it. This is called often and needs to be optimized whenever possible. """ if char is None: r...
python
def _format_char(char): """Prepares a single character for passing to ctypes calls, needs to return an integer but can also pass None which will keep the current character instead of overwriting it. This is called often and needs to be optimized whenever possible. """ if char is None: r...
['def', '_format_char', '(', 'char', ')', ':', 'if', 'char', 'is', 'None', ':', 'return', '-', '1', 'if', 'isinstance', '(', 'char', ',', '_STRTYPES', ')', 'and', 'len', '(', 'char', ')', '==', '1', ':', 'return', 'ord', '(', 'char', ')', 'try', ':', 'return', 'int', '(', 'char', ')', '# allow all int-like objects', 'e...
Prepares a single character for passing to ctypes calls, needs to return an integer but can also pass None which will keep the current character instead of overwriting it. This is called often and needs to be optimized whenever possible.
['Prepares', 'a', 'single', 'character', 'for', 'passing', 'to', 'ctypes', 'calls', 'needs', 'to', 'return', 'an', 'integer', 'but', 'can', 'also', 'pass', 'None', 'which', 'will', 'keep', 'the', 'current', 'character', 'instead', 'of', 'overwriting', 'it', '.']
train
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tdl/__init__.py#L101-L115
8,699
boriel/zxbasic
zxbparser.py
p_bexpr_func
def p_bexpr_func(p): """ bexpr : ID bexpr """ args = make_arg_list(make_argument(p[2], p.lineno(2))) p[0] = make_call(p[1], p.lineno(1), args) if p[0] is None: return if p[0].token in ('STRSLICE', 'VAR', 'STRING'): entry = SYMBOL_TABLE.access_call(p[1], p.lineno(1)) entr...
python
def p_bexpr_func(p): """ bexpr : ID bexpr """ args = make_arg_list(make_argument(p[2], p.lineno(2))) p[0] = make_call(p[1], p.lineno(1), args) if p[0] is None: return if p[0].token in ('STRSLICE', 'VAR', 'STRING'): entry = SYMBOL_TABLE.access_call(p[1], p.lineno(1)) entr...
['def', 'p_bexpr_func', '(', 'p', ')', ':', 'args', '=', 'make_arg_list', '(', 'make_argument', '(', 'p', '[', '2', ']', ',', 'p', '.', 'lineno', '(', '2', ')', ')', ')', 'p', '[', '0', ']', '=', 'make_call', '(', 'p', '[', '1', ']', ',', 'p', '.', 'lineno', '(', '1', ')', ',', 'args', ')', 'if', 'p', '[', '0', ']', 'i...
bexpr : ID bexpr
['bexpr', ':', 'ID', 'bexpr']
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L2696-L2713