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
6,800
UniversalDevicesInc/polyglot-v2-python-interface
polyinterface/polyinterface.py
Interface.send
def send(self, message): """ Formatted Message to send to Polyglot. Connection messages are sent automatically from this module so this method is used to send commands to/from Polyglot and formats it for consumption """ if not isinstance(message, dict) and self.connected: ...
python
def send(self, message): """ Formatted Message to send to Polyglot. Connection messages are sent automatically from this module so this method is used to send commands to/from Polyglot and formats it for consumption """ if not isinstance(message, dict) and self.connected: ...
['def', 'send', '(', 'self', ',', 'message', ')', ':', 'if', 'not', 'isinstance', '(', 'message', ',', 'dict', ')', 'and', 'self', '.', 'connected', ':', 'warnings', '.', 'warn', '(', "'payload not a dictionary'", ')', 'return', 'False', 'try', ':', 'message', '[', "'node'", ']', '=', 'self', '.', 'profileNum', 'self',...
Formatted Message to send to Polyglot. Connection messages are sent automatically from this module so this method is used to send commands to/from Polyglot and formats it for consumption
['Formatted', 'Message', 'to', 'send', 'to', 'Polyglot', '.', 'Connection', 'messages', 'are', 'sent', 'automatically', 'from', 'this', 'module', 'so', 'this', 'method', 'is', 'used', 'to', 'send', 'commands', 'to', '/', 'from', 'Polyglot', 'and', 'formats', 'it', 'for', 'consumption']
train
https://github.com/UniversalDevicesInc/polyglot-v2-python-interface/blob/fe613135b762731a41a081222e43d2a8ae4fc53f/polyinterface/polyinterface.py#L349-L361
6,801
empirical-org/Quill-NLP-Tools-and-Datasets
utils/qfragment/qfragment/__init__.py
_build_trigram_indices
def _build_trigram_indices(trigram_index): """Build a dictionary of trigrams and their indices from a csv""" result = {} trigram_count = 0 for key, val in csv.reader(open(trigram_index)): result[key] = int(val) trigram_count += 1 return result, trigram_count
python
def _build_trigram_indices(trigram_index): """Build a dictionary of trigrams and their indices from a csv""" result = {} trigram_count = 0 for key, val in csv.reader(open(trigram_index)): result[key] = int(val) trigram_count += 1 return result, trigram_count
['def', '_build_trigram_indices', '(', 'trigram_index', ')', ':', 'result', '=', '{', '}', 'trigram_count', '=', '0', 'for', 'key', ',', 'val', 'in', 'csv', '.', 'reader', '(', 'open', '(', 'trigram_index', ')', ')', ':', 'result', '[', 'key', ']', '=', 'int', '(', 'val', ')', 'trigram_count', '+=', '1', 'return', 'res...
Build a dictionary of trigrams and their indices from a csv
['Build', 'a', 'dictionary', 'of', 'trigrams', 'and', 'their', 'indices', 'from', 'a', 'csv']
train
https://github.com/empirical-org/Quill-NLP-Tools-and-Datasets/blob/f2ff579ddf3a556d9cdc47c5f702422fa06863d9/utils/qfragment/qfragment/__init__.py#L48-L55
6,802
maweigert/gputools
gputools/denoise/tv2.py
_tv2
def _tv2(data,weight,Niter=50): """ chambolles tv regularized denoising weight should be around 2+1.5*noise_sigma """ if dev is None: dev = imgtools.__DEFAULT_OPENCL_DEVICE__ if dev is None: raise ValueError("no OpenCLDevice found...") proc = OCLProcessor(dev,utils.absP...
python
def _tv2(data,weight,Niter=50): """ chambolles tv regularized denoising weight should be around 2+1.5*noise_sigma """ if dev is None: dev = imgtools.__DEFAULT_OPENCL_DEVICE__ if dev is None: raise ValueError("no OpenCLDevice found...") proc = OCLProcessor(dev,utils.absP...
['def', '_tv2', '(', 'data', ',', 'weight', ',', 'Niter', '=', '50', ')', ':', 'if', 'dev', 'is', 'None', ':', 'dev', '=', 'imgtools', '.', '__DEFAULT_OPENCL_DEVICE__', 'if', 'dev', 'is', 'None', ':', 'raise', 'ValueError', '(', '"no OpenCLDevice found..."', ')', 'proc', '=', 'OCLProcessor', '(', 'dev', ',', 'utils', '...
chambolles tv regularized denoising weight should be around 2+1.5*noise_sigma
['chambolles', 'tv', 'regularized', 'denoising']
train
https://github.com/maweigert/gputools/blob/6ab26efeb05dceef74cf13aadeeeb9b009b529dd/gputools/denoise/tv2.py#L16-L77
6,803
buguroo/pyknow
pyknow/fact.py
Fact.copy
def copy(self): """Return a copy of this `Fact`.""" content = [(k, v) for k, v in self.items()] intidx = [(k, v) for k, v in content if isinstance(k, int)] args = [v for k, v in sorted(intidx)] kwargs = {k: v for k, v in content if not isinst...
python
def copy(self): """Return a copy of this `Fact`.""" content = [(k, v) for k, v in self.items()] intidx = [(k, v) for k, v in content if isinstance(k, int)] args = [v for k, v in sorted(intidx)] kwargs = {k: v for k, v in content if not isinst...
['def', 'copy', '(', 'self', ')', ':', 'content', '=', '[', '(', 'k', ',', 'v', ')', 'for', 'k', ',', 'v', 'in', 'self', '.', 'items', '(', ')', ']', 'intidx', '=', '[', '(', 'k', ',', 'v', ')', 'for', 'k', ',', 'v', 'in', 'content', 'if', 'isinstance', '(', 'k', ',', 'int', ')', ']', 'args', '=', '[', 'v', 'for', 'k',...
Return a copy of this `Fact`.
['Return', 'a', 'copy', 'of', 'this', 'Fact', '.']
train
https://github.com/buguroo/pyknow/blob/48818336f2e9a126f1964f2d8dc22d37ff800fe8/pyknow/fact.py#L106-L116
6,804
hyperledger/indy-plenum
plenum/server/replica.py
Replica.nonFinalisedReqs
def nonFinalisedReqs(self, reqKeys: List[Tuple[str, int]]): """ Check if there are any requests which are not finalised, i.e for which there are not enough PROPAGATEs """ return {key for key in reqKeys if not self.requests.is_finalised(key)}
python
def nonFinalisedReqs(self, reqKeys: List[Tuple[str, int]]): """ Check if there are any requests which are not finalised, i.e for which there are not enough PROPAGATEs """ return {key for key in reqKeys if not self.requests.is_finalised(key)}
['def', 'nonFinalisedReqs', '(', 'self', ',', 'reqKeys', ':', 'List', '[', 'Tuple', '[', 'str', ',', 'int', ']', ']', ')', ':', 'return', '{', 'key', 'for', 'key', 'in', 'reqKeys', 'if', 'not', 'self', '.', 'requests', '.', 'is_finalised', '(', 'key', ')', '}']
Check if there are any requests which are not finalised, i.e for which there are not enough PROPAGATEs
['Check', 'if', 'there', 'are', 'any', 'requests', 'which', 'are', 'not', 'finalised', 'i', '.', 'e', 'for', 'which', 'there', 'are', 'not', 'enough', 'PROPAGATEs']
train
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/replica.py#L1428-L1433
6,805
shmir/PyIxExplorer
ixexplorer/ixe_port.py
IxePort.clear_port_stats
def clear_port_stats(self): """ Clear only port stats (leave stream and packet group stats). Do not use - still working with Ixia to resolve. """ stat = IxeStat(self) stat.ix_set_default() stat.enableValidStats = True stat.ix_set() stat.write()
python
def clear_port_stats(self): """ Clear only port stats (leave stream and packet group stats). Do not use - still working with Ixia to resolve. """ stat = IxeStat(self) stat.ix_set_default() stat.enableValidStats = True stat.ix_set() stat.write()
['def', 'clear_port_stats', '(', 'self', ')', ':', 'stat', '=', 'IxeStat', '(', 'self', ')', 'stat', '.', 'ix_set_default', '(', ')', 'stat', '.', 'enableValidStats', '=', 'True', 'stat', '.', 'ix_set', '(', ')', 'stat', '.', 'write', '(', ')']
Clear only port stats (leave stream and packet group stats). Do not use - still working with Ixia to resolve.
['Clear', 'only', 'port', 'stats', '(', 'leave', 'stream', 'and', 'packet', 'group', 'stats', ')', '.']
train
https://github.com/shmir/PyIxExplorer/blob/d6946b9ce0e8961507cc912062e10c365d4beee2/ixexplorer/ixe_port.py#L319-L328
6,806
tobgu/pyrsistent
pyrsistent/_plist.py
_PListBase.split
def split(self, index): """ Spilt the list at position specified by index. Returns a tuple containing the list up until index and the list after the index. Runs in O(index). >>> plist([1, 2, 3, 4]).split(2) (plist([1, 2]), plist([3, 4])) """ lb = _PListBuilder() ...
python
def split(self, index): """ Spilt the list at position specified by index. Returns a tuple containing the list up until index and the list after the index. Runs in O(index). >>> plist([1, 2, 3, 4]).split(2) (plist([1, 2]), plist([3, 4])) """ lb = _PListBuilder() ...
['def', 'split', '(', 'self', ',', 'index', ')', ':', 'lb', '=', '_PListBuilder', '(', ')', 'right_list', '=', 'self', 'i', '=', '0', 'while', 'right_list', 'and', 'i', '<', 'index', ':', 'lb', '.', 'append_elem', '(', 'right_list', '.', 'first', ')', 'right_list', '=', 'right_list', '.', 'rest', 'i', '+=', '1', 'if', ...
Spilt the list at position specified by index. Returns a tuple containing the list up until index and the list after the index. Runs in O(index). >>> plist([1, 2, 3, 4]).split(2) (plist([1, 2]), plist([3, 4]))
['Spilt', 'the', 'list', 'at', 'position', 'specified', 'by', 'index', '.', 'Returns', 'a', 'tuple', 'containing', 'the', 'list', 'up', 'until', 'index', 'and', 'the', 'list', 'after', 'the', 'index', '.', 'Runs', 'in', 'O', '(', 'index', ')', '.']
train
https://github.com/tobgu/pyrsistent/blob/c84dab0daaa44973cbe83830d14888827b307632/pyrsistent/_plist.py#L109-L129
6,807
nion-software/nionswift-io
nionswift_plugin/TIFF_IO/tifffile.py
natural_sorted
def natural_sorted(iterable): """Return human sorted list of strings. E.g. for sorting file names. >>> natural_sorted(['f1', 'f2', 'f10']) ['f1', 'f2', 'f10'] """ def sortkey(x): return [(int(c) if c.isdigit() else c) for c in re.split(numbers, x)] numbers = re.compile(r'(\d+)') ...
python
def natural_sorted(iterable): """Return human sorted list of strings. E.g. for sorting file names. >>> natural_sorted(['f1', 'f2', 'f10']) ['f1', 'f2', 'f10'] """ def sortkey(x): return [(int(c) if c.isdigit() else c) for c in re.split(numbers, x)] numbers = re.compile(r'(\d+)') ...
['def', 'natural_sorted', '(', 'iterable', ')', ':', 'def', 'sortkey', '(', 'x', ')', ':', 'return', '[', '(', 'int', '(', 'c', ')', 'if', 'c', '.', 'isdigit', '(', ')', 'else', 'c', ')', 'for', 'c', 'in', 're', '.', 'split', '(', 'numbers', ',', 'x', ')', ']', 'numbers', '=', 're', '.', 'compile', '(', "r'(\\d+)'", ')...
Return human sorted list of strings. E.g. for sorting file names. >>> natural_sorted(['f1', 'f2', 'f10']) ['f1', 'f2', 'f10']
['Return', 'human', 'sorted', 'list', 'of', 'strings', '.']
train
https://github.com/nion-software/nionswift-io/blob/e9ae37f01faa9332c48b647f93afd5ef2166b155/nionswift_plugin/TIFF_IO/tifffile.py#L10244-L10257
6,808
UUDigitalHumanitieslab/tei_reader
tei_reader/models/element.py
Element.attributes
def attributes(self): if 'id' in self.node.attrib: yield PlaceholderAttribute('id', self.node.attrib['id']) if 'tei-tag' in self.node.attrib: yield PlaceholderAttribute('tei-tag', self.node.attrib['tei-tag']) """Contain attributes applicable to this element""" f...
python
def attributes(self): if 'id' in self.node.attrib: yield PlaceholderAttribute('id', self.node.attrib['id']) if 'tei-tag' in self.node.attrib: yield PlaceholderAttribute('tei-tag', self.node.attrib['tei-tag']) """Contain attributes applicable to this element""" f...
['def', 'attributes', '(', 'self', ')', ':', 'if', "'id'", 'in', 'self', '.', 'node', '.', 'attrib', ':', 'yield', 'PlaceholderAttribute', '(', "'id'", ',', 'self', '.', 'node', '.', 'attrib', '[', "'id'", ']', ')', 'if', "'tei-tag'", 'in', 'self', '.', 'node', '.', 'attrib', ':', 'yield', 'PlaceholderAttribute', '(', ...
Contain attributes applicable to this element
['Contain', 'attributes', 'applicable', 'to', 'this', 'element']
train
https://github.com/UUDigitalHumanitieslab/tei_reader/blob/7b19c34a9d7cc941a36ecdcf6f361e26c6488697/tei_reader/models/element.py#L14-L24
6,809
klavinslab/coral
coral/seqio/_dna.py
read_dna
def read_dna(path): '''Read DNA from file. Uses BioPython and coerces to coral format. :param path: Full path to input file. :type path: str :returns: DNA sequence. :rtype: coral.DNA ''' filename, ext = os.path.splitext(os.path.split(path)[-1]) genbank_exts = ['.gb', '.ape'] fasta...
python
def read_dna(path): '''Read DNA from file. Uses BioPython and coerces to coral format. :param path: Full path to input file. :type path: str :returns: DNA sequence. :rtype: coral.DNA ''' filename, ext = os.path.splitext(os.path.split(path)[-1]) genbank_exts = ['.gb', '.ape'] fasta...
['def', 'read_dna', '(', 'path', ')', ':', 'filename', ',', 'ext', '=', 'os', '.', 'path', '.', 'splitext', '(', 'os', '.', 'path', '.', 'split', '(', 'path', ')', '[', '-', '1', ']', ')', 'genbank_exts', '=', '[', "'.gb'", ',', "'.ape'", ']', 'fasta_exts', '=', '[', "'.fasta'", ',', "'.fa'", ',', "'.fsa'", ',', "'.seq...
Read DNA from file. Uses BioPython and coerces to coral format. :param path: Full path to input file. :type path: str :returns: DNA sequence. :rtype: coral.DNA
['Read', 'DNA', 'from', 'file', '.', 'Uses', 'BioPython', 'and', 'coerces', 'to', 'coral', 'format', '.']
train
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/seqio/_dna.py#L22-L69
6,810
odlgroup/odl
odl/space/pspace.py
ProductSpaceArrayWeighting.inner
def inner(self, x1, x2): """Calculate the array-weighted inner product of two elements. Parameters ---------- x1, x2 : `ProductSpaceElement` Elements whose inner product is calculated. Returns ------- inner : float or complex The inner pr...
python
def inner(self, x1, x2): """Calculate the array-weighted inner product of two elements. Parameters ---------- x1, x2 : `ProductSpaceElement` Elements whose inner product is calculated. Returns ------- inner : float or complex The inner pr...
['def', 'inner', '(', 'self', ',', 'x1', ',', 'x2', ')', ':', 'if', 'self', '.', 'exponent', '!=', '2.0', ':', 'raise', 'NotImplementedError', '(', "'no inner product defined for '", "'exponent != 2 (got {})'", "''", '.', 'format', '(', 'self', '.', 'exponent', ')', ')', 'inners', '=', 'np', '.', 'fromiter', '(', '(', ...
Calculate the array-weighted inner product of two elements. Parameters ---------- x1, x2 : `ProductSpaceElement` Elements whose inner product is calculated. Returns ------- inner : float or complex The inner product of the two provided elements.
['Calculate', 'the', 'array', '-', 'weighted', 'inner', 'product', 'of', 'two', 'elements', '.']
train
https://github.com/odlgroup/odl/blob/b8443f6aca90e191ba36c91d32253c5a36249a6c/odl/space/pspace.py#L1596-L1622
6,811
FNNDSC/med2image
med2image/message.py
Message.str_syslog
def str_syslog(self, *args): ''' get/set the str_syslog, i.e. the current value of the syslog prepend string. str_syslog(): returns the current syslog string str_syslog(<astr>): sets the syslog string to <astr> ''' if len(args): self._s...
python
def str_syslog(self, *args): ''' get/set the str_syslog, i.e. the current value of the syslog prepend string. str_syslog(): returns the current syslog string str_syslog(<astr>): sets the syslog string to <astr> ''' if len(args): self._s...
['def', 'str_syslog', '(', 'self', ',', '*', 'args', ')', ':', 'if', 'len', '(', 'args', ')', ':', 'self', '.', '_str_syslog', '=', 'args', '[', '0', ']', 'else', ':', 'return', 'self', '.', '_str_syslog']
get/set the str_syslog, i.e. the current value of the syslog prepend string. str_syslog(): returns the current syslog string str_syslog(<astr>): sets the syslog string to <astr>
['get', '/', 'set', 'the', 'str_syslog', 'i', '.', 'e', '.', 'the', 'current', 'value', 'of', 'the', 'syslog', 'prepend', 'string', '.']
train
https://github.com/FNNDSC/med2image/blob/638d5d230de47608af20f9764acf8e382c2bf2ff/med2image/message.py#L109-L121
6,812
cmap/cmapPy
cmapPy/pandasGEXpress/parse_gctx.py
parse_data_df
def parse_data_df(data_dset, ridx, cidx, row_meta, col_meta): """ Parses in data_df from hdf5, subsetting if specified. Input: -data_dset (h5py dset): HDF5 dataset from which to read data_df -ridx (list): list of indexes to subset from data_df (may be all of them if no subsettin...
python
def parse_data_df(data_dset, ridx, cidx, row_meta, col_meta): """ Parses in data_df from hdf5, subsetting if specified. Input: -data_dset (h5py dset): HDF5 dataset from which to read data_df -ridx (list): list of indexes to subset from data_df (may be all of them if no subsettin...
['def', 'parse_data_df', '(', 'data_dset', ',', 'ridx', ',', 'cidx', ',', 'row_meta', ',', 'col_meta', ')', ':', 'if', 'len', '(', 'ridx', ')', '==', 'len', '(', 'row_meta', '.', 'index', ')', 'and', 'len', '(', 'cidx', ')', '==', 'len', '(', 'col_meta', '.', 'index', ')', ':', '# no subset', 'data_array', '=', 'np', '...
Parses in data_df from hdf5, subsetting if specified. Input: -data_dset (h5py dset): HDF5 dataset from which to read data_df -ridx (list): list of indexes to subset from data_df (may be all of them if no subsetting) -cidx (list): list of indexes to subset from data_df ...
['Parses', 'in', 'data_df', 'from', 'hdf5', 'subsetting', 'if', 'specified', '.']
train
https://github.com/cmap/cmapPy/blob/59d833b64fd2c3a494cdf67fe1eb11fc8008bf76/cmapPy/pandasGEXpress/parse_gctx.py#L320-L345
6,813
Diaoul/subliminal
subliminal/subtitle.py
Subtitle.guess_encoding
def guess_encoding(self): """Guess encoding using the language, falling back on chardet. :return: the guessed encoding. :rtype: str """ logger.info('Guessing encoding for language %s', self.language) # always try utf-8 first encodings = ['utf-8'] # add...
python
def guess_encoding(self): """Guess encoding using the language, falling back on chardet. :return: the guessed encoding. :rtype: str """ logger.info('Guessing encoding for language %s', self.language) # always try utf-8 first encodings = ['utf-8'] # add...
['def', 'guess_encoding', '(', 'self', ')', ':', 'logger', '.', 'info', '(', "'Guessing encoding for language %s'", ',', 'self', '.', 'language', ')', '# always try utf-8 first', 'encodings', '=', '[', "'utf-8'", ']', '# add language-specific encodings', 'if', 'self', '.', 'language', '.', 'alpha3', '==', "'zho'", ':',...
Guess encoding using the language, falling back on chardet. :return: the guessed encoding. :rtype: str
['Guess', 'encoding', 'using', 'the', 'language', 'falling', 'back', 'on', 'chardet', '.']
train
https://github.com/Diaoul/subliminal/blob/a952dfb2032eb0fd6eb1eb89f04080923c11c4cf/subliminal/subtitle.py#L96-L146
6,814
pvlib/pvlib-python
pvlib/modelchain.py
ModelChain.complete_irradiance
def complete_irradiance(self, times=None, weather=None): """ Determine the missing irradiation columns. Only two of the following data columns (dni, ghi, dhi) are needed to calculate the missing data. This function is not safe at the moment. Results can be too high or ne...
python
def complete_irradiance(self, times=None, weather=None): """ Determine the missing irradiation columns. Only two of the following data columns (dni, ghi, dhi) are needed to calculate the missing data. This function is not safe at the moment. Results can be too high or ne...
['def', 'complete_irradiance', '(', 'self', ',', 'times', '=', 'None', ',', 'weather', '=', 'None', ')', ':', 'if', 'weather', 'is', 'not', 'None', ':', 'self', '.', 'weather', '=', 'weather', 'if', 'times', 'is', 'not', 'None', ':', 'self', '.', 'times', '=', 'times', 'self', '.', 'solar_position', '=', 'self', '.', '...
Determine the missing irradiation columns. Only two of the following data columns (dni, ghi, dhi) are needed to calculate the missing data. This function is not safe at the moment. Results can be too high or negative. Please contribute and help to improve this function on https:...
['Determine', 'the', 'missing', 'irradiation', 'columns', '.', 'Only', 'two', 'of', 'the', 'following', 'data', 'columns', '(', 'dni', 'ghi', 'dhi', ')', 'are', 'needed', 'to', 'calculate', 'the', 'missing', 'data', '.']
train
https://github.com/pvlib/pvlib-python/blob/2e844a595b820b43d1170269781fa66bd0ccc8a3/pvlib/modelchain.py#L714-L788
6,815
ewels/MultiQC
multiqc/modules/tophat/tophat.py
MultiqcModule.tophat_alignment_plot
def tophat_alignment_plot (self): """ Make the HighCharts HTML to plot the alignment rates """ # Specify the order of the different possible categories keys = OrderedDict() keys['aligned_not_multimapped_discordant'] = { 'color': '#437bb1', 'name': 'Aligned' } keys['aligned_multi...
python
def tophat_alignment_plot (self): """ Make the HighCharts HTML to plot the alignment rates """ # Specify the order of the different possible categories keys = OrderedDict() keys['aligned_not_multimapped_discordant'] = { 'color': '#437bb1', 'name': 'Aligned' } keys['aligned_multi...
['def', 'tophat_alignment_plot', '(', 'self', ')', ':', '# Specify the order of the different possible categories', 'keys', '=', 'OrderedDict', '(', ')', 'keys', '[', "'aligned_not_multimapped_discordant'", ']', '=', '{', "'color'", ':', "'#437bb1'", ',', "'name'", ':', "'Aligned'", '}', 'keys', '[', "'aligned_multimap...
Make the HighCharts HTML to plot the alignment rates
['Make', 'the', 'HighCharts', 'HTML', 'to', 'plot', 'the', 'alignment', 'rates']
train
https://github.com/ewels/MultiQC/blob/2037d6322b2554146a74efbf869156ad20d4c4ec/multiqc/modules/tophat/tophat.py#L122-L140
6,816
ranaroussi/ezibpy
ezibpy/ezibpy.py
ezIBpy.getConId
def getConId(self, contract_identifier): """ Get contracts conId """ details = self.contractDetails(contract_identifier) if len(details["contracts"]) > 1: return details["m_underConId"] return details["m_summary"]["m_conId"]
python
def getConId(self, contract_identifier): """ Get contracts conId """ details = self.contractDetails(contract_identifier) if len(details["contracts"]) > 1: return details["m_underConId"] return details["m_summary"]["m_conId"]
['def', 'getConId', '(', 'self', ',', 'contract_identifier', ')', ':', 'details', '=', 'self', '.', 'contractDetails', '(', 'contract_identifier', ')', 'if', 'len', '(', 'details', '[', '"contracts"', ']', ')', '>', '1', ':', 'return', 'details', '[', '"m_underConId"', ']', 'return', 'details', '[', '"m_summary"', ']',...
Get contracts conId
['Get', 'contracts', 'conId']
train
https://github.com/ranaroussi/ezibpy/blob/1a9d4bf52018abd2a01af7c991d7cf00cda53e0c/ezibpy/ezibpy.py#L1974-L1979
6,817
ciena/afkak
afkak/producer.py
Producer.send_messages
def send_messages(self, topic, key=None, msgs=()): """ Given a topic, and optional key (for partitioning) and a list of messages, send them to Kafka, either immediately, or when a batch is ready, depending on the Producer's batch settings. :param str topic: Kafka topic to send t...
python
def send_messages(self, topic, key=None, msgs=()): """ Given a topic, and optional key (for partitioning) and a list of messages, send them to Kafka, either immediately, or when a batch is ready, depending on the Producer's batch settings. :param str topic: Kafka topic to send t...
['def', 'send_messages', '(', 'self', ',', 'topic', ',', 'key', '=', 'None', ',', 'msgs', '=', '(', ')', ')', ':', 'try', ':', 'topic', '=', '_coerce_topic', '(', 'topic', ')', 'if', 'key', 'is', 'not', 'None', 'and', 'not', 'isinstance', '(', 'key', ',', 'bytes', ')', ':', 'raise', 'TypeError', '(', "'key={!r} must be...
Given a topic, and optional key (for partitioning) and a list of messages, send them to Kafka, either immediately, or when a batch is ready, depending on the Producer's batch settings. :param str topic: Kafka topic to send the messages to :param str key: Message key used to...
['Given', 'a', 'topic', 'and', 'optional', 'key', '(', 'for', 'partitioning', ')', 'and', 'a', 'list', 'of', 'messages', 'send', 'them', 'to', 'Kafka', 'either', 'immediately', 'or', 'when', 'a', 'batch', 'is', 'ready', 'depending', 'on', 'the', 'Producer', 's', 'batch', 'settings', '.']
train
https://github.com/ciena/afkak/blob/6f5e05ba6f135ea3c29cdb80efda009f7845569a/afkak/producer.py#L166-L233
6,818
caseyjlaw/rtpipe
rtpipe/calpipe.py
pipe.genms
def genms(self, scans=[]): """ Generate an MS that contains all calibrator scans with 1 s integration time. """ if len(scans): scanstr = string.join([str(ss) for ss in sorted(scans)], ',') else: scanstr = self.allstr print 'Splitting out all cal scans (%...
python
def genms(self, scans=[]): """ Generate an MS that contains all calibrator scans with 1 s integration time. """ if len(scans): scanstr = string.join([str(ss) for ss in sorted(scans)], ',') else: scanstr = self.allstr print 'Splitting out all cal scans (%...
['def', 'genms', '(', 'self', ',', 'scans', '=', '[', ']', ')', ':', 'if', 'len', '(', 'scans', ')', ':', 'scanstr', '=', 'string', '.', 'join', '(', '[', 'str', '(', 'ss', ')', 'for', 'ss', 'in', 'sorted', '(', 'scans', ')', ']', ',', "','", ')', 'else', ':', 'scanstr', '=', 'self', '.', 'allstr', 'print', "'Splitting...
Generate an MS that contains all calibrator scans with 1 s integration time.
['Generate', 'an', 'MS', 'that', 'contains', 'all', 'calibrator', 'scans', 'with', '1', 's', 'integration', 'time', '.']
train
https://github.com/caseyjlaw/rtpipe/blob/ac33e4332cf215091a63afbb3137850876d73ec0/rtpipe/calpipe.py#L64-L76
6,819
jingw/pyhdfs
pyhdfs.py
HdfsClient.rename
def rename(self, path, destination, **kwargs): """Renames Path src to Path dst. :returns: true if rename is successful :rtype: bool """ return _json(self._put(path, 'RENAME', destination=destination, **kwargs))['boolean']
python
def rename(self, path, destination, **kwargs): """Renames Path src to Path dst. :returns: true if rename is successful :rtype: bool """ return _json(self._put(path, 'RENAME', destination=destination, **kwargs))['boolean']
['def', 'rename', '(', 'self', ',', 'path', ',', 'destination', ',', '*', '*', 'kwargs', ')', ':', 'return', '_json', '(', 'self', '.', '_put', '(', 'path', ',', "'RENAME'", ',', 'destination', '=', 'destination', ',', '*', '*', 'kwargs', ')', ')', '[', "'boolean'", ']']
Renames Path src to Path dst. :returns: true if rename is successful :rtype: bool
['Renames', 'Path', 'src', 'to', 'Path', 'dst', '.']
train
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L509-L515
6,820
UCL-INGI/INGInious
inginious/frontend/submission_manager.py
WebAppSubmissionManager.get_submission
def get_submission(self, submissionid, user_check=True): """ Get a submission from the database """ sub = self._database.submissions.find_one({'_id': ObjectId(submissionid)}) if user_check and not self.user_is_submission_owner(sub): return None return sub
python
def get_submission(self, submissionid, user_check=True): """ Get a submission from the database """ sub = self._database.submissions.find_one({'_id': ObjectId(submissionid)}) if user_check and not self.user_is_submission_owner(sub): return None return sub
['def', 'get_submission', '(', 'self', ',', 'submissionid', ',', 'user_check', '=', 'True', ')', ':', 'sub', '=', 'self', '.', '_database', '.', 'submissions', '.', 'find_one', '(', '{', "'_id'", ':', 'ObjectId', '(', 'submissionid', ')', '}', ')', 'if', 'user_check', 'and', 'not', 'self', '.', 'user_is_submission_owne...
Get a submission from the database
['Get', 'a', 'submission', 'from', 'the', 'database']
train
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/submission_manager.py#L208-L213
6,821
mitsei/dlkit
dlkit/json_/grading/objects.py
Grade.get_grade_system_id
def get_grade_system_id(self): """Gets the ``GradeSystem Id`` in which this grade belongs. return: (osid.id.Id) - the grade system ``Id`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.learning.Activity.get_objective_id ...
python
def get_grade_system_id(self): """Gets the ``GradeSystem Id`` in which this grade belongs. return: (osid.id.Id) - the grade system ``Id`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.learning.Activity.get_objective_id ...
['def', 'get_grade_system_id', '(', 'self', ')', ':', '# Implemented from template for osid.learning.Activity.get_objective_id', 'if', 'not', 'bool', '(', 'self', '.', '_my_map', '[', "'gradeSystemId'", ']', ')', ':', 'raise', 'errors', '.', 'IllegalState', '(', "'grade_system empty'", ')', 'return', 'Id', '(', 'self',...
Gets the ``GradeSystem Id`` in which this grade belongs. return: (osid.id.Id) - the grade system ``Id`` *compliance: mandatory -- This method must be implemented.*
['Gets', 'the', 'GradeSystem', 'Id', 'in', 'which', 'this', 'grade', 'belongs', '.']
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/grading/objects.py#L51-L61
6,822
angr/angr
angr/analyses/decompiler/structurer.py
Structurer._extract_jump_targets
def _extract_jump_targets(stmt): """ Extract goto targets from a Jump or a ConditionalJump statement. :param stmt: The statement to analyze. :return: A list of known concrete jump targets. :rtype: list """ targets = [ ] # FIXME: We are...
python
def _extract_jump_targets(stmt): """ Extract goto targets from a Jump or a ConditionalJump statement. :param stmt: The statement to analyze. :return: A list of known concrete jump targets. :rtype: list """ targets = [ ] # FIXME: We are...
['def', '_extract_jump_targets', '(', 'stmt', ')', ':', 'targets', '=', '[', ']', '# FIXME: We are assuming all jump targets are concrete targets. They may not be.', 'if', 'isinstance', '(', 'stmt', ',', 'ailment', '.', 'Stmt', '.', 'Jump', ')', ':', 'targets', '.', 'append', '(', 'stmt', '.', 'target', '.', 'value', '...
Extract goto targets from a Jump or a ConditionalJump statement. :param stmt: The statement to analyze. :return: A list of known concrete jump targets. :rtype: list
['Extract', 'goto', 'targets', 'from', 'a', 'Jump', 'or', 'a', 'ConditionalJump', 'statement', '.']
train
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/decompiler/structurer.py#L838-L857
6,823
nkavaldj/myhdl_lib
myhdl_lib/mem.py
convert_ram_sp_rf
def convert_ram_sp_rf(ADDR_WIDTH=8, DATA_WIDTH=8): ''' Convert RAM: Single-Port, Read-First ''' clk = Signal(bool(0)) we = Signal(bool(0)) addr = Signal(intbv(0)[ADDR_WIDTH:]) di = Signal(intbv(0)[DATA_WIDTH:]) do = Signal(intbv(0)[DATA_WIDTH:]) toVerilog(ram_sp_rf, clk, we, addr, di, do)
python
def convert_ram_sp_rf(ADDR_WIDTH=8, DATA_WIDTH=8): ''' Convert RAM: Single-Port, Read-First ''' clk = Signal(bool(0)) we = Signal(bool(0)) addr = Signal(intbv(0)[ADDR_WIDTH:]) di = Signal(intbv(0)[DATA_WIDTH:]) do = Signal(intbv(0)[DATA_WIDTH:]) toVerilog(ram_sp_rf, clk, we, addr, di, do)
['def', 'convert_ram_sp_rf', '(', 'ADDR_WIDTH', '=', '8', ',', 'DATA_WIDTH', '=', '8', ')', ':', 'clk', '=', 'Signal', '(', 'bool', '(', '0', ')', ')', 'we', '=', 'Signal', '(', 'bool', '(', '0', ')', ')', 'addr', '=', 'Signal', '(', 'intbv', '(', '0', ')', '[', 'ADDR_WIDTH', ':', ']', ')', 'di', '=', 'Signal', '(', 'i...
Convert RAM: Single-Port, Read-First
['Convert', 'RAM', ':', 'Single', '-', 'Port', 'Read', '-', 'First']
train
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/mem.py#L193-L200
6,824
andrewgross/pyrelic
pyrelic/client.py
Client.get_metric_data
def get_metric_data(self, applications, metrics, field, begin, end, summary=False): """ Requires: account ID, list of application IDs, list of metrics, metric fields, begin, end Method: Get Endpoint...
python
def get_metric_data(self, applications, metrics, field, begin, end, summary=False): """ Requires: account ID, list of application IDs, list of metrics, metric fields, begin, end Method: Get Endpoint...
['def', 'get_metric_data', '(', 'self', ',', 'applications', ',', 'metrics', ',', 'field', ',', 'begin', ',', 'end', ',', 'summary', '=', 'False', ')', ':', '# TODO: it may be nice to have some helper methods that make it easier', '# to query by common time frames based off the time period folding', '# of t...
Requires: account ID, list of application IDs, list of metrics, metric fields, begin, end Method: Get Endpoint: api.newrelic.com Restrictions: Rate limit to 1x per minute Errors: 403 Invalid API key...
['Requires', ':', 'account', 'ID', 'list', 'of', 'application', 'IDs', 'list', 'of', 'metrics', 'metric', 'fields', 'begin', 'end', 'Method', ':', 'Get', 'Endpoint', ':', 'api', '.', 'newrelic', '.', 'com', 'Restrictions', ':', 'Rate', 'limit', 'to', '1x', 'per', 'minute', 'Errors', ':', '403', 'Invalid', 'API', 'key',...
train
https://github.com/andrewgross/pyrelic/blob/641abe7bfa56bf850281f2d9c90cebe7ea2dfd1e/pyrelic/client.py#L250-L310
6,825
ClimateImpactLab/DataFS
datafs/core/data_api.py
DataAPI.get_archive
def get_archive(self, archive_name, default_version=None): ''' Retrieve a data archive Parameters ---------- archive_name: str Name of the archive to retrieve default_version: version str or :py:class:`~distutils.StrictVersion` giving the defaul...
python
def get_archive(self, archive_name, default_version=None): ''' Retrieve a data archive Parameters ---------- archive_name: str Name of the archive to retrieve default_version: version str or :py:class:`~distutils.StrictVersion` giving the defaul...
['def', 'get_archive', '(', 'self', ',', 'archive_name', ',', 'default_version', '=', 'None', ')', ':', 'auth', ',', 'archive_name', '=', 'self', '.', '_normalize_archive_name', '(', 'archive_name', ')', 'res', '=', 'self', '.', 'manager', '.', 'get_archive', '(', 'archive_name', ')', 'if', 'default_version', 'is', 'No...
Retrieve a data archive Parameters ---------- archive_name: str Name of the archive to retrieve default_version: version str or :py:class:`~distutils.StrictVersion` giving the default version number to be used on read operations Returns ...
['Retrieve', 'a', 'data', 'archive']
train
https://github.com/ClimateImpactLab/DataFS/blob/0d32c2b4e18d300a11b748a552f6adbc3dd8f59d/datafs/core/data_api.py#L190-L233
6,826
hobson/pug-invest
pug/invest/plot.py
thin_string_list
def thin_string_list(list_of_strings, max_nonempty_strings=50, blank=''): """Designed for composing lists of strings suitable for pyplot axis labels Often the xtick spacing doesn't allow room for 100's of text labels, so this eliminates every other one, then every other one of those, until they fit. >...
python
def thin_string_list(list_of_strings, max_nonempty_strings=50, blank=''): """Designed for composing lists of strings suitable for pyplot axis labels Often the xtick spacing doesn't allow room for 100's of text labels, so this eliminates every other one, then every other one of those, until they fit. >...
['def', 'thin_string_list', '(', 'list_of_strings', ',', 'max_nonempty_strings', '=', '50', ',', 'blank', '=', "''", ')', ':', "# blank some labels to make sure they don't overlap", 'list_of_strings', '=', 'list', '(', 'list_of_strings', ')', 'istep', '=', '2', 'while', 'sum', '(', 'bool', '(', 's', ')', 'for', 's', 'i...
Designed for composing lists of strings suitable for pyplot axis labels Often the xtick spacing doesn't allow room for 100's of text labels, so this eliminates every other one, then every other one of those, until they fit. >>> thin_string_list(['x']*20, 5) # doctring: +NORMALIZE_WHITESPACE ['x', '',...
['Designed', 'for', 'composing', 'lists', 'of', 'strings', 'suitable', 'for', 'pyplot', 'axis', 'labels']
train
https://github.com/hobson/pug-invest/blob/836911258a0e920083a88c91beae88eefdebb20c/pug/invest/plot.py#L259-L274
6,827
RiotGames/cloud-inquisitor
backend/cloud_inquisitor/plugins/types/issues.py
BaseIssue.search
def search(cls, *, limit=100, page=1, properties=None, return_query=False): """Search for issues based on the provided filters Args: limit (`int`): Number of results to return. Default: 100 page (`int`): Pagination offset for results. Default: 1 properties (`dict`): ...
python
def search(cls, *, limit=100, page=1, properties=None, return_query=False): """Search for issues based on the provided filters Args: limit (`int`): Number of results to return. Default: 100 page (`int`): Pagination offset for results. Default: 1 properties (`dict`): ...
['def', 'search', '(', 'cls', ',', '*', ',', 'limit', '=', '100', ',', 'page', '=', '1', ',', 'properties', '=', 'None', ',', 'return_query', '=', 'False', ')', ':', 'qry', '=', 'db', '.', 'Issue', '.', 'order_by', '(', 'Issue', '.', 'issue_id', ')', '.', 'filter', '(', 'Issue', '.', 'issue_type_id', '==', 'IssueType',...
Search for issues based on the provided filters Args: limit (`int`): Number of results to return. Default: 100 page (`int`): Pagination offset for results. Default: 1 properties (`dict`): A `dict` containing property name and value pairs. Values can be either a str or a list...
['Search', 'for', 'issues', 'based', 'on', 'the', 'provided', 'filters']
train
https://github.com/RiotGames/cloud-inquisitor/blob/181dc2566ca59fc855f695b7fcc2c3b934e6ee9f/backend/cloud_inquisitor/plugins/types/issues.py#L182-L231
6,828
openpaperwork/paperwork-backend
paperwork_backend/img/page.py
ImgPage.__get_boxes
def __get_boxes(self): """ Get all the word boxes of this page. """ boxfile = self.__box_path try: box_builder = pyocr.builders.LineBoxBuilder() with self.fs.open(boxfile, 'r') as file_desc: boxes = box_builder.read_file(file_desc) ...
python
def __get_boxes(self): """ Get all the word boxes of this page. """ boxfile = self.__box_path try: box_builder = pyocr.builders.LineBoxBuilder() with self.fs.open(boxfile, 'r') as file_desc: boxes = box_builder.read_file(file_desc) ...
['def', '__get_boxes', '(', 'self', ')', ':', 'boxfile', '=', 'self', '.', '__box_path', 'try', ':', 'box_builder', '=', 'pyocr', '.', 'builders', '.', 'LineBoxBuilder', '(', ')', 'with', 'self', '.', 'fs', '.', 'open', '(', 'boxfile', ',', "'r'", ')', 'as', 'file_desc', ':', 'boxes', '=', 'box_builder', '.', 'read_fil...
Get all the word boxes of this page.
['Get', 'all', 'the', 'word', 'boxes', 'of', 'this', 'page', '.']
train
https://github.com/openpaperwork/paperwork-backend/blob/114b831e94e039e68b339751fd18250877abad76/paperwork_backend/img/page.py#L95-L120
6,829
saltstack/salt
salt/modules/aptpkg.py
get_repo_keys
def get_repo_keys(): ''' .. versionadded:: 2017.7.0 List known repo key details. :return: A dictionary containing the repo keys. :rtype: dict CLI Examples: .. code-block:: bash salt '*' pkg.get_repo_keys ''' ret = dict() repo_keys = list() # The double usage of ...
python
def get_repo_keys(): ''' .. versionadded:: 2017.7.0 List known repo key details. :return: A dictionary containing the repo keys. :rtype: dict CLI Examples: .. code-block:: bash salt '*' pkg.get_repo_keys ''' ret = dict() repo_keys = list() # The double usage of ...
['def', 'get_repo_keys', '(', ')', ':', 'ret', '=', 'dict', '(', ')', 'repo_keys', '=', 'list', '(', ')', "# The double usage of '--with-fingerprint' is necessary in order to", '# retrieve the fingerprint of the subkey.', 'cmd', '=', '[', "'apt-key'", ',', "'adv'", ',', "'--batch'", ',', "'--list-public-keys'", ',', "'...
.. versionadded:: 2017.7.0 List known repo key details. :return: A dictionary containing the repo keys. :rtype: dict CLI Examples: .. code-block:: bash salt '*' pkg.get_repo_keys
['..', 'versionadded', '::', '2017', '.', '7', '.', '0']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1835-L1904
6,830
dropseed/configyaml
configyaml/config/base.py
AbstractNode._validate
def _validate(self): # type: () -> None """Run validation, save errors to object in self._errors""" # class can specify it's empty obj -- list would have empty of [] self._errors = [] self._validate_type() if self.is_valid(): self._validate_value()
python
def _validate(self): # type: () -> None """Run validation, save errors to object in self._errors""" # class can specify it's empty obj -- list would have empty of [] self._errors = [] self._validate_type() if self.is_valid(): self._validate_value()
['def', '_validate', '(', 'self', ')', ':', '# type: () -> None', "# class can specify it's empty obj -- list would have empty of []", 'self', '.', '_errors', '=', '[', ']', 'self', '.', '_validate_type', '(', ')', 'if', 'self', '.', 'is_valid', '(', ')', ':', 'self', '.', '_validate_value', '(', ')']
Run validation, save errors to object in self._errors
['Run', 'validation', 'save', 'errors', 'to', 'object', 'in', 'self', '.', '_errors']
train
https://github.com/dropseed/configyaml/blob/d008f251530d054c2d1fb3e8ac1a9030436134c8/configyaml/config/base.py#L163-L171
6,831
gem/oq-engine
openquake/hazardlib/geo/surface/base.py
BaseSurface.get_top_edge_depth
def get_top_edge_depth(self): """ Return minimum depth of surface's top edge. :returns: Float value, the vertical distance between the earth surface and the shallowest point in surface's top edge in km. """ top_edge = self.mesh[0:1] if top_edge.de...
python
def get_top_edge_depth(self): """ Return minimum depth of surface's top edge. :returns: Float value, the vertical distance between the earth surface and the shallowest point in surface's top edge in km. """ top_edge = self.mesh[0:1] if top_edge.de...
['def', 'get_top_edge_depth', '(', 'self', ')', ':', 'top_edge', '=', 'self', '.', 'mesh', '[', '0', ':', '1', ']', 'if', 'top_edge', '.', 'depths', 'is', 'None', ':', 'return', '0', 'else', ':', 'return', 'numpy', '.', 'min', '(', 'top_edge', '.', 'depths', ')']
Return minimum depth of surface's top edge. :returns: Float value, the vertical distance between the earth surface and the shallowest point in surface's top edge in km.
['Return', 'minimum', 'depth', 'of', 'surface', 's', 'top', 'edge', '.']
train
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/surface/base.py#L268-L280
6,832
unt-libraries/edtf-validate
edtf_validate/valid_edtf.py
replace_u
def replace_u(matchobj): """Break the interval into parts, and replace 'u's. pieces - [pos/neg, start_year, start_month, start_day, pos/neg, end_year, end_month, end_day] """ pieces = list(matchobj.groups('')) # Replace "u"s in start and end years. if 'u' in pieces[1]: pie...
python
def replace_u(matchobj): """Break the interval into parts, and replace 'u's. pieces - [pos/neg, start_year, start_month, start_day, pos/neg, end_year, end_month, end_day] """ pieces = list(matchobj.groups('')) # Replace "u"s in start and end years. if 'u' in pieces[1]: pie...
['def', 'replace_u', '(', 'matchobj', ')', ':', 'pieces', '=', 'list', '(', 'matchobj', '.', 'groups', '(', "''", ')', ')', '# Replace "u"s in start and end years.', 'if', "'u'", 'in', 'pieces', '[', '1', ']', ':', 'pieces', '[', '1', ']', '=', 'pieces', '[', '1', ']', '.', 'replace', '(', "'u'", ',', "'0'", ')', 'if',...
Break the interval into parts, and replace 'u's. pieces - [pos/neg, start_year, start_month, start_day, pos/neg, end_year, end_month, end_day]
['Break', 'the', 'interval', 'into', 'parts', 'and', 'replace', 'u', 's', '.']
train
https://github.com/unt-libraries/edtf-validate/blob/d6d63141919a66aea4ff1c31fa0cb8ff744ef9d9/edtf_validate/valid_edtf.py#L326-L351
6,833
KelSolaar/Foundations
foundations/rotating_backup.py
RotatingBackup.destination
def destination(self, value): """ Setter for **self.__destination** attribute. :param value: Attribute value. :type value: unicode """ if value is not None: assert type(value) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format( ...
python
def destination(self, value): """ Setter for **self.__destination** attribute. :param value: Attribute value. :type value: unicode """ if value is not None: assert type(value) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format( ...
['def', 'destination', '(', 'self', ',', 'value', ')', ':', 'if', 'value', 'is', 'not', 'None', ':', 'assert', 'type', '(', 'value', ')', 'is', 'unicode', ',', '"\'{0}\' attribute: \'{1}\' type is not \'unicode\'!"', '.', 'format', '(', '"destination"', ',', 'value', ')', 'self', '.', '__destination', '=', 'value']
Setter for **self.__destination** attribute. :param value: Attribute value. :type value: unicode
['Setter', 'for', '**', 'self', '.', '__destination', '**', 'attribute', '.']
train
https://github.com/KelSolaar/Foundations/blob/5c141330faf09dad70a12bc321f4c564917d0a91/foundations/rotating_backup.py#L136-L147
6,834
linkhub-sdk/popbill.py
popbill/cashbillService.py
CashbillService.updateEmailConfig
def updateEmailConfig(self, Corpnum, EmailType, SendYN, UserID=None): """ 알림메일 전송설정 수정 args CorpNum : 팝빌회원 사업자번호 EmailType: 메일전송유형 SendYN: 전송여부 (True-전송, False-미전송) UserID : 팝빌회원 아이디 return 처리결과. consi...
python
def updateEmailConfig(self, Corpnum, EmailType, SendYN, UserID=None): """ 알림메일 전송설정 수정 args CorpNum : 팝빌회원 사업자번호 EmailType: 메일전송유형 SendYN: 전송여부 (True-전송, False-미전송) UserID : 팝빌회원 아이디 return 처리결과. consi...
['def', 'updateEmailConfig', '(', 'self', ',', 'Corpnum', ',', 'EmailType', ',', 'SendYN', ',', 'UserID', '=', 'None', ')', ':', 'if', 'EmailType', '==', 'None', 'or', 'EmailType', '==', "''", ':', 'raise', 'PopbillException', '(', '-', '99999999', ',', '"메일전송 타입이 입력되지 않았습니다.")\r', '', 'if', 'SendYN', '==', 'None', 'or...
알림메일 전송설정 수정 args CorpNum : 팝빌회원 사업자번호 EmailType: 메일전송유형 SendYN: 전송여부 (True-전송, False-미전송) UserID : 팝빌회원 아이디 return 처리결과. consist of code and message raise PopbillException
['알림메일', '전송설정', '수정', 'args', 'CorpNum', ':', '팝빌회원', '사업자번호', 'EmailType', ':', '메일전송유형', 'SendYN', ':', '전송여부', '(', 'True', '-', '전송', 'False', '-', '미전송', ')', 'UserID', ':', '팝빌회원', '아이디', 'return', '처리결과', '.', 'consist', 'of', 'code', 'and', 'message', 'raise', 'PopbillException']
train
https://github.com/linkhub-sdk/popbill.py/blob/68a0dd7f7a937603318e93be321fde73c50b96cc/popbill/cashbillService.py#L596-L615
6,835
urbn/Caesium
caesium/handler.py
BaseHandler.write_hyper_response
def write_hyper_response(self, links=[], meta={}, entity_name=None, entity=None, notifications=[], actions=[]): """Writes a hyper media response object :param list links: A list of links to the resources :param dict meta: The meta data for this response :param str entity_name: The entit...
python
def write_hyper_response(self, links=[], meta={}, entity_name=None, entity=None, notifications=[], actions=[]): """Writes a hyper media response object :param list links: A list of links to the resources :param dict meta: The meta data for this response :param str entity_name: The entit...
['def', 'write_hyper_response', '(', 'self', ',', 'links', '=', '[', ']', ',', 'meta', '=', '{', '}', ',', 'entity_name', '=', 'None', ',', 'entity', '=', 'None', ',', 'notifications', '=', '[', ']', ',', 'actions', '=', '[', ']', ')', ':', 'assert', 'entity_name', 'is', 'not', 'None', 'assert', 'entity', 'is', 'not', ...
Writes a hyper media response object :param list links: A list of links to the resources :param dict meta: The meta data for this response :param str entity_name: The entity name :param object entity: The Entity itself :param list notifications: List of notifications :pa...
['Writes', 'a', 'hyper', 'media', 'response', 'object']
train
https://github.com/urbn/Caesium/blob/2a14fe79724c38fe9a1b20f7b8f518f8c6d50df1/caesium/handler.py#L252-L275
6,836
spacetelescope/drizzlepac
drizzlepac/tweakback.py
determine_orig_wcsname
def determine_orig_wcsname(header, wnames, wkeys): """ Determine the name of the original, unmodified WCS solution """ orig_wcsname = None orig_key = None if orig_wcsname is None: for k,w in wnames.items(): if w[:4] == 'IDC_': orig_wcsname = w ...
python
def determine_orig_wcsname(header, wnames, wkeys): """ Determine the name of the original, unmodified WCS solution """ orig_wcsname = None orig_key = None if orig_wcsname is None: for k,w in wnames.items(): if w[:4] == 'IDC_': orig_wcsname = w ...
['def', 'determine_orig_wcsname', '(', 'header', ',', 'wnames', ',', 'wkeys', ')', ':', 'orig_wcsname', '=', 'None', 'orig_key', '=', 'None', 'if', 'orig_wcsname', 'is', 'None', ':', 'for', 'k', ',', 'w', 'in', 'wnames', '.', 'items', '(', ')', ':', 'if', 'w', '[', ':', '4', ']', '==', "'IDC_'", ':', 'orig_wcsname', '=...
Determine the name of the original, unmodified WCS solution
['Determine', 'the', 'name', 'of', 'the', 'original', 'unmodified', 'WCS', 'solution']
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/tweakback.py#L379-L396
6,837
pacificclimate/cfmeta
cfmeta/cmip5file.py
get_cmor_fp_meta
def get_cmor_fp_meta(fp): """Processes a CMOR style file path. Section 3.1 of the `Data Reference Syntax`_ details: The standard CMIP5 output tool CMOR optionally writes output files to a directory structure mapping DRS components to directory names as: <activity>/<product>/<insti...
python
def get_cmor_fp_meta(fp): """Processes a CMOR style file path. Section 3.1 of the `Data Reference Syntax`_ details: The standard CMIP5 output tool CMOR optionally writes output files to a directory structure mapping DRS components to directory names as: <activity>/<product>/<insti...
['def', 'get_cmor_fp_meta', '(', 'fp', ')', ':', '# Copy metadata list then reverse to start at end of path', 'directory_meta', '=', 'list', '(', 'CMIP5_FP_ATTS', ')', '# Prefer meta extracted from filename', 'meta', '=', 'get_dir_meta', '(', 'fp', ',', 'directory_meta', ')', 'meta', '.', 'update', '(', 'get_cmor_fname...
Processes a CMOR style file path. Section 3.1 of the `Data Reference Syntax`_ details: The standard CMIP5 output tool CMOR optionally writes output files to a directory structure mapping DRS components to directory names as: <activity>/<product>/<institute>/<model>/<experiment>/<frequ...
['Processes', 'a', 'CMOR', 'style', 'file', 'path', '.']
train
https://github.com/pacificclimate/cfmeta/blob/a6eef78d0bce523bb44920ba96233f034b60316a/cfmeta/cmip5file.py#L124-L152
6,838
jopohl/urh
src/urh/controller/CompareFrameController.py
CompareFrameController.protocols
def protocols(self): """ :rtype: dict[int, list of ProtocolAnalyzer] """ if self.__protocols is None: self.__protocols = self.proto_tree_model.protocols return self.__protocols
python
def protocols(self): """ :rtype: dict[int, list of ProtocolAnalyzer] """ if self.__protocols is None: self.__protocols = self.proto_tree_model.protocols return self.__protocols
['def', 'protocols', '(', 'self', ')', ':', 'if', 'self', '.', '__protocols', 'is', 'None', ':', 'self', '.', '__protocols', '=', 'self', '.', 'proto_tree_model', '.', 'protocols', 'return', 'self', '.', '__protocols']
:rtype: dict[int, list of ProtocolAnalyzer]
[':', 'rtype', ':', 'dict', '[', 'int', 'list', 'of', 'ProtocolAnalyzer', ']']
train
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/controller/CompareFrameController.py#L201-L207
6,839
softlayer/softlayer-python
SoftLayer/CLI/virt/create_options.py
cli
def cli(env): """Virtual server order options.""" vsi = SoftLayer.VSManager(env.client) result = vsi.get_create_options() table = formatting.KeyValueTable(['name', 'value']) table.align['name'] = 'r' table.align['value'] = 'l' # Datacenters datacenters = [dc['template']['datacenter'][...
python
def cli(env): """Virtual server order options.""" vsi = SoftLayer.VSManager(env.client) result = vsi.get_create_options() table = formatting.KeyValueTable(['name', 'value']) table.align['name'] = 'r' table.align['value'] = 'l' # Datacenters datacenters = [dc['template']['datacenter'][...
['def', 'cli', '(', 'env', ')', ':', 'vsi', '=', 'SoftLayer', '.', 'VSManager', '(', 'env', '.', 'client', ')', 'result', '=', 'vsi', '.', 'get_create_options', '(', ')', 'table', '=', 'formatting', '.', 'KeyValueTable', '(', '[', "'name'", ',', "'value'", ']', ')', 'table', '.', 'align', '[', "'name'", ']', '=', "'r'"...
Virtual server order options.
['Virtual', 'server', 'order', 'options', '.']
train
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/virt/create_options.py#L17-L169
6,840
shaypal5/strct
strct/sortedlists/sortedlist.py
find_point_in_section_list
def find_point_in_section_list(point, section_list): """Returns the start of the section the given point belongs to. The given list is assumed to contain start points of consecutive sections, except for the final point, assumed to be the end point of the last section. For example, the list [5, 8, 30, 3...
python
def find_point_in_section_list(point, section_list): """Returns the start of the section the given point belongs to. The given list is assumed to contain start points of consecutive sections, except for the final point, assumed to be the end point of the last section. For example, the list [5, 8, 30, 3...
['def', 'find_point_in_section_list', '(', 'point', ',', 'section_list', ')', ':', 'if', 'point', '<', 'section_list', '[', '0', ']', 'or', 'point', '>', 'section_list', '[', '-', '1', ']', ':', 'return', 'None', 'if', 'point', 'in', 'section_list', ':', 'if', 'point', '==', 'section_list', '[', '-', '1', ']', ':', 're...
Returns the start of the section the given point belongs to. The given list is assumed to contain start points of consecutive sections, except for the final point, assumed to be the end point of the last section. For example, the list [5, 8, 30, 31] is interpreted as the following list of sections: [5-...
['Returns', 'the', 'start', 'of', 'the', 'section', 'the', 'given', 'point', 'belongs', 'to', '.']
train
https://github.com/shaypal5/strct/blob/f3a301692d052ddb79331230b3c00625db1d83fc/strct/sortedlists/sortedlist.py#L4-L53
6,841
dmlc/gluon-nlp
scripts/bert/staticbert/static_finetune_squad.py
evaluate
def evaluate(): """Evaluate the model on validation dataset. """ log.info('Loader dev data...') if version_2: dev_data = SQuAD('dev', version='2.0') else: dev_data = SQuAD('dev', version='1.1') log.info('Number of records in Train data:{}'.format(len(dev_data))) dev_dataset ...
python
def evaluate(): """Evaluate the model on validation dataset. """ log.info('Loader dev data...') if version_2: dev_data = SQuAD('dev', version='2.0') else: dev_data = SQuAD('dev', version='1.1') log.info('Number of records in Train data:{}'.format(len(dev_data))) dev_dataset ...
['def', 'evaluate', '(', ')', ':', 'log', '.', 'info', '(', "'Loader dev data...'", ')', 'if', 'version_2', ':', 'dev_data', '=', 'SQuAD', '(', "'dev'", ',', 'version', '=', "'2.0'", ')', 'else', ':', 'dev_data', '=', 'SQuAD', '(', "'dev'", ',', 'version', '=', "'1.1'", ')', 'log', '.', 'info', '(', "'Number of records...
Evaluate the model on validation dataset.
['Evaluate', 'the', 'model', 'on', 'validation', 'dataset', '.']
train
https://github.com/dmlc/gluon-nlp/blob/4b83eb6bcc8881e5f1081a3675adaa19fac5c0ba/scripts/bert/staticbert/static_finetune_squad.py#L429-L517
6,842
hydraplatform/hydra-base
hydra_base/lib/users.py
get_usernames_like
def get_usernames_like(username,**kwargs): """ Return a list of usernames like the given string. """ checkname = "%%%s%%"%username rs = db.DBSession.query(User.username).filter(User.username.like(checkname)).all() return [r.username for r in rs]
python
def get_usernames_like(username,**kwargs): """ Return a list of usernames like the given string. """ checkname = "%%%s%%"%username rs = db.DBSession.query(User.username).filter(User.username.like(checkname)).all() return [r.username for r in rs]
['def', 'get_usernames_like', '(', 'username', ',', '*', '*', 'kwargs', ')', ':', 'checkname', '=', '"%%%s%%"', '%', 'username', 'rs', '=', 'db', '.', 'DBSession', '.', 'query', '(', 'User', '.', 'username', ')', '.', 'filter', '(', 'User', '.', 'username', '.', 'like', '(', 'checkname', ')', ')', '.', 'all', '(', ')',...
Return a list of usernames like the given string.
['Return', 'a', 'list', 'of', 'usernames', 'like', 'the', 'given', 'string', '.']
train
https://github.com/hydraplatform/hydra-base/blob/9251ff7946505f7a272c87837390acd1c435bc6e/hydra_base/lib/users.py#L75-L81
6,843
chimera0/accel-brain-code
Automatic-Summarization/pysummarization/nlpbase/autoabstractor/n_gram_auto_abstractor.py
NgramAutoAbstractor.set_n
def set_n(self, value): ''' setter ''' if isinstance(value, int): self.__n = value else: raise TypeError("The type of n must be int.")
python
def set_n(self, value): ''' setter ''' if isinstance(value, int): self.__n = value else: raise TypeError("The type of n must be int.")
['def', 'set_n', '(', 'self', ',', 'value', ')', ':', 'if', 'isinstance', '(', 'value', ',', 'int', ')', ':', 'self', '.', '__n', '=', 'value', 'else', ':', 'raise', 'TypeError', '(', '"The type of n must be int."', ')']
setter
['setter']
train
https://github.com/chimera0/accel-brain-code/blob/03661f6f544bed656269fcd4b3c23c9061629daa/Automatic-Summarization/pysummarization/nlpbase/autoabstractor/n_gram_auto_abstractor.py#L41-L46
6,844
digidotcom/python-devicecloud
devicecloud/__init__.py
DeviceCloudConnection.hostname
def hostname(self): """Get the hostname that this connection is associated with""" from six.moves.urllib.parse import urlparse return urlparse(self._base_url).netloc.split(':', 1)[0]
python
def hostname(self): """Get the hostname that this connection is associated with""" from six.moves.urllib.parse import urlparse return urlparse(self._base_url).netloc.split(':', 1)[0]
['def', 'hostname', '(', 'self', ')', ':', 'from', 'six', '.', 'moves', '.', 'urllib', '.', 'parse', 'import', 'urlparse', 'return', 'urlparse', '(', 'self', '.', '_base_url', ')', '.', 'netloc', '.', 'split', '(', "':'", ',', '1', ')', '[', '0', ']']
Get the hostname that this connection is associated with
['Get', 'the', 'hostname', 'that', 'this', 'connection', 'is', 'associated', 'with']
train
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/__init__.py#L131-L134
6,845
bspaans/python-mingus
mingus/containers/note_container.py
NoteContainer.remove_note
def remove_note(self, note, octave=-1): """Remove note from container. The note can either be a Note object or a string representing the note's name. If no specific octave is given, the note gets removed in every octave. """ res = [] for x in self.notes: ...
python
def remove_note(self, note, octave=-1): """Remove note from container. The note can either be a Note object or a string representing the note's name. If no specific octave is given, the note gets removed in every octave. """ res = [] for x in self.notes: ...
['def', 'remove_note', '(', 'self', ',', 'note', ',', 'octave', '=', '-', '1', ')', ':', 'res', '=', '[', ']', 'for', 'x', 'in', 'self', '.', 'notes', ':', 'if', 'type', '(', 'note', ')', '==', 'str', ':', 'if', 'x', '.', 'name', '!=', 'note', ':', 'res', '.', 'append', '(', 'x', ')', 'else', ':', 'if', 'x', '.', 'octa...
Remove note from container. The note can either be a Note object or a string representing the note's name. If no specific octave is given, the note gets removed in every octave.
['Remove', 'note', 'from', 'container', '.']
train
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/containers/note_container.py#L213-L232
6,846
rsalmaso/django-fluo
fluo/views/decorators.py
login_required
def login_required(function=None, required=False, redirect_field_name=REDIRECT_FIELD_NAME): """ Decorator for views that, if required, checks that the user is logged in and redirect to the log-in page if necessary. """ if required: if django.VERSION < (1, 11): actual_decorator = ...
python
def login_required(function=None, required=False, redirect_field_name=REDIRECT_FIELD_NAME): """ Decorator for views that, if required, checks that the user is logged in and redirect to the log-in page if necessary. """ if required: if django.VERSION < (1, 11): actual_decorator = ...
['def', 'login_required', '(', 'function', '=', 'None', ',', 'required', '=', 'False', ',', 'redirect_field_name', '=', 'REDIRECT_FIELD_NAME', ')', ':', 'if', 'required', ':', 'if', 'django', '.', 'VERSION', '<', '(', '1', ',', '11', ')', ':', 'actual_decorator', '=', 'user_passes_test', '(', 'lambda', 'u', ':', 'u', '...
Decorator for views that, if required, checks that the user is logged in and redirect to the log-in page if necessary.
['Decorator', 'for', 'views', 'that', 'if', 'required', 'checks', 'that', 'the', 'user', 'is', 'logged', 'in', 'and', 'redirect', 'to', 'the', 'log', '-', 'in', 'page', 'if', 'necessary', '.']
train
https://github.com/rsalmaso/django-fluo/blob/1321c1e7d6a912108f79be02a9e7f2108c57f89f/fluo/views/decorators.py#L54-L78
6,847
The-Politico/politico-civic-almanac
almanac/utils/auth.py
secure
def secure(view): """ Authentication decorator for views. If DEBUG is on, we serve the view without authenticating. Default is 'django.contrib.auth.decorators.login_required'. Can also be 'django.contrib.admin.views.decorators.staff_member_required' or a custom decorator. """ auth_decor...
python
def secure(view): """ Authentication decorator for views. If DEBUG is on, we serve the view without authenticating. Default is 'django.contrib.auth.decorators.login_required'. Can also be 'django.contrib.admin.views.decorators.staff_member_required' or a custom decorator. """ auth_decor...
['def', 'secure', '(', 'view', ')', ':', 'auth_decorator', '=', 'import_class', '(', 'settings', '.', 'AUTH_DECORATOR', ')', 'return', '(', 'view', 'if', 'project_settings', '.', 'DEBUG', 'else', 'method_decorator', '(', 'auth_decorator', ',', 'name', '=', "'dispatch'", ')', '(', 'view', ')', ')']
Authentication decorator for views. If DEBUG is on, we serve the view without authenticating. Default is 'django.contrib.auth.decorators.login_required'. Can also be 'django.contrib.admin.views.decorators.staff_member_required' or a custom decorator.
['Authentication', 'decorator', 'for', 'views', '.']
train
https://github.com/The-Politico/politico-civic-almanac/blob/f97521fabd445c8a0fa97a435f6d39f517ef3892/almanac/utils/auth.py#L8-L21
6,848
bfontaine/p7magma
magma/session.py
Session.get_url
def get_url(self, url): """ Get an absolute URL from a given one. """ if url.startswith('/'): url = '%s%s' % (self.base_url, url) return url
python
def get_url(self, url): """ Get an absolute URL from a given one. """ if url.startswith('/'): url = '%s%s' % (self.base_url, url) return url
['def', 'get_url', '(', 'self', ',', 'url', ')', ':', 'if', 'url', '.', 'startswith', '(', "'/'", ')', ':', 'url', '=', "'%s%s'", '%', '(', 'self', '.', 'base_url', ',', 'url', ')', 'return', 'url']
Get an absolute URL from a given one.
['Get', 'an', 'absolute', 'URL', 'from', 'a', 'given', 'one', '.']
train
https://github.com/bfontaine/p7magma/blob/713647aa9e3187c93c2577ef812f33ec42ae5494/magma/session.py#L57-L63
6,849
honeynet/beeswarm
beeswarm/shared/asciify.py
_asciify_list
def _asciify_list(data): """ Ascii-fies list values """ ret = [] for item in data: if isinstance(item, unicode): item = _remove_accents(item) item = item.encode('utf-8') elif isinstance(item, list): item = _asciify_list(item) elif isinstance(item, ...
python
def _asciify_list(data): """ Ascii-fies list values """ ret = [] for item in data: if isinstance(item, unicode): item = _remove_accents(item) item = item.encode('utf-8') elif isinstance(item, list): item = _asciify_list(item) elif isinstance(item, ...
['def', '_asciify_list', '(', 'data', ')', ':', 'ret', '=', '[', ']', 'for', 'item', 'in', 'data', ':', 'if', 'isinstance', '(', 'item', ',', 'unicode', ')', ':', 'item', '=', '_remove_accents', '(', 'item', ')', 'item', '=', 'item', '.', 'encode', '(', "'utf-8'", ')', 'elif', 'isinstance', '(', 'item', ',', 'list', ')...
Ascii-fies list values
['Ascii', '-', 'fies', 'list', 'values']
train
https://github.com/honeynet/beeswarm/blob/db51ea0bc29f631c3e3b5312b479ac9d5e31079a/beeswarm/shared/asciify.py#L15-L27
6,850
datascopeanalytics/scrubadub
scrubadub/scrubbers.py
Scrubber.iter_filth
def iter_filth(self, text): """Iterate over the different types of filth that can exist. """ # currently doing this by aggregating all_filths and then sorting # inline instead of with a Filth.__cmp__ method, which is apparently # much slower http://stackoverflow.com/a/988728/5647...
python
def iter_filth(self, text): """Iterate over the different types of filth that can exist. """ # currently doing this by aggregating all_filths and then sorting # inline instead of with a Filth.__cmp__ method, which is apparently # much slower http://stackoverflow.com/a/988728/5647...
['def', 'iter_filth', '(', 'self', ',', 'text', ')', ':', '# currently doing this by aggregating all_filths and then sorting', '# inline instead of with a Filth.__cmp__ method, which is apparently', '# much slower http://stackoverflow.com/a/988728/564709', '#', '# NOTE: we could probably do this in a more efficient way...
Iterate over the different types of filth that can exist.
['Iterate', 'over', 'the', 'different', 'types', 'of', 'filth', 'that', 'can', 'exist', '.']
train
https://github.com/datascopeanalytics/scrubadub/blob/914bda49a16130b44af43df6a2f84755477c407c/scrubadub/scrubbers.py#L64-L96
6,851
pkgw/pwkit
pwkit/io.py
Path.read_json
def read_json (self, mode='rt', **kwargs): """Use the :mod:`json` module to read in this file as a JSON-formatted data structure. Keyword arguments are passed to :func:`json.load`. Returns the read-in data structure. """ import json with self.open (mode=mode) as f: ...
python
def read_json (self, mode='rt', **kwargs): """Use the :mod:`json` module to read in this file as a JSON-formatted data structure. Keyword arguments are passed to :func:`json.load`. Returns the read-in data structure. """ import json with self.open (mode=mode) as f: ...
['def', 'read_json', '(', 'self', ',', 'mode', '=', "'rt'", ',', '*', '*', 'kwargs', ')', ':', 'import', 'json', 'with', 'self', '.', 'open', '(', 'mode', '=', 'mode', ')', 'as', 'f', ':', 'return', 'json', '.', 'load', '(', 'f', ',', '*', '*', 'kwargs', ')']
Use the :mod:`json` module to read in this file as a JSON-formatted data structure. Keyword arguments are passed to :func:`json.load`. Returns the read-in data structure.
['Use', 'the', ':', 'mod', ':', 'json', 'module', 'to', 'read', 'in', 'this', 'file', 'as', 'a', 'JSON', '-', 'formatted', 'data', 'structure', '.', 'Keyword', 'arguments', 'are', 'passed', 'to', ':', 'func', ':', 'json', '.', 'load', '.', 'Returns', 'the', 'read', '-', 'in', 'data', 'structure', '.']
train
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/io.py#L791-L800
6,852
frmdstryr/enamlx
enamlx/qt/qt_key_event.py
QtKeyEvent.init_widget
def init_widget(self): """ The KeyEvent uses the parent_widget as it's widget """ super(QtKeyEvent, self).init_widget() d = self.declaration widget = self.widget self._keyPressEvent = widget.keyPressEvent self._keyReleaseEvent = widget.keyReleaseEvent self.set_ena...
python
def init_widget(self): """ The KeyEvent uses the parent_widget as it's widget """ super(QtKeyEvent, self).init_widget() d = self.declaration widget = self.widget self._keyPressEvent = widget.keyPressEvent self._keyReleaseEvent = widget.keyReleaseEvent self.set_ena...
['def', 'init_widget', '(', 'self', ')', ':', 'super', '(', 'QtKeyEvent', ',', 'self', ')', '.', 'init_widget', '(', ')', 'd', '=', 'self', '.', 'declaration', 'widget', '=', 'self', '.', 'widget', 'self', '.', '_keyPressEvent', '=', 'widget', '.', 'keyPressEvent', 'self', '.', '_keyReleaseEvent', '=', 'widget', '.', '...
The KeyEvent uses the parent_widget as it's widget
['The', 'KeyEvent', 'uses', 'the', 'parent_widget', 'as', 'it', 's', 'widget']
train
https://github.com/frmdstryr/enamlx/blob/9582e29c88dc0c0340f912b49168b7307a47ed4f/enamlx/qt/qt_key_event.py#L47-L55
6,853
bjodah/pyodesys
pyodesys/symbolic.py
SymbolicSys.get_dfdx
def get_dfdx(self): """ Calculates 2nd derivatives of ``self.exprs`` """ if self._dfdx is True: if self.indep is None: zero = 0*self.be.Dummy()**0 self._dfdx = self.be.Matrix(1, self.ny, [zero]*self.ny) else: self._dfdx = self.be.Ma...
python
def get_dfdx(self): """ Calculates 2nd derivatives of ``self.exprs`` """ if self._dfdx is True: if self.indep is None: zero = 0*self.be.Dummy()**0 self._dfdx = self.be.Matrix(1, self.ny, [zero]*self.ny) else: self._dfdx = self.be.Ma...
['def', 'get_dfdx', '(', 'self', ')', ':', 'if', 'self', '.', '_dfdx', 'is', 'True', ':', 'if', 'self', '.', 'indep', 'is', 'None', ':', 'zero', '=', '0', '*', 'self', '.', 'be', '.', 'Dummy', '(', ')', '**', '0', 'self', '.', '_dfdx', '=', 'self', '.', 'be', '.', 'Matrix', '(', '1', ',', 'self', '.', 'ny', ',', '[', '...
Calculates 2nd derivatives of ``self.exprs``
['Calculates', '2nd', 'derivatives', 'of', 'self', '.', 'exprs']
train
https://github.com/bjodah/pyodesys/blob/0034a6165b550d8d9808baef58678dca5a493ab7/pyodesys/symbolic.py#L674-L684
6,854
jessevdk/cldoc
cldoc/clang/cindex.py
Diagnostic.format
def format(self, options=None): """ Format this diagnostic for display. The options argument takes Diagnostic.Display* flags, which can be combined using bitwise OR. If the options argument is not provided, the default display options will be used. """ if options ...
python
def format(self, options=None): """ Format this diagnostic for display. The options argument takes Diagnostic.Display* flags, which can be combined using bitwise OR. If the options argument is not provided, the default display options will be used. """ if options ...
['def', 'format', '(', 'self', ',', 'options', '=', 'None', ')', ':', 'if', 'options', 'is', 'None', ':', 'options', '=', 'conf', '.', 'lib', '.', 'clang_defaultDiagnosticDisplayOptions', '(', ')', 'if', 'options', '&', '~', 'Diagnostic', '.', '_FormatOptionsMask', ':', 'raise', 'ValueError', '(', "'Invalid format opti...
Format this diagnostic for display. The options argument takes Diagnostic.Display* flags, which can be combined using bitwise OR. If the options argument is not provided, the default display options will be used.
['Format', 'this', 'diagnostic', 'for', 'display', '.', 'The', 'options', 'argument', 'takes', 'Diagnostic', '.', 'Display', '*', 'flags', 'which', 'can', 'be', 'combined', 'using', 'bitwise', 'OR', '.', 'If', 'the', 'options', 'argument', 'is', 'not', 'provided', 'the', 'default', 'display', 'options', 'will', 'be', '...
train
https://github.com/jessevdk/cldoc/blob/fc7f59405c4a891b8367c80a700f5aa3c5c9230c/cldoc/clang/cindex.py#L486-L497
6,855
bwohlberg/sporco
sporco/admm/admm.py
ADMM.ustep
def ustep(self): """Dual variable update.""" self.U += self.rsdl_r(self.AX, self.Y)
python
def ustep(self): """Dual variable update.""" self.U += self.rsdl_r(self.AX, self.Y)
['def', 'ustep', '(', 'self', ')', ':', 'self', '.', 'U', '+=', 'self', '.', 'rsdl_r', '(', 'self', '.', 'AX', ',', 'self', '.', 'Y', ')']
Dual variable update.
['Dual', 'variable', 'update', '.']
train
https://github.com/bwohlberg/sporco/blob/8946a04331106f4e39904fbdf2dc7351900baa04/sporco/admm/admm.py#L433-L436
6,856
aacanakin/glim
glim/app.py
Glim.flatten_urls
def flatten_urls(self, urls): """ Function flatten urls for route grouping feature of glim. Args ---- urls (dict): a dict of url definitions. current_key (unknown type): a dict or a string marking the current key that is used for recursive calls. ...
python
def flatten_urls(self, urls): """ Function flatten urls for route grouping feature of glim. Args ---- urls (dict): a dict of url definitions. current_key (unknown type): a dict or a string marking the current key that is used for recursive calls. ...
['def', 'flatten_urls', '(', 'self', ',', 'urls', ')', ':', 'available_methods', '=', '[', "'POST'", ',', "'PUT'", ',', "'OPTIONS'", ',', "'GET'", ',', "'DELETE'", ',', "'TRACE'", ',', "'COPY'", ']', 'ruleset', '=', '[', ']', 'for', 'route', ',', 'endpoint', 'in', 'urls', '.', 'items', '(', ')', ':', 'route_pieces', '=...
Function flatten urls for route grouping feature of glim. Args ---- urls (dict): a dict of url definitions. current_key (unknown type): a dict or a string marking the current key that is used for recursive calls. ruleset (dict): the ruleset that is eventually r...
['Function', 'flatten', 'urls', 'for', 'route', 'grouping', 'feature', 'of', 'glim', '.']
train
https://github.com/aacanakin/glim/blob/71a20ac149a1292c0d6c1dc7414985ea51854f7a/glim/app.py#L165-L209
6,857
RudolfCardinal/pythonlib
cardinal_pythonlib/winservice.py
ProcessManager._taskkill
def _taskkill(self, force: bool = False) -> int: """ Executes a Windows ``TASKKILL /pid PROCESS_ID /t`` command (``/t`` for "tree kill" = "kill all children"). Args: force: also add ``/f`` (forcefully) Returns: return code from ``TASKKILL`` **Te...
python
def _taskkill(self, force: bool = False) -> int: """ Executes a Windows ``TASKKILL /pid PROCESS_ID /t`` command (``/t`` for "tree kill" = "kill all children"). Args: force: also add ``/f`` (forcefully) Returns: return code from ``TASKKILL`` **Te...
['def', '_taskkill', '(', 'self', ',', 'force', ':', 'bool', '=', 'False', ')', '->', 'int', ':', '# noqa', 'args', '=', '[', '"taskkill"', ',', '# built in to Windows XP and higher', '"/pid"', ',', 'str', '(', 'self', '.', 'process', '.', 'pid', ')', ',', '"/t"', ',', '# tree kill: kill all children', ']', 'if', 'forc...
Executes a Windows ``TASKKILL /pid PROCESS_ID /t`` command (``/t`` for "tree kill" = "kill all children"). Args: force: also add ``/f`` (forcefully) Returns: return code from ``TASKKILL`` **Test code:** Firstly we need a program that won't let itself b...
['Executes', 'a', 'Windows', 'TASKKILL', '/', 'pid', 'PROCESS_ID', '/', 't', 'command', '(', '/', 't', 'for', 'tree', 'kill', '=', 'kill', 'all', 'children', ')', '.']
train
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/winservice.py#L571-L675
6,858
IceflowRE/unidown
unidown/plugin/link_item.py
LinkItem.to_protobuf
def to_protobuf(self) -> LinkItemProto: """ Create protobuf item. :return: protobuf structure :rtype: ~unidown.plugin.protobuf.link_item_pb2.LinkItemProto """ result = LinkItemProto() result.name = self._name result.time.CopyFrom(datetime_to_timestamp(sel...
python
def to_protobuf(self) -> LinkItemProto: """ Create protobuf item. :return: protobuf structure :rtype: ~unidown.plugin.protobuf.link_item_pb2.LinkItemProto """ result = LinkItemProto() result.name = self._name result.time.CopyFrom(datetime_to_timestamp(sel...
['def', 'to_protobuf', '(', 'self', ')', '->', 'LinkItemProto', ':', 'result', '=', 'LinkItemProto', '(', ')', 'result', '.', 'name', '=', 'self', '.', '_name', 'result', '.', 'time', '.', 'CopyFrom', '(', 'datetime_to_timestamp', '(', 'self', '.', '_time', ')', ')', 'return', 'result']
Create protobuf item. :return: protobuf structure :rtype: ~unidown.plugin.protobuf.link_item_pb2.LinkItemProto
['Create', 'protobuf', 'item', '.']
train
https://github.com/IceflowRE/unidown/blob/2a6f82ab780bb825668bfc55b67c11c4f72ec05c/unidown/plugin/link_item.py#L70-L80
6,859
ambitioninc/django-manager-utils
manager_utils/upsert2.py
_fetch
def _fetch( queryset, model_objs, unique_fields, update_fields, returning, sync, ignore_duplicate_updates=True, return_untouched=False ): """ Perfom the upsert and do an optional sync operation """ model = queryset.model if (return_untouched or sync) and returning is not True: return...
python
def _fetch( queryset, model_objs, unique_fields, update_fields, returning, sync, ignore_duplicate_updates=True, return_untouched=False ): """ Perfom the upsert and do an optional sync operation """ model = queryset.model if (return_untouched or sync) and returning is not True: return...
['def', '_fetch', '(', 'queryset', ',', 'model_objs', ',', 'unique_fields', ',', 'update_fields', ',', 'returning', ',', 'sync', ',', 'ignore_duplicate_updates', '=', 'True', ',', 'return_untouched', '=', 'False', ')', ':', 'model', '=', 'queryset', '.', 'model', 'if', '(', 'return_untouched', 'or', 'sync', ')', 'and',...
Perfom the upsert and do an optional sync operation
['Perfom', 'the', 'upsert', 'and', 'do', 'an', 'optional', 'sync', 'operation']
train
https://github.com/ambitioninc/django-manager-utils/blob/1f111cb4846ed6cd6b78eca320a9dcc27826bf97/manager_utils/upsert2.py#L252-L288
6,860
facebook/watchman
build/fbcode_builder/shell_quoting.py
shell_comment
def shell_comment(c): 'Do not shell-escape raw strings in comments, but do handle line breaks.' return ShellQuoted('# {c}').format(c=ShellQuoted( (raw_shell(c) if isinstance(c, ShellQuoted) else c) .replace('\n', '\n# ') ))
python
def shell_comment(c): 'Do not shell-escape raw strings in comments, but do handle line breaks.' return ShellQuoted('# {c}').format(c=ShellQuoted( (raw_shell(c) if isinstance(c, ShellQuoted) else c) .replace('\n', '\n# ') ))
['def', 'shell_comment', '(', 'c', ')', ':', 'return', 'ShellQuoted', '(', "'# {c}'", ')', '.', 'format', '(', 'c', '=', 'ShellQuoted', '(', '(', 'raw_shell', '(', 'c', ')', 'if', 'isinstance', '(', 'c', ',', 'ShellQuoted', ')', 'else', 'c', ')', '.', 'replace', '(', "'\\n'", ',', "'\\n# '", ')', ')', ')']
Do not shell-escape raw strings in comments, but do handle line breaks.
['Do', 'not', 'shell', '-', 'escape', 'raw', 'strings', 'in', 'comments', 'but', 'do', 'handle', 'line', 'breaks', '.']
train
https://github.com/facebook/watchman/blob/d416c249dd8f463dc69fc2691d0f890598c045a9/build/fbcode_builder/shell_quoting.py#L94-L99
6,861
orbingol/NURBS-Python
geomdl/compatibility.py
flip_ctrlpts2d_file
def flip_ctrlpts2d_file(file_in='', file_out='ctrlpts_flip.txt'): """ Flips u and v directions of a 2D control points file and saves flipped coordinates to a file. :param file_in: name of the input file (to be read) :type file_in: str :param file_out: name of the output file (to be saved) :type fil...
python
def flip_ctrlpts2d_file(file_in='', file_out='ctrlpts_flip.txt'): """ Flips u and v directions of a 2D control points file and saves flipped coordinates to a file. :param file_in: name of the input file (to be read) :type file_in: str :param file_out: name of the output file (to be saved) :type fil...
['def', 'flip_ctrlpts2d_file', '(', 'file_in', '=', "''", ',', 'file_out', '=', "'ctrlpts_flip.txt'", ')', ':', '# Read control points', 'ctrlpts2d', ',', 'size_u', ',', 'size_v', '=', '_read_ctrltps2d_file', '(', 'file_in', ')', '# Flip control points array', 'new_ctrlpts2d', '=', 'flip_ctrlpts2d', '(', 'ctrlpts2d', '...
Flips u and v directions of a 2D control points file and saves flipped coordinates to a file. :param file_in: name of the input file (to be read) :type file_in: str :param file_out: name of the output file (to be saved) :type file_out: str :raises IOError: an error occurred reading or writing the f...
['Flips', 'u', 'and', 'v', 'directions', 'of', 'a', '2D', 'control', 'points', 'file', 'and', 'saves', 'flipped', 'coordinates', 'to', 'a', 'file', '.']
train
https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/compatibility.py#L238-L254
6,862
nicolargo/glances
glances/processes.py
GlancesProcesses.pid_max
def pid_max(self): """ Get the maximum PID value. On Linux, the value is read from the `/proc/sys/kernel/pid_max` file. From `man 5 proc`: The default value for this file, 32768, results in the same range of PIDs as on earlier kernels. On 32-bit platfroms, 32768 is the ...
python
def pid_max(self): """ Get the maximum PID value. On Linux, the value is read from the `/proc/sys/kernel/pid_max` file. From `man 5 proc`: The default value for this file, 32768, results in the same range of PIDs as on earlier kernels. On 32-bit platfroms, 32768 is the ...
['def', 'pid_max', '(', 'self', ')', ':', 'if', 'LINUX', ':', '# XXX: waiting for https://github.com/giampaolo/psutil/issues/720', 'try', ':', 'with', 'open', '(', "'/proc/sys/kernel/pid_max'", ',', "'rb'", ')', 'as', 'f', ':', 'return', 'int', '(', 'f', '.', 'read', '(', ')', ')', 'except', '(', 'OSError', ',', 'IOErr...
Get the maximum PID value. On Linux, the value is read from the `/proc/sys/kernel/pid_max` file. From `man 5 proc`: The default value for this file, 32768, results in the same range of PIDs as on earlier kernels. On 32-bit platfroms, 32768 is the maximum value for pid_max. On 6...
['Get', 'the', 'maximum', 'PID', 'value', '.']
train
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/processes.py#L123-L153
6,863
trevisanj/a99
a99/gui/a_WBase.py
WBase.add_log_error
def add_log_error(self, x, flag_also_show=False, E=None): """Delegates to parent form""" self.parent_form.add_log_error(x, flag_also_show, E)
python
def add_log_error(self, x, flag_also_show=False, E=None): """Delegates to parent form""" self.parent_form.add_log_error(x, flag_also_show, E)
['def', 'add_log_error', '(', 'self', ',', 'x', ',', 'flag_also_show', '=', 'False', ',', 'E', '=', 'None', ')', ':', 'self', '.', 'parent_form', '.', 'add_log_error', '(', 'x', ',', 'flag_also_show', ',', 'E', ')']
Delegates to parent form
['Delegates', 'to', 'parent', 'form']
train
https://github.com/trevisanj/a99/blob/193e6e3c9b3e4f4a0ba7eb3eece846fe7045c539/a99/gui/a_WBase.py#L38-L40
6,864
Esri/ArcREST
src/arcresthelper/featureservicetools.py
featureservicetools.RemoveAndAddFeatures
def RemoveAndAddFeatures(self, url, pathToFeatureClass, id_field, chunksize=1000): """Deletes all features in a feature service and uploads features from a feature class on disk. Args: url (str): The URL of the feature service. pathToFeatureClass (str): The path of the feature c...
python
def RemoveAndAddFeatures(self, url, pathToFeatureClass, id_field, chunksize=1000): """Deletes all features in a feature service and uploads features from a feature class on disk. Args: url (str): The URL of the feature service. pathToFeatureClass (str): The path of the feature c...
['def', 'RemoveAndAddFeatures', '(', 'self', ',', 'url', ',', 'pathToFeatureClass', ',', 'id_field', ',', 'chunksize', '=', '1000', ')', ':', 'fl', '=', 'None', 'try', ':', 'if', 'arcpyFound', '==', 'False', ':', 'raise', 'common', '.', 'ArcRestHelperError', '(', '{', '"function"', ':', '"RemoveAndAddFeatures"', ',', '...
Deletes all features in a feature service and uploads features from a feature class on disk. Args: url (str): The URL of the feature service. pathToFeatureClass (str): The path of the feature class on disk. id_field (str): The name of the field in the feature class to use fo...
['Deletes', 'all', 'features', 'in', 'a', 'feature', 'service', 'and', 'uploads', 'features', 'from', 'a', 'feature', 'class', 'on', 'disk', '.']
train
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcresthelper/featureservicetools.py#L60-L195
6,865
stephenmcd/django-forms-builder
forms_builder/forms/admin.py
FormAdmin.get_queryset
def get_queryset(self, request): """ Annotate the queryset with the entries count for use in the admin list view. """ qs = super(FormAdmin, self).get_queryset(request) return qs.annotate(total_entries=Count("entries"))
python
def get_queryset(self, request): """ Annotate the queryset with the entries count for use in the admin list view. """ qs = super(FormAdmin, self).get_queryset(request) return qs.annotate(total_entries=Count("entries"))
['def', 'get_queryset', '(', 'self', ',', 'request', ')', ':', 'qs', '=', 'super', '(', 'FormAdmin', ',', 'self', ')', '.', 'get_queryset', '(', 'request', ')', 'return', 'qs', '.', 'annotate', '(', 'total_entries', '=', 'Count', '(', '"entries"', ')', ')']
Annotate the queryset with the entries count for use in the admin list view.
['Annotate', 'the', 'queryset', 'with', 'the', 'entries', 'count', 'for', 'use', 'in', 'the', 'admin', 'list', 'view', '.']
train
https://github.com/stephenmcd/django-forms-builder/blob/89fe03100ec09a6166cc0bf0022399bbbdca6298/forms_builder/forms/admin.py#L77-L83
6,866
saltstack/salt
salt/modules/http.py
query
def query(url, **kwargs): ''' Query a resource, and decode the return data Passes through all the parameters described in the :py:func:`utils.http.query function <salt.utils.http.query>`: .. autofunction:: salt.utils.http.query CLI Example: .. code-block:: bash salt '*' http.que...
python
def query(url, **kwargs): ''' Query a resource, and decode the return data Passes through all the parameters described in the :py:func:`utils.http.query function <salt.utils.http.query>`: .. autofunction:: salt.utils.http.query CLI Example: .. code-block:: bash salt '*' http.que...
['def', 'query', '(', 'url', ',', '*', '*', 'kwargs', ')', ':', 'opts', '=', '__opts__', '.', 'copy', '(', ')', 'if', "'opts'", 'in', 'kwargs', ':', 'opts', '.', 'update', '(', 'kwargs', '[', "'opts'", ']', ')', 'del', 'kwargs', '[', "'opts'", ']', 'return', 'salt', '.', 'utils', '.', 'http', '.', 'query', '(', 'url', ...
Query a resource, and decode the return data Passes through all the parameters described in the :py:func:`utils.http.query function <salt.utils.http.query>`: .. autofunction:: salt.utils.http.query CLI Example: .. code-block:: bash salt '*' http.query http://somelink.com/ salt '...
['Query', 'a', 'resource', 'and', 'decode', 'the', 'return', 'data']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/http.py#L17-L44
6,867
nion-software/nionswift
nion/swift/DocumentController.py
DocumentController.__update_display_items_model
def __update_display_items_model(self, display_items_model: ListModel.FilteredListModel, data_group: typing.Optional[DataGroup.DataGroup], filter_id: typing.Optional[str]) -> None: """Update the data item model with a new container, filter, and sorting. This is called when the data item model is create...
python
def __update_display_items_model(self, display_items_model: ListModel.FilteredListModel, data_group: typing.Optional[DataGroup.DataGroup], filter_id: typing.Optional[str]) -> None: """Update the data item model with a new container, filter, and sorting. This is called when the data item model is create...
['def', '__update_display_items_model', '(', 'self', ',', 'display_items_model', ':', 'ListModel', '.', 'FilteredListModel', ',', 'data_group', ':', 'typing', '.', 'Optional', '[', 'DataGroup', '.', 'DataGroup', ']', ',', 'filter_id', ':', 'typing', '.', 'Optional', '[', 'str', ']', ')', '->', 'None', ':', 'with', 'dis...
Update the data item model with a new container, filter, and sorting. This is called when the data item model is created or when the user changes the data group or sorting settings.
['Update', 'the', 'data', 'item', 'model', 'with', 'a', 'new', 'container', 'filter', 'and', 'sorting', '.']
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/DocumentController.py#L658-L694
6,868
cbclab/MOT
mot/lib/cl_function.py
apply_cl_function
def apply_cl_function(cl_function, kernel_data, nmr_instances, use_local_reduction=False, cl_runtime_info=None): """Run the given function/procedure on the given set of data. This class will wrap the given CL function in a kernel call and execute that that for every data instance using the provided kernel ...
python
def apply_cl_function(cl_function, kernel_data, nmr_instances, use_local_reduction=False, cl_runtime_info=None): """Run the given function/procedure on the given set of data. This class will wrap the given CL function in a kernel call and execute that that for every data instance using the provided kernel ...
['def', 'apply_cl_function', '(', 'cl_function', ',', 'kernel_data', ',', 'nmr_instances', ',', 'use_local_reduction', '=', 'False', ',', 'cl_runtime_info', '=', 'None', ')', ':', 'cl_runtime_info', '=', 'cl_runtime_info', 'or', 'CLRuntimeInfo', '(', ')', 'cl_environments', '=', 'cl_runtime_info', '.', 'cl_environments...
Run the given function/procedure on the given set of data. This class will wrap the given CL function in a kernel call and execute that that for every data instance using the provided kernel data. This class will respect the read write setting of the kernel data elements such that output can be written bac...
['Run', 'the', 'given', 'function', '/', 'procedure', 'on', 'the', 'given', 'set', 'of', 'data', '.']
train
https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/lib/cl_function.py#L578-L633
6,869
limodou/uliweb
uliweb/lib/werkzeug/datastructures.py
WWWAuthenticate.set_basic
def set_basic(self, realm='authentication required'): """Clear the auth info and enable basic auth.""" dict.clear(self) dict.update(self, {'__auth_type__': 'basic', 'realm': realm}) if self.on_update: self.on_update(self)
python
def set_basic(self, realm='authentication required'): """Clear the auth info and enable basic auth.""" dict.clear(self) dict.update(self, {'__auth_type__': 'basic', 'realm': realm}) if self.on_update: self.on_update(self)
['def', 'set_basic', '(', 'self', ',', 'realm', '=', "'authentication required'", ')', ':', 'dict', '.', 'clear', '(', 'self', ')', 'dict', '.', 'update', '(', 'self', ',', '{', "'__auth_type__'", ':', "'basic'", ',', "'realm'", ':', 'realm', '}', ')', 'if', 'self', '.', 'on_update', ':', 'self', '.', 'on_update', '(',...
Clear the auth info and enable basic auth.
['Clear', 'the', 'auth', 'info', 'and', 'enable', 'basic', 'auth', '.']
train
https://github.com/limodou/uliweb/blob/34472f25e4bc0b954a35346672f94e84ef18b076/uliweb/lib/werkzeug/datastructures.py#L2359-L2364
6,870
andymccurdy/redis-py
redis/client.py
Redis.flushall
def flushall(self, asynchronous=False): """ Delete all keys in all databases on the current host. ``asynchronous`` indicates whether the operation is executed asynchronously by the server. """ args = [] if asynchronous: args.append(Token.get_token('AS...
python
def flushall(self, asynchronous=False): """ Delete all keys in all databases on the current host. ``asynchronous`` indicates whether the operation is executed asynchronously by the server. """ args = [] if asynchronous: args.append(Token.get_token('AS...
['def', 'flushall', '(', 'self', ',', 'asynchronous', '=', 'False', ')', ':', 'args', '=', '[', ']', 'if', 'asynchronous', ':', 'args', '.', 'append', '(', 'Token', '.', 'get_token', '(', "'ASYNC'", ')', ')', 'return', 'self', '.', 'execute_command', '(', "'FLUSHALL'", ',', '*', 'args', ')']
Delete all keys in all databases on the current host. ``asynchronous`` indicates whether the operation is executed asynchronously by the server.
['Delete', 'all', 'keys', 'in', 'all', 'databases', 'on', 'the', 'current', 'host', '.']
train
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L930-L940
6,871
NicolasLM/spinach
spinach/brokers/redis.py
RedisBroker.inspect_periodic_tasks
def inspect_periodic_tasks(self) -> List[Tuple[int, str]]: """Get the next periodic task schedule. Used only for debugging and during tests. """ rv = self._r.zrangebyscore( self._to_namespaced(PERIODIC_TASKS_QUEUE_KEY), '-inf', '+inf', withscores=True ) ...
python
def inspect_periodic_tasks(self) -> List[Tuple[int, str]]: """Get the next periodic task schedule. Used only for debugging and during tests. """ rv = self._r.zrangebyscore( self._to_namespaced(PERIODIC_TASKS_QUEUE_KEY), '-inf', '+inf', withscores=True ) ...
['def', 'inspect_periodic_tasks', '(', 'self', ')', '->', 'List', '[', 'Tuple', '[', 'int', ',', 'str', ']', ']', ':', 'rv', '=', 'self', '.', '_r', '.', 'zrangebyscore', '(', 'self', '.', '_to_namespaced', '(', 'PERIODIC_TASKS_QUEUE_KEY', ')', ',', "'-inf'", ',', "'+inf'", ',', 'withscores', '=', 'True', ')', 'return'...
Get the next periodic task schedule. Used only for debugging and during tests.
['Get', 'the', 'next', 'periodic', 'task', 'schedule', '.']
train
https://github.com/NicolasLM/spinach/blob/0122f916643101eab5cdc1f3da662b9446e372aa/spinach/brokers/redis.py#L215-L224
6,872
ozak/georasters
georasters/georasters.py
GeoRaster.raster_weights
def raster_weights(self, **kwargs): """ Compute neighbor weights for GeoRaster. See help(gr.raster_weights) for options Usage: geo.raster_weights(rook=True) """ if self.weights is None: self.weights = raster_weights(self.raster, **kwargs) pass
python
def raster_weights(self, **kwargs): """ Compute neighbor weights for GeoRaster. See help(gr.raster_weights) for options Usage: geo.raster_weights(rook=True) """ if self.weights is None: self.weights = raster_weights(self.raster, **kwargs) pass
['def', 'raster_weights', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'if', 'self', '.', 'weights', 'is', 'None', ':', 'self', '.', 'weights', '=', 'raster_weights', '(', 'self', '.', 'raster', ',', '*', '*', 'kwargs', ')', 'pass']
Compute neighbor weights for GeoRaster. See help(gr.raster_weights) for options Usage: geo.raster_weights(rook=True)
['Compute', 'neighbor', 'weights', 'for', 'GeoRaster', '.', 'See', 'help', '(', 'gr', '.', 'raster_weights', ')', 'for', 'options']
train
https://github.com/ozak/georasters/blob/0612bd91bb2a2cb2f1d59ba89c1ff131dae27d70/georasters/georasters.py#L944-L954
6,873
nteract/papermill
papermill/s3.py
S3.cp_string
def cp_string(self, source, dest, **kwargs): """ Copies source string into the destination location. Parameters ---------- source: string the string with the content to copy dest: string the s3 location """ assert isinstance(sourc...
python
def cp_string(self, source, dest, **kwargs): """ Copies source string into the destination location. Parameters ---------- source: string the string with the content to copy dest: string the s3 location """ assert isinstance(sourc...
['def', 'cp_string', '(', 'self', ',', 'source', ',', 'dest', ',', '*', '*', 'kwargs', ')', ':', 'assert', 'isinstance', '(', 'source', ',', 'six', '.', 'string_types', ')', ',', '"source must be a string"', 'assert', 'self', '.', '_is_s3', '(', 'dest', ')', ',', '"Destination must be s3 location"', 'return', 'self', '...
Copies source string into the destination location. Parameters ---------- source: string the string with the content to copy dest: string the s3 location
['Copies', 'source', 'string', 'into', 'the', 'destination', 'location', '.']
train
https://github.com/nteract/papermill/blob/7423a303f3fa22ec6d03edf5fd9700d659b5a6fa/papermill/s3.py#L355-L370
6,874
Rapptz/discord.py
discord/shard.py
AutoShardedClient.latency
def latency(self): """:class:`float`: Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds. This operates similarly to :meth:`.Client.latency` except it uses the average latency of every shard's latency. To get a list of shard latency, check the :attr:`latencies` property...
python
def latency(self): """:class:`float`: Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds. This operates similarly to :meth:`.Client.latency` except it uses the average latency of every shard's latency. To get a list of shard latency, check the :attr:`latencies` property...
['def', 'latency', '(', 'self', ')', ':', 'if', 'not', 'self', '.', 'shards', ':', 'return', 'float', '(', "'nan'", ')', 'return', 'sum', '(', 'latency', 'for', '_', ',', 'latency', 'in', 'self', '.', 'latencies', ')', '/', 'len', '(', 'self', '.', 'shards', ')']
:class:`float`: Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds. This operates similarly to :meth:`.Client.latency` except it uses the average latency of every shard's latency. To get a list of shard latency, check the :attr:`latencies` property. Returns ``nan`` if there are...
[':', 'class', ':', 'float', ':', 'Measures', 'latency', 'between', 'a', 'HEARTBEAT', 'and', 'a', 'HEARTBEAT_ACK', 'in', 'seconds', '.']
train
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/shard.py#L163-L172
6,875
vmware/pyvmomi
pyVim/connect.py
VimSessionOrientedStub.makeCredBearerTokenLoginMethod
def makeCredBearerTokenLoginMethod(username, password, stsUrl, stsCert=None): '''Return a function that will call the vim.SessionManager.LoginByToken() after obtaining a Bearer token from the ST...
python
def makeCredBearerTokenLoginMethod(username, password, stsUrl, stsCert=None): '''Return a function that will call the vim.SessionManager.LoginByToken() after obtaining a Bearer token from the ST...
['def', 'makeCredBearerTokenLoginMethod', '(', 'username', ',', 'password', ',', 'stsUrl', ',', 'stsCert', '=', 'None', ')', ':', 'assert', '(', 'username', ')', 'assert', '(', 'password', ')', 'assert', '(', 'stsUrl', ')', 'def', '_doLogin', '(', 'soapStub', ')', ':', 'from', '.', 'import', 'sso', 'cert', '=', 'soapSt...
Return a function that will call the vim.SessionManager.LoginByToken() after obtaining a Bearer token from the STS. The result of this function can be passed as the "loginMethod" to a SessionOrientedStub constructor. @param username: username of the user/service registered with STS. @param pass...
['Return', 'a', 'function', 'that', 'will', 'call', 'the', 'vim', '.', 'SessionManager', '.', 'LoginByToken', '()', 'after', 'obtaining', 'a', 'Bearer', 'token', 'from', 'the', 'STS', '.', 'The', 'result', 'of', 'this', 'function', 'can', 'be', 'passed', 'as', 'the', 'loginMethod', 'to', 'a', 'SessionOrientedStub', 'co...
train
https://github.com/vmware/pyvmomi/blob/3ffcb23bf77d757175c0d5216ba9a25345d824cd/pyVim/connect.py#L154-L190
6,876
ejhigson/nestcheck
setup.py
get_version
def get_version(): """Get single-source __version__.""" pkg_dir = get_package_dir() with open(os.path.join(pkg_dir, 'nestcheck/_version.py')) as ver_file: string = ver_file.read() return string.strip().replace('__version__ = ', '').replace('\'', '')
python
def get_version(): """Get single-source __version__.""" pkg_dir = get_package_dir() with open(os.path.join(pkg_dir, 'nestcheck/_version.py')) as ver_file: string = ver_file.read() return string.strip().replace('__version__ = ', '').replace('\'', '')
['def', 'get_version', '(', ')', ':', 'pkg_dir', '=', 'get_package_dir', '(', ')', 'with', 'open', '(', 'os', '.', 'path', '.', 'join', '(', 'pkg_dir', ',', "'nestcheck/_version.py'", ')', ')', 'as', 'ver_file', ':', 'string', '=', 'ver_file', '.', 'read', '(', ')', 'return', 'string', '.', 'strip', '(', ')', '.', 'rep...
Get single-source __version__.
['Get', 'single', '-', 'source', '__version__', '.']
train
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/setup.py#L24-L29
6,877
saltstack/salt
salt/modules/file.py
get_diff
def get_diff(file1, file2, saltenv='base', show_filenames=True, show_changes=True, template=False, source_hash_file1=None, source_hash_file2=None): ''' Return unified diff of two files file1 The first file to...
python
def get_diff(file1, file2, saltenv='base', show_filenames=True, show_changes=True, template=False, source_hash_file1=None, source_hash_file2=None): ''' Return unified diff of two files file1 The first file to...
['def', 'get_diff', '(', 'file1', ',', 'file2', ',', 'saltenv', '=', "'base'", ',', 'show_filenames', '=', 'True', ',', 'show_changes', '=', 'True', ',', 'template', '=', 'False', ',', 'source_hash_file1', '=', 'None', ',', 'source_hash_file2', '=', 'None', ')', ':', 'files', '=', '(', 'file1', ',', 'file2', ')', 'sour...
Return unified diff of two files file1 The first file to feed into the diff utility .. versionchanged:: 2018.3.0 Can now be either a local or remote file. In earlier releases, thuis had to be a file local to the minion. file2 The second file to feed into the di...
['Return', 'unified', 'diff', 'of', 'two', 'files']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L5205-L5327
6,878
twilio/twilio-python
twilio/rest/serverless/v1/service/function/function_version.py
FunctionVersionList.create
def create(self, path, visibility): """ Create a new FunctionVersionInstance :param unicode path: The path :param FunctionVersionInstance.Visibility visibility: The visibility :returns: Newly created FunctionVersionInstance :rtype: twilio.rest.serverless.v1.service.func...
python
def create(self, path, visibility): """ Create a new FunctionVersionInstance :param unicode path: The path :param FunctionVersionInstance.Visibility visibility: The visibility :returns: Newly created FunctionVersionInstance :rtype: twilio.rest.serverless.v1.service.func...
['def', 'create', '(', 'self', ',', 'path', ',', 'visibility', ')', ':', 'data', '=', 'values', '.', 'of', '(', '{', "'Path'", ':', 'path', ',', "'Visibility'", ':', 'visibility', ',', '}', ')', 'payload', '=', 'self', '.', '_version', '.', 'create', '(', "'POST'", ',', 'self', '.', '_uri', ',', 'data', '=', 'data', ',...
Create a new FunctionVersionInstance :param unicode path: The path :param FunctionVersionInstance.Visibility visibility: The visibility :returns: Newly created FunctionVersionInstance :rtype: twilio.rest.serverless.v1.service.function.function_version.FunctionVersionInstance
['Create', 'a', 'new', 'FunctionVersionInstance']
train
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/serverless/v1/service/function/function_version.py#L120-L143
6,879
pymc-devs/pymc
pymc/database/base.py
Trace._initialize
def _initialize(self, chain, length): """Prepare for tallying. Create a new chain.""" # If this db was loaded from the disk, it may not have its # tallied step methods' getfuncs yet. if self._getfunc is None: self._getfunc = self.db.model._funs_to_tally[self.name]
python
def _initialize(self, chain, length): """Prepare for tallying. Create a new chain.""" # If this db was loaded from the disk, it may not have its # tallied step methods' getfuncs yet. if self._getfunc is None: self._getfunc = self.db.model._funs_to_tally[self.name]
['def', '_initialize', '(', 'self', ',', 'chain', ',', 'length', ')', ':', '# If this db was loaded from the disk, it may not have its', "# tallied step methods' getfuncs yet.", 'if', 'self', '.', '_getfunc', 'is', 'None', ':', 'self', '.', '_getfunc', '=', 'self', '.', 'db', '.', 'model', '.', '_funs_to_tally', '[', '...
Prepare for tallying. Create a new chain.
['Prepare', 'for', 'tallying', '.', 'Create', 'a', 'new', 'chain', '.']
train
https://github.com/pymc-devs/pymc/blob/c6e530210bff4c0d7189b35b2c971bc53f93f7cd/pymc/database/base.py#L88-L93
6,880
allenai/allennlp
allennlp/data/dataset_readers/reading_comprehension/util.py
make_reading_comprehension_instance_quac
def make_reading_comprehension_instance_quac(question_list_tokens: List[List[Token]], passage_tokens: List[Token], token_indexers: Dict[str, TokenIndexer], passage_text: str, ...
python
def make_reading_comprehension_instance_quac(question_list_tokens: List[List[Token]], passage_tokens: List[Token], token_indexers: Dict[str, TokenIndexer], passage_text: str, ...
['def', 'make_reading_comprehension_instance_quac', '(', 'question_list_tokens', ':', 'List', '[', 'List', '[', 'Token', ']', ']', ',', 'passage_tokens', ':', 'List', '[', 'Token', ']', ',', 'token_indexers', ':', 'Dict', '[', 'str', ',', 'TokenIndexer', ']', ',', 'passage_text', ':', 'str', ',', 'token_span_lists', ':...
Converts a question, a passage, and an optional answer (or answers) to an ``Instance`` for use in a reading comprehension model. Creates an ``Instance`` with at least these fields: ``question`` and ``passage``, both ``TextFields``; and ``metadata``, a ``MetadataField``. Additionally, if both ``answer_text...
['Converts', 'a', 'question', 'a', 'passage', 'and', 'an', 'optional', 'answer', '(', 'or', 'answers', ')', 'to', 'an', 'Instance', 'for', 'use', 'in', 'a', 'reading', 'comprehension', 'model', '.']
train
https://github.com/allenai/allennlp/blob/648a36f77db7e45784c047176074f98534c76636/allennlp/data/dataset_readers/reading_comprehension/util.py#L217-L351
6,881
numberoverzero/bloop
bloop/conditions.py
printable_name
def printable_name(column, path=None): """Provided for debug output when rendering conditions. User.name[3]["foo"][0]["bar"] -> name[3].foo[0].bar """ pieces = [column.name] path = path or path_of(column) for segment in path: if isinstance(segment, str): pieces.append(segmen...
python
def printable_name(column, path=None): """Provided for debug output when rendering conditions. User.name[3]["foo"][0]["bar"] -> name[3].foo[0].bar """ pieces = [column.name] path = path or path_of(column) for segment in path: if isinstance(segment, str): pieces.append(segmen...
['def', 'printable_name', '(', 'column', ',', 'path', '=', 'None', ')', ':', 'pieces', '=', '[', 'column', '.', 'name', ']', 'path', '=', 'path', 'or', 'path_of', '(', 'column', ')', 'for', 'segment', 'in', 'path', ':', 'if', 'isinstance', '(', 'segment', ',', 'str', ')', ':', 'pieces', '.', 'append', '(', 'segment', '...
Provided for debug output when rendering conditions. User.name[3]["foo"][0]["bar"] -> name[3].foo[0].bar
['Provided', 'for', 'debug', 'output', 'when', 'rendering', 'conditions', '.']
train
https://github.com/numberoverzero/bloop/blob/4c95f5a0ff0802443a1c258bfaccecd1758363e7/bloop/conditions.py#L887-L899
6,882
google/openhtf
openhtf/plugs/usb/shell_service.py
AsyncCommandHandle.wait
def wait(self, timeout_ms=None): """Block until this command has completed. Args: timeout_ms: Timeout, in milliseconds, to wait. Returns: Output of the command if it complete and self.stdout is a StringIO object or was passed in as None. Returns True if the command completed but stdou...
python
def wait(self, timeout_ms=None): """Block until this command has completed. Args: timeout_ms: Timeout, in milliseconds, to wait. Returns: Output of the command if it complete and self.stdout is a StringIO object or was passed in as None. Returns True if the command completed but stdou...
['def', 'wait', '(', 'self', ',', 'timeout_ms', '=', 'None', ')', ':', 'closed', '=', 'timeouts', '.', 'loop_until_timeout_or_true', '(', 'timeouts', '.', 'PolledTimeout', '.', 'from_millis', '(', 'timeout_ms', ')', ',', 'self', '.', 'stream', '.', 'is_closed', ',', '.1', ')', 'if', 'closed', ':', 'if', 'hasattr', '(',...
Block until this command has completed. Args: timeout_ms: Timeout, in milliseconds, to wait. Returns: Output of the command if it complete and self.stdout is a StringIO object or was passed in as None. Returns True if the command completed but stdout was provided (and was not a StringIO o...
['Block', 'until', 'this', 'command', 'has', 'completed', '.']
train
https://github.com/google/openhtf/blob/655e85df7134db7bdf8f8fdd6ff9a6bf932e7b09/openhtf/plugs/usb/shell_service.py#L169-L189
6,883
mfcloud/python-zvm-sdk
smtLayer/makeVM.py
createVM
def createVM(rh): """ Create a virtual machine in z/VM. 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 ...
python
def createVM(rh): """ Create a virtual machine in z/VM. 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 ...
['def', 'createVM', '(', 'rh', ')', ':', 'rh', '.', 'printSysLog', '(', '"Enter makeVM.createVM"', ')', 'dirLines', '=', '[', ']', 'dirLines', '.', 'append', '(', '"USER "', '+', 'rh', '.', 'userid', '+', '" "', '+', 'rh', '.', 'parms', '[', "'pw'", ']', '+', '" "', '+', 'rh', '.', 'parms', '[', "'priMemSize'", ']', '+...
Create a virtual machine in z/VM. 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: error
['Create', 'a', 'virtual', 'machine', 'in', 'z', '/', 'VM', '.']
train
https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/makeVM.py#L79-L154
6,884
log2timeline/plaso
plaso/parsers/pls_recall.py
PlsRecallParser.ParseFileObject
def ParseFileObject(self, parser_mediator, file_object): """Parses a PLSRecall.dat file-like object. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. file_object (dfvfs.FileIO): a file-like object. Raises: ...
python
def ParseFileObject(self, parser_mediator, file_object): """Parses a PLSRecall.dat file-like object. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. file_object (dfvfs.FileIO): a file-like object. Raises: ...
['def', 'ParseFileObject', '(', 'self', ',', 'parser_mediator', ',', 'file_object', ')', ':', 'file_offset', '=', '0', 'file_size', '=', 'file_object', '.', 'get_size', '(', ')', 'record_map', '=', 'self', '.', '_GetDataTypeMap', '(', "'pls_recall_record'", ')', 'while', 'file_offset', '<', 'file_size', ':', 'try', ':'...
Parses a PLSRecall.dat file-like object. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. file_object (dfvfs.FileIO): a file-like object. Raises: UnableToParseFile: when the file cannot be parsed.
['Parses', 'a', 'PLSRecall', '.', 'dat', 'file', '-', 'like', 'object', '.']
train
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/parsers/pls_recall.py#L98-L142
6,885
ioos/cc-plugin-ncei
cc_plugin_ncei/ncei_trajectory.py
NCEITrajectoryBase.check_trajectory_id
def check_trajectory_id(self, dataset): ''' Checks that if a variable exists for the trajectory id it has the appropriate attributes :param netCDF4.Dataset dataset: An open netCDF dataset ''' results = [] exists_ctx = TestCtx(BaseCheck.MEDIUM, 'Variable defining "traject...
python
def check_trajectory_id(self, dataset): ''' Checks that if a variable exists for the trajectory id it has the appropriate attributes :param netCDF4.Dataset dataset: An open netCDF dataset ''' results = [] exists_ctx = TestCtx(BaseCheck.MEDIUM, 'Variable defining "traject...
['def', 'check_trajectory_id', '(', 'self', ',', 'dataset', ')', ':', 'results', '=', '[', ']', 'exists_ctx', '=', 'TestCtx', '(', 'BaseCheck', '.', 'MEDIUM', ',', '\'Variable defining "trajectory_id" exists\'', ')', 'trajectory_ids', '=', 'dataset', '.', 'get_variables_by_attributes', '(', 'cf_role', '=', "'trajectory...
Checks that if a variable exists for the trajectory id it has the appropriate attributes :param netCDF4.Dataset dataset: An open netCDF dataset
['Checks', 'that', 'if', 'a', 'variable', 'exists', 'for', 'the', 'trajectory', 'id', 'it', 'has', 'the', 'appropriate', 'attributes']
train
https://github.com/ioos/cc-plugin-ncei/blob/963fefd7fa43afd32657ac4c36aad4ddb4c25acf/cc_plugin_ncei/ncei_trajectory.py#L41-L61
6,886
SetBased/py-stratum
pystratum/MetadataDataLayer.py
MetadataDataLayer._log_query
def _log_query(query): """ Logs the query on the console. :param str query: The query. """ query = query.strip() if os.linesep in query: # Query is a multi line query MetadataDataLayer.io.log_very_verbose('Executing query:') MetadataD...
python
def _log_query(query): """ Logs the query on the console. :param str query: The query. """ query = query.strip() if os.linesep in query: # Query is a multi line query MetadataDataLayer.io.log_very_verbose('Executing query:') MetadataD...
['def', '_log_query', '(', 'query', ')', ':', 'query', '=', 'query', '.', 'strip', '(', ')', 'if', 'os', '.', 'linesep', 'in', 'query', ':', '# Query is a multi line query', 'MetadataDataLayer', '.', 'io', '.', 'log_very_verbose', '(', "'Executing query:'", ')', 'MetadataDataLayer', '.', 'io', '.', 'log_very_verbose', ...
Logs the query on the console. :param str query: The query.
['Logs', 'the', 'query', 'on', 'the', 'console', '.']
train
https://github.com/SetBased/py-stratum/blob/7c5ffaa2fdd03f865832a5190b5897ff2c0e3155/pystratum/MetadataDataLayer.py#L20-L34
6,887
lucasmaystre/choix
choix/utils.py
log_likelihood_top1
def log_likelihood_top1(data, params): """Compute the log-likelihood of model parameters.""" loglik = 0 params = np.asarray(params) for winner, losers in data: idx = np.append(winner, losers) loglik -= logsumexp(params.take(idx) - params[winner]) return loglik
python
def log_likelihood_top1(data, params): """Compute the log-likelihood of model parameters.""" loglik = 0 params = np.asarray(params) for winner, losers in data: idx = np.append(winner, losers) loglik -= logsumexp(params.take(idx) - params[winner]) return loglik
['def', 'log_likelihood_top1', '(', 'data', ',', 'params', ')', ':', 'loglik', '=', '0', 'params', '=', 'np', '.', 'asarray', '(', 'params', ')', 'for', 'winner', ',', 'losers', 'in', 'data', ':', 'idx', '=', 'np', '.', 'append', '(', 'winner', ',', 'losers', ')', 'loglik', '-=', 'logsumexp', '(', 'params', '.', 'take'...
Compute the log-likelihood of model parameters.
['Compute', 'the', 'log', '-', 'likelihood', 'of', 'model', 'parameters', '.']
train
https://github.com/lucasmaystre/choix/blob/05a57a10bb707338113a9d91601ca528ead7a881/choix/utils.py#L186-L193
6,888
dropbox/stone
stone/backends/python_rsrc/stone_serializers.py
json_decode
def json_decode(data_type, serialized_obj, caller_permissions=None, alias_validators=None, strict=True, old_style=False): """Performs the reverse operation of json_encode. Args: data_type (Validator): Validator for serialized_obj. serialized_obj (str): The JSON string to deseria...
python
def json_decode(data_type, serialized_obj, caller_permissions=None, alias_validators=None, strict=True, old_style=False): """Performs the reverse operation of json_encode. Args: data_type (Validator): Validator for serialized_obj. serialized_obj (str): The JSON string to deseria...
['def', 'json_decode', '(', 'data_type', ',', 'serialized_obj', ',', 'caller_permissions', '=', 'None', ',', 'alias_validators', '=', 'None', ',', 'strict', '=', 'True', ',', 'old_style', '=', 'False', ')', ':', 'try', ':', 'deserialized_obj', '=', 'json', '.', 'loads', '(', 'serialized_obj', ')', 'except', 'ValueError...
Performs the reverse operation of json_encode. Args: data_type (Validator): Validator for serialized_obj. serialized_obj (str): The JSON string to deserialize. caller_permissions (list): The list of raw-string caller permissions with which to serialize. alias_validators ...
['Performs', 'the', 'reverse', 'operation', 'of', 'json_encode', '.']
train
https://github.com/dropbox/stone/blob/2e95cbcd1c48e05cca68c919fd8d24adec6b0f58/stone/backends/python_rsrc/stone_serializers.py#L911-L951
6,889
scoutapp/scout_apm_python
src/scout_apm/core/remote_ip.py
RemoteIp.lookup_from_headers
def lookup_from_headers(cls, headers): """ Given a dictionary of headers (WSGI request.META for instance), look up the most likely user's IP """ # A single address, set by this server, returned as an Array remote_addr = cls.ips_from(headers.get("REMOTE_ADDR")) #...
python
def lookup_from_headers(cls, headers): """ Given a dictionary of headers (WSGI request.META for instance), look up the most likely user's IP """ # A single address, set by this server, returned as an Array remote_addr = cls.ips_from(headers.get("REMOTE_ADDR")) #...
['def', 'lookup_from_headers', '(', 'cls', ',', 'headers', ')', ':', '# A single address, set by this server, returned as an Array', 'remote_addr', '=', 'cls', '.', 'ips_from', '(', 'headers', '.', 'get', '(', '"REMOTE_ADDR"', ')', ')', '# Could be a CSV list and/or repeated headers that were concatenated.', 'forwarded...
Given a dictionary of headers (WSGI request.META for instance), look up the most likely user's IP
['Given', 'a', 'dictionary', 'of', 'headers', '(', 'WSGI', 'request', '.', 'META', 'for', 'instance', ')', 'look', 'up', 'the', 'most', 'likely', 'user', 's', 'IP']
train
https://github.com/scoutapp/scout_apm_python/blob/e5539ee23b8129be9b75d5007c88b6158b51294f/src/scout_apm/core/remote_ip.py#L16-L43
6,890
pyGrowler/Growler
growler/aio/http_protocol.py
GrowlerHTTPProtocol.body_storage_pair
def body_storage_pair(self): """ Return reader/writer pair for storing receiving body data. These are event-loop specific objects. The reader should be an awaitable object that returns the body data once created. """ future = Future() def send_body(): ...
python
def body_storage_pair(self): """ Return reader/writer pair for storing receiving body data. These are event-loop specific objects. The reader should be an awaitable object that returns the body data once created. """ future = Future() def send_body(): ...
['def', 'body_storage_pair', '(', 'self', ')', ':', 'future', '=', 'Future', '(', ')', 'def', 'send_body', '(', ')', ':', 'nonlocal', 'future', 'data', '=', 'yield', 'future', '.', 'set_result', '(', 'data', ')', 'yield', 'sender', '=', 'send_body', '(', ')', 'next', '(', 'sender', ')', 'return', 'future', ',', 'sender...
Return reader/writer pair for storing receiving body data. These are event-loop specific objects. The reader should be an awaitable object that returns the body data once created.
['Return', 'reader', '/', 'writer', 'pair', 'for', 'storing', 'receiving', 'body', 'data', '.', 'These', 'are', 'event', '-', 'loop', 'specific', 'objects', '.']
train
https://github.com/pyGrowler/Growler/blob/90c923ff204f28b86a01d741224987a22f69540f/growler/aio/http_protocol.py#L147-L165
6,891
CalebBell/ht
ht/condensation.py
Shah
def Shah(m, x, D, rhol, mul, kl, Cpl, P, Pc): r'''Calculates heat transfer coefficient for condensation of a fluid inside a tube, as presented in [1]_ and again by the same author in [2]_; also given in [3]_. Requires no properties of the gas. Uses the Dittus-Boelter correlation for single phase heat t...
python
def Shah(m, x, D, rhol, mul, kl, Cpl, P, Pc): r'''Calculates heat transfer coefficient for condensation of a fluid inside a tube, as presented in [1]_ and again by the same author in [2]_; also given in [3]_. Requires no properties of the gas. Uses the Dittus-Boelter correlation for single phase heat t...
['def', 'Shah', '(', 'm', ',', 'x', ',', 'D', ',', 'rhol', ',', 'mul', ',', 'kl', ',', 'Cpl', ',', 'P', ',', 'Pc', ')', ':', 'VL', '=', 'm', '/', '(', 'rhol', '*', 'pi', '/', '4', '*', 'D', '**', '2', ')', 'ReL', '=', 'Reynolds', '(', 'V', '=', 'VL', ',', 'D', '=', 'D', ',', 'rho', '=', 'rhol', ',', 'mu', '=', 'mul', '...
r'''Calculates heat transfer coefficient for condensation of a fluid inside a tube, as presented in [1]_ and again by the same author in [2]_; also given in [3]_. Requires no properties of the gas. Uses the Dittus-Boelter correlation for single phase heat transfer coefficient, with a Reynolds number a...
['r', 'Calculates', 'heat', 'transfer', 'coefficient', 'for', 'condensation', 'of', 'a', 'fluid', 'inside', 'a', 'tube', 'as', 'presented', 'in', '[', '1', ']', '_', 'and', 'again', 'by', 'the', 'same', 'author', 'in', '[', '2', ']', '_', ';', 'also', 'given', 'in', '[', '3', ']', '_', '.', 'Requires', 'no', 'propertie...
train
https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/condensation.py#L362-L425
6,892
bcbio/bcbio-nextgen
bcbio/bam/callable.py
NBlockRegionPicker.expand_block
def expand_block(self, feat): """Expand any blocks which are near the start or end of a contig. """ chrom_end = self._ref_sizes.get(feat.chrom) if chrom_end: if feat.start < self._end_buffer: feat.start = 0 if feat.stop >= chrom_end - self._end_buf...
python
def expand_block(self, feat): """Expand any blocks which are near the start or end of a contig. """ chrom_end = self._ref_sizes.get(feat.chrom) if chrom_end: if feat.start < self._end_buffer: feat.start = 0 if feat.stop >= chrom_end - self._end_buf...
['def', 'expand_block', '(', 'self', ',', 'feat', ')', ':', 'chrom_end', '=', 'self', '.', '_ref_sizes', '.', 'get', '(', 'feat', '.', 'chrom', ')', 'if', 'chrom_end', ':', 'if', 'feat', '.', 'start', '<', 'self', '.', '_end_buffer', ':', 'feat', '.', 'start', '=', '0', 'if', 'feat', '.', 'stop', '>=', 'chrom_end', '-'...
Expand any blocks which are near the start or end of a contig.
['Expand', 'any', 'blocks', 'which', 'are', 'near', 'the', 'start', 'or', 'end', 'of', 'a', 'contig', '.']
train
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/bam/callable.py#L171-L180
6,893
jfilter/text-classification-keras
texcla/experiment.py
split_data
def split_data(X, y, ratio=(0.8, 0.1, 0.1)): """Splits data into a training, validation, and test set. Args: X: text data y: data labels ratio: the ratio for splitting. Default: (0.8, 0.1, 0.1) Returns: split data: X_train, X_val, X_test, y_train, y_...
python
def split_data(X, y, ratio=(0.8, 0.1, 0.1)): """Splits data into a training, validation, and test set. Args: X: text data y: data labels ratio: the ratio for splitting. Default: (0.8, 0.1, 0.1) Returns: split data: X_train, X_val, X_test, y_train, y_...
['def', 'split_data', '(', 'X', ',', 'y', ',', 'ratio', '=', '(', '0.8', ',', '0.1', ',', '0.1', ')', ')', ':', 'assert', '(', 'sum', '(', 'ratio', ')', '==', '1', 'and', 'len', '(', 'ratio', ')', '==', '3', ')', 'X_train', ',', 'X_rest', ',', 'y_train', ',', 'y_rest', '=', 'train_test_split', '(', 'X', ',', 'y', ',', ...
Splits data into a training, validation, and test set. Args: X: text data y: data labels ratio: the ratio for splitting. Default: (0.8, 0.1, 0.1) Returns: split data: X_train, X_val, X_test, y_train, y_val, y_test
['Splits', 'data', 'into', 'a', 'training', 'validation', 'and', 'test', 'set', '.']
train
https://github.com/jfilter/text-classification-keras/blob/a59c652805da41d18937c7fdad0d9fd943cf8578/texcla/experiment.py#L148-L164
6,894
manodeep/Corrfunc
setup.py
get_dict_from_buffer
def get_dict_from_buffer(buf, keys=['DISTNAME', 'MAJOR', 'MINOR', 'PATCHLEVEL', 'PYTHON', 'MIN_PYTHON_MAJOR', 'MIN_PYTHON_MINOR', 'MIN_NUMPY...
python
def get_dict_from_buffer(buf, keys=['DISTNAME', 'MAJOR', 'MINOR', 'PATCHLEVEL', 'PYTHON', 'MIN_PYTHON_MAJOR', 'MIN_PYTHON_MINOR', 'MIN_NUMPY...
['def', 'get_dict_from_buffer', '(', 'buf', ',', 'keys', '=', '[', "'DISTNAME'", ',', "'MAJOR'", ',', "'MINOR'", ',', "'PATCHLEVEL'", ',', "'PYTHON'", ',', "'MIN_PYTHON_MAJOR'", ',', "'MIN_PYTHON_MINOR'", ',', "'MIN_NUMPY_MAJOR'", ',', "'MIN_NUMPY_MINOR'", ']', ')', ':', 'pairs', '=', 'dict', '(', ')', 'if', 'keys', 'i...
Parses a string buffer for key-val pairs for the supplied keys. Returns: Python dictionary with all the keys (all keys in buffer if None is passed for keys) with the values being a list corresponding to each key. Note: Return dict will contain all keys supplied (if not None). ...
['Parses', 'a', 'string', 'buffer', 'for', 'key', '-', 'val', 'pairs', 'for', 'the', 'supplied', 'keys', '.']
train
https://github.com/manodeep/Corrfunc/blob/753aa50b93eebfefc76a0b0cd61522536bd45d2a/setup.py#L74-L144
6,895
etal/biofrills
biofrills/stats/chisq.py
_igamc
def _igamc(a, x): """Complemented incomplete Gamma integral. SYNOPSIS: double a, x, y, igamc(); y = igamc( a, x ); DESCRIPTION: The function is defined by:: igamc(a,x) = 1 - igam(a,x) inf. - ...
python
def _igamc(a, x): """Complemented incomplete Gamma integral. SYNOPSIS: double a, x, y, igamc(); y = igamc( a, x ); DESCRIPTION: The function is defined by:: igamc(a,x) = 1 - igam(a,x) inf. - ...
['def', '_igamc', '(', 'a', ',', 'x', ')', ':', '# Compute x**a * exp(-x) / Gamma(a)', 'ax', '=', 'math', '.', 'exp', '(', 'a', '*', 'math', '.', 'log', '(', 'x', ')', '-', 'x', '-', 'math', '.', 'lgamma', '(', 'a', ')', ')', '# Continued fraction', 'y', '=', '1.0', '-', 'a', 'z', '=', 'x', '+', 'y', '+', '1.0', 'c', ...
Complemented incomplete Gamma integral. SYNOPSIS: double a, x, y, igamc(); y = igamc( a, x ); DESCRIPTION: The function is defined by:: igamc(a,x) = 1 - igam(a,x) inf. - 1 | | -t a...
['Complemented', 'incomplete', 'Gamma', 'integral', '.']
train
https://github.com/etal/biofrills/blob/36684bb6c7632f96215e8b2b4ebc86640f331bcd/biofrills/stats/chisq.py#L47-L110
6,896
CalebBell/ht
ht/condensation.py
Boyko_Kruzhilin
def Boyko_Kruzhilin(m, rhog, rhol, kl, mul, Cpl, D, x): r'''Calculates heat transfer coefficient for condensation of a pure chemical inside a vertical tube or tube bundle, as presented in [2]_ according to [1]_. .. math:: h_f = h_{LO}\left[1 + x\left(\frac{\rho_L}{\rho_G} - 1\right)\right]^{0.5...
python
def Boyko_Kruzhilin(m, rhog, rhol, kl, mul, Cpl, D, x): r'''Calculates heat transfer coefficient for condensation of a pure chemical inside a vertical tube or tube bundle, as presented in [2]_ according to [1]_. .. math:: h_f = h_{LO}\left[1 + x\left(\frac{\rho_L}{\rho_G} - 1\right)\right]^{0.5...
['def', 'Boyko_Kruzhilin', '(', 'm', ',', 'rhog', ',', 'rhol', ',', 'kl', ',', 'mul', ',', 'Cpl', ',', 'D', ',', 'x', ')', ':', 'Vlo', '=', 'm', '/', 'rhol', '/', '(', 'pi', '/', '4.', '*', 'D', '**', '2', ')', 'Relo', '=', 'rhol', '*', 'Vlo', '*', 'D', '/', 'mul', 'Prl', '=', 'mul', '*', 'Cpl', '/', 'kl', 'hlo', '=', ...
r'''Calculates heat transfer coefficient for condensation of a pure chemical inside a vertical tube or tube bundle, as presented in [2]_ according to [1]_. .. math:: h_f = h_{LO}\left[1 + x\left(\frac{\rho_L}{\rho_G} - 1\right)\right]^{0.5} h_{LO} = 0.021 \frac{k_L}{L} Re_{LO}^{0.8} Pr^{0....
['r', 'Calculates', 'heat', 'transfer', 'coefficient', 'for', 'condensation', 'of', 'a', 'pure', 'chemical', 'inside', 'a', 'vertical', 'tube', 'or', 'tube', 'bundle', 'as', 'presented', 'in', '[', '2', ']', '_', 'according', 'to', '[', '1', ']', '_', '.']
train
https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/condensation.py#L93-L153
6,897
sibirrer/lenstronomy
lenstronomy/GalKin/light_profile.py
LightProfile.draw_light_2d_linear
def draw_light_2d_linear(self, kwargs_list, n=1, new_compute=False, r_eff=1.): """ constructs the CDF and draws from it random realizations of projected radii R :param kwargs_list: :return: """ if not hasattr(self, '_light_cdf') or new_compute is True: r_array...
python
def draw_light_2d_linear(self, kwargs_list, n=1, new_compute=False, r_eff=1.): """ constructs the CDF and draws from it random realizations of projected radii R :param kwargs_list: :return: """ if not hasattr(self, '_light_cdf') or new_compute is True: r_array...
['def', 'draw_light_2d_linear', '(', 'self', ',', 'kwargs_list', ',', 'n', '=', '1', ',', 'new_compute', '=', 'False', ',', 'r_eff', '=', '1.', ')', ':', 'if', 'not', 'hasattr', '(', 'self', ',', "'_light_cdf'", ')', 'or', 'new_compute', 'is', 'True', ':', 'r_array', '=', 'np', '.', 'linspace', '(', 'self', '.', '_min_...
constructs the CDF and draws from it random realizations of projected radii R :param kwargs_list: :return:
['constructs', 'the', 'CDF', 'and', 'draws', 'from', 'it', 'random', 'realizations', 'of', 'projected', 'radii', 'R', ':', 'param', 'kwargs_list', ':', ':', 'return', ':']
train
https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/GalKin/light_profile.py#L61-L82
6,898
mcieslik-mctp/papy
src/papy/core.py
Dagger.connect
def connect(self, datas=None): """ Connects ``Pipers`` in the order input -> output. See ``Piper.connect``. According to the pipes (topology). If "datas" is given will connect the input ``Pipers`` to the input data see: ``Dagger.connect_inputs``. Argumensts: ...
python
def connect(self, datas=None): """ Connects ``Pipers`` in the order input -> output. See ``Piper.connect``. According to the pipes (topology). If "datas" is given will connect the input ``Pipers`` to the input data see: ``Dagger.connect_inputs``. Argumensts: ...
['def', 'connect', '(', 'self', ',', 'datas', '=', 'None', ')', ':', '# if data connect inputs', 'if', 'datas', ':', 'self', '.', 'connect_inputs', '(', 'datas', ')', '# connect the remaining pipers', 'postorder', '=', 'self', '.', 'postorder', '(', ')', 'self', '.', 'log', '.', 'debug', '(', "'%s trying to connect in ...
Connects ``Pipers`` in the order input -> output. See ``Piper.connect``. According to the pipes (topology). If "datas" is given will connect the input ``Pipers`` to the input data see: ``Dagger.connect_inputs``. Argumensts: - datas(sequence) [default: ``None``] valid ...
['Connects', 'Pipers', 'in', 'the', 'order', 'input', '-', '>', 'output', '.', 'See', 'Piper', '.', 'connect', '.', 'According', 'to', 'the', 'pipes', '(', 'topology', ')', '.', 'If', 'datas', 'is', 'given', 'will', 'connect', 'the', 'input', 'Pipers', 'to', 'the', 'input', 'data', 'see', ':', 'Dagger', '.', 'connect_i...
train
https://github.com/mcieslik-mctp/papy/blob/708e50827b5db46bbea081982cb74b9b0e464064/src/papy/core.py#L158-L186
6,899
apple/turicreate
src/unity/python/turicreate/toolkits/recommender/util.py
_Recommender._get_data_schema
def _get_data_schema(self): """ Returns a dictionary of (column : type) for the data used in the model. """ if not hasattr(self, "_data_schema"): response = self.__proxy__.get_data_schema() self._data_schema = {k : _turicreate._cython.cy_flexible_type.py...
python
def _get_data_schema(self): """ Returns a dictionary of (column : type) for the data used in the model. """ if not hasattr(self, "_data_schema"): response = self.__proxy__.get_data_schema() self._data_schema = {k : _turicreate._cython.cy_flexible_type.py...
['def', '_get_data_schema', '(', 'self', ')', ':', 'if', 'not', 'hasattr', '(', 'self', ',', '"_data_schema"', ')', ':', 'response', '=', 'self', '.', '__proxy__', '.', 'get_data_schema', '(', ')', 'self', '.', '_data_schema', '=', '{', 'k', ':', '_turicreate', '.', '_cython', '.', 'cy_flexible_type', '.', 'pytype_from...
Returns a dictionary of (column : type) for the data used in the model.
['Returns', 'a', 'dictionary', 'of', '(', 'column', ':', 'type', ')', 'for', 'the', 'data', 'used', 'in', 'the', 'model', '.']
train
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/util.py#L845-L857