repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
knipknap/SpiffWorkflow
SpiffWorkflow/bpmn/serializer/Packager.py
https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/serializer/Packager.py#L441-L459
def merge_options_and_config(cls, config, options, args): """ Override in subclass if required. """ if args: config.set(CONFIG_SECTION_NAME, 'input_files', ','.join(args)) elif config.has_option(CONFIG_SECTION_NAME, 'input_files'): for i in config.get(CONF...
[ "def", "merge_options_and_config", "(", "cls", ",", "config", ",", "options", ",", "args", ")", ":", "if", "args", ":", "config", ".", "set", "(", "CONFIG_SECTION_NAME", ",", "'input_files'", ",", "','", ".", "join", "(", "args", ")", ")", "elif", "confi...
Override in subclass if required.
[ "Override", "in", "subclass", "if", "required", "." ]
python
valid
IBMStreams/pypi.streamsx
streamsx/rest_primitives.py
https://github.com/IBMStreams/pypi.streamsx/blob/abd67b4757120f6f805787fba390f53e9df9cdd8/streamsx/rest_primitives.py#L1320-L1328
def get_resource(self): """Get the :py:class:`Resource` of the resource allocation. Returns: Resource: Resource for this allocation. .. versionadded:: 1.9 """ return Resource(self.rest_client.make_request(self.resource), self.rest_client)
[ "def", "get_resource", "(", "self", ")", ":", "return", "Resource", "(", "self", ".", "rest_client", ".", "make_request", "(", "self", ".", "resource", ")", ",", "self", ".", "rest_client", ")" ]
Get the :py:class:`Resource` of the resource allocation. Returns: Resource: Resource for this allocation. .. versionadded:: 1.9
[ "Get", "the", ":", "py", ":", "class", ":", "Resource", "of", "the", "resource", "allocation", "." ]
python
train
tensorflow/tensor2tensor
tensor2tensor/models/research/moe_experiments.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/moe_experiments.py#L30-L46
def xmoe_tr_dense_2k(): """Series of architectural experiments on Translation. # run on 8-core setup 119M params, einsum=0.95e13 Returns: a hparams """ hparams = mtf_transformer2.mtf_bitransformer_base() hparams.encoder_layers = ["self_att", "drd"] * 4 hparams.decoder_layers = ["self_att", "enc_a...
[ "def", "xmoe_tr_dense_2k", "(", ")", ":", "hparams", "=", "mtf_transformer2", ".", "mtf_bitransformer_base", "(", ")", "hparams", ".", "encoder_layers", "=", "[", "\"self_att\"", ",", "\"drd\"", "]", "*", "4", "hparams", ".", "decoder_layers", "=", "[", "\"sel...
Series of architectural experiments on Translation. # run on 8-core setup 119M params, einsum=0.95e13 Returns: a hparams
[ "Series", "of", "architectural", "experiments", "on", "Translation", "." ]
python
train
walkr/nanoservice
nanoservice/reqrep.py
https://github.com/walkr/nanoservice/blob/e2098986b1baa5f283167ae487d14f3c6c21961a/nanoservice/reqrep.py#L79-L86
def parse(cls, payload): """ Parse client request """ try: method, args, ref = payload except Exception as exception: raise RequestParseError(exception) else: return method, args, ref
[ "def", "parse", "(", "cls", ",", "payload", ")", ":", "try", ":", "method", ",", "args", ",", "ref", "=", "payload", "except", "Exception", "as", "exception", ":", "raise", "RequestParseError", "(", "exception", ")", "else", ":", "return", "method", ",",...
Parse client request
[ "Parse", "client", "request" ]
python
train
wheerd/multiset
multiset.py
https://github.com/wheerd/multiset/blob/1f002397096edae3da32d004e3159345a476999c/multiset.py#L416-L443
def times(self, factor): """Return a new set with each element's multiplicity multiplied with the given scalar factor. >>> ms = Multiset('aab') >>> sorted(ms.times(2)) ['a', 'a', 'a', 'a', 'b', 'b'] You can also use the ``*`` operator for the same effect: >>> sorted(ms...
[ "def", "times", "(", "self", ",", "factor", ")", ":", "if", "factor", "==", "0", ":", "return", "self", ".", "__class__", "(", ")", "if", "factor", "<", "0", ":", "raise", "ValueError", "(", "'The factor must no be negative.'", ")", "result", "=", "self"...
Return a new set with each element's multiplicity multiplied with the given scalar factor. >>> ms = Multiset('aab') >>> sorted(ms.times(2)) ['a', 'a', 'a', 'a', 'b', 'b'] You can also use the ``*`` operator for the same effect: >>> sorted(ms * 3) ['a', 'a', 'a', 'a', '...
[ "Return", "a", "new", "set", "with", "each", "element", "s", "multiplicity", "multiplied", "with", "the", "given", "scalar", "factor", "." ]
python
train
kwikteam/phy
phy/cluster/supervisor.py
https://github.com/kwikteam/phy/blob/7e9313dc364304b7d2bd03b92938347343703003/phy/cluster/supervisor.py#L556-L566
def select(self, *cluster_ids): """Select a list of clusters.""" # HACK: allow for `select(1, 2, 3)` in addition to `select([1, 2, 3])` # This makes it more convenient to select multiple clusters with # the snippet: `:c 1 2 3` instead of `:c 1,2,3`. if cluster_ids and isinstance(...
[ "def", "select", "(", "self", ",", "*", "cluster_ids", ")", ":", "# HACK: allow for `select(1, 2, 3)` in addition to `select([1, 2, 3])`", "# This makes it more convenient to select multiple clusters with", "# the snippet: `:c 1 2 3` instead of `:c 1,2,3`.", "if", "cluster_ids", "and", ...
Select a list of clusters.
[ "Select", "a", "list", "of", "clusters", "." ]
python
train
IdentityPython/pysaml2
src/saml2/validate.py
https://github.com/IdentityPython/pysaml2/blob/d3aa78eeb7d37c12688f783cb4db1c7263a14ad6/src/saml2/validate.py#L182-L202
def valid_string(val): """ Expects unicode Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] """ for char in val: try: char = ord(char) except TypeError: raise NotValid("string") if char == 0x09 or char == ...
[ "def", "valid_string", "(", "val", ")", ":", "for", "char", "in", "val", ":", "try", ":", "char", "=", "ord", "(", "char", ")", "except", "TypeError", ":", "raise", "NotValid", "(", "\"string\"", ")", "if", "char", "==", "0x09", "or", "char", "==", ...
Expects unicode Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
[ "Expects", "unicode", "Char", "::", "=", "#x9", "|", "#xA", "|", "#xD", "|", "[", "#x20", "-", "#xD7FF", "]", "|", "[", "#xE000", "-", "#xFFFD", "]", "|", "[", "#x10000", "-", "#x10FFFF", "]" ]
python
train
napalm-automation/napalm-eos
napalm_eos/eos.py
https://github.com/napalm-automation/napalm-eos/blob/a3b37d6ee353e326ab9ea1a09ecc14045b12928b/napalm_eos/eos.py#L91-L118
def open(self): """Implementation of NAPALM method open.""" try: if self.transport in ('http', 'https'): connection = pyeapi.client.connect( transport=self.transport, host=self.hostname, username=self.username, ...
[ "def", "open", "(", "self", ")", ":", "try", ":", "if", "self", ".", "transport", "in", "(", "'http'", ",", "'https'", ")", ":", "connection", "=", "pyeapi", ".", "client", ".", "connect", "(", "transport", "=", "self", ".", "transport", ",", "host",...
Implementation of NAPALM method open.
[ "Implementation", "of", "NAPALM", "method", "open", "." ]
python
train
sdss/tree
python/tree/misc/logger.py
https://github.com/sdss/tree/blob/f61fe0876c138ccb61874912d4b8590dadfa835c/python/tree/misc/logger.py#L58-L98
def colored_formatter(record): """Prints log messages with colours.""" colours = {'info': ('blue', 'normal'), 'debug': ('magenta', 'normal'), 'warning': ('yellow', 'normal'), 'print': ('green', 'normal'), 'error': ('red', 'bold')} levelname = rec...
[ "def", "colored_formatter", "(", "record", ")", ":", "colours", "=", "{", "'info'", ":", "(", "'blue'", ",", "'normal'", ")", ",", "'debug'", ":", "(", "'magenta'", ",", "'normal'", ")", ",", "'warning'", ":", "(", "'yellow'", ",", "'normal'", ")", ","...
Prints log messages with colours.
[ "Prints", "log", "messages", "with", "colours", "." ]
python
train
Becksteinlab/GromacsWrapper
gromacs/scaling.py
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/scaling.py#L90-L134
def scale_impropers(mol, impropers, scale, banned_lines=None): """Scale improper dihedrals""" if banned_lines is None: banned_lines = [] new_impropers = [] for im in mol.impropers: atypes = (im.atom1.get_atomtype(), im.atom2.get_atomtype(), ...
[ "def", "scale_impropers", "(", "mol", ",", "impropers", ",", "scale", ",", "banned_lines", "=", "None", ")", ":", "if", "banned_lines", "is", "None", ":", "banned_lines", "=", "[", "]", "new_impropers", "=", "[", "]", "for", "im", "in", "mol", ".", "im...
Scale improper dihedrals
[ "Scale", "improper", "dihedrals" ]
python
valid
OCHA-DAP/hdx-python-utilities
src/hdx/utilities/easy_logging.py
https://github.com/OCHA-DAP/hdx-python-utilities/blob/9c89e0aa5afac2c002b02a2d8f0e5b91eeb3d2a3/src/hdx/utilities/easy_logging.py#L16-L99
def setup_logging(**kwargs): # type: (Any) -> None """Setup logging configuration Args: **kwargs: See below logging_config_dict (dict): Logging configuration dictionary OR logging_config_json (str): Path to JSON Logging configuration OR logging_config_yaml (str): Path to YAM...
[ "def", "setup_logging", "(", "*", "*", "kwargs", ")", ":", "# type: (Any) -> None", "smtp_config_found", "=", "False", "smtp_config_dict", "=", "kwargs", ".", "get", "(", "'smtp_config_dict'", ",", "None", ")", "if", "smtp_config_dict", ":", "smtp_config_found", "...
Setup logging configuration Args: **kwargs: See below logging_config_dict (dict): Logging configuration dictionary OR logging_config_json (str): Path to JSON Logging configuration OR logging_config_yaml (str): Path to YAML Logging configuration. Defaults to internal logging_configur...
[ "Setup", "logging", "configuration" ]
python
train
limix/numpy-sugar
numpy_sugar/linalg/svd.py
https://github.com/limix/numpy-sugar/blob/4bdfa26913135c76ef3cd542a332f4e5861e948b/numpy_sugar/linalg/svd.py#L4-L30
def economic_svd(G, epsilon=sqrt(finfo(float).eps)): r"""Economic Singular Value Decomposition. Args: G (array_like): Matrix to be factorized. epsilon (float): Threshold on the square root of the eigen values. Default is ``sqrt(finfo(float).eps)``. Returns: ...
[ "def", "economic_svd", "(", "G", ",", "epsilon", "=", "sqrt", "(", "finfo", "(", "float", ")", ".", "eps", ")", ")", ":", "from", "scipy", ".", "linalg", "import", "svd", "G", "=", "asarray", "(", "G", ",", "float", ")", "(", "U", ",", "S", ","...
r"""Economic Singular Value Decomposition. Args: G (array_like): Matrix to be factorized. epsilon (float): Threshold on the square root of the eigen values. Default is ``sqrt(finfo(float).eps)``. Returns: :class:`numpy.ndarray`: Unitary matrix. :class:`...
[ "r", "Economic", "Singular", "Value", "Decomposition", "." ]
python
train
quikmile/trelliolibs
trelliolibs/pigeon/workers.py
https://github.com/quikmile/trelliolibs/blob/872e37d798523ef72380f504651b98ddd0762b0d/trelliolibs/pigeon/workers.py#L45-L61
def submit(self, method, method_args=(), method_kwargs={}, done_callback=None, done_kwargs={}, loop=None): ''' used to send async notifications :param method: :param method_args: :param method_kwargs: :param done_callback: :param done_kwargs: :param loop: ...
[ "def", "submit", "(", "self", ",", "method", ",", "method_args", "=", "(", ")", ",", "method_kwargs", "=", "{", "}", ",", "done_callback", "=", "None", ",", "done_kwargs", "=", "{", "}", ",", "loop", "=", "None", ")", ":", "_future", "=", "self", "...
used to send async notifications :param method: :param method_args: :param method_kwargs: :param done_callback: :param done_kwargs: :param loop: :return:
[ "used", "to", "send", "async", "notifications", ":", "param", "method", ":", ":", "param", "method_args", ":", ":", "param", "method_kwargs", ":", ":", "param", "done_callback", ":", ":", "param", "done_kwargs", ":", ":", "param", "loop", ":", ":", "return...
python
train
ruipgil/TrackToTrip
tracktotrip/point.py
https://github.com/ruipgil/TrackToTrip/blob/5537c14ee9748091b5255b658ab528e1d6227f99/tracktotrip/point.py#L104-L116
def from_gpx(gpx_track_point): """ Creates a point from GPX representation Arguments: gpx_track_point (:obj:`gpxpy.GPXTrackPoint`) Returns: :obj:`Point` """ return Point( lat=gpx_track_point.latitude, lon=gpx_track_point.longitude,...
[ "def", "from_gpx", "(", "gpx_track_point", ")", ":", "return", "Point", "(", "lat", "=", "gpx_track_point", ".", "latitude", ",", "lon", "=", "gpx_track_point", ".", "longitude", ",", "time", "=", "gpx_track_point", ".", "time", ")" ]
Creates a point from GPX representation Arguments: gpx_track_point (:obj:`gpxpy.GPXTrackPoint`) Returns: :obj:`Point`
[ "Creates", "a", "point", "from", "GPX", "representation" ]
python
train
mitsei/dlkit
dlkit/json_/assessment/assessment_utilities.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/assessment_utilities.py#L367-L374
def remove_from_parent_sequence_map(assessment_part_admin_session, assessment_part_id): """Updates the child map of a simple sequence assessment assessment part to remove child part""" apls = get_assessment_part_lookup_session(runtime=assessment_part_admin_session._runtime, ...
[ "def", "remove_from_parent_sequence_map", "(", "assessment_part_admin_session", ",", "assessment_part_id", ")", ":", "apls", "=", "get_assessment_part_lookup_session", "(", "runtime", "=", "assessment_part_admin_session", ".", "_runtime", ",", "proxy", "=", "assessment_part_a...
Updates the child map of a simple sequence assessment assessment part to remove child part
[ "Updates", "the", "child", "map", "of", "a", "simple", "sequence", "assessment", "assessment", "part", "to", "remove", "child", "part" ]
python
train
Sheeprider/BitBucket-api
bitbucket/bitbucket.py
https://github.com/Sheeprider/BitBucket-api/blob/be45515d506d87f14807a676f3c2f20d79674b75/bitbucket/bitbucket.py#L143-L170
def authorize(self, consumer_key, consumer_secret, callback_url=None, access_token=None, access_token_secret=None): """ Call this with your consumer key, secret and callback URL, to generate a token for verification. """ self.consumer_key = consumer_key ...
[ "def", "authorize", "(", "self", ",", "consumer_key", ",", "consumer_secret", ",", "callback_url", "=", "None", ",", "access_token", "=", "None", ",", "access_token_secret", "=", "None", ")", ":", "self", ".", "consumer_key", "=", "consumer_key", "self", ".", ...
Call this with your consumer key, secret and callback URL, to generate a token for verification.
[ "Call", "this", "with", "your", "consumer", "key", "secret", "and", "callback", "URL", "to", "generate", "a", "token", "for", "verification", "." ]
python
train
niklasf/python-chess
chess/__init__.py
https://github.com/niklasf/python-chess/blob/d91f986ca3e046b300a0d7d9ee2a13b07610fe1a/chess/__init__.py#L1888-L1924
def is_repetition(self, count: int = 3) -> bool: """ Checks if the current position has repeated 3 (or a given number of) times. Unlike :func:`~chess.Board.can_claim_threefold_repetition()`, this does not consider a repetition that can be played on the next move. ...
[ "def", "is_repetition", "(", "self", ",", "count", ":", "int", "=", "3", ")", "->", "bool", ":", "transposition_key", "=", "self", ".", "_transposition_key", "(", ")", "switchyard", "=", "[", "]", "try", ":", "while", "True", ":", "if", "count", "<=", ...
Checks if the current position has repeated 3 (or a given number of) times. Unlike :func:`~chess.Board.can_claim_threefold_repetition()`, this does not consider a repetition that can be played on the next move. Note that checking this can be slow: In the worst case the entire ...
[ "Checks", "if", "the", "current", "position", "has", "repeated", "3", "(", "or", "a", "given", "number", "of", ")", "times", "." ]
python
train
Metatab/metapack
metapack/util.py
https://github.com/Metatab/metapack/blob/8365f221fbeaa3c0be9091f2eaf3447fd8e2e8d6/metapack/util.py#L89-L104
def make_dir_structure(base_dir): """Make the build directory structure. """ def maybe_makedir(*args): p = join(base_dir, *args) if exists(p) and not isdir(p): raise IOError("File '{}' exists but is not a directory ".format(p)) if not exists(p): makedirs(p) ...
[ "def", "make_dir_structure", "(", "base_dir", ")", ":", "def", "maybe_makedir", "(", "*", "args", ")", ":", "p", "=", "join", "(", "base_dir", ",", "*", "args", ")", "if", "exists", "(", "p", ")", "and", "not", "isdir", "(", "p", ")", ":", "raise",...
Make the build directory structure.
[ "Make", "the", "build", "directory", "structure", "." ]
python
train
ejeschke/ginga
ginga/rv/plugins/ChangeHistory.py
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/rv/plugins/ChangeHistory.py#L269-L284
def delete_channel_cb(self, gshell, chinfo): """Called when a channel is deleted from the main interface. Parameter is chinfo (a bunch).""" chname = chinfo.name if chname not in self.name_dict: return del self.name_dict[chname] self.logger.debug('{0} removed...
[ "def", "delete_channel_cb", "(", "self", ",", "gshell", ",", "chinfo", ")", ":", "chname", "=", "chinfo", ".", "name", "if", "chname", "not", "in", "self", ".", "name_dict", ":", "return", "del", "self", ".", "name_dict", "[", "chname", "]", "self", "....
Called when a channel is deleted from the main interface. Parameter is chinfo (a bunch).
[ "Called", "when", "a", "channel", "is", "deleted", "from", "the", "main", "interface", ".", "Parameter", "is", "chinfo", "(", "a", "bunch", ")", "." ]
python
train
nion-software/nionswift-io
nionswift_plugin/TIFF_IO/tifffile.py
https://github.com/nion-software/nionswift-io/blob/e9ae37f01faa9332c48b647f93afd5ef2166b155/nionswift_plugin/TIFF_IO/tifffile.py#L5137-L5162
def offset(self): """Return offset to series data in file, if any.""" if not self._pages: return None pos = 0 for page in self._pages: if page is None: return None if not page.is_final: return None if not po...
[ "def", "offset", "(", "self", ")", ":", "if", "not", "self", ".", "_pages", ":", "return", "None", "pos", "=", "0", "for", "page", "in", "self", ".", "_pages", ":", "if", "page", "is", "None", ":", "return", "None", "if", "not", "page", ".", "is_...
Return offset to series data in file, if any.
[ "Return", "offset", "to", "series", "data", "in", "file", "if", "any", "." ]
python
train
programa-stic/barf-project
barf/analysis/codeanalyzer/codeanalyzer.py
https://github.com/programa-stic/barf-project/blob/18ed9e5eace55f7bf6015ec57f037c364099021c/barf/analysis/codeanalyzer/codeanalyzer.py#L78-L97
def get_register_expr(self, register_name, mode="post"): """Return a smt bit vector that represents an architectural (native) register. """ reg_info = self._arch_info.alias_mapper.get(register_name, None) if reg_info: var_base_name, offset = reg_info else: ...
[ "def", "get_register_expr", "(", "self", ",", "register_name", ",", "mode", "=", "\"post\"", ")", ":", "reg_info", "=", "self", ".", "_arch_info", ".", "alias_mapper", ".", "get", "(", "register_name", ",", "None", ")", "if", "reg_info", ":", "var_base_name"...
Return a smt bit vector that represents an architectural (native) register.
[ "Return", "a", "smt", "bit", "vector", "that", "represents", "an", "architectural", "(", "native", ")", "register", "." ]
python
train
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/breakpoint.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/breakpoint.py#L3293-L3321
def enable_one_shot_process_breakpoints(self, dwProcessId): """ Enables for one shot all disabled breakpoints for the given process. @type dwProcessId: int @param dwProcessId: Process global ID. """ # enable code breakpoints for one shot for bp in self.get_proc...
[ "def", "enable_one_shot_process_breakpoints", "(", "self", ",", "dwProcessId", ")", ":", "# enable code breakpoints for one shot", "for", "bp", "in", "self", ".", "get_process_code_breakpoints", "(", "dwProcessId", ")", ":", "if", "bp", ".", "is_disabled", "(", ")", ...
Enables for one shot all disabled breakpoints for the given process. @type dwProcessId: int @param dwProcessId: Process global ID.
[ "Enables", "for", "one", "shot", "all", "disabled", "breakpoints", "for", "the", "given", "process", "." ]
python
train
pyviz/imagen
imagen/patterngenerator.py
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/patterngenerator.py#L524-L530
def state_pop(self): """ Pop the state of all generators """ super(Composite,self).state_pop() for gen in self.generators: gen.state_pop()
[ "def", "state_pop", "(", "self", ")", ":", "super", "(", "Composite", ",", "self", ")", ".", "state_pop", "(", ")", "for", "gen", "in", "self", ".", "generators", ":", "gen", ".", "state_pop", "(", ")" ]
Pop the state of all generators
[ "Pop", "the", "state", "of", "all", "generators" ]
python
train
tensorflow/tensor2tensor
tensor2tensor/utils/learning_rate.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/learning_rate.py#L141-L183
def _learning_rate_decay(hparams, warmup_steps=0): """Learning rate decay multiplier.""" scheme = hparams.learning_rate_decay_scheme warmup_steps = tf.to_float(warmup_steps) global_step = _global_step(hparams) if not scheme or scheme == "none": return tf.constant(1.) tf.logging.info("Applying learning...
[ "def", "_learning_rate_decay", "(", "hparams", ",", "warmup_steps", "=", "0", ")", ":", "scheme", "=", "hparams", ".", "learning_rate_decay_scheme", "warmup_steps", "=", "tf", ".", "to_float", "(", "warmup_steps", ")", "global_step", "=", "_global_step", "(", "h...
Learning rate decay multiplier.
[ "Learning", "rate", "decay", "multiplier", "." ]
python
train
twisted/txaws
txaws/s3/client.py
https://github.com/twisted/txaws/blob/5c3317376cd47e536625027e38c3b37840175ce0/txaws/s3/client.py#L320-L334
def get_bucket_website_config(self, bucket): """ Get the website configuration of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will fire with the bucket's website configuration. """ details = self._details( method=b"GET...
[ "def", "get_bucket_website_config", "(", "self", ",", "bucket", ")", ":", "details", "=", "self", ".", "_details", "(", "method", "=", "b\"GET\"", ",", "url_context", "=", "self", ".", "_url_context", "(", "bucket", "=", "bucket", ",", "object_name", "=", ...
Get the website configuration of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will fire with the bucket's website configuration.
[ "Get", "the", "website", "configuration", "of", "a", "bucket", "." ]
python
train
edx/edx-enterprise
enterprise/templatetags/enterprise.py
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/templatetags/enterprise.py#L48-L71
def course_modal(context, course=None): """ Django template tag that returns course information to display in a modal. You may pass in a particular course if you like. Otherwise, the modal will look for course context within the parent context. Usage: {% course_modal %} {% course_m...
[ "def", "course_modal", "(", "context", ",", "course", "=", "None", ")", ":", "if", "course", ":", "context", ".", "update", "(", "{", "'course_image_uri'", ":", "course", ".", "get", "(", "'course_image_uri'", ",", "''", ")", ",", "'course_title'", ":", ...
Django template tag that returns course information to display in a modal. You may pass in a particular course if you like. Otherwise, the modal will look for course context within the parent context. Usage: {% course_modal %} {% course_modal course %}
[ "Django", "template", "tag", "that", "returns", "course", "information", "to", "display", "in", "a", "modal", "." ]
python
valid
hyperledger/indy-plenum
plenum/server/observer/observer_node.py
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/observer/observer_node.py#L39-L46
async def serviceQueues(self, limit=None) -> int: """ Service at most `limit` messages from the inBox. :param limit: the maximum number of messages to service :return: the number of messages successfully processed """ return await self._inbox_router.handleAll(self._inbox...
[ "async", "def", "serviceQueues", "(", "self", ",", "limit", "=", "None", ")", "->", "int", ":", "return", "await", "self", ".", "_inbox_router", ".", "handleAll", "(", "self", ".", "_inbox", ",", "limit", ")" ]
Service at most `limit` messages from the inBox. :param limit: the maximum number of messages to service :return: the number of messages successfully processed
[ "Service", "at", "most", "limit", "messages", "from", "the", "inBox", "." ]
python
train
opendatateam/udata
udata/tasks.py
https://github.com/opendatateam/udata/blob/f016585af94b0ff6bd73738c700324adc8ba7f8f/udata/tasks.py#L50-L70
def router(name, args, kwargs, options, task=None, **kw): ''' A celery router using the predeclared :class:`ContextTask` attributes (`router` or `default_queue` and/or `default routing_key`). ''' # Fetch task by name if necessary task = task or celery.tasks.get(name) if not task: ret...
[ "def", "router", "(", "name", ",", "args", ",", "kwargs", ",", "options", ",", "task", "=", "None", ",", "*", "*", "kw", ")", ":", "# Fetch task by name if necessary", "task", "=", "task", "or", "celery", ".", "tasks", ".", "get", "(", "name", ")", "...
A celery router using the predeclared :class:`ContextTask` attributes (`router` or `default_queue` and/or `default routing_key`).
[ "A", "celery", "router", "using", "the", "predeclared", ":", "class", ":", "ContextTask", "attributes", "(", "router", "or", "default_queue", "and", "/", "or", "default", "routing_key", ")", "." ]
python
train
wglass/lighthouse
lighthouse/service.py
https://github.com/wglass/lighthouse/blob/f4ce6550895acc31e433ede0c05d366718a3ffe5/lighthouse/service.py#L39-L50
def validate_config(cls, config): """ Runs a check on the given config to make sure that `port`/`ports` and `discovery` is defined. """ if "discovery" not in config: raise ValueError("No discovery method defined.") if not any([item in config for item in ["por...
[ "def", "validate_config", "(", "cls", ",", "config", ")", ":", "if", "\"discovery\"", "not", "in", "config", ":", "raise", "ValueError", "(", "\"No discovery method defined.\"", ")", "if", "not", "any", "(", "[", "item", "in", "config", "for", "item", "in", ...
Runs a check on the given config to make sure that `port`/`ports` and `discovery` is defined.
[ "Runs", "a", "check", "on", "the", "given", "config", "to", "make", "sure", "that", "port", "/", "ports", "and", "discovery", "is", "defined", "." ]
python
train
saltstack/salt
salt/modules/btrfs.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/btrfs.py#L130-L171
def defragment(path): ''' Defragment mounted BTRFS filesystem. In order to defragment a filesystem, device should be properly mounted and writable. If passed a device name, then defragmented whole filesystem, mounted on in. If passed a moun tpoint of the filesystem, then only this mount point is de...
[ "def", "defragment", "(", "path", ")", ":", "is_device", "=", "salt", ".", "utils", ".", "fsutils", ".", "_is_device", "(", "path", ")", "mounts", "=", "salt", ".", "utils", ".", "fsutils", ".", "_get_mounts", "(", "\"btrfs\"", ")", "if", "is_device", ...
Defragment mounted BTRFS filesystem. In order to defragment a filesystem, device should be properly mounted and writable. If passed a device name, then defragmented whole filesystem, mounted on in. If passed a moun tpoint of the filesystem, then only this mount point is defragmented. CLI Example: ...
[ "Defragment", "mounted", "BTRFS", "filesystem", ".", "In", "order", "to", "defragment", "a", "filesystem", "device", "should", "be", "properly", "mounted", "and", "writable", "." ]
python
train
widdowquinn/pyani
bin/genbank_get_genomes_by_taxon.py
https://github.com/widdowquinn/pyani/blob/2b24ec971401e04024bba896e4011984fe3f53f0/bin/genbank_get_genomes_by_taxon.py#L234-L259
def get_asm_uids(taxon_uid): """Returns a set of NCBI UIDs associated with the passed taxon. This query at NCBI returns all assemblies for the taxon subtree rooted at the passed taxon_uid. """ query = "txid%s[Organism:exp]" % taxon_uid logger.info("Entrez ESearch with query: %s", query) # ...
[ "def", "get_asm_uids", "(", "taxon_uid", ")", ":", "query", "=", "\"txid%s[Organism:exp]\"", "%", "taxon_uid", "logger", ".", "info", "(", "\"Entrez ESearch with query: %s\"", ",", "query", ")", "# Perform initial search for assembly UIDs with taxon ID as query.", "# Use NCBI...
Returns a set of NCBI UIDs associated with the passed taxon. This query at NCBI returns all assemblies for the taxon subtree rooted at the passed taxon_uid.
[ "Returns", "a", "set", "of", "NCBI", "UIDs", "associated", "with", "the", "passed", "taxon", "." ]
python
train
sentinel-hub/eo-learn
core/eolearn/core/plots.py
https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/plots.py#L56-L63
def update(self): """Updates image to be displayed with new time frame.""" if self.single_channel: self.im.set_data(self.data[self.ind, :, :]) else: self.im.set_data(self.data[self.ind, :, :, :]) self.ax.set_ylabel('time frame %s' % self.ind) self.i...
[ "def", "update", "(", "self", ")", ":", "if", "self", ".", "single_channel", ":", "self", ".", "im", ".", "set_data", "(", "self", ".", "data", "[", "self", ".", "ind", ",", ":", ",", ":", "]", ")", "else", ":", "self", ".", "im", ".", "set_dat...
Updates image to be displayed with new time frame.
[ "Updates", "image", "to", "be", "displayed", "with", "new", "time", "frame", "." ]
python
train
rahul13ramesh/hidden_markov
hidden_markov/hmm_class.py
https://github.com/rahul13ramesh/hidden_markov/blob/6ba6012665f9e09c980ff70901604d051ba57dcc/hidden_markov/hmm_class.py#L194-L277
def viterbi(self,observations): """ The probability of occurence of the observation sequence **Arguments**: :param observations: The observation sequence, where each element belongs to 'observations' variable declared with __init__ object. :type observations: A list or tuple ...
[ "def", "viterbi", "(", "self", ",", "observations", ")", ":", "# Find total states,observations", "total_stages", "=", "len", "(", "observations", ")", "num_states", "=", "len", "(", "self", ".", "states", ")", "# initialize data", "# Path stores the state sequence gi...
The probability of occurence of the observation sequence **Arguments**: :param observations: The observation sequence, where each element belongs to 'observations' variable declared with __init__ object. :type observations: A list or tuple :return: Returns a list of hidden states. ...
[ "The", "probability", "of", "occurence", "of", "the", "observation", "sequence" ]
python
train
mozilla/DeepSpeech
bin/import_gram_vaani.py
https://github.com/mozilla/DeepSpeech/blob/f64aa73e7fbe9dde40d4fcf23b42ab304747d152/bin/import_gram_vaani.py#L32-L79
def parse_args(args): """Parse command line parameters Args: args ([str]): Command line parameters as list of strings Returns: :obj:`argparse.Namespace`: command line parameters namespace """ parser = argparse.ArgumentParser( description="Imports GramVaani data for Deep Speech" ...
[ "def", "parse_args", "(", "args", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "\"Imports GramVaani data for Deep Speech\"", ")", "parser", ".", "add_argument", "(", "\"--version\"", ",", "action", "=", "\"version\"", ",", "...
Parse command line parameters Args: args ([str]): Command line parameters as list of strings Returns: :obj:`argparse.Namespace`: command line parameters namespace
[ "Parse", "command", "line", "parameters", "Args", ":", "args", "(", "[", "str", "]", ")", ":", "Command", "line", "parameters", "as", "list", "of", "strings", "Returns", ":", ":", "obj", ":", "argparse", ".", "Namespace", ":", "command", "line", "paramet...
python
train
OpenKMIP/PyKMIP
kmip/core/objects.py
https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/core/objects.py#L3700-L3753
def read(self, input_buffer, kmip_version=enums.KMIPVersion.KMIP_2_0): """ Read the data encoding the ObjectDefaults structure and decode it into its constituent parts. Args: input_buffer (stream): A data stream containing encoded object data, supporting a re...
[ "def", "read", "(", "self", ",", "input_buffer", ",", "kmip_version", "=", "enums", ".", "KMIPVersion", ".", "KMIP_2_0", ")", ":", "if", "kmip_version", "<", "enums", ".", "KMIPVersion", ".", "KMIP_2_0", ":", "raise", "exceptions", ".", "VersionNotSupported", ...
Read the data encoding the ObjectDefaults structure and decode it into its constituent parts. Args: input_buffer (stream): A data stream containing encoded object data, supporting a read method; usually a BytearrayStream object. kmip_version (KMIP...
[ "Read", "the", "data", "encoding", "the", "ObjectDefaults", "structure", "and", "decode", "it", "into", "its", "constituent", "parts", "." ]
python
test
raiden-network/raiden
raiden/network/rpc/client.py
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/rpc/client.py#L154-L185
def geth_discover_next_available_nonce( web3: Web3, address: AddressHex, ) -> Nonce: """Returns the next available nonce for `address`.""" # The nonces of the mempool transactions are considered used, and it's # assumed these transactions are different from the ones currently pending # ...
[ "def", "geth_discover_next_available_nonce", "(", "web3", ":", "Web3", ",", "address", ":", "AddressHex", ",", ")", "->", "Nonce", ":", "# The nonces of the mempool transactions are considered used, and it's", "# assumed these transactions are different from the ones currently pendin...
Returns the next available nonce for `address`.
[ "Returns", "the", "next", "available", "nonce", "for", "address", "." ]
python
train
saltstack/salt
salt/cloud/clouds/xen.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L934-L957
def reboot(name, call=None, session=None): ''' Reboot a vm .. code-block:: bash salt-cloud -a reboot xenvm01 ''' if call == 'function': raise SaltCloudException( 'The show_instnce function must be called with -a or --action.' ) if session is None: s...
[ "def", "reboot", "(", "name", ",", "call", "=", "None", ",", "session", "=", "None", ")", ":", "if", "call", "==", "'function'", ":", "raise", "SaltCloudException", "(", "'The show_instnce function must be called with -a or --action.'", ")", "if", "session", "is",...
Reboot a vm .. code-block:: bash salt-cloud -a reboot xenvm01
[ "Reboot", "a", "vm" ]
python
train
rigetti/quantumflow
quantumflow/utils.py
https://github.com/rigetti/quantumflow/blob/13a66cabbe8aabf6e023cc675f4a4ebe6ccda8fb/quantumflow/utils.py#L192-L208
def symbolize(flt: float) -> sympy.Symbol: """Attempt to convert a real number into a simpler symbolic representation. Returns: A sympy Symbol. (Convert to string with str(sym) or to latex with sympy.latex(sym) Raises: ValueError: If cannot simplify float """ try...
[ "def", "symbolize", "(", "flt", ":", "float", ")", "->", "sympy", ".", "Symbol", ":", "try", ":", "ratio", "=", "rationalize", "(", "flt", ")", "res", "=", "sympy", ".", "simplify", "(", "ratio", ")", "except", "ValueError", ":", "ratio", "=", "ratio...
Attempt to convert a real number into a simpler symbolic representation. Returns: A sympy Symbol. (Convert to string with str(sym) or to latex with sympy.latex(sym) Raises: ValueError: If cannot simplify float
[ "Attempt", "to", "convert", "a", "real", "number", "into", "a", "simpler", "symbolic", "representation", "." ]
python
train
kevin1024/vcrpy
vcr/stubs/__init__.py
https://github.com/kevin1024/vcrpy/blob/114fcd29b43c55896aaa6a6613bc7766f2707c8b/vcr/stubs/__init__.py#L216-L272
def getresponse(self, _=False, **kwargs): '''Retrieve the response''' # Check to see if the cassette has a response for this request. If so, # then return it if self.cassette.can_play_response_for(self._vcr_request): log.info( "Playing response for {} from cas...
[ "def", "getresponse", "(", "self", ",", "_", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# Check to see if the cassette has a response for this request. If so,", "# then return it", "if", "self", ".", "cassette", ".", "can_play_response_for", "(", "self", ".", ...
Retrieve the response
[ "Retrieve", "the", "response" ]
python
train
tensorflow/tensor2tensor
tensor2tensor/data_generators/multi_problem_v2.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/multi_problem_v2.py#L378-L394
def encode_schedule(schedule): """Encodes a schedule tuple into a string. Args: schedule: A tuple containing (interpolation, steps, pmfs), where interpolation is a string specifying the interpolation strategy, steps is an int array_like of shape [N] specifying the global steps, and pmfs is an...
[ "def", "encode_schedule", "(", "schedule", ")", ":", "interpolation", ",", "steps", ",", "pmfs", "=", "schedule", "return", "interpolation", "+", "' '", "+", "' '", ".", "join", "(", "'@'", "+", "str", "(", "s", ")", "+", "' '", "+", "' '", ".", "joi...
Encodes a schedule tuple into a string. Args: schedule: A tuple containing (interpolation, steps, pmfs), where interpolation is a string specifying the interpolation strategy, steps is an int array_like of shape [N] specifying the global steps, and pmfs is an array_like of shape [N, M] where pm...
[ "Encodes", "a", "schedule", "tuple", "into", "a", "string", "." ]
python
train
gem/oq-engine
openquake/server/views.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/server/views.py#L378-L400
def calc_remove(request, calc_id): """ Remove the calculation id """ # Only the owner can remove a job user = utils.get_user(request) try: message = logs.dbcmd('del_calc', calc_id, user) except dbapi.NotFound: return HttpResponseNotFound() if 'success' in message: ...
[ "def", "calc_remove", "(", "request", ",", "calc_id", ")", ":", "# Only the owner can remove a job", "user", "=", "utils", ".", "get_user", "(", "request", ")", "try", ":", "message", "=", "logs", ".", "dbcmd", "(", "'del_calc'", ",", "calc_id", ",", "user",...
Remove the calculation id
[ "Remove", "the", "calculation", "id" ]
python
train
HewlettPackard/python-hpOneView
hpOneView/oneview_client.py
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L777-L786
def racks(self): """ Gets the Racks API client. Returns: Racks: """ if not self.__racks: self.__racks = Racks(self.__connection) return self.__racks
[ "def", "racks", "(", "self", ")", ":", "if", "not", "self", ".", "__racks", ":", "self", ".", "__racks", "=", "Racks", "(", "self", ".", "__connection", ")", "return", "self", ".", "__racks" ]
Gets the Racks API client. Returns: Racks:
[ "Gets", "the", "Racks", "API", "client", "." ]
python
train
h2oai/h2o-3
h2o-py/h2o/utils/typechecks.py
https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/utils/typechecks.py#L230-L235
def name(self, src=None): """Return string representing the name of this type.""" if len(self._types) > 1: return "!(%s)" % str("|".join(_get_type_name(tt, src) for tt in self._types)) else: return "!" + _get_type_name(self._types[0], src)
[ "def", "name", "(", "self", ",", "src", "=", "None", ")", ":", "if", "len", "(", "self", ".", "_types", ")", ">", "1", ":", "return", "\"!(%s)\"", "%", "str", "(", "\"|\"", ".", "join", "(", "_get_type_name", "(", "tt", ",", "src", ")", "for", ...
Return string representing the name of this type.
[ "Return", "string", "representing", "the", "name", "of", "this", "type", "." ]
python
test
tanghaibao/jcvi
jcvi/graphics/base.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/graphics/base.py#L328-L345
def print_colors(palette, outfile="Palette.png"): """ print color palette (a tuple) to a PNG file for quick check """ fig = plt.figure() ax = fig.add_subplot(111) xmax = 20 * (len(palette) + 1) x1s = np.arange(0, xmax, 20) xintervals = [10] * len(palette) xx = zip(x1s, xintervals) ...
[ "def", "print_colors", "(", "palette", ",", "outfile", "=", "\"Palette.png\"", ")", ":", "fig", "=", "plt", ".", "figure", "(", ")", "ax", "=", "fig", ".", "add_subplot", "(", "111", ")", "xmax", "=", "20", "*", "(", "len", "(", "palette", ")", "+"...
print color palette (a tuple) to a PNG file for quick check
[ "print", "color", "palette", "(", "a", "tuple", ")", "to", "a", "PNG", "file", "for", "quick", "check" ]
python
train
angr/angr
angr/storage/file.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/storage/file.py#L479-L521
def write(self, pos, data, size=None, events=True, **kwargs): """ Write a packet to the stream. :param int pos: The packet number to write in the sequence of the stream. May be None to append to the stream. :param data: The data to write, as a string or bitvector. :pa...
[ "def", "write", "(", "self", ",", "pos", ",", "data", ",", "size", "=", "None", ",", "events", "=", "True", ",", "*", "*", "kwargs", ")", ":", "if", "events", ":", "self", ".", "state", ".", "history", ".", "add_event", "(", "'fs_write'", ",", "f...
Write a packet to the stream. :param int pos: The packet number to write in the sequence of the stream. May be None to append to the stream. :param data: The data to write, as a string or bitvector. :param size: The optional size to write. May be symbolic; must be constrained ...
[ "Write", "a", "packet", "to", "the", "stream", "." ]
python
train
SheffieldML/GPy
GPy/examples/dimensionality_reduction.py
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/dimensionality_reduction.py#L257-L301
def _simulate_sincos(D1, D2, D3, N, num_inducing, plot_sim=False): """Simulate some data drawn from sine and cosine for use in demos of MRD""" _np.random.seed(1234) x = _np.linspace(0, 4 * _np.pi, N)[:, None] s1 = _np.vectorize(lambda x: _np.sin(x)) s2 = _np.vectorize(lambda x: _np.cos(x)) s3 =...
[ "def", "_simulate_sincos", "(", "D1", ",", "D2", ",", "D3", ",", "N", ",", "num_inducing", ",", "plot_sim", "=", "False", ")", ":", "_np", ".", "random", ".", "seed", "(", "1234", ")", "x", "=", "_np", ".", "linspace", "(", "0", ",", "4", "*", ...
Simulate some data drawn from sine and cosine for use in demos of MRD
[ "Simulate", "some", "data", "drawn", "from", "sine", "and", "cosine", "for", "use", "in", "demos", "of", "MRD" ]
python
train
apache/incubator-heron
heron/tools/tracker/src/python/handlers/exceptionsummaryhandler.py
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/exceptionsummaryhandler.py#L75-L129
def getComponentExceptionSummary(self, tmaster, component_name, instances=[], callback=None): """ Get the summary of exceptions for component_name and list of instances. Empty instance list will fetch all exceptions. """ if not tmaster or not tmaster.host or not tmaster.stats_port: return ...
[ "def", "getComponentExceptionSummary", "(", "self", ",", "tmaster", ",", "component_name", ",", "instances", "=", "[", "]", ",", "callback", "=", "None", ")", ":", "if", "not", "tmaster", "or", "not", "tmaster", ".", "host", "or", "not", "tmaster", ".", ...
Get the summary of exceptions for component_name and list of instances. Empty instance list will fetch all exceptions.
[ "Get", "the", "summary", "of", "exceptions", "for", "component_name", "and", "list", "of", "instances", ".", "Empty", "instance", "list", "will", "fetch", "all", "exceptions", "." ]
python
valid
jic-dtool/dtool-http
dtool_http/publish.py
https://github.com/jic-dtool/dtool-http/blob/7572221b07d5294aa9ead5097a4f16478837e742/dtool_http/publish.py#L9-L31
def publish(dataset_uri): """Return access URL to HTTP enabled (published) dataset. Exits with error code 1 if the dataset_uri is not a dataset. Exits with error code 2 if the dataset cannot be HTTP enabled. """ try: dataset = dtoolcore.DataSet.from_uri(dataset_uri) except dtoolcore.Dt...
[ "def", "publish", "(", "dataset_uri", ")", ":", "try", ":", "dataset", "=", "dtoolcore", ".", "DataSet", ".", "from_uri", "(", "dataset_uri", ")", "except", "dtoolcore", ".", "DtoolCoreTypeError", ":", "print", "(", "\"Not a dataset: {}\"", ".", "format", "(",...
Return access URL to HTTP enabled (published) dataset. Exits with error code 1 if the dataset_uri is not a dataset. Exits with error code 2 if the dataset cannot be HTTP enabled.
[ "Return", "access", "URL", "to", "HTTP", "enabled", "(", "published", ")", "dataset", "." ]
python
train
pybel/pybel
src/pybel/utils.py
https://github.com/pybel/pybel/blob/c8a7a1bdae4c475fa2a8c77f3a9a5f6d79556ca0/src/pybel/utils.py#L236-L244
def hash_evidence(text: str, type: str, reference: str) -> str: """Create a hash for an evidence and its citation. :param text: The evidence text :param type: The corresponding citation type :param reference: The citation reference """ s = u'{type}:{reference}:{text}'.format(type=type, referenc...
[ "def", "hash_evidence", "(", "text", ":", "str", ",", "type", ":", "str", ",", "reference", ":", "str", ")", "->", "str", ":", "s", "=", "u'{type}:{reference}:{text}'", ".", "format", "(", "type", "=", "type", ",", "reference", "=", "reference", ",", "...
Create a hash for an evidence and its citation. :param text: The evidence text :param type: The corresponding citation type :param reference: The citation reference
[ "Create", "a", "hash", "for", "an", "evidence", "and", "its", "citation", "." ]
python
train
bcbio/bcbio-nextgen
bcbio/provenance/system.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/provenance/system.py#L128-L144
def _sge_info(queue): """Returns machine information for an sge job scheduler. """ qhost_out = subprocess.check_output(["qhost", "-q", "-xml"]).decode() qstat_queue = ["-q", queue] if queue and "," not in queue else [] qstat_out = subprocess.check_output(["qstat", "-f", "-xml"] + qstat_queue).decode...
[ "def", "_sge_info", "(", "queue", ")", ":", "qhost_out", "=", "subprocess", ".", "check_output", "(", "[", "\"qhost\"", ",", "\"-q\"", ",", "\"-xml\"", "]", ")", ".", "decode", "(", ")", "qstat_queue", "=", "[", "\"-q\"", ",", "queue", "]", "if", "queu...
Returns machine information for an sge job scheduler.
[ "Returns", "machine", "information", "for", "an", "sge", "job", "scheduler", "." ]
python
train
pycontribs/pyrax
pyrax/clouddns.py
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddns.py#L423-L433
def list_next_page(self): """ When paging through results, this will return the next page, using the same limit. If there are no more results, a NoMoreResults exception will be raised. """ uri = self._paging.get("domain", {}).get("next_uri") if uri is None: ...
[ "def", "list_next_page", "(", "self", ")", ":", "uri", "=", "self", ".", "_paging", ".", "get", "(", "\"domain\"", ",", "{", "}", ")", ".", "get", "(", "\"next_uri\"", ")", "if", "uri", "is", "None", ":", "raise", "exc", ".", "NoMoreResults", "(", ...
When paging through results, this will return the next page, using the same limit. If there are no more results, a NoMoreResults exception will be raised.
[ "When", "paging", "through", "results", "this", "will", "return", "the", "next", "page", "using", "the", "same", "limit", ".", "If", "there", "are", "no", "more", "results", "a", "NoMoreResults", "exception", "will", "be", "raised", "." ]
python
train
gwastro/pycbc
pycbc/waveform/waveform.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/waveform/waveform.py#L1063-L1071
def get_waveform_filter_length_in_time(approximant, template=None, **kwargs): """For filter templates, return the length in time of the template. """ kwargs = props(template, **kwargs) if approximant in _filter_time_lengths: return _filter_time_lengths[approximant](**kwargs) else: r...
[ "def", "get_waveform_filter_length_in_time", "(", "approximant", ",", "template", "=", "None", ",", "*", "*", "kwargs", ")", ":", "kwargs", "=", "props", "(", "template", ",", "*", "*", "kwargs", ")", "if", "approximant", "in", "_filter_time_lengths", ":", "...
For filter templates, return the length in time of the template.
[ "For", "filter", "templates", "return", "the", "length", "in", "time", "of", "the", "template", "." ]
python
train
richardchien/nonebot
nonebot/natural_language.py
https://github.com/richardchien/nonebot/blob/13ed9e4e87d9824b61592520aabda6d2737c8848/nonebot/natural_language.py#L30-L58
def on_natural_language(keywords: Union[Optional[Iterable], Callable] = None, *, permission: int = perm.EVERYBODY, only_to_me: bool = True, only_short_message: bool = True, allow_empty_message: bool = False) -> Callable: ...
[ "def", "on_natural_language", "(", "keywords", ":", "Union", "[", "Optional", "[", "Iterable", "]", ",", "Callable", "]", "=", "None", ",", "*", ",", "permission", ":", "int", "=", "perm", ".", "EVERYBODY", ",", "only_to_me", ":", "bool", "=", "True", ...
Decorator to register a function as a natural language processor. :param keywords: keywords to respond to, if None, respond to all messages :param permission: permission required by the processor :param only_to_me: only handle messages to me :param only_short_message: only handle short messages :pa...
[ "Decorator", "to", "register", "a", "function", "as", "a", "natural", "language", "processor", "." ]
python
train
tamasgal/km3pipe
km3pipe/hardware.py
https://github.com/tamasgal/km3pipe/blob/7a9b59ac899a28775b5bdc5d391d9a5340d08040/km3pipe/hardware.py#L121-L127
def _extract_comments(self): """Retrieve all comments from the file""" self._det_file.seek(0, 0) for line in self._det_file.readlines(): line = line.strip() if line.startswith('#'): self.add_comment(line[1:])
[ "def", "_extract_comments", "(", "self", ")", ":", "self", ".", "_det_file", ".", "seek", "(", "0", ",", "0", ")", "for", "line", "in", "self", ".", "_det_file", ".", "readlines", "(", ")", ":", "line", "=", "line", ".", "strip", "(", ")", "if", ...
Retrieve all comments from the file
[ "Retrieve", "all", "comments", "from", "the", "file" ]
python
train
eandersson/amqpstorm
amqpstorm/channel.py
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/channel.py#L454-L481
def _close_channel(self, frame_in): """Close Channel. :param specification.Channel.Close frame_in: Channel Close frame. :return: """ if frame_in.reply_code != 200: reply_text = try_utf8_decode(frame_in.reply_text) message = ( 'Channel %d w...
[ "def", "_close_channel", "(", "self", ",", "frame_in", ")", ":", "if", "frame_in", ".", "reply_code", "!=", "200", ":", "reply_text", "=", "try_utf8_decode", "(", "frame_in", ".", "reply_text", ")", "message", "=", "(", "'Channel %d was closed by remote server: %s...
Close Channel. :param specification.Channel.Close frame_in: Channel Close frame. :return:
[ "Close", "Channel", "." ]
python
train
BreakingBytes/simkit
simkit/core/simulations.py
https://github.com/BreakingBytes/simkit/blob/205163d879d3880b6c9ef609f1b723a58773026b/simkit/core/simulations.py#L519-L535
def pause(self, progress_hook=None): """ Pause the simulation. How is this different from stopping it? Maintain info sufficient to restart simulation. Sets ``is_paused`` to True. Will this state allow analysis? changing parameters? What can you do with a paused simulation? ...
[ "def", "pause", "(", "self", ",", "progress_hook", "=", "None", ")", ":", "# default progress hook", "if", "progress_hook", "is", "None", ":", "progress_hook", "=", "sim_progress_hook", "progress_hook", "(", "'simulation paused'", ")", "self", ".", "cmd_queue", "....
Pause the simulation. How is this different from stopping it? Maintain info sufficient to restart simulation. Sets ``is_paused`` to True. Will this state allow analysis? changing parameters? What can you do with a paused simulation? Should be capable of saving paused simulation for loadi...
[ "Pause", "the", "simulation", ".", "How", "is", "this", "different", "from", "stopping", "it?", "Maintain", "info", "sufficient", "to", "restart", "simulation", ".", "Sets", "is_paused", "to", "True", ".", "Will", "this", "state", "allow", "analysis?", "changi...
python
train
deepmipt/DeepPavlov
deeppavlov/core/layers/tf_csoftmax_attention.py
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/layers/tf_csoftmax_attention.py#L75-L90
def csoftmax(tensor, inv_cumulative_att): """ It is a implementation of the constrained softmax (csoftmax). Based on the paper: https://andre-martins.github.io/docs/emnlp2017_final.pdf "Learning What's Easy: Fully Differentiable Neural Easy-First Taggers" Args: tensor: A tensorflow tenso...
[ "def", "csoftmax", "(", "tensor", ",", "inv_cumulative_att", ")", ":", "shape_ten", "=", "tensor", ".", "shape", "shape_cum", "=", "inv_cumulative_att", ".", "shape", "merge_tensor", "=", "[", "tensor", ",", "inv_cumulative_att", "]", "cs", ",", "_", "=", "t...
It is a implementation of the constrained softmax (csoftmax). Based on the paper: https://andre-martins.github.io/docs/emnlp2017_final.pdf "Learning What's Easy: Fully Differentiable Neural Easy-First Taggers" Args: tensor: A tensorflow tensor is score. This tensor have dimensionality [None,...
[ "It", "is", "a", "implementation", "of", "the", "constrained", "softmax", "(", "csoftmax", ")", ".", "Based", "on", "the", "paper", ":", "https", ":", "//", "andre", "-", "martins", ".", "github", ".", "io", "/", "docs", "/", "emnlp2017_final", ".", "p...
python
test
log2timeline/plaso
plaso/output/timesketch_out.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/output/timesketch_out.py#L42-L55
def Close(self): """Closes the connection to TimeSketch Elasticsearch database. Sends the remaining events for indexing and removes the processing status on the Timesketch search index object. """ super(TimesketchOutputModule, self).Close() with self._timesketch.app_context(): search_ind...
[ "def", "Close", "(", "self", ")", ":", "super", "(", "TimesketchOutputModule", ",", "self", ")", ".", "Close", "(", ")", "with", "self", ".", "_timesketch", ".", "app_context", "(", ")", ":", "search_index", "=", "timesketch_sketch", ".", "SearchIndex", "....
Closes the connection to TimeSketch Elasticsearch database. Sends the remaining events for indexing and removes the processing status on the Timesketch search index object.
[ "Closes", "the", "connection", "to", "TimeSketch", "Elasticsearch", "database", "." ]
python
train
sods/ods
pods/assesser.py
https://github.com/sods/ods/blob/3995c659f25a0a640f6009ed7fcc2559ce659b1d/pods/assesser.py#L145-L150
def latex(self): """Gives a latex representation of the assessment.""" output = self.latex_preamble output += self._repr_latex_() output += self.latex_post return output
[ "def", "latex", "(", "self", ")", ":", "output", "=", "self", ".", "latex_preamble", "output", "+=", "self", ".", "_repr_latex_", "(", ")", "output", "+=", "self", ".", "latex_post", "return", "output" ]
Gives a latex representation of the assessment.
[ "Gives", "a", "latex", "representation", "of", "the", "assessment", "." ]
python
train
jazzband/django-analytical
analytical/templatetags/uservoice.py
https://github.com/jazzband/django-analytical/blob/5487fd677bd47bc63fc2cf39597a0adc5d6c9ab3/analytical/templatetags/uservoice.py#L36-L47
def uservoice(parser, token): """ UserVoice tracking template tag. Renders Javascript code to track page visits. You must supply your UserVoice Widget Key in the ``USERVOICE_WIDGET_KEY`` setting or the ``uservoice_widget_key`` template context variable. """ bits = token.split_contents() ...
[ "def", "uservoice", "(", "parser", ",", "token", ")", ":", "bits", "=", "token", ".", "split_contents", "(", ")", "if", "len", "(", "bits", ")", ">", "1", ":", "raise", "TemplateSyntaxError", "(", "\"'%s' takes no arguments\"", "%", "bits", "[", "0", "]"...
UserVoice tracking template tag. Renders Javascript code to track page visits. You must supply your UserVoice Widget Key in the ``USERVOICE_WIDGET_KEY`` setting or the ``uservoice_widget_key`` template context variable.
[ "UserVoice", "tracking", "template", "tag", "." ]
python
valid
clinicedc/edc-notification
edc_notification/decorators.py
https://github.com/clinicedc/edc-notification/blob/79e43a44261e37566c63a8780d80b0d8ece89cc9/edc_notification/decorators.py#L9-L23
def register(**kwargs): """Registers a notification_cls. """ def _wrapper(notification_cls): if not issubclass(notification_cls, (Notification,)): raise RegisterNotificationError( f"Wrapped class must be a 'Notification' class. " f"Got '{notification_cls...
[ "def", "register", "(", "*", "*", "kwargs", ")", ":", "def", "_wrapper", "(", "notification_cls", ")", ":", "if", "not", "issubclass", "(", "notification_cls", ",", "(", "Notification", ",", ")", ")", ":", "raise", "RegisterNotificationError", "(", "f\"Wrapp...
Registers a notification_cls.
[ "Registers", "a", "notification_cls", "." ]
python
train
twisted/vertex
vertex/ptcp.py
https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/ptcp.py#L986-L993
def waitForAllConnectionsToClose(self): """ Wait for all currently-open connections to enter the 'CLOSED' state. Currently this is only usable from test fixtures. """ if not self._connections: return self._stop() return self._allConnectionsClosed.deferred().ad...
[ "def", "waitForAllConnectionsToClose", "(", "self", ")", ":", "if", "not", "self", ".", "_connections", ":", "return", "self", ".", "_stop", "(", ")", "return", "self", ".", "_allConnectionsClosed", ".", "deferred", "(", ")", ".", "addBoth", "(", "self", "...
Wait for all currently-open connections to enter the 'CLOSED' state. Currently this is only usable from test fixtures.
[ "Wait", "for", "all", "currently", "-", "open", "connections", "to", "enter", "the", "CLOSED", "state", ".", "Currently", "this", "is", "only", "usable", "from", "test", "fixtures", "." ]
python
train
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L58-L62
def store_dummy_router_net(self, net_id, subnet_id, rtr_id): """Storing the router attributes. """ self.dummy_net_id = net_id self.dummy_subnet_id = subnet_id self.dummy_router_id = rtr_id
[ "def", "store_dummy_router_net", "(", "self", ",", "net_id", ",", "subnet_id", ",", "rtr_id", ")", ":", "self", ".", "dummy_net_id", "=", "net_id", "self", ".", "dummy_subnet_id", "=", "subnet_id", "self", ".", "dummy_router_id", "=", "rtr_id" ]
Storing the router attributes.
[ "Storing", "the", "router", "attributes", "." ]
python
train
klis87/django-cloudinary-storage
cloudinary_storage/management/commands/deleteorphanedmedia.py
https://github.com/klis87/django-cloudinary-storage/blob/b8cabd2ebbf67b9cfbbf4defee1a750fea5950a9/cloudinary_storage/management/commands/deleteorphanedmedia.py#L30-L36
def model_file_fields(self, model): """ Generator yielding all instances of FileField and its subclasses of a model. """ for field in model._meta.fields: if isinstance(field, models.FileField): yield field
[ "def", "model_file_fields", "(", "self", ",", "model", ")", ":", "for", "field", "in", "model", ".", "_meta", ".", "fields", ":", "if", "isinstance", "(", "field", ",", "models", ".", "FileField", ")", ":", "yield", "field" ]
Generator yielding all instances of FileField and its subclasses of a model.
[ "Generator", "yielding", "all", "instances", "of", "FileField", "and", "its", "subclasses", "of", "a", "model", "." ]
python
train
raymontag/kppy
kppy/database.py
https://github.com/raymontag/kppy/blob/a43f1fff7d49da1da4b3d8628a1b3ebbaf47f43a/kppy/database.py#L654-L662
def _move_group_helper(self, group): """A helper to move the chidren of a group.""" for i in group.children: self.groups.remove(i) i.level = group.level + 1 self.groups.insert(self.groups.index(group) + 1, i) if i.children: self._move_grou...
[ "def", "_move_group_helper", "(", "self", ",", "group", ")", ":", "for", "i", "in", "group", ".", "children", ":", "self", ".", "groups", ".", "remove", "(", "i", ")", "i", ".", "level", "=", "group", ".", "level", "+", "1", "self", ".", "groups", ...
A helper to move the chidren of a group.
[ "A", "helper", "to", "move", "the", "chidren", "of", "a", "group", "." ]
python
train
mkoura/dump2polarion
dump2polarion/results/ostriztools.py
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/results/ostriztools.py#L97-L120
def _append_record(test_data, results, test_path): """Adds data of single testcase results to results database.""" statuses = test_data.get("statuses") jenkins_data = test_data.get("jenkins") or {} data = [ ("title", test_data.get("test_name") or _get_testname(test_path)), ("verdict", s...
[ "def", "_append_record", "(", "test_data", ",", "results", ",", "test_path", ")", ":", "statuses", "=", "test_data", ".", "get", "(", "\"statuses\"", ")", "jenkins_data", "=", "test_data", ".", "get", "(", "\"jenkins\"", ")", "or", "{", "}", "data", "=", ...
Adds data of single testcase results to results database.
[ "Adds", "data", "of", "single", "testcase", "results", "to", "results", "database", "." ]
python
train
pytest-dev/pluggy
pluggy/manager.py
https://github.com/pytest-dev/pluggy/blob/4de9e440eeadd9f0eb8c5232b349ef64e20e33fb/pluggy/manager.py#L158-L179
def add_hookspecs(self, module_or_class): """ add new hook specifications defined in the given module_or_class. Functions are recognized if they have been decorated accordingly. """ names = [] for name in dir(module_or_class): spec_opts = self.parse_hookspec_opts(module_or_cl...
[ "def", "add_hookspecs", "(", "self", ",", "module_or_class", ")", ":", "names", "=", "[", "]", "for", "name", "in", "dir", "(", "module_or_class", ")", ":", "spec_opts", "=", "self", ".", "parse_hookspec_opts", "(", "module_or_class", ",", "name", ")", "if...
add new hook specifications defined in the given module_or_class. Functions are recognized if they have been decorated accordingly.
[ "add", "new", "hook", "specifications", "defined", "in", "the", "given", "module_or_class", ".", "Functions", "are", "recognized", "if", "they", "have", "been", "decorated", "accordingly", "." ]
python
train
dnanexus/dx-toolkit
src/python/dxpy/bindings/search.py
https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/search.py#L528-L622
def find_global_executables(method, name=None, name_mode='exact', category=None, all_versions=None, published=None, billed_to=None, created_by=None, developer=None, created_after=None, created_before=None, mo...
[ "def", "find_global_executables", "(", "method", ",", "name", "=", "None", ",", "name_mode", "=", "'exact'", ",", "category", "=", "None", ",", "all_versions", "=", "None", ",", "published", "=", "None", ",", "billed_to", "=", "None", ",", "created_by", "=...
:param method: Name of the API method used to find the global executable (app or a global workflow). :type name: function :param name: Name of the app or a global workflow (also see *name_mode*) :type name: string :param name_mode: Method by which to interpret the *name* field ("exact": exact match, "gl...
[ ":", "param", "method", ":", "Name", "of", "the", "API", "method", "used", "to", "find", "the", "global", "executable", "(", "app", "or", "a", "global", "workflow", ")", ".", ":", "type", "name", ":", "function", ":", "param", "name", ":", "Name", "o...
python
train
tensorflow/tensor2tensor
tensor2tensor/layers/common_layers.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L2688-L2721
def padded_cross_entropy_factored(factored_logits, labels, label_smoothing, weights_fn=weights_nonzero, reduce_sum=True): """Memory-efficient computation of smoothing cross-entropy. ...
[ "def", "padded_cross_entropy_factored", "(", "factored_logits", ",", "labels", ",", "label_smoothing", ",", "weights_fn", "=", "weights_nonzero", ",", "reduce_sum", "=", "True", ")", ":", "a", "=", "factored_logits", ".", "a", "b", "=", "factored_logits", ".", "...
Memory-efficient computation of smoothing cross-entropy. Avoids realizing the entire logits matrix at once. Args: factored_logits: a `FactoredTensor` representing a Tensor with shape `[batch, timesteps, vocab_size]`. labels: an integer `Tensor` with shape `[batch, timesteps]`. label_smoothing: ...
[ "Memory", "-", "efficient", "computation", "of", "smoothing", "cross", "-", "entropy", "." ]
python
train
msmbuilder/msmbuilder
msmbuilder/msm/validation/bootstrapmsm.py
https://github.com/msmbuilder/msmbuilder/blob/556a93a170782f47be53f4a1e9d740fb1c8272b3/msmbuilder/msm/validation/bootstrapmsm.py#L199-L214
def _mapped_populations(mdl1, mdl2): """ Method to get the populations for states in mdl 1 from populations inferred in mdl 2. Resorts to 0 if population is not present. """ return_vect = np.zeros(mdl1.n_states_) for i in range(mdl1.n_states_): try: #there has to be a bet...
[ "def", "_mapped_populations", "(", "mdl1", ",", "mdl2", ")", ":", "return_vect", "=", "np", ".", "zeros", "(", "mdl1", ".", "n_states_", ")", "for", "i", "in", "range", "(", "mdl1", ".", "n_states_", ")", ":", "try", ":", "#there has to be a better way to ...
Method to get the populations for states in mdl 1 from populations inferred in mdl 2. Resorts to 0 if population is not present.
[ "Method", "to", "get", "the", "populations", "for", "states", "in", "mdl", "1", "from", "populations", "inferred", "in", "mdl", "2", ".", "Resorts", "to", "0", "if", "population", "is", "not", "present", "." ]
python
train
duniter/duniter-python-api
duniterpy/key/signing_key.py
https://github.com/duniter/duniter-python-api/blob/3a1e5d61a2f72f5afaf29d010c6cf4dff3648165/duniterpy/key/signing_key.py#L311-L363
def from_ewif_hex(cls: Type[SigningKeyType], ewif_hex: str, password: str) -> SigningKeyType: """ Return SigningKey instance from Duniter EWIF in hexadecimal format :param ewif_hex: EWIF string in hexadecimal format :param password: Password of the encrypted seed """ ewi...
[ "def", "from_ewif_hex", "(", "cls", ":", "Type", "[", "SigningKeyType", "]", ",", "ewif_hex", ":", "str", ",", "password", ":", "str", ")", "->", "SigningKeyType", ":", "ewif_bytes", "=", "Base58Encoder", ".", "decode", "(", "ewif_hex", ")", "if", "len", ...
Return SigningKey instance from Duniter EWIF in hexadecimal format :param ewif_hex: EWIF string in hexadecimal format :param password: Password of the encrypted seed
[ "Return", "SigningKey", "instance", "from", "Duniter", "EWIF", "in", "hexadecimal", "format" ]
python
train
h2non/pook
pook/request.py
https://github.com/h2non/pook/blob/e64094e41e4d89d98d2d29af7608ef27dc50cf19/pook/request.py#L141-L151
def copy(self): """ Copies the current Request object instance for side-effects purposes. Returns: pook.Request: copy of the current Request instance. """ req = type(self)() req.__dict__ = self.__dict__.copy() req._headers = self.headers.copy() ...
[ "def", "copy", "(", "self", ")", ":", "req", "=", "type", "(", "self", ")", "(", ")", "req", ".", "__dict__", "=", "self", ".", "__dict__", ".", "copy", "(", ")", "req", ".", "_headers", "=", "self", ".", "headers", ".", "copy", "(", ")", "retu...
Copies the current Request object instance for side-effects purposes. Returns: pook.Request: copy of the current Request instance.
[ "Copies", "the", "current", "Request", "object", "instance", "for", "side", "-", "effects", "purposes", "." ]
python
test
317070/python-twitch-stream
twitchstream/outputvideo.py
https://github.com/317070/python-twitch-stream/blob/83b4c2a27ee368fc3316b59ab1d25fcf0b0bcda6/twitchstream/outputvideo.py#L209-L237
def send_audio(self, left_channel, right_channel): """Add the audio samples to the stream. The left and the right channel should have the same shape. Raises an OSError when the stream is closed. :param left_channel: array containing the audio signal. :type left_channel: numpy ar...
[ "def", "send_audio", "(", "self", ",", "left_channel", ",", "right_channel", ")", ":", "if", "self", ".", "audio_pipe", "is", "None", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "'/tmp/audiopipe'", ")", ":", "os", ".", "mkfifo", "(", "'/tm...
Add the audio samples to the stream. The left and the right channel should have the same shape. Raises an OSError when the stream is closed. :param left_channel: array containing the audio signal. :type left_channel: numpy array with shape (k, ) containing values between -1....
[ "Add", "the", "audio", "samples", "to", "the", "stream", ".", "The", "left", "and", "the", "right", "channel", "should", "have", "the", "same", "shape", ".", "Raises", "an", "OSError", "when", "the", "stream", "is", "closed", "." ]
python
train
asciimoo/drawille
drawille.py
https://github.com/asciimoo/drawille/blob/ab58bba76cad68674ce50df7382c235ed21ab5ae/drawille.py#L242-L255
def frame(self, min_x=None, min_y=None, max_x=None, max_y=None): """String representation of the current :class:`Canvas` object pixels. :param min_x: (optional) minimum x coordinate of the canvas :param min_y: (optional) minimum y coordinate of the canvas :param max_x: (optional) maximu...
[ "def", "frame", "(", "self", ",", "min_x", "=", "None", ",", "min_y", "=", "None", ",", "max_x", "=", "None", ",", "max_y", "=", "None", ")", ":", "ret", "=", "self", ".", "line_ending", ".", "join", "(", "self", ".", "rows", "(", "min_x", ",", ...
String representation of the current :class:`Canvas` object pixels. :param min_x: (optional) minimum x coordinate of the canvas :param min_y: (optional) minimum y coordinate of the canvas :param max_x: (optional) maximum x coordinate of the canvas :param max_y: (optional) maximum y coor...
[ "String", "representation", "of", "the", "current", ":", "class", ":", "Canvas", "object", "pixels", "." ]
python
train
7sDream/zhihu-py3
zhihu/question.py
https://github.com/7sDream/zhihu-py3/blob/bcb4aa8325f8b54d3b44bd0bdc959edd9761fcfc/zhihu/question.py#L375-L390
def refresh(self): """刷新 Question object 的属性. 例如回答数增加了, 先调用 ``refresh()`` 再访问 answer_num 属性, 可获得更新后的答案数量. :return: None """ super().refresh() self._html = None self._title = None self._details = None self._answer_num = None ...
[ "def", "refresh", "(", "self", ")", ":", "super", "(", ")", ".", "refresh", "(", ")", "self", ".", "_html", "=", "None", "self", ".", "_title", "=", "None", "self", ".", "_details", "=", "None", "self", ".", "_answer_num", "=", "None", "self", ".",...
刷新 Question object 的属性. 例如回答数增加了, 先调用 ``refresh()`` 再访问 answer_num 属性, 可获得更新后的答案数量. :return: None
[ "刷新", "Question", "object", "的属性", ".", "例如回答数增加了", "先调用", "refresh", "()", "再访问", "answer_num", "属性", "可获得更新后的答案数量", ".", ":", "return", ":", "None" ]
python
train
leonidessaguisagjr/unicodeutil
unicodeutil/hangulutil.py
https://github.com/leonidessaguisagjr/unicodeutil/blob/c25c882cf9cb38c123df49fad365be67e5818928/unicodeutil/hangulutil.py#L215-L230
def _get_hangul_syllable_name(hangul_syllable): """ Function for taking a Unicode scalar value representing a Hangul syllable and converting it to its syllable name as defined by the Unicode naming rule NR1. See the Unicode Standard, ch. 04, section 4.8, Names, for more information. :param hangul_syll...
[ "def", "_get_hangul_syllable_name", "(", "hangul_syllable", ")", ":", "if", "not", "_is_hangul_syllable", "(", "hangul_syllable", ")", ":", "raise", "ValueError", "(", "\"Value passed in does not represent a Hangul syllable!\"", ")", "jamo", "=", "decompose_hangul_syllable", ...
Function for taking a Unicode scalar value representing a Hangul syllable and converting it to its syllable name as defined by the Unicode naming rule NR1. See the Unicode Standard, ch. 04, section 4.8, Names, for more information. :param hangul_syllable: Unicode scalar value representing the Hangul syllable ...
[ "Function", "for", "taking", "a", "Unicode", "scalar", "value", "representing", "a", "Hangul", "syllable", "and", "converting", "it", "to", "its", "syllable", "name", "as", "defined", "by", "the", "Unicode", "naming", "rule", "NR1", ".", "See", "the", "Unico...
python
train
log2timeline/plaso
plaso/parsers/mediator.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/parsers/mediator.py#L628-L639
def SetStorageWriter(self, storage_writer): """Sets the storage writer. Args: storage_writer (StorageWriter): storage writer. """ self._storage_writer = storage_writer # Reset the last event data information. Each storage file should # contain event data for their events. self._last_...
[ "def", "SetStorageWriter", "(", "self", ",", "storage_writer", ")", ":", "self", ".", "_storage_writer", "=", "storage_writer", "# Reset the last event data information. Each storage file should", "# contain event data for their events.", "self", ".", "_last_event_data_hash", "="...
Sets the storage writer. Args: storage_writer (StorageWriter): storage writer.
[ "Sets", "the", "storage", "writer", "." ]
python
train
google/grr
grr/server/grr_response_server/export.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/export.py#L1772-L1794
def ConvertValues(default_metadata, values, token=None, options=None): """Converts a set of RDFValues into a set of export-friendly RDFValues. Args: default_metadata: export.ExportedMetadata instance with basic information about where the values come from. This metadata will be passed to exporters....
[ "def", "ConvertValues", "(", "default_metadata", ",", "values", ",", "token", "=", "None", ",", "options", "=", "None", ")", ":", "batch_data", "=", "[", "(", "default_metadata", ",", "obj", ")", "for", "obj", "in", "values", "]", "return", "ConvertValuesW...
Converts a set of RDFValues into a set of export-friendly RDFValues. Args: default_metadata: export.ExportedMetadata instance with basic information about where the values come from. This metadata will be passed to exporters. values: Values to convert. They should be of the same type. token: ...
[ "Converts", "a", "set", "of", "RDFValues", "into", "a", "set", "of", "export", "-", "friendly", "RDFValues", "." ]
python
train
AltSchool/dynamic-rest
dynamic_rest/links.py
https://github.com/AltSchool/dynamic-rest/blob/5b0338c3dd8bc638d60c3bb92645857c5b89c920/dynamic_rest/links.py#L8-L48
def merge_link_object(serializer, data, instance): """Add a 'links' attribute to the data that maps field names to URLs. NOTE: This is the format that Ember Data supports, but alternative implementations are possible to support other formats. """ link_object = {} if not getattr(instance...
[ "def", "merge_link_object", "(", "serializer", ",", "data", ",", "instance", ")", ":", "link_object", "=", "{", "}", "if", "not", "getattr", "(", "instance", ",", "'pk'", ",", "None", ")", ":", "# If instance doesn't have a `pk` field, we'll assume it doesn't", "#...
Add a 'links' attribute to the data that maps field names to URLs. NOTE: This is the format that Ember Data supports, but alternative implementations are possible to support other formats.
[ "Add", "a", "links", "attribute", "to", "the", "data", "that", "maps", "field", "names", "to", "URLs", "." ]
python
train
pyviz/geoviews
geoviews/util.py
https://github.com/pyviz/geoviews/blob/cc70ac2d5a96307769bc6192eaef8576c3d24b30/geoviews/util.py#L256-L299
def path_to_geom_dicts(path, skip_invalid=True): """ Converts a Path element into a list of geometry dictionaries, preserving all value dimensions. """ interface = path.interface.datatype if interface == 'geodataframe': return [row.to_dict() for _, row in path.data.iterrows()] elif i...
[ "def", "path_to_geom_dicts", "(", "path", ",", "skip_invalid", "=", "True", ")", ":", "interface", "=", "path", ".", "interface", ".", "datatype", "if", "interface", "==", "'geodataframe'", ":", "return", "[", "row", ".", "to_dict", "(", ")", "for", "_", ...
Converts a Path element into a list of geometry dictionaries, preserving all value dimensions.
[ "Converts", "a", "Path", "element", "into", "a", "list", "of", "geometry", "dictionaries", "preserving", "all", "value", "dimensions", "." ]
python
train
softlayer/softlayer-python
SoftLayer/managers/storage_utils.py
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/storage_utils.py#L409-L422
def find_snapshot_schedule_id(volume, snapshot_schedule_keyname): """Find the snapshot schedule ID for the given volume and keyname :param volume: The volume for which the snapshot ID is desired :param snapshot_schedule_keyname: The keyname of the snapshot schedule :return: Returns an int value indicat...
[ "def", "find_snapshot_schedule_id", "(", "volume", ",", "snapshot_schedule_keyname", ")", ":", "for", "schedule", "in", "volume", "[", "'schedules'", "]", ":", "if", "'type'", "in", "schedule", "and", "'keyname'", "in", "schedule", "[", "'type'", "]", ":", "if...
Find the snapshot schedule ID for the given volume and keyname :param volume: The volume for which the snapshot ID is desired :param snapshot_schedule_keyname: The keyname of the snapshot schedule :return: Returns an int value indicating the volume's snapshot schedule ID
[ "Find", "the", "snapshot", "schedule", "ID", "for", "the", "given", "volume", "and", "keyname" ]
python
train
abilian/abilian-core
abilian/services/repository/service.py
https://github.com/abilian/abilian-core/blob/0a71275bf108c3d51e13ca9e093c0249235351e3/abilian/services/repository/service.py#L453-L461
def _add_to(self, uuid, dest, other): """Add `item` to `dest` set, ensuring `item` is not present in `other` set.""" _assert_uuid(uuid) try: other.remove(uuid) except KeyError: pass dest.add(uuid)
[ "def", "_add_to", "(", "self", ",", "uuid", ",", "dest", ",", "other", ")", ":", "_assert_uuid", "(", "uuid", ")", "try", ":", "other", ".", "remove", "(", "uuid", ")", "except", "KeyError", ":", "pass", "dest", ".", "add", "(", "uuid", ")" ]
Add `item` to `dest` set, ensuring `item` is not present in `other` set.
[ "Add", "item", "to", "dest", "set", "ensuring", "item", "is", "not", "present", "in", "other", "set", "." ]
python
train
dicaso/leopard
leopard/__init__.py
https://github.com/dicaso/leopard/blob/ee9f45251aaacd1e453b135b419f4f0b50fb036e/leopard/__init__.py#L289-L316
def sectionFromFunction(function,*args,**kwargs): """ This staticmethod executes the function that is passed with the provided args and kwargs. The first line of the function docstring is used as the section title, the comments within the function body are parsed and added as the section...
[ "def", "sectionFromFunction", "(", "function", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "figures", ",", "tables", "=", "function", "(", "*", "args", ",", "*", "*", "kwargs", ")", "title", "=", "inspect", ".", "getcomments", "(", "function",...
This staticmethod executes the function that is passed with the provided args and kwargs. The first line of the function docstring is used as the section title, the comments within the function body are parsed and added as the section text. The function should return an ordered dict of figures a...
[ "This", "staticmethod", "executes", "the", "function", "that", "is", "passed", "with", "the", "provided", "args", "and", "kwargs", ".", "The", "first", "line", "of", "the", "function", "docstring", "is", "used", "as", "the", "section", "title", "the", "comme...
python
train
DataDog/integrations-core
win32_event_log/datadog_checks/win32_event_log/win32_event_log.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/win32_event_log/datadog_checks/win32_event_log/win32_event_log.py#L192-L229
def _msg_text(self): """ Generate the event's body to send to Datadog. Consider `event_format` parameter: * Only use the specified list of event properties. * If unspecified, default to the EventLog's `Message` or `InsertionStrings`. """ msg_text = u"" i...
[ "def", "_msg_text", "(", "self", ")", ":", "msg_text", "=", "u\"\"", "if", "self", ".", "_format", ":", "msg_text_fields", "=", "[", "\"%%%\\n```\"", "]", "for", "event_property", "in", "self", ".", "_format", ":", "property_value", "=", "self", ".", "even...
Generate the event's body to send to Datadog. Consider `event_format` parameter: * Only use the specified list of event properties. * If unspecified, default to the EventLog's `Message` or `InsertionStrings`.
[ "Generate", "the", "event", "s", "body", "to", "send", "to", "Datadog", "." ]
python
train
dgovil/PySignal
PySignal.py
https://github.com/dgovil/PySignal/blob/72f4ced949f81e5438bd8f15247ef7890e8cc5ff/PySignal.py#L167-L187
def block(self, signals=None, isBlocked=True): """ Sets the block on any provided signals, or to all signals :param signals: defaults to all signals. Accepts either a single string or a list of strings :param isBlocked: the state to set the signal to """ if signals: ...
[ "def", "block", "(", "self", ",", "signals", "=", "None", ",", "isBlocked", "=", "True", ")", ":", "if", "signals", ":", "try", ":", "if", "isinstance", "(", "signals", ",", "basestring", ")", ":", "signals", "=", "[", "signals", "]", "except", "Name...
Sets the block on any provided signals, or to all signals :param signals: defaults to all signals. Accepts either a single string or a list of strings :param isBlocked: the state to set the signal to
[ "Sets", "the", "block", "on", "any", "provided", "signals", "or", "to", "all", "signals" ]
python
train
pycontribs/pyrax
pyrax/identity/rax_identity.py
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/identity/rax_identity.py#L90-L118
def auth_with_token(self, token, tenant_id=None, tenant_name=None): """ If a valid token is already known, this call will use it to generate the service catalog. """ # Implementation note: # Rackspace auth uses one tenant ID for the object_store services and # ano...
[ "def", "auth_with_token", "(", "self", ",", "token", ",", "tenant_id", "=", "None", ",", "tenant_name", "=", "None", ")", ":", "# Implementation note:", "# Rackspace auth uses one tenant ID for the object_store services and", "# another for everything else. The one that the user ...
If a valid token is already known, this call will use it to generate the service catalog.
[ "If", "a", "valid", "token", "is", "already", "known", "this", "call", "will", "use", "it", "to", "generate", "the", "service", "catalog", "." ]
python
train
PSPC-SPAC-buyandsell/von_anchor
von_anchor/anchor/issuer.py
https://github.com/PSPC-SPAC-buyandsell/von_anchor/blob/78ac1de67be42a676274f4bf71fe12f66e72f309/von_anchor/anchor/issuer.py#L111-L126
async def open(self) -> 'Issuer': """ Explicit entry. Perform ancestor opening operations, then synchronize revocation registry to tails tree content. :return: current object """ LOGGER.debug('Issuer.open >>>') await super().open() for path_rr_id in Tai...
[ "async", "def", "open", "(", "self", ")", "->", "'Issuer'", ":", "LOGGER", ".", "debug", "(", "'Issuer.open >>>'", ")", "await", "super", "(", ")", ".", "open", "(", ")", "for", "path_rr_id", "in", "Tails", ".", "links", "(", "self", ".", "dir_tails", ...
Explicit entry. Perform ancestor opening operations, then synchronize revocation registry to tails tree content. :return: current object
[ "Explicit", "entry", ".", "Perform", "ancestor", "opening", "operations", "then", "synchronize", "revocation", "registry", "to", "tails", "tree", "content", "." ]
python
train
EventRegistry/event-registry-python
eventregistry/ReturnInfo.py
https://github.com/EventRegistry/event-registry-python/blob/534d20b616de02f5e1cd73665a02d189645dbeb6/eventregistry/ReturnInfo.py#L473-L497
def getConf(self): """ return configuration in a json object that stores properties set by each *InfoFlags class """ conf = { "articleInfo": self.articleInfo._getFlags().copy(), "eventInfo": self.eventInfo._getFlags().copy(), "sourceInfo": self.sourceI...
[ "def", "getConf", "(", "self", ")", ":", "conf", "=", "{", "\"articleInfo\"", ":", "self", ".", "articleInfo", ".", "_getFlags", "(", ")", ".", "copy", "(", ")", ",", "\"eventInfo\"", ":", "self", ".", "eventInfo", ".", "_getFlags", "(", ")", ".", "c...
return configuration in a json object that stores properties set by each *InfoFlags class
[ "return", "configuration", "in", "a", "json", "object", "that", "stores", "properties", "set", "by", "each", "*", "InfoFlags", "class" ]
python
train
gem/oq-engine
openquake/commonlib/logictree.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/commonlib/logictree.py#L1012-L1020
def parse_filters(self, branchset_node, uncertainty_type, filters): """ See superclass' method for description and signature specification. Converts "applyToSources" filter value by just splitting it to a list. """ if 'applyToSources' in filters: filters['applyToSour...
[ "def", "parse_filters", "(", "self", ",", "branchset_node", ",", "uncertainty_type", ",", "filters", ")", ":", "if", "'applyToSources'", "in", "filters", ":", "filters", "[", "'applyToSources'", "]", "=", "filters", "[", "'applyToSources'", "]", ".", "split", ...
See superclass' method for description and signature specification. Converts "applyToSources" filter value by just splitting it to a list.
[ "See", "superclass", "method", "for", "description", "and", "signature", "specification", "." ]
python
train
neherlab/treetime
treetime/treeregression.py
https://github.com/neherlab/treetime/blob/f6cdb58d19243a18ffdaa2b2ec71872fa00e65c0/treetime/treeregression.py#L133-L144
def CovInv(self): """ Inverse of the covariance matrix Returns ------- H : (np.array) inverse of the covariance matrix. """ self.recurse(full_matrix=True) return self.tree.root.cinv
[ "def", "CovInv", "(", "self", ")", ":", "self", ".", "recurse", "(", "full_matrix", "=", "True", ")", "return", "self", ".", "tree", ".", "root", ".", "cinv" ]
Inverse of the covariance matrix Returns ------- H : (np.array) inverse of the covariance matrix.
[ "Inverse", "of", "the", "covariance", "matrix" ]
python
test
aws/aws-iot-device-sdk-python
AWSIoTPythonSDK/core/protocol/paho/client.py
https://github.com/aws/aws-iot-device-sdk-python/blob/f0aa2ce34b21dd2e44f4fb7e1d058656aaf2fc62/AWSIoTPythonSDK/core/protocol/paho/client.py#L1305-L1313
def socket(self): """Return the socket or ssl object for this client.""" if self._ssl: if self._useSecuredWebsocket: return self._ssl.getSSLSocket() else: return self._ssl else: return self._sock
[ "def", "socket", "(", "self", ")", ":", "if", "self", ".", "_ssl", ":", "if", "self", ".", "_useSecuredWebsocket", ":", "return", "self", ".", "_ssl", ".", "getSSLSocket", "(", ")", "else", ":", "return", "self", ".", "_ssl", "else", ":", "return", "...
Return the socket or ssl object for this client.
[ "Return", "the", "socket", "or", "ssl", "object", "for", "this", "client", "." ]
python
train
wonambi-python/wonambi
wonambi/attr/annotations.py
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/attr/annotations.py#L353-L643
def import_staging(self, filename, source, rater_name, rec_start, staging_start=None, epoch_length=None, poor=['Artefact'], as_qual=False): """Import staging from an external staging text file. Parameters ---------- filename : str ...
[ "def", "import_staging", "(", "self", ",", "filename", ",", "source", ",", "rater_name", ",", "rec_start", ",", "staging_start", "=", "None", ",", "epoch_length", "=", "None", ",", "poor", "=", "[", "'Artefact'", "]", ",", "as_qual", "=", "False", ")", "...
Import staging from an external staging text file. Parameters ---------- filename : str Staging file name. source : str Name of program where staging was made. One of 'domino', 'alice', 'compumedics', 'sandman', 'remlogic' rater_name : str ...
[ "Import", "staging", "from", "an", "external", "staging", "text", "file", "." ]
python
train
pgjones/quart
quart/ctx.py
https://github.com/pgjones/quart/blob/7cb2d3bd98e8746025764f2b933abc12041fa175/quart/ctx.py#L183-L200
def after_this_request(func: Callable) -> Callable: """Schedule the func to be called after the current request. This is useful in situations whereby you want an after request function for a specific route or circumstance only, for example, .. code-block:: python def index(): @aft...
[ "def", "after_this_request", "(", "func", ":", "Callable", ")", "->", "Callable", ":", "_request_ctx_stack", ".", "top", ".", "_after_request_functions", ".", "append", "(", "func", ")", "return", "func" ]
Schedule the func to be called after the current request. This is useful in situations whereby you want an after request function for a specific route or circumstance only, for example, .. code-block:: python def index(): @after_this_request def set_cookie(response): ...
[ "Schedule", "the", "func", "to", "be", "called", "after", "the", "current", "request", "." ]
python
train
jart/fabulous
fabulous/gotham.py
https://github.com/jart/fabulous/blob/19903cf0a980b82f5928c3bec1f28b6bdd3785bd/fabulous/gotham.py#L108-L121
def main(): """I provide a command-line interface for this module """ print() print("-~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~-") print(lorem_gotham_title().center(50)) print("-~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~-") print() poem = lorem_gotham() for n in range(16...
[ "def", "main", "(", ")", ":", "print", "(", ")", "print", "(", "\"-~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~-\"", ")", "print", "(", "lorem_gotham_title", "(", ")", ".", "center", "(", "50", ")", ")", "print", "(", "\"-~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--...
I provide a command-line interface for this module
[ "I", "provide", "a", "command", "-", "line", "interface", "for", "this", "module" ]
python
train
eddiejessup/spatious
spatious/vector.py
https://github.com/eddiejessup/spatious/blob/b7ae91bec029e85a45a7f303ee184076433723cd/spatious/vector.py#L79-L98
def vector_unit_nullrand(v, rng=None): """Return unit vectors. Any null vectors are mapped to a uniformly picked unit vector. Parameters ---------- v: array, shape (a1, a2, ..., d) Cartesian vectors, with last axis indexing the dimension. Returns ------- v_new: array, shape of ...
[ "def", "vector_unit_nullrand", "(", "v", ",", "rng", "=", "None", ")", ":", "if", "v", ".", "size", "==", "0", ":", "return", "v", "mag", "=", "vector_mag", "(", "v", ")", "v_new", "=", "v", ".", "copy", "(", ")", "v_new", "[", "mag", "==", "0....
Return unit vectors. Any null vectors are mapped to a uniformly picked unit vector. Parameters ---------- v: array, shape (a1, a2, ..., d) Cartesian vectors, with last axis indexing the dimension. Returns ------- v_new: array, shape of v
[ "Return", "unit", "vectors", ".", "Any", "null", "vectors", "are", "mapped", "to", "a", "uniformly", "picked", "unit", "vector", "." ]
python
train
ranaroussi/qtpylib
qtpylib/algo.py
https://github.com/ranaroussi/qtpylib/blob/0dbbc465fafd9cb9b0f4d10e1e07fae4e15032dd/qtpylib/algo.py#L538-L625
def order(self, signal, symbol, quantity=0, **kwargs): """ Send an order for the selected instrument :Parameters: direction : string Order Type (BUY/SELL, EXIT/FLATTEN) symbol : string instrument symbol quantity : int ...
[ "def", "order", "(", "self", ",", "signal", ",", "symbol", ",", "quantity", "=", "0", ",", "*", "*", "kwargs", ")", ":", "self", ".", "log_algo", ".", "debug", "(", "'ORDER: %s %4d %s %s'", ",", "signal", ",", "quantity", ",", "symbol", ",", "kwargs", ...
Send an order for the selected instrument :Parameters: direction : string Order Type (BUY/SELL, EXIT/FLATTEN) symbol : string instrument symbol quantity : int Order quantiry :Optional: limit_price : float...
[ "Send", "an", "order", "for", "the", "selected", "instrument" ]
python
train
kwikteam/phy
phy/cluster/views/correlogram.py
https://github.com/kwikteam/phy/blob/7e9313dc364304b7d2bd03b92938347343703003/phy/cluster/views/correlogram.py#L56-L67
def set_bin_window(self, bin_size=None, window_size=None): """Set the bin and window sizes.""" bin_size = bin_size or self.bin_size window_size = window_size or self.window_size assert 1e-6 < bin_size < 1e3 assert 1e-6 < window_size < 1e3 assert bin_size < window_size ...
[ "def", "set_bin_window", "(", "self", ",", "bin_size", "=", "None", ",", "window_size", "=", "None", ")", ":", "bin_size", "=", "bin_size", "or", "self", ".", "bin_size", "window_size", "=", "window_size", "or", "self", ".", "window_size", "assert", "1e-6", ...
Set the bin and window sizes.
[ "Set", "the", "bin", "and", "window", "sizes", "." ]
python
train
AndrewAnnex/SpiceyPy
spiceypy/spiceypy.py
https://github.com/AndrewAnnex/SpiceyPy/blob/fc20a9b9de68b58eed5b332f0c051fb343a6e335/spiceypy/spiceypy.py#L14370-L14384
def unload(filename): """ Unload a SPICE kernel. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/unload_c.html :param filename: The name of a kernel to unload. :type filename: str """ if isinstance(filename, list): for f in filename: libspice.unload_c(stypes.str...
[ "def", "unload", "(", "filename", ")", ":", "if", "isinstance", "(", "filename", ",", "list", ")", ":", "for", "f", "in", "filename", ":", "libspice", ".", "unload_c", "(", "stypes", ".", "stringToCharP", "(", "f", ")", ")", "return", "filename", "=", ...
Unload a SPICE kernel. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/unload_c.html :param filename: The name of a kernel to unload. :type filename: str
[ "Unload", "a", "SPICE", "kernel", "." ]
python
train
mlavin/argyle
argyle/postgres.py
https://github.com/mlavin/argyle/blob/92cc6e1dd9b8e7cb41c5098a79d05e14b8243d72/argyle/postgres.py#L66-L70
def change_db_user_password(username, password): """Change a db user's password.""" sql = "ALTER USER %s WITH PASSWORD '%s'" % (username, password) excute_query(sql, use_sudo=True)
[ "def", "change_db_user_password", "(", "username", ",", "password", ")", ":", "sql", "=", "\"ALTER USER %s WITH PASSWORD '%s'\"", "%", "(", "username", ",", "password", ")", "excute_query", "(", "sql", ",", "use_sudo", "=", "True", ")" ]
Change a db user's password.
[ "Change", "a", "db", "user", "s", "password", "." ]
python
train
pybel/pybel
src/pybel/parser/modifiers/fusion.py
https://github.com/pybel/pybel/blob/c8a7a1bdae4c475fa2a8c77f3a9a5f6d79556ca0/src/pybel/parser/modifiers/fusion.py#L89-L106
def get_legacy_fusion_langauge(identifier: ParserElement, reference: str) -> ParserElement: """Build a legacy fusion parser.""" break_start = (ppc.integer | '?').setParseAction(_fusion_break_handler_wrapper(reference, start=True)) break_end = (ppc.integer | '?').setParseAction(_fusion_break_handler_wrapper(...
[ "def", "get_legacy_fusion_langauge", "(", "identifier", ":", "ParserElement", ",", "reference", ":", "str", ")", "->", "ParserElement", ":", "break_start", "=", "(", "ppc", ".", "integer", "|", "'?'", ")", ".", "setParseAction", "(", "_fusion_break_handler_wrapper...
Build a legacy fusion parser.
[ "Build", "a", "legacy", "fusion", "parser", "." ]
python
train