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
7,000
opennode/waldur-core
waldur_core/core/tasks.py
BackgroundTask.is_previous_task_processing
def is_previous_task_processing(self, *args, **kwargs): """ Return True if exist task that is equal to current and is uncompleted """ app = self._get_app() inspect = app.control.inspect() active = inspect.active() or {} scheduled = inspect.scheduled() or {} reserved = ins...
python
def is_previous_task_processing(self, *args, **kwargs): """ Return True if exist task that is equal to current and is uncompleted """ app = self._get_app() inspect = app.control.inspect() active = inspect.active() or {} scheduled = inspect.scheduled() or {} reserved = ins...
['def', 'is_previous_task_processing', '(', 'self', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'app', '=', 'self', '.', '_get_app', '(', ')', 'inspect', '=', 'app', '.', 'control', '.', 'inspect', '(', ')', 'active', '=', 'inspect', '.', 'active', '(', ')', 'or', '{', '}', 'scheduled', '=', 'inspect', '.', 's...
Return True if exist task that is equal to current and is uncompleted
['Return', 'True', 'if', 'exist', 'task', 'that', 'is', 'equal', 'to', 'current', 'and', 'is', 'uncompleted']
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/core/tasks.py#L353-L361
7,001
spyder-ide/spyder
spyder/utils/vcs.py
get_hg_revision
def get_hg_revision(repopath): """Return Mercurial revision for the repository located at repopath Result is a tuple (global, local, branch), with None values on error For example: >>> get_hg_revision(".") ('eba7273c69df+', '2015+', 'default') """ try: ass...
python
def get_hg_revision(repopath): """Return Mercurial revision for the repository located at repopath Result is a tuple (global, local, branch), with None values on error For example: >>> get_hg_revision(".") ('eba7273c69df+', '2015+', 'default') """ try: ass...
['def', 'get_hg_revision', '(', 'repopath', ')', ':', 'try', ':', 'assert', 'osp', '.', 'isdir', '(', 'osp', '.', 'join', '(', 'repopath', ',', "'.hg'", ')', ')', 'proc', '=', 'programs', '.', 'run_program', '(', "'hg'", ',', '[', "'id'", ',', "'-nib'", ',', 'repopath', ']', ')', 'output', ',', '_err', '=', 'proc', '.'...
Return Mercurial revision for the repository located at repopath Result is a tuple (global, local, branch), with None values on error For example: >>> get_hg_revision(".") ('eba7273c69df+', '2015+', 'default')
['Return', 'Mercurial', 'revision', 'for', 'the', 'repository', 'located', 'at', 'repopath', 'Result', 'is', 'a', 'tuple', '(', 'global', 'local', 'branch', ')', 'with', 'None', 'values', 'on', 'error', 'For', 'example', ':', '>>>', 'get_hg_revision', '(', '.', ')', '(', 'eba7273c69df', '+', '2015', '+', 'default', ')'...
train
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/vcs.py#L100-L116
7,002
HPENetworking/PYHPEIMC
pyhpeimc/plat/system.py
modify_ssh_template
def modify_ssh_template(auth, url, ssh_template, template_name= None, template_id = None): """ Function takes input of a dictionry containing the required key/value pair for the modification of a ssh template. :param auth: :param url: :param ssh_template: Human readable label which is the name ...
python
def modify_ssh_template(auth, url, ssh_template, template_name= None, template_id = None): """ Function takes input of a dictionry containing the required key/value pair for the modification of a ssh template. :param auth: :param url: :param ssh_template: Human readable label which is the name ...
['def', 'modify_ssh_template', '(', 'auth', ',', 'url', ',', 'ssh_template', ',', 'template_name', '=', 'None', ',', 'template_id', '=', 'None', ')', ':', 'if', 'template_name', 'is', 'None', ':', 'template_name', '=', 'ssh_template', '[', "'name'", ']', 'if', 'template_id', 'is', 'None', ':', 'ssh_templates', '=', 'ge...
Function takes input of a dictionry containing the required key/value pair for the modification of a ssh template. :param auth: :param url: :param ssh_template: Human readable label which is the name of the specific ssh template :param template_id Internal IMC number which designates the specific s...
['Function', 'takes', 'input', 'of', 'a', 'dictionry', 'containing', 'the', 'required', 'key', '/', 'value', 'pair', 'for', 'the', 'modification', 'of', 'a', 'ssh', 'template', '.']
train
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/system.py#L397-L439
7,003
CodeReclaimers/neat-python
examples/xor/evolve-feedforward-threaded.py
run
def run(config_file): """load the config, create a population, evolve and show the result""" # Load configuration. config = neat.Config(neat.DefaultGenome, neat.DefaultReproduction, neat.DefaultSpeciesSet, neat.DefaultStagnation, config_file) # Create the population, which is the top-level object for...
python
def run(config_file): """load the config, create a population, evolve and show the result""" # Load configuration. config = neat.Config(neat.DefaultGenome, neat.DefaultReproduction, neat.DefaultSpeciesSet, neat.DefaultStagnation, config_file) # Create the population, which is the top-level object for...
['def', 'run', '(', 'config_file', ')', ':', '# Load configuration.', 'config', '=', 'neat', '.', 'Config', '(', 'neat', '.', 'DefaultGenome', ',', 'neat', '.', 'DefaultReproduction', ',', 'neat', '.', 'DefaultSpeciesSet', ',', 'neat', '.', 'DefaultStagnation', ',', 'config_file', ')', '# Create the population, which i...
load the config, create a population, evolve and show the result
['load', 'the', 'config', 'create', 'a', 'population', 'evolve', 'and', 'show', 'the', 'result']
train
https://github.com/CodeReclaimers/neat-python/blob/e3dbe77c0d776eae41d598e6439e6ac02ab90b18/examples/xor/evolve-feedforward-threaded.py#L49-L85
7,004
onnx/onnxmltools
onnxmltools/convert/coreml/shape_calculators/TensorToLabel.py
calculte_tensor_to_label_output_shapes
def calculte_tensor_to_label_output_shapes(operator): ''' Allowed input/output patterns are 1. [N, C] ---> [N, 1] Note that N must be 1 currently because TensorToProbability doesn't support batch size larger than 1. ''' check_input_and_output_numbers(operator, input_count_range=1, output_co...
python
def calculte_tensor_to_label_output_shapes(operator): ''' Allowed input/output patterns are 1. [N, C] ---> [N, 1] Note that N must be 1 currently because TensorToProbability doesn't support batch size larger than 1. ''' check_input_and_output_numbers(operator, input_count_range=1, output_co...
['def', 'calculte_tensor_to_label_output_shapes', '(', 'operator', ')', ':', 'check_input_and_output_numbers', '(', 'operator', ',', 'input_count_range', '=', '1', ',', 'output_count_range', '=', '1', ')', 'check_input_and_output_types', '(', 'operator', ',', 'good_input_types', '=', '[', 'FloatTensorType', ']', ')', '...
Allowed input/output patterns are 1. [N, C] ---> [N, 1] Note that N must be 1 currently because TensorToProbability doesn't support batch size larger than 1.
['Allowed', 'input', '/', 'output', 'patterns', 'are', '1', '.', '[', 'N', 'C', ']', '---', '>', '[', 'N', '1', ']']
train
https://github.com/onnx/onnxmltools/blob/d4e4c31990fc2d9fd1f92139f497d360914c9df2/onnxmltools/convert/coreml/shape_calculators/TensorToLabel.py#L12-L33
7,005
dddomodossola/remi
remi/gui.py
SvgShape.set_position
def set_position(self, x, y): """Sets the shape position. Args: x (int): the x coordinate y (int): the y coordinate """ self.attributes['x'] = str(x) self.attributes['y'] = str(y)
python
def set_position(self, x, y): """Sets the shape position. Args: x (int): the x coordinate y (int): the y coordinate """ self.attributes['x'] = str(x) self.attributes['y'] = str(y)
['def', 'set_position', '(', 'self', ',', 'x', ',', 'y', ')', ':', 'self', '.', 'attributes', '[', "'x'", ']', '=', 'str', '(', 'x', ')', 'self', '.', 'attributes', '[', "'y'", ']', '=', 'str', '(', 'y', ')']
Sets the shape position. Args: x (int): the x coordinate y (int): the y coordinate
['Sets', 'the', 'shape', 'position', '.']
train
https://github.com/dddomodossola/remi/blob/85206f62220662bb7ecd471042268def71ccad28/remi/gui.py#L3423-L3431
7,006
rfosterslo/wagtailplus
wagtailplus/utils/views/chooser.py
ChooserView.get_form_kwargs
def get_form_kwargs(self): """ Returns the keyword arguments for instantiating the form. :rtype: dict. """ kwargs = { 'initial': self.get_initial(), 'prefix': self.get_prefix(), } #noinspection PyUnresolvedReferences if self.re...
python
def get_form_kwargs(self): """ Returns the keyword arguments for instantiating the form. :rtype: dict. """ kwargs = { 'initial': self.get_initial(), 'prefix': self.get_prefix(), } #noinspection PyUnresolvedReferences if self.re...
['def', 'get_form_kwargs', '(', 'self', ')', ':', 'kwargs', '=', '{', "'initial'", ':', 'self', '.', 'get_initial', '(', ')', ',', "'prefix'", ':', 'self', '.', 'get_prefix', '(', ')', ',', '}', '#noinspection PyUnresolvedReferences', 'if', 'self', '.', 'request', '.', 'method', 'in', '(', "'POST'", ',', "'PUT'", ')', ...
Returns the keyword arguments for instantiating the form. :rtype: dict.
['Returns', 'the', 'keyword', 'arguments', 'for', 'instantiating', 'the', 'form', '.']
train
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/utils/views/chooser.py#L106-L128
7,007
rstoneback/pysat
pysat/_instrument.py
Instrument.download
def download(self, start, stop, freq='D', user=None, password=None, **kwargs): """Download data for given Instrument object from start to stop. Parameters ---------- start : pandas.datetime start date to download data stop : pandas.datetime ...
python
def download(self, start, stop, freq='D', user=None, password=None, **kwargs): """Download data for given Instrument object from start to stop. Parameters ---------- start : pandas.datetime start date to download data stop : pandas.datetime ...
['def', 'download', '(', 'self', ',', 'start', ',', 'stop', ',', 'freq', '=', "'D'", ',', 'user', '=', 'None', ',', 'password', '=', 'None', ',', '*', '*', 'kwargs', ')', ':', 'import', 'errno', '# make sure directories are there, otherwise create them', 'try', ':', 'os', '.', 'makedirs', '(', 'self', '.', 'files', '.'...
Download data for given Instrument object from start to stop. Parameters ---------- start : pandas.datetime start date to download data stop : pandas.datetime stop date to download data freq : string Stepsize between dates for season, ...
['Download', 'data', 'for', 'given', 'Instrument', 'object', 'from', 'start', 'to', 'stop', '.', 'Parameters', '----------', 'start', ':', 'pandas', '.', 'datetime', 'start', 'date', 'to', 'download', 'data', 'stop', ':', 'pandas', '.', 'datetime', 'stop', 'date', 'to', 'download', 'data', 'freq', ':', 'string', 'Steps...
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L918-L980
7,008
argaen/python-google-distance-matrix
google_distance_matrix/core.py
DM.__get_response_element_data
def __get_response_element_data(self, key1, key2): """ For each origin an elements object is created in the ouput. For each destination, an object is created inside elements object. For example, if there are 2 origins and 1 destination, 2 element objects with 1 object each are created. I...
python
def __get_response_element_data(self, key1, key2): """ For each origin an elements object is created in the ouput. For each destination, an object is created inside elements object. For example, if there are 2 origins and 1 destination, 2 element objects with 1 object each are created. I...
['def', '__get_response_element_data', '(', 'self', ',', 'key1', ',', 'key2', ')', ':', 'if', 'not', 'self', '.', 'dict_response', '[', 'key1', ']', '[', 'key2', ']', ':', 'l', '=', 'self', '.', 'response', 'for', 'i', ',', 'orig', 'in', 'enumerate', '(', 'self', '.', 'origins', ')', ':', 'self', '.', 'dict_response', ...
For each origin an elements object is created in the ouput. For each destination, an object is created inside elements object. For example, if there are 2 origins and 1 destination, 2 element objects with 1 object each are created. If there are 2 origins and 2 destinations, 2 element objects wit...
['For', 'each', 'origin', 'an', 'elements', 'object', 'is', 'created', 'in', 'the', 'ouput', '.', 'For', 'each', 'destination', 'an', 'object', 'is', 'created', 'inside', 'elements', 'object', '.', 'For', 'example', 'if', 'there', 'are', '2', 'origins', 'and', '1', 'destination', '2', 'element', 'objects', 'with', '1',...
train
https://github.com/argaen/python-google-distance-matrix/blob/20c07bf7d560180ef380b3148616f67f55246a5c/google_distance_matrix/core.py#L69-L86
7,009
klen/graphite-beacon
graphite_beacon/alerts.py
BaseAlert.evaluate_rule
def evaluate_rule(self, rule, value, target): """Calculate the value.""" def evaluate(expr): if expr in LOGICAL_OPERATORS.values(): return expr rvalue = self.get_value_for_expr(expr, target) if rvalue is None: return False # ignore thi...
python
def evaluate_rule(self, rule, value, target): """Calculate the value.""" def evaluate(expr): if expr in LOGICAL_OPERATORS.values(): return expr rvalue = self.get_value_for_expr(expr, target) if rvalue is None: return False # ignore thi...
['def', 'evaluate_rule', '(', 'self', ',', 'rule', ',', 'value', ',', 'target', ')', ':', 'def', 'evaluate', '(', 'expr', ')', ':', 'if', 'expr', 'in', 'LOGICAL_OPERATORS', '.', 'values', '(', ')', ':', 'return', 'expr', 'rvalue', '=', 'self', '.', 'get_value_for_expr', '(', 'expr', ',', 'target', ')', 'if', 'rvalue', ...
Calculate the value.
['Calculate', 'the', 'value', '.']
train
https://github.com/klen/graphite-beacon/blob/c1f071e9f557693bc90f6acbc314994985dc3b77/graphite_beacon/alerts.py#L184-L199
7,010
winstonwolff/expectorant
expectorant/runner.py
find_files
def find_files(args): ''' Return list of spec files. `args` may be filenames which are passed right through, or directories in which case they are searched recursively for *._spec.py ''' files_or_dirs = args or ['.'] filenames = [] for f in files_or_dirs: if path.isdir(f): ...
python
def find_files(args): ''' Return list of spec files. `args` may be filenames which are passed right through, or directories in which case they are searched recursively for *._spec.py ''' files_or_dirs = args or ['.'] filenames = [] for f in files_or_dirs: if path.isdir(f): ...
['def', 'find_files', '(', 'args', ')', ':', 'files_or_dirs', '=', 'args', 'or', '[', "'.'", ']', 'filenames', '=', '[', ']', 'for', 'f', 'in', 'files_or_dirs', ':', 'if', 'path', '.', 'isdir', '(', 'f', ')', ':', 'filenames', '.', 'extend', '(', 'glob', '.', 'glob', '(', 'path', '.', 'join', '(', 'f', ',', "'**'", ','...
Return list of spec files. `args` may be filenames which are passed right through, or directories in which case they are searched recursively for *._spec.py
['Return', 'list', 'of', 'spec', 'files', '.', 'args', 'may', 'be', 'filenames', 'which', 'are', 'passed', 'right', 'through', 'or', 'directories', 'in', 'which', 'case', 'they', 'are', 'searched', 'recursively', 'for', '*', '.', '_spec', '.', 'py']
train
https://github.com/winstonwolff/expectorant/blob/cb9e4c1656d7c1f4394f0b0fbeb968a833030031/expectorant/runner.py#L17-L32
7,011
leancloud/python-sdk
leancloud/conversation.py
Conversation.send
def send(self, from_client, message, to_clients=None, transient=False, push_data=None): """ 在指定会话中发送消息。 :param from_client: 发送者 id :param message: 消息内容 :param to_clients: 接受者 id,只在系统会话中生效 :param transient: 是否以暂态形式发送消息 :param push_data: 推送消息内容,参考:https://url.leana...
python
def send(self, from_client, message, to_clients=None, transient=False, push_data=None): """ 在指定会话中发送消息。 :param from_client: 发送者 id :param message: 消息内容 :param to_clients: 接受者 id,只在系统会话中生效 :param transient: 是否以暂态形式发送消息 :param push_data: 推送消息内容,参考:https://url.leana...
['def', 'send', '(', 'self', ',', 'from_client', ',', 'message', ',', 'to_clients', '=', 'None', ',', 'transient', '=', 'False', ',', 'push_data', '=', 'None', ')', ':', 'if', 'isinstance', '(', 'message', ',', 'dict', ')', ':', 'message', '=', 'json', '.', 'dumps', '(', 'message', ')', 'params', '=', '{', "'from_peer'...
在指定会话中发送消息。 :param from_client: 发送者 id :param message: 消息内容 :param to_clients: 接受者 id,只在系统会话中生效 :param transient: 是否以暂态形式发送消息 :param push_data: 推送消息内容,参考:https://url.leanapp.cn/pushData
['在指定会话中发送消息。']
train
https://github.com/leancloud/python-sdk/blob/fea3240257ce65e6a32c7312a5cee1f94a51a587/leancloud/conversation.py#L91-L113
7,012
dropbox/stone
example/backend/ex1/ex1.stoneg.py
ExampleBackend.generate
def generate(self, api): """Generates a file that lists each namespace.""" with self.output_to_relative_path('ex1.out'): for namespace in api.namespaces.values(): self.emit(namespace.name)
python
def generate(self, api): """Generates a file that lists each namespace.""" with self.output_to_relative_path('ex1.out'): for namespace in api.namespaces.values(): self.emit(namespace.name)
['def', 'generate', '(', 'self', ',', 'api', ')', ':', 'with', 'self', '.', 'output_to_relative_path', '(', "'ex1.out'", ')', ':', 'for', 'namespace', 'in', 'api', '.', 'namespaces', '.', 'values', '(', ')', ':', 'self', '.', 'emit', '(', 'namespace', '.', 'name', ')']
Generates a file that lists each namespace.
['Generates', 'a', 'file', 'that', 'lists', 'each', 'namespace', '.']
train
https://github.com/dropbox/stone/blob/2e95cbcd1c48e05cca68c919fd8d24adec6b0f58/example/backend/ex1/ex1.stoneg.py#L5-L9
7,013
python-cas/python-cas
cas.py
CASClientV1.verify_ticket
def verify_ticket(self, ticket): """Verifies CAS 1.0 authentication ticket. Returns username on success and None on failure. """ params = [('ticket', ticket), ('service', self.service_url)] url = (urllib_parse.urljoin(self.server_url, 'validate') + '?' + urllib_pa...
python
def verify_ticket(self, ticket): """Verifies CAS 1.0 authentication ticket. Returns username on success and None on failure. """ params = [('ticket', ticket), ('service', self.service_url)] url = (urllib_parse.urljoin(self.server_url, 'validate') + '?' + urllib_pa...
['def', 'verify_ticket', '(', 'self', ',', 'ticket', ')', ':', 'params', '=', '[', '(', "'ticket'", ',', 'ticket', ')', ',', '(', "'service'", ',', 'self', '.', 'service_url', ')', ']', 'url', '=', '(', 'urllib_parse', '.', 'urljoin', '(', 'self', '.', 'server_url', ',', "'validate'", ')', '+', "'?'", '+', 'urllib_pars...
Verifies CAS 1.0 authentication ticket. Returns username on success and None on failure.
['Verifies', 'CAS', '1', '.', '0', 'authentication', 'ticket', '.']
train
https://github.com/python-cas/python-cas/blob/42fc76fbd2e50f167e752eba4bf5b0df74a83978/cas.py#L128-L149
7,014
sendgrid/sendgrid-python
sendgrid/helpers/mail/section.py
Section.get
def get(self): """ Get a JSON-ready representation of this Section. :returns: This Section, ready for use in a request body. :rtype: dict """ section = {} if self.key is not None and self.value is not None: section[self.key] = self.value retur...
python
def get(self): """ Get a JSON-ready representation of this Section. :returns: This Section, ready for use in a request body. :rtype: dict """ section = {} if self.key is not None and self.value is not None: section[self.key] = self.value retur...
['def', 'get', '(', 'self', ')', ':', 'section', '=', '{', '}', 'if', 'self', '.', 'key', 'is', 'not', 'None', 'and', 'self', '.', 'value', 'is', 'not', 'None', ':', 'section', '[', 'self', '.', 'key', ']', '=', 'self', '.', 'value', 'return', 'section']
Get a JSON-ready representation of this Section. :returns: This Section, ready for use in a request body. :rtype: dict
['Get', 'a', 'JSON', '-', 'ready', 'representation', 'of', 'this', 'Section', '.']
train
https://github.com/sendgrid/sendgrid-python/blob/266c2abde7a35dfcce263e06bedc6a0bbdebeac9/sendgrid/helpers/mail/section.py#L54-L64
7,015
tensorflow/mesh
mesh_tensorflow/ops.py
cwise
def cwise(tf_fn, xs, output_dtype=None, grad_function=None, name=None): """Component-wise operation with no broadcasting. Args: tf_fn: a component-wise function taking n tf.Tensor inputs and producing a tf.Tensor output xs: n Tensors output_dtype: an optional dtype grad_function: an optional ...
python
def cwise(tf_fn, xs, output_dtype=None, grad_function=None, name=None): """Component-wise operation with no broadcasting. Args: tf_fn: a component-wise function taking n tf.Tensor inputs and producing a tf.Tensor output xs: n Tensors output_dtype: an optional dtype grad_function: an optional ...
['def', 'cwise', '(', 'tf_fn', ',', 'xs', ',', 'output_dtype', '=', 'None', ',', 'grad_function', '=', 'None', ',', 'name', '=', 'None', ')', ':', 'return', 'slicewise', '(', 'tf_fn', ',', 'xs', ',', 'output_dtype', '=', 'output_dtype', ',', 'splittable_dims', '=', 'xs', '[', '0', ']', '.', 'shape', '.', 'dims', ',', '...
Component-wise operation with no broadcasting. Args: tf_fn: a component-wise function taking n tf.Tensor inputs and producing a tf.Tensor output xs: n Tensors output_dtype: an optional dtype grad_function: an optional python function name: an optional string Returns: a Tensor
['Component', '-', 'wise', 'operation', 'with', 'no', 'broadcasting', '.']
train
https://github.com/tensorflow/mesh/blob/3921196e5e43302e820da0a87329f25d7e2a3016/mesh_tensorflow/ops.py#L1608-L1624
7,016
openstack/proliantutils
proliantutils/redfish/resources/update_service.py
HPEUpdateService.wait_for_redfish_firmware_update_to_complete
def wait_for_redfish_firmware_update_to_complete(self, redfish_object): """Continuously polls for iLO firmware update to complete. :param redfish_object: redfish instance """ p_state = ['Idle'] c_state = ['Idle'] def has_firmware_flash_completed(): """Checks...
python
def wait_for_redfish_firmware_update_to_complete(self, redfish_object): """Continuously polls for iLO firmware update to complete. :param redfish_object: redfish instance """ p_state = ['Idle'] c_state = ['Idle'] def has_firmware_flash_completed(): """Checks...
['def', 'wait_for_redfish_firmware_update_to_complete', '(', 'self', ',', 'redfish_object', ')', ':', 'p_state', '=', '[', "'Idle'", ']', 'c_state', '=', '[', "'Idle'", ']', 'def', 'has_firmware_flash_completed', '(', ')', ':', '"""Checks for completion status of firmware update operation\n\n The below table...
Continuously polls for iLO firmware update to complete. :param redfish_object: redfish instance
['Continuously', 'polls', 'for', 'iLO', 'firmware', 'update', 'to', 'complete', '.']
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/update_service.py#L97-L139
7,017
Cue/scales
src/greplin/scales/__init__.py
StateTimeStatDict.incr
def incr(self, item, value): """Increment a key by the given amount.""" if item in self: old = UserDict.__getitem__(self, item) else: old = 0.0 self[item] = old + value
python
def incr(self, item, value): """Increment a key by the given amount.""" if item in self: old = UserDict.__getitem__(self, item) else: old = 0.0 self[item] = old + value
['def', 'incr', '(', 'self', ',', 'item', ',', 'value', ')', ':', 'if', 'item', 'in', 'self', ':', 'old', '=', 'UserDict', '.', '__getitem__', '(', 'self', ',', 'item', ')', 'else', ':', 'old', '=', '0.0', 'self', '[', 'item', ']', '=', 'old', '+', 'value']
Increment a key by the given amount.
['Increment', 'a', 'key', 'by', 'the', 'given', 'amount', '.']
train
https://github.com/Cue/scales/blob/0aced26eb050ceb98ee9d5d6cdca8db448666986/src/greplin/scales/__init__.py#L617-L623
7,018
MIT-LCP/wfdb-python
wfdb/io/record.py
BaseRecord.check_field
def check_field(self, field, required_channels='all'): """ Check whether a single field is valid in its basic form. Does not check compatibility with other fields. Parameters ---------- field : str The field name required_channels : list, optional ...
python
def check_field(self, field, required_channels='all'): """ Check whether a single field is valid in its basic form. Does not check compatibility with other fields. Parameters ---------- field : str The field name required_channels : list, optional ...
['def', 'check_field', '(', 'self', ',', 'field', ',', 'required_channels', '=', "'all'", ')', ':', 'item', '=', 'getattr', '(', 'self', ',', 'field', ')', 'if', 'item', 'is', 'None', ':', 'raise', 'Exception', '(', "'Missing field required: %s'", '%', 'field', ')', '# We should have a list specifying these automatical...
Check whether a single field is valid in its basic form. Does not check compatibility with other fields. Parameters ---------- field : str The field name required_channels : list, optional Used for signal specification fields. All channels are ...
['Check', 'whether', 'a', 'single', 'field', 'is', 'valid', 'in', 'its', 'basic', 'form', '.', 'Does', 'not', 'check', 'compatibility', 'with', 'other', 'fields', '.']
train
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/io/record.py#L35-L186
7,019
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py
FabricBase._create_os_nwk
def _create_os_nwk(self, tenant_id, tenant_name, direc, is_fw_virt=False): """Function to create Openstack network. This function does the following: 1. Allocate an IP address with the net_id/subnet_id not filled in the DB. 2. Fill network parameters w/o vlan, segmentation_id...
python
def _create_os_nwk(self, tenant_id, tenant_name, direc, is_fw_virt=False): """Function to create Openstack network. This function does the following: 1. Allocate an IP address with the net_id/subnet_id not filled in the DB. 2. Fill network parameters w/o vlan, segmentation_id...
['def', '_create_os_nwk', '(', 'self', ',', 'tenant_id', ',', 'tenant_name', ',', 'direc', ',', 'is_fw_virt', '=', 'False', ')', ':', 'subnet', '=', 'self', '.', 'alloc_retrieve_subnet_info', '(', 'tenant_id', ',', 'direc', ')', 'network', '=', 'self', '.', 'retrieve_network_info', '(', 'tenant_id', ',', 'direc', ')', ...
Function to create Openstack network. This function does the following: 1. Allocate an IP address with the net_id/subnet_id not filled in the DB. 2. Fill network parameters w/o vlan, segmentation_id, because we don't have net_id to store in DB. 3. Create a Openstac...
['Function', 'to', 'create', 'Openstack', 'network', '.']
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L1021-L1045
7,020
saltstack/salt
salt/modules/at.py
atq
def atq(tag=None): ''' List all queued and running jobs or only those with an optional 'tag'. CLI Example: .. code-block:: bash salt '*' at.atq salt '*' at.atq [tag] salt '*' at.atq [job number] ''' jobs = [] # Shim to produce output similar to what __virtual_...
python
def atq(tag=None): ''' List all queued and running jobs or only those with an optional 'tag'. CLI Example: .. code-block:: bash salt '*' at.atq salt '*' at.atq [tag] salt '*' at.atq [job number] ''' jobs = [] # Shim to produce output similar to what __virtual_...
['def', 'atq', '(', 'tag', '=', 'None', ')', ':', 'jobs', '=', '[', ']', '# Shim to produce output similar to what __virtual__() should do', "# but __salt__ isn't available in __virtual__()", '# Tested on CentOS 5.8', 'if', '__grains__', '[', "'os_family'", ']', '==', "'RedHat'", ':', 'output', '=', '_cmd', '(', "'at'"...
List all queued and running jobs or only those with an optional 'tag'. CLI Example: .. code-block:: bash salt '*' at.atq salt '*' at.atq [tag] salt '*' at.atq [job number]
['List', 'all', 'queued', 'and', 'running', 'jobs', 'or', 'only', 'those', 'with', 'an', 'optional', 'tag', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/at.py#L63-L163
7,021
gabstopper/smc-python
smc/elements/netlink.py
StaticNetlink.update_or_create
def update_or_create(cls, with_status=False, **kwargs): """ Update or create static netlink. DNS entry differences are not resolved, instead any entries provided will be the final state for this netlink. If the intent is to add/remove DNS entries you can use the :meth:`~domain_se...
python
def update_or_create(cls, with_status=False, **kwargs): """ Update or create static netlink. DNS entry differences are not resolved, instead any entries provided will be the final state for this netlink. If the intent is to add/remove DNS entries you can use the :meth:`~domain_se...
['def', 'update_or_create', '(', 'cls', ',', 'with_status', '=', 'False', ',', '*', '*', 'kwargs', ')', ':', 'dns_address', '=', 'kwargs', '.', 'pop', '(', "'domain_server_address'", ',', '[', ']', ')', 'element', ',', 'updated', ',', 'created', '=', 'super', '(', 'StaticNetlink', ',', 'cls', ')', '.', 'update_or_creat...
Update or create static netlink. DNS entry differences are not resolved, instead any entries provided will be the final state for this netlink. If the intent is to add/remove DNS entries you can use the :meth:`~domain_server_address` method to add or remove. :raises Crea...
['Update', 'or', 'create', 'static', 'netlink', '.', 'DNS', 'entry', 'differences', 'are', 'not', 'resolved', 'instead', 'any', 'entries', 'provided', 'will', 'be', 'the', 'final', 'state', 'for', 'this', 'netlink', '.', 'If', 'the', 'intent', 'is', 'to', 'add', '/', 'remove', 'DNS', 'entries', 'you', 'can', 'use', 'th...
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/netlink.py#L152-L176
7,022
quiltdata/quilt
compiler/quilt/tools/store.py
PackageStore.user_path
def user_path(self, team, user): """ Returns the path to directory with the user's package repositories. """ return os.path.join(self.team_path(team), user)
python
def user_path(self, team, user): """ Returns the path to directory with the user's package repositories. """ return os.path.join(self.team_path(team), user)
['def', 'user_path', '(', 'self', ',', 'team', ',', 'user', ')', ':', 'return', 'os', '.', 'path', '.', 'join', '(', 'self', '.', 'team_path', '(', 'team', ')', ',', 'user', ')']
Returns the path to directory with the user's package repositories.
['Returns', 'the', 'path', 'to', 'directory', 'with', 'the', 'user', 's', 'package', 'repositories', '.']
train
https://github.com/quiltdata/quilt/blob/651853e7e89a8af86e0ff26167e752efa5878c12/compiler/quilt/tools/store.py#L335-L339
7,023
ryukinix/decorating
decorating/animation.py
AnimatedDecorator.auto_message
def auto_message(self, args): """Try guess the message by the args passed args: a set of args passed on the wrapper __call__ in the definition above. if the object already have some message (defined in __init__), we don't change that. If the first arg is a function, so is...
python
def auto_message(self, args): """Try guess the message by the args passed args: a set of args passed on the wrapper __call__ in the definition above. if the object already have some message (defined in __init__), we don't change that. If the first arg is a function, so is...
['def', 'auto_message', '(', 'self', ',', 'args', ')', ':', 'if', 'any', '(', 'args', ')', 'and', 'callable', '(', 'args', '[', '0', ']', ')', 'and', 'not', 'self', '.', 'message', ':', 'return', 'args', '[', '0', ']', '.', '__name__', 'elif', 'not', 'self', '.', 'message', ':', 'return', 'self', '.', 'default_message'...
Try guess the message by the args passed args: a set of args passed on the wrapper __call__ in the definition above. if the object already have some message (defined in __init__), we don't change that. If the first arg is a function, so is decorated without argument, use ...
['Try', 'guess', 'the', 'message', 'by', 'the', 'args', 'passed']
train
https://github.com/ryukinix/decorating/blob/df78c3f87800205701704c0bc0fb9b6bb908ba7e/decorating/animation.py#L296-L315
7,024
gabstopper/smc-python
smc/core/engine_vss.py
VSSContainer.add_context
def add_context(self, isc_name, isc_policy_id, isc_traffic_tag): """ Create the VSS Context within the VSSContainer :param str isc_name: ISC name, possibly append policy name?? :param str isc_policy_id: Policy ID in SMC (the 'key' attribute) :param str isc_traffic_tag: NSX group...
python
def add_context(self, isc_name, isc_policy_id, isc_traffic_tag): """ Create the VSS Context within the VSSContainer :param str isc_name: ISC name, possibly append policy name?? :param str isc_policy_id: Policy ID in SMC (the 'key' attribute) :param str isc_traffic_tag: NSX group...
['def', 'add_context', '(', 'self', ',', 'isc_name', ',', 'isc_policy_id', ',', 'isc_traffic_tag', ')', ':', 'if', "'add_context'", 'in', 'self', '.', 'data', '.', 'links', ':', '# SMC >=6.5', 'element', '=', 'ElementCreator', '(', 'VSSContext', ',', 'href', '=', 'self', '.', 'get_relation', '(', "'add_context'", ')', ...
Create the VSS Context within the VSSContainer :param str isc_name: ISC name, possibly append policy name?? :param str isc_policy_id: Policy ID in SMC (the 'key' attribute) :param str isc_traffic_tag: NSX groupId (serviceprofile-145) :raises CreateElementFailed: failed to create ...
['Create', 'the', 'VSS', 'Context', 'within', 'the', 'VSSContainer']
train
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine_vss.py#L135-L167
7,025
gawel/irc3
irc3/__init__.py
IrcBot.dcc_accept
def dcc_accept(self, mask, filepath, port, pos): """accept a DCC RESUME for an axisting DCC SEND. filepath is the filename to sent. port is the port opened on the server. pos is the expected offset""" return self.dcc.resume(mask, filepath, port, pos)
python
def dcc_accept(self, mask, filepath, port, pos): """accept a DCC RESUME for an axisting DCC SEND. filepath is the filename to sent. port is the port opened on the server. pos is the expected offset""" return self.dcc.resume(mask, filepath, port, pos)
['def', 'dcc_accept', '(', 'self', ',', 'mask', ',', 'filepath', ',', 'port', ',', 'pos', ')', ':', 'return', 'self', '.', 'dcc', '.', 'resume', '(', 'mask', ',', 'filepath', ',', 'port', ',', 'pos', ')']
accept a DCC RESUME for an axisting DCC SEND. filepath is the filename to sent. port is the port opened on the server. pos is the expected offset
['accept', 'a', 'DCC', 'RESUME', 'for', 'an', 'axisting', 'DCC', 'SEND', '.', 'filepath', 'is', 'the', 'filename', 'to', 'sent', '.', 'port', 'is', 'the', 'port', 'opened', 'on', 'the', 'server', '.', 'pos', 'is', 'the', 'expected', 'offset']
train
https://github.com/gawel/irc3/blob/cd27840a5809a1f803dc620860fe75d83d2a2ec8/irc3/__init__.py#L387-L391
7,026
materialsproject/pymatgen
pymatgen/analysis/defects/corrections.py
FreysoldtCorrection.get_correction
def get_correction(self, entry): """ Gets the Freysoldt correction for a defect entry Args: entry (DefectEntry): defect entry to compute Freysoldt correction on. Requires following parameters in the DefectEntry to exist: axis_grid (3 x NGX where N...
python
def get_correction(self, entry): """ Gets the Freysoldt correction for a defect entry Args: entry (DefectEntry): defect entry to compute Freysoldt correction on. Requires following parameters in the DefectEntry to exist: axis_grid (3 x NGX where N...
['def', 'get_correction', '(', 'self', ',', 'entry', ')', ':', 'if', 'not', 'self', '.', 'axis', ':', 'list_axis_grid', '=', 'np', '.', 'array', '(', 'entry', '.', 'parameters', '[', '"axis_grid"', ']', ')', 'list_bulk_plnr_avg_esp', '=', 'np', '.', 'array', '(', 'entry', '.', 'parameters', '[', '"bulk_planar_averages"...
Gets the Freysoldt correction for a defect entry Args: entry (DefectEntry): defect entry to compute Freysoldt correction on. Requires following parameters in the DefectEntry to exist: axis_grid (3 x NGX where NGX is the length of the NGX grid ...
['Gets', 'the', 'Freysoldt', 'correction', 'for', 'a', 'defect', 'entry', 'Args', ':', 'entry', '(', 'DefectEntry', ')', ':', 'defect', 'entry', 'to', 'compute', 'Freysoldt', 'correction', 'on', '.', 'Requires', 'following', 'parameters', 'in', 'the', 'DefectEntry', 'to', 'exist', ':']
train
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/corrections.py#L56-L121
7,027
wummel/linkchecker
linkcheck/logger/html.py
HtmlLogger.write_outro
def write_outro (self): """Write end of check message.""" self.writeln(u"<br/>") self.write(_("That's it.")+" ") if self.stats.number >= 0: self.write(_n("%d link checked.", "%d links checked.", self.stats.number) % self.stats.number) self.w...
python
def write_outro (self): """Write end of check message.""" self.writeln(u"<br/>") self.write(_("That's it.")+" ") if self.stats.number >= 0: self.write(_n("%d link checked.", "%d links checked.", self.stats.number) % self.stats.number) self.w...
['def', 'write_outro', '(', 'self', ')', ':', 'self', '.', 'writeln', '(', 'u"<br/>"', ')', 'self', '.', 'write', '(', '_', '(', '"That\'s it."', ')', '+', '" "', ')', 'if', 'self', '.', 'stats', '.', 'number', '>=', '0', ':', 'self', '.', 'write', '(', '_n', '(', '"%d link checked."', ',', '"%d links checked."', ',', ...
Write end of check message.
['Write', 'end', 'of', 'check', 'message', '.']
train
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/logger/html.py#L287-L329
7,028
google/grr
grr/server/grr_response_server/databases/mysql_paths.py
MySQLDBPathMixin.ReadPathInfos
def ReadPathInfos(self, client_id, path_type, components_list, cursor=None): """Retrieves path info records for given paths.""" if not components_list: return {} path_ids = list(map(rdf_objects.PathID.FromComponents, components_list)) path_infos = {components: None for components in components_...
python
def ReadPathInfos(self, client_id, path_type, components_list, cursor=None): """Retrieves path info records for given paths.""" if not components_list: return {} path_ids = list(map(rdf_objects.PathID.FromComponents, components_list)) path_infos = {components: None for components in components_...
['def', 'ReadPathInfos', '(', 'self', ',', 'client_id', ',', 'path_type', ',', 'components_list', ',', 'cursor', '=', 'None', ')', ':', 'if', 'not', 'components_list', ':', 'return', '{', '}', 'path_ids', '=', 'list', '(', 'map', '(', 'rdf_objects', '.', 'PathID', '.', 'FromComponents', ',', 'components_list', ')', ')'...
Retrieves path info records for given paths.
['Retrieves', 'path', 'info', 'records', 'for', 'given', 'paths', '.']
train
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_paths.py#L116-L184
7,029
polyaxon/polyaxon
polyaxon/scheduler/spawners/templates/jobs/manager.py
ResourceManager.get_init_container
def get_init_container(self, init_command, init_args, env_vars, context_mounts, persistence_outputs, persistence_data): """Pod init container for sett...
python
def get_init_container(self, init_command, init_args, env_vars, context_mounts, persistence_outputs, persistence_data): """Pod init container for sett...
['def', 'get_init_container', '(', 'self', ',', 'init_command', ',', 'init_args', ',', 'env_vars', ',', 'context_mounts', ',', 'persistence_outputs', ',', 'persistence_data', ')', ':', 'env_vars', '=', 'to_list', '(', 'env_vars', ',', 'check_none', '=', 'True', ')', 'outputs_path', '=', 'stores', '.', 'get_job_outputs_...
Pod init container for setting outputs path.
['Pod', 'init', 'container', 'for', 'setting', 'outputs', 'path', '.']
train
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/scheduler/spawners/templates/jobs/manager.py#L131-L158
7,030
bukun/TorCMS
torcms/handlers/page_handler.py
PageHandler.__could_edit
def __could_edit(self, slug): ''' Test if the user could edit the page. ''' page_rec = MWiki.get_by_uid(slug) if not page_rec: return False if self.check_post_role()['EDIT']: return True elif page_rec.user_name == self.userinfo.user_name: ...
python
def __could_edit(self, slug): ''' Test if the user could edit the page. ''' page_rec = MWiki.get_by_uid(slug) if not page_rec: return False if self.check_post_role()['EDIT']: return True elif page_rec.user_name == self.userinfo.user_name: ...
['def', '__could_edit', '(', 'self', ',', 'slug', ')', ':', 'page_rec', '=', 'MWiki', '.', 'get_by_uid', '(', 'slug', ')', 'if', 'not', 'page_rec', ':', 'return', 'False', 'if', 'self', '.', 'check_post_role', '(', ')', '[', "'EDIT'", ']', ':', 'return', 'True', 'elif', 'page_rec', '.', 'user_name', '==', 'self', '.', ...
Test if the user could edit the page.
['Test', 'if', 'the', 'user', 'could', 'edit', 'the', 'page', '.']
train
https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/page_handler.py#L96-L108
7,031
Chilipp/psyplot
psyplot/plotter.py
Plotter.check_key
def check_key(self, key, raise_error=True, *args, **kwargs): """ Checks whether the key is a valid formatoption Parameters ---------- %(check_key.parameters.no_possible_keys|name)s Returns ------- %(check_key.returns)s Raises ------ ...
python
def check_key(self, key, raise_error=True, *args, **kwargs): """ Checks whether the key is a valid formatoption Parameters ---------- %(check_key.parameters.no_possible_keys|name)s Returns ------- %(check_key.returns)s Raises ------ ...
['def', 'check_key', '(', 'self', ',', 'key', ',', 'raise_error', '=', 'True', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'return', 'check_key', '(', 'key', ',', 'possible_keys', '=', 'list', '(', 'self', ')', ',', 'raise_error', '=', 'raise_error', ',', 'name', '=', "'formatoption keyword'", ',', '*', 'args'...
Checks whether the key is a valid formatoption Parameters ---------- %(check_key.parameters.no_possible_keys|name)s Returns ------- %(check_key.returns)s Raises ------ %(check_key.raises)s
['Checks', 'whether', 'the', 'key', 'is', 'a', 'valid', 'formatoption']
train
https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/plotter.py#L1234-L1251
7,032
lobocv/pyperform
pyperform/__init__.py
enable
def enable(): """ Enable all benchmarking. """ Benchmark.enable = True ComparisonBenchmark.enable = True BenchmarkedFunction.enable = True BenchmarkedClass.enable = True
python
def enable(): """ Enable all benchmarking. """ Benchmark.enable = True ComparisonBenchmark.enable = True BenchmarkedFunction.enable = True BenchmarkedClass.enable = True
['def', 'enable', '(', ')', ':', 'Benchmark', '.', 'enable', '=', 'True', 'ComparisonBenchmark', '.', 'enable', '=', 'True', 'BenchmarkedFunction', '.', 'enable', '=', 'True', 'BenchmarkedClass', '.', 'enable', '=', 'True']
Enable all benchmarking.
['Enable', 'all', 'benchmarking', '.']
train
https://github.com/lobocv/pyperform/blob/97d87e8b9ddb35bd8f2a6782965fd7735ab0349f/pyperform/__init__.py#L23-L30
7,033
p3trus/slave
slave/srs/sr850.py
Mark.bin
def bin(self): """The bin index of this mark. :returns: An integer bin index or None if the mark is inactive. """ bin = self._query(('MBIN?', Integer, Integer), self.idx) return None if bin == -1 else bin
python
def bin(self): """The bin index of this mark. :returns: An integer bin index or None if the mark is inactive. """ bin = self._query(('MBIN?', Integer, Integer), self.idx) return None if bin == -1 else bin
['def', 'bin', '(', 'self', ')', ':', 'bin', '=', 'self', '.', '_query', '(', '(', "'MBIN?'", ',', 'Integer', ',', 'Integer', ')', ',', 'self', '.', 'idx', ')', 'return', 'None', 'if', 'bin', '==', '-', '1', 'else', 'bin']
The bin index of this mark. :returns: An integer bin index or None if the mark is inactive.
['The', 'bin', 'index', 'of', 'this', 'mark', '.']
train
https://github.com/p3trus/slave/blob/bdc74e73bd0f47b74a090c43aa2283c469cde3be/slave/srs/sr850.py#L1180-L1187
7,034
hozn/stravalib
stravalib/client.py
Client.get_route
def get_route(self, route_id): """ Gets specified route. Will be detail-level if owned by authenticated user; otherwise summary-level. https://strava.github.io/api/v3/routes/#retreive :param route_id: The ID of route to fetch. :type route_id: int :rtype: :clas...
python
def get_route(self, route_id): """ Gets specified route. Will be detail-level if owned by authenticated user; otherwise summary-level. https://strava.github.io/api/v3/routes/#retreive :param route_id: The ID of route to fetch. :type route_id: int :rtype: :clas...
['def', 'get_route', '(', 'self', ',', 'route_id', ')', ':', 'raw', '=', 'self', '.', 'protocol', '.', 'get', '(', "'/routes/{id}'", ',', 'id', '=', 'route_id', ')', 'return', 'model', '.', 'Route', '.', 'deserialize', '(', 'raw', ',', 'bind_client', '=', 'self', ')']
Gets specified route. Will be detail-level if owned by authenticated user; otherwise summary-level. https://strava.github.io/api/v3/routes/#retreive :param route_id: The ID of route to fetch. :type route_id: int :rtype: :class:`stravalib.model.Route`
['Gets', 'specified', 'route', '.']
train
https://github.com/hozn/stravalib/blob/5500ebc39e0bf4706bb1ca4c27b25e56becaaa5f/stravalib/client.py#L1430-L1444
7,035
mojaie/chorus
chorus/util/debug.py
malloc
def malloc(func): """ Decorator Execute tracemalloc """ def _f(*args, **kwargs): print("\n<<<---") tracemalloc.start() res = func(*args, **kwargs) snapshot = tracemalloc.take_snapshot() top_stats = snapshot.statistics('lineno') print("[ Top 10 ]") ...
python
def malloc(func): """ Decorator Execute tracemalloc """ def _f(*args, **kwargs): print("\n<<<---") tracemalloc.start() res = func(*args, **kwargs) snapshot = tracemalloc.take_snapshot() top_stats = snapshot.statistics('lineno') print("[ Top 10 ]") ...
['def', 'malloc', '(', 'func', ')', ':', 'def', '_f', '(', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'print', '(', '"\\n<<<---"', ')', 'tracemalloc', '.', 'start', '(', ')', 'res', '=', 'func', '(', '*', 'args', ',', '*', '*', 'kwargs', ')', 'snapshot', '=', 'tracemalloc', '.', 'take_snapshot', '(', ')', 'top_sta...
Decorator Execute tracemalloc
['Decorator', 'Execute', 'tracemalloc']
train
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/util/debug.py#L55-L75
7,036
quantopian/zipline
zipline/data/bcolz_daily_bars.py
BcolzDailyBarWriter.write
def write(self, data, assets=None, show_progress=False, invalid_data_behavior='warn'): """ Parameters ---------- data : iterable[tuple[int, pandas.DataFrame or bcolz.ctable]] The data chunks to write. Each chunk should b...
python
def write(self, data, assets=None, show_progress=False, invalid_data_behavior='warn'): """ Parameters ---------- data : iterable[tuple[int, pandas.DataFrame or bcolz.ctable]] The data chunks to write. Each chunk should b...
['def', 'write', '(', 'self', ',', 'data', ',', 'assets', '=', 'None', ',', 'show_progress', '=', 'False', ',', 'invalid_data_behavior', '=', "'warn'", ')', ':', 'ctx', '=', 'maybe_show_progress', '(', '(', '(', 'sid', ',', 'self', '.', 'to_ctable', '(', 'df', ',', 'invalid_data_behavior', ')', ')', 'for', 'sid', ',', ...
Parameters ---------- data : iterable[tuple[int, pandas.DataFrame or bcolz.ctable]] The data chunks to write. Each chunk should be a tuple of sid and the data for that asset. assets : set[int], optional The assets that should be in ``data``. If this is provide...
['Parameters', '----------', 'data', ':', 'iterable', '[', 'tuple', '[', 'int', 'pandas', '.', 'DataFrame', 'or', 'bcolz', '.', 'ctable', ']]', 'The', 'data', 'chunks', 'to', 'write', '.', 'Each', 'chunk', 'should', 'be', 'a', 'tuple', 'of', 'sid', 'and', 'the', 'data', 'for', 'that', 'asset', '.', 'assets', ':', 'set'...
train
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/data/bcolz_daily_bars.py#L170-L207
7,037
nccgroup/Scout2
AWSScout2/configs/base.py
BaseConfig.fetch_all
def fetch_all(self, credentials, regions = [], partition_name = 'aws', targets = None): """ Generic fetching function that iterates through all of the service's targets :param credentials: F :param service: Name of the service :param regions: ...
python
def fetch_all(self, credentials, regions = [], partition_name = 'aws', targets = None): """ Generic fetching function that iterates through all of the service's targets :param credentials: F :param service: Name of the service :param regions: ...
['def', 'fetch_all', '(', 'self', ',', 'credentials', ',', 'regions', '=', '[', ']', ',', 'partition_name', '=', "'aws'", ',', 'targets', '=', 'None', ')', ':', 'global', 'status', ',', 'formatted_string', '# Initialize targets', 'if', 'not', 'targets', ':', 'targets', '=', 'type', '(', 'self', ')', '.', 'targets', 'pr...
Generic fetching function that iterates through all of the service's targets :param credentials: F :param service: Name of the service :param regions: Name of regions to fetch data from :param partition_name: AWS partition to connect ...
['Generic', 'fetching', 'function', 'that', 'iterates', 'through', 'all', 'of', 'the', 'service', 's', 'targets']
train
https://github.com/nccgroup/Scout2/blob/5d86d46d7ed91a92000496189e9cfa6b98243937/AWSScout2/configs/base.py#L53-L101
7,038
volfpeter/graphscraper
src/graphscraper/spotifyartist.py
SpotifyClient.similar_artists
def similar_artists(self, artist_id: str) -> List[NameExternalIDPair]: """ Returns zero or more similar artists (in the form of artist name - external ID pairs) to the one corresponding to the given artist ID. Arguments: artist_id ([str]): The Spotify ID of the artist for wh...
python
def similar_artists(self, artist_id: str) -> List[NameExternalIDPair]: """ Returns zero or more similar artists (in the form of artist name - external ID pairs) to the one corresponding to the given artist ID. Arguments: artist_id ([str]): The Spotify ID of the artist for wh...
['def', 'similar_artists', '(', 'self', ',', 'artist_id', ':', 'str', ')', '->', 'List', '[', 'NameExternalIDPair', ']', ':', 'response', ':', 'requests', '.', 'Response', '=', 'requests', '.', 'get', '(', 'self', '.', '_API_URL_TEMPLATE', '.', 'format', '(', '"artists/{}/related-artists"', '.', 'format', '(', 'artist_...
Returns zero or more similar artists (in the form of artist name - external ID pairs) to the one corresponding to the given artist ID. Arguments: artist_id ([str]): The Spotify ID of the artist for whom similar artists are requested. Returns: Zero or more artist name - ...
['Returns', 'zero', 'or', 'more', 'similar', 'artists', '(', 'in', 'the', 'form', 'of', 'artist', 'name', '-', 'external', 'ID', 'pairs', ')', 'to', 'the', 'one', 'corresponding', 'to', 'the', 'given', 'artist', 'ID', '.']
train
https://github.com/volfpeter/graphscraper/blob/11d407509956a282ee25190ed6491a162fc0fe7f/src/graphscraper/spotifyartist.py#L384-L418
7,039
yero13/na3x
na3x/db/data.py
CRUD.upsert_multi
def upsert_multi(db, collection, object, match_params=None): """ Wrapper for pymongo.insert_many() and update_many() :param db: db connection :param collection: collection to update :param object: the modifications to apply :param match_params: a query that matches the do...
python
def upsert_multi(db, collection, object, match_params=None): """ Wrapper for pymongo.insert_many() and update_many() :param db: db connection :param collection: collection to update :param object: the modifications to apply :param match_params: a query that matches the do...
['def', 'upsert_multi', '(', 'db', ',', 'collection', ',', 'object', ',', 'match_params', '=', 'None', ')', ':', 'if', 'isinstance', '(', 'object', ',', 'list', ')', 'and', 'len', '(', 'object', ')', '>', '0', ':', 'return', 'str', '(', 'db', '[', 'collection', ']', '.', 'insert_many', '(', 'object', ')', '.', 'inserte...
Wrapper for pymongo.insert_many() and update_many() :param db: db connection :param collection: collection to update :param object: the modifications to apply :param match_params: a query that matches the documents to update :return: ids of inserted/updated document
['Wrapper', 'for', 'pymongo', '.', 'insert_many', '()', 'and', 'update_many', '()', ':', 'param', 'db', ':', 'db', 'connection', ':', 'param', 'collection', ':', 'collection', 'to', 'update', ':', 'param', 'object', ':', 'the', 'modifications', 'to', 'apply', ':', 'param', 'match_params', ':', 'a', 'query', 'that', 'ma...
train
https://github.com/yero13/na3x/blob/b31ef801ea574081125020a7d0f9c4242f8f8b02/na3x/db/data.py#L69-L81
7,040
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py
MAVLink.set_home_position_encode
def set_home_position_encode(self, target_system, latitude, longitude, altitude, x, y, z, q, approach_x, approach_y, approach_z): ''' The position the system will return to and land on. The position is set automatically by the system during the takeoff in ...
python
def set_home_position_encode(self, target_system, latitude, longitude, altitude, x, y, z, q, approach_x, approach_y, approach_z): ''' The position the system will return to and land on. The position is set automatically by the system during the takeoff in ...
['def', 'set_home_position_encode', '(', 'self', ',', 'target_system', ',', 'latitude', ',', 'longitude', ',', 'altitude', ',', 'x', ',', 'y', ',', 'z', ',', 'q', ',', 'approach_x', ',', 'approach_y', ',', 'approach_z', ')', ':', 'return', 'MAVLink_set_home_position_message', '(', 'target_system', ',', 'latitude', ',',...
The position the system will return to and land on. The position is set automatically by the system during the takeoff in case it was not explicitely set by the operator before or after. The global and local positions encode the position in the respective ...
['The', 'position', 'the', 'system', 'will', 'return', 'to', 'and', 'land', 'on', '.', 'The', 'position', 'is', 'set', 'automatically', 'by', 'the', 'system', 'during', 'the', 'takeoff', 'in', 'case', 'it', 'was', 'not', 'explicitely', 'set', 'by', 'the', 'operator', 'before', 'or', 'after', '.', 'The', 'global', 'and'...
train
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L12833-L12861
7,041
bwhite/hadoopy
hadoopy/thirdparty/pyinstaller/PyInstaller/build.py
MERGE
def MERGE(*args): """ Wipe repeated dependencies from a list of (Analysis, id, filename) tuples, supplied as argument. Replace id with the correct filename. """ # Get the longest common path common_prefix = os.path.dirname(os.path.commonprefix([os.path.abspath(a.scripts[-1][1]) for a, _, _ in a...
python
def MERGE(*args): """ Wipe repeated dependencies from a list of (Analysis, id, filename) tuples, supplied as argument. Replace id with the correct filename. """ # Get the longest common path common_prefix = os.path.dirname(os.path.commonprefix([os.path.abspath(a.scripts[-1][1]) for a, _, _ in a...
['def', 'MERGE', '(', '*', 'args', ')', ':', '# Get the longest common path', 'common_prefix', '=', 'os', '.', 'path', '.', 'dirname', '(', 'os', '.', 'path', '.', 'commonprefix', '(', '[', 'os', '.', 'path', '.', 'abspath', '(', 'a', '.', 'scripts', '[', '-', '1', ']', '[', '1', ']', ')', 'for', 'a', ',', '_', ',', '_...
Wipe repeated dependencies from a list of (Analysis, id, filename) tuples, supplied as argument. Replace id with the correct filename.
['Wipe', 'repeated', 'dependencies', 'from', 'a', 'list', 'of', '(', 'Analysis', 'id', 'filename', ')', 'tuples', 'supplied', 'as', 'argument', '.', 'Replace', 'id', 'with', 'the', 'correct', 'filename', '.']
train
https://github.com/bwhite/hadoopy/blob/ff39b4e6d4e6efaf1f571cf0f2c0e0d7ab28c2d6/hadoopy/thirdparty/pyinstaller/PyInstaller/build.py#L1477-L1499
7,042
srittau/python-asserts
asserts/__init__.py
assert_is_not_none
def assert_is_not_none(expr, msg_fmt="{msg}"): """Fail if the expression is None. >>> assert_is_not_none(0) >>> assert_is_not_none(None) Traceback (most recent call last): ... AssertionError: expression is None The following msg_fmt arguments are supported: * msg - the default erro...
python
def assert_is_not_none(expr, msg_fmt="{msg}"): """Fail if the expression is None. >>> assert_is_not_none(0) >>> assert_is_not_none(None) Traceback (most recent call last): ... AssertionError: expression is None The following msg_fmt arguments are supported: * msg - the default erro...
['def', 'assert_is_not_none', '(', 'expr', ',', 'msg_fmt', '=', '"{msg}"', ')', ':', 'if', 'expr', 'is', 'None', ':', 'msg', '=', '"expression is None"', 'fail', '(', 'msg_fmt', '.', 'format', '(', 'msg', '=', 'msg', ',', 'expr', '=', 'expr', ')', ')']
Fail if the expression is None. >>> assert_is_not_none(0) >>> assert_is_not_none(None) Traceback (most recent call last): ... AssertionError: expression is None The following msg_fmt arguments are supported: * msg - the default error message * expr - tested expression
['Fail', 'if', 'the', 'expression', 'is', 'None', '.']
train
https://github.com/srittau/python-asserts/blob/1d5c797031c68ee27552d1c94e7f918c3d3d0453/asserts/__init__.py#L137-L152
7,043
jaraco/path.py
path/__init__.py
Path.removedirs_p
def removedirs_p(self): """ Like :meth:`removedirs`, but does not raise an exception if the directory is not empty or does not exist. """ with contextlib.suppress(FileExistsError, DirectoryNotEmpty): with DirectoryNotEmpty.translate(): self.removedirs() return...
python
def removedirs_p(self): """ Like :meth:`removedirs`, but does not raise an exception if the directory is not empty or does not exist. """ with contextlib.suppress(FileExistsError, DirectoryNotEmpty): with DirectoryNotEmpty.translate(): self.removedirs() return...
['def', 'removedirs_p', '(', 'self', ')', ':', 'with', 'contextlib', '.', 'suppress', '(', 'FileExistsError', ',', 'DirectoryNotEmpty', ')', ':', 'with', 'DirectoryNotEmpty', '.', 'translate', '(', ')', ':', 'self', '.', 'removedirs', '(', ')', 'return', 'self']
Like :meth:`removedirs`, but does not raise an exception if the directory is not empty or does not exist.
['Like', ':', 'meth', ':', 'removedirs', 'but', 'does', 'not', 'raise', 'an', 'exception', 'if', 'the', 'directory', 'is', 'not', 'empty', 'or', 'does', 'not', 'exist', '.']
train
https://github.com/jaraco/path.py/blob/bbe7d99e7a64a004f866ace9ec12bd9b296908f5/path/__init__.py#L1147-L1153
7,044
APSL/transmanager
transmanager/search_indexes.py
TransTaskIndex.index_queryset
def index_queryset(self, using=None): """ Used when the entire index for model is updated. """ return self.get_model().objects.filter(date_creation__lte=datetime.datetime.now())
python
def index_queryset(self, using=None): """ Used when the entire index for model is updated. """ return self.get_model().objects.filter(date_creation__lte=datetime.datetime.now())
['def', 'index_queryset', '(', 'self', ',', 'using', '=', 'None', ')', ':', 'return', 'self', '.', 'get_model', '(', ')', '.', 'objects', '.', 'filter', '(', 'date_creation__lte', '=', 'datetime', '.', 'datetime', '.', 'now', '(', ')', ')']
Used when the entire index for model is updated.
['Used', 'when', 'the', 'entire', 'index', 'for', 'model', 'is', 'updated', '.']
train
https://github.com/APSL/transmanager/blob/79157085840008e146b264521681913090197ed1/transmanager/search_indexes.py#L17-L21
7,045
bcbio/bcbio-nextgen
bcbio/heterogeneity/phylowgs.py
_prep_inputs
def _prep_inputs(vrn_info, cnv_info, somatic_info, work_dir, config): """Prepare inputs for running PhyloWGS from variant and CNV calls. """ exe = os.path.join(os.path.dirname(sys.executable), "create_phylowgs_inputs.py") assert os.path.exists(exe), "Could not find input prep script for PhyloWGS runs." ...
python
def _prep_inputs(vrn_info, cnv_info, somatic_info, work_dir, config): """Prepare inputs for running PhyloWGS from variant and CNV calls. """ exe = os.path.join(os.path.dirname(sys.executable), "create_phylowgs_inputs.py") assert os.path.exists(exe), "Could not find input prep script for PhyloWGS runs." ...
['def', '_prep_inputs', '(', 'vrn_info', ',', 'cnv_info', ',', 'somatic_info', ',', 'work_dir', ',', 'config', ')', ':', 'exe', '=', 'os', '.', 'path', '.', 'join', '(', 'os', '.', 'path', '.', 'dirname', '(', 'sys', '.', 'executable', ')', ',', '"create_phylowgs_inputs.py"', ')', 'assert', 'os', '.', 'path', '.', 'exi...
Prepare inputs for running PhyloWGS from variant and CNV calls.
['Prepare', 'inputs', 'for', 'running', 'PhyloWGS', 'from', 'variant', 'and', 'CNV', 'calls', '.']
train
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/heterogeneity/phylowgs.py#L153-L171
7,046
AltSchool/dynamic-rest
dynamic_rest/datastructures.py
TreeMap.get_paths
def get_paths(self): """Get all paths from the root to the leaves. For example, given a chain like `{'a':{'b':{'c':None}}}`, this method would return `[['a', 'b', 'c']]`. Returns: A list of lists of paths. """ paths = [] for key, child in six.iterite...
python
def get_paths(self): """Get all paths from the root to the leaves. For example, given a chain like `{'a':{'b':{'c':None}}}`, this method would return `[['a', 'b', 'c']]`. Returns: A list of lists of paths. """ paths = [] for key, child in six.iterite...
['def', 'get_paths', '(', 'self', ')', ':', 'paths', '=', '[', ']', 'for', 'key', ',', 'child', 'in', 'six', '.', 'iteritems', '(', 'self', ')', ':', 'if', 'isinstance', '(', 'child', ',', 'TreeMap', ')', 'and', 'child', ':', '# current child is an intermediate node', 'for', 'path', 'in', 'child', '.', 'get_paths', '('...
Get all paths from the root to the leaves. For example, given a chain like `{'a':{'b':{'c':None}}}`, this method would return `[['a', 'b', 'c']]`. Returns: A list of lists of paths.
['Get', 'all', 'paths', 'from', 'the', 'root', 'to', 'the', 'leaves', '.']
train
https://github.com/AltSchool/dynamic-rest/blob/5b0338c3dd8bc638d60c3bb92645857c5b89c920/dynamic_rest/datastructures.py#L8-L27
7,047
heuer/segno
segno/encoder.py
add_format_info
def add_format_info(matrix, version, error, mask_pattern): """\ Adds the format information into the provided matrix. ISO/IEC 18004:2015(E) -- 7.9 Format information (page 55) ISO/IEC 18004:2015(E) -- 7.9.1 QR Code symbols ISO/IEC 18004:2015(E) -- 7.9.2 Micro QR Code symbols :param matrix: The...
python
def add_format_info(matrix, version, error, mask_pattern): """\ Adds the format information into the provided matrix. ISO/IEC 18004:2015(E) -- 7.9 Format information (page 55) ISO/IEC 18004:2015(E) -- 7.9.1 QR Code symbols ISO/IEC 18004:2015(E) -- 7.9.2 Micro QR Code symbols :param matrix: The...
['def', 'add_format_info', '(', 'matrix', ',', 'version', ',', 'error', ',', 'mask_pattern', ')', ':', '# 14: most significant bit', '# 0: least significant bit', '#', '# QR Code format info: Micro QR format info', '# col 0 col 7 col matrix[-1] ...
\ Adds the format information into the provided matrix. ISO/IEC 18004:2015(E) -- 7.9 Format information (page 55) ISO/IEC 18004:2015(E) -- 7.9.1 QR Code symbols ISO/IEC 18004:2015(E) -- 7.9.2 Micro QR Code symbols :param matrix: The matrix. :param int version: Version constant :param int e...
['\\', 'Adds', 'the', 'format', 'information', 'into', 'the', 'provided', 'matrix', '.']
train
https://github.com/heuer/segno/blob/64d912a2bd17d0b5ff3e8b5d37098edfc663c2b3/segno/encoder.py#L945-L1006
7,048
brocade/pynos
pynos/versions/ver_7/ver_7_1_0/yang/brocade_lldp_ext.py
brocade_lldp_ext.get_lldp_neighbor_detail_output_has_more
def get_lldp_neighbor_detail_output_has_more(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_lldp_neighbor_detail = ET.Element("get_lldp_neighbor_detail") config = get_lldp_neighbor_detail output = ET.SubElement(get_lldp_neighbor_detail, "out...
python
def get_lldp_neighbor_detail_output_has_more(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_lldp_neighbor_detail = ET.Element("get_lldp_neighbor_detail") config = get_lldp_neighbor_detail output = ET.SubElement(get_lldp_neighbor_detail, "out...
['def', 'get_lldp_neighbor_detail_output_has_more', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'config', '=', 'ET', '.', 'Element', '(', '"config"', ')', 'get_lldp_neighbor_detail', '=', 'ET', '.', 'Element', '(', '"get_lldp_neighbor_detail"', ')', 'config', '=', 'get_lldp_neighbor_detail', 'output', '=', 'ET', '....
Auto Generated Code
['Auto', 'Generated', 'Code']
train
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_1_0/yang/brocade_lldp_ext.py#L356-L367
7,049
nickoala/telepot
telepot/__init__.py
Bot.sendGame
def sendGame(self, chat_id, game_short_name, disable_notification=None, reply_to_message_id=None, reply_markup=None): """ See: https://core.telegram.org/bots/api#sendgame """ p = _strip(locals()) return self._api_request('sendGame', _rectify(p))
python
def sendGame(self, chat_id, game_short_name, disable_notification=None, reply_to_message_id=None, reply_markup=None): """ See: https://core.telegram.org/bots/api#sendgame """ p = _strip(locals()) return self._api_request('sendGame', _rectify(p))
['def', 'sendGame', '(', 'self', ',', 'chat_id', ',', 'game_short_name', ',', 'disable_notification', '=', 'None', ',', 'reply_to_message_id', '=', 'None', ',', 'reply_markup', '=', 'None', ')', ':', 'p', '=', '_strip', '(', 'locals', '(', ')', ')', 'return', 'self', '.', '_api_request', '(', "'sendGame'", ',', '_recti...
See: https://core.telegram.org/bots/api#sendgame
['See', ':', 'https', ':', '//', 'core', '.', 'telegram', '.', 'org', '/', 'bots', '/', 'api#sendgame']
train
https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/__init__.py#L701-L707
7,050
pyviz/imagen
imagen/patterngenerator.py
Composite.state_pop
def state_pop(self): """ Pop the state of all generators """ super(Composite,self).state_pop() for gen in self.generators: gen.state_pop()
python
def state_pop(self): """ Pop the state of all generators """ super(Composite,self).state_pop() for gen in self.generators: gen.state_pop()
['def', 'state_pop', '(', 'self', ')', ':', 'super', '(', 'Composite', ',', 'self', ')', '.', 'state_pop', '(', ')', 'for', 'gen', 'in', 'self', '.', 'generators', ':', 'gen', '.', 'state_pop', '(', ')']
Pop the state of all generators
['Pop', 'the', 'state', 'of', 'all', 'generators']
train
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/patterngenerator.py#L524-L530
7,051
dmwm/DBS
Server/Python/src/dbs/dao/Oracle/BlockParent/ListChild.py
ListChild.execute
def execute(self, conn, block_name="", transaction = False): """ block: /a/b/c#d """ if not conn: msg='Oracle/BlockParent/List. No DB connection found' dbsExceptionHandler('dbsException-failed-connect2host', msg, self.logger.exception) sql = self.sql ...
python
def execute(self, conn, block_name="", transaction = False): """ block: /a/b/c#d """ if not conn: msg='Oracle/BlockParent/List. No DB connection found' dbsExceptionHandler('dbsException-failed-connect2host', msg, self.logger.exception) sql = self.sql ...
['def', 'execute', '(', 'self', ',', 'conn', ',', 'block_name', '=', '""', ',', 'transaction', '=', 'False', ')', ':', 'if', 'not', 'conn', ':', 'msg', '=', "'Oracle/BlockParent/List. No DB connection found'", 'dbsExceptionHandler', '(', "'dbsException-failed-connect2host'", ',', 'msg', ',', 'self', '.', 'logger', '.',...
block: /a/b/c#d
['block', ':', '/', 'a', '/', 'b', '/', 'c#d']
train
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/dao/Oracle/BlockParent/ListChild.py#L27-L46
7,052
astorfi/speechpy
speechpy/processing.py
fft_spectrum
def fft_spectrum(frames, fft_points=512): """This function computes the one-dimensional n-point discrete Fourier Transform (DFT) of a real-valued array by means of an efficient algorithm called the Fast Fourier Transform (FFT). Please refer to https://docs.scipy.org/doc/numpy/reference/generated/numpy.f...
python
def fft_spectrum(frames, fft_points=512): """This function computes the one-dimensional n-point discrete Fourier Transform (DFT) of a real-valued array by means of an efficient algorithm called the Fast Fourier Transform (FFT). Please refer to https://docs.scipy.org/doc/numpy/reference/generated/numpy.f...
['def', 'fft_spectrum', '(', 'frames', ',', 'fft_points', '=', '512', ')', ':', 'SPECTRUM_VECTOR', '=', 'np', '.', 'fft', '.', 'rfft', '(', 'frames', ',', 'n', '=', 'fft_points', ',', 'axis', '=', '-', '1', ',', 'norm', '=', 'None', ')', 'return', 'np', '.', 'absolute', '(', 'SPECTRUM_VECTOR', ')']
This function computes the one-dimensional n-point discrete Fourier Transform (DFT) of a real-valued array by means of an efficient algorithm called the Fast Fourier Transform (FFT). Please refer to https://docs.scipy.org/doc/numpy/reference/generated/numpy.fft.rfft.html for further details. Args: ...
['This', 'function', 'computes', 'the', 'one', '-', 'dimensional', 'n', '-', 'point', 'discrete', 'Fourier', 'Transform', '(', 'DFT', ')', 'of', 'a', 'real', '-', 'valued', 'array', 'by', 'means', 'of', 'an', 'efficient', 'algorithm', 'called', 'the', 'Fast', 'Fourier', 'Transform', '(', 'FFT', ')', '.', 'Please', 'ref...
train
https://github.com/astorfi/speechpy/blob/9e99ae81398e7584e6234db371d6d7b5e8736192/speechpy/processing.py#L142-L159
7,053
helixyte/everest
everest/entities/attributes.py
get_domain_class_terminal_attribute_iterator
def get_domain_class_terminal_attribute_iterator(ent): """ Returns an iterator over all terminal attributes in the given registered resource. """ for attr in itervalues_(ent.__everest_attributes__): if attr.kind == RESOURCE_ATTRIBUTE_KINDS.TERMINAL: yield attr
python
def get_domain_class_terminal_attribute_iterator(ent): """ Returns an iterator over all terminal attributes in the given registered resource. """ for attr in itervalues_(ent.__everest_attributes__): if attr.kind == RESOURCE_ATTRIBUTE_KINDS.TERMINAL: yield attr
['def', 'get_domain_class_terminal_attribute_iterator', '(', 'ent', ')', ':', 'for', 'attr', 'in', 'itervalues_', '(', 'ent', '.', '__everest_attributes__', ')', ':', 'if', 'attr', '.', 'kind', '==', 'RESOURCE_ATTRIBUTE_KINDS', '.', 'TERMINAL', ':', 'yield', 'attr']
Returns an iterator over all terminal attributes in the given registered resource.
['Returns', 'an', 'iterator', 'over', 'all', 'terminal', 'attributes', 'in', 'the', 'given', 'registered', 'resource', '.']
train
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/entities/attributes.py#L116-L123
7,054
aburrell/apexpy
src/apexpy/helpers.py
checklat
def checklat(lat, name='lat'): """Makes sure the latitude is inside [-90, 90], clipping close values (tolerance 1e-4). Parameters ========== lat : array_like latitude name : str, optional parameter name to use in the exception message Returns ======= lat : ndarray o...
python
def checklat(lat, name='lat'): """Makes sure the latitude is inside [-90, 90], clipping close values (tolerance 1e-4). Parameters ========== lat : array_like latitude name : str, optional parameter name to use in the exception message Returns ======= lat : ndarray o...
['def', 'checklat', '(', 'lat', ',', 'name', '=', "'lat'", ')', ':', 'if', 'np', '.', 'all', '(', 'np', '.', 'float64', '(', 'lat', ')', '>=', '-', '90', ')', 'and', 'np', '.', 'all', '(', 'np', '.', 'float64', '(', 'lat', ')', '<=', '90', ')', ':', 'return', 'lat', 'if', 'np', '.', 'isscalar', '(', 'lat', ')', ':', 'i...
Makes sure the latitude is inside [-90, 90], clipping close values (tolerance 1e-4). Parameters ========== lat : array_like latitude name : str, optional parameter name to use in the exception message Returns ======= lat : ndarray or float Same as input where va...
['Makes', 'sure', 'the', 'latitude', 'is', 'inside', '[', '-', '90', '90', ']', 'clipping', 'close', 'values', '(', 'tolerance', '1e', '-', '4', ')', '.']
train
https://github.com/aburrell/apexpy/blob/a2e919fd9ea9a65d49c4c22c9eb030c8ccf48386/src/apexpy/helpers.py#L11-L52
7,055
jadolg/rocketchat_API
rocketchat_API/rocketchat.py
RocketChat.rooms_upload
def rooms_upload(self, rid, file, **kwargs): """Post a message with attached file to a dedicated room.""" files = { 'file': (os.path.basename(file), open(file, 'rb'), mimetypes.guess_type(file)[0]), } return self.__call_api_post('rooms.upload/' + rid, kwargs=kwargs, use_json=...
python
def rooms_upload(self, rid, file, **kwargs): """Post a message with attached file to a dedicated room.""" files = { 'file': (os.path.basename(file), open(file, 'rb'), mimetypes.guess_type(file)[0]), } return self.__call_api_post('rooms.upload/' + rid, kwargs=kwargs, use_json=...
['def', 'rooms_upload', '(', 'self', ',', 'rid', ',', 'file', ',', '*', '*', 'kwargs', ')', ':', 'files', '=', '{', "'file'", ':', '(', 'os', '.', 'path', '.', 'basename', '(', 'file', ')', ',', 'open', '(', 'file', ',', "'rb'", ')', ',', 'mimetypes', '.', 'guess_type', '(', 'file', ')', '[', '0', ']', ')', ',', '}', '...
Post a message with attached file to a dedicated room.
['Post', 'a', 'message', 'with', 'attached', 'file', 'to', 'a', 'dedicated', 'room', '.']
train
https://github.com/jadolg/rocketchat_API/blob/f220d094434991cb9892418245f054ea06f28aad/rocketchat_API/rocketchat.py#L644-L649
7,056
twilio/twilio-python
twilio/rest/studio/v1/flow/execution/__init__.py
ExecutionList.stream
def stream(self, date_created_from=values.unset, date_created_to=values.unset, limit=None, page_size=None): """ Streams ExecutionInstance records from the API as a generator stream. This operation lazily loads records as efficiently as possible until the limit is reached. ...
python
def stream(self, date_created_from=values.unset, date_created_to=values.unset, limit=None, page_size=None): """ Streams ExecutionInstance records from the API as a generator stream. This operation lazily loads records as efficiently as possible until the limit is reached. ...
['def', 'stream', '(', 'self', ',', 'date_created_from', '=', 'values', '.', 'unset', ',', 'date_created_to', '=', 'values', '.', 'unset', ',', 'limit', '=', 'None', ',', 'page_size', '=', 'None', ')', ':', 'limits', '=', 'self', '.', '_version', '.', 'read_limits', '(', 'limit', ',', 'page_size', ')', 'page', '=', 'se...
Streams ExecutionInstance records from the API as a generator stream. This operation lazily loads records as efficiently as possible until the limit is reached. The results are returned as a generator, so this operation is memory efficient. :param datetime date_created_from: Only show E...
['Streams', 'ExecutionInstance', 'records', 'from', 'the', 'API', 'as', 'a', 'generator', 'stream', '.', 'This', 'operation', 'lazily', 'loads', 'records', 'as', 'efficiently', 'as', 'possible', 'until', 'the', 'limit', 'is', 'reached', '.', 'The', 'results', 'are', 'returned', 'as', 'a', 'generator', 'so', 'this', 'op...
train
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/studio/v1/flow/execution/__init__.py#L39-L67
7,057
senaite/senaite.core
bika/lims/exportimport/instruments/generic/two_dimension.py
find_kw
def find_kw(ar_or_sample, kw): """ This function is used to find keywords that are not on the analysis but keywords that are on the interim fields. This function and is is_keyword function should probably be in resultsimport.py or somewhere central where it can be used by other inst...
python
def find_kw(ar_or_sample, kw): """ This function is used to find keywords that are not on the analysis but keywords that are on the interim fields. This function and is is_keyword function should probably be in resultsimport.py or somewhere central where it can be used by other inst...
['def', 'find_kw', '(', 'ar_or_sample', ',', 'kw', ')', ':', 'for', 'analysis', 'in', 'find_analyses', '(', 'ar_or_sample', ')', ':', 'if', 'kw', 'in', 'get_interims_keywords', '(', 'analysis', ')', ':', 'return', 'analysis', '.', 'getKeyword', '(', ')', 'return', 'None']
This function is used to find keywords that are not on the analysis but keywords that are on the interim fields. This function and is is_keyword function should probably be in resultsimport.py or somewhere central where it can be used by other instrument interfaces.
['This', 'function', 'is', 'used', 'to', 'find', 'keywords', 'that', 'are', 'not', 'on', 'the', 'analysis', 'but', 'keywords', 'that', 'are', 'on', 'the', 'interim', 'fields', '.']
train
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/exportimport/instruments/generic/two_dimension.py#L127-L138
7,058
alvinwan/TexSoup
TexSoup/reader.py
tokenize_math
def tokenize_math(text): r"""Prevents math from being tokenized. :param Buffer text: iterator over line, with current position >>> b = Buffer(r'$\min_x$ \command') >>> tokenize_math(b) '$' >>> b = Buffer(r'$$\min_x$$ \command') >>> tokenize_math(b) '$$' """ if text.startswith('...
python
def tokenize_math(text): r"""Prevents math from being tokenized. :param Buffer text: iterator over line, with current position >>> b = Buffer(r'$\min_x$ \command') >>> tokenize_math(b) '$' >>> b = Buffer(r'$$\min_x$$ \command') >>> tokenize_math(b) '$$' """ if text.startswith('...
['def', 'tokenize_math', '(', 'text', ')', ':', 'if', 'text', '.', 'startswith', '(', "'$'", ')', 'and', '(', 'text', '.', 'position', '==', '0', 'or', 'text', '.', 'peek', '(', '-', '1', ')', '!=', "'\\\\'", 'or', 'text', '.', 'endswith', '(', "r'\\\\'", ')', ')', ':', 'starter', '=', "'$$'", 'if', 'text', '.', 'start...
r"""Prevents math from being tokenized. :param Buffer text: iterator over line, with current position >>> b = Buffer(r'$\min_x$ \command') >>> tokenize_math(b) '$' >>> b = Buffer(r'$$\min_x$$ \command') >>> tokenize_math(b) '$$'
['r', 'Prevents', 'math', 'from', 'being', 'tokenized', '.']
train
https://github.com/alvinwan/TexSoup/blob/63323ed71510fd2351102b8c36660a3b7703cead/TexSoup/reader.py#L169-L184
7,059
meejah/txtorcon
txtorcon/onion.py
_await_descriptor_upload
def _await_descriptor_upload(tor_protocol, onion, progress, await_all_uploads): """ Internal helper. :param tor_protocol: ITorControlProtocol instance :param onion: IOnionService instance :param progress: a progess callback, or None :returns: a Deferred that fires once we've detected at leas...
python
def _await_descriptor_upload(tor_protocol, onion, progress, await_all_uploads): """ Internal helper. :param tor_protocol: ITorControlProtocol instance :param onion: IOnionService instance :param progress: a progess callback, or None :returns: a Deferred that fires once we've detected at leas...
['def', '_await_descriptor_upload', '(', 'tor_protocol', ',', 'onion', ',', 'progress', ',', 'await_all_uploads', ')', ':', "# For v3 services, Tor attempts to upload to 16 services; we'll", '# assume that for now but also cap it (we want to show some', '# progress for "attempting uploads" but we need to decide how', '...
Internal helper. :param tor_protocol: ITorControlProtocol instance :param onion: IOnionService instance :param progress: a progess callback, or None :returns: a Deferred that fires once we've detected at least one descriptor upload for the service (as detected by listening for HS_DES...
['Internal', 'helper', '.']
train
https://github.com/meejah/txtorcon/blob/14053b95adf0b4bd9dd9c317bece912a26578a93/txtorcon/onion.py#L389-L504
7,060
bitesofcode/projexui
projexui/widgets/xlocalebox.py
XLocaleBox.setShowTerritory
def setShowTerritory(self, state): """ Sets the display mode for this widget to the inputed mode. :param state | <bool> """ if state == self._showTerritory: return self._showTerritory = state self.setDirty()
python
def setShowTerritory(self, state): """ Sets the display mode for this widget to the inputed mode. :param state | <bool> """ if state == self._showTerritory: return self._showTerritory = state self.setDirty()
['def', 'setShowTerritory', '(', 'self', ',', 'state', ')', ':', 'if', 'state', '==', 'self', '.', '_showTerritory', ':', 'return', 'self', '.', '_showTerritory', '=', 'state', 'self', '.', 'setDirty', '(', ')']
Sets the display mode for this widget to the inputed mode. :param state | <bool>
['Sets', 'the', 'display', 'mode', 'for', 'this', 'widget', 'to', 'the', 'inputed', 'mode', '.', ':', 'param', 'state', '|', '<bool', '>']
train
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xlocalebox.py#L293-L303
7,061
sbmlteam/libCombine
examples/python/createArchiveExample.py
createArchiveExample
def createArchiveExample(fileName): """ Creates Combine Archive containing the given file. :param fileName: file to include in the archive :return: None """ print('*' * 80) print('Create archive') print('*' * 80) archive = CombineArchive() archive.addFile( fileName, # file...
python
def createArchiveExample(fileName): """ Creates Combine Archive containing the given file. :param fileName: file to include in the archive :return: None """ print('*' * 80) print('Create archive') print('*' * 80) archive = CombineArchive() archive.addFile( fileName, # file...
['def', 'createArchiveExample', '(', 'fileName', ')', ':', 'print', '(', "'*'", '*', '80', ')', 'print', '(', "'Create archive'", ')', 'print', '(', "'*'", '*', '80', ')', 'archive', '=', 'CombineArchive', '(', ')', 'archive', '.', 'addFile', '(', 'fileName', ',', '# filename', '"./models/model.xml"', ',', '# target fi...
Creates Combine Archive containing the given file. :param fileName: file to include in the archive :return: None
['Creates', 'Combine', 'Archive', 'containing', 'the', 'given', 'file', '.']
train
https://github.com/sbmlteam/libCombine/blob/d7c11a90129dedbcc8bdba8d204be03f1dd0c3e4/examples/python/createArchiveExample.py#L11-L57
7,062
ewels/MultiQC
multiqc/modules/base_module.py
BaseMultiqcModule.clean_s_name
def clean_s_name(self, s_name, root): """ Helper function to take a long file name and strip it back to a clean sample name. Somewhat arbitrary. :param s_name: The sample name to clean :param root: The directory path that this file is within :config.prepend_dirs: boolean, whether...
python
def clean_s_name(self, s_name, root): """ Helper function to take a long file name and strip it back to a clean sample name. Somewhat arbitrary. :param s_name: The sample name to clean :param root: The directory path that this file is within :config.prepend_dirs: boolean, whether...
['def', 'clean_s_name', '(', 'self', ',', 's_name', ',', 'root', ')', ':', 's_name_original', '=', 's_name', 'if', 'root', 'is', 'None', ':', 'root', '=', "''", 'if', 'config', '.', 'fn_clean_sample_names', ':', '# Split then take first section to remove everything after these matches', 'for', 'ext', 'in', 'config', '....
Helper function to take a long file name and strip it back to a clean sample name. Somewhat arbitrary. :param s_name: The sample name to clean :param root: The directory path that this file is within :config.prepend_dirs: boolean, whether to prepend dir name to s_name :return: Th...
['Helper', 'function', 'to', 'take', 'a', 'long', 'file', 'name', 'and', 'strip', 'it', 'back', 'to', 'a', 'clean', 'sample', 'name', '.', 'Somewhat', 'arbitrary', '.', ':', 'param', 's_name', ':', 'The', 'sample', 'name', 'to', 'clean', ':', 'param', 'root', ':', 'The', 'directory', 'path', 'that', 'this', 'file', 'is...
train
https://github.com/ewels/MultiQC/blob/2037d6322b2554146a74efbf869156ad20d4c4ec/multiqc/modules/base_module.py#L195-L252
7,063
buzzfeed/caliendo
caliendo/db/flatfiles.py
insert_io
def insert_io( args ): """ Inserts a method's i/o into the datastore :param dict args: A dictionary of the hash, stack, packet_num, methodname, args, and returnval :rtype None: """ global CACHE_ load_cache() hash = args['hash'] record_used('cache', hash) packet_num = args['pack...
python
def insert_io( args ): """ Inserts a method's i/o into the datastore :param dict args: A dictionary of the hash, stack, packet_num, methodname, args, and returnval :rtype None: """ global CACHE_ load_cache() hash = args['hash'] record_used('cache', hash) packet_num = args['pack...
['def', 'insert_io', '(', 'args', ')', ':', 'global', 'CACHE_', 'load_cache', '(', ')', 'hash', '=', 'args', '[', "'hash'", ']', 'record_used', '(', "'cache'", ',', 'hash', ')', 'packet_num', '=', 'args', '[', "'packet_num'", ']', 'if', 'hash', 'not', 'in', 'CACHE_', '[', "'cache'", ']', ':', 'CACHE_', '[', "'cache'", ...
Inserts a method's i/o into the datastore :param dict args: A dictionary of the hash, stack, packet_num, methodname, args, and returnval :rtype None:
['Inserts', 'a', 'method', 's', 'i', '/', 'o', 'into', 'the', 'datastore']
train
https://github.com/buzzfeed/caliendo/blob/1628a10f7782ad67c0422b5cbc9bf4979ac40abc/caliendo/db/flatfiles.py#L64-L80
7,064
pybel/pybel
src/pybel/struct/mutation/induction/paths.py
get_random_path
def get_random_path(graph) -> List[BaseEntity]: """Get a random path from the graph as a list of nodes. :param pybel.BELGraph graph: A BEL graph """ wg = graph.to_undirected() nodes = wg.nodes() def pick_random_pair() -> Tuple[BaseEntity, BaseEntity]: """Get a pair of random nodes."""...
python
def get_random_path(graph) -> List[BaseEntity]: """Get a random path from the graph as a list of nodes. :param pybel.BELGraph graph: A BEL graph """ wg = graph.to_undirected() nodes = wg.nodes() def pick_random_pair() -> Tuple[BaseEntity, BaseEntity]: """Get a pair of random nodes."""...
['def', 'get_random_path', '(', 'graph', ')', '->', 'List', '[', 'BaseEntity', ']', ':', 'wg', '=', 'graph', '.', 'to_undirected', '(', ')', 'nodes', '=', 'wg', '.', 'nodes', '(', ')', 'def', 'pick_random_pair', '(', ')', '->', 'Tuple', '[', 'BaseEntity', ',', 'BaseEntity', ']', ':', '"""Get a pair of random nodes."""'...
Get a random path from the graph as a list of nodes. :param pybel.BELGraph graph: A BEL graph
['Get', 'a', 'random', 'path', 'from', 'the', 'graph', 'as', 'a', 'list', 'of', 'nodes', '.']
train
https://github.com/pybel/pybel/blob/c8a7a1bdae4c475fa2a8c77f3a9a5f6d79556ca0/src/pybel/struct/mutation/induction/paths.py#L114-L139
7,065
roboogle/gtkmvc3
gtkmvco/gtkmvc3/adapters/default.py
remove_adapter
def remove_adapter(widget_class, flavour=None): """Removes the given widget class information from the default set of adapters. If widget_class had been previously added by using add_adapter, the added adapter will be removed, restoring possibly previusly existing adapter(s). Notice that this funct...
python
def remove_adapter(widget_class, flavour=None): """Removes the given widget class information from the default set of adapters. If widget_class had been previously added by using add_adapter, the added adapter will be removed, restoring possibly previusly existing adapter(s). Notice that this funct...
['def', 'remove_adapter', '(', 'widget_class', ',', 'flavour', '=', 'None', ')', ':', 'for', 'it', ',', 'tu', 'in', 'enumerate', '(', '__def_adapter', ')', ':', 'if', '(', 'widget_class', '==', 'tu', '[', 'WIDGET', ']', 'and', 'flavour', '==', 'tu', '[', 'FLAVOUR', ']', ')', ':', 'del', '__def_adapter', '[', 'it', ']',...
Removes the given widget class information from the default set of adapters. If widget_class had been previously added by using add_adapter, the added adapter will be removed, restoring possibly previusly existing adapter(s). Notice that this function will remove only *one* adapter about given wige...
['Removes', 'the', 'given', 'widget', 'class', 'information', 'from', 'the', 'default', 'set', 'of', 'adapters', '.']
train
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/adapters/default.py#L106-L126
7,066
mitodl/PyLmod
pylmod/gradebook.py
GradeBook.create_assignment
def create_assignment( # pylint: disable=too-many-arguments self, name, short_name, weight, max_points, due_date_str, gradebook_id='', **kwargs ): """Create a new assignment. Create a new assignment. By...
python
def create_assignment( # pylint: disable=too-many-arguments self, name, short_name, weight, max_points, due_date_str, gradebook_id='', **kwargs ): """Create a new assignment. Create a new assignment. By...
['def', 'create_assignment', '(', '# pylint: disable=too-many-arguments', 'self', ',', 'name', ',', 'short_name', ',', 'weight', ',', 'max_points', ',', 'due_date_str', ',', 'gradebook_id', '=', "''", ',', '*', '*', 'kwargs', ')', ':', 'data', '=', '{', "'name'", ':', 'name', ',', "'shortName'", ':', 'short_name', ',',...
Create a new assignment. Create a new assignment. By default, assignments are created under the `Uncategorized` category. Args: name (str): descriptive assignment name, i.e. ``new NUMERIC SIMPLE ASSIGNMENT`` short_name (str): short name of assignment, on...
['Create', 'a', 'new', 'assignment', '.']
train
https://github.com/mitodl/PyLmod/blob/b798b86c33d1eb615e7cd4f3457b5c15da1d86e0/pylmod/gradebook.py#L335-L425
7,067
molmod/molmod
molmod/graphs.py
RingPattern.get_new_edges
def get_new_edges(self, level): """Get new edges from the pattern graph for the graph search algorithm The level argument denotes the distance of the new edges from the starting vertex in the pattern graph. """ if level == 0: edges0 = [(0, 1), (0, 2)] e...
python
def get_new_edges(self, level): """Get new edges from the pattern graph for the graph search algorithm The level argument denotes the distance of the new edges from the starting vertex in the pattern graph. """ if level == 0: edges0 = [(0, 1), (0, 2)] e...
['def', 'get_new_edges', '(', 'self', ',', 'level', ')', ':', 'if', 'level', '==', '0', ':', 'edges0', '=', '[', '(', '0', ',', '1', ')', ',', '(', '0', ',', '2', ')', ']', 'elif', 'level', '>=', '(', 'self', '.', 'max_size', '-', '1', ')', '//', '2', ':', 'edges0', '=', '[', ']', 'else', ':', 'l2', '=', 'level', '*', ...
Get new edges from the pattern graph for the graph search algorithm The level argument denotes the distance of the new edges from the starting vertex in the pattern graph.
['Get', 'new', 'edges', 'from', 'the', 'pattern', 'graph', 'for', 'the', 'graph', 'search', 'algorithm']
train
https://github.com/molmod/molmod/blob/a7b5b4364ed514ad4c465856c05b5eda1cb561e0/molmod/graphs.py#L1429-L1442
7,068
saltstack/salt
salt/modules/firewalld.py
list_services
def list_services(zone=None, permanent=True): ''' List services added for zone as a space separated list. If zone is omitted, default zone will be used. CLI Example: .. code-block:: bash salt '*' firewalld.list_services List a specific zone .. code-block:: bash salt '*'...
python
def list_services(zone=None, permanent=True): ''' List services added for zone as a space separated list. If zone is omitted, default zone will be used. CLI Example: .. code-block:: bash salt '*' firewalld.list_services List a specific zone .. code-block:: bash salt '*'...
['def', 'list_services', '(', 'zone', '=', 'None', ',', 'permanent', '=', 'True', ')', ':', 'if', 'zone', ':', 'cmd', '=', "'--zone={0} --list-services'", '.', 'format', '(', 'zone', ')', 'else', ':', 'cmd', '=', "'--list-services'", 'if', 'permanent', ':', 'cmd', '+=', "' --permanent'", 'return', '__firewall_cmd', '('...
List services added for zone as a space separated list. If zone is omitted, default zone will be used. CLI Example: .. code-block:: bash salt '*' firewalld.list_services List a specific zone .. code-block:: bash salt '*' firewalld.list_services my_zone
['List', 'services', 'added', 'for', 'zone', 'as', 'a', 'space', 'separated', 'list', '.', 'If', 'zone', 'is', 'omitted', 'default', 'zone', 'will', 'be', 'used', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/firewalld.py#L354-L379
7,069
ploneintranet/ploneintranet.workspace
src/ploneintranet/workspace/browser/tiles/sidebar.py
Sidebar.children
def children(self): """ returns a list of dicts of items in the current context """ items = [] catalog = self.context.portal_catalog current_path = '/'.join(self.context.getPhysicalPath()) sidebar_search = self.request.get('sidebar-search', None) if sidebar_searc...
python
def children(self): """ returns a list of dicts of items in the current context """ items = [] catalog = self.context.portal_catalog current_path = '/'.join(self.context.getPhysicalPath()) sidebar_search = self.request.get('sidebar-search', None) if sidebar_searc...
['def', 'children', '(', 'self', ')', ':', 'items', '=', '[', ']', 'catalog', '=', 'self', '.', 'context', '.', 'portal_catalog', 'current_path', '=', "'/'", '.', 'join', '(', 'self', '.', 'context', '.', 'getPhysicalPath', '(', ')', ')', 'sidebar_search', '=', 'self', '.', 'request', '.', 'get', '(', "'sidebar-search'...
returns a list of dicts of items in the current context
['returns', 'a', 'list', 'of', 'dicts', 'of', 'items', 'in', 'the', 'current', 'context']
train
https://github.com/ploneintranet/ploneintranet.workspace/blob/a4fc7a5c61f9c6d4d4ad25478ff5250f342ffbba/src/ploneintranet/workspace/browser/tiles/sidebar.py#L223-L286
7,070
pyviz/holoviews
holoviews/plotting/plot.py
GenericElementPlot.get_extents
def get_extents(self, element, ranges, range_type='combined', xdim=None, ydim=None, zdim=None): """ Gets the extents for the axes from the current Element. The globally computed ranges can optionally override the extents. The extents are computed by combining the data ranges, extents ...
python
def get_extents(self, element, ranges, range_type='combined', xdim=None, ydim=None, zdim=None): """ Gets the extents for the axes from the current Element. The globally computed ranges can optionally override the extents. The extents are computed by combining the data ranges, extents ...
['def', 'get_extents', '(', 'self', ',', 'element', ',', 'ranges', ',', 'range_type', '=', "'combined'", ',', 'xdim', '=', 'None', ',', 'ydim', '=', 'None', ',', 'zdim', '=', 'None', ')', ':', 'num', '=', '6', 'if', 'self', '.', 'projection', '==', "'3d'", 'else', '4', 'if', 'self', '.', 'apply_extents', 'and', 'range_...
Gets the extents for the axes from the current Element. The globally computed ranges can optionally override the extents. The extents are computed by combining the data ranges, extents and dimension ranges. Each of these can be obtained individually by setting the range_type to one of: ...
['Gets', 'the', 'extents', 'for', 'the', 'axes', 'from', 'the', 'current', 'Element', '.', 'The', 'globally', 'computed', 'ranges', 'can', 'optionally', 'override', 'the', 'extents', '.']
train
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/plot.py#L983-L1045
7,071
brandon-rhodes/python-sgp4
sgp4/io.py
twoline2rv
def twoline2rv(longstr1, longstr2, whichconst, afspc_mode=False): """Return a Satellite imported from two lines of TLE data. Provide the two TLE lines as strings `longstr1` and `longstr2`, and select which standard set of gravitational constants you want by providing `gravity_constants`: `sgp4.ear...
python
def twoline2rv(longstr1, longstr2, whichconst, afspc_mode=False): """Return a Satellite imported from two lines of TLE data. Provide the two TLE lines as strings `longstr1` and `longstr2`, and select which standard set of gravitational constants you want by providing `gravity_constants`: `sgp4.ear...
['def', 'twoline2rv', '(', 'longstr1', ',', 'longstr2', ',', 'whichconst', ',', 'afspc_mode', '=', 'False', ')', ':', 'deg2rad', '=', 'pi', '/', '180.0', '# 0.0174532925199433', 'xpdotp', '=', '1440.0', '/', '(', '2.0', '*', 'pi', ')', '# 229.1831180523293', 'tumin', '=', 'whichconst', '.', 'tumin', 'satrec', '=', ...
Return a Satellite imported from two lines of TLE data. Provide the two TLE lines as strings `longstr1` and `longstr2`, and select which standard set of gravitational constants you want by providing `gravity_constants`: `sgp4.earth_gravity.wgs72` - Standard WGS 72 model `sgp4.earth_gravity.wgs84` ...
['Return', 'a', 'Satellite', 'imported', 'from', 'two', 'lines', 'of', 'TLE', 'data', '.']
train
https://github.com/brandon-rhodes/python-sgp4/blob/a1e19e32831d6814b3ab34f55b39b8520d291c4e/sgp4/io.py#L102-L232
7,072
sentinel-hub/sentinelhub-py
sentinelhub/ogc.py
WebFeatureService._parse_tile_url
def _parse_tile_url(tile_url): """ Extracts tile name, data and AWS index from tile URL :param tile_url: Location of tile at AWS :type: tile_url: str :return: Tuple in a form (tile_name, date, aws_index) :rtype: (str, str, int) """ props = tile_url.rsplit('/', 7)...
python
def _parse_tile_url(tile_url): """ Extracts tile name, data and AWS index from tile URL :param tile_url: Location of tile at AWS :type: tile_url: str :return: Tuple in a form (tile_name, date, aws_index) :rtype: (str, str, int) """ props = tile_url.rsplit('/', 7)...
['def', '_parse_tile_url', '(', 'tile_url', ')', ':', 'props', '=', 'tile_url', '.', 'rsplit', '(', "'/'", ',', '7', ')', 'return', "''", '.', 'join', '(', 'props', '[', '1', ':', '4', ']', ')', ',', "'-'", '.', 'join', '(', 'props', '[', '4', ':', '7', ']', ')', ',', 'int', '(', 'props', '[', '7', ']', ')']
Extracts tile name, data and AWS index from tile URL :param tile_url: Location of tile at AWS :type: tile_url: str :return: Tuple in a form (tile_name, date, aws_index) :rtype: (str, str, int)
['Extracts', 'tile', 'name', 'data', 'and', 'AWS', 'index', 'from', 'tile', 'URL']
train
https://github.com/sentinel-hub/sentinelhub-py/blob/08a83b7f1e289187159a643336995d8369860fea/sentinelhub/ogc.py#L587-L596
7,073
duniter/duniter-python-api
duniterpy/api/endpoint.py
endpoint
def endpoint(value: Any) -> Any: """ Convert a endpoint string to the corresponding Endpoint instance type :param value: Endpoint string or subclass :return: """ if issubclass(type(value), Endpoint): return value elif isinstance(value, str): for api, cls in MANAGED_API.items...
python
def endpoint(value: Any) -> Any: """ Convert a endpoint string to the corresponding Endpoint instance type :param value: Endpoint string or subclass :return: """ if issubclass(type(value), Endpoint): return value elif isinstance(value, str): for api, cls in MANAGED_API.items...
['def', 'endpoint', '(', 'value', ':', 'Any', ')', '->', 'Any', ':', 'if', 'issubclass', '(', 'type', '(', 'value', ')', ',', 'Endpoint', ')', ':', 'return', 'value', 'elif', 'isinstance', '(', 'value', ',', 'str', ')', ':', 'for', 'api', ',', 'cls', 'in', 'MANAGED_API', '.', 'items', '(', ')', ':', 'if', 'value', '.',...
Convert a endpoint string to the corresponding Endpoint instance type :param value: Endpoint string or subclass :return:
['Convert', 'a', 'endpoint', 'string', 'to', 'the', 'corresponding', 'Endpoint', 'instance', 'type']
train
https://github.com/duniter/duniter-python-api/blob/3a1e5d61a2f72f5afaf29d010c6cf4dff3648165/duniterpy/api/endpoint.py#L547-L562
7,074
btimby/fulltext
fulltext/data/winmake.py
clean
def clean(): """Deletes dev files""" rm("$testfn*") rm("*.bak") rm("*.core") rm("*.egg-info") rm("*.orig") rm("*.pyc") rm("*.pyd") rm("*.pyo") rm("*.rej") rm("*.so") rm("*.~") rm("*__pycache__") rm(".coverage") rm(".tox") rm(".coverage") rm("build") ...
python
def clean(): """Deletes dev files""" rm("$testfn*") rm("*.bak") rm("*.core") rm("*.egg-info") rm("*.orig") rm("*.pyc") rm("*.pyd") rm("*.pyo") rm("*.rej") rm("*.so") rm("*.~") rm("*__pycache__") rm(".coverage") rm(".tox") rm(".coverage") rm("build") ...
['def', 'clean', '(', ')', ':', 'rm', '(', '"$testfn*"', ')', 'rm', '(', '"*.bak"', ')', 'rm', '(', '"*.core"', ')', 'rm', '(', '"*.egg-info"', ')', 'rm', '(', '"*.orig"', ')', 'rm', '(', '"*.pyc"', ')', 'rm', '(', '"*.pyd"', ')', 'rm', '(', '"*.pyo"', ')', 'rm', '(', '"*.rej"', ')', 'rm', '(', '"*.so"', ')', 'rm', '('...
Deletes dev files
['Deletes', 'dev', 'files']
train
https://github.com/btimby/fulltext/blob/9234cc1e2099209430e20317649549026de283ce/fulltext/data/winmake.py#L200-L222
7,075
benhoff/pluginmanager
pluginmanager/module_manager.py
ModuleManager.load_modules
def load_modules(self, filepaths): """ Loads the modules from their `filepaths`. A filepath may be a directory filepath if there is an `__init__.py` file in the directory. If a filepath errors, the exception will be caught and logged in the logger. Returns a lis...
python
def load_modules(self, filepaths): """ Loads the modules from their `filepaths`. A filepath may be a directory filepath if there is an `__init__.py` file in the directory. If a filepath errors, the exception will be caught and logged in the logger. Returns a lis...
['def', 'load_modules', '(', 'self', ',', 'filepaths', ')', ':', '# removes filepaths from processed if they are not in sys.modules', 'self', '.', '_update_loaded_modules', '(', ')', 'filepaths', '=', 'util', '.', 'return_set', '(', 'filepaths', ')', 'modules', '=', '[', ']', 'for', 'filepath', 'in', 'filepaths', ':', ...
Loads the modules from their `filepaths`. A filepath may be a directory filepath if there is an `__init__.py` file in the directory. If a filepath errors, the exception will be caught and logged in the logger. Returns a list of modules.
['Loads', 'the', 'modules', 'from', 'their', 'filepaths', '.', 'A', 'filepath', 'may', 'be', 'a', 'directory', 'filepath', 'if', 'there', 'is', 'an', '__init__', '.', 'py', 'file', 'in', 'the', 'directory', '.']
train
https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/module_manager.py#L45-L84
7,076
limpyd/redis-limpyd
limpyd/fields.py
RedisField.attached_to_model
def attached_to_model(self): """Tells if the current field is the one attached to the model, not instance""" try: if not bool(self._model): return False except AttributeError: return False else: try: return not bool(self...
python
def attached_to_model(self): """Tells if the current field is the one attached to the model, not instance""" try: if not bool(self._model): return False except AttributeError: return False else: try: return not bool(self...
['def', 'attached_to_model', '(', 'self', ')', ':', 'try', ':', 'if', 'not', 'bool', '(', 'self', '.', '_model', ')', ':', 'return', 'False', 'except', 'AttributeError', ':', 'return', 'False', 'else', ':', 'try', ':', 'return', 'not', 'bool', '(', 'self', '.', '_instance', ')', 'except', 'AttributeError', ':', 'return...
Tells if the current field is the one attached to the model, not instance
['Tells', 'if', 'the', 'current', 'field', 'is', 'the', 'one', 'attached', 'to', 'the', 'model', 'not', 'instance']
train
https://github.com/limpyd/redis-limpyd/blob/3c745dde1390a0bd09690b77a089dcc08c6c7e43/limpyd/fields.py#L426-L437
7,077
ailionx/cloudflare-ddns
cloudflare_ddns/cloudflare.py
CloudFlare.create_record
def create_record(self, dns_type, name, content, **kwargs): """ Create a dns record :param dns_type: :param name: :param content: :param kwargs: :return: """ data = { 'type': dns_type, 'name': name, 'content': co...
python
def create_record(self, dns_type, name, content, **kwargs): """ Create a dns record :param dns_type: :param name: :param content: :param kwargs: :return: """ data = { 'type': dns_type, 'name': name, 'content': co...
['def', 'create_record', '(', 'self', ',', 'dns_type', ',', 'name', ',', 'content', ',', '*', '*', 'kwargs', ')', ':', 'data', '=', '{', "'type'", ':', 'dns_type', ',', "'name'", ':', 'name', ',', "'content'", ':', 'content', '}', 'if', 'kwargs', '.', 'get', '(', "'ttl'", ')', 'and', 'kwargs', '[', "'ttl'", ']', '!=', ...
Create a dns record :param dns_type: :param name: :param content: :param kwargs: :return:
['Create', 'a', 'dns', 'record', ':', 'param', 'dns_type', ':', ':', 'param', 'name', ':', ':', 'param', 'content', ':', ':', 'param', 'kwargs', ':', ':', 'return', ':']
train
https://github.com/ailionx/cloudflare-ddns/blob/e4808b8314e447f69fab77b5bd3880846e59adbe/cloudflare_ddns/cloudflare.py#L136-L162
7,078
phac-nml/sistr_cmd
sistr/src/parsers.py
fasta_format_check
def fasta_format_check(fasta_path, logger): """ Check that a file is valid FASTA format. - First non-blank line needs to begin with a '>' header character. - Sequence can only contain valid IUPAC nucleotide characters Args: fasta_str (str): FASTA file contents string Raises: ...
python
def fasta_format_check(fasta_path, logger): """ Check that a file is valid FASTA format. - First non-blank line needs to begin with a '>' header character. - Sequence can only contain valid IUPAC nucleotide characters Args: fasta_str (str): FASTA file contents string Raises: ...
['def', 'fasta_format_check', '(', 'fasta_path', ',', 'logger', ')', ':', 'header_count', '=', '0', 'line_count', '=', '1', 'nt_count', '=', '0', 'with', 'open', '(', 'fasta_path', ')', 'as', 'f', ':', 'for', 'l', 'in', 'f', ':', 'l', '=', 'l', '.', 'strip', '(', ')', 'if', 'l', '==', "''", ':', 'continue', 'if', 'l', ...
Check that a file is valid FASTA format. - First non-blank line needs to begin with a '>' header character. - Sequence can only contain valid IUPAC nucleotide characters Args: fasta_str (str): FASTA file contents string Raises: Exception: If invalid FASTA format
['Check', 'that', 'a', 'file', 'is', 'valid', 'FASTA', 'format', '.']
train
https://github.com/phac-nml/sistr_cmd/blob/4630fae72439723b354a94b94fbe76ad2f9f6295/sistr/src/parsers.py#L64-L110
7,079
PmagPy/PmagPy
programs/demag_gui.py
Demag_GUI.user_warning
def user_warning(self, message, caption='Warning!'): """ Shows a dialog that warns the user about some action Parameters ---------- message : message to display to user caption : title for dialog (default: "Warning!") Returns ------- continue_boo...
python
def user_warning(self, message, caption='Warning!'): """ Shows a dialog that warns the user about some action Parameters ---------- message : message to display to user caption : title for dialog (default: "Warning!") Returns ------- continue_boo...
['def', 'user_warning', '(', 'self', ',', 'message', ',', 'caption', '=', "'Warning!'", ')', ':', 'dlg', '=', 'wx', '.', 'MessageDialog', '(', 'self', ',', 'message', ',', 'caption', ',', 'wx', '.', 'OK', '|', 'wx', '.', 'CANCEL', '|', 'wx', '.', 'ICON_WARNING', ')', 'if', 'self', '.', 'show_dlg', '(', 'dlg', ')', '=='...
Shows a dialog that warns the user about some action Parameters ---------- message : message to display to user caption : title for dialog (default: "Warning!") Returns ------- continue_bool : True or False
['Shows', 'a', 'dialog', 'that', 'warns', 'the', 'user', 'about', 'some', 'action']
train
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/demag_gui.py#L5142-L5162
7,080
Tygs/ww
src/ww/tools/iterables.py
iterslice
def iterslice(iterable, start=0, stop=None, step=1): # type: (Iterable[T], int, int, int) -> Iterable[T] """ Like itertools.islice, but accept int and callables. If `start` is a callable, start the slice after the first time start(item) == True. If `stop` is a callable, stop the slice ...
python
def iterslice(iterable, start=0, stop=None, step=1): # type: (Iterable[T], int, int, int) -> Iterable[T] """ Like itertools.islice, but accept int and callables. If `start` is a callable, start the slice after the first time start(item) == True. If `stop` is a callable, stop the slice ...
['def', 'iterslice', '(', 'iterable', ',', 'start', '=', '0', ',', 'stop', '=', 'None', ',', 'step', '=', '1', ')', ':', '# type: (Iterable[T], int, int, int) -> Iterable[T]', 'if', 'step', '<', '0', ':', 'raise', 'ValueError', '(', '"The step can not be negative: \'%s\' given"', '%', 'step', ')', 'if', 'not', 'isinsta...
Like itertools.islice, but accept int and callables. If `start` is a callable, start the slice after the first time start(item) == True. If `stop` is a callable, stop the slice after the first time stop(item) == True.
['Like', 'itertools', '.', 'islice', 'but', 'accept', 'int', 'and', 'callables', '.']
train
https://github.com/Tygs/ww/blob/6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4/src/ww/tools/iterables.py#L265-L293
7,081
materialsproject/pymatgen
pymatgen/analysis/elasticity/elastic.py
find_eq_stress
def find_eq_stress(strains, stresses, tol=1e-10): """ Finds stress corresponding to zero strain state in stress-strain list Args: strains (Nx3x3 array-like): array corresponding to strains stresses (Nx3x3 array-like): array corresponding to stresses tol (float): tolerance to find ze...
python
def find_eq_stress(strains, stresses, tol=1e-10): """ Finds stress corresponding to zero strain state in stress-strain list Args: strains (Nx3x3 array-like): array corresponding to strains stresses (Nx3x3 array-like): array corresponding to stresses tol (float): tolerance to find ze...
['def', 'find_eq_stress', '(', 'strains', ',', 'stresses', ',', 'tol', '=', '1e-10', ')', ':', 'stress_array', '=', 'np', '.', 'array', '(', 'stresses', ')', 'strain_array', '=', 'np', '.', 'array', '(', 'strains', ')', 'eq_stress', '=', 'stress_array', '[', 'np', '.', 'all', '(', 'abs', '(', 'strain_array', ')', '<', ...
Finds stress corresponding to zero strain state in stress-strain list Args: strains (Nx3x3 array-like): array corresponding to strains stresses (Nx3x3 array-like): array corresponding to stresses tol (float): tolerance to find zero strain state
['Finds', 'stress', 'corresponding', 'to', 'zero', 'strain', 'state', 'in', 'stress', '-', 'strain', 'list']
train
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/elasticity/elastic.py#L890-L913
7,082
djgagne/hagelslag
hagelslag/processing/STObject.py
STObject.calc_attribute_statistic
def calc_attribute_statistic(self, attribute, statistic, time): """ Calculate statistics based on the values of an attribute. The following statistics are supported: mean, max, min, std, ptp (range), median, skew (mean - median), and percentile_(percentile value). Args: attr...
python
def calc_attribute_statistic(self, attribute, statistic, time): """ Calculate statistics based on the values of an attribute. The following statistics are supported: mean, max, min, std, ptp (range), median, skew (mean - median), and percentile_(percentile value). Args: attr...
['def', 'calc_attribute_statistic', '(', 'self', ',', 'attribute', ',', 'statistic', ',', 'time', ')', ':', 'ti', '=', 'np', '.', 'where', '(', 'self', '.', 'times', '==', 'time', ')', '[', '0', ']', '[', '0', ']', 'ma', '=', 'np', '.', 'where', '(', 'self', '.', 'masks', '[', 'ti', ']', '.', 'ravel', '(', ')', '==', '...
Calculate statistics based on the values of an attribute. The following statistics are supported: mean, max, min, std, ptp (range), median, skew (mean - median), and percentile_(percentile value). Args: attribute: Attribute extracted from model grid statistic: Name of statistic ...
['Calculate', 'statistics', 'based', 'on', 'the', 'values', 'of', 'an', 'attribute', '.', 'The', 'following', 'statistics', 'are', 'supported', ':', 'mean', 'max', 'min', 'std', 'ptp', '(', 'range', ')', 'median', 'skew', '(', 'mean', '-', 'median', ')', 'and', 'percentile_', '(', 'percentile', 'value', ')', '.']
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L385-L419
7,083
hyperledger/sawtooth-core
cli/sawtooth_cli/parent_parsers.py
base_http_parser
def base_http_parser(): """Creates a parser with arguments specific to sending an HTTP request to the REST API. Returns: {ArgumentParser}: Base parser with default HTTP args """ base_parser = ArgumentParser(add_help=False) base_parser.add_argument( '--url', type=str, ...
python
def base_http_parser(): """Creates a parser with arguments specific to sending an HTTP request to the REST API. Returns: {ArgumentParser}: Base parser with default HTTP args """ base_parser = ArgumentParser(add_help=False) base_parser.add_argument( '--url', type=str, ...
['def', 'base_http_parser', '(', ')', ':', 'base_parser', '=', 'ArgumentParser', '(', 'add_help', '=', 'False', ')', 'base_parser', '.', 'add_argument', '(', "'--url'", ',', 'type', '=', 'str', ',', 'help', '=', '"identify the URL of the validator\'s REST API "', '"(default: http://localhost:8008)"', ')', 'base_parser'...
Creates a parser with arguments specific to sending an HTTP request to the REST API. Returns: {ArgumentParser}: Base parser with default HTTP args
['Creates', 'a', 'parser', 'with', 'arguments', 'specific', 'to', 'sending', 'an', 'HTTP', 'request', 'to', 'the', 'REST', 'API', '.']
train
https://github.com/hyperledger/sawtooth-core/blob/8cf473bc2207e51f02bd182d825158a57d72b098/cli/sawtooth_cli/parent_parsers.py#L19-L39
7,084
tjcsl/cslbot
cslbot/helpers/babble.py
build_markov
def build_markov(cursor, cmdchar, ctrlchan, speaker=None, initial_run=False, debug=False): """Builds a markov dictionary.""" if initial_run: cursor.query(Babble_last).delete() lastrow = cursor.query(Babble_last).first() if not lastrow: lastrow = Babble_last(last=0) cursor.add(las...
python
def build_markov(cursor, cmdchar, ctrlchan, speaker=None, initial_run=False, debug=False): """Builds a markov dictionary.""" if initial_run: cursor.query(Babble_last).delete() lastrow = cursor.query(Babble_last).first() if not lastrow: lastrow = Babble_last(last=0) cursor.add(las...
['def', 'build_markov', '(', 'cursor', ',', 'cmdchar', ',', 'ctrlchan', ',', 'speaker', '=', 'None', ',', 'initial_run', '=', 'False', ',', 'debug', '=', 'False', ')', ':', 'if', 'initial_run', ':', 'cursor', '.', 'query', '(', 'Babble_last', ')', '.', 'delete', '(', ')', 'lastrow', '=', 'cursor', '.', 'query', '(', 'B...
Builds a markov dictionary.
['Builds', 'a', 'markov', 'dictionary', '.']
train
https://github.com/tjcsl/cslbot/blob/aebe07be47141f61d7c180706bddfb707f19b2b5/cslbot/helpers/babble.py#L153-L206
7,085
vnmabus/dcor
dcor/_pairwise.py
pairwise
def pairwise(function, x, y=None, **kwargs): """ pairwise(function, x, y=None, *, pool=None, is_symmetric=None, **kwargs) Computes a dependency measure between each pair of elements. Parameters ---------- function: Dependency measure function. x: iterable of array_like First list o...
python
def pairwise(function, x, y=None, **kwargs): """ pairwise(function, x, y=None, *, pool=None, is_symmetric=None, **kwargs) Computes a dependency measure between each pair of elements. Parameters ---------- function: Dependency measure function. x: iterable of array_like First list o...
['def', 'pairwise', '(', 'function', ',', 'x', ',', 'y', '=', 'None', ',', '*', '*', 'kwargs', ')', ':', 'return', '_pairwise_imp', '(', 'function', ',', 'x', ',', 'y', ',', '*', '*', 'kwargs', ')']
pairwise(function, x, y=None, *, pool=None, is_symmetric=None, **kwargs) Computes a dependency measure between each pair of elements. Parameters ---------- function: Dependency measure function. x: iterable of array_like First list of random vectors. The columns of each vector correspond ...
['pairwise', '(', 'function', 'x', 'y', '=', 'None', '*', 'pool', '=', 'None', 'is_symmetric', '=', 'None', '**', 'kwargs', ')']
train
https://github.com/vnmabus/dcor/blob/b0ff1273c0a52efdabdfdadefc7ff2a49def7e8d/dcor/_pairwise.py#L10-L94
7,086
collectiveacuity/labPack
labpack/records/time.py
labDT.fromISO
def fromISO(cls, iso_string): ''' a method for constructing a labDT object from a timezone aware ISO string :param iso_string: string with date and time info in ISO format :return: labDT object ''' # validate input title = 'ISO time input for labDT.fromISO...
python
def fromISO(cls, iso_string): ''' a method for constructing a labDT object from a timezone aware ISO string :param iso_string: string with date and time info in ISO format :return: labDT object ''' # validate input title = 'ISO time input for labDT.fromISO...
['def', 'fromISO', '(', 'cls', ',', 'iso_string', ')', ':', '# validate input\r', 'title', '=', "'ISO time input for labDT.fromISO'", 'isopattern', '=', 're', '.', 'compile', '(', "'\\d{4}-?\\d{2}-?\\d{2}[\\s|T].*'", ')', 'if', 'not', 'isopattern', '.', 'search', '(', 'iso_string', ')', ':', 'raise', 'ValueError', '(',...
a method for constructing a labDT object from a timezone aware ISO string :param iso_string: string with date and time info in ISO format :return: labDT object
['a', 'method', 'for', 'constructing', 'a', 'labDT', 'object', 'from', 'a', 'timezone', 'aware', 'ISO', 'string', ':', 'param', 'iso_string', ':', 'string', 'with', 'date', 'and', 'time', 'info', 'in', 'ISO', 'format', ':', 'return', ':', 'labDT', 'object']
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/records/time.py#L209-L238
7,087
Microsoft/nni
src/sdk/pynni/nni/networkmorphism_tuner/layers.py
layer_description_extractor
def layer_description_extractor(layer, node_to_id): '''get layer description. ''' layer_input = layer.input layer_output = layer.output if layer_input is not None: if isinstance(layer_input, Iterable): layer_input = list(map(lambda x: node_to_id[x], layer_input)) else: ...
python
def layer_description_extractor(layer, node_to_id): '''get layer description. ''' layer_input = layer.input layer_output = layer.output if layer_input is not None: if isinstance(layer_input, Iterable): layer_input = list(map(lambda x: node_to_id[x], layer_input)) else: ...
['def', 'layer_description_extractor', '(', 'layer', ',', 'node_to_id', ')', ':', 'layer_input', '=', 'layer', '.', 'input', 'layer_output', '=', 'layer', '.', 'output', 'if', 'layer_input', 'is', 'not', 'None', ':', 'if', 'isinstance', '(', 'layer_input', ',', 'Iterable', ')', ':', 'layer_input', '=', 'list', '(', 'ma...
get layer description.
['get', 'layer', 'description', '.']
train
https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/src/sdk/pynni/nni/networkmorphism_tuner/layers.py#L613-L661
7,088
InfoAgeTech/django-core
django_core/auth/views.py
AuthorizationTokenRequiredViewMixin.get_authorization
def get_authorization(self, **kwargs): """Gets the authorization object for the view.""" if self.authorization is not None: return self.authorization auth_class = self.get_authorization_class() auth_user = self.get_authorization_user() auth_kwargs = { 'to...
python
def get_authorization(self, **kwargs): """Gets the authorization object for the view.""" if self.authorization is not None: return self.authorization auth_class = self.get_authorization_class() auth_user = self.get_authorization_user() auth_kwargs = { 'to...
['def', 'get_authorization', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'if', 'self', '.', 'authorization', 'is', 'not', 'None', ':', 'return', 'self', '.', 'authorization', 'auth_class', '=', 'self', '.', 'get_authorization_class', '(', ')', 'auth_user', '=', 'self', '.', 'get_authorization_user', '(', ')', 'auth...
Gets the authorization object for the view.
['Gets', 'the', 'authorization', 'object', 'for', 'the', 'view', '.']
train
https://github.com/InfoAgeTech/django-core/blob/9664a145473b75120bf71e1644e9c8086e7e8955/django_core/auth/views.py#L31-L48
7,089
wandb/client
wandb/apis/file_stream.py
FileStreamApi._handle_response
def _handle_response(self, response): """Logs dropped chunks and updates dynamic settings""" if isinstance(response, Exception): logging.error("dropped chunk %s" % response) elif response.json().get("limits"): parsed = response.json() self._api.dynamic_setting...
python
def _handle_response(self, response): """Logs dropped chunks and updates dynamic settings""" if isinstance(response, Exception): logging.error("dropped chunk %s" % response) elif response.json().get("limits"): parsed = response.json() self._api.dynamic_setting...
['def', '_handle_response', '(', 'self', ',', 'response', ')', ':', 'if', 'isinstance', '(', 'response', ',', 'Exception', ')', ':', 'logging', '.', 'error', '(', '"dropped chunk %s"', '%', 'response', ')', 'elif', 'response', '.', 'json', '(', ')', '.', 'get', '(', '"limits"', ')', ':', 'parsed', '=', 'response', '.',...
Logs dropped chunks and updates dynamic settings
['Logs', 'dropped', 'chunks', 'and', 'updates', 'dynamic', 'settings']
train
https://github.com/wandb/client/blob/7d08954ed5674fee223cd85ed0d8518fe47266b2/wandb/apis/file_stream.py#L179-L185
7,090
tilezen/tilequeue
tilequeue/rawr.py
SqsQueue.done
def done(self, msg_handle): """acknowledge completion of message""" self.sqs_client.delete_message( QueueUrl=self.queue_url, ReceiptHandle=msg_handle.handle, )
python
def done(self, msg_handle): """acknowledge completion of message""" self.sqs_client.delete_message( QueueUrl=self.queue_url, ReceiptHandle=msg_handle.handle, )
['def', 'done', '(', 'self', ',', 'msg_handle', ')', ':', 'self', '.', 'sqs_client', '.', 'delete_message', '(', 'QueueUrl', '=', 'self', '.', 'queue_url', ',', 'ReceiptHandle', '=', 'msg_handle', '.', 'handle', ',', ')']
acknowledge completion of message
['acknowledge', 'completion', 'of', 'message']
train
https://github.com/tilezen/tilequeue/blob/d7b9484ab92e246eb2773949c784ebb37c731e28/tilequeue/rawr.py#L129-L134
7,091
scarface-4711/denonavr
denonavr/denonavr.py
DenonAVR._update_avr
def _update_avr(self): """ Get the latest status information from device. Method queries device via HTTP and updates instance attributes. Returns "True" on success and "False" on fail. This method is for pre 2016 AVR(-X) devices """ # Set all tags to be evaluated...
python
def _update_avr(self): """ Get the latest status information from device. Method queries device via HTTP and updates instance attributes. Returns "True" on success and "False" on fail. This method is for pre 2016 AVR(-X) devices """ # Set all tags to be evaluated...
['def', '_update_avr', '(', 'self', ')', ':', '# Set all tags to be evaluated', 'relevant_tags', '=', '{', '"Power"', ':', 'None', ',', '"InputFuncSelect"', ':', 'None', ',', '"Mute"', ':', 'None', ',', '"MasterVolume"', ':', 'None', '}', '# Sound mode information only available in main zone', 'if', 'self', '.', '_zone...
Get the latest status information from device. Method queries device via HTTP and updates instance attributes. Returns "True" on success and "False" on fail. This method is for pre 2016 AVR(-X) devices
['Get', 'the', 'latest', 'status', 'information', 'from', 'device', '.']
train
https://github.com/scarface-4711/denonavr/blob/59a136e27b43cb1d1e140cf67705087b3aa377cd/denonavr/denonavr.py#L410-L501
7,092
miquelo/resort
packages/resort/component/glassfish.py
JDBCConnectionPool.insert
def insert(self, context): """ Create connection pool. :param resort.engine.execution.Context context: Current execution context. """ status_code, msg = self.__endpoint.post( "/resources/jdbc-connection-pool", data={ "id": self.__name, "resType": self.__res_type, "datasourceClas...
python
def insert(self, context): """ Create connection pool. :param resort.engine.execution.Context context: Current execution context. """ status_code, msg = self.__endpoint.post( "/resources/jdbc-connection-pool", data={ "id": self.__name, "resType": self.__res_type, "datasourceClas...
['def', 'insert', '(', 'self', ',', 'context', ')', ':', 'status_code', ',', 'msg', '=', 'self', '.', '__endpoint', '.', 'post', '(', '"/resources/jdbc-connection-pool"', ',', 'data', '=', '{', '"id"', ':', 'self', '.', '__name', ',', '"resType"', ':', 'self', '.', '__res_type', ',', '"datasourceClassname"', ':', 'self...
Create connection pool. :param resort.engine.execution.Context context: Current execution context.
['Create', 'connection', 'pool', '.', ':', 'param', 'resort', '.', 'engine', '.', 'execution', '.', 'Context', 'context', ':', 'Current', 'execution', 'context', '.']
train
https://github.com/miquelo/resort/blob/097a25d3257c91a75c194fd44c2797ab356f85dd/packages/resort/component/glassfish.py#L783-L801
7,093
coursera-dl/coursera-dl
coursera/api.py
CourseraOnDemand.extract_links_from_peer_assignment
def extract_links_from_peer_assignment(self, element_id): """ Return a dictionary with links to supplement files (pdf, csv, zip, ipynb, html and so on) extracted from peer assignment. @param element_id: Element ID to extract files from. @type element_id: str @return: @s...
python
def extract_links_from_peer_assignment(self, element_id): """ Return a dictionary with links to supplement files (pdf, csv, zip, ipynb, html and so on) extracted from peer assignment. @param element_id: Element ID to extract files from. @type element_id: str @return: @s...
['def', 'extract_links_from_peer_assignment', '(', 'self', ',', 'element_id', ')', ':', 'logging', '.', 'debug', '(', "'Gathering supplement URLs for element_id <%s>.'", ',', 'element_id', ')', 'try', ':', '# Assignment text (instructions) contains asset tags which describe', '# supplementary files.', 'text', '=', "''"...
Return a dictionary with links to supplement files (pdf, csv, zip, ipynb, html and so on) extracted from peer assignment. @param element_id: Element ID to extract files from. @type element_id: str @return: @see CourseraOnDemand._extract_links_from_text
['Return', 'a', 'dictionary', 'with', 'links', 'to', 'supplement', 'files', '(', 'pdf', 'csv', 'zip', 'ipynb', 'html', 'and', 'so', 'on', ')', 'extracted', 'from', 'peer', 'assignment', '.']
train
https://github.com/coursera-dl/coursera-dl/blob/9b434bcf3c4011bf3181429fe674633ae5fb7d4d/coursera/api.py#L1204-L1236
7,094
openego/eDisGo
edisgo/grid/network.py
TimeSeriesControl._worst_case_generation
def _worst_case_generation(self, worst_case_scale_factors, modes): """ Define worst case generation time series for fluctuating and dispatchable generators. Parameters ---------- worst_case_scale_factors : dict Scale factors defined in config file 'config_tim...
python
def _worst_case_generation(self, worst_case_scale_factors, modes): """ Define worst case generation time series for fluctuating and dispatchable generators. Parameters ---------- worst_case_scale_factors : dict Scale factors defined in config file 'config_tim...
['def', '_worst_case_generation', '(', 'self', ',', 'worst_case_scale_factors', ',', 'modes', ')', ':', 'self', '.', 'timeseries', '.', 'generation_fluctuating', '=', 'pd', '.', 'DataFrame', '(', '{', "'solar'", ':', '[', 'worst_case_scale_factors', '[', "'{}_feedin_pv'", '.', 'format', '(', 'mode', ')', ']', 'for', 'm...
Define worst case generation time series for fluctuating and dispatchable generators. Parameters ---------- worst_case_scale_factors : dict Scale factors defined in config file 'config_timeseries.cfg'. Scale factors describe actual power to nominal power ratio of...
['Define', 'worst', 'case', 'generation', 'time', 'series', 'for', 'fluctuating', 'and', 'dispatchable', 'generators', '.']
train
https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/grid/network.py#L1444-L1471
7,095
KnightHawk3/Hummingbird
hummingbird/__init__.py
Hummingbird._query_
def _query_(self, path, method, params={}): """Used internally for requests. :param str path: The path to hit. :param str method: The method to use, either `'GET'` or `'POST.` :param dict data: The optional paramters to the `GET` or the data to `POST`. :returns: ...
python
def _query_(self, path, method, params={}): """Used internally for requests. :param str path: The path to hit. :param str method: The method to use, either `'GET'` or `'POST.` :param dict data: The optional paramters to the `GET` or the data to `POST`. :returns: ...
['def', '_query_', '(', 'self', ',', 'path', ',', 'method', ',', 'params', '=', '{', '}', ')', ':', 'if', 'method', '==', '"POST"', ':', 'url', '=', "'{API_URL}{API_PATH}'", '.', 'format', '(', 'API_URL', '=', 'self', '.', 'api_url', ',', 'API_PATH', '=', 'path', ')', 'r', '=', 'requests', '.', 'post', '(', 'url', ',',...
Used internally for requests. :param str path: The path to hit. :param str method: The method to use, either `'GET'` or `'POST.` :param dict data: The optional paramters to the `GET` or the data to `POST`. :returns: Requests object -- Requires you to handle the ...
['Used', 'internally', 'for', 'requests', '.']
train
https://github.com/KnightHawk3/Hummingbird/blob/10b918534b112c95a93f04dd76bfb7479c4f3f21/hummingbird/__init__.py#L27-L50
7,096
bxlab/bx-python
lib/bx_extras/pstat.py
duplicates
def duplicates(inlist): """ Returns duplicate items in the FIRST dimension of the passed list. Usage: duplicates (inlist) """ dups = [] for i in range(len(inlist)): if inlist[i] in inlist[i+1:]: dups.append(inlist[i]) return dups
python
def duplicates(inlist): """ Returns duplicate items in the FIRST dimension of the passed list. Usage: duplicates (inlist) """ dups = [] for i in range(len(inlist)): if inlist[i] in inlist[i+1:]: dups.append(inlist[i]) return dups
['def', 'duplicates', '(', 'inlist', ')', ':', 'dups', '=', '[', ']', 'for', 'i', 'in', 'range', '(', 'len', '(', 'inlist', ')', ')', ':', 'if', 'inlist', '[', 'i', ']', 'in', 'inlist', '[', 'i', '+', '1', ':', ']', ':', 'dups', '.', 'append', '(', 'inlist', '[', 'i', ']', ')', 'return', 'dups']
Returns duplicate items in the FIRST dimension of the passed list. Usage: duplicates (inlist)
['Returns', 'duplicate', 'items', 'in', 'the', 'FIRST', 'dimension', 'of', 'the', 'passed', 'list', '.']
train
https://github.com/bxlab/bx-python/blob/09cb725284803df90a468d910f2274628d8647de/lib/bx_extras/pstat.py#L676-L686
7,097
d0c-s4vage/pfp
pfp/interp.py
PfpInterp._handle_for
def _handle_for(self, node, scope, ctxt, stream): """Handle For nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling for") if node.init is not None: # perform the init self._hand...
python
def _handle_for(self, node, scope, ctxt, stream): """Handle For nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO """ self._dlog("handling for") if node.init is not None: # perform the init self._hand...
['def', '_handle_for', '(', 'self', ',', 'node', ',', 'scope', ',', 'ctxt', ',', 'stream', ')', ':', 'self', '.', '_dlog', '(', '"handling for"', ')', 'if', 'node', '.', 'init', 'is', 'not', 'None', ':', '# perform the init', 'self', '.', '_handle_node', '(', 'node', '.', 'init', ',', 'scope', ',', 'ctxt', ',', 'stream...
Handle For nodes :node: TODO :scope: TODO :ctxt: TODO :stream: TODO :returns: TODO
['Handle', 'For', 'nodes']
train
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/interp.py#L2060-L2090
7,098
gem/oq-engine
openquake/hazardlib/contexts.py
ContextMaker.add_rup_params
def add_rup_params(self, rupture): """ Add .REQUIRES_RUPTURE_PARAMETERS to the rupture """ for param in self.REQUIRES_RUPTURE_PARAMETERS: if param == 'mag': value = rupture.mag elif param == 'strike': value = rupture.surface.get_str...
python
def add_rup_params(self, rupture): """ Add .REQUIRES_RUPTURE_PARAMETERS to the rupture """ for param in self.REQUIRES_RUPTURE_PARAMETERS: if param == 'mag': value = rupture.mag elif param == 'strike': value = rupture.surface.get_str...
['def', 'add_rup_params', '(', 'self', ',', 'rupture', ')', ':', 'for', 'param', 'in', 'self', '.', 'REQUIRES_RUPTURE_PARAMETERS', ':', 'if', 'param', '==', "'mag'", ':', 'value', '=', 'rupture', '.', 'mag', 'elif', 'param', '==', "'strike'", ':', 'value', '=', 'rupture', '.', 'surface', '.', 'get_strike', '(', ')', 'e...
Add .REQUIRES_RUPTURE_PARAMETERS to the rupture
['Add', '.', 'REQUIRES_RUPTURE_PARAMETERS', 'to', 'the', 'rupture']
train
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/contexts.py#L146-L172
7,099
StackStorm/pybind
pybind/slxos/v17r_1_01a/interface/ethernet/__init__.py
ethernet._set_link_error_disable
def _set_link_error_disable(self, v, load=False): """ Setter method for link_error_disable, mapped from YANG variable /interface/ethernet/link_error_disable (container) If this variable is read-only (config: false) in the source YANG file, then _set_link_error_disable is considered as a private meth...
python
def _set_link_error_disable(self, v, load=False): """ Setter method for link_error_disable, mapped from YANG variable /interface/ethernet/link_error_disable (container) If this variable is read-only (config: false) in the source YANG file, then _set_link_error_disable is considered as a private meth...
['def', '_set_link_error_disable', '(', 'self', ',', 'v', ',', 'load', '=', 'False', ')', ':', 'if', 'hasattr', '(', 'v', ',', '"_utype"', ')', ':', 'v', '=', 'v', '.', '_utype', '(', 'v', ')', 'try', ':', 't', '=', 'YANGDynClass', '(', 'v', ',', 'base', '=', 'link_error_disable', '.', 'link_error_disable', ',', 'is_co...
Setter method for link_error_disable, mapped from YANG variable /interface/ethernet/link_error_disable (container) If this variable is read-only (config: false) in the source YANG file, then _set_link_error_disable is considered as a private method. Backends looking to populate this variable should do s...
['Setter', 'method', 'for', 'link_error_disable', 'mapped', 'from', 'YANG', 'variable', '/', 'interface', '/', 'ethernet', '/', 'link_error_disable', '(', 'container', ')', 'If', 'this', 'variable', 'is', 'read', '-', 'only', '(', 'config', ':', 'false', ')', 'in', 'the', 'source', 'YANG', 'file', 'then', '_set_link_er...
train
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17r_1_01a/interface/ethernet/__init__.py#L1514-L1535