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,400
cloudendpoints/endpoints-management-python
endpoints_management/control/report_request.py
Info._as_log_entry
def _as_log_entry(self, name, now): """Makes a `LogEntry` from this instance for the given log_name. Args: rules (:class:`ReportingRules`): determines what labels, metrics and logs to include in the report request. now (:class:`datetime.DateTime`): the current time ...
python
def _as_log_entry(self, name, now): """Makes a `LogEntry` from this instance for the given log_name. Args: rules (:class:`ReportingRules`): determines what labels, metrics and logs to include in the report request. now (:class:`datetime.DateTime`): the current time ...
['def', '_as_log_entry', '(', 'self', ',', 'name', ',', 'now', ')', ':', '# initialize the struct with fields that are always present', 'd', '=', '{', "u'http_response_code'", ':', 'self', '.', 'response_code', ',', "u'timestamp'", ':', 'time', '.', 'mktime', '(', 'now', '.', 'timetuple', '(', ')', ')', '}', '# compute...
Makes a `LogEntry` from this instance for the given log_name. Args: rules (:class:`ReportingRules`): determines what labels, metrics and logs to include in the report request. now (:class:`datetime.DateTime`): the current time Return: a ``LogEntry`` generated ...
['Makes', 'a', 'LogEntry', 'from', 'this', 'instance', 'for', 'the', 'given', 'log_name', '.']
train
https://github.com/cloudendpoints/endpoints-management-python/blob/ec3c4a330ae9d65738861ce6df4dd6c3cb9f7731/endpoints_management/control/report_request.py#L293-L342
6,401
mongodb/mongo-python-driver
pymongo/message.py
_update
def _update(collection_name, upsert, multi, spec, doc, check_keys, opts): """Get an OP_UPDATE message.""" flags = 0 if upsert: flags += 1 if multi: flags += 2 encode = _dict_to_bson # Make local. Uses extensions. encoded_update = encode(doc, check_keys, opts) return b"".join...
python
def _update(collection_name, upsert, multi, spec, doc, check_keys, opts): """Get an OP_UPDATE message.""" flags = 0 if upsert: flags += 1 if multi: flags += 2 encode = _dict_to_bson # Make local. Uses extensions. encoded_update = encode(doc, check_keys, opts) return b"".join...
['def', '_update', '(', 'collection_name', ',', 'upsert', ',', 'multi', ',', 'spec', ',', 'doc', ',', 'check_keys', ',', 'opts', ')', ':', 'flags', '=', '0', 'if', 'upsert', ':', 'flags', '+=', '1', 'if', 'multi', ':', 'flags', '+=', '2', 'encode', '=', '_dict_to_bson', '# Make local. Uses extensions.', 'encoded_update...
Get an OP_UPDATE message.
['Get', 'an', 'OP_UPDATE', 'message', '.']
train
https://github.com/mongodb/mongo-python-driver/blob/c29c21449e3aae74154207058cf85fd94018d4cd/pymongo/message.py#L568-L582
6,402
allenai/allennlp
allennlp/data/fields/text_field.py
TextField.get_padding_lengths
def get_padding_lengths(self) -> Dict[str, int]: """ The ``TextField`` has a list of ``Tokens``, and each ``Token`` gets converted into arrays by (potentially) several ``TokenIndexers``. This method gets the max length (over tokens) associated with each of these arrays. """ ...
python
def get_padding_lengths(self) -> Dict[str, int]: """ The ``TextField`` has a list of ``Tokens``, and each ``Token`` gets converted into arrays by (potentially) several ``TokenIndexers``. This method gets the max length (over tokens) associated with each of these arrays. """ ...
['def', 'get_padding_lengths', '(', 'self', ')', '->', 'Dict', '[', 'str', ',', 'int', ']', ':', '# Our basic outline: we will iterate over `TokenIndexers`, and aggregate lengths over tokens', '# for each indexer separately. Then we will combine the results for each indexer into a single', '# dictionary, resolving any...
The ``TextField`` has a list of ``Tokens``, and each ``Token`` gets converted into arrays by (potentially) several ``TokenIndexers``. This method gets the max length (over tokens) associated with each of these arrays.
['The', 'TextField', 'has', 'a', 'list', 'of', 'Tokens', 'and', 'each', 'Token', 'gets', 'converted', 'into', 'arrays', 'by', '(', 'potentially', ')', 'several', 'TokenIndexers', '.', 'This', 'method', 'gets', 'the', 'max', 'length', '(', 'over', 'tokens', ')', 'associated', 'with', 'each', 'of', 'these', 'arrays', '.'...
train
https://github.com/allenai/allennlp/blob/648a36f77db7e45784c047176074f98534c76636/allennlp/data/fields/text_field.py#L75-L125
6,403
ray-project/ray
python/ray/rllib/utils/filter.py
MeanStdFilter.apply_changes
def apply_changes(self, other, with_buffer=False): """Applies updates from the buffer of another filter. Params: other (MeanStdFilter): Other filter to apply info from with_buffer (bool): Flag for specifying if the buffer should be copied from other. Exa...
python
def apply_changes(self, other, with_buffer=False): """Applies updates from the buffer of another filter. Params: other (MeanStdFilter): Other filter to apply info from with_buffer (bool): Flag for specifying if the buffer should be copied from other. Exa...
['def', 'apply_changes', '(', 'self', ',', 'other', ',', 'with_buffer', '=', 'False', ')', ':', 'self', '.', 'rs', '.', 'update', '(', 'other', '.', 'buffer', ')', 'if', 'with_buffer', ':', 'self', '.', 'buffer', '=', 'other', '.', 'buffer', '.', 'copy', '(', ')']
Applies updates from the buffer of another filter. Params: other (MeanStdFilter): Other filter to apply info from with_buffer (bool): Flag for specifying if the buffer should be copied from other. Examples: >>> a = MeanStdFilter(()) >>> a...
['Applies', 'updates', 'from', 'the', 'buffer', 'of', 'another', 'filter', '.']
train
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/rllib/utils/filter.py#L156-L181
6,404
awacha/sastool
sastool/fitting/fitfunctions/sasbasic.py
GuinierPorod
def GuinierPorod(q, G, Rg, alpha): """Empirical Guinier-Porod scattering Inputs: ------- ``q``: independent variable ``G``: factor of the Guinier-branch ``Rg``: radius of gyration ``alpha``: power-law exponent Formula: -------- ``G * exp(-q^2*Rg^2/3)`` if ``...
python
def GuinierPorod(q, G, Rg, alpha): """Empirical Guinier-Porod scattering Inputs: ------- ``q``: independent variable ``G``: factor of the Guinier-branch ``Rg``: radius of gyration ``alpha``: power-law exponent Formula: -------- ``G * exp(-q^2*Rg^2/3)`` if ``...
['def', 'GuinierPorod', '(', 'q', ',', 'G', ',', 'Rg', ',', 'alpha', ')', ':', 'return', 'GuinierPorodMulti', '(', 'q', ',', 'G', ',', 'Rg', ',', 'alpha', ')']
Empirical Guinier-Porod scattering Inputs: ------- ``q``: independent variable ``G``: factor of the Guinier-branch ``Rg``: radius of gyration ``alpha``: power-law exponent Formula: -------- ``G * exp(-q^2*Rg^2/3)`` if ``q<q_sep`` and ``a*q^alpha`` otherwise. ...
['Empirical', 'Guinier', '-', 'Porod', 'scattering']
train
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/fitting/fitfunctions/sasbasic.py#L86-L107
6,405
awslabs/sockeye
sockeye/loss.py
LengthRatioMSEMetric.update_dict
def update_dict(self, label: Dict, pred: Dict): """ If label is missing the right name, copy it from the prediction. """ if not set(self.label_names).issubset(set(label.keys())): label.update({name:pred[name] for name in self.label_names}) super().update_dict(label, p...
python
def update_dict(self, label: Dict, pred: Dict): """ If label is missing the right name, copy it from the prediction. """ if not set(self.label_names).issubset(set(label.keys())): label.update({name:pred[name] for name in self.label_names}) super().update_dict(label, p...
['def', 'update_dict', '(', 'self', ',', 'label', ':', 'Dict', ',', 'pred', ':', 'Dict', ')', ':', 'if', 'not', 'set', '(', 'self', '.', 'label_names', ')', '.', 'issubset', '(', 'set', '(', 'label', '.', 'keys', '(', ')', ')', ')', ':', 'label', '.', 'update', '(', '{', 'name', ':', 'pred', '[', 'name', ']', 'for', 'n...
If label is missing the right name, copy it from the prediction.
['If', 'label', 'is', 'missing', 'the', 'right', 'name', 'copy', 'it', 'from', 'the', 'prediction', '.']
train
https://github.com/awslabs/sockeye/blob/5d64a1ee1ef3cbba17c6d1d94bc061020c43f6ab/sockeye/loss.py#L367-L373
6,406
acutesoftware/AIKIF
aikif/web_app/page_search.py
get_page
def get_page(search_text): """ formats the entire search result in a table output """ lst = search_aikif(search_text) txt = '<table class="as-table as-table-zebra as-table-horizontal">' for result in lst: txt += '<TR><TD>' + result + '</TD></TR>' txt += '</TABLE>\n\n' return txt
python
def get_page(search_text): """ formats the entire search result in a table output """ lst = search_aikif(search_text) txt = '<table class="as-table as-table-zebra as-table-horizontal">' for result in lst: txt += '<TR><TD>' + result + '</TD></TR>' txt += '</TABLE>\n\n' return txt
['def', 'get_page', '(', 'search_text', ')', ':', 'lst', '=', 'search_aikif', '(', 'search_text', ')', 'txt', '=', '\'<table class="as-table as-table-zebra as-table-horizontal">\'', 'for', 'result', 'in', 'lst', ':', 'txt', '+=', "'<TR><TD>'", '+', 'result', '+', "'</TD></TR>'", 'txt', '+=', "'</TABLE>\\n\\n'", 'return...
formats the entire search result in a table output
['formats', 'the', 'entire', 'search', 'result', 'in', 'a', 'table', 'output']
train
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/web_app/page_search.py#L12-L21
6,407
common-workflow-language/cwltool
cwltool/job.py
ContainerCommandLineJob.docker_monitor
def docker_monitor(self, cidfile, tmpdir_prefix, cleanup_cidfile, process): # type: (Text, Text, bool, subprocess.Popen) -> None """Record memory usage of the running Docker container.""" # Todo: consider switching to `docker create` / `docker start` # instead of `docker run` as `docker ...
python
def docker_monitor(self, cidfile, tmpdir_prefix, cleanup_cidfile, process): # type: (Text, Text, bool, subprocess.Popen) -> None """Record memory usage of the running Docker container.""" # Todo: consider switching to `docker create` / `docker start` # instead of `docker run` as `docker ...
['def', 'docker_monitor', '(', 'self', ',', 'cidfile', ',', 'tmpdir_prefix', ',', 'cleanup_cidfile', ',', 'process', ')', ':', '# type: (Text, Text, bool, subprocess.Popen) -> None', '# Todo: consider switching to `docker create` / `docker start`', '# instead of `docker run` as `docker create` outputs the container ID'...
Record memory usage of the running Docker container.
['Record', 'memory', 'usage', 'of', 'the', 'running', 'Docker', 'container', '.']
train
https://github.com/common-workflow-language/cwltool/blob/cb81b22abc52838823da9945f04d06739ab32fda/cwltool/job.py#L681-L723
6,408
alixnovosi/drewtilities
drewtilities/drewtilities.py
generate_downloader
def generate_downloader(headers: Dict[str, str], args: Any, max_per_hour: int=30 ) -> Callable[..., None]: """Create function to download with rate limiting and text progress.""" def _downloader(url: str, dest: str) -> None: @rate_limited(max_per_hour, args) def _rate_l...
python
def generate_downloader(headers: Dict[str, str], args: Any, max_per_hour: int=30 ) -> Callable[..., None]: """Create function to download with rate limiting and text progress.""" def _downloader(url: str, dest: str) -> None: @rate_limited(max_per_hour, args) def _rate_l...
['def', 'generate_downloader', '(', 'headers', ':', 'Dict', '[', 'str', ',', 'str', ']', ',', 'args', ':', 'Any', ',', 'max_per_hour', ':', 'int', '=', '30', ')', '->', 'Callable', '[', '...', ',', 'None', ']', ':', 'def', '_downloader', '(', 'url', ':', 'str', ',', 'dest', ':', 'str', ')', '->', 'None', ':', '@', 'rat...
Create function to download with rate limiting and text progress.
['Create', 'function', 'to', 'download', 'with', 'rate', 'limiting', 'and', 'text', 'progress', '.']
train
https://github.com/alixnovosi/drewtilities/blob/4e9b7f65f11195dc48347bf9c6ca4e56baca8b45/drewtilities/drewtilities.py#L33-L71
6,409
umich-brcf-bioinf/Connor
connor/consam/readers.py
paired_reader_from_bamfile
def paired_reader_from_bamfile(args, log, usage_logger, annotated_writer): '''Given a BAM file, return a generator that yields filtered, paired reads''' total_aligns = pysamwrapper.total_align_count(args.input_bam) ...
python
def paired_reader_from_bamfile(args, log, usage_logger, annotated_writer): '''Given a BAM file, return a generator that yields filtered, paired reads''' total_aligns = pysamwrapper.total_align_count(args.input_bam) ...
['def', 'paired_reader_from_bamfile', '(', 'args', ',', 'log', ',', 'usage_logger', ',', 'annotated_writer', ')', ':', 'total_aligns', '=', 'pysamwrapper', '.', 'total_align_count', '(', 'args', '.', 'input_bam', ')', 'bamfile_generator', '=', '_bamfile_generator', '(', 'args', '.', 'input_bam', ')', 'return', '_paired...
Given a BAM file, return a generator that yields filtered, paired reads
['Given', 'a', 'BAM', 'file', 'return', 'a', 'generator', 'that', 'yields', 'filtered', 'paired', 'reads']
train
https://github.com/umich-brcf-bioinf/Connor/blob/b20e9f36e9730c29eaa27ea5fa8b0151e58d2f13/connor/consam/readers.py#L112-L124
6,410
Julius2342/pyvlx
old_api/pyvlx/scenes.py
Scenes.data_import
def data_import(self, json_response): """Import scenes from JSON response.""" if 'data' not in json_response: raise PyVLXException('no element data found: {0}'.format( json.dumps(json_response))) data = json_response['data'] for item in data: self....
python
def data_import(self, json_response): """Import scenes from JSON response.""" if 'data' not in json_response: raise PyVLXException('no element data found: {0}'.format( json.dumps(json_response))) data = json_response['data'] for item in data: self....
['def', 'data_import', '(', 'self', ',', 'json_response', ')', ':', 'if', "'data'", 'not', 'in', 'json_response', ':', 'raise', 'PyVLXException', '(', "'no element data found: {0}'", '.', 'format', '(', 'json', '.', 'dumps', '(', 'json_response', ')', ')', ')', 'data', '=', 'json_response', '[', "'data'", ']', 'for', '...
Import scenes from JSON response.
['Import', 'scenes', 'from', 'JSON', 'response', '.']
train
https://github.com/Julius2342/pyvlx/blob/ee78e1324bcb1be5b8d1a9d05ab5496b72eae848/old_api/pyvlx/scenes.py#L44-L51
6,411
tanghaibao/goatools
goatools/gosubdag/rpt/wr_xlsx.py
GoDepth1LettersWr.wr_tex
def wr_tex(self, fout_tex="gos_depth01.tex"): """write text table of depth-01 GO terms and their letter representation.""" data_nts = self.get_d1nts() joinchr = " & " #pylint: disable=anomalous-backslash-in-string eol = " \\\\\n" with open(fout_tex, 'w') as prt: ...
python
def wr_tex(self, fout_tex="gos_depth01.tex"): """write text table of depth-01 GO terms and their letter representation.""" data_nts = self.get_d1nts() joinchr = " & " #pylint: disable=anomalous-backslash-in-string eol = " \\\\\n" with open(fout_tex, 'w') as prt: ...
['def', 'wr_tex', '(', 'self', ',', 'fout_tex', '=', '"gos_depth01.tex"', ')', ':', 'data_nts', '=', 'self', '.', 'get_d1nts', '(', ')', 'joinchr', '=', '" & "', '#pylint: disable=anomalous-backslash-in-string', 'eol', '=', '" \\\\\\\\\\n"', 'with', 'open', '(', 'fout_tex', ',', "'w'", ')', 'as', 'prt', ':', 'prt', '.'...
write text table of depth-01 GO terms and their letter representation.
['write', 'text', 'table', 'of', 'depth', '-', '01', 'GO', 'terms', 'and', 'their', 'letter', 'representation', '.']
train
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/rpt/wr_xlsx.py#L134-L170
6,412
spacetelescope/stsci.tools
lib/stsci/tools/fileutil.py
copyFile
def copyFile(input, output, replace=None): """Copy a file whole from input to output.""" _found = findFile(output) if not _found or (_found and replace): shutil.copy2(input, output)
python
def copyFile(input, output, replace=None): """Copy a file whole from input to output.""" _found = findFile(output) if not _found or (_found and replace): shutil.copy2(input, output)
['def', 'copyFile', '(', 'input', ',', 'output', ',', 'replace', '=', 'None', ')', ':', '_found', '=', 'findFile', '(', 'output', ')', 'if', 'not', '_found', 'or', '(', '_found', 'and', 'replace', ')', ':', 'shutil', '.', 'copy2', '(', 'input', ',', 'output', ')']
Copy a file whole from input to output.
['Copy', 'a', 'file', 'whole', 'from', 'input', 'to', 'output', '.']
train
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/fileutil.py#L1076-L1081
6,413
fstab50/metal
metal/chkrootkit.py
compile_binary
def compile_binary(source): """ Prepare chkrootkit binary $ tar xzvf chkrootkit.tar.gz $ cd chkrootkit-0.52 $ make sense sudo mv chkrootkit-0.52 /usr/local/chkrootkit sudo ln -s """ cmd = 'make sense' slink = '/usr/local/bin/chkrootkit' target = '/usr/local/chkrootkit/chkroot...
python
def compile_binary(source): """ Prepare chkrootkit binary $ tar xzvf chkrootkit.tar.gz $ cd chkrootkit-0.52 $ make sense sudo mv chkrootkit-0.52 /usr/local/chkrootkit sudo ln -s """ cmd = 'make sense' slink = '/usr/local/bin/chkrootkit' target = '/usr/local/chkrootkit/chkroot...
['def', 'compile_binary', '(', 'source', ')', ':', 'cmd', '=', "'make sense'", 'slink', '=', "'/usr/local/bin/chkrootkit'", 'target', '=', "'/usr/local/chkrootkit/chkrootkit'", '# Tar Extraction', 't', '=', 'tarfile', '.', 'open', '(', 'source', ',', "'r'", ')', 't', '.', 'extractall', '(', 'TMPDIR', ')', 'if', 'isinst...
Prepare chkrootkit binary $ tar xzvf chkrootkit.tar.gz $ cd chkrootkit-0.52 $ make sense sudo mv chkrootkit-0.52 /usr/local/chkrootkit sudo ln -s
['Prepare', 'chkrootkit', 'binary', '$', 'tar', 'xzvf', 'chkrootkit', '.', 'tar', '.', 'gz', '$', 'cd', 'chkrootkit', '-', '0', '.', '52', '$', 'make', 'sense', 'sudo', 'mv', 'chkrootkit', '-', '0', '.', '52', '/', 'usr', '/', 'local', '/', 'chkrootkit', 'sudo', 'ln', '-', 's']
train
https://github.com/fstab50/metal/blob/0488bbdd516a508909267cc44191f632e21156ba/metal/chkrootkit.py#L46-L70
6,414
google/grr
grr/server/grr_response_server/databases/mysql_utils.py
ComponentsToPath
def ComponentsToPath(components): """Converts a list of path components to a canonical path representation. Args: components: A sequence of path components. Returns: A canonical MySQL path representation. """ precondition.AssertIterableType(components, Text) for component in components: if not...
python
def ComponentsToPath(components): """Converts a list of path components to a canonical path representation. Args: components: A sequence of path components. Returns: A canonical MySQL path representation. """ precondition.AssertIterableType(components, Text) for component in components: if not...
['def', 'ComponentsToPath', '(', 'components', ')', ':', 'precondition', '.', 'AssertIterableType', '(', 'components', ',', 'Text', ')', 'for', 'component', 'in', 'components', ':', 'if', 'not', 'component', ':', 'raise', 'ValueError', '(', '"Empty path component in: {}"', '.', 'format', '(', 'components', ')', ')', 'i...
Converts a list of path components to a canonical path representation. Args: components: A sequence of path components. Returns: A canonical MySQL path representation.
['Converts', 'a', 'list', 'of', 'path', 'components', 'to', 'a', 'canonical', 'path', 'representation', '.']
train
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_utils.py#L141-L161
6,415
juju/python-libjuju
juju/model.py
_Observer.cares_about
def cares_about(self, delta): """Return True if this observer "cares about" (i.e. wants to be called) for a this delta. """ if (self.entity_id and delta.get_id() and not re.match(self.entity_id, str(delta.get_id()))): return False if self.entity_type...
python
def cares_about(self, delta): """Return True if this observer "cares about" (i.e. wants to be called) for a this delta. """ if (self.entity_id and delta.get_id() and not re.match(self.entity_id, str(delta.get_id()))): return False if self.entity_type...
['def', 'cares_about', '(', 'self', ',', 'delta', ')', ':', 'if', '(', 'self', '.', 'entity_id', 'and', 'delta', '.', 'get_id', '(', ')', 'and', 'not', 're', '.', 'match', '(', 'self', '.', 'entity_id', ',', 'str', '(', 'delta', '.', 'get_id', '(', ')', ')', ')', ')', ':', 'return', 'False', 'if', 'self', '.', 'entity_...
Return True if this observer "cares about" (i.e. wants to be called) for a this delta.
['Return', 'True', 'if', 'this', 'observer', 'cares', 'about', '(', 'i', '.', 'e', '.', 'wants', 'to', 'be', 'called', ')', 'for', 'a', 'this', 'delta', '.']
train
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L62-L80
6,416
thespacedoctor/rockAtlas
rockAtlas/positions/orbfitPositions.py
orbfitPositions.get
def get(self, singleExposure=False): """ *get the orbfitPositions object* **Key Arguments:** - ``singleExposure`` -- only execute fot a single exposure (useful for debugging) **Return:** - None **Usage:** See class docstring ...
python
def get(self, singleExposure=False): """ *get the orbfitPositions object* **Key Arguments:** - ``singleExposure`` -- only execute fot a single exposure (useful for debugging) **Return:** - None **Usage:** See class docstring ...
['def', 'get', '(', 'self', ',', 'singleExposure', '=', 'False', ')', ':', 'self', '.', 'log', '.', 'info', '(', "'starting the ``get`` method'", ')', 'if', 'singleExposure', ':', 'batchSize', '=', '1', 'else', ':', 'batchSize', '=', 'int', '(', 'self', '.', 'settings', '[', '"orbfit"', ']', '[', '"batch size"', ']', '...
*get the orbfitPositions object* **Key Arguments:** - ``singleExposure`` -- only execute fot a single exposure (useful for debugging) **Return:** - None **Usage:** See class docstring
['*', 'get', 'the', 'orbfitPositions', 'object', '*']
train
https://github.com/thespacedoctor/rockAtlas/blob/062ecaa95ab547efda535aa33165944f13c621de/rockAtlas/positions/orbfitPositions.py#L84-L119
6,417
PMBio/limix-backup
limix/scripts/limix_runner.py
LIMIX_runner.run_experiment
def run_experiment(self): """ Run the job specified in experiment_script """ data=self.data options=self.options result=self.result command = open(self.options.experiment_script).read() result["experiment_script"]=command t0=time.time() ex...
python
def run_experiment(self): """ Run the job specified in experiment_script """ data=self.data options=self.options result=self.result command = open(self.options.experiment_script).read() result["experiment_script"]=command t0=time.time() ex...
['def', 'run_experiment', '(', 'self', ')', ':', 'data', '=', 'self', '.', 'data', 'options', '=', 'self', '.', 'options', 'result', '=', 'self', '.', 'result', 'command', '=', 'open', '(', 'self', '.', 'options', '.', 'experiment_script', ')', '.', 'read', '(', ')', 'result', '[', '"experiment_script"', ']', '=', 'com...
Run the job specified in experiment_script
['Run', 'the', 'job', 'specified', 'in', 'experiment_script']
train
https://github.com/PMBio/limix-backup/blob/1e201fdb5c694d0d5506f207f3de65d8ef66146c/limix/scripts/limix_runner.py#L66-L81
6,418
ramrod-project/database-brain
schema/brain/binary/filesystem.py
BrainStore.create
def create(self, path, mode): # pragma: no cover """ This is currently a read-only filessytem. GetAttr will return a stat for everything if getattr raises FuseOSError(ENOENT) OS may call this function and the write function """ # print("create {}".format(path)) ...
python
def create(self, path, mode): # pragma: no cover """ This is currently a read-only filessytem. GetAttr will return a stat for everything if getattr raises FuseOSError(ENOENT) OS may call this function and the write function """ # print("create {}".format(path)) ...
['def', 'create', '(', 'self', ',', 'path', ',', 'mode', ')', ':', '# pragma: no cover', '# print("create {}".format(path))', 'now_time', '=', 'time', '(', ')', 'with', 'self', '.', 'attr_lock', ':', 'base', '=', 'NoStat', '(', ')', 'base', '.', 'staged', '=', 'True', 'base', '.', 'st_mode', '=', 'stat', '.', 'S_IFREG'...
This is currently a read-only filessytem. GetAttr will return a stat for everything if getattr raises FuseOSError(ENOENT) OS may call this function and the write function
['This', 'is', 'currently', 'a', 'read', '-', 'only', 'filessytem', '.', 'GetAttr', 'will', 'return', 'a', 'stat', 'for', 'everything', 'if', 'getattr', 'raises', 'FuseOSError', '(', 'ENOENT', ')', 'OS', 'may', 'call', 'this', 'function', 'and', 'the', 'write', 'function']
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/binary/filesystem.py#L149-L167
6,419
jilljenn/tryalgo
tryalgo/partition_refinement.py
PartitionItem.remove
def remove(self): """remove item from its class """ DoubleLinkedListItem.remove(self) # remove from double linked list if self.succ is self: # list was a singleton self.theclass.items = None # class is empty elif self.theclass.items is self:...
python
def remove(self): """remove item from its class """ DoubleLinkedListItem.remove(self) # remove from double linked list if self.succ is self: # list was a singleton self.theclass.items = None # class is empty elif self.theclass.items is self:...
['def', 'remove', '(', 'self', ')', ':', 'DoubleLinkedListItem', '.', 'remove', '(', 'self', ')', '# remove from double linked list', 'if', 'self', '.', 'succ', 'is', 'self', ':', '# list was a singleton', 'self', '.', 'theclass', '.', 'items', '=', 'None', '# class is empty', 'elif', 'self', '.', 'theclass', '.', 'ite...
remove item from its class
['remove', 'item', 'from', 'its', 'class']
train
https://github.com/jilljenn/tryalgo/blob/89a4dd9655e7b6b0a176f72b4c60d0196420dfe1/tryalgo/partition_refinement.py#L77-L84
6,420
obriencj/python-javatools
javatools/manifest.py
multi_path_generator
def multi_path_generator(pathnames): """ yields (name,chunkgen) for all of the files found under the list of pathnames given. This is recursive, so directories will have their contents emitted. chunkgen is a function that can called and iterated over to obtain the contents of the file in multiple ...
python
def multi_path_generator(pathnames): """ yields (name,chunkgen) for all of the files found under the list of pathnames given. This is recursive, so directories will have their contents emitted. chunkgen is a function that can called and iterated over to obtain the contents of the file in multiple ...
['def', 'multi_path_generator', '(', 'pathnames', ')', ':', 'for', 'pathname', 'in', 'pathnames', ':', 'if', 'isdir', '(', 'pathname', ')', ':', 'for', 'entry', 'in', 'directory_generator', '(', 'pathname', ')', ':', 'yield', 'entry', 'else', ':', 'yield', 'pathname', ',', 'file_chunk', '(', 'pathname', ')']
yields (name,chunkgen) for all of the files found under the list of pathnames given. This is recursive, so directories will have their contents emitted. chunkgen is a function that can called and iterated over to obtain the contents of the file in multiple reads.
['yields', '(', 'name', 'chunkgen', ')', 'for', 'all', 'of', 'the', 'files', 'found', 'under', 'the', 'list', 'of', 'pathnames', 'given', '.', 'This', 'is', 'recursive', 'so', 'directories', 'will', 'have', 'their', 'contents', 'emitted', '.', 'chunkgen', 'is', 'a', 'function', 'that', 'can', 'called', 'and', 'iterated...
train
https://github.com/obriencj/python-javatools/blob/9e2332b452ddc508bed0615937dddcb2cf051557/javatools/manifest.py#L860-L874
6,421
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
Blobber.blobize
async def blobize(self, elem=None, elem_type=None, params=None): """ Main blobbing :param elem: :param elem_type: :param params: :return: """ if self.writing: await self.field(elem=elem, elem_type=elem_type, params=params) return by...
python
async def blobize(self, elem=None, elem_type=None, params=None): """ Main blobbing :param elem: :param elem_type: :param params: :return: """ if self.writing: await self.field(elem=elem, elem_type=elem_type, params=params) return by...
['async', 'def', 'blobize', '(', 'self', ',', 'elem', '=', 'None', ',', 'elem_type', '=', 'None', ',', 'params', '=', 'None', ')', ':', 'if', 'self', '.', 'writing', ':', 'await', 'self', '.', 'field', '(', 'elem', '=', 'elem', ',', 'elem_type', '=', 'elem_type', ',', 'params', '=', 'params', ')', 'return', 'bytes', '(...
Main blobbing :param elem: :param elem_type: :param params: :return:
['Main', 'blobbing', ':', 'param', 'elem', ':', ':', 'param', 'elem_type', ':', ':', 'param', 'params', ':', ':', 'return', ':']
train
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L914-L926
6,422
arne-cl/discoursegraphs
src/discoursegraphs/discoursegraph.py
create_token_mapping
def create_token_mapping(docgraph_with_old_names, docgraph_with_new_names, verbose=False): """ given two document graphs which annotate the same text and which use the same tokenization, creates a dictionary with a mapping from the token IDs used in the first graph to the token ...
python
def create_token_mapping(docgraph_with_old_names, docgraph_with_new_names, verbose=False): """ given two document graphs which annotate the same text and which use the same tokenization, creates a dictionary with a mapping from the token IDs used in the first graph to the token ...
['def', 'create_token_mapping', '(', 'docgraph_with_old_names', ',', 'docgraph_with_new_names', ',', 'verbose', '=', 'False', ')', ':', 'def', 'kwic_string', '(', 'docgraph', ',', 'keyword_index', ')', ':', 'tokens', '=', '[', 'tok', 'for', '(', 'tokid', ',', 'tok', ')', 'in', 'list', '(', 'docgraph', '.', 'get_tokens'...
given two document graphs which annotate the same text and which use the same tokenization, creates a dictionary with a mapping from the token IDs used in the first graph to the token IDs used in the second graph. Parameters ---------- docgraph_with_old_names : DiscourseDocumentGraph a docu...
['given', 'two', 'document', 'graphs', 'which', 'annotate', 'the', 'same', 'text', 'and', 'which', 'use', 'the', 'same', 'tokenization', 'creates', 'a', 'dictionary', 'with', 'a', 'mapping', 'from', 'the', 'token', 'IDs', 'used', 'in', 'the', 'first', 'graph', 'to', 'the', 'token', 'IDs', 'used', 'in', 'the', 'second',...
train
https://github.com/arne-cl/discoursegraphs/blob/842f0068a3190be2c75905754521b176b25a54fb/src/discoursegraphs/discoursegraph.py#L790-L838
6,423
merll/docker-map
dockermap/map/client.py
MappingDockerClient.stop
def stop(self, container, instances=None, map_name=None, **kwargs): """ Stops instances for a container configuration. :param container: Container name. :type container: unicode | str :param instances: Instance names to stop. If not specified, will stop all instances as specifie...
python
def stop(self, container, instances=None, map_name=None, **kwargs): """ Stops instances for a container configuration. :param container: Container name. :type container: unicode | str :param instances: Instance names to stop. If not specified, will stop all instances as specifie...
['def', 'stop', '(', 'self', ',', 'container', ',', 'instances', '=', 'None', ',', 'map_name', '=', 'None', ',', '*', '*', 'kwargs', ')', ':', 'return', 'self', '.', 'run_actions', '(', "'stop'", ',', 'container', ',', 'instances', '=', 'instances', ',', 'map_name', '=', 'map_name', ',', '*', '*', 'kwargs', ')']
Stops instances for a container configuration. :param container: Container name. :type container: unicode | str :param instances: Instance names to stop. If not specified, will stop all instances as specified in the configuration (or just one default instance). :type instances:...
['Stops', 'instances', 'for', 'a', 'container', 'configuration', '.']
train
https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/client.py#L294-L314
6,424
mushkevych/scheduler
synergy/system/utils.py
copy_and_sum_families
def copy_and_sum_families(family_source, family_target): """ methods iterates thru source family and copies its entries to target family in case key already exists in both families - then the values are added""" for every in family_source: if every not in family_target: family_target[eve...
python
def copy_and_sum_families(family_source, family_target): """ methods iterates thru source family and copies its entries to target family in case key already exists in both families - then the values are added""" for every in family_source: if every not in family_target: family_target[eve...
['def', 'copy_and_sum_families', '(', 'family_source', ',', 'family_target', ')', ':', 'for', 'every', 'in', 'family_source', ':', 'if', 'every', 'not', 'in', 'family_target', ':', 'family_target', '[', 'every', ']', '=', 'family_source', '[', 'every', ']', 'else', ':', 'family_target', '[', 'every', ']', '+=', 'family...
methods iterates thru source family and copies its entries to target family in case key already exists in both families - then the values are added
['methods', 'iterates', 'thru', 'source', 'family', 'and', 'copies', 'its', 'entries', 'to', 'target', 'family', 'in', 'case', 'key', 'already', 'exists', 'in', 'both', 'families', '-', 'then', 'the', 'values', 'are', 'added']
train
https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/system/utils.py#L65-L72
6,425
RJT1990/pyflux
pyflux/tsm.py
TSM._bbvi_fit
def _bbvi_fit(self, posterior, optimizer='RMSProp', iterations=1000, map_start=True, batch_size=12, mini_batch=None, learning_rate=0.001, record_elbo=False, quiet_progress=False, **kwargs): """ Performs Black Box Variational Inference Parameters ---------- posterior : ...
python
def _bbvi_fit(self, posterior, optimizer='RMSProp', iterations=1000, map_start=True, batch_size=12, mini_batch=None, learning_rate=0.001, record_elbo=False, quiet_progress=False, **kwargs): """ Performs Black Box Variational Inference Parameters ---------- posterior : ...
['def', '_bbvi_fit', '(', 'self', ',', 'posterior', ',', 'optimizer', '=', "'RMSProp'", ',', 'iterations', '=', '1000', ',', 'map_start', '=', 'True', ',', 'batch_size', '=', '12', ',', 'mini_batch', '=', 'None', ',', 'learning_rate', '=', '0.001', ',', 'record_elbo', '=', 'False', ',', 'quiet_progress', '=', 'False', ...
Performs Black Box Variational Inference Parameters ---------- posterior : method Hands bbvi_fit a posterior object optimizer : string Stochastic optimizer: one of RMSProp or ADAM. iterations: int How many iterations for BBVI map_st...
['Performs', 'Black', 'Box', 'Variational', 'Inference']
train
https://github.com/RJT1990/pyflux/blob/297f2afc2095acd97c12e827dd500e8ea5da0c0f/pyflux/tsm.py#L112-L185
6,426
fabioz/PyDev.Debugger
_pydevd_bundle/pydevd_comm.py
InternalThreadCommand.can_be_executed_by
def can_be_executed_by(self, thread_id): '''By default, it must be in the same thread to be executed ''' return self.thread_id == thread_id or self.thread_id.endswith('|' + thread_id)
python
def can_be_executed_by(self, thread_id): '''By default, it must be in the same thread to be executed ''' return self.thread_id == thread_id or self.thread_id.endswith('|' + thread_id)
['def', 'can_be_executed_by', '(', 'self', ',', 'thread_id', ')', ':', 'return', 'self', '.', 'thread_id', '==', 'thread_id', 'or', 'self', '.', 'thread_id', '.', 'endswith', '(', "'|'", '+', 'thread_id', ')']
By default, it must be in the same thread to be executed
['By', 'default', 'it', 'must', 'be', 'in', 'the', 'same', 'thread', 'to', 'be', 'executed']
train
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/_pydevd_bundle/pydevd_comm.py#L458-L461
6,427
proycon/pynlpl
pynlpl/datatypes.py
PriorityQueue.randomprune
def randomprune(self,n): """prune down to n items at random, disregarding their score""" self.data = random.sample(self.data, n)
python
def randomprune(self,n): """prune down to n items at random, disregarding their score""" self.data = random.sample(self.data, n)
['def', 'randomprune', '(', 'self', ',', 'n', ')', ':', 'self', '.', 'data', '=', 'random', '.', 'sample', '(', 'self', '.', 'data', ',', 'n', ')']
prune down to n items at random, disregarding their score
['prune', 'down', 'to', 'n', 'items', 'at', 'random', 'disregarding', 'their', 'score']
train
https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/datatypes.py#L196-L198
6,428
openego/ding0
ding0/grid/mv_grid/models/models.py
Route.allocate
def allocate(self, nodes, append=True): # TODO: check docstring """Allocates all nodes from `nodes` list in this route Parameters ---------- nodes : type Desc append : bool, defaults to True Desc """ nodes_demand ...
python
def allocate(self, nodes, append=True): # TODO: check docstring """Allocates all nodes from `nodes` list in this route Parameters ---------- nodes : type Desc append : bool, defaults to True Desc """ nodes_demand ...
['def', 'allocate', '(', 'self', ',', 'nodes', ',', 'append', '=', 'True', ')', ':', '# TODO: check docstring', 'nodes_demand', '=', '0', 'for', 'node', 'in', '[', 'node', 'for', 'node', 'in', 'nodes', ']', ':', 'if', 'node', '.', '_allocation', ':', 'node', '.', '_allocation', '.', 'deallocate', '(', '[', 'node', ']',...
Allocates all nodes from `nodes` list in this route Parameters ---------- nodes : type Desc append : bool, defaults to True Desc
['Allocates', 'all', 'nodes', 'from', 'nodes', 'list', 'in', 'this', 'route', 'Parameters', '----------', 'nodes', ':', 'type', 'Desc', 'append', ':', 'bool', 'defaults', 'to', 'True', 'Desc']
train
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/models/models.py#L160-L185
6,429
atlassian-api/atlassian-python-api
atlassian/jira.py
Jira.delete_agile_board
def delete_agile_board(self, board_id): """ Delete agile board by id :param board_id: :return: """ url = 'rest/agile/1.0/board/{}'.format(str(board_id)) return self.delete(url)
python
def delete_agile_board(self, board_id): """ Delete agile board by id :param board_id: :return: """ url = 'rest/agile/1.0/board/{}'.format(str(board_id)) return self.delete(url)
['def', 'delete_agile_board', '(', 'self', ',', 'board_id', ')', ':', 'url', '=', "'rest/agile/1.0/board/{}'", '.', 'format', '(', 'str', '(', 'board_id', ')', ')', 'return', 'self', '.', 'delete', '(', 'url', ')']
Delete agile board by id :param board_id: :return:
['Delete', 'agile', 'board', 'by', 'id', ':', 'param', 'board_id', ':', ':', 'return', ':']
train
https://github.com/atlassian-api/atlassian-python-api/blob/540d269905c3e7547b666fe30c647b2d512cf358/atlassian/jira.py#L1167-L1174
6,430
vmware/pyvmomi
pyVmomi/DynamicTypeManagerHelper.py
DynamicTypeConstructor._ConvertParamType
def _ConvertParamType(self, paramType): """ Convert vmodl.reflect.DynamicTypeManager.ParamTypeInfo to pyVmomi param definition """ if paramType: name = paramType.name version = paramType.version aType = paramType.type flags = self._ConvertAnnotations(par...
python
def _ConvertParamType(self, paramType): """ Convert vmodl.reflect.DynamicTypeManager.ParamTypeInfo to pyVmomi param definition """ if paramType: name = paramType.name version = paramType.version aType = paramType.type flags = self._ConvertAnnotations(par...
['def', '_ConvertParamType', '(', 'self', ',', 'paramType', ')', ':', 'if', 'paramType', ':', 'name', '=', 'paramType', '.', 'name', 'version', '=', 'paramType', '.', 'version', 'aType', '=', 'paramType', '.', 'type', 'flags', '=', 'self', '.', '_ConvertAnnotations', '(', 'paramType', '.', 'annotation', ')', 'privId', ...
Convert vmodl.reflect.DynamicTypeManager.ParamTypeInfo to pyVmomi param definition
['Convert', 'vmodl', '.', 'reflect', '.', 'DynamicTypeManager', '.', 'ParamTypeInfo', 'to', 'pyVmomi', 'param', 'definition']
train
https://github.com/vmware/pyvmomi/blob/3ffcb23bf77d757175c0d5216ba9a25345d824cd/pyVmomi/DynamicTypeManagerHelper.py#L161-L175
6,431
AustralianSynchrotron/lightflow
lightflow/models/task_signal.py
TaskSignal.start_dag
def start_dag(self, dag, *, data=None): """ Schedule the execution of a dag by sending a signal to the workflow. Args: dag (Dag, str): The dag object or the name of the dag that should be started. data (MultiTaskData): The data that should be passed on to the new dag. R...
python
def start_dag(self, dag, *, data=None): """ Schedule the execution of a dag by sending a signal to the workflow. Args: dag (Dag, str): The dag object or the name of the dag that should be started. data (MultiTaskData): The data that should be passed on to the new dag. R...
['def', 'start_dag', '(', 'self', ',', 'dag', ',', '*', ',', 'data', '=', 'None', ')', ':', 'return', 'self', '.', '_client', '.', 'send', '(', 'Request', '(', 'action', '=', "'start_dag'", ',', 'payload', '=', '{', "'name'", ':', 'dag', '.', 'name', 'if', 'isinstance', '(', 'dag', ',', 'Dag', ')', 'else', 'dag', ',', ...
Schedule the execution of a dag by sending a signal to the workflow. Args: dag (Dag, str): The dag object or the name of the dag that should be started. data (MultiTaskData): The data that should be passed on to the new dag. Returns: str: The name of the successfull...
['Schedule', 'the', 'execution', 'of', 'a', 'dag', 'by', 'sending', 'a', 'signal', 'to', 'the', 'workflow', '.']
train
https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/task_signal.py#L18-L34
6,432
ArchiveTeam/wpull
wpull/network/connection.py
BaseConnection.run_network_operation
def run_network_operation(self, task, wait_timeout=None, close_timeout=None, name='Network operation'): '''Run the task and raise appropriate exceptions. Coroutine. ''' if wait_timeout is not None and close_timeout is not None:...
python
def run_network_operation(self, task, wait_timeout=None, close_timeout=None, name='Network operation'): '''Run the task and raise appropriate exceptions. Coroutine. ''' if wait_timeout is not None and close_timeout is not None:...
['def', 'run_network_operation', '(', 'self', ',', 'task', ',', 'wait_timeout', '=', 'None', ',', 'close_timeout', '=', 'None', ',', 'name', '=', "'Network operation'", ')', ':', 'if', 'wait_timeout', 'is', 'not', 'None', 'and', 'close_timeout', 'is', 'not', 'None', ':', 'raise', 'Exception', '(', "'Cannot use wait_tim...
Run the task and raise appropriate exceptions. Coroutine.
['Run', 'the', 'task', 'and', 'raise', 'appropriate', 'exceptions', '.']
train
https://github.com/ArchiveTeam/wpull/blob/ddf051aa3322479325ba20aa778cb2cb97606bf5/wpull/network/connection.py#L277-L345
6,433
PlaidWeb/Publ
publ/image/local.py
fix_orientation
def fix_orientation(image): """ adapted from https://stackoverflow.com/a/30462851/318857 Apply Image.transpose to ensure 0th row of pixels is at the visual top of the image, and 0th column is the visual left-hand side. Return the original image if unable to determine the orientation. ...
python
def fix_orientation(image): """ adapted from https://stackoverflow.com/a/30462851/318857 Apply Image.transpose to ensure 0th row of pixels is at the visual top of the image, and 0th column is the visual left-hand side. Return the original image if unable to determine the orientation. ...
['def', 'fix_orientation', '(', 'image', ')', ':', 'exif_orientation_tag', '=', '0x0112', 'exif_transpose_sequences', '=', '[', '[', ']', ',', '[', ']', ',', '[', 'PIL', '.', 'Image', '.', 'FLIP_LEFT_RIGHT', ']', ',', '[', 'PIL', '.', 'Image', '.', 'ROTATE_180', ']', ',', '[', 'PIL', '.', 'Image', '.', 'FLIP_TOP_BOTTOM...
adapted from https://stackoverflow.com/a/30462851/318857 Apply Image.transpose to ensure 0th row of pixels is at the visual top of the image, and 0th column is the visual left-hand side. Return the original image if unable to determine the orientation. As per CIPA DC-008-2012, the orie...
['adapted', 'from', 'https', ':', '//', 'stackoverflow', '.', 'com', '/', 'a', '/', '30462851', '/', '318857']
train
https://github.com/PlaidWeb/Publ/blob/ce7893632ddc3cb70b4978a41ffd7dd06fa13565/publ/image/local.py#L23-L55
6,434
tanghaibao/goatools
goatools/gosubdag/plot/plot.py
plt_goids
def plt_goids(gosubdag, fout_img, goids, **kws_plt): """Plot GO IDs in a DAG (Directed Acyclic Graph).""" gosubdag_plt = GoSubDag(goids, gosubdag.go2obj, rcntobj=gosubdag.rcntobj, **kws_plt) godagplot = GoSubDagPlot(gosubdag_plt, **kws_plt) godagplot.plt_dag(fout_img) return godagplot
python
def plt_goids(gosubdag, fout_img, goids, **kws_plt): """Plot GO IDs in a DAG (Directed Acyclic Graph).""" gosubdag_plt = GoSubDag(goids, gosubdag.go2obj, rcntobj=gosubdag.rcntobj, **kws_plt) godagplot = GoSubDagPlot(gosubdag_plt, **kws_plt) godagplot.plt_dag(fout_img) return godagplot
['def', 'plt_goids', '(', 'gosubdag', ',', 'fout_img', ',', 'goids', ',', '*', '*', 'kws_plt', ')', ':', 'gosubdag_plt', '=', 'GoSubDag', '(', 'goids', ',', 'gosubdag', '.', 'go2obj', ',', 'rcntobj', '=', 'gosubdag', '.', 'rcntobj', ',', '*', '*', 'kws_plt', ')', 'godagplot', '=', 'GoSubDagPlot', '(', 'gosubdag_plt', '...
Plot GO IDs in a DAG (Directed Acyclic Graph).
['Plot', 'GO', 'IDs', 'in', 'a', 'DAG', '(', 'Directed', 'Acyclic', 'Graph', ')', '.']
train
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/plot/plot.py#L55-L60
6,435
mozillazg/python-shanbay
shanbay/team.py
Team.forum_id
def forum_id(self): """小组发帖要用的 forum_id""" html = self.request(self.team_url).text soup = BeautifulSoup(html) return soup.find(id='forum_id').attrs['value']
python
def forum_id(self): """小组发帖要用的 forum_id""" html = self.request(self.team_url).text soup = BeautifulSoup(html) return soup.find(id='forum_id').attrs['value']
['def', 'forum_id', '(', 'self', ')', ':', 'html', '=', 'self', '.', 'request', '(', 'self', '.', 'team_url', ')', '.', 'text', 'soup', '=', 'BeautifulSoup', '(', 'html', ')', 'return', 'soup', '.', 'find', '(', 'id', '=', "'forum_id'", ')', '.', 'attrs', '[', "'value'", ']']
小组发帖要用的 forum_id
['小组发帖要用的', 'forum_id']
train
https://github.com/mozillazg/python-shanbay/blob/d505ba614dc13a36afce46969d13fc64e10dde0d/shanbay/team.py#L249-L253
6,436
shexSpec/grammar
parsers/python/pyshexc/parser_impl/shex_node_expression_parser.py
ShexNodeExpressionParser.visitIriRange
def visitIriRange(self, ctx: ShExDocParser.IriRangeContext): """ iriRange: iri (STEM_MARK iriExclusion*)? """ baseiri = self.context.iri_to_iriref(ctx.iri()) if not ctx.STEM_MARK(): vsvalue = baseiri # valueSetValue = objectValue / objectValue = IRI else: ...
python
def visitIriRange(self, ctx: ShExDocParser.IriRangeContext): """ iriRange: iri (STEM_MARK iriExclusion*)? """ baseiri = self.context.iri_to_iriref(ctx.iri()) if not ctx.STEM_MARK(): vsvalue = baseiri # valueSetValue = objectValue / objectValue = IRI else: ...
['def', 'visitIriRange', '(', 'self', ',', 'ctx', ':', 'ShExDocParser', '.', 'IriRangeContext', ')', ':', 'baseiri', '=', 'self', '.', 'context', '.', 'iri_to_iriref', '(', 'ctx', '.', 'iri', '(', ')', ')', 'if', 'not', 'ctx', '.', 'STEM_MARK', '(', ')', ':', 'vsvalue', '=', 'baseiri', '# valueSetValue = objectValue /...
iriRange: iri (STEM_MARK iriExclusion*)?
['iriRange', ':', 'iri', '(', 'STEM_MARK', 'iriExclusion', '*', ')', '?']
train
https://github.com/shexSpec/grammar/blob/4497cd1f73fa6703bca6e2cb53ba9c120f22e48c/parsers/python/pyshexc/parser_impl/shex_node_expression_parser.py#L86-L97
6,437
titusjan/argos
argos/repo/memoryrtis.py
ArrayRti.elementTypeName
def elementTypeName(self): """ String representation of the element type. """ if self._array is None: return super(ArrayRti, self).elementTypeName else: dtype = self._array.dtype return '<structured>' if dtype.names else str(dtype)
python
def elementTypeName(self): """ String representation of the element type. """ if self._array is None: return super(ArrayRti, self).elementTypeName else: dtype = self._array.dtype return '<structured>' if dtype.names else str(dtype)
['def', 'elementTypeName', '(', 'self', ')', ':', 'if', 'self', '.', '_array', 'is', 'None', ':', 'return', 'super', '(', 'ArrayRti', ',', 'self', ')', '.', 'elementTypeName', 'else', ':', 'dtype', '=', 'self', '.', '_array', '.', 'dtype', 'return', "'<structured>'", 'if', 'dtype', '.', 'names', 'else', 'str', '(', 'dt...
String representation of the element type.
['String', 'representation', 'of', 'the', 'element', 'type', '.']
train
https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/repo/memoryrtis.py#L328-L335
6,438
openstax/cnx-archive
cnxarchive/database.py
upsert_users_from_legacy_publication_trigger
def upsert_users_from_legacy_publication_trigger(plpy, td): """A compatibility trigger to upsert users from legacy persons table.""" modified_state = "OK" authors = td['new']['authors'] and td['new']['authors'] or [] maintainers = td['new']['maintainers'] and td['new']['maintainers'] or [] licensors...
python
def upsert_users_from_legacy_publication_trigger(plpy, td): """A compatibility trigger to upsert users from legacy persons table.""" modified_state = "OK" authors = td['new']['authors'] and td['new']['authors'] or [] maintainers = td['new']['maintainers'] and td['new']['maintainers'] or [] licensors...
['def', 'upsert_users_from_legacy_publication_trigger', '(', 'plpy', ',', 'td', ')', ':', 'modified_state', '=', '"OK"', 'authors', '=', 'td', '[', "'new'", ']', '[', "'authors'", ']', 'and', 'td', '[', "'new'", ']', '[', "'authors'", ']', 'or', '[', ']', 'maintainers', '=', 'td', '[', "'new'", ']', '[', "'maintainers'...
A compatibility trigger to upsert users from legacy persons table.
['A', 'compatibility', 'trigger', 'to', 'upsert', 'users', 'from', 'legacy', 'persons', 'table', '.']
train
https://github.com/openstax/cnx-archive/blob/d31d34aa8bbc8a9fde6cd4227a0df92726e8daf4/cnxarchive/database.py#L639-L670
6,439
rosenbrockc/fortpy
fortpy/interop/ftypes.py
_ctypes_out
def _ctypes_out(parameter): """Returns a parameter variable declaration for an output variable for the specified parameter. """ if (parameter.dimension is not None and ":" in parameter.dimension and "out" in parameter.direction and ("allocatable" in parameter.modifiers or ...
python
def _ctypes_out(parameter): """Returns a parameter variable declaration for an output variable for the specified parameter. """ if (parameter.dimension is not None and ":" in parameter.dimension and "out" in parameter.direction and ("allocatable" in parameter.modifiers or ...
['def', '_ctypes_out', '(', 'parameter', ')', ':', 'if', '(', 'parameter', '.', 'dimension', 'is', 'not', 'None', 'and', '":"', 'in', 'parameter', '.', 'dimension', 'and', '"out"', 'in', 'parameter', '.', 'direction', 'and', '(', '"allocatable"', 'in', 'parameter', '.', 'modifiers', 'or', '"pointer"', 'in', 'parameter'...
Returns a parameter variable declaration for an output variable for the specified parameter.
['Returns', 'a', 'parameter', 'variable', 'declaration', 'for', 'an', 'output', 'variable', 'for', 'the', 'specified', 'parameter', '.']
train
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L798-L808
6,440
secdev/scapy
scapy/layers/tls/extensions.py
TLS_Ext_PrettyPacketList._show_or_dump
def _show_or_dump(self, dump=False, indent=3, lvl="", label_lvl="", first_call=True): """ Reproduced from packet.py """ ct = AnsiColorTheme() if dump else conf.color_theme s = "%s%s %s %s \n" % (label_lvl, ct.punct("###["), ct.layer_name(self....
python
def _show_or_dump(self, dump=False, indent=3, lvl="", label_lvl="", first_call=True): """ Reproduced from packet.py """ ct = AnsiColorTheme() if dump else conf.color_theme s = "%s%s %s %s \n" % (label_lvl, ct.punct("###["), ct.layer_name(self....
['def', '_show_or_dump', '(', 'self', ',', 'dump', '=', 'False', ',', 'indent', '=', '3', ',', 'lvl', '=', '""', ',', 'label_lvl', '=', '""', ',', 'first_call', '=', 'True', ')', ':', 'ct', '=', 'AnsiColorTheme', '(', ')', 'if', 'dump', 'else', 'conf', '.', 'color_theme', 's', '=', '"%s%s %s %s \\n"', '%', '(', 'label_...
Reproduced from packet.py
['Reproduced', 'from', 'packet', '.', 'py']
train
https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/extensions.py#L96-L135
6,441
SBRG/ssbio
ssbio/pipeline/atlas.py
ATLAS.get_orthology_matrix
def get_orthology_matrix(self, pid_cutoff=None, bitscore_cutoff=None, evalue_cutoff=None, filter_condition='OR', remove_strains_with_no_orthology=True, remove_strains_with_no_differences=False, remove_genes_not_in_base_model=True): ...
python
def get_orthology_matrix(self, pid_cutoff=None, bitscore_cutoff=None, evalue_cutoff=None, filter_condition='OR', remove_strains_with_no_orthology=True, remove_strains_with_no_differences=False, remove_genes_not_in_base_model=True): ...
['def', 'get_orthology_matrix', '(', 'self', ',', 'pid_cutoff', '=', 'None', ',', 'bitscore_cutoff', '=', 'None', ',', 'evalue_cutoff', '=', 'None', ',', 'filter_condition', '=', "'OR'", ',', 'remove_strains_with_no_orthology', '=', 'True', ',', 'remove_strains_with_no_differences', '=', 'False', ',', 'remove_genes_not...
Create the orthology matrix by finding best bidirectional BLAST hits. Genes = rows, strains = columns Runs run_makeblastdb, run_bidirectional_blast, and calculate_bbh for protein sequences. Args: pid_cutoff (float): Minimum percent identity between BLAST hits to filter for in the range [0,...
['Create', 'the', 'orthology', 'matrix', 'by', 'finding', 'best', 'bidirectional', 'BLAST', 'hits', '.', 'Genes', '=', 'rows', 'strains', '=', 'columns']
train
https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/pipeline/atlas.py#L252-L318
6,442
caseyjlaw/rtpipe
rtpipe/parsecal.py
casa_sol.set_selection
def set_selection(self, time, freqs, blarr, calname='', radec=(), dist=1, spwind=[], pols=['XX','YY']): """ Set select parameter that defines time, spw, and pol solutions to apply. time defines the time to find solutions near in mjd. freqs defines frequencies to select bandpass solution ...
python
def set_selection(self, time, freqs, blarr, calname='', radec=(), dist=1, spwind=[], pols=['XX','YY']): """ Set select parameter that defines time, spw, and pol solutions to apply. time defines the time to find solutions near in mjd. freqs defines frequencies to select bandpass solution ...
['def', 'set_selection', '(', 'self', ',', 'time', ',', 'freqs', ',', 'blarr', ',', 'calname', '=', "''", ',', 'radec', '=', '(', ')', ',', 'dist', '=', '1', ',', 'spwind', '=', '[', ']', ',', 'pols', '=', '[', "'XX'", ',', "'YY'", ']', ')', ':', 'self', '.', 'spwind', '=', 'spwind', 'if', 'calname', ':', 'self', '.', ...
Set select parameter that defines time, spw, and pol solutions to apply. time defines the time to find solutions near in mjd. freqs defines frequencies to select bandpass solution blarr is array of size 2xnbl that gives pairs of antennas in each baseline (a la tpipe.blarr). radec (radian...
['Set', 'select', 'parameter', 'that', 'defines', 'time', 'spw', 'and', 'pol', 'solutions', 'to', 'apply', '.', 'time', 'defines', 'the', 'time', 'to', 'find', 'solutions', 'near', 'in', 'mjd', '.', 'freqs', 'defines', 'frequencies', 'to', 'select', 'bandpass', 'solution', 'blarr', 'is', 'array', 'of', 'size', '2xnbl',...
train
https://github.com/caseyjlaw/rtpipe/blob/ac33e4332cf215091a63afbb3137850876d73ec0/rtpipe/parsecal.py#L187-L237
6,443
yunojuno/elasticsearch-django
elasticsearch_django/models.py
SearchDocumentManagerMixin._raw_sql
def _raw_sql(self, values): """Prepare SQL statement consisting of a sequence of WHEN .. THEN statements.""" if isinstance(self.model._meta.pk, CharField): when_clauses = " ".join( [self._when("'{}'".format(x), y) for (x, y) in values] ) else: ...
python
def _raw_sql(self, values): """Prepare SQL statement consisting of a sequence of WHEN .. THEN statements.""" if isinstance(self.model._meta.pk, CharField): when_clauses = " ".join( [self._when("'{}'".format(x), y) for (x, y) in values] ) else: ...
['def', '_raw_sql', '(', 'self', ',', 'values', ')', ':', 'if', 'isinstance', '(', 'self', '.', 'model', '.', '_meta', '.', 'pk', ',', 'CharField', ')', ':', 'when_clauses', '=', '" "', '.', 'join', '(', '[', 'self', '.', '_when', '(', '"\'{}\'"', '.', 'format', '(', 'x', ')', ',', 'y', ')', 'for', '(', 'x', ',', 'y', ...
Prepare SQL statement consisting of a sequence of WHEN .. THEN statements.
['Prepare', 'SQL', 'statement', 'consisting', 'of', 'a', 'sequence', 'of', 'WHEN', '..', 'THEN', 'statements', '.']
train
https://github.com/yunojuno/elasticsearch-django/blob/e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489/elasticsearch_django/models.py#L138-L150
6,444
yymao/generic-catalog-reader
GCR/base.py
BaseGenericCatalog.get_input_kwargs
def get_input_kwargs(self, key=None, default=None): """ Deprecated. Use `get_catalog_info` instead. Get information from the catalog config file. If *key* is `None`, return the full dict. """ warnings.warn("`get_input_kwargs` is deprecated; use `get_catalog_info` instead...
python
def get_input_kwargs(self, key=None, default=None): """ Deprecated. Use `get_catalog_info` instead. Get information from the catalog config file. If *key* is `None`, return the full dict. """ warnings.warn("`get_input_kwargs` is deprecated; use `get_catalog_info` instead...
['def', 'get_input_kwargs', '(', 'self', ',', 'key', '=', 'None', ',', 'default', '=', 'None', ')', ':', 'warnings', '.', 'warn', '(', '"`get_input_kwargs` is deprecated; use `get_catalog_info` instead."', ',', 'DeprecationWarning', ')', 'return', 'self', '.', 'get_catalog_info', '(', 'key', ',', 'default', ')']
Deprecated. Use `get_catalog_info` instead. Get information from the catalog config file. If *key* is `None`, return the full dict.
['Deprecated', '.', 'Use', 'get_catalog_info', 'instead', '.']
train
https://github.com/yymao/generic-catalog-reader/blob/bc6267ac41b9f68106ed6065184469ac13fdc0b6/GCR/base.py#L162-L170
6,445
sassoftware/saspy
saspy/sasdata.py
SASdata.assessModel
def assessModel(self, target: str, prediction: str, nominal: bool = True, event: str = '', **kwargs): """ This method will calculate assessment measures using the SAS AA_Model_Eval Macro used for SAS Enterprise Miner. Not all datasets can be assessed. This is designed for scored data that includ...
python
def assessModel(self, target: str, prediction: str, nominal: bool = True, event: str = '', **kwargs): """ This method will calculate assessment measures using the SAS AA_Model_Eval Macro used for SAS Enterprise Miner. Not all datasets can be assessed. This is designed for scored data that includ...
['def', 'assessModel', '(', 'self', ',', 'target', ':', 'str', ',', 'prediction', ':', 'str', ',', 'nominal', ':', 'bool', '=', 'True', ',', 'event', ':', 'str', '=', "''", ',', '*', '*', 'kwargs', ')', ':', '# submit autocall macro', 'self', '.', 'sas', '.', 'submit', '(', '"%aamodel;"', ')', 'objtype', '=', '"dataste...
This method will calculate assessment measures using the SAS AA_Model_Eval Macro used for SAS Enterprise Miner. Not all datasets can be assessed. This is designed for scored data that includes a target and prediction columns TODO: add code example of build, score, and then assess :param target:...
['This', 'method', 'will', 'calculate', 'assessment', 'measures', 'using', 'the', 'SAS', 'AA_Model_Eval', 'Macro', 'used', 'for', 'SAS', 'Enterprise', 'Miner', '.', 'Not', 'all', 'datasets', 'can', 'be', 'assessed', '.', 'This', 'is', 'designed', 'for', 'scored', 'data', 'that', 'includes', 'a', 'target', 'and', 'predi...
train
https://github.com/sassoftware/saspy/blob/e433f71990f249d3a6c3db323ceb11cb2d462cf9/saspy/sasdata.py#L801-L910
6,446
senaite/senaite.core
bika/lims/controlpanel/bika_analysisservices.py
AnalysisServicesView.format_price
def format_price(self, price): """Formats the price with the set decimal mark and correct currency """ return u"{} {}{}{:02d}".format( self.currency_symbol, price[0], self.decimal_mark, price[1], )
python
def format_price(self, price): """Formats the price with the set decimal mark and correct currency """ return u"{} {}{}{:02d}".format( self.currency_symbol, price[0], self.decimal_mark, price[1], )
['def', 'format_price', '(', 'self', ',', 'price', ')', ':', 'return', 'u"{} {}{}{:02d}"', '.', 'format', '(', 'self', '.', 'currency_symbol', ',', 'price', '[', '0', ']', ',', 'self', '.', 'decimal_mark', ',', 'price', '[', '1', ']', ',', ')']
Formats the price with the set decimal mark and correct currency
['Formats', 'the', 'price', 'with', 'the', 'set', 'decimal', 'mark', 'and', 'correct', 'currency']
train
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/controlpanel/bika_analysisservices.py#L308-L316
6,447
openid/JWTConnect-Python-CryptoJWT
src/cryptojwt/jws/dsa.py
ECDSASigner._cross_check
def _cross_check(self, pub_key): """ In Ecdsa, both the key and the algorithm define the curve. Therefore, we must cross check them to make sure they're the same. :param key: :raises: ValueError is the curves are not the same """ if self.curve_name != pub_key.cur...
python
def _cross_check(self, pub_key): """ In Ecdsa, both the key and the algorithm define the curve. Therefore, we must cross check them to make sure they're the same. :param key: :raises: ValueError is the curves are not the same """ if self.curve_name != pub_key.cur...
['def', '_cross_check', '(', 'self', ',', 'pub_key', ')', ':', 'if', 'self', '.', 'curve_name', '!=', 'pub_key', '.', 'curve', '.', 'name', ':', 'raise', 'ValueError', '(', '"The curve in private key {} and in algorithm {} don\'t "', '"match"', '.', 'format', '(', 'pub_key', '.', 'curve', '.', 'name', ',', 'self', '.',...
In Ecdsa, both the key and the algorithm define the curve. Therefore, we must cross check them to make sure they're the same. :param key: :raises: ValueError is the curves are not the same
['In', 'Ecdsa', 'both', 'the', 'key', 'and', 'the', 'algorithm', 'define', 'the', 'curve', '.', 'Therefore', 'we', 'must', 'cross', 'check', 'them', 'to', 'make', 'sure', 'they', 're', 'the', 'same', '.']
train
https://github.com/openid/JWTConnect-Python-CryptoJWT/blob/8863cfbfe77ca885084870b234a66b55bd52930c/src/cryptojwt/jws/dsa.py#L87-L98
6,448
bitcraft/PyTMX
pytmx/pytmx.py
TiledMap.map_gid2
def map_gid2(self, tiled_gid): """ WIP. need to refactor the gid code :param tiled_gid: :return: """ tiled_gid = int(tiled_gid) # gidmap is a default dict, so cannot trust to raise KeyError if tiled_gid in self.gidmap: return self.gidmap[tiled_gid] ...
python
def map_gid2(self, tiled_gid): """ WIP. need to refactor the gid code :param tiled_gid: :return: """ tiled_gid = int(tiled_gid) # gidmap is a default dict, so cannot trust to raise KeyError if tiled_gid in self.gidmap: return self.gidmap[tiled_gid] ...
['def', 'map_gid2', '(', 'self', ',', 'tiled_gid', ')', ':', 'tiled_gid', '=', 'int', '(', 'tiled_gid', ')', '# gidmap is a default dict, so cannot trust to raise KeyError', 'if', 'tiled_gid', 'in', 'self', '.', 'gidmap', ':', 'return', 'self', '.', 'gidmap', '[', 'tiled_gid', ']', 'else', ':', 'gid', '=', 'self', '.',...
WIP. need to refactor the gid code :param tiled_gid: :return:
['WIP', '.', 'need', 'to', 'refactor', 'the', 'gid', 'code']
train
https://github.com/bitcraft/PyTMX/blob/3fb9788dd66ecfd0c8fa0e9f38c582337d89e1d9/pytmx/pytmx.py#L801-L814
6,449
apache/incubator-mxnet
python/mxnet/symbol/symbol.py
eye
def eye(N, M=0, k=0, dtype=None, **kwargs): """Returns a new symbol of 2-D shpae, filled with ones on the diagonal and zeros elsewhere. Parameters ---------- N: int Number of rows in the output. M: int, optional Number of columns in the output. If 0, defaults to N. k: int, optio...
python
def eye(N, M=0, k=0, dtype=None, **kwargs): """Returns a new symbol of 2-D shpae, filled with ones on the diagonal and zeros elsewhere. Parameters ---------- N: int Number of rows in the output. M: int, optional Number of columns in the output. If 0, defaults to N. k: int, optio...
['def', 'eye', '(', 'N', ',', 'M', '=', '0', ',', 'k', '=', '0', ',', 'dtype', '=', 'None', ',', '*', '*', 'kwargs', ')', ':', 'if', 'dtype', 'is', 'None', ':', 'dtype', '=', '_numpy', '.', 'float32', 'return', '_internal', '.', '_eye', '(', 'N', ',', 'M', ',', 'k', ',', 'dtype', '=', 'dtype', ',', '*', '*', 'kwargs', ...
Returns a new symbol of 2-D shpae, filled with ones on the diagonal and zeros elsewhere. Parameters ---------- N: int Number of rows in the output. M: int, optional Number of columns in the output. If 0, defaults to N. k: int, optional Index of the diagonal: 0 (the default) ...
['Returns', 'a', 'new', 'symbol', 'of', '2', '-', 'D', 'shpae', 'filled', 'with', 'ones', 'on', 'the', 'diagonal', 'and', 'zeros', 'elsewhere', '.']
train
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/symbol/symbol.py#L2962-L2985
6,450
Kautenja/nes-py
nes_py/nes_env.py
NESEnv.render
def render(self, mode='human'): """ Render the environment. Args: mode (str): the mode to render with: - human: render to the current display - rgb_array: Return an numpy.ndarray with shape (x, y, 3), representing RGB values for an x-by-y pixel ...
python
def render(self, mode='human'): """ Render the environment. Args: mode (str): the mode to render with: - human: render to the current display - rgb_array: Return an numpy.ndarray with shape (x, y, 3), representing RGB values for an x-by-y pixel ...
['def', 'render', '(', 'self', ',', 'mode', '=', "'human'", ')', ':', 'if', 'mode', '==', "'human'", ':', "# if the viewer isn't setup, import it and create one", 'if', 'self', '.', 'viewer', 'is', 'None', ':', 'from', '.', '_image_viewer', 'import', 'ImageViewer', '# get the caption for the ImageViewer', 'if', 'self',...
Render the environment. Args: mode (str): the mode to render with: - human: render to the current display - rgb_array: Return an numpy.ndarray with shape (x, y, 3), representing RGB values for an x-by-y pixel image Returns: a numpy array if...
['Render', 'the', 'environment', '.']
train
https://github.com/Kautenja/nes-py/blob/a113885198d418f38fcf24b8f79ac508975788c2/nes_py/nes_env.py#L347-L386
6,451
hydpy-dev/hydpy
hydpy/cythons/modelutils.py
PyxWriter.calculate_single_terms
def calculate_single_terms(self): """Lines of model method with the same name.""" lines = self._call_methods('calculate_single_terms', self.model.PART_ODE_METHODS) if lines: lines.insert(1, (' self.numvars.nmb_calls =' ...
python
def calculate_single_terms(self): """Lines of model method with the same name.""" lines = self._call_methods('calculate_single_terms', self.model.PART_ODE_METHODS) if lines: lines.insert(1, (' self.numvars.nmb_calls =' ...
['def', 'calculate_single_terms', '(', 'self', ')', ':', 'lines', '=', 'self', '.', '_call_methods', '(', "'calculate_single_terms'", ',', 'self', '.', 'model', '.', 'PART_ODE_METHODS', ')', 'if', 'lines', ':', 'lines', '.', 'insert', '(', '1', ',', '(', "' self.numvars.nmb_calls ='", "'self.numvars.nmb_calls+1'...
Lines of model method with the same name.
['Lines', 'of', 'model', 'method', 'with', 'the', 'same', 'name', '.']
train
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/cythons/modelutils.py#L818-L825
6,452
vlukes/dicom2fem
dicom2fem/ioutils.py
remove_files
def remove_files(root_dir): """ Remove all files and directories in supplied root directory. """ for dirpath, dirnames, filenames in os.walk(os.path.abspath(root_dir)): for filename in filenames: os.remove(os.path.join(root_dir, filename)) for dirname in dirnames: ...
python
def remove_files(root_dir): """ Remove all files and directories in supplied root directory. """ for dirpath, dirnames, filenames in os.walk(os.path.abspath(root_dir)): for filename in filenames: os.remove(os.path.join(root_dir, filename)) for dirname in dirnames: ...
['def', 'remove_files', '(', 'root_dir', ')', ':', 'for', 'dirpath', ',', 'dirnames', ',', 'filenames', 'in', 'os', '.', 'walk', '(', 'os', '.', 'path', '.', 'abspath', '(', 'root_dir', ')', ')', ':', 'for', 'filename', 'in', 'filenames', ':', 'os', '.', 'remove', '(', 'os', '.', 'path', '.', 'join', '(', 'root_dir', '...
Remove all files and directories in supplied root directory.
['Remove', 'all', 'files', 'and', 'directories', 'in', 'supplied', 'root', 'directory', '.']
train
https://github.com/vlukes/dicom2fem/blob/3056c977ca7119e01984d3aa0c4448a1c6c2430f/dicom2fem/ioutils.py#L50-L59
6,453
langloisjp/pysvcmetrics
statsdclient.py
StatsdClient.gauge
def gauge(self, stats, value): """ Log gauges >>> client = StatsdClient() >>> client.gauge('example.gauge', 47) >>> client.gauge(('example.gauge41', 'example.gauge43'), 47) """ self.update_stats(stats, value, self.SC_GAUGE)
python
def gauge(self, stats, value): """ Log gauges >>> client = StatsdClient() >>> client.gauge('example.gauge', 47) >>> client.gauge(('example.gauge41', 'example.gauge43'), 47) """ self.update_stats(stats, value, self.SC_GAUGE)
['def', 'gauge', '(', 'self', ',', 'stats', ',', 'value', ')', ':', 'self', '.', 'update_stats', '(', 'stats', ',', 'value', ',', 'self', '.', 'SC_GAUGE', ')']
Log gauges >>> client = StatsdClient() >>> client.gauge('example.gauge', 47) >>> client.gauge(('example.gauge41', 'example.gauge43'), 47)
['Log', 'gauges']
train
https://github.com/langloisjp/pysvcmetrics/blob/a126fc029ab645d9db46c0f5712c416cdf80e370/statsdclient.py#L40-L48
6,454
marshmallow-code/webargs
src/webargs/tornadoparser.py
TornadoParser.handle_error
def handle_error(self, error, req, schema, error_status_code, error_headers): """Handles errors during parsing. Raises a `tornado.web.HTTPError` with a 400 error. """ status_code = error_status_code or self.DEFAULT_VALIDATION_STATUS if status_code == 422: reason = "Un...
python
def handle_error(self, error, req, schema, error_status_code, error_headers): """Handles errors during parsing. Raises a `tornado.web.HTTPError` with a 400 error. """ status_code = error_status_code or self.DEFAULT_VALIDATION_STATUS if status_code == 422: reason = "Un...
['def', 'handle_error', '(', 'self', ',', 'error', ',', 'req', ',', 'schema', ',', 'error_status_code', ',', 'error_headers', ')', ':', 'status_code', '=', 'error_status_code', 'or', 'self', '.', 'DEFAULT_VALIDATION_STATUS', 'if', 'status_code', '==', '422', ':', 'reason', '=', '"Unprocessable Entity"', 'else', ':', 'r...
Handles errors during parsing. Raises a `tornado.web.HTTPError` with a 400 error.
['Handles', 'errors', 'during', 'parsing', '.', 'Raises', 'a', 'tornado', '.', 'web', '.', 'HTTPError', 'with', 'a', '400', 'error', '.']
train
https://github.com/marshmallow-code/webargs/blob/40cc2d25421d15d9630b1a819f1dcefbbf01ed95/src/webargs/tornadoparser.py#L122-L137
6,455
programa-stic/barf-project
barf/core/reil/reil.py
ReilInstruction.operands
def operands(self, value): """Set instruction operands. """ if len(value) != 3: raise Exception("Invalid instruction operands : %s" % str(value)) self._operands = value
python
def operands(self, value): """Set instruction operands. """ if len(value) != 3: raise Exception("Invalid instruction operands : %s" % str(value)) self._operands = value
['def', 'operands', '(', 'self', ',', 'value', ')', ':', 'if', 'len', '(', 'value', ')', '!=', '3', ':', 'raise', 'Exception', '(', '"Invalid instruction operands : %s"', '%', 'str', '(', 'value', ')', ')', 'self', '.', '_operands', '=', 'value']
Set instruction operands.
['Set', 'instruction', 'operands', '.']
train
https://github.com/programa-stic/barf-project/blob/18ed9e5eace55f7bf6015ec57f037c364099021c/barf/core/reil/reil.py#L272-L278
6,456
twilio/twilio-python
twilio/rest/autopilot/v1/assistant/__init__.py
AssistantContext.field_types
def field_types(self): """ Access the field_types :returns: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeList :rtype: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeList """ if self._field_types is None: self._field_types = FieldTypeList(sel...
python
def field_types(self): """ Access the field_types :returns: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeList :rtype: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeList """ if self._field_types is None: self._field_types = FieldTypeList(sel...
['def', 'field_types', '(', 'self', ')', ':', 'if', 'self', '.', '_field_types', 'is', 'None', ':', 'self', '.', '_field_types', '=', 'FieldTypeList', '(', 'self', '.', '_version', ',', 'assistant_sid', '=', 'self', '.', '_solution', '[', "'sid'", ']', ',', ')', 'return', 'self', '.', '_field_types']
Access the field_types :returns: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeList :rtype: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeList
['Access', 'the', 'field_types']
train
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/autopilot/v1/assistant/__init__.py#L328-L337
6,457
pyamg/pyamg
pyamg/util/utils.py
profile_solver
def profile_solver(ml, accel=None, **kwargs): """Profile a particular multilevel object. Parameters ---------- ml : multilevel Fully constructed multilevel object accel : function pointer Pointer to a valid Krylov solver (e.g. gmres, cg) Returns ------- residuals : arra...
python
def profile_solver(ml, accel=None, **kwargs): """Profile a particular multilevel object. Parameters ---------- ml : multilevel Fully constructed multilevel object accel : function pointer Pointer to a valid Krylov solver (e.g. gmres, cg) Returns ------- residuals : arra...
['def', 'profile_solver', '(', 'ml', ',', 'accel', '=', 'None', ',', '*', '*', 'kwargs', ')', ':', 'A', '=', 'ml', '.', 'levels', '[', '0', ']', '.', 'A', 'b', '=', 'A', '*', 'sp', '.', 'rand', '(', 'A', '.', 'shape', '[', '0', ']', ',', '1', ')', 'residuals', '=', '[', ']', 'if', 'accel', 'is', 'None', ':', 'ml', '.',...
Profile a particular multilevel object. Parameters ---------- ml : multilevel Fully constructed multilevel object accel : function pointer Pointer to a valid Krylov solver (e.g. gmres, cg) Returns ------- residuals : array Array of residuals for each iteration ...
['Profile', 'a', 'particular', 'multilevel', 'object', '.']
train
https://github.com/pyamg/pyamg/blob/89dc54aa27e278f65d2f54bdaf16ab97d7768fa6/pyamg/util/utils.py#L42-L89
6,458
tanghaibao/goatools
goatools/obo_parser.py
GOTerm.get_all_parents
def get_all_parents(self): """Return all parent GO IDs.""" all_parents = set() for parent in self.parents: all_parents.add(parent.item_id) all_parents |= parent.get_all_parents() return all_parents
python
def get_all_parents(self): """Return all parent GO IDs.""" all_parents = set() for parent in self.parents: all_parents.add(parent.item_id) all_parents |= parent.get_all_parents() return all_parents
['def', 'get_all_parents', '(', 'self', ')', ':', 'all_parents', '=', 'set', '(', ')', 'for', 'parent', 'in', 'self', '.', 'parents', ':', 'all_parents', '.', 'add', '(', 'parent', '.', 'item_id', ')', 'all_parents', '|=', 'parent', '.', 'get_all_parents', '(', ')', 'return', 'all_parents']
Return all parent GO IDs.
['Return', 'all', 'parent', 'GO', 'IDs', '.']
train
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/obo_parser.py#L205-L211
6,459
OnroerendErfgoed/crabpy_pyramid
crabpy_pyramid/renderers/crab.py
item_land_adapter
def item_land_adapter(obj, request): """ Adapter for rendering an item of :class: `pycountry.db.Data` to json. """ return { 'id': obj.alpha_2, 'alpha2': obj.alpha_2, 'alpha3': obj.alpha_3, 'naam': _(obj.name) }
python
def item_land_adapter(obj, request): """ Adapter for rendering an item of :class: `pycountry.db.Data` to json. """ return { 'id': obj.alpha_2, 'alpha2': obj.alpha_2, 'alpha3': obj.alpha_3, 'naam': _(obj.name) }
['def', 'item_land_adapter', '(', 'obj', ',', 'request', ')', ':', 'return', '{', "'id'", ':', 'obj', '.', 'alpha_2', ',', "'alpha2'", ':', 'obj', '.', 'alpha_2', ',', "'alpha3'", ':', 'obj', '.', 'alpha_3', ',', "'naam'", ':', '_', '(', 'obj', '.', 'name', ')', '}']
Adapter for rendering an item of :class: `pycountry.db.Data` to json.
['Adapter', 'for', 'rendering', 'an', 'item', 'of', ':', 'class', ':', 'pycountry', '.', 'db', '.', 'Data', 'to', 'json', '.']
train
https://github.com/OnroerendErfgoed/crabpy_pyramid/blob/b727ea55838d71575db96e987b536a0bac9f6a7a/crabpy_pyramid/renderers/crab.py#L504-L514
6,460
Microsoft/nni
examples/trials/ga_squad/trial.py
generate_data
def generate_data(path, tokenizer, char_vcb, word_vcb, is_training=False): ''' Generate data ''' global root_path qp_pairs = data.load_from_file(path=path, is_training=is_training) tokenized_sent = 0 # qp_pairs = qp_pairs[:1000]1 for qp_pair in qp_pairs: tokenized_sent += 1 ...
python
def generate_data(path, tokenizer, char_vcb, word_vcb, is_training=False): ''' Generate data ''' global root_path qp_pairs = data.load_from_file(path=path, is_training=is_training) tokenized_sent = 0 # qp_pairs = qp_pairs[:1000]1 for qp_pair in qp_pairs: tokenized_sent += 1 ...
['def', 'generate_data', '(', 'path', ',', 'tokenizer', ',', 'char_vcb', ',', 'word_vcb', ',', 'is_training', '=', 'False', ')', ':', 'global', 'root_path', 'qp_pairs', '=', 'data', '.', 'load_from_file', '(', 'path', '=', 'path', ',', 'is_training', '=', 'is_training', ')', 'tokenized_sent', '=', '0', '# qp_pairs = qp...
Generate data
['Generate', 'data']
train
https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/examples/trials/ga_squad/trial.py#L272-L299
6,461
numenta/htmresearch
projects/combined_sequences/combined_sequences.py
runExperiment5A
def runExperiment5A(dirName): """ This runs the first experiment in the section "Simulations with Sensorimotor Sequences", an example sensorimotor sequence. """ # Results are put into a pkl file which can be used to generate the plots. # dirName is the absolute path where the pkl file will be placed. resu...
python
def runExperiment5A(dirName): """ This runs the first experiment in the section "Simulations with Sensorimotor Sequences", an example sensorimotor sequence. """ # Results are put into a pkl file which can be used to generate the plots. # dirName is the absolute path where the pkl file will be placed. resu...
['def', 'runExperiment5A', '(', 'dirName', ')', ':', '# Results are put into a pkl file which can be used to generate the plots.', '# dirName is the absolute path where the pkl file will be placed.', 'resultsFilename', '=', 'os', '.', 'path', '.', 'join', '(', 'dirName', ',', '"sensorimotor_sequence_example.pkl"', ')',...
This runs the first experiment in the section "Simulations with Sensorimotor Sequences", an example sensorimotor sequence.
['This', 'runs', 'the', 'first', 'experiment', 'in', 'the', 'section', 'Simulations', 'with', 'Sensorimotor', 'Sequences', 'an', 'example', 'sensorimotor', 'sequence', '.']
train
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/projects/combined_sequences/combined_sequences.py#L759-L780
6,462
gem/oq-engine
openquake/hazardlib/gsim/cauzzi_faccioli_2008.py
CauzziFaccioli2008._get_stddevs
def _get_stddevs(self, C, stddev_types, num_sites): """ Return total standard deviation. """ stddevs = [] for stddev_type in stddev_types: assert stddev_type in self.DEFINED_FOR_STANDARD_DEVIATION_TYPES stddevs.append(np.log(10 ** C['sigma']) + np.zeros(nu...
python
def _get_stddevs(self, C, stddev_types, num_sites): """ Return total standard deviation. """ stddevs = [] for stddev_type in stddev_types: assert stddev_type in self.DEFINED_FOR_STANDARD_DEVIATION_TYPES stddevs.append(np.log(10 ** C['sigma']) + np.zeros(nu...
['def', '_get_stddevs', '(', 'self', ',', 'C', ',', 'stddev_types', ',', 'num_sites', ')', ':', 'stddevs', '=', '[', ']', 'for', 'stddev_type', 'in', 'stddev_types', ':', 'assert', 'stddev_type', 'in', 'self', '.', 'DEFINED_FOR_STANDARD_DEVIATION_TYPES', 'stddevs', '.', 'append', '(', 'np', '.', 'log', '(', '10', '**',...
Return total standard deviation.
['Return', 'total', 'standard', 'deviation', '.']
train
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/cauzzi_faccioli_2008.py#L177-L186
6,463
tensorpack/tensorpack
tensorpack/utils/utils.py
change_env
def change_env(name, val): """ Args: name(str), val(str): Returns: a context where the environment variable ``name`` being set to ``val``. It will be set back after the context exits. """ oldval = os.environ.get(name, None) os.environ[name] = val yield if oldval ...
python
def change_env(name, val): """ Args: name(str), val(str): Returns: a context where the environment variable ``name`` being set to ``val``. It will be set back after the context exits. """ oldval = os.environ.get(name, None) os.environ[name] = val yield if oldval ...
['def', 'change_env', '(', 'name', ',', 'val', ')', ':', 'oldval', '=', 'os', '.', 'environ', '.', 'get', '(', 'name', ',', 'None', ')', 'os', '.', 'environ', '[', 'name', ']', '=', 'val', 'yield', 'if', 'oldval', 'is', 'None', ':', 'del', 'os', '.', 'environ', '[', 'name', ']', 'else', ':', 'os', '.', 'environ', '[', ...
Args: name(str), val(str): Returns: a context where the environment variable ``name`` being set to ``val``. It will be set back after the context exits.
['Args', ':', 'name', '(', 'str', ')', 'val', '(', 'str', ')', ':']
train
https://github.com/tensorpack/tensorpack/blob/d7a13cb74c9066bc791d7aafc3b744b60ee79a9f/tensorpack/utils/utils.py#L69-L84
6,464
QUANTAXIS/QUANTAXIS
QUANTAXIS/QAData/base_datastruct.py
_quotation_base.reindex
def reindex(self, ind): """reindex Arguments: ind {[type]} -- [description] Raises: RuntimeError -- [description] RuntimeError -- [description] Returns: [type] -- [description] """ if isinstance(ind, pd.MultiIndex): ...
python
def reindex(self, ind): """reindex Arguments: ind {[type]} -- [description] Raises: RuntimeError -- [description] RuntimeError -- [description] Returns: [type] -- [description] """ if isinstance(ind, pd.MultiIndex): ...
['def', 'reindex', '(', 'self', ',', 'ind', ')', ':', 'if', 'isinstance', '(', 'ind', ',', 'pd', '.', 'MultiIndex', ')', ':', 'try', ':', 'return', 'self', '.', 'new', '(', 'self', '.', 'data', '.', 'reindex', '(', 'ind', ')', ')', 'except', ':', 'raise', 'RuntimeError', '(', "'QADATASTRUCT ERROR: CANNOT REINDEX'", ')'...
reindex Arguments: ind {[type]} -- [description] Raises: RuntimeError -- [description] RuntimeError -- [description] Returns: [type] -- [description]
['reindex']
train
https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAData/base_datastruct.py#L863-L885
6,465
ucsb-cs-education/hairball
hairball/plugins/checks.py
SaySoundSync.analyze
def analyze(self, scratch, **kwargs): """Categorize instances of attempted say and sound synchronization.""" errors = Counter() for script in self.iter_scripts(scratch): prev_name, prev_depth, prev_block = '', 0, script.blocks[0] gen = self.iter_blocks(script.blocks) ...
python
def analyze(self, scratch, **kwargs): """Categorize instances of attempted say and sound synchronization.""" errors = Counter() for script in self.iter_scripts(scratch): prev_name, prev_depth, prev_block = '', 0, script.blocks[0] gen = self.iter_blocks(script.blocks) ...
['def', 'analyze', '(', 'self', ',', 'scratch', ',', '*', '*', 'kwargs', ')', ':', 'errors', '=', 'Counter', '(', ')', 'for', 'script', 'in', 'self', '.', 'iter_scripts', '(', 'scratch', ')', ':', 'prev_name', ',', 'prev_depth', ',', 'prev_block', '=', "''", ',', '0', ',', 'script', '.', 'blocks', '[', '0', ']', 'gen',...
Categorize instances of attempted say and sound synchronization.
['Categorize', 'instances', 'of', 'attempted', 'say', 'and', 'sound', 'synchronization', '.']
train
https://github.com/ucsb-cs-education/hairball/blob/c6da8971f8a34e88ce401d36b51431715e1dff5b/hairball/plugins/checks.py#L203-L233
6,466
juju-solutions/charms.reactive
charms/reactive/decorators.py
_expand_endpoint_name
def _expand_endpoint_name(endpoint_name, flags): """ Populate any ``{endpoint_name}`` tags in the flag names for the given handler, based on the handlers module / file name. """ return tuple(flag.format(endpoint_name=endpoint_name) for flag in flags)
python
def _expand_endpoint_name(endpoint_name, flags): """ Populate any ``{endpoint_name}`` tags in the flag names for the given handler, based on the handlers module / file name. """ return tuple(flag.format(endpoint_name=endpoint_name) for flag in flags)
['def', '_expand_endpoint_name', '(', 'endpoint_name', ',', 'flags', ')', ':', 'return', 'tuple', '(', 'flag', '.', 'format', '(', 'endpoint_name', '=', 'endpoint_name', ')', 'for', 'flag', 'in', 'flags', ')']
Populate any ``{endpoint_name}`` tags in the flag names for the given handler, based on the handlers module / file name.
['Populate', 'any', '{', 'endpoint_name', '}', 'tags', 'in', 'the', 'flag', 'names', 'for', 'the', 'given', 'handler', 'based', 'on', 'the', 'handlers', 'module', '/', 'file', 'name', '.']
train
https://github.com/juju-solutions/charms.reactive/blob/e37e781432e77c12b63d2c739bd6cd70d3230c3a/charms/reactive/decorators.py#L289-L294
6,467
johnbywater/eventsourcing
eventsourcing/utils/cipher/aes.py
AESCipher.encrypt
def encrypt(self, plaintext): """Return ciphertext for given plaintext.""" # String to bytes. plainbytes = plaintext.encode('utf8') # Compress plaintext bytes. compressed = zlib.compress(plainbytes) # Construct AES-GCM cipher, with 96-bit nonce. cipher = AES.ne...
python
def encrypt(self, plaintext): """Return ciphertext for given plaintext.""" # String to bytes. plainbytes = plaintext.encode('utf8') # Compress plaintext bytes. compressed = zlib.compress(plainbytes) # Construct AES-GCM cipher, with 96-bit nonce. cipher = AES.ne...
['def', 'encrypt', '(', 'self', ',', 'plaintext', ')', ':', '# String to bytes.', 'plainbytes', '=', 'plaintext', '.', 'encode', '(', "'utf8'", ')', '# Compress plaintext bytes.', 'compressed', '=', 'zlib', '.', 'compress', '(', 'plainbytes', ')', '# Construct AES-GCM cipher, with 96-bit nonce.', 'cipher', '=', 'AES', ...
Return ciphertext for given plaintext.
['Return', 'ciphertext', 'for', 'given', 'plaintext', '.']
train
https://github.com/johnbywater/eventsourcing/blob/de2c22c653fdccf2f5ee96faea74453ff1847e42/eventsourcing/utils/cipher/aes.py#L24-L49
6,468
saltstack/salt
salt/modules/neutron.py
_auth
def _auth(profile=None): ''' Set up neutron credentials ''' if profile: credentials = __salt__['config.option'](profile) user = credentials['keystone.user'] password = credentials['keystone.password'] tenant = credentials['keystone.tenant'] auth_url = credentials[...
python
def _auth(profile=None): ''' Set up neutron credentials ''' if profile: credentials = __salt__['config.option'](profile) user = credentials['keystone.user'] password = credentials['keystone.password'] tenant = credentials['keystone.tenant'] auth_url = credentials[...
['def', '_auth', '(', 'profile', '=', 'None', ')', ':', 'if', 'profile', ':', 'credentials', '=', '__salt__', '[', "'config.option'", ']', '(', 'profile', ')', 'user', '=', 'credentials', '[', "'keystone.user'", ']', 'password', '=', 'credentials', '[', "'keystone.password'", ']', 'tenant', '=', 'credentials', '[', "'k...
Set up neutron credentials
['Set', 'up', 'neutron', 'credentials']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/neutron.py#L99-L153
6,469
apache/spark
python/pyspark/sql/functions.py
sequence
def sequence(start, stop, step=None): """ Generate a sequence of integers from `start` to `stop`, incrementing by `step`. If `step` is not set, incrementing by 1 if `start` is less than or equal to `stop`, otherwise -1. >>> df1 = spark.createDataFrame([(-2, 2)], ('C1', 'C2')) >>> df1.select(seq...
python
def sequence(start, stop, step=None): """ Generate a sequence of integers from `start` to `stop`, incrementing by `step`. If `step` is not set, incrementing by 1 if `start` is less than or equal to `stop`, otherwise -1. >>> df1 = spark.createDataFrame([(-2, 2)], ('C1', 'C2')) >>> df1.select(seq...
['def', 'sequence', '(', 'start', ',', 'stop', ',', 'step', '=', 'None', ')', ':', 'sc', '=', 'SparkContext', '.', '_active_spark_context', 'if', 'step', 'is', 'None', ':', 'return', 'Column', '(', 'sc', '.', '_jvm', '.', 'functions', '.', 'sequence', '(', '_to_java_column', '(', 'start', ')', ',', '_to_java_column', '...
Generate a sequence of integers from `start` to `stop`, incrementing by `step`. If `step` is not set, incrementing by 1 if `start` is less than or equal to `stop`, otherwise -1. >>> df1 = spark.createDataFrame([(-2, 2)], ('C1', 'C2')) >>> df1.select(sequence('C1', 'C2').alias('r')).collect() [Row(r...
['Generate', 'a', 'sequence', 'of', 'integers', 'from', 'start', 'to', 'stop', 'incrementing', 'by', 'step', '.', 'If', 'step', 'is', 'not', 'set', 'incrementing', 'by', '1', 'if', 'start', 'is', 'less', 'than', 'or', 'equal', 'to', 'stop', 'otherwise', '-', '1', '.']
train
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/functions.py#L2739-L2757
6,470
sobolevn/jinja2-git
jinja2_git.py
GitExtension.parse
def parse(self, parser): """Main method to render data into the template.""" lineno = next(parser.stream).lineno if parser.stream.skip_if('name:short'): parser.stream.skip(1) short = parser.parse_expression() else: short = nodes.Const(False) ...
python
def parse(self, parser): """Main method to render data into the template.""" lineno = next(parser.stream).lineno if parser.stream.skip_if('name:short'): parser.stream.skip(1) short = parser.parse_expression() else: short = nodes.Const(False) ...
['def', 'parse', '(', 'self', ',', 'parser', ')', ':', 'lineno', '=', 'next', '(', 'parser', '.', 'stream', ')', '.', 'lineno', 'if', 'parser', '.', 'stream', '.', 'skip_if', '(', "'name:short'", ')', ':', 'parser', '.', 'stream', '.', 'skip', '(', '1', ')', 'short', '=', 'parser', '.', 'parse_expression', '(', ')', 'e...
Main method to render data into the template.
['Main', 'method', 'to', 'render', 'data', 'into', 'the', 'template', '.']
train
https://github.com/sobolevn/jinja2-git/blob/2ef8ac30efc1d73db551aaae73b2fe214761f840/jinja2_git.py#L23-L34
6,471
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/__init__.py
MapModule.remove_rally
def remove_rally(self, key): '''remove a rally point''' a = key.split(' ') if a[0] != 'Rally' or len(a) != 2: print("Bad rally object %s" % key) return i = int(a[1]) self.mpstate.functions.process_stdin('rally remove %u' % i)
python
def remove_rally(self, key): '''remove a rally point''' a = key.split(' ') if a[0] != 'Rally' or len(a) != 2: print("Bad rally object %s" % key) return i = int(a[1]) self.mpstate.functions.process_stdin('rally remove %u' % i)
['def', 'remove_rally', '(', 'self', ',', 'key', ')', ':', 'a', '=', 'key', '.', 'split', '(', "' '", ')', 'if', 'a', '[', '0', ']', '!=', "'Rally'", 'or', 'len', '(', 'a', ')', '!=', '2', ':', 'print', '(', '"Bad rally object %s"', '%', 'key', ')', 'return', 'i', '=', 'int', '(', 'a', '[', '1', ']', ')', 'self', '.', ...
remove a rally point
['remove', 'a', 'rally', 'point']
train
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_map/__init__.py#L182-L189
6,472
blockstack/blockstack-core
blockstack/lib/c32.py
c32checkDecode
def c32checkDecode(c32data): """ >>> c32checkDecode('P2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKNRV9EJ7') (22, 'a46ff88886c2ef9762d970b4d2c63678835bd39d') >>> c32checkDecode('02J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKPVKG2CE') (0, 'a46ff88886c2ef9762d970b4d2c63678835bd39d') >>> c32checkDecode('Z2J6ZY48GV1EZ5V2V5RB...
python
def c32checkDecode(c32data): """ >>> c32checkDecode('P2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKNRV9EJ7') (22, 'a46ff88886c2ef9762d970b4d2c63678835bd39d') >>> c32checkDecode('02J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKPVKG2CE') (0, 'a46ff88886c2ef9762d970b4d2c63678835bd39d') >>> c32checkDecode('Z2J6ZY48GV1EZ5V2V5RB...
['def', 'c32checkDecode', '(', 'c32data', ')', ':', 'if', 'not', 're', '.', 'match', '(', "r'^['", '+', 'C32', '+', "']*$'", ',', 'c32data', ')', ':', 'raise', 'ValueError', '(', "'Must be c32 data'", ')', 'c32data', '=', 'c32normalize', '(', 'c32data', ')', 'data_hex', '=', 'c32decode', '(', 'c32data', '[', '1', ':', ...
>>> c32checkDecode('P2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKNRV9EJ7') (22, 'a46ff88886c2ef9762d970b4d2c63678835bd39d') >>> c32checkDecode('02J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKPVKG2CE') (0, 'a46ff88886c2ef9762d970b4d2c63678835bd39d') >>> c32checkDecode('Z2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR') (31, 'a46ff888...
['>>>', 'c32checkDecode', '(', 'P2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKNRV9EJ7', ')', '(', '22', 'a46ff88886c2ef9762d970b4d2c63678835bd39d', ')', '>>>', 'c32checkDecode', '(', '02J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKPVKG2CE', ')', '(', '0', 'a46ff88886c2ef9762d970b4d2c63678835bd39d', ')', '>>>', 'c32checkDecode', '(', 'Z2J6ZY48GV1...
train
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/c32.py#L333-L399
6,473
django-leonardo/django-leonardo
leonardo/module/media/admin/file/admin.py
FileAdmin.delete_view
def delete_view(self, request, object_id, extra_context=None): """ Overrides the default to enable redirecting to the directory view after deletion of a image. we need to fetch the object and find out who the parent is before super, because super will delete the object and make ...
python
def delete_view(self, request, object_id, extra_context=None): """ Overrides the default to enable redirecting to the directory view after deletion of a image. we need to fetch the object and find out who the parent is before super, because super will delete the object and make ...
['def', 'delete_view', '(', 'self', ',', 'request', ',', 'object_id', ',', 'extra_context', '=', 'None', ')', ':', 'parent_folder', '=', 'None', 'try', ':', 'obj', '=', 'self', '.', 'get_queryset', '(', 'request', ')', '.', 'get', '(', 'pk', '=', 'unquote', '(', 'object_id', ')', ')', 'parent_folder', '=', 'obj', '.', ...
Overrides the default to enable redirecting to the directory view after deletion of a image. we need to fetch the object and find out who the parent is before super, because super will delete the object and make it impossible to find out the parent folder to redirect to.
['Overrides', 'the', 'default', 'to', 'enable', 'redirecting', 'to', 'the', 'directory', 'view', 'after', 'deletion', 'of', 'a', 'image', '.']
train
https://github.com/django-leonardo/django-leonardo/blob/4b933e1792221a13b4028753d5f1d3499b0816d4/leonardo/module/media/admin/file/admin.py#L103-L138
6,474
loisaidasam/pyslack
pyslack/__init__.py
SlackClient._make_request
def _make_request(self, method, params): """Make request to API endpoint Note: Ignoring SSL cert validation due to intermittent failures http://requests.readthedocs.org/en/latest/user/advanced/#ssl-cert-verification """ if self.blocked_until is not None and \ dat...
python
def _make_request(self, method, params): """Make request to API endpoint Note: Ignoring SSL cert validation due to intermittent failures http://requests.readthedocs.org/en/latest/user/advanced/#ssl-cert-verification """ if self.blocked_until is not None and \ dat...
['def', '_make_request', '(', 'self', ',', 'method', ',', 'params', ')', ':', 'if', 'self', '.', 'blocked_until', 'is', 'not', 'None', 'and', 'datetime', '.', 'datetime', '.', 'utcnow', '(', ')', '<', 'self', '.', 'blocked_until', ':', 'raise', 'SlackError', '(', '"Too many requests - wait until {0}"', '.', 'format', '...
Make request to API endpoint Note: Ignoring SSL cert validation due to intermittent failures http://requests.readthedocs.org/en/latest/user/advanced/#ssl-cert-verification
['Make', 'request', 'to', 'API', 'endpoint']
train
https://github.com/loisaidasam/pyslack/blob/bce0dcbe830b95ba548b58c7ceea07923589a8ec/pyslack/__init__.py#L23-L49
6,475
RI-imaging/qpformat
qpformat/file_formats/single_hdf5_qpimage.py
SingleHdf5Qpimage.get_qpimage
def get_qpimage(self, idx=0): """Return background-corrected QPImage""" if self._bgdata: # The user has explicitly chosen different background data # using `get_qpimage_raw`. qpi = super(SingleHdf5Qpimage, self).get_qpimage() else: # We can use the...
python
def get_qpimage(self, idx=0): """Return background-corrected QPImage""" if self._bgdata: # The user has explicitly chosen different background data # using `get_qpimage_raw`. qpi = super(SingleHdf5Qpimage, self).get_qpimage() else: # We can use the...
['def', 'get_qpimage', '(', 'self', ',', 'idx', '=', '0', ')', ':', 'if', 'self', '.', '_bgdata', ':', '# The user has explicitly chosen different background data', '# using `get_qpimage_raw`.', 'qpi', '=', 'super', '(', 'SingleHdf5Qpimage', ',', 'self', ')', '.', 'get_qpimage', '(', ')', 'else', ':', '# We can use the...
Return background-corrected QPImage
['Return', 'background', '-', 'corrected', 'QPImage']
train
https://github.com/RI-imaging/qpformat/blob/364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb/qpformat/file_formats/single_hdf5_qpimage.py#L25-L42
6,476
rstoneback/pysat
pysat/_orbits.py
Orbits._equaBreaks
def _equaBreaks(self, orbit_index_period=24.): """Determine where breaks in an equatorial satellite orbit occur. Looks for negative gradients in local time (or longitude) as well as breaks in UT. Parameters ---------- orbit_index_period : float The change in...
python
def _equaBreaks(self, orbit_index_period=24.): """Determine where breaks in an equatorial satellite orbit occur. Looks for negative gradients in local time (or longitude) as well as breaks in UT. Parameters ---------- orbit_index_period : float The change in...
['def', '_equaBreaks', '(', 'self', ',', 'orbit_index_period', '=', '24.', ')', ':', 'if', 'self', '.', 'orbit_index', 'is', 'None', ':', 'raise', 'ValueError', '(', "'Orbit properties must be defined at '", '+', "'pysat.Instrument object instantiation.'", '+', "'See Instrument docs.'", ')', 'else', ':', 'try', ':', 's...
Determine where breaks in an equatorial satellite orbit occur. Looks for negative gradients in local time (or longitude) as well as breaks in UT. Parameters ---------- orbit_index_period : float The change in value of supplied index parameter for a single orbit
['Determine', 'where', 'breaks', 'in', 'an', 'equatorial', 'satellite', 'orbit', 'occur', '.']
train
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_orbits.py#L171-L300
6,477
flowersteam/explauto
explauto/models/pydmps/dmp_discrete.py
DMPs_discrete.gen_psi
def gen_psi(self, x): """Generates the activity of the basis functions for a given canonical system rollout. x float, array: the canonical system state or path """ if isinstance(x, np.ndarray): x = x[:,None] return np.exp(-self.h * (x - self.c)*...
python
def gen_psi(self, x): """Generates the activity of the basis functions for a given canonical system rollout. x float, array: the canonical system state or path """ if isinstance(x, np.ndarray): x = x[:,None] return np.exp(-self.h * (x - self.c)*...
['def', 'gen_psi', '(', 'self', ',', 'x', ')', ':', 'if', 'isinstance', '(', 'x', ',', 'np', '.', 'ndarray', ')', ':', 'x', '=', 'x', '[', ':', ',', 'None', ']', 'return', 'np', '.', 'exp', '(', '-', 'self', '.', 'h', '*', '(', 'x', '-', 'self', '.', 'c', ')', '**', '2', ')']
Generates the activity of the basis functions for a given canonical system rollout. x float, array: the canonical system state or path
['Generates', 'the', 'activity', 'of', 'the', 'basis', 'functions', 'for', 'a', 'given', 'canonical', 'system', 'rollout', '.', 'x', 'float', 'array', ':', 'the', 'canonical', 'system', 'state', 'or', 'path']
train
https://github.com/flowersteam/explauto/blob/cf0f81ecb9f6412f7276a95bd27359000e1e26b6/explauto/models/pydmps/dmp_discrete.py#L97-L106
6,478
osrg/ryu
ryu/services/protocols/bgp/core_managers/table_manager.py
TableCoreManager.import_single_vpn_path_to_all_vrfs
def import_single_vpn_path_to_all_vrfs(self, vpn_path, path_rts=None): """Imports *vpn_path* to qualifying VRF tables. Import RTs of VRF table is matched with RTs from *vpn4_path* and if we have any common RTs we import the path into VRF. """ LOG.debug('Importing path %s to qual...
python
def import_single_vpn_path_to_all_vrfs(self, vpn_path, path_rts=None): """Imports *vpn_path* to qualifying VRF tables. Import RTs of VRF table is matched with RTs from *vpn4_path* and if we have any common RTs we import the path into VRF. """ LOG.debug('Importing path %s to qual...
['def', 'import_single_vpn_path_to_all_vrfs', '(', 'self', ',', 'vpn_path', ',', 'path_rts', '=', 'None', ')', ':', 'LOG', '.', 'debug', '(', "'Importing path %s to qualifying VRFs'", ',', 'vpn_path', ')', '# If this path has no RTs we are done.', 'if', 'not', 'path_rts', ':', 'LOG', '.', 'info', '(', "'Encountered a p...
Imports *vpn_path* to qualifying VRF tables. Import RTs of VRF table is matched with RTs from *vpn4_path* and if we have any common RTs we import the path into VRF.
['Imports', '*', 'vpn_path', '*', 'to', 'qualifying', 'VRF', 'tables', '.']
train
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/bgp/core_managers/table_manager.py#L562-L615
6,479
tamasgal/km3pipe
km3pipe/shell.py
qsub
def qsub(script, job_name, dryrun=False, *args, **kwargs): """Submit a job via qsub.""" print("Preparing job script...") job_string = gen_job(script=script, job_name=job_name, *args, **kwargs) env = os.environ.copy() if dryrun: print( "This is a dry run! Here is the generated job...
python
def qsub(script, job_name, dryrun=False, *args, **kwargs): """Submit a job via qsub.""" print("Preparing job script...") job_string = gen_job(script=script, job_name=job_name, *args, **kwargs) env = os.environ.copy() if dryrun: print( "This is a dry run! Here is the generated job...
['def', 'qsub', '(', 'script', ',', 'job_name', ',', 'dryrun', '=', 'False', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'print', '(', '"Preparing job script..."', ')', 'job_string', '=', 'gen_job', '(', 'script', '=', 'script', ',', 'job_name', '=', 'job_name', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ...
Submit a job via qsub.
['Submit', 'a', 'job', 'via', 'qsub', '.']
train
https://github.com/tamasgal/km3pipe/blob/7a9b59ac899a28775b5bdc5d391d9a5340d08040/km3pipe/shell.py#L66-L82
6,480
fhcrc/taxtastic
taxtastic/taxtable.py
TaxNode.collapse
def collapse(self, remove=False): """ Move all ``sequence_ids`` in the subtree below this node to this node. If ``remove`` is True, nodes below this one are deleted from the taxonomy. """ descendants = iter(self) # Skip this node assert next(descendants) ...
python
def collapse(self, remove=False): """ Move all ``sequence_ids`` in the subtree below this node to this node. If ``remove`` is True, nodes below this one are deleted from the taxonomy. """ descendants = iter(self) # Skip this node assert next(descendants) ...
['def', 'collapse', '(', 'self', ',', 'remove', '=', 'False', ')', ':', 'descendants', '=', 'iter', '(', 'self', ')', '# Skip this node', 'assert', 'next', '(', 'descendants', ')', 'is', 'self', 'for', 'descendant', 'in', 'descendants', ':', 'self', '.', 'sequence_ids', '.', 'update', '(', 'descendant', '.', 'sequence_...
Move all ``sequence_ids`` in the subtree below this node to this node. If ``remove`` is True, nodes below this one are deleted from the taxonomy.
['Move', 'all', 'sequence_ids', 'in', 'the', 'subtree', 'below', 'this', 'node', 'to', 'this', 'node', '.']
train
https://github.com/fhcrc/taxtastic/blob/4e874b7f2cc146178828bfba386314f8c342722b/taxtastic/taxtable.py#L235-L251
6,481
bcbio/bcbio-nextgen
bcbio/cwl/create.py
_cwl_workflow_template
def _cwl_workflow_template(inputs, top_level=False): """Retrieve CWL inputs shared amongst different workflows. """ ready_inputs = [] for inp in inputs: cur_inp = copy.deepcopy(inp) for attr in ["source", "valueFrom", "wf_duplicate"]: cur_inp.pop(attr, None) if top_le...
python
def _cwl_workflow_template(inputs, top_level=False): """Retrieve CWL inputs shared amongst different workflows. """ ready_inputs = [] for inp in inputs: cur_inp = copy.deepcopy(inp) for attr in ["source", "valueFrom", "wf_duplicate"]: cur_inp.pop(attr, None) if top_le...
['def', '_cwl_workflow_template', '(', 'inputs', ',', 'top_level', '=', 'False', ')', ':', 'ready_inputs', '=', '[', ']', 'for', 'inp', 'in', 'inputs', ':', 'cur_inp', '=', 'copy', '.', 'deepcopy', '(', 'inp', ')', 'for', 'attr', 'in', '[', '"source"', ',', '"valueFrom"', ',', '"wf_duplicate"', ']', ':', 'cur_inp', '.'...
Retrieve CWL inputs shared amongst different workflows.
['Retrieve', 'CWL', 'inputs', 'shared', 'amongst', 'different', 'workflows', '.']
train
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/create.py#L42-L63
6,482
PythonCharmers/python-future
src/future/backports/email/message.py
Message.values
def values(self): """Return a list of all the message's header values. These will be sorted in the order they appeared in the original message, or were added to the message, and may contain duplicates. Any fields deleted and re-inserted are always appended to the header list. ...
python
def values(self): """Return a list of all the message's header values. These will be sorted in the order they appeared in the original message, or were added to the message, and may contain duplicates. Any fields deleted and re-inserted are always appended to the header list. ...
['def', 'values', '(', 'self', ')', ':', 'return', '[', 'self', '.', 'policy', '.', 'header_fetch_parse', '(', 'k', ',', 'v', ')', 'for', 'k', ',', 'v', 'in', 'self', '.', '_headers', ']']
Return a list of all the message's header values. These will be sorted in the order they appeared in the original message, or were added to the message, and may contain duplicates. Any fields deleted and re-inserted are always appended to the header list.
['Return', 'a', 'list', 'of', 'all', 'the', 'message', 's', 'header', 'values', '.']
train
https://github.com/PythonCharmers/python-future/blob/c423752879acc05eebc29b0bb9909327bd5c7308/src/future/backports/email/message.py#L395-L404
6,483
kobejohn/PQHelper
pqhelper/base.py
StateInvestigator._board_from_game_image
def _board_from_game_image(self, game_image): """Return a board object matching the board in the game image. Return None if any tiles are not identified. """ # board image board_rect = self._board_tools['board_region'].region_in(game_image) t, l, b, r = board_rect ...
python
def _board_from_game_image(self, game_image): """Return a board object matching the board in the game image. Return None if any tiles are not identified. """ # board image board_rect = self._board_tools['board_region'].region_in(game_image) t, l, b, r = board_rect ...
['def', '_board_from_game_image', '(', 'self', ',', 'game_image', ')', ':', '# board image', 'board_rect', '=', 'self', '.', '_board_tools', '[', "'board_region'", ']', '.', 'region_in', '(', 'game_image', ')', 't', ',', 'l', ',', 'b', ',', 'r', '=', 'board_rect', 'board_image', '=', 'game_image', '[', 't', ':', 'b', '...
Return a board object matching the board in the game image. Return None if any tiles are not identified.
['Return', 'a', 'board', 'object', 'matching', 'the', 'board', 'in', 'the', 'game', 'image', '.', 'Return', 'None', 'if', 'any', 'tiles', 'are', 'not', 'identified', '.']
train
https://github.com/kobejohn/PQHelper/blob/d2b78a22dcb631794295e6a159b06f39c3f10db6/pqhelper/base.py#L160-L179
6,484
bwohlberg/sporco
docs/source/docntbk.py
script_and_notebook_to_rst
def script_and_notebook_to_rst(spth, npth, rpth): """ Convert a script and the corresponding executed notebook to rst. The script is converted to notebook format *without* replacement of sphinx cross-references with links to online docs, and the resulting markdown cells are inserted into the execute...
python
def script_and_notebook_to_rst(spth, npth, rpth): """ Convert a script and the corresponding executed notebook to rst. The script is converted to notebook format *without* replacement of sphinx cross-references with links to online docs, and the resulting markdown cells are inserted into the execute...
['def', 'script_and_notebook_to_rst', '(', 'spth', ',', 'npth', ',', 'rpth', ')', ':', '# Read entire text of script at spth', 'with', 'open', '(', 'spth', ')', 'as', 'f', ':', 'stxt', '=', 'f', '.', 'read', '(', ')', '# Process script text', 'stxt', '=', 'preprocess_script_string', '(', 'stxt', ')', '# Convert script ...
Convert a script and the corresponding executed notebook to rst. The script is converted to notebook format *without* replacement of sphinx cross-references with links to online docs, and the resulting markdown cells are inserted into the executed notebook, which is then converted to rst.
['Convert', 'a', 'script', 'and', 'the', 'corresponding', 'executed', 'notebook', 'to', 'rst', '.', 'The', 'script', 'is', 'converted', 'to', 'notebook', 'format', '*', 'without', '*', 'replacement', 'of', 'sphinx', 'cross', '-', 'references', 'with', 'links', 'to', 'online', 'docs', 'and', 'the', 'resulting', 'markdow...
train
https://github.com/bwohlberg/sporco/blob/8946a04331106f4e39904fbdf2dc7351900baa04/docs/source/docntbk.py#L555-L583
6,485
inasafe/inasafe
safe/gis/generic_expressions.py
inasafe_analysis_summary_field_value
def inasafe_analysis_summary_field_value(field, feature, parent): """Retrieve a value from a field in the analysis summary layer. e.g. inasafe_analysis_summary_field_value('total_not_exposed') -> 3 """ _ = feature, parent # NOQA project_context_scope = QgsExpressionContextUtils.projectScope( ...
python
def inasafe_analysis_summary_field_value(field, feature, parent): """Retrieve a value from a field in the analysis summary layer. e.g. inasafe_analysis_summary_field_value('total_not_exposed') -> 3 """ _ = feature, parent # NOQA project_context_scope = QgsExpressionContextUtils.projectScope( ...
['def', 'inasafe_analysis_summary_field_value', '(', 'field', ',', 'feature', ',', 'parent', ')', ':', '_', '=', 'feature', ',', 'parent', '# NOQA', 'project_context_scope', '=', 'QgsExpressionContextUtils', '.', 'projectScope', '(', 'QgsProject', '.', 'instance', '(', ')', ')', 'registry', '=', 'QgsProject', '.', 'ins...
Retrieve a value from a field in the analysis summary layer. e.g. inasafe_analysis_summary_field_value('total_not_exposed') -> 3
['Retrieve', 'a', 'value', 'from', 'a', 'field', 'in', 'the', 'analysis', 'summary', 'layer', '.']
train
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gis/generic_expressions.py#L50-L74
6,486
stephantul/somber
somber/sequential.py
RecursiveMixin.forward
def forward(self, x, **kwargs): """ Perform a forward pass through the network. The forward pass in recursive som is based on a combination between the activation in the last time-step and the current time-step. Parameters ---------- x : numpy array ...
python
def forward(self, x, **kwargs): """ Perform a forward pass through the network. The forward pass in recursive som is based on a combination between the activation in the last time-step and the current time-step. Parameters ---------- x : numpy array ...
['def', 'forward', '(', 'self', ',', 'x', ',', '*', '*', 'kwargs', ')', ':', 'prev', '=', 'kwargs', '[', "'prev_activation'", ']', '# Differences is the components of the weights subtracted from', '# the weight vector.', 'distance_x', ',', 'diff_x', '=', 'self', '.', 'distance_function', '(', 'x', ',', 'self', '.', 'we...
Perform a forward pass through the network. The forward pass in recursive som is based on a combination between the activation in the last time-step and the current time-step. Parameters ---------- x : numpy array The input data. prev_activation : numpy arra...
['Perform', 'a', 'forward', 'pass', 'through', 'the', 'network', '.']
train
https://github.com/stephantul/somber/blob/b7a13e646239500cc393668c01a7169c3e50b7b5/somber/sequential.py#L167-L200
6,487
letuananh/chirptext
chirptext/deko.py
MeCabToken.pos3
def pos3(self): ''' Use pos-sc1-sc2 as POS ''' parts = [self.pos] if self.sc1 and self.sc1 != '*': parts.append(self.sc1) if self.sc2 and self.sc2 != '*': parts.append(self.sc2) return '-'.join(parts)
python
def pos3(self): ''' Use pos-sc1-sc2 as POS ''' parts = [self.pos] if self.sc1 and self.sc1 != '*': parts.append(self.sc1) if self.sc2 and self.sc2 != '*': parts.append(self.sc2) return '-'.join(parts)
['def', 'pos3', '(', 'self', ')', ':', 'parts', '=', '[', 'self', '.', 'pos', ']', 'if', 'self', '.', 'sc1', 'and', 'self', '.', 'sc1', '!=', "'*'", ':', 'parts', '.', 'append', '(', 'self', '.', 'sc1', ')', 'if', 'self', '.', 'sc2', 'and', 'self', '.', 'sc2', '!=', "'*'", ':', 'parts', '.', 'append', '(', 'self', '.',...
Use pos-sc1-sc2 as POS
['Use', 'pos', '-', 'sc1', '-', 'sc2', 'as', 'POS']
train
https://github.com/letuananh/chirptext/blob/ce60b47257b272a587c8703ea1f86cd1a45553a7/chirptext/deko.py#L113-L120
6,488
ga4gh/ga4gh-client
ga4gh/client/client.py
AbstractClient.search_individuals
def search_individuals(self, dataset_id, name=None): """ Returns an iterator over the Individuals fulfilling the specified conditions. :param str dataset_id: The dataset to search within. :param str name: Only Individuals matching the specified name will be returned....
python
def search_individuals(self, dataset_id, name=None): """ Returns an iterator over the Individuals fulfilling the specified conditions. :param str dataset_id: The dataset to search within. :param str name: Only Individuals matching the specified name will be returned....
['def', 'search_individuals', '(', 'self', ',', 'dataset_id', ',', 'name', '=', 'None', ')', ':', 'request', '=', 'protocol', '.', 'SearchIndividualsRequest', '(', ')', 'request', '.', 'dataset_id', '=', 'dataset_id', 'request', '.', 'name', '=', 'pb', '.', 'string', '(', 'name', ')', 'request', '.', 'page_size', '=', ...
Returns an iterator over the Individuals fulfilling the specified conditions. :param str dataset_id: The dataset to search within. :param str name: Only Individuals matching the specified name will be returned. :return: An iterator over the :class:`ga4gh.protocol.Biosample` ...
['Returns', 'an', 'iterator', 'over', 'the', 'Individuals', 'fulfilling', 'the', 'specified', 'conditions', '.']
train
https://github.com/ga4gh/ga4gh-client/blob/d23b00b89112ef0930d45ee75aa3c6de3db615c5/ga4gh/client/client.py#L676-L692
6,489
StackStorm/pybind
pybind/slxos/v17s_1_02/qos_mpls/map_apply/__init__.py
map_apply._set_apply_exp_dscp_map_name
def _set_apply_exp_dscp_map_name(self, v, load=False): """ Setter method for apply_exp_dscp_map_name, mapped from YANG variable /qos_mpls/map_apply/apply_exp_dscp_map_name (container) If this variable is read-only (config: false) in the source YANG file, then _set_apply_exp_dscp_map_name is considered a...
python
def _set_apply_exp_dscp_map_name(self, v, load=False): """ Setter method for apply_exp_dscp_map_name, mapped from YANG variable /qos_mpls/map_apply/apply_exp_dscp_map_name (container) If this variable is read-only (config: false) in the source YANG file, then _set_apply_exp_dscp_map_name is considered a...
['def', '_set_apply_exp_dscp_map_name', '(', 'self', ',', 'v', ',', 'load', '=', 'False', ')', ':', 'if', 'hasattr', '(', 'v', ',', '"_utype"', ')', ':', 'v', '=', 'v', '.', '_utype', '(', 'v', ')', 'try', ':', 't', '=', 'YANGDynClass', '(', 'v', ',', 'base', '=', 'apply_exp_dscp_map_name', '.', 'apply_exp_dscp_map_nam...
Setter method for apply_exp_dscp_map_name, mapped from YANG variable /qos_mpls/map_apply/apply_exp_dscp_map_name (container) If this variable is read-only (config: false) in the source YANG file, then _set_apply_exp_dscp_map_name is considered as a private method. Backends looking to populate this variable ...
['Setter', 'method', 'for', 'apply_exp_dscp_map_name', 'mapped', 'from', 'YANG', 'variable', '/', 'qos_mpls', '/', 'map_apply', '/', 'apply_exp_dscp_map_name', '(', 'container', ')', 'If', 'this', 'variable', 'is', 'read', '-', 'only', '(', 'config', ':', 'false', ')', 'in', 'the', 'source', 'YANG', 'file', 'then', '_s...
train
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17s_1_02/qos_mpls/map_apply/__init__.py#L199-L220
6,490
pantsbuild/pants
src/python/pants/net/http/fetcher.py
Fetcher.fetch
def fetch(self, url, listener, chunk_size_bytes=None, timeout_secs=None): """Fetches data from the given URL notifying listener of all lifecycle events. :param string url: the url to GET data from :param listener: the listener to notify of all download lifecycle events :param chunk_size_bytes: the chun...
python
def fetch(self, url, listener, chunk_size_bytes=None, timeout_secs=None): """Fetches data from the given URL notifying listener of all lifecycle events. :param string url: the url to GET data from :param listener: the listener to notify of all download lifecycle events :param chunk_size_bytes: the chun...
['def', 'fetch', '(', 'self', ',', 'url', ',', 'listener', ',', 'chunk_size_bytes', '=', 'None', ',', 'timeout_secs', '=', 'None', ')', ':', 'if', 'not', 'isinstance', '(', 'listener', ',', 'self', '.', 'Listener', ')', ':', 'raise', 'ValueError', '(', "'listener must be a Listener instance, given {}'", '.', 'format', ...
Fetches data from the given URL notifying listener of all lifecycle events. :param string url: the url to GET data from :param listener: the listener to notify of all download lifecycle events :param chunk_size_bytes: the chunk size to use for buffering data, 10 KB by default :param timeout_secs: the m...
['Fetches', 'data', 'from', 'the', 'given', 'URL', 'notifying', 'listener', 'of', 'all', 'lifecycle', 'events', '.']
train
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/net/http/fetcher.py#L327-L356
6,491
hyperledger/sawtooth-core
validator/sawtooth_validator/gossip/gossip.py
Gossip.add_candidate_peer_endpoints
def add_candidate_peer_endpoints(self, peer_endpoints): """Adds candidate endpoints to the list of endpoints to attempt to peer with. Args: peer_endpoints ([str]): A list of public uri's which the validator can attempt to peer with. """ if self._topol...
python
def add_candidate_peer_endpoints(self, peer_endpoints): """Adds candidate endpoints to the list of endpoints to attempt to peer with. Args: peer_endpoints ([str]): A list of public uri's which the validator can attempt to peer with. """ if self._topol...
['def', 'add_candidate_peer_endpoints', '(', 'self', ',', 'peer_endpoints', ')', ':', 'if', 'self', '.', '_topology', ':', 'self', '.', '_topology', '.', 'add_candidate_peer_endpoints', '(', 'peer_endpoints', ')', 'else', ':', 'LOGGER', '.', 'debug', '(', '"Could not add peer endpoints to topology. "', '"ConnectionMana...
Adds candidate endpoints to the list of endpoints to attempt to peer with. Args: peer_endpoints ([str]): A list of public uri's which the validator can attempt to peer with.
['Adds', 'candidate', 'endpoints', 'to', 'the', 'list', 'of', 'endpoints', 'to', 'attempt', 'to', 'peer', 'with', '.']
train
https://github.com/hyperledger/sawtooth-core/blob/8cf473bc2207e51f02bd182d825158a57d72b098/validator/sawtooth_validator/gossip/gossip.py#L179-L191
6,492
phac-nml/sistr_cmd
sistr/src/writers.py
flatten_dict
def flatten_dict(x): """Flatten a dict Flatten an arbitrarily nested dict as output by to_dict .. note:: Keys in the flattened dict may get very long. Args: x (dict): Arbitrarily nested dict (maybe resembling a tree) with literal/scalar leaf values Retu...
python
def flatten_dict(x): """Flatten a dict Flatten an arbitrarily nested dict as output by to_dict .. note:: Keys in the flattened dict may get very long. Args: x (dict): Arbitrarily nested dict (maybe resembling a tree) with literal/scalar leaf values Retu...
['def', 'flatten_dict', '(', 'x', ')', ':', 'out', '=', '{', '}', 'for', 'k', ',', 'v', 'in', 'x', '.', 'items', '(', ')', ':', 'out', '=', '_recur_flatten', '(', 'k', ',', 'v', ',', 'out', ')', 'return', 'out']
Flatten a dict Flatten an arbitrarily nested dict as output by to_dict .. note:: Keys in the flattened dict may get very long. Args: x (dict): Arbitrarily nested dict (maybe resembling a tree) with literal/scalar leaf values Returns: dict: flattened...
['Flatten', 'a', 'dict', 'Flatten', 'an', 'arbitrarily', 'nested', 'dict', 'as', 'output', 'by', 'to_dict', '..', 'note', '::', 'Keys', 'in', 'the', 'flattened', 'dict', 'may', 'get', 'very', 'long', '.', 'Args', ':', 'x', '(', 'dict', ')', ':', 'Arbitrarily', 'nested', 'dict', '(', 'maybe', 'resembling', 'a', 'tree', ...
train
https://github.com/phac-nml/sistr_cmd/blob/4630fae72439723b354a94b94fbe76ad2f9f6295/sistr/src/writers.py#L110-L128
6,493
openthread/openthread
tools/harness-automation/autothreadharness/open_thread_controller.py
OpenThreadController.run
def run(self): """Threading callback""" self.viewing = True while self.viewing and self._lock.acquire(): try: line = self._readline() except: pass else: logger.info(line) self._lock.release() ...
python
def run(self): """Threading callback""" self.viewing = True while self.viewing and self._lock.acquire(): try: line = self._readline() except: pass else: logger.info(line) self._lock.release() ...
['def', 'run', '(', 'self', ')', ':', 'self', '.', 'viewing', '=', 'True', 'while', 'self', '.', 'viewing', 'and', 'self', '.', '_lock', '.', 'acquire', '(', ')', ':', 'try', ':', 'line', '=', 'self', '.', '_readline', '(', ')', 'except', ':', 'pass', 'else', ':', 'logger', '.', 'info', '(', 'line', ')', 'self', '.', '...
Threading callback
['Threading', 'callback']
train
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/open_thread_controller.py#L234-L246
6,494
jepegit/cellpy
cellpy/utils/batch_tools/batch_core.py
Doer.info
def info(self): """Delivers some info to you about the class.""" print("Sorry, but I don't have much to share.") print("This is me:") print(self) print("And these are the experiments assigned to me:") print(self.experiments)
python
def info(self): """Delivers some info to you about the class.""" print("Sorry, but I don't have much to share.") print("This is me:") print(self) print("And these are the experiments assigned to me:") print(self.experiments)
['def', 'info', '(', 'self', ')', ':', 'print', '(', '"Sorry, but I don\'t have much to share."', ')', 'print', '(', '"This is me:"', ')', 'print', '(', 'self', ')', 'print', '(', '"And these are the experiments assigned to me:"', ')', 'print', '(', 'self', '.', 'experiments', ')']
Delivers some info to you about the class.
['Delivers', 'some', 'info', 'to', 'you', 'about', 'the', 'class', '.']
train
https://github.com/jepegit/cellpy/blob/9f4a84cdd11f72cfa02cda8c2d7b5174abbb7370/cellpy/utils/batch_tools/batch_core.py#L46-L53
6,495
quantumlib/Cirq
cirq/optimizers/merge_interactions.py
MergeInteractions._op_to_matrix
def _op_to_matrix(self, op: Optional[ops.Operation], qubits: Tuple[ops.Qid, ...] ) -> Optional[np.ndarray]: """Determines the effect of an operation on the given qubits. If the operation is a 1-qubit operation on one of the given qubits,...
python
def _op_to_matrix(self, op: Optional[ops.Operation], qubits: Tuple[ops.Qid, ...] ) -> Optional[np.ndarray]: """Determines the effect of an operation on the given qubits. If the operation is a 1-qubit operation on one of the given qubits,...
['def', '_op_to_matrix', '(', 'self', ',', 'op', ':', 'Optional', '[', 'ops', '.', 'Operation', ']', ',', 'qubits', ':', 'Tuple', '[', 'ops', '.', 'Qid', ',', '...', ']', ')', '->', 'Optional', '[', 'np', '.', 'ndarray', ']', ':', 'q1', ',', 'q2', '=', 'qubits', 'matrix', '=', 'protocols', '.', 'unitary', '(', 'op', ',...
Determines the effect of an operation on the given qubits. If the operation is a 1-qubit operation on one of the given qubits, or a 2-qubit operation on both of the given qubits, and also the operation has a known matrix, then a matrix is returned. Otherwise None is returned. A...
['Determines', 'the', 'effect', 'of', 'an', 'operation', 'on', 'the', 'given', 'qubits', '.']
train
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/cirq/optimizers/merge_interactions.py#L90-L125
6,496
csparpa/pyowm
pyowm/weatherapi25/owm25.py
OWM25.weather_history_at_place
def weather_history_at_place(self, name, start=None, end=None): """ Queries the OWM Weather API for weather history for the specified location (eg: "London,uk"). A list of *Weather* objects is returned. It is possible to query for weather history in a closed time period, whose bo...
python
def weather_history_at_place(self, name, start=None, end=None): """ Queries the OWM Weather API for weather history for the specified location (eg: "London,uk"). A list of *Weather* objects is returned. It is possible to query for weather history in a closed time period, whose bo...
['def', 'weather_history_at_place', '(', 'self', ',', 'name', ',', 'start', '=', 'None', ',', 'end', '=', 'None', ')', ':', 'assert', 'isinstance', '(', 'name', ',', 'str', ')', ',', '"Value must be a string"', 'encoded_name', '=', 'name', 'params', '=', '{', "'q'", ':', 'encoded_name', ',', "'lang'", ':', 'self', '.',...
Queries the OWM Weather API for weather history for the specified location (eg: "London,uk"). A list of *Weather* objects is returned. It is possible to query for weather history in a closed time period, whose boundaries can be passed as optional parameters. :param name: the location's ...
['Queries', 'the', 'OWM', 'Weather', 'API', 'for', 'weather', 'history', 'for', 'the', 'specified', 'location', '(', 'eg', ':', 'London', 'uk', ')', '.', 'A', 'list', 'of', '*', 'Weather', '*', 'objects', 'is', 'returned', '.', 'It', 'is', 'possible', 'to', 'query', 'for', 'weather', 'history', 'in', 'a', 'closed', 'ti...
train
https://github.com/csparpa/pyowm/blob/cdd59eb72f32f7238624ceef9b2e2329a5ebd472/pyowm/weatherapi25/owm25.py#L769-L820
6,497
senaite/senaite.core
bika/lims/browser/widgets/reflexrulewidget.py
ReflexRuleWidget._get_sorted_actions_list
def _get_sorted_actions_list(self, raw_set): """ This returns a list of dictionaries with the actions got in the raw_set. :raw_set: is the dict representing a set of rules and conditions. """ keys_list = raw_set.keys() # actions_dicts_l is the final list which wil...
python
def _get_sorted_actions_list(self, raw_set): """ This returns a list of dictionaries with the actions got in the raw_set. :raw_set: is the dict representing a set of rules and conditions. """ keys_list = raw_set.keys() # actions_dicts_l is the final list which wil...
['def', '_get_sorted_actions_list', '(', 'self', ',', 'raw_set', ')', ':', 'keys_list', '=', 'raw_set', '.', 'keys', '(', ')', '# actions_dicts_l is the final list which will contain the the', '# dictionaries with the actions.', '# The dictionaries will be sorted by the index obtained in the', '# template.', 'actions_d...
This returns a list of dictionaries with the actions got in the raw_set. :raw_set: is the dict representing a set of rules and conditions.
['This', 'returns', 'a', 'list', 'of', 'dictionaries', 'with', 'the', 'actions', 'got', 'in', 'the', 'raw_set', '.', ':', 'raw_set', ':', 'is', 'the', 'dict', 'representing', 'a', 'set', 'of', 'rules', 'and', 'conditions', '.']
train
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/browser/widgets/reflexrulewidget.py#L234-L299
6,498
jaraco/jaraco.windows
jaraco/windows/dpapi.py
CryptProtectData
def CryptProtectData( data, description=None, optional_entropy=None, prompt_struct=None, flags=0, ): """ Encrypt data """ data_in = DATA_BLOB(data) entropy = DATA_BLOB(optional_entropy) if optional_entropy else None data_out = DATA_BLOB() res = _CryptProtectData( data_in, description, entropy, None, ...
python
def CryptProtectData( data, description=None, optional_entropy=None, prompt_struct=None, flags=0, ): """ Encrypt data """ data_in = DATA_BLOB(data) entropy = DATA_BLOB(optional_entropy) if optional_entropy else None data_out = DATA_BLOB() res = _CryptProtectData( data_in, description, entropy, None, ...
['def', 'CryptProtectData', '(', 'data', ',', 'description', '=', 'None', ',', 'optional_entropy', '=', 'None', ',', 'prompt_struct', '=', 'None', ',', 'flags', '=', '0', ',', ')', ':', 'data_in', '=', 'DATA_BLOB', '(', 'data', ')', 'entropy', '=', 'DATA_BLOB', '(', 'optional_entropy', ')', 'if', 'optional_entropy', 'e...
Encrypt data
['Encrypt', 'data']
train
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/dpapi.py#L103-L126
6,499
Alignak-monitoring/alignak
alignak/external_command.py
ExternalCommandManager.disable_host_flap_detection
def disable_host_flap_detection(self, host): """Disable flap detection for a host Format of the line that triggers function call:: DISABLE_HOST_FLAP_DETECTION;<host_name> :param host: host to edit :type host: alignak.objects.host.Host :return: None """ i...
python
def disable_host_flap_detection(self, host): """Disable flap detection for a host Format of the line that triggers function call:: DISABLE_HOST_FLAP_DETECTION;<host_name> :param host: host to edit :type host: alignak.objects.host.Host :return: None """ i...
['def', 'disable_host_flap_detection', '(', 'self', ',', 'host', ')', ':', 'if', 'host', '.', 'flap_detection_enabled', ':', 'host', '.', 'modified_attributes', '|=', 'DICT_MODATTR', '[', '"MODATTR_FLAP_DETECTION_ENABLED"', ']', '.', 'value', 'host', '.', 'flap_detection_enabled', '=', 'False', '# Maybe the host was fl...
Disable flap detection for a host Format of the line that triggers function call:: DISABLE_HOST_FLAP_DETECTION;<host_name> :param host: host to edit :type host: alignak.objects.host.Host :return: None
['Disable', 'flap', 'detection', 'for', 'a', 'host', 'Format', 'of', 'the', 'line', 'that', 'triggers', 'function', 'call', '::']
train
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/external_command.py#L2146-L2163