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,800
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_0/security/security_client.py
SecurityClient.has_permissions_batch
def has_permissions_batch(self, eval_batch): """HasPermissionsBatch. Evaluates multiple permissions for the calling user. Note: This method does not aggregate the results, nor does it short-circuit if one of the permissions evaluates to false. :param :class:`<PermissionEvaluationBatch> <azure.d...
python
def has_permissions_batch(self, eval_batch): """HasPermissionsBatch. Evaluates multiple permissions for the calling user. Note: This method does not aggregate the results, nor does it short-circuit if one of the permissions evaluates to false. :param :class:`<PermissionEvaluationBatch> <azure.d...
['def', 'has_permissions_batch', '(', 'self', ',', 'eval_batch', ')', ':', 'content', '=', 'self', '.', '_serialize', '.', 'body', '(', 'eval_batch', ',', "'PermissionEvaluationBatch'", ')', 'response', '=', 'self', '.', '_send', '(', 'http_method', '=', "'POST'", ',', 'location_id', '=', "'cf1faa59-1b63-4448-bf04-13d9...
HasPermissionsBatch. Evaluates multiple permissions for the calling user. Note: This method does not aggregate the results, nor does it short-circuit if one of the permissions evaluates to false. :param :class:`<PermissionEvaluationBatch> <azure.devops.v5_0.security.models.PermissionEvaluationBatch>` e...
['HasPermissionsBatch', '.', 'Evaluates', 'multiple', 'permissions', 'for', 'the', 'calling', 'user', '.', 'Note', ':', 'This', 'method', 'does', 'not', 'aggregate', 'the', 'results', 'nor', 'does', 'it', 'short', '-', 'circuit', 'if', 'one', 'of', 'the', 'permissions', 'evaluates', 'to', 'false', '.', ':', 'param', ':...
train
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_0/security/security_client.py#L137-L148
8,801
CI-WATER/mapkit
mapkit/ColorRampGenerator.py
MappedColorRamp.getColorMapAsContinuousSLD
def getColorMapAsContinuousSLD(self, nodata=-9999): """ Return the mapped color ramp as a :rtype: str """ colorMap = ET.Element('ColorMap', type='interval') # Add a line for the no-data values (nv) ET.SubElement(colorMap, 'ColorMapEntry', color='#000000', quantit...
python
def getColorMapAsContinuousSLD(self, nodata=-9999): """ Return the mapped color ramp as a :rtype: str """ colorMap = ET.Element('ColorMap', type='interval') # Add a line for the no-data values (nv) ET.SubElement(colorMap, 'ColorMapEntry', color='#000000', quantit...
['def', 'getColorMapAsContinuousSLD', '(', 'self', ',', 'nodata', '=', '-', '9999', ')', ':', 'colorMap', '=', 'ET', '.', 'Element', '(', "'ColorMap'", ',', 'type', '=', "'interval'", ')', '# Add a line for the no-data values (nv)', 'ET', '.', 'SubElement', '(', 'colorMap', ',', "'ColorMapEntry'", ',', 'color', '=', "'...
Return the mapped color ramp as a :rtype: str
['Return', 'the', 'mapped', 'color', 'ramp', 'as', 'a', ':', 'rtype', ':', 'str']
train
https://github.com/CI-WATER/mapkit/blob/ce5fbded6af7adabdf1eec85631c6811ef8ecc34/mapkit/ColorRampGenerator.py#L115-L161
8,802
radjkarl/imgProcessor
imgProcessor/camera/LensDistortion.py
LensDistortion.getCameraParams
def getCameraParams(self): ''' value positions based on http://docs.opencv.org/modules/imgproc/doc/geometric_transformations.html#cv.InitUndistortRectifyMap ''' c = self.coeffs['cameraMatrix'] fx = c[0][0] fy = c[1][1] cx = c[0][2] cy = c...
python
def getCameraParams(self): ''' value positions based on http://docs.opencv.org/modules/imgproc/doc/geometric_transformations.html#cv.InitUndistortRectifyMap ''' c = self.coeffs['cameraMatrix'] fx = c[0][0] fy = c[1][1] cx = c[0][2] cy = c...
['def', 'getCameraParams', '(', 'self', ')', ':', 'c', '=', 'self', '.', 'coeffs', '[', "'cameraMatrix'", ']', 'fx', '=', 'c', '[', '0', ']', '[', '0', ']', 'fy', '=', 'c', '[', '1', ']', '[', '1', ']', 'cx', '=', 'c', '[', '0', ']', '[', '2', ']', 'cy', '=', 'c', '[', '1', ']', '[', '2', ']', 'k1', ',', 'k2', ',', 'p1...
value positions based on http://docs.opencv.org/modules/imgproc/doc/geometric_transformations.html#cv.InitUndistortRectifyMap
['value', 'positions', 'based', 'on', 'http', ':', '//', 'docs', '.', 'opencv', '.', 'org', '/', 'modules', '/', 'imgproc', '/', 'doc', '/', 'geometric_transformations', '.', 'html#cv', '.', 'InitUndistortRectifyMap']
train
https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/camera/LensDistortion.py#L360-L371
8,803
emdb-empiar/ahds
ahds/data_stream.py
ImageSet.segments
def segments(self): """A dictionary of lists of contours keyed by z-index""" segments = dict() for i in xrange(len(self)): image = self[i] for z, contour in image.as_segments.iteritems(): for byte_value, contour_set in contour.iteritems(): ...
python
def segments(self): """A dictionary of lists of contours keyed by z-index""" segments = dict() for i in xrange(len(self)): image = self[i] for z, contour in image.as_segments.iteritems(): for byte_value, contour_set in contour.iteritems(): ...
['def', 'segments', '(', 'self', ')', ':', 'segments', '=', 'dict', '(', ')', 'for', 'i', 'in', 'xrange', '(', 'len', '(', 'self', ')', ')', ':', 'image', '=', 'self', '[', 'i', ']', 'for', 'z', ',', 'contour', 'in', 'image', '.', 'as_segments', '.', 'iteritems', '(', ')', ':', 'for', 'byte_value', ',', 'contour_set', ...
A dictionary of lists of contours keyed by z-index
['A', 'dictionary', 'of', 'lists', 'of', 'contours', 'keyed', 'by', 'z', '-', 'index']
train
https://github.com/emdb-empiar/ahds/blob/6a752f6806d4f62155cd2e1194de8aabe7195e0f/ahds/data_stream.py#L242-L256
8,804
awslabs/aws-cfn-template-flip
cfn_flip/__init__.py
dump_yaml
def dump_yaml(data, clean_up=False, long_form=False): """ Output some YAML """ return yaml.dump( data, Dumper=get_dumper(clean_up, long_form), default_flow_style=False, allow_unicode=True )
python
def dump_yaml(data, clean_up=False, long_form=False): """ Output some YAML """ return yaml.dump( data, Dumper=get_dumper(clean_up, long_form), default_flow_style=False, allow_unicode=True )
['def', 'dump_yaml', '(', 'data', ',', 'clean_up', '=', 'False', ',', 'long_form', '=', 'False', ')', ':', 'return', 'yaml', '.', 'dump', '(', 'data', ',', 'Dumper', '=', 'get_dumper', '(', 'clean_up', ',', 'long_form', ')', ',', 'default_flow_style', '=', 'False', ',', 'allow_unicode', '=', 'True', ')']
Output some YAML
['Output', 'some', 'YAML']
train
https://github.com/awslabs/aws-cfn-template-flip/blob/837576bea243e3f5efb0a20b84802371272e2d33/cfn_flip/__init__.py#L37-L47
8,805
raiden-network/raiden
raiden/transfer/mediated_transfer/mediator.py
sanity_check
def sanity_check( state: MediatorTransferState, channelidentifiers_to_channels: ChannelMap, ) -> None: """ Check invariants that must hold. """ # if a transfer is paid we must know the secret all_transfers_states = itertools.chain( (pair.payee_state for pair in state.transfers_pair)...
python
def sanity_check( state: MediatorTransferState, channelidentifiers_to_channels: ChannelMap, ) -> None: """ Check invariants that must hold. """ # if a transfer is paid we must know the secret all_transfers_states = itertools.chain( (pair.payee_state for pair in state.transfers_pair)...
['def', 'sanity_check', '(', 'state', ':', 'MediatorTransferState', ',', 'channelidentifiers_to_channels', ':', 'ChannelMap', ',', ')', '->', 'None', ':', '# if a transfer is paid we must know the secret', 'all_transfers_states', '=', 'itertools', '.', 'chain', '(', '(', 'pair', '.', 'payee_state', 'for', 'pair', 'in',...
Check invariants that must hold.
['Check', 'invariants', 'that', 'must', 'hold', '.']
train
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/mediated_transfer/mediator.py#L293-L365
8,806
lawsie/guizero
guizero/ButtonGroup.py
ButtonGroup.append
def append(self, option): """ Appends a new `option` to the end of the ButtonGroup. :param string/List option: The option to append to the ButtonGroup. If a 2D list is specified, the first element is the text, the second is the value. """ self._options.ap...
python
def append(self, option): """ Appends a new `option` to the end of the ButtonGroup. :param string/List option: The option to append to the ButtonGroup. If a 2D list is specified, the first element is the text, the second is the value. """ self._options.ap...
['def', 'append', '(', 'self', ',', 'option', ')', ':', 'self', '.', '_options', '.', 'append', '(', 'self', '.', '_parse_option', '(', 'option', ')', ')', 'self', '.', '_refresh_options', '(', ')', 'self', '.', 'resize', '(', 'self', '.', '_width', ',', 'self', '.', '_height', ')']
Appends a new `option` to the end of the ButtonGroup. :param string/List option: The option to append to the ButtonGroup. If a 2D list is specified, the first element is the text, the second is the value.
['Appends', 'a', 'new', 'option', 'to', 'the', 'end', 'of', 'the', 'ButtonGroup', '.']
train
https://github.com/lawsie/guizero/blob/84c7f0b314fa86f9fc88eb11c9a0f6c4b57155e2/guizero/ButtonGroup.py#L235-L245
8,807
llazzaro/analyzerdam
analyzerdam/sqlDAM.py
SqlDAM.write_fundamental
def write_fundamental(self, keyTimeValueDict): ''' write fundamental ''' if self.first: Base.metadata.create_all(self.__getEngine(), checkfirst=True) self.first=False sqls=self._fundamentalToSqls(keyTimeValueDict) session=self.Session() try: ...
python
def write_fundamental(self, keyTimeValueDict): ''' write fundamental ''' if self.first: Base.metadata.create_all(self.__getEngine(), checkfirst=True) self.first=False sqls=self._fundamentalToSqls(keyTimeValueDict) session=self.Session() try: ...
['def', 'write_fundamental', '(', 'self', ',', 'keyTimeValueDict', ')', ':', 'if', 'self', '.', 'first', ':', 'Base', '.', 'metadata', '.', 'create_all', '(', 'self', '.', '__getEngine', '(', ')', ',', 'checkfirst', '=', 'True', ')', 'self', '.', 'first', '=', 'False', 'sqls', '=', 'self', '.', '_fundamentalToSqls', '(...
write fundamental
['write', 'fundamental']
train
https://github.com/llazzaro/analyzerdam/blob/c5bc7483dae23bd2e14bbf36147b7a43a0067bc0/analyzerdam/sqlDAM.py#L181-L192
8,808
happyleavesaoc/python-voobly
utils/update_metadata.py
get_ladder_metadata
def get_ladder_metadata(session, url): """Get ladder metadata.""" parsed = make_scrape_request(session, url) tag = parsed.find('a', href=re.compile(LADDER_ID_REGEX)) return { 'id': int(tag['href'].split('/')[-1]), 'slug': url.split('/')[-1], 'url': url }
python
def get_ladder_metadata(session, url): """Get ladder metadata.""" parsed = make_scrape_request(session, url) tag = parsed.find('a', href=re.compile(LADDER_ID_REGEX)) return { 'id': int(tag['href'].split('/')[-1]), 'slug': url.split('/')[-1], 'url': url }
['def', 'get_ladder_metadata', '(', 'session', ',', 'url', ')', ':', 'parsed', '=', 'make_scrape_request', '(', 'session', ',', 'url', ')', 'tag', '=', 'parsed', '.', 'find', '(', "'a'", ',', 'href', '=', 're', '.', 'compile', '(', 'LADDER_ID_REGEX', ')', ')', 'return', '{', "'id'", ':', 'int', '(', 'tag', '[', "'href'...
Get ladder metadata.
['Get', 'ladder', 'metadata', '.']
train
https://github.com/happyleavesaoc/python-voobly/blob/83b4ab7d630a00459c2a64e55e3ac85c7be38194/utils/update_metadata.py#L14-L22
8,809
fbcotter/py3nvml
py3nvml/py3nvml.py
nvmlDeviceGetPcieThroughput
def nvmlDeviceGetPcieThroughput(device, counter): r""" /** * Retrieve PCIe utilization information. * This function is querying a byte counter over a 20ms interval and thus is the * PCIe throughput over that interval. * * For Maxwell &tm; or newer fully supported devices. * ...
python
def nvmlDeviceGetPcieThroughput(device, counter): r""" /** * Retrieve PCIe utilization information. * This function is querying a byte counter over a 20ms interval and thus is the * PCIe throughput over that interval. * * For Maxwell &tm; or newer fully supported devices. * ...
['def', 'nvmlDeviceGetPcieThroughput', '(', 'device', ',', 'counter', ')', ':', 'c_util', '=', 'c_uint', '(', ')', 'fn', '=', '_nvmlGetFunctionPointer', '(', '"nvmlDeviceGetPcieThroughput"', ')', 'ret', '=', 'fn', '(', 'device', ',', '_nvmlPcieUtilCounter_t', '(', 'counter', ')', ',', 'byref', '(', 'c_util', ')', ')', ...
r""" /** * Retrieve PCIe utilization information. * This function is querying a byte counter over a 20ms interval and thus is the * PCIe throughput over that interval. * * For Maxwell &tm; or newer fully supported devices. * * This method is not supported in virtual machines run...
['r', '/', '**', '*', 'Retrieve', 'PCIe', 'utilization', 'information', '.', '*', 'This', 'function', 'is', 'querying', 'a', 'byte', 'counter', 'over', 'a', '20ms', 'interval', 'and', 'thus', 'is', 'the', '*', 'PCIe', 'throughput', 'over', 'that', 'interval', '.', '*', '*', 'For', 'Maxwell', '&tm', ';', 'or', 'newer', ...
train
https://github.com/fbcotter/py3nvml/blob/47f0f2c0eee56dec4e4beebec26b734e01d357b7/py3nvml/py3nvml.py#L5263-L5292
8,810
Cognexa/cxflow
cxflow/cli/common.py
run
def run(config: dict, output_root: str, restore_from: str=None, eval: Optional[str]=None) -> None: """ Run **cxflow** training configured by the passed `config`. Unique ``output_dir`` for this training is created under the given ``output_root`` dir wherein all the training outputs are saved. The output...
python
def run(config: dict, output_root: str, restore_from: str=None, eval: Optional[str]=None) -> None: """ Run **cxflow** training configured by the passed `config`. Unique ``output_dir`` for this training is created under the given ``output_root`` dir wherein all the training outputs are saved. The output...
['def', 'run', '(', 'config', ':', 'dict', ',', 'output_root', ':', 'str', ',', 'restore_from', ':', 'str', '=', 'None', ',', 'eval', ':', 'Optional', '[', 'str', ']', '=', 'None', ')', '->', 'None', ':', 'output_dir', '=', 'dataset', '=', 'model', '=', 'hooks', '=', 'main_loop', '=', 'None', 'try', ':', 'output_dir', ...
Run **cxflow** training configured by the passed `config`. Unique ``output_dir`` for this training is created under the given ``output_root`` dir wherein all the training outputs are saved. The output dir name will be roughly ``[model.name]_[time]``. The training procedure consists of the following steps:...
['Run', '**', 'cxflow', '**', 'training', 'configured', 'by', 'the', 'passed', 'config', '.']
train
https://github.com/Cognexa/cxflow/blob/dd609e6b0bd854424a8f86781dd77801a13038f9/cxflow/cli/common.py#L215-L309
8,811
PeerAssets/pypeerassets
pypeerassets/pautils.py
load_p2th_privkey_into_local_node
def load_p2th_privkey_into_local_node(provider: RpcNode, prod: bool=True) -> None: '''Load PeerAssets P2TH privkey into the local node.''' assert isinstance(provider, RpcNode), {"error": "Import only works with local node."} error = {"error": "Loading P2TH privkey failed."} pa_params = param_query(prov...
python
def load_p2th_privkey_into_local_node(provider: RpcNode, prod: bool=True) -> None: '''Load PeerAssets P2TH privkey into the local node.''' assert isinstance(provider, RpcNode), {"error": "Import only works with local node."} error = {"error": "Loading P2TH privkey failed."} pa_params = param_query(prov...
['def', 'load_p2th_privkey_into_local_node', '(', 'provider', ':', 'RpcNode', ',', 'prod', ':', 'bool', '=', 'True', ')', '->', 'None', ':', 'assert', 'isinstance', '(', 'provider', ',', 'RpcNode', ')', ',', '{', '"error"', ':', '"Import only works with local node."', '}', 'error', '=', '{', '"error"', ':', '"Loading P...
Load PeerAssets P2TH privkey into the local node.
['Load', 'PeerAssets', 'P2TH', 'privkey', 'into', 'the', 'local', 'node', '.']
train
https://github.com/PeerAssets/pypeerassets/blob/8927b4a686887f44fe2cd9de777e2c827c948987/pypeerassets/pautils.py#L30-L45
8,812
johntruckenbrodt/spatialist
spatialist/raster.py
Raster.res
def res(self): """ the raster resolution in x and y direction Returns ------- tuple (xres, yres) """ return (abs(float(self.geo['xres'])), abs(float(self.geo['yres'])))
python
def res(self): """ the raster resolution in x and y direction Returns ------- tuple (xres, yres) """ return (abs(float(self.geo['xres'])), abs(float(self.geo['yres'])))
['def', 'res', '(', 'self', ')', ':', 'return', '(', 'abs', '(', 'float', '(', 'self', '.', 'geo', '[', "'xres'", ']', ')', ')', ',', 'abs', '(', 'float', '(', 'self', '.', 'geo', '[', "'yres'", ']', ')', ')', ')']
the raster resolution in x and y direction Returns ------- tuple (xres, yres)
['the', 'raster', 'resolution', 'in', 'x', 'and', 'y', 'direction']
train
https://github.com/johntruckenbrodt/spatialist/blob/007f49296a156de8d7168ad235b5a5b8e8d3633d/spatialist/raster.py#L721-L730
8,813
farshidce/touchworks-python
touchworks/api/http.py
TouchWorks._http_request
def _http_request(self, api, data, headers=None): """ internal method for handling request and response and raising an exception is http return status code is not success :rtype : response object from requests.post() """ if not headers: headers = {'Content-Ty...
python
def _http_request(self, api, data, headers=None): """ internal method for handling request and response and raising an exception is http return status code is not success :rtype : response object from requests.post() """ if not headers: headers = {'Content-Ty...
['def', '_http_request', '(', 'self', ',', 'api', ',', 'data', ',', 'headers', '=', 'None', ')', ':', 'if', 'not', 'headers', ':', 'headers', '=', '{', "'Content-Type'", ':', "'application/json'", '}', 'if', 'not', 'self', '.', '_token_valid', ':', 'self', '.', '_token', '=', 'self', '.', 'get_token', '(', 'self', '.',...
internal method for handling request and response and raising an exception is http return status code is not success :rtype : response object from requests.post()
['internal', 'method', 'for', 'handling', 'request', 'and', 'response', 'and', 'raising', 'an', 'exception', 'is', 'http', 'return', 'status', 'code', 'is', 'not', 'success']
train
https://github.com/farshidce/touchworks-python/blob/ea8f93a0f4273de1317a318e945a571f5038ba62/touchworks/api/http.py#L178-L195
8,814
polyaxon/polyaxon
polyaxon/api/experiments/serializers.py
ExperimentCreateSerializer.validate_config
def validate_config(self, config): """We only validate the config if passed. Also we use the ExperimentSpecification to check if this config was intended as an experiment. """ # config is optional if not config: return config spec = validate_experime...
python
def validate_config(self, config): """We only validate the config if passed. Also we use the ExperimentSpecification to check if this config was intended as an experiment. """ # config is optional if not config: return config spec = validate_experime...
['def', 'validate_config', '(', 'self', ',', 'config', ')', ':', '# config is optional', 'if', 'not', 'config', ':', 'return', 'config', 'spec', '=', 'validate_experiment_spec_config', '(', 'config', ')', 'if', 'spec', '.', 'is_experiment', ':', '# Resume normal creation', 'return', 'config', '# Raise an error to tell ...
We only validate the config if passed. Also we use the ExperimentSpecification to check if this config was intended as an experiment.
['We', 'only', 'validate', 'the', 'config', 'if', 'passed', '.']
train
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/api/experiments/serializers.py#L269-L288
8,815
jsfenfen/990-xml-reader
irs_reader/file_utils.py
validate_object_id
def validate_object_id(object_id): """ It's easy to make a mistake entering these, validate the format """ result = re.match(OBJECT_ID_RE, str(object_id)) if not result: print("'%s' appears not to be a valid 990 object_id" % object_id) raise RuntimeError(OBJECT_ID_MSG) return object_id
python
def validate_object_id(object_id): """ It's easy to make a mistake entering these, validate the format """ result = re.match(OBJECT_ID_RE, str(object_id)) if not result: print("'%s' appears not to be a valid 990 object_id" % object_id) raise RuntimeError(OBJECT_ID_MSG) return object_id
['def', 'validate_object_id', '(', 'object_id', ')', ':', 'result', '=', 're', '.', 'match', '(', 'OBJECT_ID_RE', ',', 'str', '(', 'object_id', ')', ')', 'if', 'not', 'result', ':', 'print', '(', '"\'%s\' appears not to be a valid 990 object_id"', '%', 'object_id', ')', 'raise', 'RuntimeError', '(', 'OBJECT_ID_MSG', ')...
It's easy to make a mistake entering these, validate the format
['It', 's', 'easy', 'to', 'make', 'a', 'mistake', 'entering', 'these', 'validate', 'the', 'format']
train
https://github.com/jsfenfen/990-xml-reader/blob/00020529b789081329a31a2e30b5ee729ce7596a/irs_reader/file_utils.py#L42-L48
8,816
googleapis/google-cloud-python
api_core/google/api_core/gapic_v1/config.py
_retry_from_retry_config
def _retry_from_retry_config(retry_params, retry_codes): """Creates a Retry object given a gapic retry configuration. Args: retry_params (dict): The retry parameter values, for example:: { "initial_retry_delay_millis": 1000, "retry_delay_multiplier": 2.5, ...
python
def _retry_from_retry_config(retry_params, retry_codes): """Creates a Retry object given a gapic retry configuration. Args: retry_params (dict): The retry parameter values, for example:: { "initial_retry_delay_millis": 1000, "retry_delay_multiplier": 2.5, ...
['def', '_retry_from_retry_config', '(', 'retry_params', ',', 'retry_codes', ')', ':', 'exception_classes', '=', '[', '_exception_class_for_grpc_status_name', '(', 'code', ')', 'for', 'code', 'in', 'retry_codes', ']', 'return', 'retry', '.', 'Retry', '(', 'retry', '.', 'if_exception_type', '(', '*', 'exception_classes'...
Creates a Retry object given a gapic retry configuration. Args: retry_params (dict): The retry parameter values, for example:: { "initial_retry_delay_millis": 1000, "retry_delay_multiplier": 2.5, "max_retry_delay_millis": 120000, ...
['Creates', 'a', 'Retry', 'object', 'given', 'a', 'gapic', 'retry', 'configuration', '.']
train
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/gapic_v1/config.py#L48-L79
8,817
JukeboxPipeline/jukebox-core
src/jukeboxcore/addons/guerilla/guerillamgmt.py
GuerillaMGMTWin.task_view_user
def task_view_user(self, ): """View the user that is currently selected :returns: None :rtype: None :raises: None """ if not self.cur_task: return i = self.task_user_tablev.currentIndex() item = i.internalPointer() if item: ...
python
def task_view_user(self, ): """View the user that is currently selected :returns: None :rtype: None :raises: None """ if not self.cur_task: return i = self.task_user_tablev.currentIndex() item = i.internalPointer() if item: ...
['def', 'task_view_user', '(', 'self', ',', ')', ':', 'if', 'not', 'self', '.', 'cur_task', ':', 'return', 'i', '=', 'self', '.', 'task_user_tablev', '.', 'currentIndex', '(', ')', 'item', '=', 'i', '.', 'internalPointer', '(', ')', 'if', 'item', ':', 'user', '=', 'item', '.', 'internal_data', '(', ')', 'self', '.', 'v...
View the user that is currently selected :returns: None :rtype: None :raises: None
['View', 'the', 'user', 'that', 'is', 'currently', 'selected']
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/addons/guerilla/guerillamgmt.py#L2224-L2237
8,818
DataDog/integrations-core
datadog_checks_base/datadog_checks/base/checks/libs/thread_pool.py
ApplyResult.get
def get(self, timeout=None): """ Returns the result when it arrives. If timeout is not None and the result does not arrive within timeout seconds then TimeoutError is raised. If the remote call raised an exception then that exception will be reraised by get(). """ ...
python
def get(self, timeout=None): """ Returns the result when it arrives. If timeout is not None and the result does not arrive within timeout seconds then TimeoutError is raised. If the remote call raised an exception then that exception will be reraised by get(). """ ...
['def', 'get', '(', 'self', ',', 'timeout', '=', 'None', ')', ':', 'if', 'not', 'self', '.', 'wait', '(', 'timeout', ')', ':', 'raise', 'TimeoutError', '(', '"Result not available within %fs"', '%', 'timeout', ')', 'if', 'self', '.', '_success', ':', 'return', 'self', '.', '_data', 'raise', 'self', '.', '_data', '[', '...
Returns the result when it arrives. If timeout is not None and the result does not arrive within timeout seconds then TimeoutError is raised. If the remote call raised an exception then that exception will be reraised by get().
['Returns', 'the', 'result', 'when', 'it', 'arrives', '.', 'If', 'timeout', 'is', 'not', 'None', 'and', 'the', 'result', 'does', 'not', 'arrive', 'within', 'timeout', 'seconds', 'then', 'TimeoutError', 'is', 'raised', '.', 'If', 'the', 'remote', 'call', 'raised', 'an', 'exception', 'then', 'that', 'exception', 'will', ...
train
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/checks/libs/thread_pool.py#L349-L360
8,819
apache/spark
python/pyspark/streaming/dstream.py
DStream.countByValueAndWindow
def countByValueAndWindow(self, windowDuration, slideDuration, numPartitions=None): """ Return a new DStream in which each RDD contains the count of distinct elements in RDDs in a sliding window over this DStream. @param windowDuration: width of the window; must be a multiple of this DS...
python
def countByValueAndWindow(self, windowDuration, slideDuration, numPartitions=None): """ Return a new DStream in which each RDD contains the count of distinct elements in RDDs in a sliding window over this DStream. @param windowDuration: width of the window; must be a multiple of this DS...
['def', 'countByValueAndWindow', '(', 'self', ',', 'windowDuration', ',', 'slideDuration', ',', 'numPartitions', '=', 'None', ')', ':', 'keyed', '=', 'self', '.', 'map', '(', 'lambda', 'x', ':', '(', 'x', ',', '1', ')', ')', 'counted', '=', 'keyed', '.', 'reduceByKeyAndWindow', '(', 'operator', '.', 'add', ',', 'operat...
Return a new DStream in which each RDD contains the count of distinct elements in RDDs in a sliding window over this DStream. @param windowDuration: width of the window; must be a multiple of this DStream's batching interval @param slideDuration: sliding interval ...
['Return', 'a', 'new', 'DStream', 'in', 'which', 'each', 'RDD', 'contains', 'the', 'count', 'of', 'distinct', 'elements', 'in', 'RDDs', 'in', 'a', 'sliding', 'window', 'over', 'this', 'DStream', '.']
train
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/streaming/dstream.py#L485-L500
8,820
numenta/htmresearch
projects/l2_pooling/topology_experiments.py
plotConvergenceByDistantConnectionChance
def plotConvergenceByDistantConnectionChance(results, featureRange, columnRange, longDistanceConnectionsRange, numTrials): """ Plots the convergence graph: iterations vs number of columns. Each curve shows the convergence for a given number of unique features. """ #############################################...
python
def plotConvergenceByDistantConnectionChance(results, featureRange, columnRange, longDistanceConnectionsRange, numTrials): """ Plots the convergence graph: iterations vs number of columns. Each curve shows the convergence for a given number of unique features. """ #############################################...
['def', 'plotConvergenceByDistantConnectionChance', '(', 'results', ',', 'featureRange', ',', 'columnRange', ',', 'longDistanceConnectionsRange', ',', 'numTrials', ')', ':', '########################################################################', '#', '# Accumulate all the results per column in a convergence array.'...
Plots the convergence graph: iterations vs number of columns. Each curve shows the convergence for a given number of unique features.
['Plots', 'the', 'convergence', 'graph', ':', 'iterations', 'vs', 'number', 'of', 'columns', '.', 'Each', 'curve', 'shows', 'the', 'convergence', 'for', 'a', 'given', 'number', 'of', 'unique', 'features', '.']
train
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/projects/l2_pooling/topology_experiments.py#L186-L247
8,821
CalebBell/ht
ht/boiling_nucleic.py
Zuber
def Zuber(sigma, Hvap, rhol, rhog, K=0.18): r'''Calculates critical heat flux for nucleic boiling of a flat plate or other shape as presented in various sources. K = pi/24 is believed to be the original [1]_ value for K, but 0.149 is now more widely used, a value claimed to be from [2]_ according to [5]...
python
def Zuber(sigma, Hvap, rhol, rhog, K=0.18): r'''Calculates critical heat flux for nucleic boiling of a flat plate or other shape as presented in various sources. K = pi/24 is believed to be the original [1]_ value for K, but 0.149 is now more widely used, a value claimed to be from [2]_ according to [5]...
['def', 'Zuber', '(', 'sigma', ',', 'Hvap', ',', 'rhol', ',', 'rhog', ',', 'K', '=', '0.18', ')', ':', 'return', 'K', '*', 'Hvap', '*', 'rhog', '**', '0.5', '*', '(', 'g', '*', 'sigma', '*', '(', 'rhol', '-', 'rhog', ')', ')', '**', '0.25']
r'''Calculates critical heat flux for nucleic boiling of a flat plate or other shape as presented in various sources. K = pi/24 is believed to be the original [1]_ value for K, but 0.149 is now more widely used, a value claimed to be from [2]_ according to [5]_. Cao [4]_ lists a value of 0.18 for K. The...
['r', 'Calculates', 'critical', 'heat', 'flux', 'for', 'nucleic', 'boiling', 'of', 'a', 'flat', 'plate', 'or', 'other', 'shape', 'as', 'presented', 'in', 'various', 'sources', '.', 'K', '=', 'pi', '/', '24', 'is', 'believed', 'to', 'be', 'the', 'original', '[', '1', ']', '_', 'value', 'for', 'K', 'but', '0', '.', '149'...
train
https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/boiling_nucleic.py#L1000-L1056
8,822
kedpter/secret_miner
pjutils.py
execute_by_options
def execute_by_options(args): """execute by argument dictionary Args: args (dict): command line argument dictionary """ if args['subcommand'] == 'sphinx': s = Sphinx(proj_info) if args['quickstart']: s.quickstart() elif args['gen_code_api']: s.ge...
python
def execute_by_options(args): """execute by argument dictionary Args: args (dict): command line argument dictionary """ if args['subcommand'] == 'sphinx': s = Sphinx(proj_info) if args['quickstart']: s.quickstart() elif args['gen_code_api']: s.ge...
['def', 'execute_by_options', '(', 'args', ')', ':', 'if', 'args', '[', "'subcommand'", ']', '==', "'sphinx'", ':', 's', '=', 'Sphinx', '(', 'proj_info', ')', 'if', 'args', '[', "'quickstart'", ']', ':', 's', '.', 'quickstart', '(', ')', 'elif', 'args', '[', "'gen_code_api'", ']', ':', 's', '.', 'gen_code_api', '(', ')...
execute by argument dictionary Args: args (dict): command line argument dictionary
['execute', 'by', 'argument', 'dictionary']
train
https://github.com/kedpter/secret_miner/blob/3b4ebe58e11fb688d7e8928ebaa2871fc43717e4/pjutils.py#L417-L448
8,823
CellProfiler/centrosome
centrosome/filter.py
laplacian_of_gaussian
def laplacian_of_gaussian(image, mask, size, sigma): '''Perform the Laplacian of Gaussian transform on the image image - 2-d image array mask - binary mask of significant pixels size - length of side of square kernel to use sigma - standard deviation of the Gaussian ''' half_size = size//...
python
def laplacian_of_gaussian(image, mask, size, sigma): '''Perform the Laplacian of Gaussian transform on the image image - 2-d image array mask - binary mask of significant pixels size - length of side of square kernel to use sigma - standard deviation of the Gaussian ''' half_size = size//...
['def', 'laplacian_of_gaussian', '(', 'image', ',', 'mask', ',', 'size', ',', 'sigma', ')', ':', 'half_size', '=', 'size', '//', '2', 'i', ',', 'j', '=', 'np', '.', 'mgrid', '[', '-', 'half_size', ':', 'half_size', '+', '1', ',', '-', 'half_size', ':', 'half_size', '+', '1', ']', '.', 'astype', '(', 'float', ')', '/', ...
Perform the Laplacian of Gaussian transform on the image image - 2-d image array mask - binary mask of significant pixels size - length of side of square kernel to use sigma - standard deviation of the Gaussian
['Perform', 'the', 'Laplacian', 'of', 'Gaussian', 'transform', 'on', 'the', 'image']
train
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/filter.py#L252-L291
8,824
ramses-tech/ramses
ramses/utils.py
singular_subresource
def singular_subresource(raml_resource, route_name): """ Determine if :raml_resource: is a singular subresource. :param raml_resource: Instance of ramlfications.raml.ResourceNode. :param route_name: Name of the :raml_resource:. """ static_parent = get_static_parent(raml_resource, method='POST') ...
python
def singular_subresource(raml_resource, route_name): """ Determine if :raml_resource: is a singular subresource. :param raml_resource: Instance of ramlfications.raml.ResourceNode. :param route_name: Name of the :raml_resource:. """ static_parent = get_static_parent(raml_resource, method='POST') ...
['def', 'singular_subresource', '(', 'raml_resource', ',', 'route_name', ')', ':', 'static_parent', '=', 'get_static_parent', '(', 'raml_resource', ',', 'method', '=', "'POST'", ')', 'if', 'static_parent', 'is', 'None', ':', 'return', 'False', 'schema', '=', 'resource_schema', '(', 'static_parent', ')', 'or', '{', '}',...
Determine if :raml_resource: is a singular subresource. :param raml_resource: Instance of ramlfications.raml.ResourceNode. :param route_name: Name of the :raml_resource:.
['Determine', 'if', ':', 'raml_resource', ':', 'is', 'a', 'singular', 'subresource', '.']
train
https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/utils.py#L234-L251
8,825
johnnoone/aioconsul
aioconsul/client/session_endpoint.py
SessionEndpoint.renew
async def renew(self, session, *, dc=None): """Renews a TTL-based session Parameters: session (ObjectID): Session ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Returns: ObjectMeta: where val...
python
async def renew(self, session, *, dc=None): """Renews a TTL-based session Parameters: session (ObjectID): Session ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Returns: ObjectMeta: where val...
['async', 'def', 'renew', '(', 'self', ',', 'session', ',', '*', ',', 'dc', '=', 'None', ')', ':', 'session_id', '=', 'extract_attr', '(', 'session', ',', 'keys', '=', '[', '"ID"', ']', ')', 'response', '=', 'await', 'self', '.', '_api', '.', 'put', '(', '"/v1/session/renew"', ',', 'session_id', ',', 'params', '=', '{'...
Renews a TTL-based session Parameters: session (ObjectID): Session ID dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. Returns: ObjectMeta: where value is session Raises: NotFound: ses...
['Renews', 'a', 'TTL', '-', 'based', 'session']
train
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/session_endpoint.py#L198-L237
8,826
pymc-devs/pymc
pymc/StepMethods.py
assign_method
def assign_method(stochastic, scale=None, verbose=-1): """ Returns a step method instance to handle a variable. If several methods have the same competence, it picks one arbitrarily (using set.pop()). """ # Retrieve set of best candidates best_candidates = pick_best_methods(stochastic) ...
python
def assign_method(stochastic, scale=None, verbose=-1): """ Returns a step method instance to handle a variable. If several methods have the same competence, it picks one arbitrarily (using set.pop()). """ # Retrieve set of best candidates best_candidates = pick_best_methods(stochastic) ...
['def', 'assign_method', '(', 'stochastic', ',', 'scale', '=', 'None', ',', 'verbose', '=', '-', '1', ')', ':', '# Retrieve set of best candidates', 'best_candidates', '=', 'pick_best_methods', '(', 'stochastic', ')', '# Randomly grab and appropriate method', 'method', '=', 'best_candidates', '.', 'pop', '(', ')', 'fai...
Returns a step method instance to handle a variable. If several methods have the same competence, it picks one arbitrarily (using set.pop()).
['Returns', 'a', 'step', 'method', 'instance', 'to', 'handle', 'a', 'variable', '.', 'If', 'several', 'methods', 'have', 'the', 'same', 'competence', 'it', 'picks', 'one', 'arbitrarily', '(', 'using', 'set', '.', 'pop', '()', ')', '.']
train
https://github.com/pymc-devs/pymc/blob/c6e530210bff4c0d7189b35b2c971bc53f93f7cd/pymc/StepMethods.py#L97-L130
8,827
pereorga/csvshuf
csvshuf/csvshuf.py
column_list
def column_list(string): """Validate and convert comma-separated list of column numbers.""" try: columns = list(map(int, string.split(','))) except ValueError as e: raise argparse.ArgumentTypeError(*e.args) for column in columns: if column < 1: raise argparse.Argument...
python
def column_list(string): """Validate and convert comma-separated list of column numbers.""" try: columns = list(map(int, string.split(','))) except ValueError as e: raise argparse.ArgumentTypeError(*e.args) for column in columns: if column < 1: raise argparse.Argument...
['def', 'column_list', '(', 'string', ')', ':', 'try', ':', 'columns', '=', 'list', '(', 'map', '(', 'int', ',', 'string', '.', 'split', '(', "','", ')', ')', ')', 'except', 'ValueError', 'as', 'e', ':', 'raise', 'argparse', '.', 'ArgumentTypeError', '(', '*', 'e', '.', 'args', ')', 'for', 'column', 'in', 'columns', ':...
Validate and convert comma-separated list of column numbers.
['Validate', 'and', 'convert', 'comma', '-', 'separated', 'list', 'of', 'column', 'numbers', '.']
train
https://github.com/pereorga/csvshuf/blob/70fdd4f512ef980bffe9cc51bfe59fea116d7c2f/csvshuf/csvshuf.py#L27-L38
8,828
COALAIP/pycoalaip
coalaip/model_validators.py
is_manifestation_model
def is_manifestation_model(instance, attribute, value): """Must include a ``manifestationOfWork`` key.""" instance_name = instance.__class__.__name__ is_creation_model(instance, attribute, value) manifestation_of = value.get('manifestationOfWork') if not isinstance(manifestation_of, str): ...
python
def is_manifestation_model(instance, attribute, value): """Must include a ``manifestationOfWork`` key.""" instance_name = instance.__class__.__name__ is_creation_model(instance, attribute, value) manifestation_of = value.get('manifestationOfWork') if not isinstance(manifestation_of, str): ...
['def', 'is_manifestation_model', '(', 'instance', ',', 'attribute', ',', 'value', ')', ':', 'instance_name', '=', 'instance', '.', '__class__', '.', '__name__', 'is_creation_model', '(', 'instance', ',', 'attribute', ',', 'value', ')', 'manifestation_of', '=', 'value', '.', 'get', '(', "'manifestationOfWork'", ')', 'i...
Must include a ``manifestationOfWork`` key.
['Must', 'include', 'a', 'manifestationOfWork', 'key', '.']
train
https://github.com/COALAIP/pycoalaip/blob/cecc8f6ff4733f0525fafcee63647753e832f0be/coalaip/model_validators.py#L68-L81
8,829
saltstack/salt
salt/modules/cp.py
push_dir
def push_dir(path, glob=None, upload_path=None): ''' Push a directory from the minion up to the master, the files will be saved to the salt master in the master's minion files cachedir (defaults to ``/var/cache/salt/master/minions/minion-id/files``). It also has a glob for matching specific files u...
python
def push_dir(path, glob=None, upload_path=None): ''' Push a directory from the minion up to the master, the files will be saved to the salt master in the master's minion files cachedir (defaults to ``/var/cache/salt/master/minions/minion-id/files``). It also has a glob for matching specific files u...
['def', 'push_dir', '(', 'path', ',', 'glob', '=', 'None', ',', 'upload_path', '=', 'None', ')', ':', 'if', "'../'", 'in', 'path', 'or', 'not', 'os', '.', 'path', '.', 'isabs', '(', 'path', ')', ':', 'return', 'False', 'tmpupload_path', '=', 'upload_path', 'path', '=', 'os', '.', 'path', '.', 'realpath', '(', 'path', '...
Push a directory from the minion up to the master, the files will be saved to the salt master in the master's minion files cachedir (defaults to ``/var/cache/salt/master/minions/minion-id/files``). It also has a glob for matching specific files using globbing. .. versionadded:: 2014.7.0 Since thi...
['Push', 'a', 'directory', 'from', 'the', 'minion', 'up', 'to', 'the', 'master', 'the', 'files', 'will', 'be', 'saved', 'to', 'the', 'salt', 'master', 'in', 'the', 'master', 's', 'minion', 'files', 'cachedir', '(', 'defaults', 'to', '/', 'var', '/', 'cache', '/', 'salt', '/', 'master', '/', 'minions', '/', 'minion', '-...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cp.py#L883-L931
8,830
saltstack/salt
salt/modules/debian_ip.py
_parse_ethtool_opts
def _parse_ethtool_opts(opts, iface): ''' Filters given options and outputs valid settings for ETHTOOLS_OPTS If an option has a value that is not expected, this function will log what the Interface, Setting and what it was expecting. ''' config = {} if 'autoneg' in opts: if opts...
python
def _parse_ethtool_opts(opts, iface): ''' Filters given options and outputs valid settings for ETHTOOLS_OPTS If an option has a value that is not expected, this function will log what the Interface, Setting and what it was expecting. ''' config = {} if 'autoneg' in opts: if opts...
['def', '_parse_ethtool_opts', '(', 'opts', ',', 'iface', ')', ':', 'config', '=', '{', '}', 'if', "'autoneg'", 'in', 'opts', ':', 'if', 'opts', '[', "'autoneg'", ']', 'in', '_CONFIG_TRUE', ':', 'config', '.', 'update', '(', '{', "'autoneg'", ':', "'on'", '}', ')', 'elif', 'opts', '[', "'autoneg'", ']', 'in', '_CONFIG_...
Filters given options and outputs valid settings for ETHTOOLS_OPTS If an option has a value that is not expected, this function will log what the Interface, Setting and what it was expecting.
['Filters', 'given', 'options', 'and', 'outputs', 'valid', 'settings', 'for', 'ETHTOOLS_OPTS', 'If', 'an', 'option', 'has', 'a', 'value', 'that', 'is', 'not', 'expected', 'this', 'function', 'will', 'log', 'what', 'the', 'Interface', 'Setting', 'and', 'what', 'it', 'was', 'expecting', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L695-L736
8,831
StackStorm/pybind
pybind/nos/v6_0_2f/brocade_fabric_service_rpc/show_linkinfo/output/show_link_info/linkinfo_isl/__init__.py
linkinfo_isl._set_linkinfo_isllink_srcport_type
def _set_linkinfo_isllink_srcport_type(self, v, load=False): """ Setter method for linkinfo_isllink_srcport_type, mapped from YANG variable /brocade_fabric_service_rpc/show_linkinfo/output/show_link_info/linkinfo_isl/linkinfo_isllink_srcport_type (interfacetype-type) If this variable is read-only (config: f...
python
def _set_linkinfo_isllink_srcport_type(self, v, load=False): """ Setter method for linkinfo_isllink_srcport_type, mapped from YANG variable /brocade_fabric_service_rpc/show_linkinfo/output/show_link_info/linkinfo_isl/linkinfo_isllink_srcport_type (interfacetype-type) If this variable is read-only (config: f...
['def', '_set_linkinfo_isllink_srcport_type', '(', 'self', ',', 'v', ',', 'load', '=', 'False', ')', ':', 'if', 'hasattr', '(', 'v', ',', '"_utype"', ')', ':', 'v', '=', 'v', '.', '_utype', '(', 'v', ')', 'try', ':', 't', '=', 'YANGDynClass', '(', 'v', ',', 'base', '=', 'RestrictedClassType', '(', 'base_type', '=', 'un...
Setter method for linkinfo_isllink_srcport_type, mapped from YANG variable /brocade_fabric_service_rpc/show_linkinfo/output/show_link_info/linkinfo_isl/linkinfo_isllink_srcport_type (interfacetype-type) If this variable is read-only (config: false) in the source YANG file, then _set_linkinfo_isllink_srcport_typ...
['Setter', 'method', 'for', 'linkinfo_isllink_srcport_type', 'mapped', 'from', 'YANG', 'variable', '/', 'brocade_fabric_service_rpc', '/', 'show_linkinfo', '/', 'output', '/', 'show_link_info', '/', 'linkinfo_isl', '/', 'linkinfo_isllink_srcport_type', '(', 'interfacetype', '-', 'type', ')', 'If', 'this', 'variable', '...
train
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/nos/v6_0_2f/brocade_fabric_service_rpc/show_linkinfo/output/show_link_info/linkinfo_isl/__init__.py#L225-L251
8,832
StackStorm/pybind
pybind/nos/v6_0_2f/brocade_nameserver_rpc/get_nameserver_detail/output/show_nameserver/__init__.py
show_nameserver._set_nameserver_cos
def _set_nameserver_cos(self, v, load=False): """ Setter method for nameserver_cos, mapped from YANG variable /brocade_nameserver_rpc/get_nameserver_detail/output/show_nameserver/nameserver_cos (nameserver-cos-type) If this variable is read-only (config: false) in the source YANG file, then _set_nameser...
python
def _set_nameserver_cos(self, v, load=False): """ Setter method for nameserver_cos, mapped from YANG variable /brocade_nameserver_rpc/get_nameserver_detail/output/show_nameserver/nameserver_cos (nameserver-cos-type) If this variable is read-only (config: false) in the source YANG file, then _set_nameser...
['def', '_set_nameserver_cos', '(', 'self', ',', 'v', ',', 'load', '=', 'False', ')', ':', 'if', 'hasattr', '(', 'v', ',', '"_utype"', ')', ':', 'v', '=', 'v', '.', '_utype', '(', 'v', ')', 'try', ':', 't', '=', 'YANGDynClass', '(', 'v', ',', 'base', '=', 'RestrictedClassType', '(', 'base_type', '=', 'unicode', ',', 'r...
Setter method for nameserver_cos, mapped from YANG variable /brocade_nameserver_rpc/get_nameserver_detail/output/show_nameserver/nameserver_cos (nameserver-cos-type) If this variable is read-only (config: false) in the source YANG file, then _set_nameserver_cos is considered as a private method. Backends lo...
['Setter', 'method', 'for', 'nameserver_cos', 'mapped', 'from', 'YANG', 'variable', '/', 'brocade_nameserver_rpc', '/', 'get_nameserver_detail', '/', 'output', '/', 'show_nameserver', '/', 'nameserver_cos', '(', 'nameserver', '-', 'cos', '-', 'type', ')', 'If', 'this', 'variable', 'is', 'read', '-', 'only', '(', 'confi...
train
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/nos/v6_0_2f/brocade_nameserver_rpc/get_nameserver_detail/output/show_nameserver/__init__.py#L586-L610
8,833
codeinn/vcs
vcs/cli.py
BaseCommand.execute
def execute(self, *args, **options): """ Executes whole process of parsing arguments, running command and trying to catch errors. """ try: self.handle(*args, **options) except CommandError, e: if options['debug']: try: ...
python
def execute(self, *args, **options): """ Executes whole process of parsing arguments, running command and trying to catch errors. """ try: self.handle(*args, **options) except CommandError, e: if options['debug']: try: ...
['def', 'execute', '(', 'self', ',', '*', 'args', ',', '*', '*', 'options', ')', ':', 'try', ':', 'self', '.', 'handle', '(', '*', 'args', ',', '*', '*', 'options', ')', 'except', 'CommandError', ',', 'e', ':', 'if', 'options', '[', "'debug'", ']', ':', 'try', ':', 'import', 'ipdb', 'ipdb', '.', 'set_trace', '(', ')', ...
Executes whole process of parsing arguments, running command and trying to catch errors.
['Executes', 'whole', 'process', 'of', 'parsing', 'arguments', 'running', 'command', 'and', 'trying', 'to', 'catch', 'errors', '.']
train
https://github.com/codeinn/vcs/blob/e6cd94188e9c36d273411bf3adc0584ac6ab92a0/vcs/cli.py#L237-L275
8,834
sci-bots/pygtkhelpers
pygtkhelpers/ui/views/shapes_canvas_view.py
GtkShapesCanvasView.create_ui
def create_ui(self): ''' .. versionchanged:: 0.20 Debounce window expose and resize handlers to improve responsiveness. .. versionchanged:: X.X.X Call debounced `_on_expose_event` handler on _leading_ edge to make UI update more responsive when, e...
python
def create_ui(self): ''' .. versionchanged:: 0.20 Debounce window expose and resize handlers to improve responsiveness. .. versionchanged:: X.X.X Call debounced `_on_expose_event` handler on _leading_ edge to make UI update more responsive when, e...
['def', 'create_ui', '(', 'self', ')', ':', 'super', '(', 'GtkShapesCanvasView', ',', 'self', ')', '.', 'create_ui', '(', ')', 'self', '.', 'widget', '.', 'set_events', '(', 'gtk', '.', 'gdk', '.', 'BUTTON_PRESS', '|', 'gtk', '.', 'gdk', '.', 'BUTTON_RELEASE', '|', 'gtk', '.', 'gdk', '.', 'BUTTON_MOTION_MASK', '|', 'gt...
.. versionchanged:: 0.20 Debounce window expose and resize handlers to improve responsiveness. .. versionchanged:: X.X.X Call debounced `_on_expose_event` handler on _leading_ edge to make UI update more responsive when, e.g., changing window focus. ...
['..', 'versionchanged', '::', '0', '.', '20', 'Debounce', 'window', 'expose', 'and', 'resize', 'handlers', 'to', 'improve', 'responsiveness', '.']
train
https://github.com/sci-bots/pygtkhelpers/blob/3a6e6d6340221c686229cd1c951d7537dae81b07/pygtkhelpers/ui/views/shapes_canvas_view.py#L43-L67
8,835
aio-libs/aioredis
aioredis/sentinel/pool.py
SentinelPool.discover
async def discover(self, timeout=None): # TODO: better name? """Discover sentinels and all monitored services within given timeout. If no sentinels discovered within timeout: TimeoutError is raised. If some sentinels were discovered but not all — it is ok. If not all monitored servic...
python
async def discover(self, timeout=None): # TODO: better name? """Discover sentinels and all monitored services within given timeout. If no sentinels discovered within timeout: TimeoutError is raised. If some sentinels were discovered but not all — it is ok. If not all monitored servic...
['async', 'def', 'discover', '(', 'self', ',', 'timeout', '=', 'None', ')', ':', '# TODO: better name?', '# TODO: check not closed', '# TODO: discovery must be done with some customizable timeout.', 'if', 'timeout', 'is', 'None', ':', 'timeout', '=', 'self', '.', 'discover_timeout', 'tasks', '=', '[', ']', 'pools', '='...
Discover sentinels and all monitored services within given timeout. If no sentinels discovered within timeout: TimeoutError is raised. If some sentinels were discovered but not all — it is ok. If not all monitored services (masters/slaves) discovered (or connections established) — it is...
['Discover', 'sentinels', 'and', 'all', 'monitored', 'services', 'within', 'given', 'timeout', '.']
train
https://github.com/aio-libs/aioredis/blob/e8c33e39558d4cc91cf70dde490d8b330c97dc2e/aioredis/sentinel/pool.py#L192-L228
8,836
gmr/tredis
tredis/sets.py
SetsMixin.sdiffstore
def sdiffstore(self, destination, *keys): """This command is equal to :meth:`~tredis.RedisClient.sdiff`, but instead of returning the resulting set, it is stored in destination. If destination already exists, it is overwritten. .. note:: **Time complexity**: ``O(N)`` where ...
python
def sdiffstore(self, destination, *keys): """This command is equal to :meth:`~tredis.RedisClient.sdiff`, but instead of returning the resulting set, it is stored in destination. If destination already exists, it is overwritten. .. note:: **Time complexity**: ``O(N)`` where ...
['def', 'sdiffstore', '(', 'self', ',', 'destination', ',', '*', 'keys', ')', ':', 'return', 'self', '.', '_execute', '(', '[', "b'SDIFFSTORE'", ',', 'destination', ']', '+', 'list', '(', 'keys', ')', ')']
This command is equal to :meth:`~tredis.RedisClient.sdiff`, but instead of returning the resulting set, it is stored in destination. If destination already exists, it is overwritten. .. note:: **Time complexity**: ``O(N)`` where ``N`` is the total number of elements in a...
['This', 'command', 'is', 'equal', 'to', ':', 'meth', ':', '~tredis', '.', 'RedisClient', '.', 'sdiff', 'but', 'instead', 'of', 'returning', 'the', 'resulting', 'set', 'it', 'is', 'stored', 'in', 'destination', '.']
train
https://github.com/gmr/tredis/blob/2e91c6a58a35460be0525c51ac6a98fde3b506ad/tredis/sets.py#L82-L101
8,837
huge-success/sanic
sanic/response.py
StreamingHTTPResponse.stream
async def stream( self, version="1.1", keep_alive=False, keep_alive_timeout=None ): """Streams headers, runs the `streaming_fn` callback that writes content to the response body, then finalizes the response body. """ headers = self.get_headers( version, ...
python
async def stream( self, version="1.1", keep_alive=False, keep_alive_timeout=None ): """Streams headers, runs the `streaming_fn` callback that writes content to the response body, then finalizes the response body. """ headers = self.get_headers( version, ...
['async', 'def', 'stream', '(', 'self', ',', 'version', '=', '"1.1"', ',', 'keep_alive', '=', 'False', ',', 'keep_alive_timeout', '=', 'None', ')', ':', 'headers', '=', 'self', '.', 'get_headers', '(', 'version', ',', 'keep_alive', '=', 'keep_alive', ',', 'keep_alive_timeout', '=', 'keep_alive_timeout', ',', ')', 'self...
Streams headers, runs the `streaming_fn` callback that writes content to the response body, then finalizes the response body.
['Streams', 'headers', 'runs', 'the', 'streaming_fn', 'callback', 'that', 'writes', 'content', 'to', 'the', 'response', 'body', 'then', 'finalizes', 'the', 'response', 'body', '.']
train
https://github.com/huge-success/sanic/blob/6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd/sanic/response.py#L85-L99
8,838
ottogroup/palladium
palladium/server.py
PredictStream.listen
def listen(self, io_in, io_out, io_err): """Listens to provided io stream and writes predictions to output. In case of errors, the error stream will be used. """ for line in io_in: if line.strip().lower() == 'exit': break try: y_pr...
python
def listen(self, io_in, io_out, io_err): """Listens to provided io stream and writes predictions to output. In case of errors, the error stream will be used. """ for line in io_in: if line.strip().lower() == 'exit': break try: y_pr...
['def', 'listen', '(', 'self', ',', 'io_in', ',', 'io_out', ',', 'io_err', ')', ':', 'for', 'line', 'in', 'io_in', ':', 'if', 'line', '.', 'strip', '(', ')', '.', 'lower', '(', ')', '==', "'exit'", ':', 'break', 'try', ':', 'y_pred', '=', 'self', '.', 'process_line', '(', 'line', ')', 'except', 'Exception', 'as', 'e', ...
Listens to provided io stream and writes predictions to output. In case of errors, the error stream will be used.
['Listens', 'to', 'provided', 'io', 'stream', 'and', 'writes', 'predictions', 'to', 'output', '.', 'In', 'case', 'of', 'errors', 'the', 'error', 'stream', 'will', 'be', 'used', '.']
train
https://github.com/ottogroup/palladium/blob/f3a4372fba809efbd8da7c979a8c6faff04684dd/palladium/server.py#L340-L359
8,839
kwikteam/phy
phy/gui/widgets.py
HTMLWidget.build
def build(self): """Build the full HTML source.""" if self.is_built(): # pragma: no cover return with _wait_signal(self.loadFinished, 20): self.rebuild() self._built = True
python
def build(self): """Build the full HTML source.""" if self.is_built(): # pragma: no cover return with _wait_signal(self.loadFinished, 20): self.rebuild() self._built = True
['def', 'build', '(', 'self', ')', ':', 'if', 'self', '.', 'is_built', '(', ')', ':', '# pragma: no cover', 'return', 'with', '_wait_signal', '(', 'self', '.', 'loadFinished', ',', '20', ')', ':', 'self', '.', 'rebuild', '(', ')', 'self', '.', '_built', '=', 'True']
Build the full HTML source.
['Build', 'the', 'full', 'HTML', 'source', '.']
train
https://github.com/kwikteam/phy/blob/7e9313dc364304b7d2bd03b92938347343703003/phy/gui/widgets.py#L171-L177
8,840
jfilter/text-classification-keras
texcla/embeddings.py
build_embedding_weights
def build_embedding_weights(word_index, embeddings_index): """Builds an embedding matrix for all words in vocab using embeddings_index """ logger.info('Loading embeddings for all words in the corpus') embedding_dim = list(embeddings_index.values())[0].shape[-1] # setting special tokens such as UNK ...
python
def build_embedding_weights(word_index, embeddings_index): """Builds an embedding matrix for all words in vocab using embeddings_index """ logger.info('Loading embeddings for all words in the corpus') embedding_dim = list(embeddings_index.values())[0].shape[-1] # setting special tokens such as UNK ...
['def', 'build_embedding_weights', '(', 'word_index', ',', 'embeddings_index', ')', ':', 'logger', '.', 'info', '(', "'Loading embeddings for all words in the corpus'", ')', 'embedding_dim', '=', 'list', '(', 'embeddings_index', '.', 'values', '(', ')', ')', '[', '0', ']', '.', 'shape', '[', '-', '1', ']', '# setting s...
Builds an embedding matrix for all words in vocab using embeddings_index
['Builds', 'an', 'embedding', 'matrix', 'for', 'all', 'words', 'in', 'vocab', 'using', 'embeddings_index']
train
https://github.com/jfilter/text-classification-keras/blob/a59c652805da41d18937c7fdad0d9fd943cf8578/texcla/embeddings.py#L146-L161
8,841
wandb/client
wandb/__init__.py
reset_env
def reset_env(exclude=[]): """Remove environment variables, used in Jupyter notebooks""" if os.getenv(env.INITED): wandb_keys = [key for key in os.environ.keys() if key.startswith( 'WANDB_') and key not in exclude] for key in wandb_keys: del os.environ[key] return...
python
def reset_env(exclude=[]): """Remove environment variables, used in Jupyter notebooks""" if os.getenv(env.INITED): wandb_keys = [key for key in os.environ.keys() if key.startswith( 'WANDB_') and key not in exclude] for key in wandb_keys: del os.environ[key] return...
['def', 'reset_env', '(', 'exclude', '=', '[', ']', ')', ':', 'if', 'os', '.', 'getenv', '(', 'env', '.', 'INITED', ')', ':', 'wandb_keys', '=', '[', 'key', 'for', 'key', 'in', 'os', '.', 'environ', '.', 'keys', '(', ')', 'if', 'key', '.', 'startswith', '(', "'WANDB_'", ')', 'and', 'key', 'not', 'in', 'exclude', ']', '...
Remove environment variables, used in Jupyter notebooks
['Remove', 'environment', 'variables', 'used', 'in', 'Jupyter', 'notebooks']
train
https://github.com/wandb/client/blob/7d08954ed5674fee223cd85ed0d8518fe47266b2/wandb/__init__.py#L498-L507
8,842
google/importlab
importlab/resolve.py
Resolver.resolve_import
def resolve_import(self, item): """Simulate how Python resolves imports. Returns the filename of the source file Python would load when processing a statement like 'import name' in the module we're currently under. Args: item: An instance of ImportItem Retu...
python
def resolve_import(self, item): """Simulate how Python resolves imports. Returns the filename of the source file Python would load when processing a statement like 'import name' in the module we're currently under. Args: item: An instance of ImportItem Retu...
['def', 'resolve_import', '(', 'self', ',', 'item', ')', ':', 'name', '=', 'item', '.', 'name', '# The last part in `from a.b.c import d` might be a symbol rather than a', '# module, so we try a.b.c and a.b.c.d as names.', 'short_name', '=', 'None', 'if', 'item', '.', 'is_from', 'and', 'not', 'item', '.', 'is_star', ':...
Simulate how Python resolves imports. Returns the filename of the source file Python would load when processing a statement like 'import name' in the module we're currently under. Args: item: An instance of ImportItem Returns: A filename Raises...
['Simulate', 'how', 'Python', 'resolves', 'imports', '.']
train
https://github.com/google/importlab/blob/92090a0b4421137d1369c2ed952eda6bb4c7a155/importlab/resolve.py#L150-L233
8,843
casacore/python-casacore
casacore/fitting/fitting.py
fitserver.functional
def functional(self, fnct, x, y, sd=None, wt=1.0, mxit=50, fid=0): """Make a non-linear least squares solution. This will make a non-linear least squares solution for the points through the ordinates at the abscissa values, using the specified `fnct`. Details can be found in the :meth:`...
python
def functional(self, fnct, x, y, sd=None, wt=1.0, mxit=50, fid=0): """Make a non-linear least squares solution. This will make a non-linear least squares solution for the points through the ordinates at the abscissa values, using the specified `fnct`. Details can be found in the :meth:`...
['def', 'functional', '(', 'self', ',', 'fnct', ',', 'x', ',', 'y', ',', 'sd', '=', 'None', ',', 'wt', '=', '1.0', ',', 'mxit', '=', '50', ',', 'fid', '=', '0', ')', ':', 'self', '.', '_fit', '(', 'fitfunc', '=', '"functional"', ',', 'fnct', '=', 'fnct', ',', 'x', '=', 'x', ',', 'y', '=', 'y', ',', 'sd', '=', 'sd', ','...
Make a non-linear least squares solution. This will make a non-linear least squares solution for the points through the ordinates at the abscissa values, using the specified `fnct`. Details can be found in the :meth:`linear` description. :param fnct: the functional to fit :para...
['Make', 'a', 'non', '-', 'linear', 'least', 'squares', 'solution', '.']
train
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/fitting/fitting.py#L333-L351
8,844
genepattern/genepattern-python
gp/data.py
_bytes_to_str
def _bytes_to_str(lines): """ Convert all lines from byte string to unicode string, if necessary """ if len(lines) >= 1 and hasattr(lines[0], 'decode'): return [line.decode('utf-8') for line in lines] else: return lines
python
def _bytes_to_str(lines): """ Convert all lines from byte string to unicode string, if necessary """ if len(lines) >= 1 and hasattr(lines[0], 'decode'): return [line.decode('utf-8') for line in lines] else: return lines
['def', '_bytes_to_str', '(', 'lines', ')', ':', 'if', 'len', '(', 'lines', ')', '>=', '1', 'and', 'hasattr', '(', 'lines', '[', '0', ']', ',', "'decode'", ')', ':', 'return', '[', 'line', '.', 'decode', '(', "'utf-8'", ')', 'for', 'line', 'in', 'lines', ']', 'else', ':', 'return', 'lines']
Convert all lines from byte string to unicode string, if necessary
['Convert', 'all', 'lines', 'from', 'byte', 'string', 'to', 'unicode', 'string', 'if', 'necessary']
train
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/data.py#L263-L270
8,845
pypa/setuptools
setuptools/command/egg_info.py
FileList.global_include
def global_include(self, pattern): """ Include all files anywhere in the current directory that match the pattern. This is very inefficient on large file trees. """ if self.allfiles is None: self.findall() match = translate_pattern(os.path.join('**', pattern))...
python
def global_include(self, pattern): """ Include all files anywhere in the current directory that match the pattern. This is very inefficient on large file trees. """ if self.allfiles is None: self.findall() match = translate_pattern(os.path.join('**', pattern))...
['def', 'global_include', '(', 'self', ',', 'pattern', ')', ':', 'if', 'self', '.', 'allfiles', 'is', 'None', ':', 'self', '.', 'findall', '(', ')', 'match', '=', 'translate_pattern', '(', 'os', '.', 'path', '.', 'join', '(', "'**'", ',', 'pattern', ')', ')', 'found', '=', '[', 'f', 'for', 'f', 'in', 'self', '.', 'allf...
Include all files anywhere in the current directory that match the pattern. This is very inefficient on large file trees.
['Include', 'all', 'files', 'anywhere', 'in', 'the', 'current', 'directory', 'that', 'match', 'the', 'pattern', '.', 'This', 'is', 'very', 'inefficient', 'on', 'large', 'file', 'trees', '.']
train
https://github.com/pypa/setuptools/blob/83c667e0b2a98193851c07115d1af65011ed0fb6/setuptools/command/egg_info.py#L454-L464
8,846
kensho-technologies/graphql-compiler
graphql_compiler/schema_generation/schema_graph.py
_validate_edges_do_not_have_extra_links
def _validate_edges_do_not_have_extra_links(class_name, properties): """Validate that edges do not have properties of Link type that aren't the edge endpoints.""" for property_name, property_descriptor in six.iteritems(properties): if property_name in {EDGE_SOURCE_PROPERTY_NAME, EDGE_DESTINATION_PROPERT...
python
def _validate_edges_do_not_have_extra_links(class_name, properties): """Validate that edges do not have properties of Link type that aren't the edge endpoints.""" for property_name, property_descriptor in six.iteritems(properties): if property_name in {EDGE_SOURCE_PROPERTY_NAME, EDGE_DESTINATION_PROPERT...
['def', '_validate_edges_do_not_have_extra_links', '(', 'class_name', ',', 'properties', ')', ':', 'for', 'property_name', ',', 'property_descriptor', 'in', 'six', '.', 'iteritems', '(', 'properties', ')', ':', 'if', 'property_name', 'in', '{', 'EDGE_SOURCE_PROPERTY_NAME', ',', 'EDGE_DESTINATION_PROPERTY_NAME', '}', ':...
Validate that edges do not have properties of Link type that aren't the edge endpoints.
['Validate', 'that', 'edges', 'do', 'not', 'have', 'properties', 'of', 'Link', 'type', 'that', 'aren', 't', 'the', 'edge', 'endpoints', '.']
train
https://github.com/kensho-technologies/graphql-compiler/blob/f6079c6d10f64932f6b3af309b79bcea2123ca8f/graphql_compiler/schema_generation/schema_graph.py#L44-L53
8,847
maceoutliner/django-fiction-outlines
fiction_outlines/receivers.py
validate_generations_for_story_elements
def validate_generations_for_story_elements( sender, instance, action, target_node_type=None, target_node=None, pos=None, *args, **kwargs ): ''' Unlike arc nodes, for which we just warn about structure, the story tree allowed parent/child rules...
python
def validate_generations_for_story_elements( sender, instance, action, target_node_type=None, target_node=None, pos=None, *args, **kwargs ): ''' Unlike arc nodes, for which we just warn about structure, the story tree allowed parent/child rules...
['def', 'validate_generations_for_story_elements', '(', 'sender', ',', 'instance', ',', 'action', ',', 'target_node_type', '=', 'None', ',', 'target_node', '=', 'None', ',', 'pos', '=', 'None', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'if', 'action', '==', "'add_child'", ':', 'if', 'instance', '.', 'story_e...
Unlike arc nodes, for which we just warn about structure, the story tree allowed parent/child rules must be strictly enforced.
['Unlike', 'arc', 'nodes', 'for', 'which', 'we', 'just', 'warn', 'about', 'structure', 'the', 'story', 'tree', 'allowed', 'parent', '/', 'child', 'rules', 'must', 'be', 'strictly', 'enforced', '.']
train
https://github.com/maceoutliner/django-fiction-outlines/blob/6c58e356af3fbe7b23557643ba27e46eaef9d4e3/fiction_outlines/receivers.py#L206-L253
8,848
zagfai/webtul
webtul/task.py
Task.get
def get(self, timeout=10): """get() -> {'id': 32-byte-md5, 'body': msg-body}""" req = self.req({'op': 'GET', 'timeout': timeout}) if req.status_code != 200: return None result = req.json() if result.get('status') != 'ok': return False return result
python
def get(self, timeout=10): """get() -> {'id': 32-byte-md5, 'body': msg-body}""" req = self.req({'op': 'GET', 'timeout': timeout}) if req.status_code != 200: return None result = req.json() if result.get('status') != 'ok': return False return result
['def', 'get', '(', 'self', ',', 'timeout', '=', '10', ')', ':', 'req', '=', 'self', '.', 'req', '(', '{', "'op'", ':', "'GET'", ',', "'timeout'", ':', 'timeout', '}', ')', 'if', 'req', '.', 'status_code', '!=', '200', ':', 'return', 'None', 'result', '=', 'req', '.', 'json', '(', ')', 'if', 'result', '.', 'get', '(', ...
get() -> {'id': 32-byte-md5, 'body': msg-body}
['get', '()', '-', '>', '{', 'id', ':', '32', '-', 'byte', '-', 'md5', 'body', ':', 'msg', '-', 'body', '}']
train
https://github.com/zagfai/webtul/blob/58c49928070b56ef54a45b4af20d800b269ad8ce/webtul/task.py#L192-L200
8,849
klahnakoski/pyLibrary
mo_threads/signal.py
Signal.wait
def wait(self): """ PUT THREAD IN WAIT STATE UNTIL SIGNAL IS ACTIVATED """ if self._go: return True with self.lock: if self._go: return True stopper = _allocate_lock() stopper.acquire() if not self.waiti...
python
def wait(self): """ PUT THREAD IN WAIT STATE UNTIL SIGNAL IS ACTIVATED """ if self._go: return True with self.lock: if self._go: return True stopper = _allocate_lock() stopper.acquire() if not self.waiti...
['def', 'wait', '(', 'self', ')', ':', 'if', 'self', '.', '_go', ':', 'return', 'True', 'with', 'self', '.', 'lock', ':', 'if', 'self', '.', '_go', ':', 'return', 'True', 'stopper', '=', '_allocate_lock', '(', ')', 'stopper', '.', 'acquire', '(', ')', 'if', 'not', 'self', '.', 'waiting_threads', ':', 'self', '.', 'wait...
PUT THREAD IN WAIT STATE UNTIL SIGNAL IS ACTIVATED
['PUT', 'THREAD', 'IN', 'WAIT', 'STATE', 'UNTIL', 'SIGNAL', 'IS', 'ACTIVATED']
train
https://github.com/klahnakoski/pyLibrary/blob/fa2dcbc48fda8d26999baef400e9a98149e0b982/mo_threads/signal.py#L57-L77
8,850
a1ezzz/wasp-general
wasp_general/crypto/rsa.py
WRSA.export_private_key
def export_private_key(self, password=None): """ Export a private key in PEM-format :param password: If it is not None, then result will be encrypt with given password :return: bytes """ if self.__private_key is None: raise ValueError('Unable to call this method. Private key must be set') if password ...
python
def export_private_key(self, password=None): """ Export a private key in PEM-format :param password: If it is not None, then result will be encrypt with given password :return: bytes """ if self.__private_key is None: raise ValueError('Unable to call this method. Private key must be set') if password ...
['def', 'export_private_key', '(', 'self', ',', 'password', '=', 'None', ')', ':', 'if', 'self', '.', '__private_key', 'is', 'None', ':', 'raise', 'ValueError', '(', "'Unable to call this method. Private key must be set'", ')', 'if', 'password', 'is', 'not', 'None', ':', 'if', 'isinstance', '(', 'password', ',', 'str',...
Export a private key in PEM-format :param password: If it is not None, then result will be encrypt with given password :return: bytes
['Export', 'a', 'private', 'key', 'in', 'PEM', '-', 'format']
train
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/crypto/rsa.py#L106-L128
8,851
ninuxorg/nodeshot
nodeshot/community/participation/models/__init__.py
create_node_rating_counts_settings
def create_node_rating_counts_settings(sender, **kwargs): """ create node rating count and settings""" created = kwargs['created'] node = kwargs['instance'] if created: # create node_rating_count and settings # task will be executed in background unless settings.CELERY_ALWAYS_EAGER is Tr...
python
def create_node_rating_counts_settings(sender, **kwargs): """ create node rating count and settings""" created = kwargs['created'] node = kwargs['instance'] if created: # create node_rating_count and settings # task will be executed in background unless settings.CELERY_ALWAYS_EAGER is Tr...
['def', 'create_node_rating_counts_settings', '(', 'sender', ',', '*', '*', 'kwargs', ')', ':', 'created', '=', 'kwargs', '[', "'created'", ']', 'node', '=', 'kwargs', '[', "'instance'", ']', 'if', 'created', ':', '# create node_rating_count and settings', '# task will be executed in background unless settings.CELERY_A...
create node rating count and settings
['create', 'node', 'rating', 'count', 'and', 'settings']
train
https://github.com/ninuxorg/nodeshot/blob/2466f0a55f522b2696026f196436ce7ba3f1e5c6/nodeshot/community/participation/models/__init__.py#L147-L156
8,852
ArduPilot/MAVProxy
MAVProxy/modules/lib/MacOS/backend_wx.py
MenuButtonWx._handleSelectAllAxes
def _handleSelectAllAxes(self, evt): """Called when the 'select all axes' menu item is selected.""" if len(self._axisId) == 0: return for i in range(len(self._axisId)): self._menu.Check(self._axisId[i], True) self._toolbar.set_active(self.getActiveAxes()) ...
python
def _handleSelectAllAxes(self, evt): """Called when the 'select all axes' menu item is selected.""" if len(self._axisId) == 0: return for i in range(len(self._axisId)): self._menu.Check(self._axisId[i], True) self._toolbar.set_active(self.getActiveAxes()) ...
['def', '_handleSelectAllAxes', '(', 'self', ',', 'evt', ')', ':', 'if', 'len', '(', 'self', '.', '_axisId', ')', '==', '0', ':', 'return', 'for', 'i', 'in', 'range', '(', 'len', '(', 'self', '.', '_axisId', ')', ')', ':', 'self', '.', '_menu', '.', 'Check', '(', 'self', '.', '_axisId', '[', 'i', ']', ',', 'True', ')',...
Called when the 'select all axes' menu item is selected.
['Called', 'when', 'the', 'select', 'all', 'axes', 'menu', 'item', 'is', 'selected', '.']
train
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/lib/MacOS/backend_wx.py#L1521-L1528
8,853
log2timeline/plaso
plaso/engine/worker.py
EventExtractionWorker._ProcessArchiveTypes
def _ProcessArchiveTypes(self, mediator, path_spec, type_indicators): """Processes a data stream containing archive types such as: TAR or ZIP. Args: mediator (ParserMediator): mediates the interactions between parsers and other components, such as storage and abort signals. path_spec (dfv...
python
def _ProcessArchiveTypes(self, mediator, path_spec, type_indicators): """Processes a data stream containing archive types such as: TAR or ZIP. Args: mediator (ParserMediator): mediates the interactions between parsers and other components, such as storage and abort signals. path_spec (dfv...
['def', '_ProcessArchiveTypes', '(', 'self', ',', 'mediator', ',', 'path_spec', ',', 'type_indicators', ')', ':', 'number_of_type_indicators', '=', 'len', '(', 'type_indicators', ')', 'if', 'number_of_type_indicators', '==', '0', ':', 'return', 'self', '.', 'processing_status', '=', 'definitions', '.', 'STATUS_INDICATO...
Processes a data stream containing archive types such as: TAR or ZIP. Args: mediator (ParserMediator): mediates the interactions between parsers and other components, such as storage and abort signals. path_spec (dfvfs.PathSpec): path specification. type_indicators(list[str]): dfVFS arc...
['Processes', 'a', 'data', 'stream', 'containing', 'archive', 'types', 'such', 'as', ':', 'TAR', 'or', 'ZIP', '.']
train
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/engine/worker.py#L440-L504
8,854
yeraydiazdiaz/lunr.py
lunr/languages/stemmer.py
nltk_stemmer
def nltk_stemmer(stemmer, token, i=None, tokens=None): """Wrapper around a NLTK SnowballStemmer, which includes stop words for each language. Args: stemmer (SnowballStemmer): Stemmer instance that performs the stemming. token (lunr.Token): The token to stem. i (int): The index of th...
python
def nltk_stemmer(stemmer, token, i=None, tokens=None): """Wrapper around a NLTK SnowballStemmer, which includes stop words for each language. Args: stemmer (SnowballStemmer): Stemmer instance that performs the stemming. token (lunr.Token): The token to stem. i (int): The index of th...
['def', 'nltk_stemmer', '(', 'stemmer', ',', 'token', ',', 'i', '=', 'None', ',', 'tokens', '=', 'None', ')', ':', 'def', 'wrapped_stem', '(', 'token', ',', 'metadata', '=', 'None', ')', ':', 'return', 'stemmer', '.', 'stem', '(', 'token', ')', 'return', 'token', '.', 'update', '(', 'wrapped_stem', ')']
Wrapper around a NLTK SnowballStemmer, which includes stop words for each language. Args: stemmer (SnowballStemmer): Stemmer instance that performs the stemming. token (lunr.Token): The token to stem. i (int): The index of the token in a set. tokens (list): A list of tokens repr...
['Wrapper', 'around', 'a', 'NLTK', 'SnowballStemmer', 'which', 'includes', 'stop', 'words', 'for', 'each', 'language', '.']
train
https://github.com/yeraydiazdiaz/lunr.py/blob/28ec3f6d4888295eed730211ee9617aa488d6ba3/lunr/languages/stemmer.py#L13-L27
8,855
ceph/ceph-deploy
ceph_deploy/install.py
install_repo
def install_repo(args): """ For a user that only wants to install the repository only (and avoid installing Ceph and its dependencies). """ cd_conf = getattr(args, 'cd_conf', None) for hostname in args.host: LOG.debug('Detecting platform for host %s ...', hostname) distro = host...
python
def install_repo(args): """ For a user that only wants to install the repository only (and avoid installing Ceph and its dependencies). """ cd_conf = getattr(args, 'cd_conf', None) for hostname in args.host: LOG.debug('Detecting platform for host %s ...', hostname) distro = host...
['def', 'install_repo', '(', 'args', ')', ':', 'cd_conf', '=', 'getattr', '(', 'args', ',', "'cd_conf'", ',', 'None', ')', 'for', 'hostname', 'in', 'args', '.', 'host', ':', 'LOG', '.', 'debug', '(', "'Detecting platform for host %s ...'", ',', 'hostname', ')', 'distro', '=', 'hosts', '.', 'get', '(', 'hostname', ',', ...
For a user that only wants to install the repository only (and avoid installing Ceph and its dependencies).
['For', 'a', 'user', 'that', 'only', 'wants', 'to', 'install', 'the', 'repository', 'only', '(', 'and', 'avoid', 'installing', 'Ceph', 'and', 'its', 'dependencies', ')', '.']
train
https://github.com/ceph/ceph-deploy/blob/86943fcc454cd4c99a86e3493e9e93a59c661fef/ceph_deploy/install.py#L287-L316
8,856
driftx/Telephus
telephus/cassandra/Cassandra.py
Client.system_add_column_family
def system_add_column_family(self, cf_def): """ adds a column family. returns the new schema id. Parameters: - cf_def """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_system_add_column_family(cf_def) return d
python
def system_add_column_family(self, cf_def): """ adds a column family. returns the new schema id. Parameters: - cf_def """ self._seqid += 1 d = self._reqs[self._seqid] = defer.Deferred() self.send_system_add_column_family(cf_def) return d
['def', 'system_add_column_family', '(', 'self', ',', 'cf_def', ')', ':', 'self', '.', '_seqid', '+=', '1', 'd', '=', 'self', '.', '_reqs', '[', 'self', '.', '_seqid', ']', '=', 'defer', '.', 'Deferred', '(', ')', 'self', '.', 'send_system_add_column_family', '(', 'cf_def', ')', 'return', 'd']
adds a column family. returns the new schema id. Parameters: - cf_def
['adds', 'a', 'column', 'family', '.', 'returns', 'the', 'new', 'schema', 'id', '.']
train
https://github.com/driftx/Telephus/blob/860a03a0fafe71605e1a4316dfdd8d0c29094703/telephus/cassandra/Cassandra.py#L1656-L1666
8,857
TangentMicroServices/PythonClient
microclient/clients.py
ServiceBase.delete
def delete(self, resource, resource_id): ''' A base function that performs a default delete DELETE request for a given object ''' service_def, resource_def, path = self._get_service_information( resource) delete_path = "{0}{1}/" . format(path, resource_id) re...
python
def delete(self, resource, resource_id): ''' A base function that performs a default delete DELETE request for a given object ''' service_def, resource_def, path = self._get_service_information( resource) delete_path = "{0}{1}/" . format(path, resource_id) re...
['def', 'delete', '(', 'self', ',', 'resource', ',', 'resource_id', ')', ':', 'service_def', ',', 'resource_def', ',', 'path', '=', 'self', '.', '_get_service_information', '(', 'resource', ')', 'delete_path', '=', '"{0}{1}/"', '.', 'format', '(', 'path', ',', 'resource_id', ')', 'return', 'self', '.', 'call', '(', 'pa...
A base function that performs a default delete DELETE request for a given object
['A', 'base', 'function', 'that', 'performs', 'a', 'default', 'delete', 'DELETE', 'request', 'for', 'a', 'given', 'object']
train
https://github.com/TangentMicroServices/PythonClient/blob/98cc4b3027fa1b2e8a66146a7efe76370fc225f0/microclient/clients.py#L169-L177
8,858
chaoss/grimoirelab-elk
grimoire_elk/enriched/projects.py
GrimoireLibProjects.get_projects
def get_projects(self): """ Get the projects list from database """ repos_list = [] gerrit_projects_db = self.projects_db db = Database(user="root", passwd="", host="localhost", port=3306, scrdb=None, shdb=gerrit_projects_db, prjdb=None) sql = """ ...
python
def get_projects(self): """ Get the projects list from database """ repos_list = [] gerrit_projects_db = self.projects_db db = Database(user="root", passwd="", host="localhost", port=3306, scrdb=None, shdb=gerrit_projects_db, prjdb=None) sql = """ ...
['def', 'get_projects', '(', 'self', ')', ':', 'repos_list', '=', '[', ']', 'gerrit_projects_db', '=', 'self', '.', 'projects_db', 'db', '=', 'Database', '(', 'user', '=', '"root"', ',', 'passwd', '=', '""', ',', 'host', '=', '"localhost"', ',', 'port', '=', '3306', ',', 'scrdb', '=', 'None', ',', 'shdb', '=', 'gerrit_...
Get the projects list from database
['Get', 'the', 'projects', 'list', 'from', 'database']
train
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/projects.py#L37-L62
8,859
bunq/sdk_python
bunq/sdk/model/generated/endpoint.py
CustomerLimit.is_all_field_none
def is_all_field_none(self): """ :rtype: bool """ if self._limit_monetary_account is not None: return False if self._limit_monetary_account_remaining is not None: return False if self._limit_card_debit_maestro is not None: return Fal...
python
def is_all_field_none(self): """ :rtype: bool """ if self._limit_monetary_account is not None: return False if self._limit_monetary_account_remaining is not None: return False if self._limit_card_debit_maestro is not None: return Fal...
['def', 'is_all_field_none', '(', 'self', ')', ':', 'if', 'self', '.', '_limit_monetary_account', 'is', 'not', 'None', ':', 'return', 'False', 'if', 'self', '.', '_limit_monetary_account_remaining', 'is', 'not', 'None', ':', 'return', 'False', 'if', 'self', '.', '_limit_card_debit_maestro', 'is', 'not', 'None', ':', 'r...
:rtype: bool
[':', 'rtype', ':', 'bool']
train
https://github.com/bunq/sdk_python/blob/da6c9b83e6d83ee8062617f53c6eb7293c0d863d/bunq/sdk/model/generated/endpoint.py#L373-L405
8,860
ergo/ziggurat_foundations
ziggurat_foundations/models/services/resource.py
ResourceService.direct_perms_for_user
def direct_perms_for_user(cls, instance, user, db_session=None): """ returns permissions that given user has for this resource without ones inherited from groups that user belongs to :param instance: :param user: :param db_session: :return: """ ...
python
def direct_perms_for_user(cls, instance, user, db_session=None): """ returns permissions that given user has for this resource without ones inherited from groups that user belongs to :param instance: :param user: :param db_session: :return: """ ...
['def', 'direct_perms_for_user', '(', 'cls', ',', 'instance', ',', 'user', ',', 'db_session', '=', 'None', ')', ':', 'db_session', '=', 'get_db_session', '(', 'db_session', ',', 'instance', ')', 'query', '=', 'db_session', '.', 'query', '(', 'cls', '.', 'models_proxy', '.', 'UserResourcePermission', '.', 'user_id', ','...
returns permissions that given user has for this resource without ones inherited from groups that user belongs to :param instance: :param user: :param db_session: :return:
['returns', 'permissions', 'that', 'given', 'user', 'has', 'for', 'this', 'resource', 'without', 'ones', 'inherited', 'from', 'groups', 'that', 'user', 'belongs', 'to']
train
https://github.com/ergo/ziggurat_foundations/blob/9eeec894d08e8d7defa60ddc04b63f69cd4cbeba/ziggurat_foundations/models/services/resource.py#L109-L139
8,861
aparo/pyes
pyes/models.py
ElasticSearchModel.save
def save(self, bulk=False, id=None, parent=None, routing=None, force=False): """ Save the object and returns id """ meta = self._meta conn = meta['connection'] id = id or meta.get("id", None) parent = parent or meta.get('parent', None) routing = routing or...
python
def save(self, bulk=False, id=None, parent=None, routing=None, force=False): """ Save the object and returns id """ meta = self._meta conn = meta['connection'] id = id or meta.get("id", None) parent = parent or meta.get('parent', None) routing = routing or...
['def', 'save', '(', 'self', ',', 'bulk', '=', 'False', ',', 'id', '=', 'None', ',', 'parent', '=', 'None', ',', 'routing', '=', 'None', ',', 'force', '=', 'False', ')', ':', 'meta', '=', 'self', '.', '_meta', 'conn', '=', 'meta', '[', "'connection'", ']', 'id', '=', 'id', 'or', 'meta', '.', 'get', '(', '"id"', ',', 'N...
Save the object and returns id
['Save', 'the', 'object', 'and', 'returns', 'id']
train
https://github.com/aparo/pyes/blob/712eb6095961755067b2b5baa262008ade6584b3/pyes/models.py#L66-L89
8,862
markuskiller/textblob-de
textblob_de/ext/_pattern/text/tree.py
Sentence.parse_token
def parse_token(self, token, tags=[WORD, POS, CHUNK, PNP, REL, ANCHOR, LEMMA]): """ Returns the arguments for Sentence.append() from a tagged token representation. The order in which token tags appear can be specified. The default order is (separated by slashes): - word, ...
python
def parse_token(self, token, tags=[WORD, POS, CHUNK, PNP, REL, ANCHOR, LEMMA]): """ Returns the arguments for Sentence.append() from a tagged token representation. The order in which token tags appear can be specified. The default order is (separated by slashes): - word, ...
['def', 'parse_token', '(', 'self', ',', 'token', ',', 'tags', '=', '[', 'WORD', ',', 'POS', ',', 'CHUNK', ',', 'PNP', ',', 'REL', ',', 'ANCHOR', ',', 'LEMMA', ']', ')', ':', 'p', '=', '{', 'WORD', ':', '""', ',', 'POS', ':', 'None', ',', 'IOB', ':', 'None', ',', 'CHUNK', ':', 'None', ',', 'PNP', ':', 'None', ',', 'REL...
Returns the arguments for Sentence.append() from a tagged token representation. The order in which token tags appear can be specified. The default order is (separated by slashes): - word, - part-of-speech, - (IOB-)chunk, - (IOB-)preposition, ...
['Returns', 'the', 'arguments', 'for', 'Sentence', '.', 'append', '()', 'from', 'a', 'tagged', 'token', 'representation', '.', 'The', 'order', 'in', 'which', 'token', 'tags', 'appear', 'can', 'be', 'specified', '.', 'The', 'default', 'order', 'is', '(', 'separated', 'by', 'slashes', ')', ':', '-', 'word', '-', 'part', ...
train
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/ext/_pattern/text/tree.py#L730-L796
8,863
what-studio/profiling
profiling/tracing/__init__.py
TracingProfiler.record_leaving
def record_leaving(self, time, code, frame_key, parent_stats): """Left from a function call.""" try: stats = parent_stats.get_child(code) time_entered = self._times_entered.pop((code, frame_key)) except KeyError: return time_elapsed = time - time_enter...
python
def record_leaving(self, time, code, frame_key, parent_stats): """Left from a function call.""" try: stats = parent_stats.get_child(code) time_entered = self._times_entered.pop((code, frame_key)) except KeyError: return time_elapsed = time - time_enter...
['def', 'record_leaving', '(', 'self', ',', 'time', ',', 'code', ',', 'frame_key', ',', 'parent_stats', ')', ':', 'try', ':', 'stats', '=', 'parent_stats', '.', 'get_child', '(', 'code', ')', 'time_entered', '=', 'self', '.', '_times_entered', '.', 'pop', '(', '(', 'code', ',', 'frame_key', ')', ')', 'except', 'KeyErro...
Left from a function call.
['Left', 'from', 'a', 'function', 'call', '.']
train
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/tracing/__init__.py#L116-L124
8,864
twisted/txaws
txaws/server/resource.py
QueryAPI.get_call_arguments
def get_call_arguments(self, request): """ Get call arguments from a request. Override this if you want to use a wire format different from AWS's. The return value is a dictionary with three keys: 'transport_args', 'handler_args', and 'raw_args'. The value of 'transport...
python
def get_call_arguments(self, request): """ Get call arguments from a request. Override this if you want to use a wire format different from AWS's. The return value is a dictionary with three keys: 'transport_args', 'handler_args', and 'raw_args'. The value of 'transport...
['def', 'get_call_arguments', '(', 'self', ',', 'request', ')', ':', 'params', '=', 'dict', '(', '(', 'k', ',', 'v', '[', '-', '1', ']', ')', 'for', 'k', ',', 'v', 'in', 'request', '.', 'args', '.', 'iteritems', '(', ')', ')', 'args', ',', 'rest', '=', 'self', '.', 'schema', '.', 'extract', '(', 'params', ')', "# Get r...
Get call arguments from a request. Override this if you want to use a wire format different from AWS's. The return value is a dictionary with three keys: 'transport_args', 'handler_args', and 'raw_args'. The value of 'transport_args' must be a dictionary with the following keys...
['Get', 'call', 'arguments', 'from', 'a', 'request', '.', 'Override', 'this', 'if', 'you', 'want', 'to', 'use', 'a', 'wire', 'format', 'different', 'from', 'AWS', 's', '.']
train
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/server/resource.py#L169-L214
8,865
IDSIA/sacred
sacred/metrics_logger.py
linearize_metrics
def linearize_metrics(logged_metrics): """ Group metrics by name. Takes a list of individual measurements, possibly belonging to different metrics and groups them by name. :param logged_metrics: A list of ScalarMetricLogEntries :return: Measured values grouped by the metric name: {"metric_...
python
def linearize_metrics(logged_metrics): """ Group metrics by name. Takes a list of individual measurements, possibly belonging to different metrics and groups them by name. :param logged_metrics: A list of ScalarMetricLogEntries :return: Measured values grouped by the metric name: {"metric_...
['def', 'linearize_metrics', '(', 'logged_metrics', ')', ':', 'metrics_by_name', '=', '{', '}', 'for', 'metric_entry', 'in', 'logged_metrics', ':', 'if', 'metric_entry', '.', 'name', 'not', 'in', 'metrics_by_name', ':', 'metrics_by_name', '[', 'metric_entry', '.', 'name', ']', '=', '{', '"steps"', ':', '[', ']', ',', '...
Group metrics by name. Takes a list of individual measurements, possibly belonging to different metrics and groups them by name. :param logged_metrics: A list of ScalarMetricLogEntries :return: Measured values grouped by the metric name: {"metric_name1": {"steps": [0,1,2], "values": [4, 5, 6], ...
['Group', 'metrics', 'by', 'name', '.']
train
https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/metrics_logger.py#L85-L113
8,866
vtkiorg/vtki
vtki/plotting.py
BasePlotter.image
def image(self): """ Returns an image array of current render window """ if not hasattr(self, 'ren_win') and hasattr(self, 'last_image'): return self.last_image ifilter = vtk.vtkWindowToImageFilter() ifilter.SetInput(self.ren_win) ifilter.ReadFrontBufferOff() ...
python
def image(self): """ Returns an image array of current render window """ if not hasattr(self, 'ren_win') and hasattr(self, 'last_image'): return self.last_image ifilter = vtk.vtkWindowToImageFilter() ifilter.SetInput(self.ren_win) ifilter.ReadFrontBufferOff() ...
['def', 'image', '(', 'self', ')', ':', 'if', 'not', 'hasattr', '(', 'self', ',', "'ren_win'", ')', 'and', 'hasattr', '(', 'self', ',', "'last_image'", ')', ':', 'return', 'self', '.', 'last_image', 'ifilter', '=', 'vtk', '.', 'vtkWindowToImageFilter', '(', ')', 'ifilter', '.', 'SetInput', '(', 'self', '.', 'ren_win', ...
Returns an image array of current render window
['Returns', 'an', 'image', 'array', 'of', 'current', 'render', 'window']
train
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L2060-L2071
8,867
fredericklussier/ObservablePy
observablePy/ObservableStore.py
ObservableStore.isObservableElement
def isObservableElement(self, elementName): """ Mention if an element is an observable element. :param str ElementName: the element name to evaluate :return: true if is an observable element, otherwise false. :rtype: bool """ if not(isinstance(elementName, str)):...
python
def isObservableElement(self, elementName): """ Mention if an element is an observable element. :param str ElementName: the element name to evaluate :return: true if is an observable element, otherwise false. :rtype: bool """ if not(isinstance(elementName, str)):...
['def', 'isObservableElement', '(', 'self', ',', 'elementName', ')', ':', 'if', 'not', '(', 'isinstance', '(', 'elementName', ',', 'str', ')', ')', ':', 'raise', 'TypeError', '(', '"Element name should be a string ."', '+', '"I receive this {0}"', '.', 'format', '(', 'elementName', ')', ')', 'return', '(', 'True', 'if'...
Mention if an element is an observable element. :param str ElementName: the element name to evaluate :return: true if is an observable element, otherwise false. :rtype: bool
['Mention', 'if', 'an', 'element', 'is', 'an', 'observable', 'element', '.']
train
https://github.com/fredericklussier/ObservablePy/blob/fd7926a0568621f80b1d567d18f199976f1fa4e8/observablePy/ObservableStore.py#L43-L58
8,868
heroku/heroku.py
heroku/models.py
App.processes
def processes(self): """The proccesses for this app.""" return self._h._get_resources( resource=('apps', self.name, 'ps'), obj=Process, app=self, map=ProcessListResource )
python
def processes(self): """The proccesses for this app.""" return self._h._get_resources( resource=('apps', self.name, 'ps'), obj=Process, app=self, map=ProcessListResource )
['def', 'processes', '(', 'self', ')', ':', 'return', 'self', '.', '_h', '.', '_get_resources', '(', 'resource', '=', '(', "'apps'", ',', 'self', '.', 'name', ',', "'ps'", ')', ',', 'obj', '=', 'Process', ',', 'app', '=', 'self', ',', 'map', '=', 'ProcessListResource', ')']
The proccesses for this app.
['The', 'proccesses', 'for', 'this', 'app', '.']
train
https://github.com/heroku/heroku.py/blob/cadc0a074896cf29c65a457c5c5bdb2069470af0/heroku/models.py#L238-L243
8,869
inasafe/inasafe
safe/gui/widgets/dock.py
Dock._validate_question_area
def _validate_question_area(self): """Helper method to evaluate the current state of the dialog. This function will determine if it is appropriate for the OK button to be enabled or not. .. note:: The enabled state of the OK button on the dialog will NOT be updated (set True...
python
def _validate_question_area(self): """Helper method to evaluate the current state of the dialog. This function will determine if it is appropriate for the OK button to be enabled or not. .. note:: The enabled state of the OK button on the dialog will NOT be updated (set True...
['def', '_validate_question_area', '(', 'self', ')', ':', 'hazard_index', '=', 'self', '.', 'hazard_layer_combo', '.', 'currentIndex', '(', ')', 'exposure_index', '=', 'self', '.', 'exposure_layer_combo', '.', 'currentIndex', '(', ')', 'if', 'hazard_index', '==', '-', '1', 'or', 'exposure_index', '==', '-', '1', ':', '...
Helper method to evaluate the current state of the dialog. This function will determine if it is appropriate for the OK button to be enabled or not. .. note:: The enabled state of the OK button on the dialog will NOT be updated (set True or False) depending on the outcome of ...
['Helper', 'method', 'to', 'evaluate', 'the', 'current', 'state', 'of', 'the', 'dialog', '.']
train
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/widgets/dock.py#L1564-L1593
8,870
switchboardpy/switchboard
switchboard/models.py
Model.update
def update(cls, spec, updates, upsert=False): ''' The spec is used to search for the data to update, updates contains the values to be updated, and upsert specifies whether to do an insert if the original data is not found. ''' if 'key' in spec: previous = cls...
python
def update(cls, spec, updates, upsert=False): ''' The spec is used to search for the data to update, updates contains the values to be updated, and upsert specifies whether to do an insert if the original data is not found. ''' if 'key' in spec: previous = cls...
['def', 'update', '(', 'cls', ',', 'spec', ',', 'updates', ',', 'upsert', '=', 'False', ')', ':', 'if', "'key'", 'in', 'spec', ':', 'previous', '=', 'cls', '.', 'get', '(', 'spec', '[', "'key'", ']', ')', 'else', ':', 'previous', '=', 'None', 'if', 'previous', ':', '# Update existing data.', 'current', '=', 'cls', '(',...
The spec is used to search for the data to update, updates contains the values to be updated, and upsert specifies whether to do an insert if the original data is not found.
['The', 'spec', 'is', 'used', 'to', 'search', 'for', 'the', 'data', 'to', 'update', 'updates', 'contains', 'the', 'values', 'to', 'be', 'updated', 'and', 'upsert', 'specifies', 'whether', 'to', 'do', 'an', 'insert', 'if', 'the', 'original', 'data', 'is', 'not', 'found', '.']
train
https://github.com/switchboardpy/switchboard/blob/074b4838dbe140cb8f89d3c25ae25e70a29f9553/switchboard/models.py#L124-L146
8,871
proycon/flat
flat/modes/viewer/views.py
pub_poll
def pub_poll(request, docid): """The initial viewer, does not provide the document content yet""" try: r = flat.comm.get(request, '/poll/pub/' + docid + '/', False) except URLError: return HttpResponseForbidden("Unable to connect to the document server [viewer/poll]") return HttpResponse...
python
def pub_poll(request, docid): """The initial viewer, does not provide the document content yet""" try: r = flat.comm.get(request, '/poll/pub/' + docid + '/', False) except URLError: return HttpResponseForbidden("Unable to connect to the document server [viewer/poll]") return HttpResponse...
['def', 'pub_poll', '(', 'request', ',', 'docid', ')', ':', 'try', ':', 'r', '=', 'flat', '.', 'comm', '.', 'get', '(', 'request', ',', "'/poll/pub/'", '+', 'docid', '+', "'/'", ',', 'False', ')', 'except', 'URLError', ':', 'return', 'HttpResponseForbidden', '(', '"Unable to connect to the document server [viewer/poll]...
The initial viewer, does not provide the document content yet
['The', 'initial', 'viewer', 'does', 'not', 'provide', 'the', 'document', 'content', 'yet']
train
https://github.com/proycon/flat/blob/f14eea61edcae8656dadccd9a43481ff7e710ffb/flat/modes/viewer/views.py#L37-L43
8,872
pinterest/pymemcache
pymemcache/client/base.py
Client.prepend
def prepend(self, key, value, expire=0, noreply=None): """ The memcached "prepend" command. Args: key: str, see class docs for details. value: str, see class docs for details. expire: optional int, number of seconds until the item is expired from ...
python
def prepend(self, key, value, expire=0, noreply=None): """ The memcached "prepend" command. Args: key: str, see class docs for details. value: str, see class docs for details. expire: optional int, number of seconds until the item is expired from ...
['def', 'prepend', '(', 'self', ',', 'key', ',', 'value', ',', 'expire', '=', '0', ',', 'noreply', '=', 'None', ')', ':', 'if', 'noreply', 'is', 'None', ':', 'noreply', '=', 'self', '.', 'default_noreply', 'return', 'self', '.', '_store_cmd', '(', "b'prepend'", ',', '{', 'key', ':', 'value', '}', ',', 'expire', ',', 'n...
The memcached "prepend" command. Args: key: str, see class docs for details. value: str, see class docs for details. expire: optional int, number of seconds until the item is expired from the cache, or zero for no expiry (the default). noreply: optional...
['The', 'memcached', 'prepend', 'command', '.']
train
https://github.com/pinterest/pymemcache/blob/f3a348f4ce2248cce8b398e93e08d984fb9100e5/pymemcache/client/base.py#L401-L418
8,873
novopl/peltak
src/peltak/extra/gitflow/logic/feature.py
start
def start(name): # type: (str) -> None """ Start working on a new feature by branching off develop. This will create a new branch off develop called feature/<name>. Args: name (str): The name of the new feature. """ feature_name = 'feature/' + common.to_branch_name(name) ...
python
def start(name): # type: (str) -> None """ Start working on a new feature by branching off develop. This will create a new branch off develop called feature/<name>. Args: name (str): The name of the new feature. """ feature_name = 'feature/' + common.to_branch_name(name) ...
['def', 'start', '(', 'name', ')', ':', '# type: (str) -> None', 'feature_name', '=', "'feature/'", '+', 'common', '.', 'to_branch_name', '(', 'name', ')', 'develop', '=', 'conf', '.', 'get', '(', "'git.devel_branch'", ',', "'develop'", ')', 'common', '.', 'assert_on_branch', '(', 'develop', ')', 'common', '.', 'git_ch...
Start working on a new feature by branching off develop. This will create a new branch off develop called feature/<name>. Args: name (str): The name of the new feature.
['Start', 'working', 'on', 'a', 'new', 'feature', 'by', 'branching', 'off', 'develop', '.']
train
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/gitflow/logic/feature.py#L30-L44
8,874
twilio/twilio-python
twilio/rest/proxy/v1/service/__init__.py
ServiceInstance.update
def update(self, unique_name=values.unset, default_ttl=values.unset, callback_url=values.unset, geo_match_level=values.unset, number_selection_behavior=values.unset, intercept_callback_url=values.unset, out_of_session_callback_url=values.unset, ...
python
def update(self, unique_name=values.unset, default_ttl=values.unset, callback_url=values.unset, geo_match_level=values.unset, number_selection_behavior=values.unset, intercept_callback_url=values.unset, out_of_session_callback_url=values.unset, ...
['def', 'update', '(', 'self', ',', 'unique_name', '=', 'values', '.', 'unset', ',', 'default_ttl', '=', 'values', '.', 'unset', ',', 'callback_url', '=', 'values', '.', 'unset', ',', 'geo_match_level', '=', 'values', '.', 'unset', ',', 'number_selection_behavior', '=', 'values', '.', 'unset', ',', 'intercept_callback_...
Update the ServiceInstance :param unicode unique_name: An application-defined string that uniquely identifies the resource :param unicode default_ttl: Default TTL for a Session, in seconds :param unicode callback_url: The URL we should call when the interaction status changes :param Ser...
['Update', 'the', 'ServiceInstance']
train
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/proxy/v1/service/__init__.py#L558-L588
8,875
phac-nml/sistr_cmd
sistr/src/cgmlst/extras/centroid_cgmlst_alleles.py
min_row_dist_sum_idx
def min_row_dist_sum_idx(dists): """Find the index of the row with the minimum row distance sum This should return the index of the row index with the least distance overall to all other rows. Args: dists (np.array): must be square distance matrix Returns: int: index of row wit...
python
def min_row_dist_sum_idx(dists): """Find the index of the row with the minimum row distance sum This should return the index of the row index with the least distance overall to all other rows. Args: dists (np.array): must be square distance matrix Returns: int: index of row wit...
['def', 'min_row_dist_sum_idx', '(', 'dists', ')', ':', 'row_sums', '=', 'np', '.', 'apply_along_axis', '(', 'arr', '=', 'dists', ',', 'axis', '=', '0', ',', 'func1d', '=', 'np', '.', 'sum', ')', 'return', 'row_sums', '.', 'argmin', '(', ')']
Find the index of the row with the minimum row distance sum This should return the index of the row index with the least distance overall to all other rows. Args: dists (np.array): must be square distance matrix Returns: int: index of row with min dist row sum
['Find', 'the', 'index', 'of', 'the', 'row', 'with', 'the', 'minimum', 'row', 'distance', 'sum']
train
https://github.com/phac-nml/sistr_cmd/blob/4630fae72439723b354a94b94fbe76ad2f9f6295/sistr/src/cgmlst/extras/centroid_cgmlst_alleles.py#L84-L97
8,876
seleniumbase/SeleniumBase
seleniumbase/fixtures/base_case.py
BaseCase.assert_link_text
def assert_link_text(self, link_text, timeout=settings.SMALL_TIMEOUT): """ Similar to wait_for_link_text_visible(), but returns nothing. As above, will raise an exception if nothing can be found. Returns True if successful. Default timeout = SMALL_TIMEOUT. """ if self.timeout_mul...
python
def assert_link_text(self, link_text, timeout=settings.SMALL_TIMEOUT): """ Similar to wait_for_link_text_visible(), but returns nothing. As above, will raise an exception if nothing can be found. Returns True if successful. Default timeout = SMALL_TIMEOUT. """ if self.timeout_mul...
['def', 'assert_link_text', '(', 'self', ',', 'link_text', ',', 'timeout', '=', 'settings', '.', 'SMALL_TIMEOUT', ')', ':', 'if', 'self', '.', 'timeout_multiplier', 'and', 'timeout', '==', 'settings', '.', 'SMALL_TIMEOUT', ':', 'timeout', '=', 'self', '.', '__get_new_timeout', '(', 'timeout', ')', 'self', '.', 'wait_fo...
Similar to wait_for_link_text_visible(), but returns nothing. As above, will raise an exception if nothing can be found. Returns True if successful. Default timeout = SMALL_TIMEOUT.
['Similar', 'to', 'wait_for_link_text_visible', '()', 'but', 'returns', 'nothing', '.', 'As', 'above', 'will', 'raise', 'an', 'exception', 'if', 'nothing', 'can', 'be', 'found', '.', 'Returns', 'True', 'if', 'successful', '.', 'Default', 'timeout', '=', 'SMALL_TIMEOUT', '.']
train
https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L2319-L2330
8,877
nameko/nameko
nameko/messaging.py
QueueConsumer.get_consumers
def get_consumers(self, consumer_cls, channel): """ Kombu callback to set up consumers. Called after any (re)connection to the broker. """ _log.debug('setting up consumers %s', self) for provider in self._providers: callbacks = [partial(self.handle_message, provider...
python
def get_consumers(self, consumer_cls, channel): """ Kombu callback to set up consumers. Called after any (re)connection to the broker. """ _log.debug('setting up consumers %s', self) for provider in self._providers: callbacks = [partial(self.handle_message, provider...
['def', 'get_consumers', '(', 'self', ',', 'consumer_cls', ',', 'channel', ')', ':', '_log', '.', 'debug', '(', "'setting up consumers %s'", ',', 'self', ')', 'for', 'provider', 'in', 'self', '.', '_providers', ':', 'callbacks', '=', '[', 'partial', '(', 'self', '.', 'handle_message', ',', 'provider', ')', ']', 'consum...
Kombu callback to set up consumers. Called after any (re)connection to the broker.
['Kombu', 'callback', 'to', 'set', 'up', 'consumers', '.']
train
https://github.com/nameko/nameko/blob/88d7e5211de4fcc1c34cd7f84d7c77f0619c5f5d/nameko/messaging.py#L369-L388
8,878
PmagPy/PmagPy
SPD/lib/lib_ptrm_statistics.py
get_delta_pal
def get_delta_pal(b, b_star): """ input: b, b_star (actual and corrected slope) output: delta_pal """ delta_pal = numpy.abs(old_div((b - b_star), b)) * 100 return delta_pal
python
def get_delta_pal(b, b_star): """ input: b, b_star (actual and corrected slope) output: delta_pal """ delta_pal = numpy.abs(old_div((b - b_star), b)) * 100 return delta_pal
['def', 'get_delta_pal', '(', 'b', ',', 'b_star', ')', ':', 'delta_pal', '=', 'numpy', '.', 'abs', '(', 'old_div', '(', '(', 'b', '-', 'b_star', ')', ',', 'b', ')', ')', '*', '100', 'return', 'delta_pal']
input: b, b_star (actual and corrected slope) output: delta_pal
['input', ':', 'b', 'b_star', '(', 'actual', 'and', 'corrected', 'slope', ')', 'output', ':', 'delta_pal']
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/SPD/lib/lib_ptrm_statistics.py#L215-L221
8,879
ttroy50/pyephember
pyephember/pyephember.py
EphEmber.set_target_temperature_by_id
def set_target_temperature_by_id(self, zone_id, target_temperature): """ Set the target temperature for a zone by id """ if not self._do_auth(): raise RuntimeError("Unable to login") data = { "ZoneId": zone_id, "TargetTemperature": target_temp...
python
def set_target_temperature_by_id(self, zone_id, target_temperature): """ Set the target temperature for a zone by id """ if not self._do_auth(): raise RuntimeError("Unable to login") data = { "ZoneId": zone_id, "TargetTemperature": target_temp...
['def', 'set_target_temperature_by_id', '(', 'self', ',', 'zone_id', ',', 'target_temperature', ')', ':', 'if', 'not', 'self', '.', '_do_auth', '(', ')', ':', 'raise', 'RuntimeError', '(', '"Unable to login"', ')', 'data', '=', '{', '"ZoneId"', ':', 'zone_id', ',', '"TargetTemperature"', ':', 'target_temperature', '}',...
Set the target temperature for a zone by id
['Set', 'the', 'target', 'temperature', 'for', 'a', 'zone', 'by', 'id']
train
https://github.com/ttroy50/pyephember/blob/3ee159ee82b926b957dae8dcbc7a4bfb6807a9b4/pyephember/pyephember.py#L243-L272
8,880
projectshift/shift-boiler
boiler/user/models.py
User.verify_password
def verify_password(self, password): """ Verify a given string for being valid password """ if self.password is None: return False from boiler.user.util.passlib import passlib_context return passlib_context.verify(str(password), self.password)
python
def verify_password(self, password): """ Verify a given string for being valid password """ if self.password is None: return False from boiler.user.util.passlib import passlib_context return passlib_context.verify(str(password), self.password)
['def', 'verify_password', '(', 'self', ',', 'password', ')', ':', 'if', 'self', '.', 'password', 'is', 'None', ':', 'return', 'False', 'from', 'boiler', '.', 'user', '.', 'util', '.', 'passlib', 'import', 'passlib_context', 'return', 'passlib_context', '.', 'verify', '(', 'str', '(', 'password', ')', ',', 'self', '.',...
Verify a given string for being valid password
['Verify', 'a', 'given', 'string', 'for', 'being', 'valid', 'password']
train
https://github.com/projectshift/shift-boiler/blob/8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b/boiler/user/models.py#L332-L338
8,881
pnegahdar/inenv
inenv/inenv.py
toggle_autojump
def toggle_autojump(): """Toggles Autojump""" if not autojump_enabled(): with open(AUTOJUMP_FILE, 'w+') as ajfile: ajfile.write("enabled") else: os.remove(AUTOJUMP_FILE)
python
def toggle_autojump(): """Toggles Autojump""" if not autojump_enabled(): with open(AUTOJUMP_FILE, 'w+') as ajfile: ajfile.write("enabled") else: os.remove(AUTOJUMP_FILE)
['def', 'toggle_autojump', '(', ')', ':', 'if', 'not', 'autojump_enabled', '(', ')', ':', 'with', 'open', '(', 'AUTOJUMP_FILE', ',', "'w+'", ')', 'as', 'ajfile', ':', 'ajfile', '.', 'write', '(', '"enabled"', ')', 'else', ':', 'os', '.', 'remove', '(', 'AUTOJUMP_FILE', ')']
Toggles Autojump
['Toggles', 'Autojump']
train
https://github.com/pnegahdar/inenv/blob/8f484e520892bf9eb59f91b4b5c92df9fbd9a4e6/inenv/inenv.py#L228-L234
8,882
tanghaibao/jcvi
jcvi/utils/range.py
range_distance
def range_distance(a, b, distmode='ss'): """ Returns the distance between two ranges. distmode is ss, se, es, ee and sets the place on read one and two to measure the distance (s = start, e = end) >>> range_distance(("1", 30, 45, '+'), ("1", 45, 55, '+')) (26, '++') >>> range_distanc...
python
def range_distance(a, b, distmode='ss'): """ Returns the distance between two ranges. distmode is ss, se, es, ee and sets the place on read one and two to measure the distance (s = start, e = end) >>> range_distance(("1", 30, 45, '+'), ("1", 45, 55, '+')) (26, '++') >>> range_distanc...
['def', 'range_distance', '(', 'a', ',', 'b', ',', 'distmode', '=', "'ss'", ')', ':', 'assert', 'distmode', 'in', '(', "'ss'", ',', "'ee'", ')', 'a_chr', ',', 'a_min', ',', 'a_max', ',', 'a_strand', '=', 'a', 'b_chr', ',', 'b_min', ',', 'b_max', ',', 'b_strand', '=', 'b', '# must be on the same chromosome', 'if', 'a_ch...
Returns the distance between two ranges. distmode is ss, se, es, ee and sets the place on read one and two to measure the distance (s = start, e = end) >>> range_distance(("1", 30, 45, '+'), ("1", 45, 55, '+')) (26, '++') >>> range_distance(("1", 30, 45, '-'), ("1", 57, 68, '-')) (39, '-...
['Returns', 'the', 'distance', 'between', 'two', 'ranges', '.']
train
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/utils/range.py#L116-L155
8,883
google/grr
grr/server/grr_response_server/gui/api_plugins/vfs.py
ApiAff4ObjectRepresentation.InitFromAff4Object
def InitFromAff4Object(self, aff4_obj): """Initializes the current instance from an Aff4Object. Iterates the inheritance hierarchy of the given Aff4Object and adds a ApiAff4ObjectType for each class found in the hierarchy. Args: aff4_obj: An Aff4Object as source for the initialization. Retu...
python
def InitFromAff4Object(self, aff4_obj): """Initializes the current instance from an Aff4Object. Iterates the inheritance hierarchy of the given Aff4Object and adds a ApiAff4ObjectType for each class found in the hierarchy. Args: aff4_obj: An Aff4Object as source for the initialization. Retu...
['def', 'InitFromAff4Object', '(', 'self', ',', 'aff4_obj', ')', ':', 'attr_blacklist', '=', '[', ']', '# We use this to show attributes only once.', 'self', '.', 'types', '=', '[', ']', 'for', 'aff4_cls', 'in', 'aff4_obj', '.', '__class__', '.', '__mro__', ':', 'if', 'not', 'hasattr', '(', 'aff4_cls', ',', '"SchemaCls...
Initializes the current instance from an Aff4Object. Iterates the inheritance hierarchy of the given Aff4Object and adds a ApiAff4ObjectType for each class found in the hierarchy. Args: aff4_obj: An Aff4Object as source for the initialization. Returns: A reference to the current instance.
['Initializes', 'the', 'current', 'instance', 'from', 'an', 'Aff4Object', '.']
train
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/gui/api_plugins/vfs.py#L182-L211
8,884
openvax/pyensembl
pyensembl/common.py
_memoize_cache_key
def _memoize_cache_key(args, kwargs): """Turn args tuple and kwargs dictionary into a hashable key. Expects that all arguments to a memoized function are either hashable or can be uniquely identified from type(arg) and repr(arg). """ cache_key_list = [] # hack to get around the unhashability o...
python
def _memoize_cache_key(args, kwargs): """Turn args tuple and kwargs dictionary into a hashable key. Expects that all arguments to a memoized function are either hashable or can be uniquely identified from type(arg) and repr(arg). """ cache_key_list = [] # hack to get around the unhashability o...
['def', '_memoize_cache_key', '(', 'args', ',', 'kwargs', ')', ':', 'cache_key_list', '=', '[', ']', '# hack to get around the unhashability of lists,', '# add a special case to convert them to tuples', 'for', 'arg', 'in', 'args', ':', 'if', 'type', '(', 'arg', ')', 'is', 'list', ':', 'cache_key_list', '.', 'append', '...
Turn args tuple and kwargs dictionary into a hashable key. Expects that all arguments to a memoized function are either hashable or can be uniquely identified from type(arg) and repr(arg).
['Turn', 'args', 'tuple', 'and', 'kwargs', 'dictionary', 'into', 'a', 'hashable', 'key', '.']
train
https://github.com/openvax/pyensembl/blob/4b995fb72e848206d6fbf11950cf30964cd9b3aa/pyensembl/common.py#L31-L51
8,885
deshima-dev/decode
decode/joke/functions.py
youtube
def youtube(keyword=None): """Open youtube. Args: keyword (optional): Search word. """ if keyword is None: web.open('https://www.youtube.com/watch?v=L_mBVT2jBFw') else: web.open(quote('https://www.youtube.com/results?search_query={}'.format(keyword), RESERVED))
python
def youtube(keyword=None): """Open youtube. Args: keyword (optional): Search word. """ if keyword is None: web.open('https://www.youtube.com/watch?v=L_mBVT2jBFw') else: web.open(quote('https://www.youtube.com/results?search_query={}'.format(keyword), RESERVED))
['def', 'youtube', '(', 'keyword', '=', 'None', ')', ':', 'if', 'keyword', 'is', 'None', ':', 'web', '.', 'open', '(', "'https://www.youtube.com/watch?v=L_mBVT2jBFw'", ')', 'else', ':', 'web', '.', 'open', '(', 'quote', '(', "'https://www.youtube.com/results?search_query={}'", '.', 'format', '(', 'keyword', ')', ',', '...
Open youtube. Args: keyword (optional): Search word.
['Open', 'youtube', '.']
train
https://github.com/deshima-dev/decode/blob/e789e174cd316e7ec8bc55be7009ad35baced3c0/decode/joke/functions.py#L21-L30
8,886
NuGrid/NuGridPy
nugridpy/mesa.py
history_data.xche4_teff
def xche4_teff(self,ifig=None,lims=[1.,0.,3.4,4.7],label=None,colour=None, s2ms=True,dashes=None): """ Plot effective temperature against central helium abundance. Parameters ---------- ifig : integer or string Figure label, if None the current fig...
python
def xche4_teff(self,ifig=None,lims=[1.,0.,3.4,4.7],label=None,colour=None, s2ms=True,dashes=None): """ Plot effective temperature against central helium abundance. Parameters ---------- ifig : integer or string Figure label, if None the current fig...
['def', 'xche4_teff', '(', 'self', ',', 'ifig', '=', 'None', ',', 'lims', '=', '[', '1.', ',', '0.', ',', '3.4', ',', '4.7', ']', ',', 'label', '=', 'None', ',', 'colour', '=', 'None', ',', 's2ms', '=', 'True', ',', 'dashes', '=', 'None', ')', ':', 'fsize', '=', '18', 'params', '=', '{', "'axes.labelsize'", ':', 'fsize...
Plot effective temperature against central helium abundance. Parameters ---------- ifig : integer or string Figure label, if None the current figure is used The default value is None. lims : list [x_lower, x_upper, y_lower, y_upper] label : string ...
['Plot', 'effective', 'temperature', 'against', 'central', 'helium', 'abundance', '.']
train
https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/mesa.py#L1110-L1184
8,887
sorgerlab/indra
indra/sources/hume/processor.py
HumeJsonLdProcessor._find_relations
def _find_relations(self): """Find all relevant relation elements and return them in a list.""" # Get all extractions extractions = \ list(self.tree.execute("$.extractions[(@.@type is 'Extraction')]")) # Get relations from extractions relations = [] for e in ...
python
def _find_relations(self): """Find all relevant relation elements and return them in a list.""" # Get all extractions extractions = \ list(self.tree.execute("$.extractions[(@.@type is 'Extraction')]")) # Get relations from extractions relations = [] for e in ...
['def', '_find_relations', '(', 'self', ')', ':', '# Get all extractions', 'extractions', '=', 'list', '(', 'self', '.', 'tree', '.', 'execute', '(', '"$.extractions[(@.@type is \'Extraction\')]"', ')', ')', '# Get relations from extractions', 'relations', '=', '[', ']', 'for', 'e', 'in', 'extractions', ':', 'label_set...
Find all relevant relation elements and return them in a list.
['Find', 'all', 'relevant', 'relation', 'elements', 'and', 'return', 'them', 'in', 'a', 'list', '.']
train
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/hume/processor.py#L68-L95
8,888
saltstack/salt
salt/master.py
Master._pre_flight
def _pre_flight(self): ''' Run pre flight checks. If anything in this method fails then the master should not start up. ''' errors = [] critical_errors = [] try: os.chdir('/') except OSError as err: errors.append( '...
python
def _pre_flight(self): ''' Run pre flight checks. If anything in this method fails then the master should not start up. ''' errors = [] critical_errors = [] try: os.chdir('/') except OSError as err: errors.append( '...
['def', '_pre_flight', '(', 'self', ')', ':', 'errors', '=', '[', ']', 'critical_errors', '=', '[', ']', 'try', ':', 'os', '.', 'chdir', '(', "'/'", ')', 'except', 'OSError', 'as', 'err', ':', 'errors', '.', 'append', '(', "'Cannot change to root directory ({0})'", '.', 'format', '(', 'err', ')', ')', 'if', 'self', '.'...
Run pre flight checks. If anything in this method fails then the master should not start up.
['Run', 'pre', 'flight', 'checks', '.', 'If', 'anything', 'in', 'this', 'method', 'fails', 'then', 'the', 'master', 'should', 'not', 'start', 'up', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L563-L644
8,889
perrygeo/python-rasterstats
src/rasterstats/point.py
gen_point_query
def gen_point_query( vectors, raster, band=1, layer=0, nodata=None, affine=None, interpolate='bilinear', property_name='value', geojson_out=False): """ Given a set of vector features and a raster, generate raster values at each vertex of the geometry For features wit...
python
def gen_point_query( vectors, raster, band=1, layer=0, nodata=None, affine=None, interpolate='bilinear', property_name='value', geojson_out=False): """ Given a set of vector features and a raster, generate raster values at each vertex of the geometry For features wit...
['def', 'gen_point_query', '(', 'vectors', ',', 'raster', ',', 'band', '=', '1', ',', 'layer', '=', '0', ',', 'nodata', '=', 'None', ',', 'affine', '=', 'None', ',', 'interpolate', '=', "'bilinear'", ',', 'property_name', '=', "'value'", ',', 'geojson_out', '=', 'False', ')', ':', 'if', 'interpolate', 'not', 'in', '[',...
Given a set of vector features and a raster, generate raster values at each vertex of the geometry For features with point geometry, the values will be a 1D with the index refering to the feature For features with other geometry types, it effectively creates a 2D list, such that the first inde...
['Given', 'a', 'set', 'of', 'vector', 'features', 'and', 'a', 'raster', 'generate', 'raster', 'values', 'at', 'each', 'vertex', 'of', 'the', 'geometry']
train
https://github.com/perrygeo/python-rasterstats/blob/910455cd7c9c21eadf464927db72b38ef62b7dfb/src/rasterstats/point.py#L100-L197
8,890
fractalego/parvusdb
parvusdb/utils/graph_database.py
GraphDatabase.query
def query(self, string, repeat_n_times=None): """ This method performs the operations onto self.g :param string: The list of operations to perform. The sequences of commands should be separated by a semicolon An example might be CREATE {'tag': 'PE...
python
def query(self, string, repeat_n_times=None): """ This method performs the operations onto self.g :param string: The list of operations to perform. The sequences of commands should be separated by a semicolon An example might be CREATE {'tag': 'PE...
['def', 'query', '(', 'self', ',', 'string', ',', 'repeat_n_times', '=', 'None', ')', ':', 'if', 'not', 'repeat_n_times', ':', 'repeat_n_times', '=', 'self', '.', '__determine_how_many_times_to_repeat_query', '(', 'string', ')', 'lines', '=', 'self', '.', '__get_command_lines', '(', 'string', ')', 'return_list', '=', '...
This method performs the operations onto self.g :param string: The list of operations to perform. The sequences of commands should be separated by a semicolon An example might be CREATE {'tag': 'PERSON', 'text': 'joseph'}(v1), {'relation': 'LIVES_AT'}(v1,v2), ...
['This', 'method', 'performs', 'the', 'operations', 'onto', 'self', '.', 'g']
train
https://github.com/fractalego/parvusdb/blob/d5e818d3f3c3decfd4835ef2133aa956b6d87b1d/parvusdb/utils/graph_database.py#L35-L62
8,891
AndrewAnnex/SpiceyPy
spiceypy/spiceypy.py
bsrchd
def bsrchd(value, ndim, array): """ Do a binary search for a key value within a double precision array, assumed to be in increasing order. Return the index of the matching array entry, or -1 if the key value is not found. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/bsrchd_c.html :p...
python
def bsrchd(value, ndim, array): """ Do a binary search for a key value within a double precision array, assumed to be in increasing order. Return the index of the matching array entry, or -1 if the key value is not found. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/bsrchd_c.html :p...
['def', 'bsrchd', '(', 'value', ',', 'ndim', ',', 'array', ')', ':', 'value', '=', 'ctypes', '.', 'c_double', '(', 'value', ')', 'ndim', '=', 'ctypes', '.', 'c_int', '(', 'ndim', ')', 'array', '=', 'stypes', '.', 'toDoubleVector', '(', 'array', ')', 'return', 'libspice', '.', 'bsrchd_c', '(', 'value', ',', 'ndim', ',',...
Do a binary search for a key value within a double precision array, assumed to be in increasing order. Return the index of the matching array entry, or -1 if the key value is not found. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/bsrchd_c.html :param value: Value to find in array. :typ...
['Do', 'a', 'binary', 'search', 'for', 'a', 'key', 'value', 'within', 'a', 'double', 'precision', 'array', 'assumed', 'to', 'be', 'in', 'increasing', 'order', '.', 'Return', 'the', 'index', 'of', 'the', 'matching', 'array', 'entry', 'or', '-', '1', 'if', 'the', 'key', 'value', 'is', 'not', 'found', '.']
train
https://github.com/AndrewAnnex/SpiceyPy/blob/fc20a9b9de68b58eed5b332f0c051fb343a6e335/spiceypy/spiceypy.py#L732-L752
8,892
joke2k/faker
faker/providers/__init__.py
BaseProvider.lexify
def lexify(self, text='????', letters=string.ascii_letters): """ Replaces all question mark ('?') occurrences with a random letter. :param text: string to be parsed :param letters: a set of letters to choose from. :returns: string with all letter placeholders filled in "...
python
def lexify(self, text='????', letters=string.ascii_letters): """ Replaces all question mark ('?') occurrences with a random letter. :param text: string to be parsed :param letters: a set of letters to choose from. :returns: string with all letter placeholders filled in "...
['def', 'lexify', '(', 'self', ',', 'text', '=', "'????'", ',', 'letters', '=', 'string', '.', 'ascii_letters', ')', ':', 'return', '_re_qm', '.', 'sub', '(', 'lambda', 'x', ':', 'self', '.', 'random_element', '(', 'letters', ')', ',', 'text', ')']
Replaces all question mark ('?') occurrences with a random letter. :param text: string to be parsed :param letters: a set of letters to choose from. :returns: string with all letter placeholders filled in
['Replaces', 'all', 'question', 'mark', '(', '?', ')', 'occurrences', 'with', 'a', 'random', 'letter', '.']
train
https://github.com/joke2k/faker/blob/965824b61132e52d92d1a6ce470396dbbe01c96c/faker/providers/__init__.py#L303-L311
8,893
Jaymon/prom
prom/interface/sqlite.py
SQLite.get_field_SQL
def get_field_SQL(self, field_name, field): """ returns the SQL for a given field with full type information http://www.sqlite.org/datatype3.html field_name -- string -- the field's name field -- Field() -- the set options for the field return -- string -- the field ty...
python
def get_field_SQL(self, field_name, field): """ returns the SQL for a given field with full type information http://www.sqlite.org/datatype3.html field_name -- string -- the field's name field -- Field() -- the set options for the field return -- string -- the field ty...
['def', 'get_field_SQL', '(', 'self', ',', 'field_name', ',', 'field', ')', ':', 'field_type', '=', '""', 'is_pk', '=', 'field', '.', 'options', '.', 'get', '(', "'pk'", ',', 'False', ')', 'if', 'issubclass', '(', 'field', '.', 'type', ',', 'bool', ')', ':', 'field_type', '=', "'BOOLEAN'", 'elif', 'issubclass', '(', 'f...
returns the SQL for a given field with full type information http://www.sqlite.org/datatype3.html field_name -- string -- the field's name field -- Field() -- the set options for the field return -- string -- the field type (eg, foo BOOL NOT NULL)
['returns', 'the', 'SQL', 'for', 'a', 'given', 'field', 'with', 'full', 'type', 'information']
train
https://github.com/Jaymon/prom/blob/b7ad2c259eca198da03e1e4bc7d95014c168c361/prom/interface/sqlite.py#L266-L362
8,894
pandas-dev/pandas
pandas/core/indexes/datetimelike.py
DatetimeIndexOpsMixin._create_comparison_method
def _create_comparison_method(cls, op): """ Create a comparison method that dispatches to ``cls.values``. """ def wrapper(self, other): if isinstance(other, ABCSeries): # the arrays defer to Series for comparison ops but the indexes # don't, s...
python
def _create_comparison_method(cls, op): """ Create a comparison method that dispatches to ``cls.values``. """ def wrapper(self, other): if isinstance(other, ABCSeries): # the arrays defer to Series for comparison ops but the indexes # don't, s...
['def', '_create_comparison_method', '(', 'cls', ',', 'op', ')', ':', 'def', 'wrapper', '(', 'self', ',', 'other', ')', ':', 'if', 'isinstance', '(', 'other', ',', 'ABCSeries', ')', ':', '# the arrays defer to Series for comparison ops but the indexes', "# don't, so we have to unwrap here.", 'other', '=', 'other', '.'...
Create a comparison method that dispatches to ``cls.values``.
['Create', 'a', 'comparison', 'method', 'that', 'dispatches', 'to', 'cls', '.', 'values', '.']
train
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/datetimelike.py#L107-L122
8,895
kigawas/eciespy
ecies/__init__.py
encrypt
def encrypt(receiver_pubhex: str, msg: bytes) -> bytes: """ Encrypt with eth public key Parameters ---------- receiver_pubhex: str Receiver's ethereum public key hex string msg: bytes Data to encrypt Returns ------- bytes Encrypted data """ disposabl...
python
def encrypt(receiver_pubhex: str, msg: bytes) -> bytes: """ Encrypt with eth public key Parameters ---------- receiver_pubhex: str Receiver's ethereum public key hex string msg: bytes Data to encrypt Returns ------- bytes Encrypted data """ disposabl...
['def', 'encrypt', '(', 'receiver_pubhex', ':', 'str', ',', 'msg', ':', 'bytes', ')', '->', 'bytes', ':', 'disposable_key', '=', 'generate_key', '(', ')', 'receiver_pubkey', '=', 'hex2pub', '(', 'receiver_pubhex', ')', 'aes_key', '=', 'derive', '(', 'disposable_key', ',', 'receiver_pubkey', ')', 'cipher_text', '=', 'ae...
Encrypt with eth public key Parameters ---------- receiver_pubhex: str Receiver's ethereum public key hex string msg: bytes Data to encrypt Returns ------- bytes Encrypted data
['Encrypt', 'with', 'eth', 'public', 'key']
train
https://github.com/kigawas/eciespy/blob/233f3d7726bf03465a6b2470e83f34cc457eea6c/ecies/__init__.py#L6-L26
8,896
fabioz/PyDev.Debugger
third_party/pep8/autopep8.py
ReformattedLines._split_after_delimiter
def _split_after_delimiter(self, item, indent_amt): """Split the line only after a delimiter.""" self._delete_whitespace() if self.fits_on_current_line(item.size): return last_space = None for item in reversed(self._lines): if ( last_spac...
python
def _split_after_delimiter(self, item, indent_amt): """Split the line only after a delimiter.""" self._delete_whitespace() if self.fits_on_current_line(item.size): return last_space = None for item in reversed(self._lines): if ( last_spac...
['def', '_split_after_delimiter', '(', 'self', ',', 'item', ',', 'indent_amt', ')', ':', 'self', '.', '_delete_whitespace', '(', ')', 'if', 'self', '.', 'fits_on_current_line', '(', 'item', '.', 'size', ')', ':', 'return', 'last_space', '=', 'None', 'for', 'item', 'in', 'reversed', '(', 'self', '.', '_lines', ')', ':',...
Split the line only after a delimiter.
['Split', 'the', 'line', 'only', 'after', 'a', 'delimiter', '.']
train
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/third_party/pep8/autopep8.py#L1897-L1921
8,897
PyGithub/PyGithub
github/Migration.py
Migration.get_archive_url
def get_archive_url(self): """ :calls: `GET /user/migrations/:migration_id/archive`_ :rtype: str """ headers, data = self._requester.requestJsonAndCheck( "GET", self.url + "/archive", headers={ "Accept": Consts.mediaTypeMigratio...
python
def get_archive_url(self): """ :calls: `GET /user/migrations/:migration_id/archive`_ :rtype: str """ headers, data = self._requester.requestJsonAndCheck( "GET", self.url + "/archive", headers={ "Accept": Consts.mediaTypeMigratio...
['def', 'get_archive_url', '(', 'self', ')', ':', 'headers', ',', 'data', '=', 'self', '.', '_requester', '.', 'requestJsonAndCheck', '(', '"GET"', ',', 'self', '.', 'url', '+', '"/archive"', ',', 'headers', '=', '{', '"Accept"', ':', 'Consts', '.', 'mediaTypeMigrationPreview', '}', ')', 'return', 'data', '[', '"data"'...
:calls: `GET /user/migrations/:migration_id/archive`_ :rtype: str
[':', 'calls', ':', 'GET', '/', 'user', '/', 'migrations', '/', ':', 'migration_id', '/', 'archive', '_', ':', 'rtype', ':', 'str']
train
https://github.com/PyGithub/PyGithub/blob/f716df86bbe7dc276c6596699fa9712b61ef974c/github/Migration.py#L146-L158
8,898
senaite/senaite.core
bika/lims/content/abstractbaseanalysis.py
AbstractBaseAnalysis.getTotalPrice
def getTotalPrice(self): """Compute total price including VAT """ price = self.getPrice() vat = self.getVAT() price = price and price or 0 vat = vat and vat or 0 return float(price) + (float(price) * float(vat)) / 100
python
def getTotalPrice(self): """Compute total price including VAT """ price = self.getPrice() vat = self.getVAT() price = price and price or 0 vat = vat and vat or 0 return float(price) + (float(price) * float(vat)) / 100
['def', 'getTotalPrice', '(', 'self', ')', ':', 'price', '=', 'self', '.', 'getPrice', '(', ')', 'vat', '=', 'self', '.', 'getVAT', '(', ')', 'price', '=', 'price', 'and', 'price', 'or', '0', 'vat', '=', 'vat', 'and', 'vat', 'or', '0', 'return', 'float', '(', 'price', ')', '+', '(', 'float', '(', 'price', ')', '*', 'fl...
Compute total price including VAT
['Compute', 'total', 'price', 'including', 'VAT']
train
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/content/abstractbaseanalysis.py#L785-L792
8,899
mitsei/dlkit
dlkit/handcar/repository/managers.py
RepositoryManager.get_repository_admin_session
def get_repository_admin_session(self): """Gets the repository administrative session for creating, updating and deleteing repositories. return: (osid.repository.RepositoryAdminSession) - a RepositoryAdminSession raise: OperationFailed - unable to complete request ...
python
def get_repository_admin_session(self): """Gets the repository administrative session for creating, updating and deleteing repositories. return: (osid.repository.RepositoryAdminSession) - a RepositoryAdminSession raise: OperationFailed - unable to complete request ...
['def', 'get_repository_admin_session', '(', 'self', ')', ':', 'if', 'not', 'self', '.', 'supports_repository_admin', '(', ')', ':', 'raise', 'Unimplemented', '(', ')', 'try', ':', 'from', '.', 'import', 'sessions', 'except', 'ImportError', ':', 'raise', '# OperationFailed()', 'try', ':', 'session', '=', 'sessions', '....
Gets the repository administrative session for creating, updating and deleteing repositories. return: (osid.repository.RepositoryAdminSession) - a RepositoryAdminSession raise: OperationFailed - unable to complete request raise: Unimplemented - supports_repository_admi...
['Gets', 'the', 'repository', 'administrative', 'session', 'for', 'creating', 'updating', 'and', 'deleteing', 'repositories', '.']
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/repository/managers.py#L1728-L1751