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,900
DataDog/integrations-core
kubelet/datadog_checks/kubelet/common.py
get_pod_by_uid
def get_pod_by_uid(uid, podlist): """ Searches for a pod uid in the podlist and returns the pod if found :param uid: pod uid :param podlist: podlist dict object :return: pod dict object if found, None if not found """ for pod in podlist.get("items", []): try: if pod["meta...
python
def get_pod_by_uid(uid, podlist): """ Searches for a pod uid in the podlist and returns the pod if found :param uid: pod uid :param podlist: podlist dict object :return: pod dict object if found, None if not found """ for pod in podlist.get("items", []): try: if pod["meta...
['def', 'get_pod_by_uid', '(', 'uid', ',', 'podlist', ')', ':', 'for', 'pod', 'in', 'podlist', '.', 'get', '(', '"items"', ',', '[', ']', ')', ':', 'try', ':', 'if', 'pod', '[', '"metadata"', ']', '[', '"uid"', ']', '==', 'uid', ':', 'return', 'pod', 'except', 'KeyError', ':', 'continue', 'return', 'None']
Searches for a pod uid in the podlist and returns the pod if found :param uid: pod uid :param podlist: podlist dict object :return: pod dict object if found, None if not found
['Searches', 'for', 'a', 'pod', 'uid', 'in', 'the', 'podlist', 'and', 'returns', 'the', 'pod', 'if', 'found', ':', 'param', 'uid', ':', 'pod', 'uid', ':', 'param', 'podlist', ':', 'podlist', 'dict', 'object', ':', 'return', ':', 'pod', 'dict', 'object', 'if', 'found', 'None', 'if', 'not', 'found']
train
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubelet/datadog_checks/kubelet/common.py#L41-L54
8,901
pushyzheng/flask-rabbitmq
example/producer/flask_rabbitmq/RabbitMQ.py
RabbitMQ.bind_topic_exchange
def bind_topic_exchange(self, exchange_name, routing_key, queue_name): """ 绑定主题交换机和队列 :param exchange_name: 需要绑定的交换机名 :param routing_key: :param queue_name: 需要绑定的交换机队列名 :return: """ self._channel.queue_declare( queue=queue_name, aut...
python
def bind_topic_exchange(self, exchange_name, routing_key, queue_name): """ 绑定主题交换机和队列 :param exchange_name: 需要绑定的交换机名 :param routing_key: :param queue_name: 需要绑定的交换机队列名 :return: """ self._channel.queue_declare( queue=queue_name, aut...
['def', 'bind_topic_exchange', '(', 'self', ',', 'exchange_name', ',', 'routing_key', ',', 'queue_name', ')', ':', 'self', '.', '_channel', '.', 'queue_declare', '(', 'queue', '=', 'queue_name', ',', 'auto_delete', '=', 'True', ',', 'durable', '=', 'True', ',', ')', 'self', '.', '_channel', '.', 'exchange_declare', '('...
绑定主题交换机和队列 :param exchange_name: 需要绑定的交换机名 :param routing_key: :param queue_name: 需要绑定的交换机队列名 :return:
['绑定主题交换机和队列', ':', 'param', 'exchange_name', ':', '需要绑定的交换机名', ':', 'param', 'routing_key', ':', ':', 'param', 'queue_name', ':', '需要绑定的交换机队列名', ':', 'return', ':']
train
https://github.com/pushyzheng/flask-rabbitmq/blob/beecefdf7bb6ff0892388e2bc303aa96931588bd/example/producer/flask_rabbitmq/RabbitMQ.py#L61-L83
8,902
Cog-Creators/Red-Lavalink
lavalink/player_manager.py
Player.stop
async def stop(self): """ Stops playback from lavalink. .. important:: This method will clear the queue. """ await self.node.stop(self.channel.guild.id) self.queue = [] self.current = None self.position = 0 self._paused = False
python
async def stop(self): """ Stops playback from lavalink. .. important:: This method will clear the queue. """ await self.node.stop(self.channel.guild.id) self.queue = [] self.current = None self.position = 0 self._paused = False
['async', 'def', 'stop', '(', 'self', ')', ':', 'await', 'self', '.', 'node', '.', 'stop', '(', 'self', '.', 'channel', '.', 'guild', '.', 'id', ')', 'self', '.', 'queue', '=', '[', ']', 'self', '.', 'current', '=', 'None', 'self', '.', 'position', '=', '0', 'self', '.', '_paused', '=', 'False']
Stops playback from lavalink. .. important:: This method will clear the queue.
['Stops', 'playback', 'from', 'lavalink', '.']
train
https://github.com/Cog-Creators/Red-Lavalink/blob/5b3fc6eb31ee5db8bd2b633a523cf69749957111/lavalink/player_manager.py#L265-L277
8,903
limodou/uliweb
uliweb/i18n/po_merge.py
split_comments
def split_comments(comments): """Split COMMENTS into flag comments and other comments. Flag comments are those that begin with '#,', e.g. '#,fuzzy'.""" flags = [] other = [] for c in comments: if len(c) > 1 and c[1] == ',': flags.append(c) else: othe...
python
def split_comments(comments): """Split COMMENTS into flag comments and other comments. Flag comments are those that begin with '#,', e.g. '#,fuzzy'.""" flags = [] other = [] for c in comments: if len(c) > 1 and c[1] == ',': flags.append(c) else: othe...
['def', 'split_comments', '(', 'comments', ')', ':', 'flags', '=', '[', ']', 'other', '=', '[', ']', 'for', 'c', 'in', 'comments', ':', 'if', 'len', '(', 'c', ')', '>', '1', 'and', 'c', '[', '1', ']', '==', "','", ':', 'flags', '.', 'append', '(', 'c', ')', 'else', ':', 'other', '.', 'append', '(', 'c', ')', 'return', ...
Split COMMENTS into flag comments and other comments. Flag comments are those that begin with '#,', e.g. '#,fuzzy'.
['Split', 'COMMENTS', 'into', 'flag', 'comments', 'and', 'other', 'comments', '.', 'Flag', 'comments', 'are', 'those', 'that', 'begin', 'with', '#', 'e', '.', 'g', '.', '#', 'fuzzy', '.']
train
https://github.com/limodou/uliweb/blob/34472f25e4bc0b954a35346672f94e84ef18b076/uliweb/i18n/po_merge.py#L61-L71
8,904
numenta/htmresearch
projects/sequence_prediction/continuous_sequence/run_adaptive_filter.py
normalizeSequence
def normalizeSequence(sequence): """ normalize sequence by subtracting the mean and :param sequence: a list of data samples :param considerDimensions: a list of dimensions to consider :return: normalized sequence """ seq = np.array(sequence).astype('float64') meanSeq = np.mean(seq) stdSeq = np.std(se...
python
def normalizeSequence(sequence): """ normalize sequence by subtracting the mean and :param sequence: a list of data samples :param considerDimensions: a list of dimensions to consider :return: normalized sequence """ seq = np.array(sequence).astype('float64') meanSeq = np.mean(seq) stdSeq = np.std(se...
['def', 'normalizeSequence', '(', 'sequence', ')', ':', 'seq', '=', 'np', '.', 'array', '(', 'sequence', ')', '.', 'astype', '(', "'float64'", ')', 'meanSeq', '=', 'np', '.', 'mean', '(', 'seq', ')', 'stdSeq', '=', 'np', '.', 'std', '(', 'seq', ')', 'seq', '=', '(', 'seq', '-', 'np', '.', 'mean', '(', 'seq', ')', ')', ...
normalize sequence by subtracting the mean and :param sequence: a list of data samples :param considerDimensions: a list of dimensions to consider :return: normalized sequence
['normalize', 'sequence', 'by', 'subtracting', 'the', 'mean', 'and', ':', 'param', 'sequence', ':', 'a', 'list', 'of', 'data', 'samples', ':', 'param', 'considerDimensions', ':', 'a', 'list', 'of', 'dimensions', 'to', 'consider', ':', 'return', ':', 'normalized', 'sequence']
train
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/projects/sequence_prediction/continuous_sequence/run_adaptive_filter.py#L109-L123
8,905
garnaat/placebo
placebo/pill.py
Pill._mock_request
def _mock_request(self, **kwargs): """ A mocked out make_request call that bypasses all network calls and simply returns any mocked responses defined. """ model = kwargs.get('model') service = model.service_model.endpoint_prefix operation = model.name LOG....
python
def _mock_request(self, **kwargs): """ A mocked out make_request call that bypasses all network calls and simply returns any mocked responses defined. """ model = kwargs.get('model') service = model.service_model.endpoint_prefix operation = model.name LOG....
['def', '_mock_request', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'model', '=', 'kwargs', '.', 'get', '(', "'model'", ')', 'service', '=', 'model', '.', 'service_model', '.', 'endpoint_prefix', 'operation', '=', 'model', '.', 'name', 'LOG', '.', 'debug', '(', "'_make_request: %s.%s'", ',', 'service', ',', 'opera...
A mocked out make_request call that bypasses all network calls and simply returns any mocked responses defined.
['A', 'mocked', 'out', 'make_request', 'call', 'that', 'bypasses', 'all', 'network', 'calls', 'and', 'simply', 'returns', 'any', 'mocked', 'responses', 'defined', '.']
train
https://github.com/garnaat/placebo/blob/1e8ab91b92fa7c5bb1fdbce2331f0c55455093d7/placebo/pill.py#L290-L299
8,906
ska-sa/katcp-python
katcp/server.py
KATCPServer.start
def start(self, timeout=None): """Install the server on its IOLoop, optionally starting the IOLoop. Parameters ---------- timeout : float or None, optional Time in seconds to wait for server thread to start. """ if self._running.isSet(): raise Ru...
python
def start(self, timeout=None): """Install the server on its IOLoop, optionally starting the IOLoop. Parameters ---------- timeout : float or None, optional Time in seconds to wait for server thread to start. """ if self._running.isSet(): raise Ru...
['def', 'start', '(', 'self', ',', 'timeout', '=', 'None', ')', ':', 'if', 'self', '.', '_running', '.', 'isSet', '(', ')', ':', 'raise', 'RuntimeError', '(', "'Server already started'", ')', 'self', '.', '_stopped', '.', 'clear', '(', ')', '# Make sure we have an ioloop', 'self', '.', 'ioloop', '=', 'self', '.', '_iol...
Install the server on its IOLoop, optionally starting the IOLoop. Parameters ---------- timeout : float or None, optional Time in seconds to wait for server thread to start.
['Install', 'the', 'server', 'on', 'its', 'IOLoop', 'optionally', 'starting', 'the', 'IOLoop', '.']
train
https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L369-L394
8,907
evolbioinfo/pastml
pastml/ml.py
choose_ancestral_states_mppa
def choose_ancestral_states_mppa(tree, feature, states, force_joint=True): """ Chooses node ancestral states based on their marginal probabilities using MPPA method. :param force_joint: make sure that Joint state is chosen even if it has a low probability. :type force_joint: bool :param tree: tree ...
python
def choose_ancestral_states_mppa(tree, feature, states, force_joint=True): """ Chooses node ancestral states based on their marginal probabilities using MPPA method. :param force_joint: make sure that Joint state is chosen even if it has a low probability. :type force_joint: bool :param tree: tree ...
['def', 'choose_ancestral_states_mppa', '(', 'tree', ',', 'feature', ',', 'states', ',', 'force_joint', '=', 'True', ')', ':', 'lh_feature', '=', 'get_personalized_feature_name', '(', 'feature', ',', 'LH', ')', 'allowed_state_feature', '=', 'get_personalized_feature_name', '(', 'feature', ',', 'ALLOWED_STATES', ')', 'j...
Chooses node ancestral states based on their marginal probabilities using MPPA method. :param force_joint: make sure that Joint state is chosen even if it has a low probability. :type force_joint: bool :param tree: tree of interest :type tree: ete3.Tree :param feature: character for which the ances...
['Chooses', 'node', 'ancestral', 'states', 'based', 'on', 'their', 'marginal', 'probabilities', 'using', 'MPPA', 'method', '.']
train
https://github.com/evolbioinfo/pastml/blob/df8a375841525738383e59548eed3441b07dbd3e/pastml/ml.py#L496-L563
8,908
phaethon/kamene
kamene/arch/windows/__init__.py
sniff
def sniff(count=0, store=1, offline=None, prn = None, lfilter=None, L2socket=None, timeout=None, stop_callback=None, *arg, **karg): """Sniff packets sniff([count=0,] [prn=None,] [store=1,] [offline=None,] [lfilter=None,] + L2ListenSocket args) -> list of packets Select interface to sniff by setting conf.iface. Use ...
python
def sniff(count=0, store=1, offline=None, prn = None, lfilter=None, L2socket=None, timeout=None, stop_callback=None, *arg, **karg): """Sniff packets sniff([count=0,] [prn=None,] [store=1,] [offline=None,] [lfilter=None,] + L2ListenSocket args) -> list of packets Select interface to sniff by setting conf.iface. Use ...
['def', 'sniff', '(', 'count', '=', '0', ',', 'store', '=', '1', ',', 'offline', '=', 'None', ',', 'prn', '=', 'None', ',', 'lfilter', '=', 'None', ',', 'L2socket', '=', 'None', ',', 'timeout', '=', 'None', ',', 'stop_callback', '=', 'None', ',', '*', 'arg', ',', '*', '*', 'karg', ')', ':', 'c', '=', '0', 'if', 'offlin...
Sniff packets sniff([count=0,] [prn=None,] [store=1,] [offline=None,] [lfilter=None,] + L2ListenSocket args) -> list of packets Select interface to sniff by setting conf.iface. Use show_interfaces() to see interface names. count: number of packets to capture. 0 means infinity store: wether to store sniffed packets ...
['Sniff', 'packets', 'sniff', '(', '[', 'count', '=', '0', ']', '[', 'prn', '=', 'None', ']', '[', 'store', '=', '1', ']', '[', 'offline', '=', 'None', ']', '[', 'lfilter', '=', 'None', ']', '+', 'L2ListenSocket', 'args', ')', '-', '>', 'list', 'of', 'packets', 'Select', 'interface', 'to', 'sniff', 'by', 'setting', 'co...
train
https://github.com/phaethon/kamene/blob/11d4064844f4f68ac5d7546f5633ac7d02082914/kamene/arch/windows/__init__.py#L445-L506
8,909
fermiPy/fermipy
fermipy/stats_utils.py
norm
def norm(x, mu, sigma=1.0): """ Scipy norm function """ return stats.norm(loc=mu, scale=sigma).pdf(x)
python
def norm(x, mu, sigma=1.0): """ Scipy norm function """ return stats.norm(loc=mu, scale=sigma).pdf(x)
['def', 'norm', '(', 'x', ',', 'mu', ',', 'sigma', '=', '1.0', ')', ':', 'return', 'stats', '.', 'norm', '(', 'loc', '=', 'mu', ',', 'scale', '=', 'sigma', ')', '.', 'pdf', '(', 'x', ')']
Scipy norm function
['Scipy', 'norm', 'function']
train
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/stats_utils.py#L14-L16
8,910
klen/aioauth-client
aioauth_client.py
OAuth1Client.request
def request(self, method, url, params=None, **aio_kwargs): """Make a request to provider.""" oparams = { 'oauth_consumer_key': self.consumer_key, 'oauth_nonce': sha1(str(RANDOM()).encode('ascii')).hexdigest(), 'oauth_signature_method': self.signature.name, ...
python
def request(self, method, url, params=None, **aio_kwargs): """Make a request to provider.""" oparams = { 'oauth_consumer_key': self.consumer_key, 'oauth_nonce': sha1(str(RANDOM()).encode('ascii')).hexdigest(), 'oauth_signature_method': self.signature.name, ...
['def', 'request', '(', 'self', ',', 'method', ',', 'url', ',', 'params', '=', 'None', ',', '*', '*', 'aio_kwargs', ')', ':', 'oparams', '=', '{', "'oauth_consumer_key'", ':', 'self', '.', 'consumer_key', ',', "'oauth_nonce'", ':', 'sha1', '(', 'str', '(', 'RANDOM', '(', ')', ')', '.', 'encode', '(', "'ascii'", ')', ')...
Make a request to provider.
['Make', 'a', 'request', 'to', 'provider', '.']
train
https://github.com/klen/aioauth-client/blob/54f58249496c26965adb4f752f2b24cfe18d0084/aioauth_client.py#L220-L246
8,911
seibert-media/Highton
highton/fields/list_field.py
ListField.encode
def encode(self): """ Just iterate over the child elements and append them to the current element :return: the encoded element :rtype: xml.etree.ElementTree.Element """ element = ElementTree.Element( self.name, attrib={'type': FieldConstants.ARRAY...
python
def encode(self): """ Just iterate over the child elements and append them to the current element :return: the encoded element :rtype: xml.etree.ElementTree.Element """ element = ElementTree.Element( self.name, attrib={'type': FieldConstants.ARRAY...
['def', 'encode', '(', 'self', ')', ':', 'element', '=', 'ElementTree', '.', 'Element', '(', 'self', '.', 'name', ',', 'attrib', '=', '{', "'type'", ':', 'FieldConstants', '.', 'ARRAY', '}', ',', ')', 'for', 'item', 'in', 'self', '.', 'value', ':', 'element', '.', 'append', '(', 'item', '.', 'encode', '(', ')', ')', 'r...
Just iterate over the child elements and append them to the current element :return: the encoded element :rtype: xml.etree.ElementTree.Element
['Just', 'iterate', 'over', 'the', 'child', 'elements', 'and', 'append', 'them', 'to', 'the', 'current', 'element']
train
https://github.com/seibert-media/Highton/blob/1519e4fb105f62882c2e7bc81065d994649558d8/highton/fields/list_field.py#L18-L31
8,912
abe-winter/pg13-py
pg13/pg.py
Row.updatewhere
def updatewhere(clas,pool_or_cursor,where_keys,**update_keys): "this doesn't allow raw_keys for now" # if clas.JSONFIELDS: raise NotImplementedError # todo(awinter): do I need to make the same change for SpecialField? if not where_keys or not update_keys: raise ValueError setclause=','.join(k+'=%s' ...
python
def updatewhere(clas,pool_or_cursor,where_keys,**update_keys): "this doesn't allow raw_keys for now" # if clas.JSONFIELDS: raise NotImplementedError # todo(awinter): do I need to make the same change for SpecialField? if not where_keys or not update_keys: raise ValueError setclause=','.join(k+'=%s' ...
['def', 'updatewhere', '(', 'clas', ',', 'pool_or_cursor', ',', 'where_keys', ',', '*', '*', 'update_keys', ')', ':', '# if clas.JSONFIELDS: raise NotImplementedError # todo(awinter): do I need to make the same change for SpecialField?\r', 'if', 'not', 'where_keys', 'or', 'not', 'update_keys', ':', 'raise', 'ValueError...
this doesn't allow raw_keys for now
['this', 'doesn', 't', 'allow', 'raw_keys', 'for', 'now']
train
https://github.com/abe-winter/pg13-py/blob/c78806f99f35541a8756987e86edca3438aa97f5/pg13/pg.py#L277-L285
8,913
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.set_idlesleep
def set_idlesleep(self, idlesleep): """ Sets CPU idle sleep time value. :param idlesleep: idle sleep value (integer) """ is_running = yield from self.is_running() if is_running: # router is running yield from self._hypervisor.send('vm set_idle_sleep_time "{...
python
def set_idlesleep(self, idlesleep): """ Sets CPU idle sleep time value. :param idlesleep: idle sleep value (integer) """ is_running = yield from self.is_running() if is_running: # router is running yield from self._hypervisor.send('vm set_idle_sleep_time "{...
['def', 'set_idlesleep', '(', 'self', ',', 'idlesleep', ')', ':', 'is_running', '=', 'yield', 'from', 'self', '.', 'is_running', '(', ')', 'if', 'is_running', ':', '# router is running', 'yield', 'from', 'self', '.', '_hypervisor', '.', 'send', '(', '\'vm set_idle_sleep_time "{name}" 0 {idlesleep}\'', '.', 'format', '(...
Sets CPU idle sleep time value. :param idlesleep: idle sleep value (integer)
['Sets', 'CPU', 'idle', 'sleep', 'time', 'value', '.']
train
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L767-L784
8,914
weso/CWR-DataApi
cwr/grammar/field/basic.py
_check_above_value_float
def _check_above_value_float(string, minimum): """ Checks that the number parsed from the string is above a minimum. This is used on compulsory numeric fields. If the value is not above the minimum an exception is thrown. :param string: the field value :param minimum: minimum value """ ...
python
def _check_above_value_float(string, minimum): """ Checks that the number parsed from the string is above a minimum. This is used on compulsory numeric fields. If the value is not above the minimum an exception is thrown. :param string: the field value :param minimum: minimum value """ ...
['def', '_check_above_value_float', '(', 'string', ',', 'minimum', ')', ':', 'value', '=', 'float', '(', 'string', ')', 'if', 'value', '<', 'minimum', ':', 'message', '=', "'The Numeric Field value should be above %s'", '%', 'minimum', 'raise', 'pp', '.', 'ParseException', '(', 'message', ')']
Checks that the number parsed from the string is above a minimum. This is used on compulsory numeric fields. If the value is not above the minimum an exception is thrown. :param string: the field value :param minimum: minimum value
['Checks', 'that', 'the', 'number', 'parsed', 'from', 'the', 'string', 'is', 'above', 'a', 'minimum', '.']
train
https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/grammar/field/basic.py#L261-L276
8,915
fermiPy/fermipy
fermipy/diffuse/name_policy.py
NameFactory.generic
def generic(self, input_string, **kwargs): """ return a generic filename for a given dataset and component """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) kwargs_copy['dataset'] = kwargs.get('dataset', self.dataset(**kwargs)) kwargs_copy['component'] ...
python
def generic(self, input_string, **kwargs): """ return a generic filename for a given dataset and component """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) kwargs_copy['dataset'] = kwargs.get('dataset', self.dataset(**kwargs)) kwargs_copy['component'] ...
['def', 'generic', '(', 'self', ',', 'input_string', ',', '*', '*', 'kwargs', ')', ':', 'kwargs_copy', '=', 'self', '.', 'base_dict', '.', 'copy', '(', ')', 'kwargs_copy', '.', 'update', '(', '*', '*', 'kwargs', ')', 'kwargs_copy', '[', "'dataset'", ']', '=', 'kwargs', '.', 'get', '(', "'dataset'", ',', 'self', '.', 'd...
return a generic filename for a given dataset and component
['return', 'a', 'generic', 'filename', 'for', 'a', 'given', 'dataset', 'and', 'component']
train
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/name_policy.py#L594-L603
8,916
tensorpack/tensorpack
examples/basics/mnist-visualizations.py
visualize_conv_activations
def visualize_conv_activations(activation, name): """Visualize activations for convolution layers. Remarks: This tries to place all activations into a square. Args: activation: tensor with the activation [B,H,W,C] name: label for tensorboard Returns: image of almost al...
python
def visualize_conv_activations(activation, name): """Visualize activations for convolution layers. Remarks: This tries to place all activations into a square. Args: activation: tensor with the activation [B,H,W,C] name: label for tensorboard Returns: image of almost al...
['def', 'visualize_conv_activations', '(', 'activation', ',', 'name', ')', ':', 'import', 'math', 'with', 'tf', '.', 'name_scope', '(', "'visualize_act_'", '+', 'name', ')', ':', '_', ',', 'h', ',', 'w', ',', 'c', '=', 'activation', '.', 'get_shape', '(', ')', '.', 'as_list', '(', ')', 'rows', '=', '[', ']', 'c_per_row...
Visualize activations for convolution layers. Remarks: This tries to place all activations into a square. Args: activation: tensor with the activation [B,H,W,C] name: label for tensorboard Returns: image of almost all activations
['Visualize', 'activations', 'for', 'convolution', 'layers', '.']
train
https://github.com/tensorpack/tensorpack/blob/d7a13cb74c9066bc791d7aafc3b744b60ee79a9f/examples/basics/mnist-visualizations.py#L39-L64
8,917
bitcraft/PyTMX
pytmx/pytmx.py
TiledObject.parse_xml
def parse_xml(self, node): """ Parse an Object from ElementTree xml node :param node: ElementTree xml node :return: self """ def read_points(text): """parse a text string of float tuples and return [(x,...),...] """ return tuple(tuple(map(flo...
python
def parse_xml(self, node): """ Parse an Object from ElementTree xml node :param node: ElementTree xml node :return: self """ def read_points(text): """parse a text string of float tuples and return [(x,...),...] """ return tuple(tuple(map(flo...
['def', 'parse_xml', '(', 'self', ',', 'node', ')', ':', 'def', 'read_points', '(', 'text', ')', ':', '"""parse a text string of float tuples and return [(x,...),...]\n """', 'return', 'tuple', '(', 'tuple', '(', 'map', '(', 'float', ',', 'i', '.', 'split', '(', "','", ')', ')', ')', 'for', 'i', 'in', 'text'...
Parse an Object from ElementTree xml node :param node: ElementTree xml node :return: self
['Parse', 'an', 'Object', 'from', 'ElementTree', 'xml', 'node']
train
https://github.com/bitcraft/PyTMX/blob/3fb9788dd66ecfd0c8fa0e9f38c582337d89e1d9/pytmx/pytmx.py#L1146-L1187
8,918
bxlab/bx-python
lib/bx_extras/stats.py
lfprob
def lfprob (dfnum, dfden, F): """ Returns the (1-tailed) significance level (p-value) of an F statistic given the degrees of freedom for the numerator (dfR-dfF) and the degrees of freedom for the denominator (dfF). Usage: lfprob(dfnum, dfden, F) where usually dfnum=dfbn, dfden=dfwn """ p = betai(0.5*dfden,...
python
def lfprob (dfnum, dfden, F): """ Returns the (1-tailed) significance level (p-value) of an F statistic given the degrees of freedom for the numerator (dfR-dfF) and the degrees of freedom for the denominator (dfF). Usage: lfprob(dfnum, dfden, F) where usually dfnum=dfbn, dfden=dfwn """ p = betai(0.5*dfden,...
['def', 'lfprob', '(', 'dfnum', ',', 'dfden', ',', 'F', ')', ':', 'p', '=', 'betai', '(', '0.5', '*', 'dfden', ',', '0.5', '*', 'dfnum', ',', 'dfden', '/', 'float', '(', 'dfden', '+', 'dfnum', '*', 'F', ')', ')', 'return', 'p']
Returns the (1-tailed) significance level (p-value) of an F statistic given the degrees of freedom for the numerator (dfR-dfF) and the degrees of freedom for the denominator (dfF). Usage: lfprob(dfnum, dfden, F) where usually dfnum=dfbn, dfden=dfwn
['Returns', 'the', '(', '1', '-', 'tailed', ')', 'significance', 'level', '(', 'p', '-', 'value', ')', 'of', 'an', 'F', 'statistic', 'given', 'the', 'degrees', 'of', 'freedom', 'for', 'the', 'numerator', '(', 'dfR', '-', 'dfF', ')', 'and', 'the', 'degrees', 'of', 'freedom', 'for', 'the', 'denominator', '(', 'dfF', ')',...
train
https://github.com/bxlab/bx-python/blob/09cb725284803df90a468d910f2274628d8647de/lib/bx_extras/stats.py#L1424-L1433
8,919
nschloe/meshplex
meshplex/mesh_tri.py
MeshTri._compute_surface_areas
def _compute_surface_areas(self, cell_ids): """For each edge, one half of the the edge goes to each of the end points. Used for Neumann boundary conditions if on the boundary of the mesh and transition conditions if in the interior. """ # Each of the three edges may contribute to...
python
def _compute_surface_areas(self, cell_ids): """For each edge, one half of the the edge goes to each of the end points. Used for Neumann boundary conditions if on the boundary of the mesh and transition conditions if in the interior. """ # Each of the three edges may contribute to...
['def', '_compute_surface_areas', '(', 'self', ',', 'cell_ids', ')', ':', '# Each of the three edges may contribute to the surface areas of all', '# three vertices. Here, only the two adjacent nodes receive a', '# contribution, but other approaches (e.g., the flat cell corrector),', '# may contribute to all three nodes...
For each edge, one half of the the edge goes to each of the end points. Used for Neumann boundary conditions if on the boundary of the mesh and transition conditions if in the interior.
['For', 'each', 'edge', 'one', 'half', 'of', 'the', 'the', 'edge', 'goes', 'to', 'each', 'of', 'the', 'end', 'points', '.', 'Used', 'for', 'Neumann', 'boundary', 'conditions', 'if', 'on', 'the', 'boundary', 'of', 'the', 'mesh', 'and', 'transition', 'conditions', 'if', 'in', 'the', 'interior', '.']
train
https://github.com/nschloe/meshplex/blob/376cfe8ce7b9917e5398c5d60c87455ff5590913/meshplex/mesh_tri.py#L537-L560
8,920
scott-griffiths/bitstring
bitstring.py
Bits._readintle
def _readintle(self, length, start): """Read bits and interpret as a little-endian signed int.""" ui = self._readuintle(length, start) if not ui >> (length - 1): # Top bit not set, number is positive return ui # Top bit is set, so number is negative tmp = ...
python
def _readintle(self, length, start): """Read bits and interpret as a little-endian signed int.""" ui = self._readuintle(length, start) if not ui >> (length - 1): # Top bit not set, number is positive return ui # Top bit is set, so number is negative tmp = ...
['def', '_readintle', '(', 'self', ',', 'length', ',', 'start', ')', ':', 'ui', '=', 'self', '.', '_readuintle', '(', 'length', ',', 'start', ')', 'if', 'not', 'ui', '>>', '(', 'length', '-', '1', ')', ':', '# Top bit not set, number is positive', 'return', 'ui', '# Top bit is set, so number is negative', 'tmp', '=', '...
Read bits and interpret as a little-endian signed int.
['Read', 'bits', 'and', 'interpret', 'as', 'a', 'little', '-', 'endian', 'signed', 'int', '.']
train
https://github.com/scott-griffiths/bitstring/blob/ab40ae7f0b43fe223a39b63cbc0529b09f3ef653/bitstring.py#L1528-L1536
8,921
d11wtq/dockerpty
dockerpty/pty.py
WINCHHandler.start
def start(self): """ Start trapping WINCH signals and resizing the PTY. This method saves the previous WINCH handler so it can be restored on `stop()`. """ def handle(signum, frame): if signum == signal.SIGWINCH: self.pty.resize() se...
python
def start(self): """ Start trapping WINCH signals and resizing the PTY. This method saves the previous WINCH handler so it can be restored on `stop()`. """ def handle(signum, frame): if signum == signal.SIGWINCH: self.pty.resize() se...
['def', 'start', '(', 'self', ')', ':', 'def', 'handle', '(', 'signum', ',', 'frame', ')', ':', 'if', 'signum', '==', 'signal', '.', 'SIGWINCH', ':', 'self', '.', 'pty', '.', 'resize', '(', ')', 'self', '.', 'original_handler', '=', 'signal', '.', 'signal', '(', 'signal', '.', 'SIGWINCH', ',', 'handle', ')']
Start trapping WINCH signals and resizing the PTY. This method saves the previous WINCH handler so it can be restored on `stop()`.
['Start', 'trapping', 'WINCH', 'signals', 'and', 'resizing', 'the', 'PTY', '.']
train
https://github.com/d11wtq/dockerpty/blob/f8d17d893c6758b7cc25825e99f6b02202632a97/dockerpty/pty.py#L57-L69
8,922
GetmeUK/MongoFrames
mongoframes/factory/__init__.py
Factory.reassemble
def reassemble(self, blueprint, fields, documents): """ Reassemble the given set of fields for a list of pre-assembed documents. NOTE: Reassembly is done in place, since the data you send the method should be JSON type safe, if you need to retain the existing document it is reco...
python
def reassemble(self, blueprint, fields, documents): """ Reassemble the given set of fields for a list of pre-assembed documents. NOTE: Reassembly is done in place, since the data you send the method should be JSON type safe, if you need to retain the existing document it is reco...
['def', 'reassemble', '(', 'self', ',', 'blueprint', ',', 'fields', ',', 'documents', ')', ':', '# Reset the blueprint', 'blueprint', '.', 'reset', '(', ')', '# Reassemble the documents', 'for', 'document', 'in', 'documents', ':', 'blueprint', '.', 'reassemble', '(', 'fields', ',', 'document', ')']
Reassemble the given set of fields for a list of pre-assembed documents. NOTE: Reassembly is done in place, since the data you send the method should be JSON type safe, if you need to retain the existing document it is recommended that you copy them using `copy.deepcopy`.
['Reassemble', 'the', 'given', 'set', 'of', 'fields', 'for', 'a', 'list', 'of', 'pre', '-', 'assembed', 'documents', '.']
train
https://github.com/GetmeUK/MongoFrames/blob/7d2bd792235dfa77a9deecab5366f5f73480823d/mongoframes/factory/__init__.py#L96-L110
8,923
pydata/xarray
xarray/core/variable.py
as_variable
def as_variable(obj, name=None) -> 'Union[Variable, IndexVariable]': """Convert an object into a Variable. Parameters ---------- obj : object Object to convert into a Variable. - If the object is already a Variable, return a shallow copy. - Otherwise, if the object has 'dims' a...
python
def as_variable(obj, name=None) -> 'Union[Variable, IndexVariable]': """Convert an object into a Variable. Parameters ---------- obj : object Object to convert into a Variable. - If the object is already a Variable, return a shallow copy. - Otherwise, if the object has 'dims' a...
['def', 'as_variable', '(', 'obj', ',', 'name', '=', 'None', ')', '->', "'Union[Variable, IndexVariable]'", ':', 'from', '.', 'dataarray', 'import', 'DataArray', '# TODO: consider extending this method to automatically handle Iris and', 'if', 'isinstance', '(', 'obj', ',', 'DataArray', ')', ':', '# extract the primary ...
Convert an object into a Variable. Parameters ---------- obj : object Object to convert into a Variable. - If the object is already a Variable, return a shallow copy. - Otherwise, if the object has 'dims' and 'data' attributes, convert it into a new Variable. - If...
['Convert', 'an', 'object', 'into', 'a', 'Variable', '.']
train
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/variable.py#L46-L119
8,924
bcbio/bcbio-nextgen
bcbio/structural/purple.py
_run_amber
def _run_amber(paired, work_dir, lenient=False): """AMBER: calculate allele frequencies at likely heterozygous sites. lenient flag allows amber runs on small test sets. """ amber_dir = utils.safe_makedir(os.path.join(work_dir, "amber")) out_file = os.path.join(amber_dir, "%s.amber.baf" % dd.get_sam...
python
def _run_amber(paired, work_dir, lenient=False): """AMBER: calculate allele frequencies at likely heterozygous sites. lenient flag allows amber runs on small test sets. """ amber_dir = utils.safe_makedir(os.path.join(work_dir, "amber")) out_file = os.path.join(amber_dir, "%s.amber.baf" % dd.get_sam...
['def', '_run_amber', '(', 'paired', ',', 'work_dir', ',', 'lenient', '=', 'False', ')', ':', 'amber_dir', '=', 'utils', '.', 'safe_makedir', '(', 'os', '.', 'path', '.', 'join', '(', 'work_dir', ',', '"amber"', ')', ')', 'out_file', '=', 'os', '.', 'path', '.', 'join', '(', 'amber_dir', ',', '"%s.amber.baf"', '%', 'dd...
AMBER: calculate allele frequencies at likely heterozygous sites. lenient flag allows amber runs on small test sets.
['AMBER', ':', 'calculate', 'allele', 'frequencies', 'at', 'likely', 'heterozygous', 'sites', '.']
train
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/purple.py#L199-L230
8,925
brocade/pynos
pynos/versions/ver_7/ver_7_0_0/interface.py
Interface.bfd
def bfd(self, **kwargs): """Configure BFD for Interface. Args: name (str): name of the interface to configure (230/0/1 etc) int_type (str): interface type (gigabitethernet etc) tx (str): BFD transmit interval in milliseconds (300, 500, etc) rx (str): BFD ...
python
def bfd(self, **kwargs): """Configure BFD for Interface. Args: name (str): name of the interface to configure (230/0/1 etc) int_type (str): interface type (gigabitethernet etc) tx (str): BFD transmit interval in milliseconds (300, 500, etc) rx (str): BFD ...
['def', 'bfd', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'int_type', '=', 'str', '(', 'kwargs', '.', 'pop', '(', "'int_type'", ')', '.', 'lower', '(', ')', ')', 'kwargs', '[', "'name'", ']', '=', 'str', '(', 'kwargs', '.', 'pop', '(', "'name'", ')', ')', 'kwargs', '[', "'min_tx'", ']', '=', 'kwargs', '.', 'pop', ...
Configure BFD for Interface. Args: name (str): name of the interface to configure (230/0/1 etc) int_type (str): interface type (gigabitethernet etc) tx (str): BFD transmit interval in milliseconds (300, 500, etc) rx (str): BFD receive interval in milliseconds (30...
['Configure', 'BFD', 'for', 'Interface', '.']
train
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_0_0/interface.py#L257-L316
8,926
google/grr
grr/server/grr_response_server/databases/mem_hunts.py
InMemoryDBHuntMixin.UpdateHuntObject
def UpdateHuntObject(self, hunt_id, start_time=None, **kwargs): """Updates the hunt object by applying the update function.""" hunt_obj = self.ReadHuntObject(hunt_id) delta_suffix = "_delta" for k, v in kwargs.items(): if v is None: continue if k.endswith(delta_suffix): ke...
python
def UpdateHuntObject(self, hunt_id, start_time=None, **kwargs): """Updates the hunt object by applying the update function.""" hunt_obj = self.ReadHuntObject(hunt_id) delta_suffix = "_delta" for k, v in kwargs.items(): if v is None: continue if k.endswith(delta_suffix): ke...
['def', 'UpdateHuntObject', '(', 'self', ',', 'hunt_id', ',', 'start_time', '=', 'None', ',', '*', '*', 'kwargs', ')', ':', 'hunt_obj', '=', 'self', '.', 'ReadHuntObject', '(', 'hunt_id', ')', 'delta_suffix', '=', '"_delta"', 'for', 'k', ',', 'v', 'in', 'kwargs', '.', 'items', '(', ')', ':', 'if', 'v', 'is', 'None', ':...
Updates the hunt object by applying the update function.
['Updates', 'the', 'hunt', 'object', 'by', 'applying', 'the', 'update', 'function', '.']
train
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L41-L63
8,927
zsimic/runez
src/runez/logsetup.py
LogManager._fix_logging_shortcuts
def _fix_logging_shortcuts(cls): """ Fix standard logging shortcuts to correctly report logging module. This is only useful if you: - actually use %(name) and care about it being correct - you would still like to use the logging.info() etc shortcuts So basically you'd l...
python
def _fix_logging_shortcuts(cls): """ Fix standard logging shortcuts to correctly report logging module. This is only useful if you: - actually use %(name) and care about it being correct - you would still like to use the logging.info() etc shortcuts So basically you'd l...
['def', '_fix_logging_shortcuts', '(', 'cls', ')', ':', 'if', 'cls', '.', 'is_using_format', '(', '"%(pathname)s %(filename)s %(funcName)s %(module)s"', ')', ':', 'logging', '.', '_srcfile', '=', 'cls', '.', '_logging_snapshot', '.', '_srcfile', 'else', ':', 'logging', '.', '_srcfile', '=', 'None', 'logging', '.', 'log...
Fix standard logging shortcuts to correctly report logging module. This is only useful if you: - actually use %(name) and care about it being correct - you would still like to use the logging.info() etc shortcuts So basically you'd like to write this: import logging ...
['Fix', 'standard', 'logging', 'shortcuts', 'to', 'correctly', 'report', 'logging', 'module', '.']
train
https://github.com/zsimic/runez/blob/14363b719a1aae1528859a501a22d075ce0abfcc/src/runez/logsetup.py#L439-L491
8,928
spencerahill/aospy
aospy/calc.py
Calc._save_files
def _save_files(self, data, dtype_out_time): """Save the data to netcdf files in direc_out.""" path = self.path_out[dtype_out_time] if not os.path.isdir(self.dir_out): os.makedirs(self.dir_out) if 'reg' in dtype_out_time: try: reg_data = xr.open_da...
python
def _save_files(self, data, dtype_out_time): """Save the data to netcdf files in direc_out.""" path = self.path_out[dtype_out_time] if not os.path.isdir(self.dir_out): os.makedirs(self.dir_out) if 'reg' in dtype_out_time: try: reg_data = xr.open_da...
['def', '_save_files', '(', 'self', ',', 'data', ',', 'dtype_out_time', ')', ':', 'path', '=', 'self', '.', 'path_out', '[', 'dtype_out_time', ']', 'if', 'not', 'os', '.', 'path', '.', 'isdir', '(', 'self', '.', 'dir_out', ')', ':', 'os', '.', 'makedirs', '(', 'self', '.', 'dir_out', ')', 'if', "'reg'", 'in', 'dtype_ou...
Save the data to netcdf files in direc_out.
['Save', 'the', 'data', 'to', 'netcdf', 'files', 'in', 'direc_out', '.']
train
https://github.com/spencerahill/aospy/blob/2f6e775b9b9956c54af117fdcdce2c87196afb6c/aospy/calc.py#L452-L468
8,929
tdsmith/eleven
eleven/eleven.py
calculate_v
def calculate_v(nfs): """Calculates V(n+1/n) values. Useful for establishing the quality of your normalization regime. See Vandesompele 2002 for advice on interpretation. :param DataFrame nfs: A matrix of all normalization factors, produced by `calculate_all_nfs`. :return: a Series of values...
python
def calculate_v(nfs): """Calculates V(n+1/n) values. Useful for establishing the quality of your normalization regime. See Vandesompele 2002 for advice on interpretation. :param DataFrame nfs: A matrix of all normalization factors, produced by `calculate_all_nfs`. :return: a Series of values...
['def', 'calculate_v', '(', 'nfs', ')', ':', 'v', '=', '[', ']', 'if', '(', 'nfs', '.', 'columns', '!=', 'range', '(', '1', ',', 'nfs', '.', 'columns', '[', '-', '1', ']', '+', '1', ')', ')', '.', 'any', '(', ')', ':', 'raise', 'ValueError', '(', '"Column names invalid in nf_v_frame"', ')', 'for', 'i', 'in', 'nfs', '.'...
Calculates V(n+1/n) values. Useful for establishing the quality of your normalization regime. See Vandesompele 2002 for advice on interpretation. :param DataFrame nfs: A matrix of all normalization factors, produced by `calculate_all_nfs`. :return: a Series of values [V(2/1), V(3/2), V(4/3), ......
['Calculates', 'V', '(', 'n', '+', '1', '/', 'n', ')', 'values', '.', 'Useful', 'for', 'establishing', 'the', 'quality', 'of', 'your', 'normalization', 'regime', '.', 'See', 'Vandesompele', '2002', 'for', 'advice', 'on', 'interpretation', '.']
train
https://github.com/tdsmith/eleven/blob/c79b7e784f6d4a76eb4371e69d5ee6f471fe56e1/eleven/eleven.py#L230-L244
8,930
pip-services3-python/pip-services3-commons-python
pip_services3_commons/run/Parameters.py
Parameters.from_config
def from_config(config): """ Creates new Parameters from ConfigMap object. :param config: a ConfigParams that contain parameters. :return: a new Parameters object. """ result = Parameters() if config == None or len(config) == 0: return resul...
python
def from_config(config): """ Creates new Parameters from ConfigMap object. :param config: a ConfigParams that contain parameters. :return: a new Parameters object. """ result = Parameters() if config == None or len(config) == 0: return resul...
['def', 'from_config', '(', 'config', ')', ':', 'result', '=', 'Parameters', '(', ')', 'if', 'config', '==', 'None', 'or', 'len', '(', 'config', ')', '==', '0', ':', 'return', 'result', 'for', '(', 'key', ',', 'value', ')', 'in', 'config', '.', 'items', '(', ')', ':', 'result', '.', 'put', '(', 'key', ',', 'value', ')'...
Creates new Parameters from ConfigMap object. :param config: a ConfigParams that contain parameters. :return: a new Parameters object.
['Creates', 'new', 'Parameters', 'from', 'ConfigMap', 'object', '.']
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/run/Parameters.py#L261-L277
8,931
quantopian/zipline
zipline/utils/preprocess.py
preprocess
def preprocess(*_unused, **processors): """ Decorator that applies pre-processors to the arguments of a function before calling the function. Parameters ---------- **processors : dict Map from argument name -> processor function. A processor function takes three arguments: (fun...
python
def preprocess(*_unused, **processors): """ Decorator that applies pre-processors to the arguments of a function before calling the function. Parameters ---------- **processors : dict Map from argument name -> processor function. A processor function takes three arguments: (fun...
['def', 'preprocess', '(', '*', '_unused', ',', '*', '*', 'processors', ')', ':', 'if', '_unused', ':', 'raise', 'TypeError', '(', '"preprocess() doesn\'t accept positional arguments"', ')', 'def', '_decorator', '(', 'f', ')', ':', 'args', ',', 'varargs', ',', 'varkw', ',', 'defaults', '=', 'argspec', '=', 'getargspec'...
Decorator that applies pre-processors to the arguments of a function before calling the function. Parameters ---------- **processors : dict Map from argument name -> processor function. A processor function takes three arguments: (func, argname, argvalue). `func` is the the fu...
['Decorator', 'that', 'applies', 'pre', '-', 'processors', 'to', 'the', 'arguments', 'of', 'a', 'function', 'before', 'calling', 'the', 'function', '.']
train
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/preprocess.py#L35-L112
8,932
GNS3/gns3-server
gns3server/compute/vpcs/vpcs_vm.py
VPCSVM.script_file
def script_file(self): """ Returns the startup script file for this VPCS VM. :returns: path to startup script file """ # use the default VPCS file if it exists path = os.path.join(self.working_dir, 'startup.vpc') if os.path.exists(path): return path ...
python
def script_file(self): """ Returns the startup script file for this VPCS VM. :returns: path to startup script file """ # use the default VPCS file if it exists path = os.path.join(self.working_dir, 'startup.vpc') if os.path.exists(path): return path ...
['def', 'script_file', '(', 'self', ')', ':', '# use the default VPCS file if it exists', 'path', '=', 'os', '.', 'path', '.', 'join', '(', 'self', '.', 'working_dir', ',', "'startup.vpc'", ')', 'if', 'os', '.', 'path', '.', 'exists', '(', 'path', ')', ':', 'return', 'path', 'else', ':', 'return', 'None']
Returns the startup script file for this VPCS VM. :returns: path to startup script file
['Returns', 'the', 'startup', 'script', 'file', 'for', 'this', 'VPCS', 'VM', '.']
train
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/vpcs/vpcs_vm.py#L539-L551
8,933
cloudnull/turbolift
turbolift/clouderator/actions.py
CloudActions.delete_items
def delete_items(self, url, container, container_object=None): """Deletes an objects in a container. :param url: :param container: """ headers, container_uri = self._return_base_data( url=url, container=container, container_object=container_o...
python
def delete_items(self, url, container, container_object=None): """Deletes an objects in a container. :param url: :param container: """ headers, container_uri = self._return_base_data( url=url, container=container, container_object=container_o...
['def', 'delete_items', '(', 'self', ',', 'url', ',', 'container', ',', 'container_object', '=', 'None', ')', ':', 'headers', ',', 'container_uri', '=', 'self', '.', '_return_base_data', '(', 'url', '=', 'url', ',', 'container', '=', 'container', ',', 'container_object', '=', 'container_object', ')', 'return', 'self', ...
Deletes an objects in a container. :param url: :param container:
['Deletes', 'an', 'objects', 'in', 'a', 'container', '.']
train
https://github.com/cloudnull/turbolift/blob/da33034e88959226529ce762e2895e6f6356c448/turbolift/clouderator/actions.py#L642-L655
8,934
nvbn/thefuck
thefuck/argument_parser.py
Parser._add_conflicting_arguments
def _add_conflicting_arguments(self): """It's too dangerous to use `-y` and `-r` together.""" group = self._parser.add_mutually_exclusive_group() group.add_argument( '-y', '--yes', '--yeah', action='store_true', help='execute fixed command without confirmation...
python
def _add_conflicting_arguments(self): """It's too dangerous to use `-y` and `-r` together.""" group = self._parser.add_mutually_exclusive_group() group.add_argument( '-y', '--yes', '--yeah', action='store_true', help='execute fixed command without confirmation...
['def', '_add_conflicting_arguments', '(', 'self', ')', ':', 'group', '=', 'self', '.', '_parser', '.', 'add_mutually_exclusive_group', '(', ')', 'group', '.', 'add_argument', '(', "'-y'", ',', "'--yes'", ',', "'--yeah'", ',', 'action', '=', "'store_true'", ',', 'help', '=', "'execute fixed command without confirmation...
It's too dangerous to use `-y` and `-r` together.
['It', 's', 'too', 'dangerous', 'to', 'use', '-', 'y', 'and', '-', 'r', 'together', '.']
train
https://github.com/nvbn/thefuck/blob/40ab4eb62db57627bff10cf029d29c94704086a2/thefuck/argument_parser.py#L54-L64
8,935
edx/opaque-keys
opaque_keys/edx/locator.py
CourseLocator.offering
def offering(self): """ Deprecated. Use course and run independently. """ warnings.warn( "Offering is no longer a supported property of Locator. Please use the course and run properties.", DeprecationWarning, stacklevel=2 ) if not self....
python
def offering(self): """ Deprecated. Use course and run independently. """ warnings.warn( "Offering is no longer a supported property of Locator. Please use the course and run properties.", DeprecationWarning, stacklevel=2 ) if not self....
['def', 'offering', '(', 'self', ')', ':', 'warnings', '.', 'warn', '(', '"Offering is no longer a supported property of Locator. Please use the course and run properties."', ',', 'DeprecationWarning', ',', 'stacklevel', '=', '2', ')', 'if', 'not', 'self', '.', 'course', 'and', 'not', 'self', '.', 'run', ':', 'return',...
Deprecated. Use course and run independently.
['Deprecated', '.', 'Use', 'course', 'and', 'run', 'independently', '.']
train
https://github.com/edx/opaque-keys/blob/9807168660c12e0551c8fdd58fd1bc6b0bcb0a54/opaque_keys/edx/locator.py#L234-L247
8,936
lmcinnes/umap
umap/rp_tree.py
num_nodes
def num_nodes(tree): """Determine the number of nodes in a tree""" if tree.is_leaf: return 1 else: return 1 + num_nodes(tree.left_child) + num_nodes(tree.right_child)
python
def num_nodes(tree): """Determine the number of nodes in a tree""" if tree.is_leaf: return 1 else: return 1 + num_nodes(tree.left_child) + num_nodes(tree.right_child)
['def', 'num_nodes', '(', 'tree', ')', ':', 'if', 'tree', '.', 'is_leaf', ':', 'return', '1', 'else', ':', 'return', '1', '+', 'num_nodes', '(', 'tree', '.', 'left_child', ')', '+', 'num_nodes', '(', 'tree', '.', 'right_child', ')']
Determine the number of nodes in a tree
['Determine', 'the', 'number', 'of', 'nodes', 'in', 'a', 'tree']
train
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/rp_tree.py#L580-L585
8,937
aichaos/rivescript-python
rivescript/rivescript.py
RiveScript.reply
def reply(self, user, msg, errors_as_replies=True): """Fetch a reply from the RiveScript brain. Arguments: user (str): A unique user ID for the person requesting a reply. This could be e.g. a screen name or nickname. It's used internally to store user variabl...
python
def reply(self, user, msg, errors_as_replies=True): """Fetch a reply from the RiveScript brain. Arguments: user (str): A unique user ID for the person requesting a reply. This could be e.g. a screen name or nickname. It's used internally to store user variabl...
['def', 'reply', '(', 'self', ',', 'user', ',', 'msg', ',', 'errors_as_replies', '=', 'True', ')', ':', 'return', 'self', '.', '_brain', '.', 'reply', '(', 'user', ',', 'msg', ',', 'errors_as_replies', ')']
Fetch a reply from the RiveScript brain. Arguments: user (str): A unique user ID for the person requesting a reply. This could be e.g. a screen name or nickname. It's used internally to store user variables (including topic and history), so if your bo...
['Fetch', 'a', 'reply', 'from', 'the', 'RiveScript', 'brain', '.']
train
https://github.com/aichaos/rivescript-python/blob/b55c820cf02a194605fd66af1f070e239f84ed31/rivescript/rivescript.py#L926-L947
8,938
BD2KGenomics/protect
attic/precision_immuno.py
get_file_from_s3
def get_file_from_s3(job, s3_url, encryption_key=None, write_to_jobstore=True): """ Downloads a supplied URL that points to an unencrypted, unprotected file on Amazon S3. The file is downloaded and a subsequently written to the jobstore and the return value is a the path to the file in the jobstore. ...
python
def get_file_from_s3(job, s3_url, encryption_key=None, write_to_jobstore=True): """ Downloads a supplied URL that points to an unencrypted, unprotected file on Amazon S3. The file is downloaded and a subsequently written to the jobstore and the return value is a the path to the file in the jobstore. ...
['def', 'get_file_from_s3', '(', 'job', ',', 's3_url', ',', 'encryption_key', '=', 'None', ',', 'write_to_jobstore', '=', 'True', ')', ':', 'work_dir', '=', 'job', '.', 'fileStore', '.', 'getLocalTempDir', '(', ')', 'filename', '=', "'/'", '.', 'join', '(', '[', 'work_dir', ',', 'os', '.', 'path', '.', 'basename', '(',...
Downloads a supplied URL that points to an unencrypted, unprotected file on Amazon S3. The file is downloaded and a subsequently written to the jobstore and the return value is a the path to the file in the jobstore.
['Downloads', 'a', 'supplied', 'URL', 'that', 'points', 'to', 'an', 'unencrypted', 'unprotected', 'file', 'on', 'Amazon', 'S3', '.', 'The', 'file', 'is', 'downloaded', 'and', 'a', 'subsequently', 'written', 'to', 'the', 'jobstore', 'and', 'the', 'return', 'value', 'is', 'a', 'the', 'path', 'to', 'the', 'file', 'in', 't...
train
https://github.com/BD2KGenomics/protect/blob/06310682c50dcf8917b912c8e551299ff7ee41ce/attic/precision_immuno.py#L2159-L2191
8,939
hotdoc/hotdoc
hotdoc/core/tree.py
Tree.write_out
def write_out(self, output): """Banana banana """ for page in self.walk(): ext = self.project.extensions[page.extension_name] ext.write_out_page(output, page)
python
def write_out(self, output): """Banana banana """ for page in self.walk(): ext = self.project.extensions[page.extension_name] ext.write_out_page(output, page)
['def', 'write_out', '(', 'self', ',', 'output', ')', ':', 'for', 'page', 'in', 'self', '.', 'walk', '(', ')', ':', 'ext', '=', 'self', '.', 'project', '.', 'extensions', '[', 'page', '.', 'extension_name', ']', 'ext', '.', 'write_out_page', '(', 'output', ',', 'page', ')']
Banana banana
['Banana', 'banana']
train
https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/tree.py#L623-L628
8,940
PmagPy/PmagPy
programs/plot_magmap.py
main
def main(): """ NAME plot_magmap.py DESCRIPTION makes a color contour map of desired field model SYNTAX plot_magmap.py [command line options] OPTIONS -h prints help and quits -f FILE specify field model file with format: l m g h -fmt [pdf,eps,svg,...
python
def main(): """ NAME plot_magmap.py DESCRIPTION makes a color contour map of desired field model SYNTAX plot_magmap.py [command line options] OPTIONS -h prints help and quits -f FILE specify field model file with format: l m g h -fmt [pdf,eps,svg,...
['def', 'main', '(', ')', ':', 'cmap', '=', "'RdYlBu'", 'date', '=', '2016.', 'if', 'not', 'ccrs', ':', 'print', '(', '"-W- You must intstall the cartopy module to run plot_magmap.py"', ')', 'sys', '.', 'exit', '(', ')', 'dir_path', '=', "'.'", 'lincr', '=', '1', '# level increment for contours', 'if', "'-WD'", 'in', '...
NAME plot_magmap.py DESCRIPTION makes a color contour map of desired field model SYNTAX plot_magmap.py [command line options] OPTIONS -h prints help and quits -f FILE specify field model file with format: l m g h -fmt [pdf,eps,svg,png] specify format for...
['NAME', 'plot_magmap', '.', 'py']
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/plot_magmap.py#L24-L153
8,941
django-parler/django-parler
parler/cache.py
_cache_translation
def _cache_translation(translation, timeout=cache.default_timeout): """ Store a new translation in the cache. """ if not appsettings.PARLER_ENABLE_CACHING: return if translation.master_id is None: raise ValueError("Can't cache unsaved translation") # Cache a translation object....
python
def _cache_translation(translation, timeout=cache.default_timeout): """ Store a new translation in the cache. """ if not appsettings.PARLER_ENABLE_CACHING: return if translation.master_id is None: raise ValueError("Can't cache unsaved translation") # Cache a translation object....
['def', '_cache_translation', '(', 'translation', ',', 'timeout', '=', 'cache', '.', 'default_timeout', ')', ':', 'if', 'not', 'appsettings', '.', 'PARLER_ENABLE_CACHING', ':', 'return', 'if', 'translation', '.', 'master_id', 'is', 'None', ':', 'raise', 'ValueError', '(', '"Can\'t cache unsaved translation"', ')', '# C...
Store a new translation in the cache.
['Store', 'a', 'new', 'translation', 'in', 'the', 'cache', '.']
train
https://github.com/django-parler/django-parler/blob/11ae4af5e8faddb74c69c848870122df4006a54e/parler/cache.py#L147-L165
8,942
cemsbr/yala
yala/main.py
Main.print_results
def print_results(cls, stdout, stderr): """Print linter results and exits with an error if there's any.""" for line in stderr: print(line, file=sys.stderr) if stdout: if stderr: # blank line to separate stdout from stderr print(file=sys.stderr) ...
python
def print_results(cls, stdout, stderr): """Print linter results and exits with an error if there's any.""" for line in stderr: print(line, file=sys.stderr) if stdout: if stderr: # blank line to separate stdout from stderr print(file=sys.stderr) ...
['def', 'print_results', '(', 'cls', ',', 'stdout', ',', 'stderr', ')', ':', 'for', 'line', 'in', 'stderr', ':', 'print', '(', 'line', ',', 'file', '=', 'sys', '.', 'stderr', ')', 'if', 'stdout', ':', 'if', 'stderr', ':', '# blank line to separate stdout from stderr', 'print', '(', 'file', '=', 'sys', '.', 'stderr', ')...
Print linter results and exits with an error if there's any.
['Print', 'linter', 'results', 'and', 'exits', 'with', 'an', 'error', 'if', 'there', 's', 'any', '.']
train
https://github.com/cemsbr/yala/blob/efceb044cb3de8d1c12140087ae9d5f8269bfbf9/yala/main.py#L136-L145
8,943
stbraun/fuzzing
fuzzing/fuzzer.py
fuzz_string
def fuzz_string(seed_str, runs=100, fuzz_factor=50): """A random fuzzer for a simulated text viewer application. It takes a string as seed and generates <runs> variant of it. :param seed_str: the string to use as seed for fuzzing. :param runs: number of fuzzed variants to supply. :param fuzz_facto...
python
def fuzz_string(seed_str, runs=100, fuzz_factor=50): """A random fuzzer for a simulated text viewer application. It takes a string as seed and generates <runs> variant of it. :param seed_str: the string to use as seed for fuzzing. :param runs: number of fuzzed variants to supply. :param fuzz_facto...
['def', 'fuzz_string', '(', 'seed_str', ',', 'runs', '=', '100', ',', 'fuzz_factor', '=', '50', ')', ':', 'buf', '=', 'bytearray', '(', 'seed_str', ',', 'encoding', '=', '"utf8"', ')', 'variants', '=', '[', ']', 'for', '_', 'in', 'range', '(', 'runs', ')', ':', 'fuzzed', '=', 'fuzzer', '(', 'buf', ',', 'fuzz_factor', '...
A random fuzzer for a simulated text viewer application. It takes a string as seed and generates <runs> variant of it. :param seed_str: the string to use as seed for fuzzing. :param runs: number of fuzzed variants to supply. :param fuzz_factor: degree of fuzzing = 1 / fuzz_factor. :return: list of...
['A', 'random', 'fuzzer', 'for', 'a', 'simulated', 'text', 'viewer', 'application', '.']
train
https://github.com/stbraun/fuzzing/blob/974a64472732d4e40db919d242149bf0856fe199/fuzzing/fuzzer.py#L55-L72
8,944
binux/pyspider
pyspider/libs/counter.py
CounterManager.trim
def trim(self): """Clear not used counters""" for key, value in list(iteritems(self.counters)): if value.empty(): del self.counters[key]
python
def trim(self): """Clear not used counters""" for key, value in list(iteritems(self.counters)): if value.empty(): del self.counters[key]
['def', 'trim', '(', 'self', ')', ':', 'for', 'key', ',', 'value', 'in', 'list', '(', 'iteritems', '(', 'self', '.', 'counters', ')', ')', ':', 'if', 'value', '.', 'empty', '(', ')', ':', 'del', 'self', '.', 'counters', '[', 'key', ']']
Clear not used counters
['Clear', 'not', 'used', 'counters']
train
https://github.com/binux/pyspider/blob/3fccfabe2b057b7a56d4a4c79dc0dd6cd2239fe9/pyspider/libs/counter.py#L366-L370
8,945
darkfeline/animanager
animanager/commands/reset.py
command
def command(state, args): """Reset anime watched episodes.""" args = parser.parse_args(args[1:]) aid = state.results.parse_aid(args.aid, default_key='db') query.update.reset(state.db, aid, args.episode)
python
def command(state, args): """Reset anime watched episodes.""" args = parser.parse_args(args[1:]) aid = state.results.parse_aid(args.aid, default_key='db') query.update.reset(state.db, aid, args.episode)
['def', 'command', '(', 'state', ',', 'args', ')', ':', 'args', '=', 'parser', '.', 'parse_args', '(', 'args', '[', '1', ':', ']', ')', 'aid', '=', 'state', '.', 'results', '.', 'parse_aid', '(', 'args', '.', 'aid', ',', 'default_key', '=', "'db'", ')', 'query', '.', 'update', '.', 'reset', '(', 'state', '.', 'db', ','...
Reset anime watched episodes.
['Reset', 'anime', 'watched', 'episodes', '.']
train
https://github.com/darkfeline/animanager/blob/55d92e4cbdc12aac8ebe302420d2cff3fa9fa148/animanager/commands/reset.py#L22-L26
8,946
serkanyersen/underscore.py
src/underscore.py
underscore.without
def without(self, *values): """ Return a version of the array that does not contain the specified value(s). """ if self._clean.isDict(): newlist = {} for i, k in enumerate(self.obj): # if k not in values: # use indexof to check identity ...
python
def without(self, *values): """ Return a version of the array that does not contain the specified value(s). """ if self._clean.isDict(): newlist = {} for i, k in enumerate(self.obj): # if k not in values: # use indexof to check identity ...
['def', 'without', '(', 'self', ',', '*', 'values', ')', ':', 'if', 'self', '.', '_clean', '.', 'isDict', '(', ')', ':', 'newlist', '=', '{', '}', 'for', 'i', ',', 'k', 'in', 'enumerate', '(', 'self', '.', 'obj', ')', ':', '# if k not in values: # use indexof to check identity', 'if', '_', '(', 'values', ')', '.', 'in...
Return a version of the array that does not contain the specified value(s).
['Return', 'a', 'version', 'of', 'the', 'array', 'that', 'does', 'not', 'contain', 'the', 'specified', 'value', '(', 's', ')', '.']
train
https://github.com/serkanyersen/underscore.py/blob/07c25c3f0f789536e4ad47aa315faccc0da9602f/src/underscore.py#L561-L579
8,947
python-rope/rope
rope/contrib/fixmodnames.py
FixModuleNames.get_changes
def get_changes(self, fixer=str.lower, task_handle=taskhandle.NullTaskHandle()): """Fix module names `fixer` is a function that takes and returns a `str`. Given the name of a module, it should return the fixed name. """ stack = changestack.ChangeStack(self....
python
def get_changes(self, fixer=str.lower, task_handle=taskhandle.NullTaskHandle()): """Fix module names `fixer` is a function that takes and returns a `str`. Given the name of a module, it should return the fixed name. """ stack = changestack.ChangeStack(self....
['def', 'get_changes', '(', 'self', ',', 'fixer', '=', 'str', '.', 'lower', ',', 'task_handle', '=', 'taskhandle', '.', 'NullTaskHandle', '(', ')', ')', ':', 'stack', '=', 'changestack', '.', 'ChangeStack', '(', 'self', '.', 'project', ',', "'Fixing module names'", ')', 'jobset', '=', 'task_handle', '.', 'create_jobset...
Fix module names `fixer` is a function that takes and returns a `str`. Given the name of a module, it should return the fixed name.
['Fix', 'module', 'names']
train
https://github.com/python-rope/rope/blob/1c9f9cd5964b099a99a9111e998f0dc728860688/rope/contrib/fixmodnames.py#L28-L54
8,948
ironfroggy/django-better-cache
bettercache/utils.py
get_header_dict
def get_header_dict(response, header): """ returns a dictionary of the cache control headers the same as is used by django.utils.cache.patch_cache_control if there are no Cache-Control headers returns and empty dict """ def dictitem(s): t = s.split('=', 1) if len(t) > 1: ...
python
def get_header_dict(response, header): """ returns a dictionary of the cache control headers the same as is used by django.utils.cache.patch_cache_control if there are no Cache-Control headers returns and empty dict """ def dictitem(s): t = s.split('=', 1) if len(t) > 1: ...
['def', 'get_header_dict', '(', 'response', ',', 'header', ')', ':', 'def', 'dictitem', '(', 's', ')', ':', 't', '=', 's', '.', 'split', '(', "'='", ',', '1', ')', 'if', 'len', '(', 't', ')', '>', '1', ':', 'return', '(', 't', '[', '0', ']', '.', 'lower', '(', ')', ',', 't', '[', '1', ']', ')', 'else', ':', 'return', '...
returns a dictionary of the cache control headers the same as is used by django.utils.cache.patch_cache_control if there are no Cache-Control headers returns and empty dict
['returns', 'a', 'dictionary', 'of', 'the', 'cache', 'control', 'headers', 'the', 'same', 'as', 'is', 'used', 'by', 'django', '.', 'utils', '.', 'cache', '.', 'patch_cache_control', 'if', 'there', 'are', 'no', 'Cache', '-', 'Control', 'headers', 'returns', 'and', 'empty', 'dict']
train
https://github.com/ironfroggy/django-better-cache/blob/5350e8c646cef1c1ca74eab176f856ddd9eaf5c3/bettercache/utils.py#L161-L177
8,949
fedora-infra/fedmsg
fedmsg/consumers/__init__.py
FedmsgConsumer._backlog
def _backlog(self, data): """Find all the datagrepper messages between 'then' and 'now'. Put those on our work queue. Should be called in a thread so as not to block the hub at startup. """ try: data = json.loads(data) except ValueError as e: se...
python
def _backlog(self, data): """Find all the datagrepper messages between 'then' and 'now'. Put those on our work queue. Should be called in a thread so as not to block the hub at startup. """ try: data = json.loads(data) except ValueError as e: se...
['def', '_backlog', '(', 'self', ',', 'data', ')', ':', 'try', ':', 'data', '=', 'json', '.', 'loads', '(', 'data', ')', 'except', 'ValueError', 'as', 'e', ':', 'self', '.', 'log', '.', 'info', '(', '"Status contents are %r"', '%', 'data', ')', 'self', '.', 'log', '.', 'exception', '(', 'e', ')', 'self', '.', 'log', '....
Find all the datagrepper messages between 'then' and 'now'. Put those on our work queue. Should be called in a thread so as not to block the hub at startup.
['Find', 'all', 'the', 'datagrepper', 'messages', 'between', 'then', 'and', 'now', '.']
train
https://github.com/fedora-infra/fedmsg/blob/c21d6b3ce023fc3c0e881c704f5b55fb6e6392d7/fedmsg/consumers/__init__.py#L161-L197
8,950
huseyin/color
color/color.py
colorize
def colorize(bg, base, fg, *text): """ colorize(bg, base, fg, *text) """ # All argument types must be str. rtext = [str(f) for f in text] return COLORIZE_FORMAT.format( _to_int(bg), _to_int(base), _to_int(fg), ''.join(rtext) )
python
def colorize(bg, base, fg, *text): """ colorize(bg, base, fg, *text) """ # All argument types must be str. rtext = [str(f) for f in text] return COLORIZE_FORMAT.format( _to_int(bg), _to_int(base), _to_int(fg), ''.join(rtext) )
['def', 'colorize', '(', 'bg', ',', 'base', ',', 'fg', ',', '*', 'text', ')', ':', '# All argument types must be str.', 'rtext', '=', '[', 'str', '(', 'f', ')', 'for', 'f', 'in', 'text', ']', 'return', 'COLORIZE_FORMAT', '.', 'format', '(', '_to_int', '(', 'bg', ')', ',', '_to_int', '(', 'base', ')', ',', '_to_int', '(...
colorize(bg, base, fg, *text)
['colorize', '(', 'bg', 'base', 'fg', '*', 'text', ')']
train
https://github.com/huseyin/color/blob/00d1e38f0f0cf9a94ad6c65fa21590984a575a05/color/color.py#L53-L61
8,951
brocade/pynos
pynos/versions/ver_7/ver_7_1_0/yang/brocade_arp.py
brocade_arp.get_arp_output_arp_entry_interface_name
def get_arp_output_arp_entry_interface_name(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_arp = ET.Element("get_arp") config = get_arp output = ET.SubElement(get_arp, "output") arp_entry = ET.SubElement(output, "arp-entry") ...
python
def get_arp_output_arp_entry_interface_name(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_arp = ET.Element("get_arp") config = get_arp output = ET.SubElement(get_arp, "output") arp_entry = ET.SubElement(output, "arp-entry") ...
['def', 'get_arp_output_arp_entry_interface_name', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'config', '=', 'ET', '.', 'Element', '(', '"config"', ')', 'get_arp', '=', 'ET', '.', 'Element', '(', '"get_arp"', ')', 'config', '=', 'get_arp', 'output', '=', 'ET', '.', 'SubElement', '(', 'get_arp', ',', '"output"', ')...
Auto Generated Code
['Auto', 'Generated', 'Code']
train
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_1_0/yang/brocade_arp.py#L279-L293
8,952
saltstack/salt
salt/cli/daemons.py
DaemonsMixin.verify_hash_type
def verify_hash_type(self): ''' Verify and display a nag-messsage to the log if vulnerable hash-type is used. :return: ''' if self.config['hash_type'].lower() in ['md5', 'sha1']: log.warning( 'IMPORTANT: Do not use %s hashing algorithm! Please set ' ...
python
def verify_hash_type(self): ''' Verify and display a nag-messsage to the log if vulnerable hash-type is used. :return: ''' if self.config['hash_type'].lower() in ['md5', 'sha1']: log.warning( 'IMPORTANT: Do not use %s hashing algorithm! Please set ' ...
['def', 'verify_hash_type', '(', 'self', ')', ':', 'if', 'self', '.', 'config', '[', "'hash_type'", ']', '.', 'lower', '(', ')', 'in', '[', "'md5'", ',', "'sha1'", ']', ':', 'log', '.', 'warning', '(', "'IMPORTANT: Do not use %s hashing algorithm! Please set '", '\'"hash_type" to sha256 in Salt %s config!\'', ',', 'sel...
Verify and display a nag-messsage to the log if vulnerable hash-type is used. :return:
['Verify', 'and', 'display', 'a', 'nag', '-', 'messsage', 'to', 'the', 'log', 'if', 'vulnerable', 'hash', '-', 'type', 'is', 'used', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/daemons.py#L65-L76
8,953
lalinsky/python-phoenixdb
phoenixdb/connection.py
Connection.set_session
def set_session(self, autocommit=None, readonly=None): """Sets one or more parameters in the current connection. :param autocommit: Switch the connection to autocommit mode. With the current version, you need to always enable this, because :meth:`commit` is not imple...
python
def set_session(self, autocommit=None, readonly=None): """Sets one or more parameters in the current connection. :param autocommit: Switch the connection to autocommit mode. With the current version, you need to always enable this, because :meth:`commit` is not imple...
['def', 'set_session', '(', 'self', ',', 'autocommit', '=', 'None', ',', 'readonly', '=', 'None', ')', ':', 'props', '=', '{', '}', 'if', 'autocommit', 'is', 'not', 'None', ':', 'props', '[', "'autoCommit'", ']', '=', 'bool', '(', 'autocommit', ')', 'if', 'readonly', 'is', 'not', 'None', ':', 'props', '[', "'readOnly'"...
Sets one or more parameters in the current connection. :param autocommit: Switch the connection to autocommit mode. With the current version, you need to always enable this, because :meth:`commit` is not implemented. :param readonly: Switch the connectio...
['Sets', 'one', 'or', 'more', 'parameters', 'in', 'the', 'current', 'connection', '.']
train
https://github.com/lalinsky/python-phoenixdb/blob/1bb34488dd530ca65f91b29ef16aa7b71f26b806/phoenixdb/connection.py#L128-L147
8,954
yeasy/hyperledger-py
hyperledger/api/network.py
NetworkApiMixin.peer_list
def peer_list(self): """ GET /network/peers Use the Network APIs to retrieve information about the network of peer nodes comprising the blockchain network. ```golang message PeersMessage { repeated PeerEndpoint peers = 1; } message PeerEndpoint { ...
python
def peer_list(self): """ GET /network/peers Use the Network APIs to retrieve information about the network of peer nodes comprising the blockchain network. ```golang message PeersMessage { repeated PeerEndpoint peers = 1; } message PeerEndpoint { ...
['def', 'peer_list', '(', 'self', ')', ':', 'res', '=', 'self', '.', '_get', '(', 'self', '.', '_url', '(', '"/network/peers"', ')', ')', 'return', 'self', '.', '_result', '(', 'res', ',', 'True', ')']
GET /network/peers Use the Network APIs to retrieve information about the network of peer nodes comprising the blockchain network. ```golang message PeersMessage { repeated PeerEndpoint peers = 1; } message PeerEndpoint { PeerID ID = 1; ...
['GET', '/', 'network', '/', 'peers']
train
https://github.com/yeasy/hyperledger-py/blob/f24e9cc409b50628b911950466786be6fe74f09f/hyperledger/api/network.py#L16-L46
8,955
kodexlab/reliure
reliure/offline.py
run
def run(pipeline, input_gen, options={}): """ Run a pipeline over a input generator >>> # if we have a simple component >>> from reliure.pipeline import Composable >>> @Composable ... def print_each(letters): ... for letter in letters: ... print(letter) ... yield let...
python
def run(pipeline, input_gen, options={}): """ Run a pipeline over a input generator >>> # if we have a simple component >>> from reliure.pipeline import Composable >>> @Composable ... def print_each(letters): ... for letter in letters: ... print(letter) ... yield let...
['def', 'run', '(', 'pipeline', ',', 'input_gen', ',', 'options', '=', '{', '}', ')', ':', 'logger', '=', 'logging', '.', 'getLogger', '(', '"reliure.run"', ')', 't0', '=', 'time', '(', ')', 'res', '=', '[', 'output', 'for', 'output', 'in', 'pipeline', '(', 'input_gen', ',', '*', '*', 'options', ')', ']', 'logger', '.'...
Run a pipeline over a input generator >>> # if we have a simple component >>> from reliure.pipeline import Composable >>> @Composable ... def print_each(letters): ... for letter in letters: ... print(letter) ... yield letter >>> # that we want to run over a given inp...
['Run', 'a', 'pipeline', 'over', 'a', 'input', 'generator']
train
https://github.com/kodexlab/reliure/blob/0450c7a9254c5c003162738458bbe0c49e777ba5/reliure/offline.py#L11-L45
8,956
zerok/flask-compass
flaskext/compass.py
CompassConfig.compile
def compile(self, compass): """ Calls the compass script specified in the compass extension with the paths provided by the config.rb. """ try: output = subprocess.check_output( [compass.compass_path, 'compile', '-q'], cwd=self.b...
python
def compile(self, compass): """ Calls the compass script specified in the compass extension with the paths provided by the config.rb. """ try: output = subprocess.check_output( [compass.compass_path, 'compile', '-q'], cwd=self.b...
['def', 'compile', '(', 'self', ',', 'compass', ')', ':', 'try', ':', 'output', '=', 'subprocess', '.', 'check_output', '(', '[', 'compass', '.', 'compass_path', ',', "'compile'", ',', "'-q'", ']', ',', 'cwd', '=', 'self', '.', 'base_dir', ')', 'os', '.', 'utime', '(', 'self', '.', 'dest', ',', 'None', ')', 'compass', ...
Calls the compass script specified in the compass extension with the paths provided by the config.rb.
['Calls', 'the', 'compass', 'script', 'specified', 'in', 'the', 'compass', 'extension', 'with', 'the', 'paths', 'provided', 'by', 'the', 'config', '.', 'rb', '.']
train
https://github.com/zerok/flask-compass/blob/633ef4bcbfbf0882a337d84f776b3c090ef5f464/flaskext/compass.py#L179-L197
8,957
SmartTeleMax/iktomi
iktomi/web/url_templates.py
UrlTemplate.match
def match(self, path, **kw): ''' path - str (urlencoded) ''' m = self._pattern.match(path) if m: kwargs = m.groupdict() # convert params for url_arg_name, value_urlencoded in kwargs.items(): conv_obj = self._url_params[url_arg_n...
python
def match(self, path, **kw): ''' path - str (urlencoded) ''' m = self._pattern.match(path) if m: kwargs = m.groupdict() # convert params for url_arg_name, value_urlencoded in kwargs.items(): conv_obj = self._url_params[url_arg_n...
['def', 'match', '(', 'self', ',', 'path', ',', '*', '*', 'kw', ')', ':', 'm', '=', 'self', '.', '_pattern', '.', 'match', '(', 'path', ')', 'if', 'm', ':', 'kwargs', '=', 'm', '.', 'groupdict', '(', ')', '# convert params', 'for', 'url_arg_name', ',', 'value_urlencoded', 'in', 'kwargs', '.', 'items', '(', ')', ':', 'c...
path - str (urlencoded)
['path', '-', 'str', '(', 'urlencoded', ')']
train
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/web/url_templates.py#L111-L135
8,958
pypa/pipenv
pipenv/patched/notpip/_vendor/html5lib/treebuilders/etree_lxml.py
tostring
def tostring(element): """Serialize an element and its child nodes to a string""" rv = [] def serializeElement(element): if not hasattr(element, "tag"): if element.docinfo.internalDTD: if element.docinfo.doctype: dtd_str = element.docinfo.doctype ...
python
def tostring(element): """Serialize an element and its child nodes to a string""" rv = [] def serializeElement(element): if not hasattr(element, "tag"): if element.docinfo.internalDTD: if element.docinfo.doctype: dtd_str = element.docinfo.doctype ...
['def', 'tostring', '(', 'element', ')', ':', 'rv', '=', '[', ']', 'def', 'serializeElement', '(', 'element', ')', ':', 'if', 'not', 'hasattr', '(', 'element', ',', '"tag"', ')', ':', 'if', 'element', '.', 'docinfo', '.', 'internalDTD', ':', 'if', 'element', '.', 'docinfo', '.', 'doctype', ':', 'dtd_str', '=', 'element...
Serialize an element and its child nodes to a string
['Serialize', 'an', 'element', 'and', 'its', 'child', 'nodes', 'to', 'a', 'string']
train
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/html5lib/treebuilders/etree_lxml.py#L134-L172
8,959
davgeo/clear
clear/util.py
UserAcceptance
def UserAcceptance( matchList, recursiveLookup = True, promptComment = None, promptOnly = False, xStrOverride = "to skip this selection" ): """ Prompt user to select a entry from a given match list or to enter a new string to look up. If the match list is empty user must enter a new string or exit. ...
python
def UserAcceptance( matchList, recursiveLookup = True, promptComment = None, promptOnly = False, xStrOverride = "to skip this selection" ): """ Prompt user to select a entry from a given match list or to enter a new string to look up. If the match list is empty user must enter a new string or exit. ...
['def', 'UserAcceptance', '(', 'matchList', ',', 'recursiveLookup', '=', 'True', ',', 'promptComment', '=', 'None', ',', 'promptOnly', '=', 'False', ',', 'xStrOverride', '=', '"to skip this selection"', ')', ':', 'matchString', '=', "', '", '.', 'join', '(', 'matchList', ')', 'if', 'len', '(', 'matchList', ')', '==', '...
Prompt user to select a entry from a given match list or to enter a new string to look up. If the match list is empty user must enter a new string or exit. Parameters ---------- matchList : list A list of entries which the user can select a valid match from. recursiveLookup : boolean [optional: ...
['Prompt', 'user', 'to', 'select', 'a', 'entry', 'from', 'a', 'given', 'match', 'list', 'or', 'to', 'enter', 'a', 'new', 'string', 'to', 'look', 'up', '.', 'If', 'the', 'match', 'list', 'is', 'empty', 'user', 'must', 'enter', 'a', 'new', 'string', 'or', 'exit', '.']
train
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/util.py#L162-L240
8,960
ratt-ru/PyMORESANE
pymoresane/main.py
DataImage.moresane_by_scale
def moresane_by_scale(self, start_scale=1, stop_scale=20, subregion=None, sigma_level=4, loop_gain=0.1, tolerance=0.75, accuracy=1e-6, major_loop_miter=100, minor_loop_miter=30, all_on_gpu=False, decom_mode="ser", core_count=1, conv_device='cpu', conv_mode='linear', e...
python
def moresane_by_scale(self, start_scale=1, stop_scale=20, subregion=None, sigma_level=4, loop_gain=0.1, tolerance=0.75, accuracy=1e-6, major_loop_miter=100, minor_loop_miter=30, all_on_gpu=False, decom_mode="ser", core_count=1, conv_device='cpu', conv_mode='linear', e...
['def', 'moresane_by_scale', '(', 'self', ',', 'start_scale', '=', '1', ',', 'stop_scale', '=', '20', ',', 'subregion', '=', 'None', ',', 'sigma_level', '=', '4', ',', 'loop_gain', '=', '0.1', ',', 'tolerance', '=', '0.75', ',', 'accuracy', '=', '1e-6', ',', 'major_loop_miter', '=', '100', ',', 'minor_loop_miter', '=',...
Extension of the MORESANE algorithm. This takes a scale-by-scale approach, attempting to remove all sources at the lower scales before moving onto the higher ones. At each step the algorithm may return to previous scales to remove the sources uncovered by the deconvolution. INPUTS: star...
['Extension', 'of', 'the', 'MORESANE', 'algorithm', '.', 'This', 'takes', 'a', 'scale', '-', 'by', '-', 'scale', 'approach', 'attempting', 'to', 'remove', 'all', 'sources', 'at', 'the', 'lower', 'scales', 'before', 'moving', 'onto', 'the', 'higher', 'ones', '.', 'At', 'each', 'step', 'the', 'algorithm', 'may', 'return'...
train
https://github.com/ratt-ru/PyMORESANE/blob/b024591ad0bbb69320d08841f28a2c27f62ae1af/pymoresane/main.py#L523-L599
8,961
Dallinger/Dallinger
dallinger/notifications.py
EmailConfig.validate
def validate(self): """Could this config be used to send a real email?""" missing = [] for k, v in self._map.items(): attr = getattr(self, k, False) if not attr or attr == CONFIG_PLACEHOLDER: missing.append(v) if missing: return "Missin...
python
def validate(self): """Could this config be used to send a real email?""" missing = [] for k, v in self._map.items(): attr = getattr(self, k, False) if not attr or attr == CONFIG_PLACEHOLDER: missing.append(v) if missing: return "Missin...
['def', 'validate', '(', 'self', ')', ':', 'missing', '=', '[', ']', 'for', 'k', ',', 'v', 'in', 'self', '.', '_map', '.', 'items', '(', ')', ':', 'attr', '=', 'getattr', '(', 'self', ',', 'k', ',', 'False', ')', 'if', 'not', 'attr', 'or', 'attr', '==', 'CONFIG_PLACEHOLDER', ':', 'missing', '.', 'append', '(', 'v', ')'...
Could this config be used to send a real email?
['Could', 'this', 'config', 'be', 'used', 'to', 'send', 'a', 'real', 'email?']
train
https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/notifications.py#L42-L52
8,962
ARMmbed/mbed-cloud-sdk-python
src/mbed_cloud/_backends/iam/apis/aggregator_account_admin_api.py
AggregatorAccountAdminApi.update_account_api_key
def update_account_api_key(self, account_id, api_key, body, **kwargs): # noqa: E501 """Update API key details. # noqa: E501 An endpoint for updating API key details. **Example usage:** `curl -X PUT https://api.us-east-1.mbedcloud.com/v3/accounts/{accountID}/api-keys/{apiKey} -d '{\"name\": \"TestAp...
python
def update_account_api_key(self, account_id, api_key, body, **kwargs): # noqa: E501 """Update API key details. # noqa: E501 An endpoint for updating API key details. **Example usage:** `curl -X PUT https://api.us-east-1.mbedcloud.com/v3/accounts/{accountID}/api-keys/{apiKey} -d '{\"name\": \"TestAp...
['def', 'update_account_api_key', '(', 'self', ',', 'account_id', ',', 'api_key', ',', 'body', ',', '*', '*', 'kwargs', ')', ':', '# noqa: E501', 'kwargs', '[', "'_return_http_data_only'", ']', '=', 'True', 'if', 'kwargs', '.', 'get', '(', "'asynchronous'", ')', ':', 'return', 'self', '.', 'update_account_api_key_with_...
Update API key details. # noqa: E501 An endpoint for updating API key details. **Example usage:** `curl -X PUT https://api.us-east-1.mbedcloud.com/v3/accounts/{accountID}/api-keys/{apiKey} -d '{\"name\": \"TestApiKey25\"}' -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501...
['Update', 'API', 'key', 'details', '.', '#', 'noqa', ':', 'E501']
train
https://github.com/ARMmbed/mbed-cloud-sdk-python/blob/c0af86fb2cdd4dc7ed26f236139241067d293509/src/mbed_cloud/_backends/iam/apis/aggregator_account_admin_api.py#L4163-L4185
8,963
aroberge/experimental
experimental/core/transforms.py
add_transformers
def add_transformers(line): '''Extract the transformers names from a line of code of the form from __experimental__ import transformer1 [,...] and adds them to the globally known dict ''' assert FROM_EXPERIMENTAL.match(line) line = FROM_EXPERIMENTAL.sub(' ', line) # we now have: " tra...
python
def add_transformers(line): '''Extract the transformers names from a line of code of the form from __experimental__ import transformer1 [,...] and adds them to the globally known dict ''' assert FROM_EXPERIMENTAL.match(line) line = FROM_EXPERIMENTAL.sub(' ', line) # we now have: " tra...
['def', 'add_transformers', '(', 'line', ')', ':', 'assert', 'FROM_EXPERIMENTAL', '.', 'match', '(', 'line', ')', 'line', '=', 'FROM_EXPERIMENTAL', '.', 'sub', '(', "' '", ',', 'line', ')', '# we now have: " transformer1 [,...]"', 'line', '=', 'line', '.', 'split', '(', '"#"', ')', '[', '0', ']', '# remove any end of l...
Extract the transformers names from a line of code of the form from __experimental__ import transformer1 [,...] and adds them to the globally known dict
['Extract', 'the', 'transformers', 'names', 'from', 'a', 'line', 'of', 'code', 'of', 'the', 'form', 'from', '__experimental__', 'import', 'transformer1', '[', '...', ']', 'and', 'adds', 'them', 'to', 'the', 'globally', 'known', 'dict']
train
https://github.com/aroberge/experimental/blob/031a9be10698b429998436da748b8fdb86f18b47/experimental/core/transforms.py#L19-L31
8,964
gabstopper/smc-python
smc/policy/rule.py
IPv4Rule.create
def create(self, name, sources=None, destinations=None, services=None, action='allow', log_options=None, authentication_options=None, connection_tracking=None, is_disabled=False, vpn_policy=None, mobile_vpn=False, add_pos=None, after=None, before=None, ...
python
def create(self, name, sources=None, destinations=None, services=None, action='allow', log_options=None, authentication_options=None, connection_tracking=None, is_disabled=False, vpn_policy=None, mobile_vpn=False, add_pos=None, after=None, before=None, ...
['def', 'create', '(', 'self', ',', 'name', ',', 'sources', '=', 'None', ',', 'destinations', '=', 'None', ',', 'services', '=', 'None', ',', 'action', '=', "'allow'", ',', 'log_options', '=', 'None', ',', 'authentication_options', '=', 'None', ',', 'connection_tracking', '=', 'None', ',', 'is_disabled', '=', 'False', ...
Create a layer 3 firewall rule :param str name: name of rule :param sources: source/s for rule :type sources: list[str, Element] :param destinations: destination/s for rule :type destinations: list[str, Element] :param services: service/s for rule :type services:...
['Create', 'a', 'layer', '3', 'firewall', 'rule']
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/policy/rule.py#L469-L575
8,965
scanny/python-pptx
pptx/chart/series.py
LineSeries.smooth
def smooth(self): """ Read/write boolean specifying whether to use curve smoothing to form the line connecting the data points in this series into a continuous curve. If |False|, a series of straight line segments are used to connect the points. """ smooth = self....
python
def smooth(self): """ Read/write boolean specifying whether to use curve smoothing to form the line connecting the data points in this series into a continuous curve. If |False|, a series of straight line segments are used to connect the points. """ smooth = self....
['def', 'smooth', '(', 'self', ')', ':', 'smooth', '=', 'self', '.', '_element', '.', 'smooth', 'if', 'smooth', 'is', 'None', ':', 'return', 'True', 'return', 'smooth', '.', 'val']
Read/write boolean specifying whether to use curve smoothing to form the line connecting the data points in this series into a continuous curve. If |False|, a series of straight line segments are used to connect the points.
['Read', '/', 'write', 'boolean', 'specifying', 'whether', 'to', 'use', 'curve', 'smoothing', 'to', 'form', 'the', 'line', 'connecting', 'the', 'data', 'points', 'in', 'this', 'series', 'into', 'a', 'continuous', 'curve', '.', 'If', '|False|', 'a', 'series', 'of', 'straight', 'line', 'segments', 'are', 'used', 'to', 'c...
train
https://github.com/scanny/python-pptx/blob/d6ab8234f8b03953d2f831ff9394b1852db34130/pptx/chart/series.py#L140-L150
8,966
DLR-RM/RAFCON
source/rafcon/core/states/state.py
State.outcomes
def outcomes(self, outcomes): """ Setter for _outcomes field See property. :param dict outcomes: Dictionary outcomes[outcome_id] that maps :class:`int` outcome_ids onto values of type :class:`rafcon.core.state_elements.logical_port.Outcome` :raises excepti...
python
def outcomes(self, outcomes): """ Setter for _outcomes field See property. :param dict outcomes: Dictionary outcomes[outcome_id] that maps :class:`int` outcome_ids onto values of type :class:`rafcon.core.state_elements.logical_port.Outcome` :raises excepti...
['def', 'outcomes', '(', 'self', ',', 'outcomes', ')', ':', 'if', 'not', 'isinstance', '(', 'outcomes', ',', 'dict', ')', ':', 'raise', 'TypeError', '(', '"outcomes must be of type dict"', ')', 'if', '[', 'outcome_id', 'for', 'outcome_id', ',', 'outcome', 'in', 'outcomes', '.', 'items', '(', ')', 'if', 'not', 'isinstan...
Setter for _outcomes field See property. :param dict outcomes: Dictionary outcomes[outcome_id] that maps :class:`int` outcome_ids onto values of type :class:`rafcon.core.state_elements.logical_port.Outcome` :raises exceptions.TypeError: if outcomes parameter has t...
['Setter', 'for', '_outcomes', 'field']
train
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L1192-L1227
8,967
KelSolaar/Umbra
umbra/preferences.py
Preferences.get_key
def get_key(self, section, key): """ Gets key value from settings file. :param section: Current section to retrieve key from. :type section: unicode :param key: Current key to retrieve. :type key: unicode :return: Current key value. :rtype: object ...
python
def get_key(self, section, key): """ Gets key value from settings file. :param section: Current section to retrieve key from. :type section: unicode :param key: Current key to retrieve. :type key: unicode :return: Current key value. :rtype: object ...
['def', 'get_key', '(', 'self', ',', 'section', ',', 'key', ')', ':', 'LOGGER', '.', 'debug', '(', '"> Retrieving \'{0}\' in \'{1}\' section."', '.', 'format', '(', 'key', ',', 'section', ')', ')', 'self', '.', '__settings', '.', 'beginGroup', '(', 'section', ')', 'value', '=', 'self', '.', '__settings', '.', 'value', ...
Gets key value from settings file. :param section: Current section to retrieve key from. :type section: unicode :param key: Current key to retrieve. :type key: unicode :return: Current key value. :rtype: object
['Gets', 'key', 'value', 'from', 'settings', 'file', '.']
train
https://github.com/KelSolaar/Umbra/blob/66f45f08d9d723787f1191989f8b0dda84b412ce/umbra/preferences.py#L225-L244
8,968
cakebread/yolk
yolk/pypi.py
check_proxy_setting
def check_proxy_setting(): """ If the environmental variable 'HTTP_PROXY' is set, it will most likely be in one of these forms: proxyhost:8080 http://proxyhost:8080 urlllib2 requires the proxy URL to start with 'http://' This routine does that, and returns the transport for xml...
python
def check_proxy_setting(): """ If the environmental variable 'HTTP_PROXY' is set, it will most likely be in one of these forms: proxyhost:8080 http://proxyhost:8080 urlllib2 requires the proxy URL to start with 'http://' This routine does that, and returns the transport for xml...
['def', 'check_proxy_setting', '(', ')', ':', 'try', ':', 'http_proxy', '=', 'os', '.', 'environ', '[', "'HTTP_PROXY'", ']', 'except', 'KeyError', ':', 'return', 'if', 'not', 'http_proxy', '.', 'startswith', '(', "'http://'", ')', ':', 'match', '=', 're', '.', 'match', '(', "'(http://)?([-_\\.A-Za-z]+):(\\d+)'", ',', '...
If the environmental variable 'HTTP_PROXY' is set, it will most likely be in one of these forms: proxyhost:8080 http://proxyhost:8080 urlllib2 requires the proxy URL to start with 'http://' This routine does that, and returns the transport for xmlrpc.
['If', 'the', 'environmental', 'variable', 'HTTP_PROXY', 'is', 'set', 'it', 'will', 'most', 'likely', 'be', 'in', 'one', 'of', 'these', 'forms', ':']
train
https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/pypi.py#L95-L117
8,969
knipknap/exscript
Exscript/util/interact.py
InputHistory.set
def set(self, key, value): """ Saves the input with the given key in the section that was passed to the constructor. If either the section or the key are not found, they are created. Does nothing if the given value is None. :type key: str :param key: The key fo...
python
def set(self, key, value): """ Saves the input with the given key in the section that was passed to the constructor. If either the section or the key are not found, they are created. Does nothing if the given value is None. :type key: str :param key: The key fo...
['def', 'set', '(', 'self', ',', 'key', ',', 'value', ')', ':', 'if', 'value', 'is', 'None', ':', 'return', 'None', 'self', '.', 'parser', '.', 'set', '(', 'self', '.', 'section', ',', 'key', ',', 'value', ')', '# Unfortunately ConfigParser attempts to write a string to the file', '# object, and NamedTemporaryFile uses...
Saves the input with the given key in the section that was passed to the constructor. If either the section or the key are not found, they are created. Does nothing if the given value is None. :type key: str :param key: The key for which to define a value. :type value...
['Saves', 'the', 'input', 'with', 'the', 'given', 'key', 'in', 'the', 'section', 'that', 'was', 'passed', 'to', 'the', 'constructor', '.', 'If', 'either', 'the', 'section', 'or', 'the', 'key', 'are', 'not', 'found', 'they', 'are', 'created', '.']
train
https://github.com/knipknap/exscript/blob/72718eee3e87b345d5a5255be9824e867e42927b/Exscript/util/interact.py#L108-L139
8,970
quantumlib/Cirq
cirq/protocols/apply_unitary.py
ApplyUnitaryArgs.subspace_index
def subspace_index(self, little_endian_bits_int: int ) -> Tuple[Union[slice, int, 'ellipsis'], ...]: """An index for the subspace where the target axes equal a value. Args: little_endian_bits_int: The desired value of the qubits at the targeted `axes`,...
python
def subspace_index(self, little_endian_bits_int: int ) -> Tuple[Union[slice, int, 'ellipsis'], ...]: """An index for the subspace where the target axes equal a value. Args: little_endian_bits_int: The desired value of the qubits at the targeted `axes`,...
['def', 'subspace_index', '(', 'self', ',', 'little_endian_bits_int', ':', 'int', ')', '->', 'Tuple', '[', 'Union', '[', 'slice', ',', 'int', ',', "'ellipsis'", ']', ',', '...', ']', ':', 'return', 'linalg', '.', 'slice_for_qubits_equal_to', '(', 'self', '.', 'axes', ',', 'little_endian_bits_int', ')']
An index for the subspace where the target axes equal a value. Args: little_endian_bits_int: The desired value of the qubits at the targeted `axes`, packed into an integer. The least significant bit of the integer is the desired bit for the first axis, and ...
['An', 'index', 'for', 'the', 'subspace', 'where', 'the', 'target', 'axes', 'equal', 'a', 'value', '.']
train
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/cirq/protocols/apply_unitary.py#L82-L111
8,971
lrq3000/pyFileFixity
pyFileFixity/lib/brownanrs/ff.py
GF2int.multiply
def multiply(a, b, prim=0x11b, field_charac_full=256, carryless=True): '''A slow multiply method. This method gives the same results as the other __mul__ method but without needing precomputed tables, thus it can be used to generate those tables. If prim is set to 0 and carryless=False,...
python
def multiply(a, b, prim=0x11b, field_charac_full=256, carryless=True): '''A slow multiply method. This method gives the same results as the other __mul__ method but without needing precomputed tables, thus it can be used to generate those tables. If prim is set to 0 and carryless=False,...
['def', 'multiply', '(', 'a', ',', 'b', ',', 'prim', '=', '0x11b', ',', 'field_charac_full', '=', '256', ',', 'carryless', '=', 'True', ')', ':', 'r', '=', '0', 'a', '=', 'int', '(', 'a', ')', 'b', '=', 'int', '(', 'b', ')', 'while', 'b', ':', '# while b is not 0', 'if', 'b', '&', '1', ':', 'r', '=', 'r', '^', 'a', 'if...
A slow multiply method. This method gives the same results as the other __mul__ method but without needing precomputed tables, thus it can be used to generate those tables. If prim is set to 0 and carryless=False, the function produces the result of a standard multiplication of integers (outsid...
['A', 'slow', 'multiply', 'method', '.', 'This', 'method', 'gives', 'the', 'same', 'results', 'as', 'the', 'other', '__mul__', 'method', 'but', 'without', 'needing', 'precomputed', 'tables', 'thus', 'it', 'can', 'be', 'used', 'to', 'generate', 'those', 'tables', '.']
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/brownanrs/ff.py#L265-L287
8,972
pmelchior/proxmin
proxmin/utils.py
get_step_f
def get_step_f(step_f, lR2, lS2): """Update the stepsize of given the primal and dual errors. See Boyd (2011), section 3.4.1 """ mu, tau = 10, 2 if lR2 > mu*lS2: return step_f * tau elif lS2 > mu*lR2: return step_f / tau return step_f
python
def get_step_f(step_f, lR2, lS2): """Update the stepsize of given the primal and dual errors. See Boyd (2011), section 3.4.1 """ mu, tau = 10, 2 if lR2 > mu*lS2: return step_f * tau elif lS2 > mu*lR2: return step_f / tau return step_f
['def', 'get_step_f', '(', 'step_f', ',', 'lR2', ',', 'lS2', ')', ':', 'mu', ',', 'tau', '=', '10', ',', '2', 'if', 'lR2', '>', 'mu', '*', 'lS2', ':', 'return', 'step_f', '*', 'tau', 'elif', 'lS2', '>', 'mu', '*', 'lR2', ':', 'return', 'step_f', '/', 'tau', 'return', 'step_f']
Update the stepsize of given the primal and dual errors. See Boyd (2011), section 3.4.1
['Update', 'the', 'stepsize', 'of', 'given', 'the', 'primal', 'and', 'dual', 'errors', '.']
train
https://github.com/pmelchior/proxmin/blob/60e49d90c67c46329cc1d3b5c484951dc8bd2c3f/proxmin/utils.py#L300-L310
8,973
crunchyroll/ef-open
efopen/ef_aws_resolver.py
EFAwsResolver.elbv2_load_balancer_arn_suffix
def elbv2_load_balancer_arn_suffix(self, lookup, default=None): """ Args: lookup: the friendly name of the v2 elb to look up default: value to return in case of no match Returns: The shorthand fragment of the ALB's ARN, of the form `app/*/*` """ try: elb = self._elbv2_load_ba...
python
def elbv2_load_balancer_arn_suffix(self, lookup, default=None): """ Args: lookup: the friendly name of the v2 elb to look up default: value to return in case of no match Returns: The shorthand fragment of the ALB's ARN, of the form `app/*/*` """ try: elb = self._elbv2_load_ba...
['def', 'elbv2_load_balancer_arn_suffix', '(', 'self', ',', 'lookup', ',', 'default', '=', 'None', ')', ':', 'try', ':', 'elb', '=', 'self', '.', '_elbv2_load_balancer', '(', 'lookup', ')', 'm', '=', 're', '.', 'search', '(', "r'.+?(app\\/[^\\/]+\\/[^\\/]+)$'", ',', 'elb', '[', "'LoadBalancerArn'", ']', ')', 'return', ...
Args: lookup: the friendly name of the v2 elb to look up default: value to return in case of no match Returns: The shorthand fragment of the ALB's ARN, of the form `app/*/*`
['Args', ':', 'lookup', ':', 'the', 'friendly', 'name', 'of', 'the', 'v2', 'elb', 'to', 'look', 'up', 'default', ':', 'value', 'to', 'return', 'in', 'case', 'of', 'no', 'match', 'Returns', ':', 'The', 'shorthand', 'fragment', 'of', 'the', 'ALB', 's', 'ARN', 'of', 'the', 'form', 'app', '/', '*', '/', '*']
train
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_aws_resolver.py#L358-L371
8,974
nickmckay/LiPD-utilities
Matlab/bagit.py
Bag.missing_optional_tagfiles
def missing_optional_tagfiles(self): """ From v0.97 we need to validate any tagfiles listed in the optional tagmanifest(s). As there is no mandatory directory structure for additional tagfiles we can only check for entries with missing files (not missing entries for exist...
python
def missing_optional_tagfiles(self): """ From v0.97 we need to validate any tagfiles listed in the optional tagmanifest(s). As there is no mandatory directory structure for additional tagfiles we can only check for entries with missing files (not missing entries for exist...
['def', 'missing_optional_tagfiles', '(', 'self', ')', ':', 'for', 'tagfilepath', 'in', 'list', '(', 'self', '.', 'tagfile_entries', '(', ')', '.', 'keys', '(', ')', ')', ':', 'if', 'not', 'os', '.', 'path', '.', 'isfile', '(', 'os', '.', 'path', '.', 'join', '(', 'self', '.', 'path', ',', 'tagfilepath', ')', ')', ':',...
From v0.97 we need to validate any tagfiles listed in the optional tagmanifest(s). As there is no mandatory directory structure for additional tagfiles we can only check for entries with missing files (not missing entries for existing files).
['From', 'v0', '.', '97', 'we', 'need', 'to', 'validate', 'any', 'tagfiles', 'listed', 'in', 'the', 'optional', 'tagmanifest', '(', 's', ')', '.', 'As', 'there', 'is', 'no', 'mandatory', 'directory', 'structure', 'for', 'additional', 'tagfiles', 'we', 'can', 'only', 'check', 'for', 'entries', 'with', 'missing', 'files'...
train
https://github.com/nickmckay/LiPD-utilities/blob/5dab6bbeffc5effd68e3a6beaca6b76aa928e860/Matlab/bagit.py#L325-L335
8,975
fastavro/fastavro
fastavro/_read_py.py
schemaless_reader
def schemaless_reader(fo, writer_schema, reader_schema=None): """Reads a single record writen using the :meth:`~fastavro._write_py.schemaless_writer` Parameters ---------- fo: file-like Input stream writer_schema: dict Schema used when calling schemaless_writer reader_schema...
python
def schemaless_reader(fo, writer_schema, reader_schema=None): """Reads a single record writen using the :meth:`~fastavro._write_py.schemaless_writer` Parameters ---------- fo: file-like Input stream writer_schema: dict Schema used when calling schemaless_writer reader_schema...
['def', 'schemaless_reader', '(', 'fo', ',', 'writer_schema', ',', 'reader_schema', '=', 'None', ')', ':', 'if', 'writer_schema', '==', 'reader_schema', ':', '# No need for the reader schema if they are the same', 'reader_schema', '=', 'None', 'writer_schema', '=', 'parse_schema', '(', 'writer_schema', ')', 'if', 'read...
Reads a single record writen using the :meth:`~fastavro._write_py.schemaless_writer` Parameters ---------- fo: file-like Input stream writer_schema: dict Schema used when calling schemaless_writer reader_schema: dict, optional If the schema has changed since being writte...
['Reads', 'a', 'single', 'record', 'writen', 'using', 'the', ':', 'meth', ':', '~fastavro', '.', '_write_py', '.', 'schemaless_writer']
train
https://github.com/fastavro/fastavro/blob/bafe826293e19eb93e77bbb0f6adfa059c7884b2/fastavro/_read_py.py#L794-L826
8,976
wandb/client
wandb/vendor/prompt_toolkit/key_binding/registry.py
Registry.add_binding
def add_binding(self, *keys, **kwargs): """ Decorator for annotating key bindings. :param filter: :class:`~prompt_toolkit.filters.CLIFilter` to determine when this key binding is active. :param eager: :class:`~prompt_toolkit.filters.CLIFilter` or `bool`. When Tru...
python
def add_binding(self, *keys, **kwargs): """ Decorator for annotating key bindings. :param filter: :class:`~prompt_toolkit.filters.CLIFilter` to determine when this key binding is active. :param eager: :class:`~prompt_toolkit.filters.CLIFilter` or `bool`. When Tru...
['def', 'add_binding', '(', 'self', ',', '*', 'keys', ',', '*', '*', 'kwargs', ')', ':', 'filter', '=', 'to_cli_filter', '(', 'kwargs', '.', 'pop', '(', "'filter'", ',', 'True', ')', ')', 'eager', '=', 'to_cli_filter', '(', 'kwargs', '.', 'pop', '(', "'eager'", ',', 'False', ')', ')', 'save_before', '=', 'kwargs', '.',...
Decorator for annotating key bindings. :param filter: :class:`~prompt_toolkit.filters.CLIFilter` to determine when this key binding is active. :param eager: :class:`~prompt_toolkit.filters.CLIFilter` or `bool`. When True, ignore potential longer matches when this key binding is ...
['Decorator', 'for', 'annotating', 'key', 'bindings', '.']
train
https://github.com/wandb/client/blob/7d08954ed5674fee223cd85ed0d8518fe47266b2/wandb/vendor/prompt_toolkit/key_binding/registry.py#L101-L141
8,977
saltstack/salt
salt/modules/zfs.py
exists
def exists(name, **kwargs): ''' Check if a ZFS filesystem or volume or snapshot exists. name : string name of dataset type : string also check if dataset is of a certain type, valid choices are: filesystem, snapshot, volume, bookmark, or all. .. versionadded:: 2015.5.0 ...
python
def exists(name, **kwargs): ''' Check if a ZFS filesystem or volume or snapshot exists. name : string name of dataset type : string also check if dataset is of a certain type, valid choices are: filesystem, snapshot, volume, bookmark, or all. .. versionadded:: 2015.5.0 ...
['def', 'exists', '(', 'name', ',', '*', '*', 'kwargs', ')', ':', '## Configure command', '# NOTE: initialize the defaults', 'opts', '=', '{', '}', '# NOTE: set extra config from kwargs', 'if', 'kwargs', '.', 'get', '(', "'type'", ',', 'False', ')', ':', 'opts', '[', "'-t'", ']', '=', 'kwargs', '.', 'get', '(', "'type'...
Check if a ZFS filesystem or volume or snapshot exists. name : string name of dataset type : string also check if dataset is of a certain type, valid choices are: filesystem, snapshot, volume, bookmark, or all. .. versionadded:: 2015.5.0 CLI Example: .. code-block:: bash ...
['Check', 'if', 'a', 'ZFS', 'filesystem', 'or', 'volume', 'or', 'snapshot', 'exists', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zfs.py#L48-L87
8,978
jasonlaska/spherecluster
spherecluster/von_mises_fisher_mixture.py
_inertia_from_labels
def _inertia_from_labels(X, centers, labels): """Compute inertia with cosine distance using known labels. """ n_examples, n_features = X.shape inertia = np.zeros((n_examples,)) for ee in range(n_examples): inertia[ee] = 1 - X[ee, :].dot(centers[int(labels[ee]), :].T) return np.sum(inert...
python
def _inertia_from_labels(X, centers, labels): """Compute inertia with cosine distance using known labels. """ n_examples, n_features = X.shape inertia = np.zeros((n_examples,)) for ee in range(n_examples): inertia[ee] = 1 - X[ee, :].dot(centers[int(labels[ee]), :].T) return np.sum(inert...
['def', '_inertia_from_labels', '(', 'X', ',', 'centers', ',', 'labels', ')', ':', 'n_examples', ',', 'n_features', '=', 'X', '.', 'shape', 'inertia', '=', 'np', '.', 'zeros', '(', '(', 'n_examples', ',', ')', ')', 'for', 'ee', 'in', 'range', '(', 'n_examples', ')', ':', 'inertia', '[', 'ee', ']', '=', '1', '-', 'X', '...
Compute inertia with cosine distance using known labels.
['Compute', 'inertia', 'with', 'cosine', 'distance', 'using', 'known', 'labels', '.']
train
https://github.com/jasonlaska/spherecluster/blob/701b0b1909088a56e353b363b2672580d4fe9d93/spherecluster/von_mises_fisher_mixture.py#L25-L33
8,979
Erotemic/utool
utool/util_progress.py
progress_str
def progress_str(max_val, lbl='Progress: ', repl=False, approx=False, backspace=PROGGRESS_BACKSPACE): r""" makes format string that prints progress: %Xd/MAX_VAL with backspaces NOTE: \r can be used instead of backspaces. This function is not very relevant because of that. """ # st...
python
def progress_str(max_val, lbl='Progress: ', repl=False, approx=False, backspace=PROGGRESS_BACKSPACE): r""" makes format string that prints progress: %Xd/MAX_VAL with backspaces NOTE: \r can be used instead of backspaces. This function is not very relevant because of that. """ # st...
['def', 'progress_str', '(', 'max_val', ',', 'lbl', '=', "'Progress: '", ',', 'repl', '=', 'False', ',', 'approx', '=', 'False', ',', 'backspace', '=', 'PROGGRESS_BACKSPACE', ')', ':', '# string that displays max value', 'max_str', '=', 'six', '.', 'text_type', '(', 'max_val', ')', 'if', 'approx', ':', '# denote approx...
r""" makes format string that prints progress: %Xd/MAX_VAL with backspaces NOTE: \r can be used instead of backspaces. This function is not very relevant because of that.
['r', 'makes', 'format', 'string', 'that', 'prints', 'progress', ':', '%Xd', '/', 'MAX_VAL', 'with', 'backspaces']
train
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_progress.py#L836-L869
8,980
saltstack/salt
salt/modules/oracle.py
run_query
def run_query(db, query): ''' Run SQL query and return result CLI Example: .. code-block:: bash salt '*' oracle.run_query my_db "select * from my_table" ''' if db in [x.keys()[0] for x in show_dbs()]: conn = _connect(show_dbs(db)[db]['uri']) else: log.debug('No uri...
python
def run_query(db, query): ''' Run SQL query and return result CLI Example: .. code-block:: bash salt '*' oracle.run_query my_db "select * from my_table" ''' if db in [x.keys()[0] for x in show_dbs()]: conn = _connect(show_dbs(db)[db]['uri']) else: log.debug('No uri...
['def', 'run_query', '(', 'db', ',', 'query', ')', ':', 'if', 'db', 'in', '[', 'x', '.', 'keys', '(', ')', '[', '0', ']', 'for', 'x', 'in', 'show_dbs', '(', ')', ']', ':', 'conn', '=', '_connect', '(', 'show_dbs', '(', 'db', ')', '[', 'db', ']', '[', "'uri'", ']', ')', 'else', ':', 'log', '.', 'debug', '(', "'No uri fo...
Run SQL query and return result CLI Example: .. code-block:: bash salt '*' oracle.run_query my_db "select * from my_table"
['Run', 'SQL', 'query', 'and', 'return', 'result']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/oracle.py#L170-L187
8,981
confluentinc/confluent-kafka-python
confluent_kafka/avro/serializer/message_serializer.py
MessageSerializer.encode_record_with_schema_id
def encode_record_with_schema_id(self, schema_id, record, is_key=False): """ Encode a record with a given schema id. The record must be a python dictionary. :param int schema_id: integer ID :param dict record: An object to serialize :param bool is_key: If the record is a...
python
def encode_record_with_schema_id(self, schema_id, record, is_key=False): """ Encode a record with a given schema id. The record must be a python dictionary. :param int schema_id: integer ID :param dict record: An object to serialize :param bool is_key: If the record is a...
['def', 'encode_record_with_schema_id', '(', 'self', ',', 'schema_id', ',', 'record', ',', 'is_key', '=', 'False', ')', ':', 'serialize_err', '=', 'KeySerializerError', 'if', 'is_key', 'else', 'ValueSerializerError', '# use slow avro', 'if', 'schema_id', 'not', 'in', 'self', '.', 'id_to_writers', ':', '# get the writer...
Encode a record with a given schema id. The record must be a python dictionary. :param int schema_id: integer ID :param dict record: An object to serialize :param bool is_key: If the record is a key :returns: decoder function :rtype: func
['Encode', 'a', 'record', 'with', 'a', 'given', 'schema', 'id', '.', 'The', 'record', 'must', 'be', 'a', 'python', 'dictionary', '.', ':', 'param', 'int', 'schema_id', ':', 'integer', 'ID', ':', 'param', 'dict', 'record', ':', 'An', 'object', 'to', 'serialize', ':', 'param', 'bool', 'is_key', ':', 'If', 'the', 'record'...
train
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/confluent_kafka/avro/serializer/message_serializer.py#L115-L149
8,982
PmagPy/PmagPy
dialogs/thellier_interpreter.py
thellier_auto_interpreter.find_close_value
def find_close_value(self, LIST, value): ''' take a LIST and find the nearest value in LIST to 'value' ''' diff = inf for a in LIST: if abs(value - a) < diff: diff = abs(value - a) result = a return(result)
python
def find_close_value(self, LIST, value): ''' take a LIST and find the nearest value in LIST to 'value' ''' diff = inf for a in LIST: if abs(value - a) < diff: diff = abs(value - a) result = a return(result)
['def', 'find_close_value', '(', 'self', ',', 'LIST', ',', 'value', ')', ':', 'diff', '=', 'inf', 'for', 'a', 'in', 'LIST', ':', 'if', 'abs', '(', 'value', '-', 'a', ')', '<', 'diff', ':', 'diff', '=', 'abs', '(', 'value', '-', 'a', ')', 'result', '=', 'a', 'return', '(', 'result', ')']
take a LIST and find the nearest value in LIST to 'value'
['take', 'a', 'LIST', 'and', 'find', 'the', 'nearest', 'value', 'in', 'LIST', 'to', 'value']
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/thellier_interpreter.py#L1000-L1009
8,983
salbrandi/stressypy
stressypy/cpustresser.py
create_job
def create_job(cpu_width, time_height): """ :param cpu_width: number of cpus :param time_height: amount of time :return: the instantiated JobBlock object """ shell_command = stress_string.format(cpu_width, time_height) job = JobBlock(cpu_width, time_height) job.set_job(subprocess.call, ...
python
def create_job(cpu_width, time_height): """ :param cpu_width: number of cpus :param time_height: amount of time :return: the instantiated JobBlock object """ shell_command = stress_string.format(cpu_width, time_height) job = JobBlock(cpu_width, time_height) job.set_job(subprocess.call, ...
['def', 'create_job', '(', 'cpu_width', ',', 'time_height', ')', ':', 'shell_command', '=', 'stress_string', '.', 'format', '(', 'cpu_width', ',', 'time_height', ')', 'job', '=', 'JobBlock', '(', 'cpu_width', ',', 'time_height', ')', 'job', '.', 'set_job', '(', 'subprocess', '.', 'call', ',', 'shell_command', ',', 'she...
:param cpu_width: number of cpus :param time_height: amount of time :return: the instantiated JobBlock object
[':', 'param', 'cpu_width', ':', 'number', 'of', 'cpus', ':', 'param', 'time_height', ':', 'amount', 'of', 'time', ':', 'return', ':', 'the', 'instantiated', 'JobBlock', 'object']
train
https://github.com/salbrandi/stressypy/blob/7e2901e131a40f3597921358a1c8647a346bd0cc/stressypy/cpustresser.py#L52-L62
8,984
xapple/plumbing
plumbing/slurm/job.py
JobSLURM.wait_locally
def wait_locally(self): """If you have run the query in a non-blocking way, call this method to pause until the query is finished.""" try: self.thread.join(sys.maxint) # maxint timeout so that we can Ctrl-C them except KeyboardInterrupt: print "Stopped waiting on job '%s'" % self.kwargs[...
python
def wait_locally(self): """If you have run the query in a non-blocking way, call this method to pause until the query is finished.""" try: self.thread.join(sys.maxint) # maxint timeout so that we can Ctrl-C them except KeyboardInterrupt: print "Stopped waiting on job '%s'" % self.kwargs[...
['def', 'wait_locally', '(', 'self', ')', ':', 'try', ':', 'self', '.', 'thread', '.', 'join', '(', 'sys', '.', 'maxint', ')', '# maxint timeout so that we can Ctrl-C them', 'except', 'KeyboardInterrupt', ':', 'print', '"Stopped waiting on job \'%s\'"', '%', 'self', '.', 'kwargs', '[', "'job_name'", ']']
If you have run the query in a non-blocking way, call this method to pause until the query is finished.
['If', 'you', 'have', 'run', 'the', 'query', 'in', 'a', 'non', '-', 'blocking', 'way', 'call', 'this', 'method', 'to', 'pause', 'until', 'the', 'query', 'is', 'finished', '.']
train
https://github.com/xapple/plumbing/blob/4a7706c7722f5996d0ca366f191aff9ac145880a/plumbing/slurm/job.py#L263-L267
8,985
spacetelescope/drizzlepac
drizzlepac/imageObject.py
baseImageObject.putData
def putData(self,data=None,exten=None): """ Now that we are removing the data from the object to save memory, we need something that cleanly puts the data array back into the object so that we can write out everything together using something like fits.writeto....this method...
python
def putData(self,data=None,exten=None): """ Now that we are removing the data from the object to save memory, we need something that cleanly puts the data array back into the object so that we can write out everything together using something like fits.writeto....this method...
['def', 'putData', '(', 'self', ',', 'data', '=', 'None', ',', 'exten', '=', 'None', ')', ':', 'if', 'data', 'is', 'None', ':', 'log', '.', 'warning', '(', '"No data supplied"', ')', 'else', ':', 'extnum', '=', '_interpretExten', '(', 'exten', ')', 'ext', '=', 'self', '.', '_image', '[', 'extnum', ']', '# update the bi...
Now that we are removing the data from the object to save memory, we need something that cleanly puts the data array back into the object so that we can write out everything together using something like fits.writeto....this method is an attempt to make sure that when yo...
['Now', 'that', 'we', 'are', 'removing', 'the', 'data', 'from', 'the', 'object', 'to', 'save', 'memory', 'we', 'need', 'something', 'that', 'cleanly', 'puts', 'the', 'data', 'array', 'back', 'into', 'the', 'object', 'so', 'that', 'we', 'can', 'write', 'out', 'everything', 'together', 'using', 'something', 'like', 'fits...
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L222-L244
8,986
pvlib/pvlib-python
pvlib/atmosphere.py
kasten96_lt
def kasten96_lt(airmass_absolute, precipitable_water, aod_bb): """ Calculate Linke turbidity factor using Kasten pyrheliometric formula. Note that broadband aerosol optical depth (AOD) can be approximated by AOD measured at 700 nm according to Molineaux [4] . Bird and Hulstrom offer an alternate ap...
python
def kasten96_lt(airmass_absolute, precipitable_water, aod_bb): """ Calculate Linke turbidity factor using Kasten pyrheliometric formula. Note that broadband aerosol optical depth (AOD) can be approximated by AOD measured at 700 nm according to Molineaux [4] . Bird and Hulstrom offer an alternate ap...
['def', 'kasten96_lt', '(', 'airmass_absolute', ',', 'precipitable_water', ',', 'aod_bb', ')', ':', '# "From numerically integrated spectral simulations done with Modtran', '# (Berk, 1989), Molineaux (1998) obtained for the broadband optical depth', '# of a clean and dry atmospshere (fictitious atmosphere that comprise...
Calculate Linke turbidity factor using Kasten pyrheliometric formula. Note that broadband aerosol optical depth (AOD) can be approximated by AOD measured at 700 nm according to Molineaux [4] . Bird and Hulstrom offer an alternate approximation using AOD measured at 380 nm and 500 nm. Based on original...
['Calculate', 'Linke', 'turbidity', 'factor', 'using', 'Kasten', 'pyrheliometric', 'formula', '.']
train
https://github.com/pvlib/pvlib-python/blob/2e844a595b820b43d1170269781fa66bd0ccc8a3/pvlib/atmosphere.py#L536-L621
8,987
jobovy/galpy
galpy/util/bovy_coords.py
Rz_to_lambdanu_jac
def Rz_to_lambdanu_jac(R,z,Delta=1.): """ NAME: Rz_to_lambdanu_jac PURPOSE: calculate the Jacobian of the cylindrical (R,z) to prolate spheroidal (lambda,nu) conversion INPUT: R - Galactocentric cylindrical radius z - vertical height Delta - foca...
python
def Rz_to_lambdanu_jac(R,z,Delta=1.): """ NAME: Rz_to_lambdanu_jac PURPOSE: calculate the Jacobian of the cylindrical (R,z) to prolate spheroidal (lambda,nu) conversion INPUT: R - Galactocentric cylindrical radius z - vertical height Delta - foca...
['def', 'Rz_to_lambdanu_jac', '(', 'R', ',', 'z', ',', 'Delta', '=', '1.', ')', ':', 'discr', '=', '(', 'R', '**', '2', '+', 'z', '**', '2', '-', 'Delta', '**', '2', ')', '**', '2', '+', '(', '4.', '*', 'Delta', '**', '2', '*', 'R', '**', '2', ')', 'dldR', '=', 'R', '*', '(', '1.', '+', '(', 'R', '**', '2', '+', 'z', '...
NAME: Rz_to_lambdanu_jac PURPOSE: calculate the Jacobian of the cylindrical (R,z) to prolate spheroidal (lambda,nu) conversion INPUT: R - Galactocentric cylindrical radius z - vertical height Delta - focal distance that defines the spheroidal coordinate ...
['NAME', ':']
train
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/util/bovy_coords.py#L2039-L2080
8,988
mrcagney/gtfstk
gtfstk/trips.py
map_trips
def map_trips( feed: "Feed", trip_ids: List[str], color_palette: List[str] = cs.COLORS_SET2, *, include_stops: bool = True, ): """ Return a Folium map showing the given trips and (optionally) their stops. Parameters ---------- feed : Feed trip_ids : list IDs of t...
python
def map_trips( feed: "Feed", trip_ids: List[str], color_palette: List[str] = cs.COLORS_SET2, *, include_stops: bool = True, ): """ Return a Folium map showing the given trips and (optionally) their stops. Parameters ---------- feed : Feed trip_ids : list IDs of t...
['def', 'map_trips', '(', 'feed', ':', '"Feed"', ',', 'trip_ids', ':', 'List', '[', 'str', ']', ',', 'color_palette', ':', 'List', '[', 'str', ']', '=', 'cs', '.', 'COLORS_SET2', ',', '*', ',', 'include_stops', ':', 'bool', '=', 'True', ',', ')', ':', 'import', 'folium', 'as', 'fl', 'import', 'folium', '.', 'plugins', ...
Return a Folium map showing the given trips and (optionally) their stops. Parameters ---------- feed : Feed trip_ids : list IDs of trips in ``feed.trips`` color_palette : list Palette to use to color the routes. If more routes than colors, then colors will be recycled. ...
['Return', 'a', 'Folium', 'map', 'showing', 'the', 'given', 'trips', 'and', '(', 'optionally', ')', 'their', 'stops', '.']
train
https://github.com/mrcagney/gtfstk/blob/c91494e6fefc02523889655a0dc92d1c0eee8d03/gtfstk/trips.py#L572-L683
8,989
saltstack/salt
salt/modules/lxd.py
image_get
def image_get(fingerprint, remote_addr=None, cert=None, key=None, verify_cert=True, _raw=False): ''' Get an image by its fingerprint fingerprint : The fingerprint of the image to retrieve remote_addr : An...
python
def image_get(fingerprint, remote_addr=None, cert=None, key=None, verify_cert=True, _raw=False): ''' Get an image by its fingerprint fingerprint : The fingerprint of the image to retrieve remote_addr : An...
['def', 'image_get', '(', 'fingerprint', ',', 'remote_addr', '=', 'None', ',', 'cert', '=', 'None', ',', 'key', '=', 'None', ',', 'verify_cert', '=', 'True', ',', '_raw', '=', 'False', ')', ':', 'client', '=', 'pylxd_client_get', '(', 'remote_addr', ',', 'cert', ',', 'key', ',', 'verify_cert', ')', 'image', '=', 'None'...
Get an image by its fingerprint fingerprint : The fingerprint of the image to retrieve remote_addr : An URL to a remote Server, you also have to give cert and key if you provide remote_addr and its a TCP Address! Examples: https://myserv...
['Get', 'an', 'image', 'by', 'its', 'fingerprint']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxd.py#L2542-L2600
8,990
modin-project/modin
modin/pandas/base.py
BasePandasDataset.get_dtype_counts
def get_dtype_counts(self): """Get the counts of dtypes in this object. Returns: The counts of dtypes in this object. """ if hasattr(self, "dtype"): return pandas.Series({str(self.dtype): 1}) result = self.dtypes.value_counts() result.ind...
python
def get_dtype_counts(self): """Get the counts of dtypes in this object. Returns: The counts of dtypes in this object. """ if hasattr(self, "dtype"): return pandas.Series({str(self.dtype): 1}) result = self.dtypes.value_counts() result.ind...
['def', 'get_dtype_counts', '(', 'self', ')', ':', 'if', 'hasattr', '(', 'self', ',', '"dtype"', ')', ':', 'return', 'pandas', '.', 'Series', '(', '{', 'str', '(', 'self', '.', 'dtype', ')', ':', '1', '}', ')', 'result', '=', 'self', '.', 'dtypes', '.', 'value_counts', '(', ')', 'result', '.', 'index', '=', 'result', '...
Get the counts of dtypes in this object. Returns: The counts of dtypes in this object.
['Get', 'the', 'counts', 'of', 'dtypes', 'in', 'this', 'object', '.', 'Returns', ':', 'The', 'counts', 'of', 'dtypes', 'in', 'this', 'object', '.']
train
https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/base.py#L1264-L1274
8,991
mopidy/mopidy-gmusic
mopidy_gmusic/translator.py
track_to_ref
def track_to_ref(track, with_track_no=False): """Convert a mopidy track to a mopidy ref.""" if with_track_no and track.track_no > 0: name = '%d - ' % track.track_no else: name = '' for artist in track.artists: if len(name) > 0: name += ', ' name += artist.name...
python
def track_to_ref(track, with_track_no=False): """Convert a mopidy track to a mopidy ref.""" if with_track_no and track.track_no > 0: name = '%d - ' % track.track_no else: name = '' for artist in track.artists: if len(name) > 0: name += ', ' name += artist.name...
['def', 'track_to_ref', '(', 'track', ',', 'with_track_no', '=', 'False', ')', ':', 'if', 'with_track_no', 'and', 'track', '.', 'track_no', '>', '0', ':', 'name', '=', "'%d - '", '%', 'track', '.', 'track_no', 'else', ':', 'name', '=', "''", 'for', 'artist', 'in', 'track', '.', 'artists', ':', 'if', 'len', '(', 'name',...
Convert a mopidy track to a mopidy ref.
['Convert', 'a', 'mopidy', 'track', 'to', 'a', 'mopidy', 'ref', '.']
train
https://github.com/mopidy/mopidy-gmusic/blob/bbfe876d2a7e4f0f4f9308193bb988936bdfd5c3/mopidy_gmusic/translator.py#L33-L46
8,992
noobermin/lspreader
lspreader/flds.py
getvector
def getvector(d,s): ''' Get a vector flds data. Parameters: ----------- d -- flds data. s -- key for the data. ''' return np.array([d[s+"x"],d[s+"y"],d[s+"z"]]);
python
def getvector(d,s): ''' Get a vector flds data. Parameters: ----------- d -- flds data. s -- key for the data. ''' return np.array([d[s+"x"],d[s+"y"],d[s+"z"]]);
['def', 'getvector', '(', 'd', ',', 's', ')', ':', 'return', 'np', '.', 'array', '(', '[', 'd', '[', 's', '+', '"x"', ']', ',', 'd', '[', 's', '+', '"y"', ']', ',', 'd', '[', 's', '+', '"z"', ']', ']', ')']
Get a vector flds data. Parameters: ----------- d -- flds data. s -- key for the data.
['Get', 'a', 'vector', 'flds', 'data', '.']
train
https://github.com/noobermin/lspreader/blob/903b9d6427513b07986ffacf76cbca54e18d8be6/lspreader/flds.py#L11-L21
8,993
log2timeline/dfvfs
examples/source_analyzer.py
SourceAnalyzer._EncodeString
def _EncodeString(self, string): """Encodes a string in the preferred encoding. Returns: bytes: encoded string. """ try: # Note that encode() will first convert string into a Unicode string # if necessary. encoded_string = string.encode( self._preferred_encoding, error...
python
def _EncodeString(self, string): """Encodes a string in the preferred encoding. Returns: bytes: encoded string. """ try: # Note that encode() will first convert string into a Unicode string # if necessary. encoded_string = string.encode( self._preferred_encoding, error...
['def', '_EncodeString', '(', 'self', ',', 'string', ')', ':', 'try', ':', '# Note that encode() will first convert string into a Unicode string', '# if necessary.', 'encoded_string', '=', 'string', '.', 'encode', '(', 'self', '.', '_preferred_encoding', ',', 'errors', '=', 'self', '.', '_encode_errors', ')', 'except',...
Encodes a string in the preferred encoding. Returns: bytes: encoded string.
['Encodes', 'a', 'string', 'in', 'the', 'preferred', 'encoding', '.']
train
https://github.com/log2timeline/dfvfs/blob/2b3ccd115f9901d89f383397d4a1376a873c83c4/examples/source_analyzer.py#L39-L62
8,994
wummel/linkchecker
third_party/dnspython/dns/rcode.py
to_flags
def to_flags(value): """Return a (flags, ednsflags) tuple which encodes the rcode. @param value: the rcode @type value: int @raises ValueError: rcode is < 0 or > 4095 @rtype: (int, int) tuple """ if value < 0 or value > 4095: raise ValueError('rcode must be >= 0 and <= 4095') v...
python
def to_flags(value): """Return a (flags, ednsflags) tuple which encodes the rcode. @param value: the rcode @type value: int @raises ValueError: rcode is < 0 or > 4095 @rtype: (int, int) tuple """ if value < 0 or value > 4095: raise ValueError('rcode must be >= 0 and <= 4095') v...
['def', 'to_flags', '(', 'value', ')', ':', 'if', 'value', '<', '0', 'or', 'value', '>', '4095', ':', 'raise', 'ValueError', '(', "'rcode must be >= 0 and <= 4095'", ')', 'v', '=', 'value', '&', '0xf', 'ev', '=', 'long', '(', 'value', '&', '0xff0', ')', '<<', '20', 'return', '(', 'v', ',', 'ev', ')']
Return a (flags, ednsflags) tuple which encodes the rcode. @param value: the rcode @type value: int @raises ValueError: rcode is < 0 or > 4095 @rtype: (int, int) tuple
['Return', 'a', '(', 'flags', 'ednsflags', ')', 'tuple', 'which', 'encodes', 'the', 'rcode', '.']
train
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/third_party/dnspython/dns/rcode.py#L93-L106
8,995
scanny/python-pptx
pptx/shapes/freeform.py
FreeformBuilder._add_line_segment
def _add_line_segment(self, x, y): """Add a |_LineSegment| operation to the drawing sequence.""" self._drawing_operations.append(_LineSegment.new(self, x, y))
python
def _add_line_segment(self, x, y): """Add a |_LineSegment| operation to the drawing sequence.""" self._drawing_operations.append(_LineSegment.new(self, x, y))
['def', '_add_line_segment', '(', 'self', ',', 'x', ',', 'y', ')', ':', 'self', '.', '_drawing_operations', '.', 'append', '(', '_LineSegment', '.', 'new', '(', 'self', ',', 'x', ',', 'y', ')', ')']
Add a |_LineSegment| operation to the drawing sequence.
['Add', 'a', '|_LineSegment|', 'operation', 'to', 'the', 'drawing', 'sequence', '.']
train
https://github.com/scanny/python-pptx/blob/d6ab8234f8b03953d2f831ff9394b1852db34130/pptx/shapes/freeform.py#L145-L147
8,996
oasiswork/zimsoap
zimsoap/client.py
ZimbraAdminClient.mk_auth_token
def mk_auth_token(self, account, admin=False, duration=0): """ Builds an authentification token, using preauth mechanism. See http://wiki.zimbra.com/wiki/Preauth :param duration: in seconds defaults to 0, which means "use account default" :param account: an account obje...
python
def mk_auth_token(self, account, admin=False, duration=0): """ Builds an authentification token, using preauth mechanism. See http://wiki.zimbra.com/wiki/Preauth :param duration: in seconds defaults to 0, which means "use account default" :param account: an account obje...
['def', 'mk_auth_token', '(', 'self', ',', 'account', ',', 'admin', '=', 'False', ',', 'duration', '=', '0', ')', ':', 'domain', '=', 'account', '.', 'get_domain', '(', ')', 'try', ':', 'preauth_key', '=', 'self', '.', 'get_domain', '(', 'domain', ')', '[', "'zimbraPreAuthKey'", ']', 'except', 'KeyError', ':', 'raise',...
Builds an authentification token, using preauth mechanism. See http://wiki.zimbra.com/wiki/Preauth :param duration: in seconds defaults to 0, which means "use account default" :param account: an account object to be used as a selector :returns: the auth string
['Builds', 'an', 'authentification', 'token', 'using', 'preauth', 'mechanism', '.']
train
https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/client.py#L1133-L1152
8,997
LogicalDash/LiSE
allegedb/allegedb/window.py
WindowDict.past
def past(self, rev=None): """Return a Mapping of items at or before the given revision. Default revision is the last one looked up. """ if rev is not None: self.seek(rev) return WindowDictPastView(self._past)
python
def past(self, rev=None): """Return a Mapping of items at or before the given revision. Default revision is the last one looked up. """ if rev is not None: self.seek(rev) return WindowDictPastView(self._past)
['def', 'past', '(', 'self', ',', 'rev', '=', 'None', ')', ':', 'if', 'rev', 'is', 'not', 'None', ':', 'self', '.', 'seek', '(', 'rev', ')', 'return', 'WindowDictPastView', '(', 'self', '.', '_past', ')']
Return a Mapping of items at or before the given revision. Default revision is the last one looked up.
['Return', 'a', 'Mapping', 'of', 'items', 'at', 'or', 'before', 'the', 'given', 'revision', '.']
train
https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/window.py#L439-L447
8,998
saltstack/salt
salt/modules/xbpspkg.py
_get_version
def _get_version(): ''' Get the xbps version ''' version_string = __salt__['cmd.run']( [_check_xbps(), '--version'], output_loglevel='trace') if version_string is None: # Dunno why it would, but... return False VERSION_MATCH = re.compile(r'(?:XBPS:[\s]+)([\d.]+)(...
python
def _get_version(): ''' Get the xbps version ''' version_string = __salt__['cmd.run']( [_check_xbps(), '--version'], output_loglevel='trace') if version_string is None: # Dunno why it would, but... return False VERSION_MATCH = re.compile(r'(?:XBPS:[\s]+)([\d.]+)(...
['def', '_get_version', '(', ')', ':', 'version_string', '=', '__salt__', '[', "'cmd.run'", ']', '(', '[', '_check_xbps', '(', ')', ',', "'--version'", ']', ',', 'output_loglevel', '=', "'trace'", ')', 'if', 'version_string', 'is', 'None', ':', '# Dunno why it would, but...', 'return', 'False', 'VERSION_MATCH', '=', 'r...
Get the xbps version
['Get', 'the', 'xbps', 'version']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xbpspkg.py#L51-L67
8,999
inveniosoftware/invenio-oauth2server
invenio_oauth2server/ext.py
verify_oauth_token_and_set_current_user
def verify_oauth_token_and_set_current_user(): """Verify OAuth token and set current user on request stack. This function should be used **only** on REST application. .. code-block:: python app.before_request(verify_oauth_token_and_set_current_user) """ for func in oauth2._before_request_...
python
def verify_oauth_token_and_set_current_user(): """Verify OAuth token and set current user on request stack. This function should be used **only** on REST application. .. code-block:: python app.before_request(verify_oauth_token_and_set_current_user) """ for func in oauth2._before_request_...
['def', 'verify_oauth_token_and_set_current_user', '(', ')', ':', 'for', 'func', 'in', 'oauth2', '.', '_before_request_funcs', ':', 'func', '(', ')', 'if', 'not', 'hasattr', '(', 'request', ',', "'oauth'", ')', 'or', 'not', 'request', '.', 'oauth', ':', 'scopes', '=', '[', ']', 'try', ':', 'valid', ',', 'req', '=', 'oa...
Verify OAuth token and set current user on request stack. This function should be used **only** on REST application. .. code-block:: python app.before_request(verify_oauth_token_and_set_current_user)
['Verify', 'OAuth', 'token', 'and', 'set', 'current', 'user', 'on', 'request', 'stack', '.']
train
https://github.com/inveniosoftware/invenio-oauth2server/blob/7033d3495c1a2b830e101e43918e92a37bbb49f2/invenio_oauth2server/ext.py#L165-L188