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
2,800
pyusb/pyusb
usb/core.py
show_devices
def show_devices(verbose=False, **kwargs): """Show information about connected devices. The verbose flag sets to verbose or not. **kwargs are passed directly to the find() function. """ kwargs["find_all"] = True devices = find(**kwargs) strings = "" for device in devices: if not...
python
def show_devices(verbose=False, **kwargs): """Show information about connected devices. The verbose flag sets to verbose or not. **kwargs are passed directly to the find() function. """ kwargs["find_all"] = True devices = find(**kwargs) strings = "" for device in devices: if not...
['def', 'show_devices', '(', 'verbose', '=', 'False', ',', '*', '*', 'kwargs', ')', ':', 'kwargs', '[', '"find_all"', ']', '=', 'True', 'devices', '=', 'find', '(', '*', '*', 'kwargs', ')', 'strings', '=', '""', 'for', 'device', 'in', 'devices', ':', 'if', 'not', 'verbose', ':', 'strings', '+=', '"%s, %s\\n"', '%', '('...
Show information about connected devices. The verbose flag sets to verbose or not. **kwargs are passed directly to the find() function.
['Show', 'information', 'about', 'connected', 'devices', '.']
train
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/usb/core.py#L1275-L1291
2,801
base4sistemas/satcomum
satcomum/br.py
as_cnpj
def as_cnpj(numero): """Formata um número de CNPJ. Se o número não for um CNPJ válido apenas retorna o argumento sem qualquer modificação. """ _num = digitos(numero) if is_cnpj(_num): return '{}.{}.{}/{}-{}'.format( _num[:2], _num[2:5], _num[5:8], _num[8:12], _num[12:]) r...
python
def as_cnpj(numero): """Formata um número de CNPJ. Se o número não for um CNPJ válido apenas retorna o argumento sem qualquer modificação. """ _num = digitos(numero) if is_cnpj(_num): return '{}.{}.{}/{}-{}'.format( _num[:2], _num[2:5], _num[5:8], _num[8:12], _num[12:]) r...
['def', 'as_cnpj', '(', 'numero', ')', ':', '_num', '=', 'digitos', '(', 'numero', ')', 'if', 'is_cnpj', '(', '_num', ')', ':', 'return', "'{}.{}.{}/{}-{}'", '.', 'format', '(', '_num', '[', ':', '2', ']', ',', '_num', '[', '2', ':', '5', ']', ',', '_num', '[', '5', ':', '8', ']', ',', '_num', '[', '8', ':', '12', ']',...
Formata um número de CNPJ. Se o número não for um CNPJ válido apenas retorna o argumento sem qualquer modificação.
['Formata', 'um', 'número', 'de', 'CNPJ', '.', 'Se', 'o', 'número', 'não', 'for', 'um', 'CNPJ', 'válido', 'apenas', 'retorna', 'o', 'argumento', 'sem', 'qualquer', 'modificação', '.']
train
https://github.com/base4sistemas/satcomum/blob/b42bec06cb0fb0ad2f6b1a2644a1e8fc8403f2c3/satcomum/br.py#L171-L179
2,802
AndrewAnnex/SpiceyPy
spiceypy/spiceypy.py
lx4num
def lx4num(string, first): """ Scan a string from a specified starting position for the end of a number. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lx4num_c.html :param string: Any character string. :type string: str :param first: First character to scan from in string. :t...
python
def lx4num(string, first): """ Scan a string from a specified starting position for the end of a number. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lx4num_c.html :param string: Any character string. :type string: str :param first: First character to scan from in string. :t...
['def', 'lx4num', '(', 'string', ',', 'first', ')', ':', 'string', '=', 'stypes', '.', 'stringToCharP', '(', 'string', ')', 'first', '=', 'ctypes', '.', 'c_int', '(', 'first', ')', 'last', '=', 'ctypes', '.', 'c_int', '(', ')', 'nchar', '=', 'ctypes', '.', 'c_int', '(', ')', 'libspice', '.', 'lx4num_c', '(', 'string', ...
Scan a string from a specified starting position for the end of a number. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/lx4num_c.html :param string: Any character string. :type string: str :param first: First character to scan from in string. :type first: int :return: last and nc...
['Scan', 'a', 'string', 'from', 'a', 'specified', 'starting', 'position', 'for', 'the', 'end', 'of', 'a', 'number', '.']
train
https://github.com/AndrewAnnex/SpiceyPy/blob/fc20a9b9de68b58eed5b332f0c051fb343a6e335/spiceypy/spiceypy.py#L8282-L8301
2,803
openvax/topiary
topiary/filters.py
apply_effect_expression_filters
def apply_effect_expression_filters( effects, gene_expression_dict, gene_expression_threshold, transcript_expression_dict, transcript_expression_threshold): """ Filter collection of varcode effects by given gene and transcript expression thresholds. Parameters ...
python
def apply_effect_expression_filters( effects, gene_expression_dict, gene_expression_threshold, transcript_expression_dict, transcript_expression_threshold): """ Filter collection of varcode effects by given gene and transcript expression thresholds. Parameters ...
['def', 'apply_effect_expression_filters', '(', 'effects', ',', 'gene_expression_dict', ',', 'gene_expression_threshold', ',', 'transcript_expression_dict', ',', 'transcript_expression_threshold', ')', ':', 'if', 'gene_expression_dict', ':', 'effects', '=', 'apply_filter', '(', 'lambda', 'effect', ':', '(', 'gene_expre...
Filter collection of varcode effects by given gene and transcript expression thresholds. Parameters ---------- effects : varcode.EffectCollection gene_expression_dict : dict gene_expression_threshold : float transcript_expression_dict : dict transcript_expression_threshold : float
['Filter', 'collection', 'of', 'varcode', 'effects', 'by', 'given', 'gene', 'and', 'transcript', 'expression', 'thresholds', '.']
train
https://github.com/openvax/topiary/blob/04f0077bc4bf1ad350a0e78c26fa48c55fe7813b/topiary/filters.py#L109-L151
2,804
svenevs/exhale
exhale/configs.py
apply_sphinx_configurations
def apply_sphinx_configurations(app): ''' This method applies the various configurations users place in their ``conf.py``, in the dictionary ``exhale_args``. The error checking seems to be robust, and borderline obsessive, but there may very well be some glaring flaws. When the user requests for t...
python
def apply_sphinx_configurations(app): ''' This method applies the various configurations users place in their ``conf.py``, in the dictionary ``exhale_args``. The error checking seems to be robust, and borderline obsessive, but there may very well be some glaring flaws. When the user requests for t...
['def', 'apply_sphinx_configurations', '(', 'app', ')', ':', '# Import local to function to prevent circular imports elsewhere in the framework.', 'from', '.', 'import', 'deploy', 'from', '.', 'import', 'utils', '####################################################################################', '# Make sure they ha...
This method applies the various configurations users place in their ``conf.py``, in the dictionary ``exhale_args``. The error checking seems to be robust, and borderline obsessive, but there may very well be some glaring flaws. When the user requests for the ``treeView`` to be created, this method is also...
['This', 'method', 'applies', 'the', 'various', 'configurations', 'users', 'place', 'in', 'their', 'conf', '.', 'py', 'in', 'the', 'dictionary', 'exhale_args', '.', 'The', 'error', 'checking', 'seems', 'to', 'be', 'robust', 'and', 'borderline', 'obsessive', 'but', 'there', 'may', 'very', 'well', 'be', 'some', 'glaring'...
train
https://github.com/svenevs/exhale/blob/fe7644829057af622e467bb529db6c03a830da99/exhale/configs.py#L1190-L1810
2,805
bcbio/bcbio-nextgen
bcbio/variation/vcfanno.py
run
def run(vcf, conf_fns, lua_fns, data, basepath=None, decomposed=False): """Annotate a VCF file using vcfanno (https://github.com/brentp/vcfanno) decomposed -- if set to true we'll convert allele based output into single values to match alleles and make compatible with vcf2db (https://github.com/qui...
python
def run(vcf, conf_fns, lua_fns, data, basepath=None, decomposed=False): """Annotate a VCF file using vcfanno (https://github.com/brentp/vcfanno) decomposed -- if set to true we'll convert allele based output into single values to match alleles and make compatible with vcf2db (https://github.com/qui...
['def', 'run', '(', 'vcf', ',', 'conf_fns', ',', 'lua_fns', ',', 'data', ',', 'basepath', '=', 'None', ',', 'decomposed', '=', 'False', ')', ':', 'conf_fns', '.', 'sort', '(', 'key', '=', 'lambda', 'x', ':', 'os', '.', 'path', '.', 'basename', '(', 'x', ')', 'if', 'x', 'else', '""', ')', 'lua_fns', '.', 'sort', '(', 'k...
Annotate a VCF file using vcfanno (https://github.com/brentp/vcfanno) decomposed -- if set to true we'll convert allele based output into single values to match alleles and make compatible with vcf2db (https://github.com/quinlan-lab/vcf2db/issues/14)
['Annotate', 'a', 'VCF', 'file', 'using', 'vcfanno', '(', 'https', ':', '//', 'github', '.', 'com', '/', 'brentp', '/', 'vcfanno', ')']
train
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vcfanno.py#L18-L45
2,806
project-rig/rig
rig/geometry.py
spinn5_eth_coords
def spinn5_eth_coords(width, height, root_x=0, root_y=0): """Generate a list of board coordinates with Ethernet connectivity in a SpiNNaker machine. Specifically, generates the coordinates for the Ethernet connected chips of SpiNN-5 boards arranged in a standard torus topology. .. warning:: ...
python
def spinn5_eth_coords(width, height, root_x=0, root_y=0): """Generate a list of board coordinates with Ethernet connectivity in a SpiNNaker machine. Specifically, generates the coordinates for the Ethernet connected chips of SpiNN-5 boards arranged in a standard torus topology. .. warning:: ...
['def', 'spinn5_eth_coords', '(', 'width', ',', 'height', ',', 'root_x', '=', '0', ',', 'root_y', '=', '0', ')', ':', '# In oddly-shaped machines where chip (0, 0) does not exist, we must offset', "# the coordinates returned in accordance with the root chip's location.", 'root_x', '%=', '12', 'root_x', '%=', '12', '# I...
Generate a list of board coordinates with Ethernet connectivity in a SpiNNaker machine. Specifically, generates the coordinates for the Ethernet connected chips of SpiNN-5 boards arranged in a standard torus topology. .. warning:: In general, applications should use :py:class:`rig.mac...
['Generate', 'a', 'list', 'of', 'board', 'coordinates', 'with', 'Ethernet', 'connectivity', 'in', 'a', 'SpiNNaker', 'machine', '.']
train
https://github.com/project-rig/rig/blob/3a3e053d3214899b6d68758685835de0afd5542b/rig/geometry.py#L281-L328
2,807
ev3dev/ev3dev-lang-python
ev3dev2/sensor/lego.py
UltrasonicSensor.distance_inches_continuous
def distance_inches_continuous(self): """ Measurement of the distance detected by the sensor, in inches. The sensor will continue to take measurements so they are available for future reads. Prefer using the equivalent :meth:`UltrasonicSensor.distance_inches` property. ...
python
def distance_inches_continuous(self): """ Measurement of the distance detected by the sensor, in inches. The sensor will continue to take measurements so they are available for future reads. Prefer using the equivalent :meth:`UltrasonicSensor.distance_inches` property. ...
['def', 'distance_inches_continuous', '(', 'self', ')', ':', 'self', '.', '_ensure_mode', '(', 'self', '.', 'MODE_US_DIST_IN', ')', 'return', 'self', '.', 'value', '(', '0', ')', '*', 'self', '.', '_scale', '(', "'US_DIST_IN'", ')']
Measurement of the distance detected by the sensor, in inches. The sensor will continue to take measurements so they are available for future reads. Prefer using the equivalent :meth:`UltrasonicSensor.distance_inches` property.
['Measurement', 'of', 'the', 'distance', 'detected', 'by', 'the', 'sensor', 'in', 'inches', '.']
train
https://github.com/ev3dev/ev3dev-lang-python/blob/afc98d35004b533dc161a01f7c966e78607d7c1e/ev3dev2/sensor/lego.py#L494-L505
2,808
tanghaibao/jcvi
jcvi/formats/sam.py
ace
def ace(args): """ %prog ace bamfile fastafile convert bam format to ace format. This often allows the remapping to be assessed as a denovo assembly format. bam file needs to be indexed. also creates a .mates file to be used in amos/bambus, and .astat file to mark whether the contig is unique o...
python
def ace(args): """ %prog ace bamfile fastafile convert bam format to ace format. This often allows the remapping to be assessed as a denovo assembly format. bam file needs to be indexed. also creates a .mates file to be used in amos/bambus, and .astat file to mark whether the contig is unique o...
['def', 'ace', '(', 'args', ')', ':', 'p', '=', 'OptionParser', '(', 'ace', '.', '__doc__', ')', 'p', '.', 'add_option', '(', '"--splitdir"', ',', 'dest', '=', '"splitdir"', ',', 'default', '=', '"outRoot"', ',', 'help', '=', '"split the ace per contig to dir [default: %default]"', ')', 'p', '.', 'add_option', '(', '"-...
%prog ace bamfile fastafile convert bam format to ace format. This often allows the remapping to be assessed as a denovo assembly format. bam file needs to be indexed. also creates a .mates file to be used in amos/bambus, and .astat file to mark whether the contig is unique or repetitive based on A-sta...
['%prog', 'ace', 'bamfile', 'fastafile']
train
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/formats/sam.py#L823-L937
2,809
Kozea/pygal
pygal/graph/radar.py
Radar._compute
def _compute(self): """Compute r min max and labels position""" delta = 2 * pi / self._len if self._len else 0 self._x_pos = [.5 * pi + i * delta for i in range(self._len + 1)] for serie in self.all_series: serie.points = [(v, self._x_pos[i]) for i...
python
def _compute(self): """Compute r min max and labels position""" delta = 2 * pi / self._len if self._len else 0 self._x_pos = [.5 * pi + i * delta for i in range(self._len + 1)] for serie in self.all_series: serie.points = [(v, self._x_pos[i]) for i...
['def', '_compute', '(', 'self', ')', ':', 'delta', '=', '2', '*', 'pi', '/', 'self', '.', '_len', 'if', 'self', '.', '_len', 'else', '0', 'self', '.', '_x_pos', '=', '[', '.5', '*', 'pi', '+', 'i', '*', 'delta', 'for', 'i', 'in', 'range', '(', 'self', '.', '_len', '+', '1', ')', ']', 'for', 'serie', 'in', 'self', '.',...
Compute r min max and labels position
['Compute', 'r', 'min', 'max', 'and', 'labels', 'position']
train
https://github.com/Kozea/pygal/blob/5e25c98a59a0642eecd9fcc5dbfeeb2190fbb5e7/pygal/graph/radar.py#L167-L192
2,810
materialsproject/pymatgen
pymatgen/analysis/defects/utils.py
ChargeDensityAnalyzer.get_local_extrema
def get_local_extrema(self, find_min=True, threshold_frac=None, threshold_abs=None): """ Get all local extrema fractional coordinates in charge density, searching for local minimum by default. Note that sites are NOT grouped symmetrically. Args: ...
python
def get_local_extrema(self, find_min=True, threshold_frac=None, threshold_abs=None): """ Get all local extrema fractional coordinates in charge density, searching for local minimum by default. Note that sites are NOT grouped symmetrically. Args: ...
['def', 'get_local_extrema', '(', 'self', ',', 'find_min', '=', 'True', ',', 'threshold_frac', '=', 'None', ',', 'threshold_abs', '=', 'None', ')', ':', 'sign', ',', 'extrema_type', '=', '1', ',', '"local maxima"', 'if', 'find_min', ':', 'sign', ',', 'extrema_type', '=', '-', '1', ',', '"local minima"', '# Make 3x3x3 s...
Get all local extrema fractional coordinates in charge density, searching for local minimum by default. Note that sites are NOT grouped symmetrically. Args: find_min (bool): True to find local minimum else maximum, otherwise find local maximum. threshold...
['Get', 'all', 'local', 'extrema', 'fractional', 'coordinates', 'in', 'charge', 'density', 'searching', 'for', 'local', 'minimum', 'by', 'default', '.', 'Note', 'that', 'sites', 'are', 'NOT', 'grouped', 'symmetrically', '.']
train
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/utils.py#L1030-L1083
2,811
sdispater/eloquent
eloquent/support/collection.py
Collection.lists
def lists(self, value, key=None): """ Get a list with the values of a given key :rtype: list """ results = map(lambda x: x[value], self._items) return list(results)
python
def lists(self, value, key=None): """ Get a list with the values of a given key :rtype: list """ results = map(lambda x: x[value], self._items) return list(results)
['def', 'lists', '(', 'self', ',', 'value', ',', 'key', '=', 'None', ')', ':', 'results', '=', 'map', '(', 'lambda', 'x', ':', 'x', '[', 'value', ']', ',', 'self', '.', '_items', ')', 'return', 'list', '(', 'results', ')']
Get a list with the values of a given key :rtype: list
['Get', 'a', 'list', 'with', 'the', 'values', 'of', 'a', 'given', 'key']
train
https://github.com/sdispater/eloquent/blob/0638b688d5fd0c1a46b7471dd465eeb4c2f84666/eloquent/support/collection.py#L118-L126
2,812
chaoss/grimoirelab-sortinghat
sortinghat/matcher.py
_match_with_pandas
def _match_with_pandas(filtered, matcher): """Find matches in a set using Pandas' library.""" import pandas data = [fl.to_dict() for fl in filtered] if not data: return [] df = pandas.DataFrame(data) df = df.sort_values(['uuid']) cdfs = [] criteria = matcher.matching_criteri...
python
def _match_with_pandas(filtered, matcher): """Find matches in a set using Pandas' library.""" import pandas data = [fl.to_dict() for fl in filtered] if not data: return [] df = pandas.DataFrame(data) df = df.sort_values(['uuid']) cdfs = [] criteria = matcher.matching_criteri...
['def', '_match_with_pandas', '(', 'filtered', ',', 'matcher', ')', ':', 'import', 'pandas', 'data', '=', '[', 'fl', '.', 'to_dict', '(', ')', 'for', 'fl', 'in', 'filtered', ']', 'if', 'not', 'data', ':', 'return', '[', ']', 'df', '=', 'pandas', '.', 'DataFrame', '(', 'data', ')', 'df', '=', 'df', '.', 'sort_values', '...
Find matches in a set using Pandas' library.
['Find', 'matches', 'in', 'a', 'set', 'using', 'Pandas', 'library', '.']
train
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/matcher.py#L237-L267
2,813
mitsei/dlkit
dlkit/json_/grading/objects.py
GradeForm.get_input_score_end_range_metadata
def get_input_score_end_range_metadata(self): """Gets the metadata for the input score start range. return: (osid.Metadata) - metadata for the input score start range *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for...
python
def get_input_score_end_range_metadata(self): """Gets the metadata for the input score start range. return: (osid.Metadata) - metadata for the input score start range *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for...
['def', 'get_input_score_end_range_metadata', '(', 'self', ')', ':', '# Implemented from template for osid.resource.ResourceForm.get_group_metadata_template', 'metadata', '=', 'dict', '(', 'self', '.', '_mdata', '[', "'input_score_end_range'", ']', ')', 'metadata', '.', 'update', '(', '{', "'existing_decimal_values'", ...
Gets the metadata for the input score start range. return: (osid.Metadata) - metadata for the input score start range *compliance: mandatory -- This method must be implemented.*
['Gets', 'the', 'metadata', 'for', 'the', 'input', 'score', 'start', 'range', '.']
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/grading/objects.py#L239-L250
2,814
pytorch/text
torchtext/data/field.py
NestedField.preprocess
def preprocess(self, xs): """Preprocess a single example. Firstly, tokenization and the supplied preprocessing pipeline is applied. Since this field is always sequential, the result is a list. Then, each element of the list is preprocessed using ``self.nesting_field.preprocess`` and the...
python
def preprocess(self, xs): """Preprocess a single example. Firstly, tokenization and the supplied preprocessing pipeline is applied. Since this field is always sequential, the result is a list. Then, each element of the list is preprocessed using ``self.nesting_field.preprocess`` and the...
['def', 'preprocess', '(', 'self', ',', 'xs', ')', ':', 'return', '[', 'self', '.', 'nesting_field', '.', 'preprocess', '(', 'x', ')', 'for', 'x', 'in', 'super', '(', 'NestedField', ',', 'self', ')', '.', 'preprocess', '(', 'xs', ')', ']']
Preprocess a single example. Firstly, tokenization and the supplied preprocessing pipeline is applied. Since this field is always sequential, the result is a list. Then, each element of the list is preprocessed using ``self.nesting_field.preprocess`` and the resulting list is returned. ...
['Preprocess', 'a', 'single', 'example', '.']
train
https://github.com/pytorch/text/blob/26bfce6869dc704f1d86792f9a681d453d7e7bb8/torchtext/data/field.py#L528-L543
2,815
bfontaine/term2048
term2048/game.py
Game.boardToString
def boardToString(self, margins=None): """ return a string representation of the current board. """ if margins is None: margins = {} b = self.board rg = range(b.size()) left = ' '*margins.get('left', 0) s = '\n'.join( [left + ' '.j...
python
def boardToString(self, margins=None): """ return a string representation of the current board. """ if margins is None: margins = {} b = self.board rg = range(b.size()) left = ' '*margins.get('left', 0) s = '\n'.join( [left + ' '.j...
['def', 'boardToString', '(', 'self', ',', 'margins', '=', 'None', ')', ':', 'if', 'margins', 'is', 'None', ':', 'margins', '=', '{', '}', 'b', '=', 'self', '.', 'board', 'rg', '=', 'range', '(', 'b', '.', 'size', '(', ')', ')', 'left', '=', "' '", '*', 'margins', '.', 'get', '(', "'left'", ',', '0', ')', 's', '=', "'\...
return a string representation of the current board.
['return', 'a', 'string', 'representation', 'of', 'the', 'current', 'board', '.']
train
https://github.com/bfontaine/term2048/blob/8b5ce8b65f44f20a7ad36022a34dce56184070af/term2048/game.py#L280-L292
2,816
kstaniek/condoor
condoor/connection.py
Connection.resume_session_logging
def resume_session_logging(self): """Resume session logging.""" self._chain.ctrl.set_session_log(self.session_fd) self.log("Session logging resumed")
python
def resume_session_logging(self): """Resume session logging.""" self._chain.ctrl.set_session_log(self.session_fd) self.log("Session logging resumed")
['def', 'resume_session_logging', '(', 'self', ')', ':', 'self', '.', '_chain', '.', 'ctrl', '.', 'set_session_log', '(', 'self', '.', 'session_fd', ')', 'self', '.', 'log', '(', '"Session logging resumed"', ')']
Resume session logging.
['Resume', 'session', 'logging', '.']
train
https://github.com/kstaniek/condoor/blob/77c054b29d4e286c1d7aca2c74dff86b805e1fae/condoor/connection.py#L371-L374
2,817
vtkiorg/vtki
vtki/pointset.py
UnstructuredGrid._from_arrays
def _from_arrays(self, offset, cells, cell_type, points, deep=True): """ Create VTK unstructured grid from numpy arrays Parameters ---------- offset : np.ndarray dtype=np.int64 Array indicating the start location of each cell in the cells array. ...
python
def _from_arrays(self, offset, cells, cell_type, points, deep=True): """ Create VTK unstructured grid from numpy arrays Parameters ---------- offset : np.ndarray dtype=np.int64 Array indicating the start location of each cell in the cells array. ...
['def', '_from_arrays', '(', 'self', ',', 'offset', ',', 'cells', ',', 'cell_type', ',', 'points', ',', 'deep', '=', 'True', ')', ':', 'if', 'offset', '.', 'dtype', '!=', 'vtki', '.', 'ID_TYPE', ':', 'offset', '=', 'offset', '.', 'astype', '(', 'vtki', '.', 'ID_TYPE', ')', 'if', 'cells', '.', 'dtype', '!=', 'vtki', '.'...
Create VTK unstructured grid from numpy arrays Parameters ---------- offset : np.ndarray dtype=np.int64 Array indicating the start location of each cell in the cells array. cells : np.ndarray dtype=np.int64 Array of cells. Each cell contains the num...
['Create', 'VTK', 'unstructured', 'grid', 'from', 'numpy', 'arrays']
train
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/pointset.py#L1839-L1923
2,818
aiogram/aiogram
aiogram/bot/bot.py
Bot.kick_chat_member
async def kick_chat_member(self, chat_id: typing.Union[base.Integer, base.String], user_id: base.Integer, until_date: typing.Union[base.Integer, None] = None) -> base.Boolean: """ Use this method to kick a user from a group, a supergroup or a channel. In the case o...
python
async def kick_chat_member(self, chat_id: typing.Union[base.Integer, base.String], user_id: base.Integer, until_date: typing.Union[base.Integer, None] = None) -> base.Boolean: """ Use this method to kick a user from a group, a supergroup or a channel. In the case o...
['async', 'def', 'kick_chat_member', '(', 'self', ',', 'chat_id', ':', 'typing', '.', 'Union', '[', 'base', '.', 'Integer', ',', 'base', '.', 'String', ']', ',', 'user_id', ':', 'base', '.', 'Integer', ',', 'until_date', ':', 'typing', '.', 'Union', '[', 'base', '.', 'Integer', ',', 'None', ']', '=', 'None', ')', '->',...
Use this method to kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must ...
['Use', 'this', 'method', 'to', 'kick', 'a', 'user', 'from', 'a', 'group', 'a', 'supergroup', 'or', 'a', 'channel', '.', 'In', 'the', 'case', 'of', 'supergroups', 'and', 'channels', 'the', 'user', 'will', 'not', 'be', 'able', 'to', 'return', 'to', 'the', 'group', 'on', 'their', 'own', 'using', 'invite', 'links', 'etc',...
train
https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L952-L980
2,819
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
xmlDoc.newDtd
def newDtd(self, name, ExternalID, SystemID): """Creation of a new DTD for the external subset. To create an internal subset, use xmlCreateIntSubset(). """ ret = libxml2mod.xmlNewDtd(self._o, name, ExternalID, SystemID) if ret is None:raise treeError('xmlNewDtd() failed') __tm...
python
def newDtd(self, name, ExternalID, SystemID): """Creation of a new DTD for the external subset. To create an internal subset, use xmlCreateIntSubset(). """ ret = libxml2mod.xmlNewDtd(self._o, name, ExternalID, SystemID) if ret is None:raise treeError('xmlNewDtd() failed') __tm...
['def', 'newDtd', '(', 'self', ',', 'name', ',', 'ExternalID', ',', 'SystemID', ')', ':', 'ret', '=', 'libxml2mod', '.', 'xmlNewDtd', '(', 'self', '.', '_o', ',', 'name', ',', 'ExternalID', ',', 'SystemID', ')', 'if', 'ret', 'is', 'None', ':', 'raise', 'treeError', '(', "'xmlNewDtd() failed'", ')', '__tmp', '=', 'xmlDt...
Creation of a new DTD for the external subset. To create an internal subset, use xmlCreateIntSubset().
['Creation', 'of', 'a', 'new', 'DTD', 'for', 'the', 'external', 'subset', '.', 'To', 'create', 'an', 'internal', 'subset', 'use', 'xmlCreateIntSubset', '()', '.']
train
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L4395-L4401
2,820
yunojuno/elasticsearch-django
elasticsearch_django/models.py
SearchDocumentMixin.index_search_document
def index_search_document(self, *, index): """ Create or replace search document in named index. Checks the local cache to see if the document has changed, and if not aborts the update, else pushes to ES, and then resets the local cache. Cache timeout is set as "cache_expiry" ...
python
def index_search_document(self, *, index): """ Create or replace search document in named index. Checks the local cache to see if the document has changed, and if not aborts the update, else pushes to ES, and then resets the local cache. Cache timeout is set as "cache_expiry" ...
['def', 'index_search_document', '(', 'self', ',', '*', ',', 'index', ')', ':', 'cache_key', '=', 'self', '.', 'search_document_cache_key', 'new_doc', '=', 'self', '.', 'as_search_document', '(', 'index', '=', 'index', ')', 'cached_doc', '=', 'cache', '.', 'get', '(', 'cache_key', ')', 'if', 'new_doc', '==', 'cached_do...
Create or replace search document in named index. Checks the local cache to see if the document has changed, and if not aborts the update, else pushes to ES, and then resets the local cache. Cache timeout is set as "cache_expiry" in the settings, and defaults to 60s.
['Create', 'or', 'replace', 'search', 'document', 'in', 'named', 'index', '.']
train
https://github.com/yunojuno/elasticsearch-django/blob/e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489/elasticsearch_django/models.py#L350-L369
2,821
moble/quaternion
quaternion_time_series.py
squad
def squad(R_in, t_in, t_out): """Spherical "quadrangular" interpolation of rotors with a cubic spline This is the best way to interpolate rotations. It uses the analog of a cubic spline, except that the interpolant is confined to the rotor manifold in a natural way. Alternative methods involving ...
python
def squad(R_in, t_in, t_out): """Spherical "quadrangular" interpolation of rotors with a cubic spline This is the best way to interpolate rotations. It uses the analog of a cubic spline, except that the interpolant is confined to the rotor manifold in a natural way. Alternative methods involving ...
['def', 'squad', '(', 'R_in', ',', 't_in', ',', 't_out', ')', ':', 'if', 'R_in', '.', 'size', '==', '0', 'or', 't_out', '.', 'size', '==', '0', ':', 'return', 'np', '.', 'array', '(', '(', ')', ',', 'dtype', '=', 'np', '.', 'quaternion', ')', '# This list contains an index for each `t_out` such that', '# t_in[i-1] <= t...
Spherical "quadrangular" interpolation of rotors with a cubic spline This is the best way to interpolate rotations. It uses the analog of a cubic spline, except that the interpolant is confined to the rotor manifold in a natural way. Alternative methods involving interpolation of other coordinates on...
['Spherical', 'quadrangular', 'interpolation', 'of', 'rotors', 'with', 'a', 'cubic', 'spline']
train
https://github.com/moble/quaternion/blob/7a323e81b391d6892e2874073e495e0beb057e85/quaternion_time_series.py#L38-L154
2,822
mfcloud/python-zvm-sdk
smtLayer/getVM.py
getConsole
def getConsole(rh): """ Get the virtual machine's console output. Input: Request Handle with the following properties: function - 'CMDVM' subfunction - 'CMD' userid - userid of the virtual machine Output: Request Handle updated with the results. ...
python
def getConsole(rh): """ Get the virtual machine's console output. Input: Request Handle with the following properties: function - 'CMDVM' subfunction - 'CMD' userid - userid of the virtual machine Output: Request Handle updated with the results. ...
['def', 'getConsole', '(', 'rh', ')', ':', 'rh', '.', 'printSysLog', '(', '"Enter getVM.getConsole"', ')', '# Transfer the console to this virtual machine.', 'parms', '=', '[', '"-T"', ',', 'rh', '.', 'userid', ']', 'results', '=', 'invokeSMCLI', '(', 'rh', ',', '"Image_Console_Get"', ',', 'parms', ')', 'if', 'results'...
Get the virtual machine's console output. Input: Request Handle with the following properties: function - 'CMDVM' subfunction - 'CMD' userid - userid of the virtual machine Output: Request Handle updated with the results. Return code - 0: ok, non-zero...
['Get', 'the', 'virtual', 'machine', 's', 'console', 'output', '.']
train
https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/getVM.py#L152-L283
2,823
gristlabs/asttokens
asttokens/line_numbers.py
LineNumbers.offset_to_line
def offset_to_line(self, offset): """ Converts 0-based character offset to pair (line, col) of 1-based line and 0-based column numbers. """ offset = max(0, min(self._text_len, offset)) line_index = bisect.bisect_right(self._line_offsets, offset) - 1 return (line_index + 1, offset - self._lin...
python
def offset_to_line(self, offset): """ Converts 0-based character offset to pair (line, col) of 1-based line and 0-based column numbers. """ offset = max(0, min(self._text_len, offset)) line_index = bisect.bisect_right(self._line_offsets, offset) - 1 return (line_index + 1, offset - self._lin...
['def', 'offset_to_line', '(', 'self', ',', 'offset', ')', ':', 'offset', '=', 'max', '(', '0', ',', 'min', '(', 'self', '.', '_text_len', ',', 'offset', ')', ')', 'line_index', '=', 'bisect', '.', 'bisect_right', '(', 'self', '.', '_line_offsets', ',', 'offset', ')', '-', '1', 'return', '(', 'line_index', '+', '1', ',...
Converts 0-based character offset to pair (line, col) of 1-based line and 0-based column numbers.
['Converts', '0', '-', 'based', 'character', 'offset', 'to', 'pair', '(', 'line', 'col', ')', 'of', '1', '-', 'based', 'line', 'and', '0', '-', 'based', 'column', 'numbers', '.']
train
https://github.com/gristlabs/asttokens/blob/c8697dcf799a63d432727abb1d972adb3e85970a/asttokens/line_numbers.py#L62-L69
2,824
keans/lmnotify
lmnotify/lmnotify.py
LaMetricManager.set_display
def set_display(self, brightness=100, brightness_mode="auto"): """ allows to modify display state (change brightness) :param int brightness: display brightness [0, 100] (default: 100) :param str brightness_mode: the brightness mode of the display [aut...
python
def set_display(self, brightness=100, brightness_mode="auto"): """ allows to modify display state (change brightness) :param int brightness: display brightness [0, 100] (default: 100) :param str brightness_mode: the brightness mode of the display [aut...
['def', 'set_display', '(', 'self', ',', 'brightness', '=', '100', ',', 'brightness_mode', '=', '"auto"', ')', ':', 'assert', '(', 'brightness_mode', 'in', '(', '"auto"', ',', '"manual"', ')', ')', 'assert', '(', 'brightness', 'in', 'range', '(', '101', ')', ')', 'log', '.', 'debug', '(', '"setting display information....
allows to modify display state (change brightness) :param int brightness: display brightness [0, 100] (default: 100) :param str brightness_mode: the brightness mode of the display [auto, manual] (default: auto)
['allows', 'to', 'modify', 'display', 'state', '(', 'change', 'brightness', ')']
train
https://github.com/keans/lmnotify/blob/b0a5282a582e5090852dc20fea8a135ca258d0d3/lmnotify/lmnotify.py#L350-L369
2,825
pantsbuild/pants
src/python/pants/backend/jvm/tasks/jar_publish.py
JarPublish.create_doc_jar
def create_doc_jar(self, target, open_jar, version): """Returns a doc jar if either scala or java docs are available for the given target.""" javadoc = self._java_doc(target) scaladoc = self._scala_doc(target) if javadoc or scaladoc: jar_path = self.artifact_path(open_jar, version, suffix='-javado...
python
def create_doc_jar(self, target, open_jar, version): """Returns a doc jar if either scala or java docs are available for the given target.""" javadoc = self._java_doc(target) scaladoc = self._scala_doc(target) if javadoc or scaladoc: jar_path = self.artifact_path(open_jar, version, suffix='-javado...
['def', 'create_doc_jar', '(', 'self', ',', 'target', ',', 'open_jar', ',', 'version', ')', ':', 'javadoc', '=', 'self', '.', '_java_doc', '(', 'target', ')', 'scaladoc', '=', 'self', '.', '_scala_doc', '(', 'target', ')', 'if', 'javadoc', 'or', 'scaladoc', ':', 'jar_path', '=', 'self', '.', 'artifact_path', '(', 'open...
Returns a doc jar if either scala or java docs are available for the given target.
['Returns', 'a', 'doc', 'jar', 'if', 'either', 'scala', 'or', 'java', 'docs', 'are', 'available', 'for', 'the', 'given', 'target', '.']
train
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/backend/jvm/tasks/jar_publish.py#L985-L1002
2,826
b3j0f/utils
b3j0f/utils/reflect.py
base_elts
def base_elts(elt, cls=None, depth=None): """Get bases elements of the input elt. - If elt is an instance, get class and all base classes. - If elt is a method, get all base methods. - If elt is a class, get all base classes. - In other case, get an empty list. :param elt: supposed inherited e...
python
def base_elts(elt, cls=None, depth=None): """Get bases elements of the input elt. - If elt is an instance, get class and all base classes. - If elt is a method, get all base methods. - If elt is a class, get all base classes. - In other case, get an empty list. :param elt: supposed inherited e...
['def', 'base_elts', '(', 'elt', ',', 'cls', '=', 'None', ',', 'depth', '=', 'None', ')', ':', 'result', '=', '[', ']', 'elt_name', '=', 'getattr', '(', 'elt', ',', "'__name__'", ',', 'None', ')', 'if', 'elt_name', 'is', 'not', 'None', ':', 'cls', '=', '[', ']', 'if', 'cls', 'is', 'None', 'else', 'ensureiterable', '(',...
Get bases elements of the input elt. - If elt is an instance, get class and all base classes. - If elt is a method, get all base methods. - If elt is a class, get all base classes. - In other case, get an empty list. :param elt: supposed inherited elt. :param cls: cls from where find attribute...
['Get', 'bases', 'elements', 'of', 'the', 'input', 'elt', '.']
train
https://github.com/b3j0f/utils/blob/793871b98e90fd1c7ce9ef0dce839cc18fcbc6ff/b3j0f/utils/reflect.py#L48-L145
2,827
moonso/vcftoolbox
vcftoolbox/cli.py
variants
def variants(ctx, snpeff): """Print the variants in a vcf""" head = ctx.parent.head vcf_handle = ctx.parent.handle outfile = ctx.parent.outfile silent = ctx.parent.silent print_headers(head, outfile=outfile, silent=silent) for line in vcf_handle: print_variant(variant_line=...
python
def variants(ctx, snpeff): """Print the variants in a vcf""" head = ctx.parent.head vcf_handle = ctx.parent.handle outfile = ctx.parent.outfile silent = ctx.parent.silent print_headers(head, outfile=outfile, silent=silent) for line in vcf_handle: print_variant(variant_line=...
['def', 'variants', '(', 'ctx', ',', 'snpeff', ')', ':', 'head', '=', 'ctx', '.', 'parent', '.', 'head', 'vcf_handle', '=', 'ctx', '.', 'parent', '.', 'handle', 'outfile', '=', 'ctx', '.', 'parent', '.', 'outfile', 'silent', '=', 'ctx', '.', 'parent', '.', 'silent', 'print_headers', '(', 'head', ',', 'outfile', '=', 'o...
Print the variants in a vcf
['Print', 'the', 'variants', 'in', 'a', 'vcf']
train
https://github.com/moonso/vcftoolbox/blob/438fb1d85a83812c389774b94802eb5921c89e3a/vcftoolbox/cli.py#L96-L123
2,828
Kane610/deconz
pydeconz/__init__.py
DeconzSession.start
def start(self) -> None: """Connect websocket to deCONZ.""" if self.config: self.websocket = self.ws_client( self.loop, self.session, self.host, self.config.websocketport, self.async_session_handler) self.websocket.start() else: ...
python
def start(self) -> None: """Connect websocket to deCONZ.""" if self.config: self.websocket = self.ws_client( self.loop, self.session, self.host, self.config.websocketport, self.async_session_handler) self.websocket.start() else: ...
['def', 'start', '(', 'self', ')', '->', 'None', ':', 'if', 'self', '.', 'config', ':', 'self', '.', 'websocket', '=', 'self', '.', 'ws_client', '(', 'self', '.', 'loop', ',', 'self', '.', 'session', ',', 'self', '.', 'host', ',', 'self', '.', 'config', '.', 'websocketport', ',', 'self', '.', 'async_session_handler', '...
Connect websocket to deCONZ.
['Connect', 'websocket', 'to', 'deCONZ', '.']
train
https://github.com/Kane610/deconz/blob/8a9498dbbc8c168d4a081173ad6c3b1e17fffdf6/pydeconz/__init__.py#L38-L46
2,829
ttinoco/OPTALG
optalg/lin_solver/_mumps/__init__.py
_MumpsBaseContext.set_silent
def set_silent(self): """Silence most messages.""" self.set_icntl(1, -1) # output stream for error msgs self.set_icntl(2, -1) # otuput stream for diagnostic msgs self.set_icntl(3, -1) # output stream for global info self.set_icntl(4, 0)
python
def set_silent(self): """Silence most messages.""" self.set_icntl(1, -1) # output stream for error msgs self.set_icntl(2, -1) # otuput stream for diagnostic msgs self.set_icntl(3, -1) # output stream for global info self.set_icntl(4, 0)
['def', 'set_silent', '(', 'self', ')', ':', 'self', '.', 'set_icntl', '(', '1', ',', '-', '1', ')', '# output stream for error msgs', 'self', '.', 'set_icntl', '(', '2', ',', '-', '1', ')', '# otuput stream for diagnostic msgs', 'self', '.', 'set_icntl', '(', '3', ',', '-', '1', ')', '# output stream for global info',...
Silence most messages.
['Silence', 'most', 'messages', '.']
train
https://github.com/ttinoco/OPTALG/blob/d4f141292f281eea4faa71473258139e7f433001/optalg/lin_solver/_mumps/__init__.py#L187-L192
2,830
Tinche/cattrs
src/cattr/converters.py
Converter._unstructure_mapping
def _unstructure_mapping(self, mapping): """Convert a mapping of attr classes to primitive equivalents.""" # We can reuse the mapping class, so dicts stay dicts and OrderedDicts # stay OrderedDicts. dispatch = self._unstructure_func.dispatch return mapping.__class__( ...
python
def _unstructure_mapping(self, mapping): """Convert a mapping of attr classes to primitive equivalents.""" # We can reuse the mapping class, so dicts stay dicts and OrderedDicts # stay OrderedDicts. dispatch = self._unstructure_func.dispatch return mapping.__class__( ...
['def', '_unstructure_mapping', '(', 'self', ',', 'mapping', ')', ':', '# We can reuse the mapping class, so dicts stay dicts and OrderedDicts', '# stay OrderedDicts.', 'dispatch', '=', 'self', '.', '_unstructure_func', '.', 'dispatch', 'return', 'mapping', '.', '__class__', '(', '(', 'dispatch', '(', 'k', '.', '__clas...
Convert a mapping of attr classes to primitive equivalents.
['Convert', 'a', 'mapping', 'of', 'attr', 'classes', 'to', 'primitive', 'equivalents', '.']
train
https://github.com/Tinche/cattrs/blob/481bc9bdb69b2190d699b54f331c8c5c075506d5/src/cattr/converters.py#L227-L236
2,831
fhcrc/seqmagick
seqmagick/subcommands/info.py
summarize_sequence_file
def summarize_sequence_file(source_file, file_type=None): """ Summarizes a sequence file, returning a tuple containing the name, whether the file is an alignment, minimum sequence length, maximum sequence length, average length, number of sequences. """ is_alignment = True avg_length = None ...
python
def summarize_sequence_file(source_file, file_type=None): """ Summarizes a sequence file, returning a tuple containing the name, whether the file is an alignment, minimum sequence length, maximum sequence length, average length, number of sequences. """ is_alignment = True avg_length = None ...
['def', 'summarize_sequence_file', '(', 'source_file', ',', 'file_type', '=', 'None', ')', ':', 'is_alignment', '=', 'True', 'avg_length', '=', 'None', 'min_length', '=', 'sys', '.', 'maxsize', 'max_length', '=', '0', 'sequence_count', '=', '0', '# Get an iterator and analyze the data.', 'with', 'common', '.', 'FileTyp...
Summarizes a sequence file, returning a tuple containing the name, whether the file is an alignment, minimum sequence length, maximum sequence length, average length, number of sequences.
['Summarizes', 'a', 'sequence', 'file', 'returning', 'a', 'tuple', 'containing', 'the', 'name', 'whether', 'the', 'file', 'is', 'an', 'alignment', 'minimum', 'sequence', 'length', 'maximum', 'sequence', 'length', 'average', 'length', 'number', 'of', 'sequences', '.']
train
https://github.com/fhcrc/seqmagick/blob/1642bb87ba5c171fbd307f9da0f8a0ee1d69d5ed/seqmagick/subcommands/info.py#L98-L143
2,832
markokr/rarfile
rarfile.py
RarExtFile.close
def close(self): """Close open resources.""" super(RarExtFile, self).close() if self._fd: self._fd.close() self._fd = None
python
def close(self): """Close open resources.""" super(RarExtFile, self).close() if self._fd: self._fd.close() self._fd = None
['def', 'close', '(', 'self', ')', ':', 'super', '(', 'RarExtFile', ',', 'self', ')', '.', 'close', '(', ')', 'if', 'self', '.', '_fd', ':', 'self', '.', '_fd', '.', 'close', '(', ')', 'self', '.', '_fd', '=', 'None']
Close open resources.
['Close', 'open', 'resources', '.']
train
https://github.com/markokr/rarfile/blob/2704344e8d7a1658c96c8ed8f449d7ba01bedea3/rarfile.py#L2046-L2053
2,833
saltstack/salt
salt/modules/solr.py
_get_none_or_value
def _get_none_or_value(value): ''' PRIVATE METHOD Checks to see if the value of a primitive or built-in container such as a list, dict, set, tuple etc is empty or none. None type is returned if the value is empty/None/False. Number data types that are 0 will return None. value : obj The...
python
def _get_none_or_value(value): ''' PRIVATE METHOD Checks to see if the value of a primitive or built-in container such as a list, dict, set, tuple etc is empty or none. None type is returned if the value is empty/None/False. Number data types that are 0 will return None. value : obj The...
['def', '_get_none_or_value', '(', 'value', ')', ':', 'if', 'value', 'is', 'None', ':', 'return', 'None', 'elif', 'not', 'value', ':', 'return', 'value', "# if it's a string, and it's not empty check for none", 'elif', 'isinstance', '(', 'value', ',', 'six', '.', 'string_types', ')', ':', 'if', 'value', '.', 'lower', '...
PRIVATE METHOD Checks to see if the value of a primitive or built-in container such as a list, dict, set, tuple etc is empty or none. None type is returned if the value is empty/None/False. Number data types that are 0 will return None. value : obj The primitive or built-in container to evaluat...
['PRIVATE', 'METHOD', 'Checks', 'to', 'see', 'if', 'the', 'value', 'of', 'a', 'primitive', 'or', 'built', '-', 'in', 'container', 'such', 'as', 'a', 'list', 'dict', 'set', 'tuple', 'etc', 'is', 'empty', 'or', 'none', '.', 'None', 'type', 'is', 'returned', 'if', 'the', 'value', 'is', 'empty', '/', 'None', '/', 'False', ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solr.py#L99-L122
2,834
Robpol86/sphinxcontrib-versioning
sphinxcontrib/versioning/sphinx_.py
build
def build(source, target, versions, current_name, is_root): """Build Sphinx docs for one version. Includes Versions class instance with names/urls in the HTML context. :raise HandledError: If sphinx-build fails. Will be logged before raising. :param str source: Source directory to pass to sphinx-build. ...
python
def build(source, target, versions, current_name, is_root): """Build Sphinx docs for one version. Includes Versions class instance with names/urls in the HTML context. :raise HandledError: If sphinx-build fails. Will be logged before raising. :param str source: Source directory to pass to sphinx-build. ...
['def', 'build', '(', 'source', ',', 'target', ',', 'versions', ',', 'current_name', ',', 'is_root', ')', ':', 'log', '=', 'logging', '.', 'getLogger', '(', '__name__', ')', 'argv', '=', '(', "'sphinx-build'", ',', 'source', ',', 'target', ')', 'config', '=', 'Config', '.', 'from_context', '(', ')', 'log', '.', 'debug'...
Build Sphinx docs for one version. Includes Versions class instance with names/urls in the HTML context. :raise HandledError: If sphinx-build fails. Will be logged before raising. :param str source: Source directory to pass to sphinx-build. :param str target: Destination directory to write documentation t...
['Build', 'Sphinx', 'docs', 'for', 'one', 'version', '.', 'Includes', 'Versions', 'class', 'instance', 'with', 'names', '/', 'urls', 'in', 'the', 'HTML', 'context', '.']
train
https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/sphinx_.py#L222-L243
2,835
brocade/pynos
pynos/versions/ver_7/ver_7_1_0/yang/brocade_vswitch.py
brocade_vswitch.get_vnetwork_portgroups_input_vcenter
def get_vnetwork_portgroups_input_vcenter(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_vnetwork_portgroups = ET.Element("get_vnetwork_portgroups") config = get_vnetwork_portgroups input = ET.SubElement(get_vnetwork_portgroups, "input") ...
python
def get_vnetwork_portgroups_input_vcenter(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_vnetwork_portgroups = ET.Element("get_vnetwork_portgroups") config = get_vnetwork_portgroups input = ET.SubElement(get_vnetwork_portgroups, "input") ...
['def', 'get_vnetwork_portgroups_input_vcenter', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'config', '=', 'ET', '.', 'Element', '(', '"config"', ')', 'get_vnetwork_portgroups', '=', 'ET', '.', 'Element', '(', '"get_vnetwork_portgroups"', ')', 'config', '=', 'get_vnetwork_portgroups', 'input', '=', 'ET', '.', 'Sub...
Auto Generated Code
['Auto', 'Generated', 'Code']
train
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_1_0/yang/brocade_vswitch.py#L807-L818
2,836
ga4gh/ga4gh-server
ga4gh/server/datamodel/sequence_annotations.py
Gff3DbFeatureSet.populateFromRow
def populateFromRow(self, featureSetRecord): """ Populates the instance variables of this FeatureSet from the specified DB row. """ self._dbFilePath = featureSetRecord.dataurl self.setAttributesJson(featureSetRecord.attributes) self._db = Gff3DbBackend(self._dbFil...
python
def populateFromRow(self, featureSetRecord): """ Populates the instance variables of this FeatureSet from the specified DB row. """ self._dbFilePath = featureSetRecord.dataurl self.setAttributesJson(featureSetRecord.attributes) self._db = Gff3DbBackend(self._dbFil...
['def', 'populateFromRow', '(', 'self', ',', 'featureSetRecord', ')', ':', 'self', '.', '_dbFilePath', '=', 'featureSetRecord', '.', 'dataurl', 'self', '.', 'setAttributesJson', '(', 'featureSetRecord', '.', 'attributes', ')', 'self', '.', '_db', '=', 'Gff3DbBackend', '(', 'self', '.', '_dbFilePath', ')']
Populates the instance variables of this FeatureSet from the specified DB row.
['Populates', 'the', 'instance', 'variables', 'of', 'this', 'FeatureSet', 'from', 'the', 'specified', 'DB', 'row', '.']
train
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/sequence_annotations.py#L342-L349
2,837
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient._get_all_file_versions
def _get_all_file_versions(self, secure_data_path, limit=None): """ Convenience function that returns a generator yielding the contents of all versions of a file and its version info secure_data_path -- full path to the file in the safety deposit box limit -- Default(100), limit...
python
def _get_all_file_versions(self, secure_data_path, limit=None): """ Convenience function that returns a generator yielding the contents of all versions of a file and its version info secure_data_path -- full path to the file in the safety deposit box limit -- Default(100), limit...
['def', '_get_all_file_versions', '(', 'self', ',', 'secure_data_path', ',', 'limit', '=', 'None', ')', ':', 'for', 'secret', 'in', 'self', '.', '_get_all_file_version_ids', '(', 'secure_data_path', ',', 'limit', ')', ':', 'yield', '{', "'secret'", ':', 'self', '.', 'get_file_data', '(', 'secure_data_path', ',', 'versi...
Convenience function that returns a generator yielding the contents of all versions of a file and its version info secure_data_path -- full path to the file in the safety deposit box limit -- Default(100), limits how many records to be returned from the api at once.
['Convenience', 'function', 'that', 'returns', 'a', 'generator', 'yielding', 'the', 'contents', 'of', 'all', 'versions', 'of', 'a', 'file', 'and', 'its', 'version', 'info']
train
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L433-L443
2,838
nimbusproject/dashi
dashi/__init__.py
Dashi.ensure
def ensure(self, connection, func, *args, **kwargs): """Perform an operation until success Repeats in the face of connection errors, pursuant to retry policy. """ channel = None while 1: try: if channel is None: channel = connectio...
python
def ensure(self, connection, func, *args, **kwargs): """Perform an operation until success Repeats in the face of connection errors, pursuant to retry policy. """ channel = None while 1: try: if channel is None: channel = connectio...
['def', 'ensure', '(', 'self', ',', 'connection', ',', 'func', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'channel', '=', 'None', 'while', '1', ':', 'try', ':', 'if', 'channel', 'is', 'None', ':', 'channel', '=', 'connection', '.', 'channel', '(', ')', 'return', 'func', '(', 'channel', ',', '*', 'args', ',', ...
Perform an operation until success Repeats in the face of connection errors, pursuant to retry policy.
['Perform', 'an', 'operation', 'until', 'success']
train
https://github.com/nimbusproject/dashi/blob/368b3963ec8abd60aebe0f81915429b45cbf4b5a/dashi/__init__.py#L379-L393
2,839
pymc-devs/pymc
pymc/database/hdf5ea.py
Database._initialize
def _initialize(self, funs_to_tally, length): """Create a group named ``chain#`` to store all data for this chain.""" chain = self.nchains self._chains[chain] = self._h5file.create_group( '/', 'chain%d' % chain, 'chain #%d' % chain) for name, fun in six.iteritems(funs_to_ta...
python
def _initialize(self, funs_to_tally, length): """Create a group named ``chain#`` to store all data for this chain.""" chain = self.nchains self._chains[chain] = self._h5file.create_group( '/', 'chain%d' % chain, 'chain #%d' % chain) for name, fun in six.iteritems(funs_to_ta...
['def', '_initialize', '(', 'self', ',', 'funs_to_tally', ',', 'length', ')', ':', 'chain', '=', 'self', '.', 'nchains', 'self', '.', '_chains', '[', 'chain', ']', '=', 'self', '.', '_h5file', '.', 'create_group', '(', "'/'", ',', "'chain%d'", '%', 'chain', ',', "'chain #%d'", '%', 'chain', ')', 'for', 'name', ',', 'fu...
Create a group named ``chain#`` to store all data for this chain.
['Create', 'a', 'group', 'named', 'chain#', 'to', 'store', 'all', 'data', 'for', 'this', 'chain', '.']
train
https://github.com/pymc-devs/pymc/blob/c6e530210bff4c0d7189b35b2c971bc53f93f7cd/pymc/database/hdf5ea.py#L237-L259
2,840
rosenbrockc/fortpy
fortpy/elements.py
Function.returns
def returns(self): """Gets a string showing the return type and modifiers for the function in a nice display format.""" kind = "({}) ".format(self.kind) if self.kind is not None else "" mods = ", ".join(self.modifiers) + " " dtype = self.dtype if self.dtype is not None else...
python
def returns(self): """Gets a string showing the return type and modifiers for the function in a nice display format.""" kind = "({}) ".format(self.kind) if self.kind is not None else "" mods = ", ".join(self.modifiers) + " " dtype = self.dtype if self.dtype is not None else...
['def', 'returns', '(', 'self', ')', ':', 'kind', '=', '"({}) "', '.', 'format', '(', 'self', '.', 'kind', ')', 'if', 'self', '.', 'kind', 'is', 'not', 'None', 'else', '""', 'mods', '=', '", "', '.', 'join', '(', 'self', '.', 'modifiers', ')', '+', '" "', 'dtype', '=', 'self', '.', 'dtype', 'if', 'self', '.', 'dtype', ...
Gets a string showing the return type and modifiers for the function in a nice display format.
['Gets', 'a', 'string', 'showing', 'the', 'return', 'type', 'and', 'modifiers', 'for', 'the', 'function', 'in', 'a', 'nice', 'display', 'format', '.']
train
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/elements.py#L993-L999
2,841
nugget/python-insteonplm
insteonplm/states/onOff.py
OnOffKeypadLed.off
def off(self, group): """Turn the LED off for a group.""" asyncio.ensure_future(self._send_led_on_off_request(group, 0), loop=self._loop)
python
def off(self, group): """Turn the LED off for a group.""" asyncio.ensure_future(self._send_led_on_off_request(group, 0), loop=self._loop)
['def', 'off', '(', 'self', ',', 'group', ')', ':', 'asyncio', '.', 'ensure_future', '(', 'self', '.', '_send_led_on_off_request', '(', 'group', ',', '0', ')', ',', 'loop', '=', 'self', '.', '_loop', ')']
Turn the LED off for a group.
['Turn', 'the', 'LED', 'off', 'for', 'a', 'group', '.']
train
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/states/onOff.py#L857-L860
2,842
moonso/vcftoolbox
vcftoolbox/cli.py
sort
def sort(ctx): """Sort the variants of a vcf file""" head = ctx.parent.head vcf_handle = ctx.parent.handle outfile = ctx.parent.outfile silent = ctx.parent.silent print_headers(head, outfile=outfile, silent=silent) for line in sort_variants(vcf_handle): print_variant(variant_line=l...
python
def sort(ctx): """Sort the variants of a vcf file""" head = ctx.parent.head vcf_handle = ctx.parent.handle outfile = ctx.parent.outfile silent = ctx.parent.silent print_headers(head, outfile=outfile, silent=silent) for line in sort_variants(vcf_handle): print_variant(variant_line=l...
['def', 'sort', '(', 'ctx', ')', ':', 'head', '=', 'ctx', '.', 'parent', '.', 'head', 'vcf_handle', '=', 'ctx', '.', 'parent', '.', 'handle', 'outfile', '=', 'ctx', '.', 'parent', '.', 'outfile', 'silent', '=', 'ctx', '.', 'parent', '.', 'silent', 'print_headers', '(', 'head', ',', 'outfile', '=', 'outfile', ',', 'sile...
Sort the variants of a vcf file
['Sort', 'the', 'variants', 'of', 'a', 'vcf', 'file']
train
https://github.com/moonso/vcftoolbox/blob/438fb1d85a83812c389774b94802eb5921c89e3a/vcftoolbox/cli.py#L127-L137
2,843
edeposit/edeposit.amqp.aleph
src/edeposit/amqp/aleph/export.py
PostData.get_POST_data
def get_POST_data(self): """ Returns: dict: POST data, which can be sent to webform using \ :py:mod:`urllib` or similar library """ self._postprocess() # some fields need to be remapped (depends on type of media) self._apply_mapping( ...
python
def get_POST_data(self): """ Returns: dict: POST data, which can be sent to webform using \ :py:mod:`urllib` or similar library """ self._postprocess() # some fields need to be remapped (depends on type of media) self._apply_mapping( ...
['def', 'get_POST_data', '(', 'self', ')', ':', 'self', '.', '_postprocess', '(', ')', '# some fields need to be remapped (depends on type of media)', 'self', '.', '_apply_mapping', '(', 'self', '.', 'mapping', '.', 'get', '(', 'self', '.', '_POST', '[', '"P0502010__b"', ']', ',', 'self', '.', 'mapping', '[', '"else"',...
Returns: dict: POST data, which can be sent to webform using \ :py:mod:`urllib` or similar library
['Returns', ':', 'dict', ':', 'POST', 'data', 'which', 'can', 'be', 'sent', 'to', 'webform', 'using', '\\', ':', 'py', ':', 'mod', ':', 'urllib', 'or', 'similar', 'library']
train
https://github.com/edeposit/edeposit.amqp.aleph/blob/360342c0504d5daa2344e864762cdf938d4149c7/src/edeposit/amqp/aleph/export.py#L303-L318
2,844
wonambi-python/wonambi
wonambi/ioeeg/edf.py
Edf._read_record
def _read_record(self, f, blk, chans): """Read raw data from a single EDF channel. Parameters ---------- i_chan : int index of the channel to read begsam : int index of the first sample endsam : int index of the last sample Re...
python
def _read_record(self, f, blk, chans): """Read raw data from a single EDF channel. Parameters ---------- i_chan : int index of the channel to read begsam : int index of the first sample endsam : int index of the last sample Re...
['def', '_read_record', '(', 'self', ',', 'f', ',', 'blk', ',', 'chans', ')', ':', 'dat_in_rec', '=', 'empty', '(', '(', 'len', '(', 'chans', ')', ',', 'self', '.', 'max_smp', ')', ')', 'i_ch_in_dat', '=', '0', 'for', 'i_ch', 'in', 'chans', ':', 'offset', ',', 'n_smp_per_chan', '=', 'self', '.', '_offset', '(', 'blk', ...
Read raw data from a single EDF channel. Parameters ---------- i_chan : int index of the channel to read begsam : int index of the first sample endsam : int index of the last sample Returns ------- numpy.ndarray ...
['Read', 'raw', 'data', 'from', 'a', 'single', 'EDF', 'channel', '.']
train
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/ioeeg/edf.py#L214-L244
2,845
juju/python-libjuju
juju/machine.py
Machine.agent_version
def agent_version(self): """Get the version of the Juju machine agent. May return None if the agent is not yet available. """ version = self.safe_data['agent-status']['version'] if version: return client.Number.from_json(version) else: return None
python
def agent_version(self): """Get the version of the Juju machine agent. May return None if the agent is not yet available. """ version = self.safe_data['agent-status']['version'] if version: return client.Number.from_json(version) else: return None
['def', 'agent_version', '(', 'self', ')', ':', 'version', '=', 'self', '.', 'safe_data', '[', "'agent-status'", ']', '[', "'version'", ']', 'if', 'version', ':', 'return', 'client', '.', 'Number', '.', 'from_json', '(', 'version', ')', 'else', ':', 'return', 'None']
Get the version of the Juju machine agent. May return None if the agent is not yet available.
['Get', 'the', 'version', 'of', 'the', 'Juju', 'machine', 'agent', '.']
train
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/machine.py#L231-L240
2,846
AtteqCom/zsl
src/zsl/application/containers/container.py
IoCContainer.modules
def modules(cls): """Collect all the public class attributes. All class attributes should be a DI modules, this method collects them and returns as a list. :return: list of DI modules :rtype: list[Union[Module, Callable]] """ members = inspect.getmembers(cls, la...
python
def modules(cls): """Collect all the public class attributes. All class attributes should be a DI modules, this method collects them and returns as a list. :return: list of DI modules :rtype: list[Union[Module, Callable]] """ members = inspect.getmembers(cls, la...
['def', 'modules', '(', 'cls', ')', ':', 'members', '=', 'inspect', '.', 'getmembers', '(', 'cls', ',', 'lambda', 'a', ':', 'not', '(', 'inspect', '.', 'isroutine', '(', 'a', ')', 'and', 'a', '.', '__name__', '==', "'modules'", ')', ')', 'modules', '=', '[', 'module', 'for', 'name', ',', 'module', 'in', 'members', 'if'...
Collect all the public class attributes. All class attributes should be a DI modules, this method collects them and returns as a list. :return: list of DI modules :rtype: list[Union[Module, Callable]]
['Collect', 'all', 'the', 'public', 'class', 'attributes', '.']
train
https://github.com/AtteqCom/zsl/blob/ab51a96da1780ff642912396d4b85bdcb72560c1/src/zsl/application/containers/container.py#L24-L35
2,847
ambitioninc/django-query-builder
querybuilder/query.py
Query.explain
def explain(self, sql=None, sql_args=None): """ Runs EXPLAIN on this query :type sql: str or None :param sql: The sql to run EXPLAIN on. If None is specified, the query will use ``self.get_sql()`` :type sql_args: dict or None :param sql_args: A dictionary of...
python
def explain(self, sql=None, sql_args=None): """ Runs EXPLAIN on this query :type sql: str or None :param sql: The sql to run EXPLAIN on. If None is specified, the query will use ``self.get_sql()`` :type sql_args: dict or None :param sql_args: A dictionary of...
['def', 'explain', '(', 'self', ',', 'sql', '=', 'None', ',', 'sql_args', '=', 'None', ')', ':', 'cursor', '=', 'self', '.', 'get_cursor', '(', ')', 'if', 'sql', 'is', 'None', ':', 'sql', '=', 'self', '.', 'get_sql', '(', ')', 'sql_args', '=', 'self', '.', 'get_args', '(', ')', 'elif', 'sql_args', 'is', 'None', ':', 's...
Runs EXPLAIN on this query :type sql: str or None :param sql: The sql to run EXPLAIN on. If None is specified, the query will use ``self.get_sql()`` :type sql_args: dict or None :param sql_args: A dictionary of the arguments to be escaped in the query. If None and ...
['Runs', 'EXPLAIN', 'on', 'this', 'query']
train
https://github.com/ambitioninc/django-query-builder/blob/113a7d845d3ddc6a45621b9880308e756f87c5bf/querybuilder/query.py#L1557-L1581
2,848
dropbox/stone
stone/backends/obj_c_types.py
ObjCTypesBackend._generate_serializer_signatures
def _generate_serializer_signatures(self, obj_name): """Emits the signatures of the serializer object's serializing functions.""" serial_signature = fmt_signature( func='serialize', args=fmt_func_args_declaration([( 'instance', '{} *'.format(obj_name))]), ...
python
def _generate_serializer_signatures(self, obj_name): """Emits the signatures of the serializer object's serializing functions.""" serial_signature = fmt_signature( func='serialize', args=fmt_func_args_declaration([( 'instance', '{} *'.format(obj_name))]), ...
['def', '_generate_serializer_signatures', '(', 'self', ',', 'obj_name', ')', ':', 'serial_signature', '=', 'fmt_signature', '(', 'func', '=', "'serialize'", ',', 'args', '=', 'fmt_func_args_declaration', '(', '[', '(', "'instance'", ',', "'{} *'", '.', 'format', '(', 'obj_name', ')', ')', ']', ')', ',', 'return_type',...
Emits the signatures of the serializer object's serializing functions.
['Emits', 'the', 'signatures', 'of', 'the', 'serializer', 'object', 's', 'serializing', 'functions', '.']
train
https://github.com/dropbox/stone/blob/2e95cbcd1c48e05cca68c919fd8d24adec6b0f58/stone/backends/obj_c_types.py#L687-L733
2,849
spotify/luigi
luigi/contrib/kubernetes.py
KubernetesJobTask.__get_job_status
def __get_job_status(self): """Return the Kubernetes job status""" # Figure out status and return it job = self.__get_job() if "succeeded" in job.obj["status"] and job.obj["status"]["succeeded"] > 0: job.scale(replicas=0) if self.print_pod_logs_on_exit: ...
python
def __get_job_status(self): """Return the Kubernetes job status""" # Figure out status and return it job = self.__get_job() if "succeeded" in job.obj["status"] and job.obj["status"]["succeeded"] > 0: job.scale(replicas=0) if self.print_pod_logs_on_exit: ...
['def', '__get_job_status', '(', 'self', ')', ':', '# Figure out status and return it', 'job', '=', 'self', '.', '__get_job', '(', ')', 'if', '"succeeded"', 'in', 'job', '.', 'obj', '[', '"status"', ']', 'and', 'job', '.', 'obj', '[', '"status"', ']', '[', '"succeeded"', ']', '>', '0', ':', 'job', '.', 'scale', '(', 'r...
Return the Kubernetes job status
['Return', 'the', 'Kubernetes', 'job', 'status']
train
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/kubernetes.py#L298-L320
2,850
SheffieldML/GPy
GPy/util/warping_functions.py
TanhFunction.fgrad_y
def fgrad_y(self, y, return_precalc=False): """ gradient of f w.r.t to y ([N x 1]) :returns: Nx1 vector of derivatives, unless return_precalc is true, then it also returns the precomputed stuff """ d = self.d mpsi = self.psi # vectorized version ...
python
def fgrad_y(self, y, return_precalc=False): """ gradient of f w.r.t to y ([N x 1]) :returns: Nx1 vector of derivatives, unless return_precalc is true, then it also returns the precomputed stuff """ d = self.d mpsi = self.psi # vectorized version ...
['def', 'fgrad_y', '(', 'self', ',', 'y', ',', 'return_precalc', '=', 'False', ')', ':', 'd', '=', 'self', '.', 'd', 'mpsi', '=', 'self', '.', 'psi', '# vectorized version', 'S', '=', '(', 'mpsi', '[', ':', ',', '1', ']', '*', '(', 'y', '[', ':', ',', ':', ',', 'None', ']', '+', 'mpsi', '[', ':', ',', '2', ']', ')', ')...
gradient of f w.r.t to y ([N x 1]) :returns: Nx1 vector of derivatives, unless return_precalc is true, then it also returns the precomputed stuff
['gradient', 'of', 'f', 'w', '.', 'r', '.', 't', 'to', 'y', '(', '[', 'N', 'x', '1', ']', ')']
train
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/warping_functions.py#L108-L128
2,851
fhs/pyhdf
pyhdf/VS.py
VS.find
def find(self, vName): """Get the reference number of a vdata given its name. The vdata can then be opened (attached) by passing this reference number to the attach() method. Args:: vName Name of the vdata for which the reference number is needed. vdatas...
python
def find(self, vName): """Get the reference number of a vdata given its name. The vdata can then be opened (attached) by passing this reference number to the attach() method. Args:: vName Name of the vdata for which the reference number is needed. vdatas...
['def', 'find', '(', 'self', ',', 'vName', ')', ':', 'refNum', '=', '_C', '.', 'VSfind', '(', 'self', '.', '_hdf_inst', '.', '_id', ',', 'vName', ')', '_checkErr', '(', '"find"', ',', 'refNum', ',', '"cannot find vdata %s"', '%', 'vName', ')', 'return', 'refNum']
Get the reference number of a vdata given its name. The vdata can then be opened (attached) by passing this reference number to the attach() method. Args:: vName Name of the vdata for which the reference number is needed. vdatas names are not guaranteed to be ...
['Get', 'the', 'reference', 'number', 'of', 'a', 'vdata', 'given', 'its', 'name', '.', 'The', 'vdata', 'can', 'then', 'be', 'opened', '(', 'attached', ')', 'by', 'passing', 'this', 'reference', 'number', 'to', 'the', 'attach', '()', 'method', '.']
train
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/VS.py#L961-L982
2,852
flo-compbio/genometools
genometools/expression/matrix.py
ExpMatrix.sample_correlations
def sample_correlations(self): """Returns an `ExpMatrix` containing all pairwise sample correlations. Returns ------- `ExpMatrix` The sample correlation matrix. """ C = np.corrcoef(self.X.T) corr_matrix = ExpMatrix(genes=self.samples, samples=self.sa...
python
def sample_correlations(self): """Returns an `ExpMatrix` containing all pairwise sample correlations. Returns ------- `ExpMatrix` The sample correlation matrix. """ C = np.corrcoef(self.X.T) corr_matrix = ExpMatrix(genes=self.samples, samples=self.sa...
['def', 'sample_correlations', '(', 'self', ')', ':', 'C', '=', 'np', '.', 'corrcoef', '(', 'self', '.', 'X', '.', 'T', ')', 'corr_matrix', '=', 'ExpMatrix', '(', 'genes', '=', 'self', '.', 'samples', ',', 'samples', '=', 'self', '.', 'samples', ',', 'X', '=', 'C', ')', 'return', 'corr_matrix']
Returns an `ExpMatrix` containing all pairwise sample correlations. Returns ------- `ExpMatrix` The sample correlation matrix.
['Returns', 'an', 'ExpMatrix', 'containing', 'all', 'pairwise', 'sample', 'correlations', '.']
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/expression/matrix.py#L411-L422
2,853
apache/spark
python/pyspark/sql/types.py
UserDefinedType._cachedSqlType
def _cachedSqlType(cls): """ Cache the sqlType() into class, because it's heavy used in `toInternal`. """ if not hasattr(cls, "_cached_sql_type"): cls._cached_sql_type = cls.sqlType() return cls._cached_sql_type
python
def _cachedSqlType(cls): """ Cache the sqlType() into class, because it's heavy used in `toInternal`. """ if not hasattr(cls, "_cached_sql_type"): cls._cached_sql_type = cls.sqlType() return cls._cached_sql_type
['def', '_cachedSqlType', '(', 'cls', ')', ':', 'if', 'not', 'hasattr', '(', 'cls', ',', '"_cached_sql_type"', ')', ':', 'cls', '.', '_cached_sql_type', '=', 'cls', '.', 'sqlType', '(', ')', 'return', 'cls', '.', '_cached_sql_type']
Cache the sqlType() into class, because it's heavy used in `toInternal`.
['Cache', 'the', 'sqlType', '()', 'into', 'class', 'because', 'it', 's', 'heavy', 'used', 'in', 'toInternal', '.']
train
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/types.py#L675-L681
2,854
galaxyproject/pulsar
pulsar/web/wsgi.py
app_factory
def app_factory(global_conf, **local_conf): """ Returns the Pulsar WSGI application. """ configuration_file = global_conf.get("__file__", None) webapp = init_webapp(ini_path=configuration_file, local_conf=local_conf) return webapp
python
def app_factory(global_conf, **local_conf): """ Returns the Pulsar WSGI application. """ configuration_file = global_conf.get("__file__", None) webapp = init_webapp(ini_path=configuration_file, local_conf=local_conf) return webapp
['def', 'app_factory', '(', 'global_conf', ',', '*', '*', 'local_conf', ')', ':', 'configuration_file', '=', 'global_conf', '.', 'get', '(', '"__file__"', ',', 'None', ')', 'webapp', '=', 'init_webapp', '(', 'ini_path', '=', 'configuration_file', ',', 'local_conf', '=', 'local_conf', ')', 'return', 'webapp']
Returns the Pulsar WSGI application.
['Returns', 'the', 'Pulsar', 'WSGI', 'application', '.']
train
https://github.com/galaxyproject/pulsar/blob/9ab6683802884324652da0a9f0808c7eb59d3ab4/pulsar/web/wsgi.py#L14-L20
2,855
kpdyer/libfte
fte/encrypter.py
Encrypter.getCiphertextLen
def getCiphertextLen(self, ciphertext): """Given a ``ciphertext`` with a valid header, returns the length of the ciphertext inclusive of ciphertext expansion. """ plaintext_length = self.getPlaintextLen(ciphertext) ciphertext_length = plaintext_length + Encrypter._CTXT_EXPANSION ...
python
def getCiphertextLen(self, ciphertext): """Given a ``ciphertext`` with a valid header, returns the length of the ciphertext inclusive of ciphertext expansion. """ plaintext_length = self.getPlaintextLen(ciphertext) ciphertext_length = plaintext_length + Encrypter._CTXT_EXPANSION ...
['def', 'getCiphertextLen', '(', 'self', ',', 'ciphertext', ')', ':', 'plaintext_length', '=', 'self', '.', 'getPlaintextLen', '(', 'ciphertext', ')', 'ciphertext_length', '=', 'plaintext_length', '+', 'Encrypter', '.', '_CTXT_EXPANSION', 'return', 'ciphertext_length']
Given a ``ciphertext`` with a valid header, returns the length of the ciphertext inclusive of ciphertext expansion.
['Given', 'a', 'ciphertext', 'with', 'a', 'valid', 'header', 'returns', 'the', 'length', 'of', 'the', 'ciphertext', 'inclusive', 'of', 'ciphertext', 'expansion', '.']
train
https://github.com/kpdyer/libfte/blob/74ed6ad197b6e72d1b9709c4dbc04041e05eb9b7/fte/encrypter.py#L173-L179
2,856
caseyjlaw/rtpipe
rtpipe/nbpipeline.py
state.save
def save(self, obj, label, format='text'): """ Save or update obj as pkl file with name label format can be 'text' or 'pickle'. """ # initialize hidden state directory objloc = '{0}/{1}'.format(self.statedir, label) with open(objloc, 'w') as fp: if format...
python
def save(self, obj, label, format='text'): """ Save or update obj as pkl file with name label format can be 'text' or 'pickle'. """ # initialize hidden state directory objloc = '{0}/{1}'.format(self.statedir, label) with open(objloc, 'w') as fp: if format...
['def', 'save', '(', 'self', ',', 'obj', ',', 'label', ',', 'format', '=', "'text'", ')', ':', '# initialize hidden state directory', 'objloc', '=', "'{0}/{1}'", '.', 'format', '(', 'self', '.', 'statedir', ',', 'label', ')', 'with', 'open', '(', 'objloc', ',', "'w'", ')', 'as', 'fp', ':', 'if', 'format', '==', "'pickl...
Save or update obj as pkl file with name label format can be 'text' or 'pickle'.
['Save', 'or', 'update', 'obj', 'as', 'pkl', 'file', 'with', 'name', 'label']
train
https://github.com/caseyjlaw/rtpipe/blob/ac33e4332cf215091a63afbb3137850876d73ec0/rtpipe/nbpipeline.py#L24-L42
2,857
mk-fg/feedjack
feedjack/models.py
Feed.update_handler
def update_handler(feeds): '''Update all cross-referencing filters results for feeds and others, related to them. Intended to be called from non-Feed update hooks (like new Post saving).''' # Check if this call is a result of actions initiated from # one of the hooks in a higher frame (resulting in recursion)...
python
def update_handler(feeds): '''Update all cross-referencing filters results for feeds and others, related to them. Intended to be called from non-Feed update hooks (like new Post saving).''' # Check if this call is a result of actions initiated from # one of the hooks in a higher frame (resulting in recursion)...
['def', 'update_handler', '(', 'feeds', ')', ':', '# Check if this call is a result of actions initiated from', '# one of the hooks in a higher frame (resulting in recursion).', 'if', 'Feed', '.', '_filters_update_handler_lock', ':', 'return', 'return', 'Feed', '.', '_filters_update_handler', '(', 'Feed', ',', 'feeds'...
Update all cross-referencing filters results for feeds and others, related to them. Intended to be called from non-Feed update hooks (like new Post saving).
['Update', 'all', 'cross', '-', 'referencing', 'filters', 'results', 'for', 'feeds', 'and', 'others', 'related', 'to', 'them', '.', 'Intended', 'to', 'be', 'called', 'from', 'non', '-', 'Feed', 'update', 'hooks', '(', 'like', 'new', 'Post', 'saving', ')', '.']
train
https://github.com/mk-fg/feedjack/blob/3fe65c0f66dc2cfdf45834aaa7235ec9f81b3ca3/feedjack/models.py#L616-L622
2,858
mitsei/dlkit
dlkit/json_/authentication/sessions.py
AgentLookupSession.get_agents_by_genus_type
def get_agents_by_genus_type(self, agent_genus_type): """Gets an ``AgentList`` corresponding to the given agent genus ``Type`` which does not include agents of genus types derived from the specified ``Type``. In plenary mode, the returned list contains all known agents or an error results. Othe...
python
def get_agents_by_genus_type(self, agent_genus_type): """Gets an ``AgentList`` corresponding to the given agent genus ``Type`` which does not include agents of genus types derived from the specified ``Type``. In plenary mode, the returned list contains all known agents or an error results. Othe...
['def', 'get_agents_by_genus_type', '(', 'self', ',', 'agent_genus_type', ')', ':', '# Implemented from template for', '# osid.resource.ResourceLookupSession.get_resources_by_genus_type', '# NOTE: This implementation currently ignores plenary view', 'collection', '=', 'JSONClientValidated', '(', "'authentication'", ','...
Gets an ``AgentList`` corresponding to the given agent genus ``Type`` which does not include agents of genus types derived from the specified ``Type``. In plenary mode, the returned list contains all known agents or an error results. Otherwise, the returned list may contain only those agents th...
['Gets', 'an', 'AgentList', 'corresponding', 'to', 'the', 'given', 'agent', 'genus', 'Type', 'which', 'does', 'not', 'include', 'agents', 'of', 'genus', 'types', 'derived', 'from', 'the', 'specified', 'Type', '.']
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/authentication/sessions.py#L255-L280
2,859
jleinonen/pytmatrix
pytmatrix/tmatrix.py
Scatterer._set_scatter_signature
def _set_scatter_signature(self): """Mark the amplitude and scattering matrices as up to date. """ self._scatter_signature = (self.thet0, self.thet, self.phi0, self.phi, self.alpha, self.beta, self.orient)
python
def _set_scatter_signature(self): """Mark the amplitude and scattering matrices as up to date. """ self._scatter_signature = (self.thet0, self.thet, self.phi0, self.phi, self.alpha, self.beta, self.orient)
['def', '_set_scatter_signature', '(', 'self', ')', ':', 'self', '.', '_scatter_signature', '=', '(', 'self', '.', 'thet0', ',', 'self', '.', 'thet', ',', 'self', '.', 'phi0', ',', 'self', '.', 'phi', ',', 'self', '.', 'alpha', ',', 'self', '.', 'beta', ',', 'self', '.', 'orient', ')']
Mark the amplitude and scattering matrices as up to date.
['Mark', 'the', 'amplitude', 'and', 'scattering', 'matrices', 'as', 'up', 'to', 'date', '.']
train
https://github.com/jleinonen/pytmatrix/blob/8803507fe5332786feab105fa74acf63e7121718/pytmatrix/tmatrix.py#L231-L235
2,860
jasedit/pymmd
pymmd/mmd.py
has_metadata
def has_metadata(source, ext): """Returns a flag indicating if a given block of MultiMarkdown text contains metadata.""" _MMD_LIB.has_metadata.argtypes = [ctypes.c_char_p, ctypes.c_int] _MMD_LIB.has_metadata.restype = ctypes.c_bool return _MMD_LIB.has_metadata(source.encode('utf-8'), ext)
python
def has_metadata(source, ext): """Returns a flag indicating if a given block of MultiMarkdown text contains metadata.""" _MMD_LIB.has_metadata.argtypes = [ctypes.c_char_p, ctypes.c_int] _MMD_LIB.has_metadata.restype = ctypes.c_bool return _MMD_LIB.has_metadata(source.encode('utf-8'), ext)
['def', 'has_metadata', '(', 'source', ',', 'ext', ')', ':', '_MMD_LIB', '.', 'has_metadata', '.', 'argtypes', '=', '[', 'ctypes', '.', 'c_char_p', ',', 'ctypes', '.', 'c_int', ']', '_MMD_LIB', '.', 'has_metadata', '.', 'restype', '=', 'ctypes', '.', 'c_bool', 'return', '_MMD_LIB', '.', 'has_metadata', '(', 'source', '...
Returns a flag indicating if a given block of MultiMarkdown text contains metadata.
['Returns', 'a', 'flag', 'indicating', 'if', 'a', 'given', 'block', 'of', 'MultiMarkdown', 'text', 'contains', 'metadata', '.']
train
https://github.com/jasedit/pymmd/blob/37b5a717241b837ca15b8a4d4cc3c06b4456bfbd/pymmd/mmd.py#L103-L107
2,861
kodexlab/reliure
reliure/pipeline.py
Optionable.get_options
def get_options(self, hidden=False): """ :param hidden: whether to return hidden options :type hidden: bool :returns: dictionary of all options (with option's information) :rtype: dict """ return dict((opt['name'], opt) for opt in self.get_ordered_options(hidden=h...
python
def get_options(self, hidden=False): """ :param hidden: whether to return hidden options :type hidden: bool :returns: dictionary of all options (with option's information) :rtype: dict """ return dict((opt['name'], opt) for opt in self.get_ordered_options(hidden=h...
['def', 'get_options', '(', 'self', ',', 'hidden', '=', 'False', ')', ':', 'return', 'dict', '(', '(', 'opt', '[', "'name'", ']', ',', 'opt', ')', 'for', 'opt', 'in', 'self', '.', 'get_ordered_options', '(', 'hidden', '=', 'hidden', ')', ')']
:param hidden: whether to return hidden options :type hidden: bool :returns: dictionary of all options (with option's information) :rtype: dict
[':', 'param', 'hidden', ':', 'whether', 'to', 'return', 'hidden', 'options', ':', 'type', 'hidden', ':', 'bool', ':', 'returns', ':', 'dictionary', 'of', 'all', 'options', '(', 'with', 'option', 's', 'information', ')', ':', 'rtype', ':', 'dict']
train
https://github.com/kodexlab/reliure/blob/0450c7a9254c5c003162738458bbe0c49e777ba5/reliure/pipeline.py#L307-L314
2,862
MillionIntegrals/vel
vel/rl/models/stochastic_policy_model.py
StochasticPolicyModelFactory.instantiate
def instantiate(self, **extra_args): """ Instantiate the model """ input_block = self.input_block.instantiate() backbone = self.backbone.instantiate(**extra_args) return StochasticPolicyModel(input_block, backbone, extra_args['action_space'])
python
def instantiate(self, **extra_args): """ Instantiate the model """ input_block = self.input_block.instantiate() backbone = self.backbone.instantiate(**extra_args) return StochasticPolicyModel(input_block, backbone, extra_args['action_space'])
['def', 'instantiate', '(', 'self', ',', '*', '*', 'extra_args', ')', ':', 'input_block', '=', 'self', '.', 'input_block', '.', 'instantiate', '(', ')', 'backbone', '=', 'self', '.', 'backbone', '.', 'instantiate', '(', '*', '*', 'extra_args', ')', 'return', 'StochasticPolicyModel', '(', 'input_block', ',', 'backbone',...
Instantiate the model
['Instantiate', 'the', 'model']
train
https://github.com/MillionIntegrals/vel/blob/e0726e1f63742b728966ccae0c8b825ea0ba491a/vel/rl/models/stochastic_policy_model.py#L110-L115
2,863
apache/spark
python/pyspark/ml/image.py
_ImageSchema.readImages
def readImages(self, path, recursive=False, numPartitions=-1, dropImageFailures=False, sampleRatio=1.0, seed=0): """ Reads the directory of images from the local or remote source. .. note:: If multiple jobs are run in parallel with different sampleRatio or recursive flag, ...
python
def readImages(self, path, recursive=False, numPartitions=-1, dropImageFailures=False, sampleRatio=1.0, seed=0): """ Reads the directory of images from the local or remote source. .. note:: If multiple jobs are run in parallel with different sampleRatio or recursive flag, ...
['def', 'readImages', '(', 'self', ',', 'path', ',', 'recursive', '=', 'False', ',', 'numPartitions', '=', '-', '1', ',', 'dropImageFailures', '=', 'False', ',', 'sampleRatio', '=', '1.0', ',', 'seed', '=', '0', ')', ':', 'warnings', '.', 'warn', '(', '"`ImageSchema.readImage` is deprecated. "', '+', '"Use `spark.read....
Reads the directory of images from the local or remote source. .. note:: If multiple jobs are run in parallel with different sampleRatio or recursive flag, there may be a race condition where one job overwrites the hadoop configs of another. .. note:: If sample ratio is less than 1, sampli...
['Reads', 'the', 'directory', 'of', 'images', 'from', 'the', 'local', 'or', 'remote', 'source', '.']
train
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/ml/image.py#L206-L242
2,864
glomex/gcdt
gcdt/ramuda_core.py
invoke
def invoke(awsclient, function_name, payload, invocation_type=None, alias_name=ALIAS_NAME, version=None, outfile=None): """Send a ping request to a lambda function. :param awsclient: :param function_name: :param payload: :param invocation_type: :param alias_name: :param version: ...
python
def invoke(awsclient, function_name, payload, invocation_type=None, alias_name=ALIAS_NAME, version=None, outfile=None): """Send a ping request to a lambda function. :param awsclient: :param function_name: :param payload: :param invocation_type: :param alias_name: :param version: ...
['def', 'invoke', '(', 'awsclient', ',', 'function_name', ',', 'payload', ',', 'invocation_type', '=', 'None', ',', 'alias_name', '=', 'ALIAS_NAME', ',', 'version', '=', 'None', ',', 'outfile', '=', 'None', ')', ':', 'log', '.', 'debug', '(', "'invoking lambda function: %s'", ',', 'function_name', ')', 'client_lambda',...
Send a ping request to a lambda function. :param awsclient: :param function_name: :param payload: :param invocation_type: :param alias_name: :param version: :param outfile: write response to file :return: ping response payload
['Send', 'a', 'ping', 'request', 'to', 'a', 'lambda', 'function', '.']
train
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/ramuda_core.py#L654-L700
2,865
jic-dtool/dtool-config
dtool_config/cli.py
readme_template
def readme_template(readme_template_file): """Display / set / update the readme template file.""" if not readme_template_file: click.secho(dtool_config.utils.get_readme_template_fpath( CONFIG_PATH, )) else: click.secho(dtool_config.utils.set_readme_template_fpath( ...
python
def readme_template(readme_template_file): """Display / set / update the readme template file.""" if not readme_template_file: click.secho(dtool_config.utils.get_readme_template_fpath( CONFIG_PATH, )) else: click.secho(dtool_config.utils.set_readme_template_fpath( ...
['def', 'readme_template', '(', 'readme_template_file', ')', ':', 'if', 'not', 'readme_template_file', ':', 'click', '.', 'secho', '(', 'dtool_config', '.', 'utils', '.', 'get_readme_template_fpath', '(', 'CONFIG_PATH', ',', ')', ')', 'else', ':', 'click', '.', 'secho', '(', 'dtool_config', '.', 'utils', '.', 'set_read...
Display / set / update the readme template file.
['Display', '/', 'set', '/', 'update', 'the', 'readme', 'template', 'file', '.']
train
https://github.com/jic-dtool/dtool-config/blob/21afa99a6794909e1d0180a45895492b4b726a51/dtool_config/cli.py#L53-L63
2,866
brutasse/graphite-api
graphite_api/functions.py
_getFirstPathExpression
def _getFirstPathExpression(name): """Returns the first metric path in an expression.""" tokens = grammar.parseString(name) pathExpression = None while pathExpression is None: if tokens.pathExpression: pathExpression = tokens.pathExpression elif tokens.expression: ...
python
def _getFirstPathExpression(name): """Returns the first metric path in an expression.""" tokens = grammar.parseString(name) pathExpression = None while pathExpression is None: if tokens.pathExpression: pathExpression = tokens.pathExpression elif tokens.expression: ...
['def', '_getFirstPathExpression', '(', 'name', ')', ':', 'tokens', '=', 'grammar', '.', 'parseString', '(', 'name', ')', 'pathExpression', '=', 'None', 'while', 'pathExpression', 'is', 'None', ':', 'if', 'tokens', '.', 'pathExpression', ':', 'pathExpression', '=', 'tokens', '.', 'pathExpression', 'elif', 'tokens', '.'...
Returns the first metric path in an expression.
['Returns', 'the', 'first', 'metric', 'path', 'in', 'an', 'expression', '.']
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L1921-L1934
2,867
fracpete/python-weka-wrapper3
python/weka/core/dataset.py
Instances.template_instances
def template_instances(cls, dataset, capacity=0): """ Uses the Instances as template to create an empty dataset. :param dataset: the original dataset :type dataset: Instances :param capacity: how many data rows to reserve initially (see compactify) :type capacity: int ...
python
def template_instances(cls, dataset, capacity=0): """ Uses the Instances as template to create an empty dataset. :param dataset: the original dataset :type dataset: Instances :param capacity: how many data rows to reserve initially (see compactify) :type capacity: int ...
['def', 'template_instances', '(', 'cls', ',', 'dataset', ',', 'capacity', '=', '0', ')', ':', 'return', 'Instances', '(', 'javabridge', '.', 'make_instance', '(', '"weka/core/Instances"', ',', '"(Lweka/core/Instances;I)V"', ',', 'dataset', '.', 'jobject', ',', 'capacity', ')', ')']
Uses the Instances as template to create an empty dataset. :param dataset: the original dataset :type dataset: Instances :param capacity: how many data rows to reserve initially (see compactify) :type capacity: int :return: the empty dataset :rtype: Instances
['Uses', 'the', 'Instances', 'as', 'template', 'to', 'create', 'an', 'empty', 'dataset', '.']
train
https://github.com/fracpete/python-weka-wrapper3/blob/d850ab1bdb25fbd5a8d86e99f34a397975425838/python/weka/core/dataset.py#L435-L448
2,868
saltstack/salt
salt/modules/boto_apigateway.py
describe_api_deployments
def describe_api_deployments(restApiId, region=None, key=None, keyid=None, profile=None): ''' Gets information about the defined API Deployments. Return list of api deployments. CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_api_deployments restApiId ''' tr...
python
def describe_api_deployments(restApiId, region=None, key=None, keyid=None, profile=None): ''' Gets information about the defined API Deployments. Return list of api deployments. CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_api_deployments restApiId ''' tr...
['def', 'describe_api_deployments', '(', 'restApiId', ',', 'region', '=', 'None', ',', 'key', '=', 'None', ',', 'keyid', '=', 'None', ',', 'profile', '=', 'None', ')', ':', 'try', ':', 'conn', '=', '_get_conn', '(', 'region', '=', 'region', ',', 'key', '=', 'key', ',', 'keyid', '=', 'keyid', ',', 'profile', '=', 'profi...
Gets information about the defined API Deployments. Return list of api deployments. CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_api_deployments restApiId
['Gets', 'information', 'about', 'the', 'defined', 'API', 'Deployments', '.', 'Return', 'list', 'of', 'api', 'deployments', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_apigateway.py#L656-L681
2,869
317070/python-twitch-stream
twitchstream/chat.py
TwitchChatStream._push_from_buffer
def _push_from_buffer(self): """ Push a message on the stack to the IRC stream. This is necessary to avoid Twitch overflow control. """ if len(self.buffer) > 0: if time.time() - self.last_sent_time > 5: try: message = self.buffer.po...
python
def _push_from_buffer(self): """ Push a message on the stack to the IRC stream. This is necessary to avoid Twitch overflow control. """ if len(self.buffer) > 0: if time.time() - self.last_sent_time > 5: try: message = self.buffer.po...
['def', '_push_from_buffer', '(', 'self', ')', ':', 'if', 'len', '(', 'self', '.', 'buffer', ')', '>', '0', ':', 'if', 'time', '.', 'time', '(', ')', '-', 'self', '.', 'last_sent_time', '>', '5', ':', 'try', ':', 'message', '=', 'self', '.', 'buffer', '.', 'pop', '(', '0', ')', 'self', '.', 's', '.', 'send', '(', 'mess...
Push a message on the stack to the IRC stream. This is necessary to avoid Twitch overflow control.
['Push', 'a', 'message', 'on', 'the', 'stack', 'to', 'the', 'IRC', 'stream', '.', 'This', 'is', 'necessary', 'to', 'avoid', 'Twitch', 'overflow', 'control', '.']
train
https://github.com/317070/python-twitch-stream/blob/83b4c2a27ee368fc3316b59ab1d25fcf0b0bcda6/twitchstream/chat.py#L159-L172
2,870
vxgmichel/aiostream
examples/extra.py
power
async def power(source, exponent): """Raise the elements of an asynchronous sequence to the given power.""" async with streamcontext(source) as streamer: async for item in streamer: yield item ** exponent
python
async def power(source, exponent): """Raise the elements of an asynchronous sequence to the given power.""" async with streamcontext(source) as streamer: async for item in streamer: yield item ** exponent
['async', 'def', 'power', '(', 'source', ',', 'exponent', ')', ':', 'async', 'with', 'streamcontext', '(', 'source', ')', 'as', 'streamer', ':', 'async', 'for', 'item', 'in', 'streamer', ':', 'yield', 'item', '**', 'exponent']
Raise the elements of an asynchronous sequence to the given power.
['Raise', 'the', 'elements', 'of', 'an', 'asynchronous', 'sequence', 'to', 'the', 'given', 'power', '.']
train
https://github.com/vxgmichel/aiostream/blob/43bdf04ab19108a3f1b5a472062e1392a26cbcf8/examples/extra.py#L16-L20
2,871
radjkarl/imgProcessor
imgProcessor/camera/PerspectiveCorrection.py
PerspectiveCorrection._calcQuadSize
def _calcQuadSize(corners, aspectRatio): ''' return the size of a rectangle in perspective distortion in [px] DEBUG: PUT THAT BACK IN??:: if aspectRatio is not given is will be determined ''' if aspectRatio > 1: # x is bigger -> reduce y x_length =...
python
def _calcQuadSize(corners, aspectRatio): ''' return the size of a rectangle in perspective distortion in [px] DEBUG: PUT THAT BACK IN??:: if aspectRatio is not given is will be determined ''' if aspectRatio > 1: # x is bigger -> reduce y x_length =...
['def', '_calcQuadSize', '(', 'corners', ',', 'aspectRatio', ')', ':', 'if', 'aspectRatio', '>', '1', ':', '# x is bigger -> reduce y\r', 'x_length', '=', 'PerspectiveCorrection', '.', '_quadXLength', '(', 'corners', ')', 'y', '=', 'x_length', '/', 'aspectRatio', 'return', 'x_length', ',', 'y', 'else', ':', '# y is big...
return the size of a rectangle in perspective distortion in [px] DEBUG: PUT THAT BACK IN??:: if aspectRatio is not given is will be determined
['return', 'the', 'size', 'of', 'a', 'rectangle', 'in', 'perspective', 'distortion', 'in', '[', 'px', ']', 'DEBUG', ':', 'PUT', 'THAT', 'BACK', 'IN??', '::', 'if', 'aspectRatio', 'is', 'not', 'given', 'is', 'will', 'be', 'determined']
train
https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/camera/PerspectiveCorrection.py#L810-L823
2,872
mobolic/facebook-sdk
facebook/__init__.py
GraphAPI.get_object
def get_object(self, id, **args): """Fetches the given object from the graph.""" return self.request("{0}/{1}".format(self.version, id), args)
python
def get_object(self, id, **args): """Fetches the given object from the graph.""" return self.request("{0}/{1}".format(self.version, id), args)
['def', 'get_object', '(', 'self', ',', 'id', ',', '*', '*', 'args', ')', ':', 'return', 'self', '.', 'request', '(', '"{0}/{1}"', '.', 'format', '(', 'self', '.', 'version', ',', 'id', ')', ',', 'args', ')']
Fetches the given object from the graph.
['Fetches', 'the', 'given', 'object', 'from', 'the', 'graph', '.']
train
https://github.com/mobolic/facebook-sdk/blob/65ff582e77f7ed68b6e9643a7490e5dee2a1031b/facebook/__init__.py#L133-L135
2,873
klmitch/tendril
tendril/manager.py
TendrilManager.get_local_addr
def get_local_addr(self, timeout=None): """ Retrieve the current local address. :param timeout: If not given or given as ``None``, waits until the local address is available. Otherwise, waits for as long as specified. If the local ...
python
def get_local_addr(self, timeout=None): """ Retrieve the current local address. :param timeout: If not given or given as ``None``, waits until the local address is available. Otherwise, waits for as long as specified. If the local ...
['def', 'get_local_addr', '(', 'self', ',', 'timeout', '=', 'None', ')', ':', "# If we're not running, just return None", 'if', 'not', 'self', '.', 'running', ':', 'return', 'None', "# OK, we're running; wait on the _local_addr_event", 'if', 'not', 'self', '.', '_local_addr_event', '.', 'wait', '(', 'timeout', ')', ':'...
Retrieve the current local address. :param timeout: If not given or given as ``None``, waits until the local address is available. Otherwise, waits for as long as specified. If the local address is not set by the time the timeout ...
['Retrieve', 'the', 'current', 'local', 'address', '.']
train
https://github.com/klmitch/tendril/blob/207102c83e88f8f1fa7ba605ef0aab2ae9078b36/tendril/manager.py#L291-L312
2,874
secdev/scapy
scapy/contrib/http2.py
AbstractUVarIntField.addfield
def addfield(self, pkt, s, val): # type: (Optional[packet.Packet], Union[str, Tuple[str, int, int]], int) -> str # noqa: E501 """ An AbstractUVarIntField prefix always consumes the remaining bits of a BitField;if no current BitField is in use (no tuple in entry) then the prefix leng...
python
def addfield(self, pkt, s, val): # type: (Optional[packet.Packet], Union[str, Tuple[str, int, int]], int) -> str # noqa: E501 """ An AbstractUVarIntField prefix always consumes the remaining bits of a BitField;if no current BitField is in use (no tuple in entry) then the prefix leng...
['def', 'addfield', '(', 'self', ',', 'pkt', ',', 's', ',', 'val', ')', ':', '# type: (Optional[packet.Packet], Union[str, Tuple[str, int, int]], int) -> str # noqa: E501', 'assert', '(', 'val', '>=', '0', ')', 'if', 'isinstance', '(', 's', ',', 'bytes', ')', ':', 'assert', 'self', '.', 'size', '==', '8', ',', "'EINVA...
An AbstractUVarIntField prefix always consumes the remaining bits of a BitField;if no current BitField is in use (no tuple in entry) then the prefix length is 8 bits and the whole byte is to be consumed @param packet.Packet|None pkt: the packet containing this field. Probably unuse...
['An', 'AbstractUVarIntField', 'prefix', 'always', 'consumes', 'the', 'remaining', 'bits', 'of', 'a', 'BitField', ';', 'if', 'no', 'current', 'BitField', 'is', 'in', 'use', '(', 'no', 'tuple', 'in', 'entry', ')', 'then', 'the', 'prefix', 'length', 'is', '8', 'bits', 'and', 'the', 'whole', 'byte', 'is', 'to', 'be', 'con...
train
https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/http2.py#L368-L397
2,875
txomon/abot
abot/cli.py
AsyncCommandMixin.invoke
def invoke(self, ctx): """Given a context, this invokes the attached callback (if it exists) in the right way. """ if self.callback is not None: loop = asyncio.get_event_loop() return loop.run_until_complete(self.async_invoke(ctx))
python
def invoke(self, ctx): """Given a context, this invokes the attached callback (if it exists) in the right way. """ if self.callback is not None: loop = asyncio.get_event_loop() return loop.run_until_complete(self.async_invoke(ctx))
['def', 'invoke', '(', 'self', ',', 'ctx', ')', ':', 'if', 'self', '.', 'callback', 'is', 'not', 'None', ':', 'loop', '=', 'asyncio', '.', 'get_event_loop', '(', ')', 'return', 'loop', '.', 'run_until_complete', '(', 'self', '.', 'async_invoke', '(', 'ctx', ')', ')']
Given a context, this invokes the attached callback (if it exists) in the right way.
['Given', 'a', 'context', 'this', 'invokes', 'the', 'attached', 'callback', '(', 'if', 'it', 'exists', ')', 'in', 'the', 'right', 'way', '.']
train
https://github.com/txomon/abot/blob/3ac23c6d14965d4608ed13c284ae1a886b462252/abot/cli.py#L43-L49
2,876
bsolomon1124/pyfinance
pyfinance/options.py
BSM.value
def value(self): """Compute option value according to BSM model.""" return self._sign[1] * self.S0 * norm.cdf( self._sign[1] * self.d1, 0.0, 1.0 ) - self._sign[1] * self.K * np.exp(-self.r * self.T) * norm.cdf( self._sign[1] * self.d2, 0.0, 1.0 )
python
def value(self): """Compute option value according to BSM model.""" return self._sign[1] * self.S0 * norm.cdf( self._sign[1] * self.d1, 0.0, 1.0 ) - self._sign[1] * self.K * np.exp(-self.r * self.T) * norm.cdf( self._sign[1] * self.d2, 0.0, 1.0 )
['def', 'value', '(', 'self', ')', ':', 'return', 'self', '.', '_sign', '[', '1', ']', '*', 'self', '.', 'S0', '*', 'norm', '.', 'cdf', '(', 'self', '.', '_sign', '[', '1', ']', '*', 'self', '.', 'd1', ',', '0.0', ',', '1.0', ')', '-', 'self', '.', '_sign', '[', '1', ']', '*', 'self', '.', 'K', '*', 'np', '.', 'exp', '...
Compute option value according to BSM model.
['Compute', 'option', 'value', 'according', 'to', 'BSM', 'model', '.']
train
https://github.com/bsolomon1124/pyfinance/blob/c95925209a809b4e648e79cbeaf7711d8e5ff1a6/pyfinance/options.py#L172-L178
2,877
fermiPy/fermipy
fermipy/skymap.py
Map.sum_over_energy
def sum_over_energy(self): """ Reduce a 3D counts cube to a 2D counts map """ # Note that the array is using the opposite convention from WCS # so we sum over axis 0 in the array, but drop axis 2 in the WCS object return Map(np.sum(self.counts, axis=0), self.wcs.dropaxis(2))
python
def sum_over_energy(self): """ Reduce a 3D counts cube to a 2D counts map """ # Note that the array is using the opposite convention from WCS # so we sum over axis 0 in the array, but drop axis 2 in the WCS object return Map(np.sum(self.counts, axis=0), self.wcs.dropaxis(2))
['def', 'sum_over_energy', '(', 'self', ')', ':', '# Note that the array is using the opposite convention from WCS', '# so we sum over axis 0 in the array, but drop axis 2 in the WCS object', 'return', 'Map', '(', 'np', '.', 'sum', '(', 'self', '.', 'counts', ',', 'axis', '=', '0', ')', ',', 'self', '.', 'wcs', '.', 'd...
Reduce a 3D counts cube to a 2D counts map
['Reduce', 'a', '3D', 'counts', 'cube', 'to', 'a', '2D', 'counts', 'map']
train
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/skymap.py#L252-L257
2,878
ask/carrot
carrot/messaging.py
Publisher.declare
def declare(self): """Declare the exchange. Creates the exchange on the broker. """ self.backend.exchange_declare(exchange=self.exchange, type=self.exchange_type, durable=self.durable, ...
python
def declare(self): """Declare the exchange. Creates the exchange on the broker. """ self.backend.exchange_declare(exchange=self.exchange, type=self.exchange_type, durable=self.durable, ...
['def', 'declare', '(', 'self', ')', ':', 'self', '.', 'backend', '.', 'exchange_declare', '(', 'exchange', '=', 'self', '.', 'exchange', ',', 'type', '=', 'self', '.', 'exchange_type', ',', 'durable', '=', 'self', '.', 'durable', ',', 'auto_delete', '=', 'self', '.', 'auto_delete', ')']
Declare the exchange. Creates the exchange on the broker.
['Declare', 'the', 'exchange', '.']
train
https://github.com/ask/carrot/blob/5889a25cd2e274642071c9bba39772f4b3e3d9da/carrot/messaging.py#L663-L672
2,879
kiliankoe/dvbpy
dvb/dvb.py
pins
def pins(swlat, swlng, nelat, nelng, pintypes='stop', *, raw=False): """ DVB Map Pins (GET https://www.dvb.de/apps/map/pins) :param swlat: South-West Bounding Box Latitude :param swlng: South-West Bounding Box Longitude :param nelat: North-East Bounding Box Latitude :param nelng: North-East...
python
def pins(swlat, swlng, nelat, nelng, pintypes='stop', *, raw=False): """ DVB Map Pins (GET https://www.dvb.de/apps/map/pins) :param swlat: South-West Bounding Box Latitude :param swlng: South-West Bounding Box Longitude :param nelat: North-East Bounding Box Latitude :param nelng: North-East...
['def', 'pins', '(', 'swlat', ',', 'swlng', ',', 'nelat', ',', 'nelng', ',', 'pintypes', '=', "'stop'", ',', '*', ',', 'raw', '=', 'False', ')', ':', 'try', ':', 'swlat', ',', 'swlng', '=', 'wgs_to_gk4', '(', 'swlat', ',', 'swlng', ')', 'nelat', ',', 'nelng', '=', 'wgs_to_gk4', '(', 'nelat', ',', 'nelng', ')', 'r', '='...
DVB Map Pins (GET https://www.dvb.de/apps/map/pins) :param swlat: South-West Bounding Box Latitude :param swlng: South-West Bounding Box Longitude :param nelat: North-East Bounding Box Latitude :param nelng: North-East Bounding Box Longitude :param pintypes: Types to search for, defaults to 'st...
['DVB', 'Map', 'Pins', '(', 'GET', 'https', ':', '//', 'www', '.', 'dvb', '.', 'de', '/', 'apps', '/', 'map', '/', 'pins', ')']
train
https://github.com/kiliankoe/dvbpy/blob/d499706ae56386d680f78975d3512d56f848e9dc/dvb/dvb.py#L304-L342
2,880
rtfd/readthedocs-sphinx-ext
readthedocs_ext/readthedocs.py
HtmlBuilderMixin._copy_searchtools
def _copy_searchtools(self, renderer=None): """Copy and patch searchtools This uses the included Sphinx version's searchtools, but patches it to remove automatic initialization. This is a fork of ``sphinx.util.fileutil.copy_asset`` """ log.info(bold('copying searchtools....
python
def _copy_searchtools(self, renderer=None): """Copy and patch searchtools This uses the included Sphinx version's searchtools, but patches it to remove automatic initialization. This is a fork of ``sphinx.util.fileutil.copy_asset`` """ log.info(bold('copying searchtools....
['def', '_copy_searchtools', '(', 'self', ',', 'renderer', '=', 'None', ')', ':', 'log', '.', 'info', '(', 'bold', '(', "'copying searchtools... '", ')', ',', 'nonl', '=', 'True', ')', 'if', 'sphinx', '.', 'version_info', '<', '(', '1', ',', '8', ')', ':', 'search_js_file', '=', "'searchtools.js_t'", 'else', ':', 'sear...
Copy and patch searchtools This uses the included Sphinx version's searchtools, but patches it to remove automatic initialization. This is a fork of ``sphinx.util.fileutil.copy_asset``
['Copy', 'and', 'patch', 'searchtools']
train
https://github.com/rtfd/readthedocs-sphinx-ext/blob/f1a01c51c675d36ac365162ea06814544c2aa410/readthedocs_ext/readthedocs.py#L209-L247
2,881
odlgroup/odl
odl/space/npy_tensors.py
_lincomb_impl
def _lincomb_impl(a, x1, b, x2, out): """Optimized implementation of ``out[:] = a * x1 + b * x2``.""" # Lazy import to improve `import odl` time import scipy.linalg size = native(x1.size) if size < THRESHOLD_SMALL: # Faster for small arrays out.data[:] = a * x1.data + b * x2.data ...
python
def _lincomb_impl(a, x1, b, x2, out): """Optimized implementation of ``out[:] = a * x1 + b * x2``.""" # Lazy import to improve `import odl` time import scipy.linalg size = native(x1.size) if size < THRESHOLD_SMALL: # Faster for small arrays out.data[:] = a * x1.data + b * x2.data ...
['def', '_lincomb_impl', '(', 'a', ',', 'x1', ',', 'b', ',', 'x2', ',', 'out', ')', ':', '# Lazy import to improve `import odl` time', 'import', 'scipy', '.', 'linalg', 'size', '=', 'native', '(', 'x1', '.', 'size', ')', 'if', 'size', '<', 'THRESHOLD_SMALL', ':', '# Faster for small arrays', 'out', '.', 'data', '[', ':...
Optimized implementation of ``out[:] = a * x1 + b * x2``.
['Optimized', 'implementation', 'of', 'out', '[', ':', ']', '=', 'a', '*', 'x1', '+', 'b', '*', 'x2', '.']
train
https://github.com/odlgroup/odl/blob/b8443f6aca90e191ba36c91d32253c5a36249a6c/odl/space/npy_tensors.py#L1802-L1901
2,882
berkerpeksag/astor
astor/rtrip.py
convert
def convert(srctree, dsttree=dsttree, readonly=False, dumpall=False, ignore_exceptions=False, fullcomp=False): """Walk the srctree, and convert/copy all python files into the dsttree """ if fullcomp: allow_ast_comparison() parse_file = code_to_ast.parse_file find_py_files ...
python
def convert(srctree, dsttree=dsttree, readonly=False, dumpall=False, ignore_exceptions=False, fullcomp=False): """Walk the srctree, and convert/copy all python files into the dsttree """ if fullcomp: allow_ast_comparison() parse_file = code_to_ast.parse_file find_py_files ...
['def', 'convert', '(', 'srctree', ',', 'dsttree', '=', 'dsttree', ',', 'readonly', '=', 'False', ',', 'dumpall', '=', 'False', ',', 'ignore_exceptions', '=', 'False', ',', 'fullcomp', '=', 'False', ')', ':', 'if', 'fullcomp', ':', 'allow_ast_comparison', '(', ')', 'parse_file', '=', 'code_to_ast', '.', 'parse_file', '...
Walk the srctree, and convert/copy all python files into the dsttree
['Walk', 'the', 'srctree', 'and', 'convert', '/', 'copy', 'all', 'python', 'files', 'into', 'the', 'dsttree']
train
https://github.com/berkerpeksag/astor/blob/d9e893eb49d9eb2e30779680f90cd632c30e0ba1/astor/rtrip.py#L32-L153
2,883
saltstack/salt
salt/modules/virt.py
stop
def stop(name, **kwargs): ''' Hard power down the virtual machine, this is equivalent to pulling the power. :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults ...
python
def stop(name, **kwargs): ''' Hard power down the virtual machine, this is equivalent to pulling the power. :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults ...
['def', 'stop', '(', 'name', ',', '*', '*', 'kwargs', ')', ':', 'conn', '=', '__get_conn', '(', '*', '*', 'kwargs', ')', 'ret', '=', '_get_domain', '(', 'conn', ',', 'name', ')', '.', 'destroy', '(', ')', '==', '0', 'conn', '.', 'close', '(', ')', 'return', 'ret']
Hard power down the virtual machine, this is equivalent to pulling the power. :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: 2019.2.0 :pa...
['Hard', 'power', 'down', 'the', 'virtual', 'machine', 'this', 'is', 'equivalent', 'to', 'pulling', 'the', 'power', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/virt.py#L2825-L2849
2,884
humilis/humilis-lambdautils
lambdautils/state.py
_state_table_name
def _state_table_name(environment=None, layer=None, stage=None): """The name of the state table associated to a humilis deployment.""" if environment is None: # For backwards compatiblity environment = os.environ.get("HUMILIS_ENVIRONMENT") if layer is None: layer = os.environ.get("HU...
python
def _state_table_name(environment=None, layer=None, stage=None): """The name of the state table associated to a humilis deployment.""" if environment is None: # For backwards compatiblity environment = os.environ.get("HUMILIS_ENVIRONMENT") if layer is None: layer = os.environ.get("HU...
['def', '_state_table_name', '(', 'environment', '=', 'None', ',', 'layer', '=', 'None', ',', 'stage', '=', 'None', ')', ':', 'if', 'environment', 'is', 'None', ':', '# For backwards compatiblity', 'environment', '=', 'os', '.', 'environ', '.', 'get', '(', '"HUMILIS_ENVIRONMENT"', ')', 'if', 'layer', 'is', 'None', ':',...
The name of the state table associated to a humilis deployment.
['The', 'name', 'of', 'the', 'state', 'table', 'associated', 'to', 'a', 'humilis', 'deployment', '.']
train
https://github.com/humilis/humilis-lambdautils/blob/58f75eb5ace23523c283708d56a9193181ea7e8e/lambdautils/state.py#L47-L63
2,885
hydraplatform/hydra-base
hydra_base/lib/sharing.py
share_network
def share_network(network_id, usernames, read_only, share,**kwargs): """ Share a network with a list of users, identified by their usernames. The read_only flag ('Y' or 'N') must be set to 'Y' to allow write access or sharing. The share flat ('Y' or 'N') must be set to 'Y' to allow...
python
def share_network(network_id, usernames, read_only, share,**kwargs): """ Share a network with a list of users, identified by their usernames. The read_only flag ('Y' or 'N') must be set to 'Y' to allow write access or sharing. The share flat ('Y' or 'N') must be set to 'Y' to allow...
['def', 'share_network', '(', 'network_id', ',', 'usernames', ',', 'read_only', ',', 'share', ',', '*', '*', 'kwargs', ')', ':', 'user_id', '=', 'kwargs', '.', 'get', '(', "'user_id'", ')', 'net_i', '=', '_get_network', '(', 'network_id', ')', 'net_i', '.', 'check_share_permission', '(', 'user_id', ')', 'if', 'read_onl...
Share a network with a list of users, identified by their usernames. The read_only flag ('Y' or 'N') must be set to 'Y' to allow write access or sharing. The share flat ('Y' or 'N') must be set to 'Y' to allow the project to be shared with other users
['Share', 'a', 'network', 'with', 'a', 'list', 'of', 'users', 'identified', 'by', 'their', 'usernames', '.']
train
https://github.com/hydraplatform/hydra-base/blob/9251ff7946505f7a272c87837390acd1c435bc6e/hydra_base/lib/sharing.py#L57-L93
2,886
helixyte/everest
everest/views/base.py
WarnAndResubmitUserMessageChecker.create_307_response
def create_307_response(self): """ Creates a 307 "Temporary Redirect" response including a HTTP Warning header with code 299 that contains the user message received during processing the request. """ request = get_current_request() msg_mb = UserMessageMember(self....
python
def create_307_response(self): """ Creates a 307 "Temporary Redirect" response including a HTTP Warning header with code 299 that contains the user message received during processing the request. """ request = get_current_request() msg_mb = UserMessageMember(self....
['def', 'create_307_response', '(', 'self', ')', ':', 'request', '=', 'get_current_request', '(', ')', 'msg_mb', '=', 'UserMessageMember', '(', 'self', '.', 'message', ')', 'coll', '=', 'request', '.', 'root', '[', "'_messages'", ']', 'coll', '.', 'add', '(', 'msg_mb', ')', '# Figure out the new location URL.', 'qs', '...
Creates a 307 "Temporary Redirect" response including a HTTP Warning header with code 299 that contains the user message received during processing the request.
['Creates', 'a', '307', 'Temporary', 'Redirect', 'response', 'including', 'a', 'HTTP', 'Warning', 'header', 'with', 'code', '299', 'that', 'contains', 'the', 'user', 'message', 'received', 'during', 'processing', 'the', 'request', '.']
train
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/views/base.py#L540-L560
2,887
openstack/networking-cisco
networking_cisco/apps/saf/agent/vdp/dfa_vdp_mgr.py
VdpMgr.vdp_vlan_change_cb
def vdp_vlan_change_cb(self, port_uuid, lvid, vdp_vlan, fail_reason): """Callback function for updating the VDP VLAN in DB. """ LOG.info("Vlan change CB lvid %(lvid)s VDP %(vdp)s", {'lvid': lvid, 'vdp': vdp_vlan}) self.update_vm_result(port_uuid, constants.RESULT_SUCCESS, ...
python
def vdp_vlan_change_cb(self, port_uuid, lvid, vdp_vlan, fail_reason): """Callback function for updating the VDP VLAN in DB. """ LOG.info("Vlan change CB lvid %(lvid)s VDP %(vdp)s", {'lvid': lvid, 'vdp': vdp_vlan}) self.update_vm_result(port_uuid, constants.RESULT_SUCCESS, ...
['def', 'vdp_vlan_change_cb', '(', 'self', ',', 'port_uuid', ',', 'lvid', ',', 'vdp_vlan', ',', 'fail_reason', ')', ':', 'LOG', '.', 'info', '(', '"Vlan change CB lvid %(lvid)s VDP %(vdp)s"', ',', '{', "'lvid'", ':', 'lvid', ',', "'vdp'", ':', 'vdp_vlan', '}', ')', 'self', '.', 'update_vm_result', '(', 'port_uuid', ','...
Callback function for updating the VDP VLAN in DB.
['Callback', 'function', 'for', 'updating', 'the', 'VDP', 'VLAN', 'in', 'DB', '.']
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/vdp/dfa_vdp_mgr.py#L200-L206
2,888
aboSamoor/polyglot
polyglot/mapping/base.py
VocabularyBase.sanitize_words
def sanitize_words(self, words): """Guarantees that all textual symbols are unicode. Note: We do not convert numbers, only strings to unicode. We assume that the strings are encoded in utf-8. """ _words = [] for w in words: if isinstance(w, string_types) and not isinstance(w, unic...
python
def sanitize_words(self, words): """Guarantees that all textual symbols are unicode. Note: We do not convert numbers, only strings to unicode. We assume that the strings are encoded in utf-8. """ _words = [] for w in words: if isinstance(w, string_types) and not isinstance(w, unic...
['def', 'sanitize_words', '(', 'self', ',', 'words', ')', ':', '_words', '=', '[', ']', 'for', 'w', 'in', 'words', ':', 'if', 'isinstance', '(', 'w', ',', 'string_types', ')', 'and', 'not', 'isinstance', '(', 'w', ',', 'unicode', ')', ':', '_words', '.', 'append', '(', 'unicode', '(', 'w', ',', 'encoding', '=', '"utf-8...
Guarantees that all textual symbols are unicode. Note: We do not convert numbers, only strings to unicode. We assume that the strings are encoded in utf-8.
['Guarantees', 'that', 'all', 'textual', 'symbols', 'are', 'unicode', '.']
train
https://github.com/aboSamoor/polyglot/blob/d0d2aa8d06cec4e03bd96618ae960030f7069a17/polyglot/mapping/base.py#L52-L65
2,889
saltstack/salt
salt/utils/win_dacl.py
set_inheritance
def set_inheritance(obj_name, enabled, obj_type='file', clear=False): ''' Enable or disable an objects inheritance. Args: obj_name (str): The name of the object enabled (bool): True to enable inheritance, False to disable obj_type (Optional[str]): ...
python
def set_inheritance(obj_name, enabled, obj_type='file', clear=False): ''' Enable or disable an objects inheritance. Args: obj_name (str): The name of the object enabled (bool): True to enable inheritance, False to disable obj_type (Optional[str]): ...
['def', 'set_inheritance', '(', 'obj_name', ',', 'enabled', ',', 'obj_type', '=', "'file'", ',', 'clear', '=', 'False', ')', ':', 'if', 'obj_type', 'not', 'in', '[', "'file'", ',', "'registry'", ',', "'registry32'", ']', ':', 'raise', 'SaltInvocationError', '(', "'obj_type called with incorrect parameter: {0}'", '.', '...
Enable or disable an objects inheritance. Args: obj_name (str): The name of the object enabled (bool): True to enable inheritance, False to disable obj_type (Optional[str]): The type of object. Only three objects allow inheritance. Valid ob...
['Enable', 'or', 'disable', 'an', 'objects', 'inheritance', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/win_dacl.py#L1776-L1818
2,890
gsi-upm/soil
soil/environment.py
Environment.save_state
def save_state(self): ''' :DEPRECATED: Periodically save the state of the environment and the agents. ''' self._save_state() while self.peek() != simpy.core.Infinity: delay = max(self.peek() - self.now, self.interval) utils.logger.debug('Step: {}'....
python
def save_state(self): ''' :DEPRECATED: Periodically save the state of the environment and the agents. ''' self._save_state() while self.peek() != simpy.core.Infinity: delay = max(self.peek() - self.now, self.interval) utils.logger.debug('Step: {}'....
['def', 'save_state', '(', 'self', ')', ':', 'self', '.', '_save_state', '(', ')', 'while', 'self', '.', 'peek', '(', ')', '!=', 'simpy', '.', 'core', '.', 'Infinity', ':', 'delay', '=', 'max', '(', 'self', '.', 'peek', '(', ')', '-', 'self', '.', 'now', ',', 'self', '.', 'interval', ')', 'utils', '.', 'logger', '.', '...
:DEPRECATED: Periodically save the state of the environment and the agents.
[':', 'DEPRECATED', ':', 'Periodically', 'save', 'the', 'state', 'of', 'the', 'environment', 'and', 'the', 'agents', '.']
train
https://github.com/gsi-upm/soil/blob/a3ea434f237f039c3cadbc2e0a83ae626d77b818/soil/environment.py#L175-L190
2,891
rohankapoorcom/zm-py
zoneminder/zm.py
ZoneMinder.get_monitors
def get_monitors(self) -> List[Monitor]: """Get a list of Monitors from the ZoneMinder API.""" raw_monitors = self._zm_request('get', ZoneMinder.MONITOR_URL) if not raw_monitors: _LOGGER.warning("Could not fetch monitors from ZoneMinder") return [] monitors = [] ...
python
def get_monitors(self) -> List[Monitor]: """Get a list of Monitors from the ZoneMinder API.""" raw_monitors = self._zm_request('get', ZoneMinder.MONITOR_URL) if not raw_monitors: _LOGGER.warning("Could not fetch monitors from ZoneMinder") return [] monitors = [] ...
['def', 'get_monitors', '(', 'self', ')', '->', 'List', '[', 'Monitor', ']', ':', 'raw_monitors', '=', 'self', '.', '_zm_request', '(', "'get'", ',', 'ZoneMinder', '.', 'MONITOR_URL', ')', 'if', 'not', 'raw_monitors', ':', '_LOGGER', '.', 'warning', '(', '"Could not fetch monitors from ZoneMinder"', ')', 'return', '[',...
Get a list of Monitors from the ZoneMinder API.
['Get', 'a', 'list', 'of', 'Monitors', 'from', 'the', 'ZoneMinder', 'API', '.']
train
https://github.com/rohankapoorcom/zm-py/blob/bd3a9f6b2f7b84b37589e2939f628b479a5531bf/zoneminder/zm.py#L102-L115
2,892
twilio/twilio-python
twilio/rest/authy/v1/form.py
FormContext.fetch
def fetch(self): """ Fetch a FormInstance :returns: Fetched FormInstance :rtype: twilio.rest.authy.v1.form.FormInstance """ params = values.of({}) payload = self._version.fetch( 'GET', self._uri, params=params, ) ...
python
def fetch(self): """ Fetch a FormInstance :returns: Fetched FormInstance :rtype: twilio.rest.authy.v1.form.FormInstance """ params = values.of({}) payload = self._version.fetch( 'GET', self._uri, params=params, ) ...
['def', 'fetch', '(', 'self', ')', ':', 'params', '=', 'values', '.', 'of', '(', '{', '}', ')', 'payload', '=', 'self', '.', '_version', '.', 'fetch', '(', "'GET'", ',', 'self', '.', '_uri', ',', 'params', '=', 'params', ',', ')', 'return', 'FormInstance', '(', 'self', '.', '_version', ',', 'payload', ',', 'form_type',...
Fetch a FormInstance :returns: Fetched FormInstance :rtype: twilio.rest.authy.v1.form.FormInstance
['Fetch', 'a', 'FormInstance']
train
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/authy/v1/form.py#L129-L144
2,893
googlefonts/glyphsLib
Lib/glyphsLib/builder/custom_params.py
GlyphsObjectProxy.set_custom_value
def set_custom_value(self, key, value): """Set one custom parameter with the given value. We assume that the list of custom parameters does not already contain the given parameter so we only append. """ self._owner.customParameters.append( self._glyphs_module.GSCustom...
python
def set_custom_value(self, key, value): """Set one custom parameter with the given value. We assume that the list of custom parameters does not already contain the given parameter so we only append. """ self._owner.customParameters.append( self._glyphs_module.GSCustom...
['def', 'set_custom_value', '(', 'self', ',', 'key', ',', 'value', ')', ':', 'self', '.', '_owner', '.', 'customParameters', '.', 'append', '(', 'self', '.', '_glyphs_module', '.', 'GSCustomParameter', '(', 'name', '=', 'key', ',', 'value', '=', 'value', ')', ')']
Set one custom parameter with the given value. We assume that the list of custom parameters does not already contain the given parameter so we only append.
['Set', 'one', 'custom', 'parameter', 'with', 'the', 'given', 'value', '.', 'We', 'assume', 'that', 'the', 'list', 'of', 'custom', 'parameters', 'does', 'not', 'already', 'contain', 'the', 'given', 'parameter', 'so', 'we', 'only', 'append', '.']
train
https://github.com/googlefonts/glyphsLib/blob/9c12dc70c8d13f08d92b824e6710f6e3bb5037bb/Lib/glyphsLib/builder/custom_params.py#L118-L125
2,894
onyxfish/clan
clan/report.py
ReportCommand.html
def html(self, report, f): """ Write report data to an HTML file. """ env = Environment(loader=PackageLoader('clan', 'templates')) template = env.get_template('report.html') context = { 'report': report, 'GLOBAL_ARGUMENTS': GLOBAL_ARGUMENTS, ...
python
def html(self, report, f): """ Write report data to an HTML file. """ env = Environment(loader=PackageLoader('clan', 'templates')) template = env.get_template('report.html') context = { 'report': report, 'GLOBAL_ARGUMENTS': GLOBAL_ARGUMENTS, ...
['def', 'html', '(', 'self', ',', 'report', ',', 'f', ')', ':', 'env', '=', 'Environment', '(', 'loader', '=', 'PackageLoader', '(', "'clan'", ',', "'templates'", ')', ')', 'template', '=', 'env', '.', 'get_template', '(', "'report.html'", ')', 'context', '=', '{', "'report'", ':', 'report', ',', "'GLOBAL_ARGUMENTS'", ...
Write report data to an HTML file.
['Write', 'report', 'data', 'to', 'an', 'HTML', 'file', '.']
train
https://github.com/onyxfish/clan/blob/415ddd027ea81013f2d62d75aec6da70703df49c/clan/report.py#L294-L311
2,895
pantsbuild/pants
src/python/pants/build_graph/build_graph.py
BuildGraph.get_all_derivatives
def get_all_derivatives(self, address): """Get all targets derived directly or indirectly from the specified target. Note that the specified target itself is not returned. :API: public """ ret = [] direct = self.get_direct_derivatives(address) ret.extend(direct) for t in direct: ...
python
def get_all_derivatives(self, address): """Get all targets derived directly or indirectly from the specified target. Note that the specified target itself is not returned. :API: public """ ret = [] direct = self.get_direct_derivatives(address) ret.extend(direct) for t in direct: ...
['def', 'get_all_derivatives', '(', 'self', ',', 'address', ')', ':', 'ret', '=', '[', ']', 'direct', '=', 'self', '.', 'get_direct_derivatives', '(', 'address', ')', 'ret', '.', 'extend', '(', 'direct', ')', 'for', 't', 'in', 'direct', ':', 'ret', '.', 'extend', '(', 'self', '.', 'get_all_derivatives', '(', 't', '.', ...
Get all targets derived directly or indirectly from the specified target. Note that the specified target itself is not returned. :API: public
['Get', 'all', 'targets', 'derived', 'directly', 'or', 'indirectly', 'from', 'the', 'specified', 'target', '.']
train
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/build_graph/build_graph.py#L217-L229
2,896
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_1/release/release_client.py
ReleaseClient.update_release
def update_release(self, release, project, release_id): """UpdateRelease. [Preview API] Update a complete release object. :param :class:`<Release> <azure.devops.v5_1.release.models.Release>` release: Release object for update. :param str project: Project ID or project name :param...
python
def update_release(self, release, project, release_id): """UpdateRelease. [Preview API] Update a complete release object. :param :class:`<Release> <azure.devops.v5_1.release.models.Release>` release: Release object for update. :param str project: Project ID or project name :param...
['def', 'update_release', '(', 'self', ',', 'release', ',', 'project', ',', 'release_id', ')', ':', 'route_values', '=', '{', '}', 'if', 'project', 'is', 'not', 'None', ':', 'route_values', '[', "'project'", ']', '=', 'self', '.', '_serialize', '.', 'url', '(', "'project'", ',', 'project', ',', "'str'", ')', 'if', 'rel...
UpdateRelease. [Preview API] Update a complete release object. :param :class:`<Release> <azure.devops.v5_1.release.models.Release>` release: Release object for update. :param str project: Project ID or project name :param int release_id: Id of the release to update. :rtype: :clas...
['UpdateRelease', '.', '[', 'Preview', 'API', ']', 'Update', 'a', 'complete', 'release', 'object', '.', ':', 'param', ':', 'class', ':', '<Release', '>', '<azure', '.', 'devops', '.', 'v5_1', '.', 'release', '.', 'models', '.', 'Release', '>', 'release', ':', 'Release', 'object', 'for', 'update', '.', ':', 'param', 'st...
train
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_1/release/release_client.py#L727-L746
2,897
pypa/pipenv
pipenv/vendor/distlib/_backport/tarfile.py
TarFile.gettarinfo
def gettarinfo(self, name=None, arcname=None, fileobj=None): """Create a TarInfo object for either the file `name' or the file object `fileobj' (using os.fstat on its file descriptor). You can modify some of the TarInfo's attributes before you add it using addfile(). If given, `...
python
def gettarinfo(self, name=None, arcname=None, fileobj=None): """Create a TarInfo object for either the file `name' or the file object `fileobj' (using os.fstat on its file descriptor). You can modify some of the TarInfo's attributes before you add it using addfile(). If given, `...
['def', 'gettarinfo', '(', 'self', ',', 'name', '=', 'None', ',', 'arcname', '=', 'None', ',', 'fileobj', '=', 'None', ')', ':', 'self', '.', '_check', '(', '"aw"', ')', '# When fileobj is given, replace name by', "# fileobj's real name.", 'if', 'fileobj', 'is', 'not', 'None', ':', 'name', '=', 'fileobj', '.', 'name', ...
Create a TarInfo object for either the file `name' or the file object `fileobj' (using os.fstat on its file descriptor). You can modify some of the TarInfo's attributes before you add it using addfile(). If given, `arcname' specifies an alternative name for the file in the ar...
['Create', 'a', 'TarInfo', 'object', 'for', 'either', 'the', 'file', 'name', 'or', 'the', 'file', 'object', 'fileobj', '(', 'using', 'os', '.', 'fstat', 'on', 'its', 'file', 'descriptor', ')', '.', 'You', 'can', 'modify', 'some', 'of', 'the', 'TarInfo', 's', 'attributes', 'before', 'you', 'add', 'it', 'using', 'addfile...
train
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/_backport/tarfile.py#L1911-L2007
2,898
nugget/python-insteonplm
insteonplm/devices/__init__.py
Device.receive_message
def receive_message(self, msg): """Receive a messages sent to this device.""" _LOGGER.debug('Starting Device.receive_message') if hasattr(msg, 'isack') and msg.isack: _LOGGER.debug('Got Message ACK') if self._sent_msg_wait_for_directACK.get('callback') is not None: ...
python
def receive_message(self, msg): """Receive a messages sent to this device.""" _LOGGER.debug('Starting Device.receive_message') if hasattr(msg, 'isack') and msg.isack: _LOGGER.debug('Got Message ACK') if self._sent_msg_wait_for_directACK.get('callback') is not None: ...
['def', 'receive_message', '(', 'self', ',', 'msg', ')', ':', '_LOGGER', '.', 'debug', '(', "'Starting Device.receive_message'", ')', 'if', 'hasattr', '(', 'msg', ',', "'isack'", ')', 'and', 'msg', '.', 'isack', ':', '_LOGGER', '.', 'debug', '(', "'Got Message ACK'", ')', 'if', 'self', '.', '_sent_msg_wait_for_directAC...
Receive a messages sent to this device.
['Receive', 'a', 'messages', 'sent', 'to', 'this', 'device', '.']
train
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/devices/__init__.py#L666-L696
2,899
nion-software/nionswift-io
nionswift_plugin/TIFF_IO/tifffile.py
olympusini_metadata
def olympusini_metadata(inistr): """Return OlympusSIS metadata from INI string. No documentation is available. """ def keyindex(key): # split key into name and index index = 0 i = len(key.rstrip('0123456789')) if i < len(key): index = int(key[i:]) - 1 ...
python
def olympusini_metadata(inistr): """Return OlympusSIS metadata from INI string. No documentation is available. """ def keyindex(key): # split key into name and index index = 0 i = len(key.rstrip('0123456789')) if i < len(key): index = int(key[i:]) - 1 ...
['def', 'olympusini_metadata', '(', 'inistr', ')', ':', 'def', 'keyindex', '(', 'key', ')', ':', '# split key into name and index', 'index', '=', '0', 'i', '=', 'len', '(', 'key', '.', 'rstrip', '(', "'0123456789'", ')', ')', 'if', 'i', '<', 'len', '(', 'key', ')', ':', 'index', '=', 'int', '(', 'key', '[', 'i', ':', '...
Return OlympusSIS metadata from INI string. No documentation is available.
['Return', 'OlympusSIS', 'metadata', 'from', 'INI', 'string', '.']
train
https://github.com/nion-software/nionswift-io/blob/e9ae37f01faa9332c48b647f93afd5ef2166b155/nionswift_plugin/TIFF_IO/tifffile.py#L9234-L9334