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
rflamary/POT
ot/utils.py
https://github.com/rflamary/POT/blob/c5108efc7b6702e1af3928bef1032e6b37734d1c/ot/utils.py#L32-L36
def toc(message='Elapsed time : {} s'): """ Python implementation of Matlab toc() function """ t = time.time() print(message.format(t - __time_tic_toc)) return t - __time_tic_toc
[ "def", "toc", "(", "message", "=", "'Elapsed time : {} s'", ")", ":", "t", "=", "time", ".", "time", "(", ")", "print", "(", "message", ".", "format", "(", "t", "-", "__time_tic_toc", ")", ")", "return", "t", "-", "__time_tic_toc" ]
Python implementation of Matlab toc() function
[ "Python", "implementation", "of", "Matlab", "toc", "()", "function" ]
python
train
nerdvegas/rez
src/rez/vendor/pyparsing/pyparsing.py
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/pyparsing/pyparsing.py#L617-L627
def col (loc,strg): """Returns current column within a string, counting newlines as line separators. The first column is number 1. Note: the default parsing behavior is to expand tabs in the input string before starting the parsing process. See L{I{ParserElement.parseString}<ParserElement.parseStrin...
[ "def", "col", "(", "loc", ",", "strg", ")", ":", "return", "(", "loc", "<", "len", "(", "strg", ")", "and", "strg", "[", "loc", "]", "==", "'\\n'", ")", "and", "1", "or", "loc", "-", "strg", ".", "rfind", "(", "\"\\n\"", ",", "0", ",", "loc",...
Returns current column within a string, counting newlines as line separators. The first column is number 1. Note: the default parsing behavior is to expand tabs in the input string before starting the parsing process. See L{I{ParserElement.parseString}<ParserElement.parseString>} for more information ...
[ "Returns", "current", "column", "within", "a", "string", "counting", "newlines", "as", "line", "separators", ".", "The", "first", "column", "is", "number", "1", ".", "Note", ":", "the", "default", "parsing", "behavior", "is", "to", "expand", "tabs", "in", ...
python
train
BlueBrain/hpcbench
hpcbench/driver/base.py
https://github.com/BlueBrain/hpcbench/blob/192d0ec142b897157ec25f131d1ef28f84752592/hpcbench/driver/base.py#L136-L150
def call_decorator(cls, func): """class function that MUST be specified as decorator to the `__call__` method overriden by sub-classes. """ @wraps(func) def _wrap(self, *args, **kwargs): try: return func(self, *args, **kwargs) except Excep...
[ "def", "call_decorator", "(", "cls", ",", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "_wrap", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "func", "(", "self", ",", "*", "args", ",", "*",...
class function that MUST be specified as decorator to the `__call__` method overriden by sub-classes.
[ "class", "function", "that", "MUST", "be", "specified", "as", "decorator", "to", "the", "__call__", "method", "overriden", "by", "sub", "-", "classes", "." ]
python
train
dfm/casjobs
casjobs.py
https://github.com/dfm/casjobs/blob/1cc3f5511cc254d776082909221787e3c037ac16/casjobs.py#L350-L362
def list_tables(self): """ Lists the tables in mydb. ## Returns * `tables` (list): A list of strings with all the table names from mydb. """ q = 'SELECT Distinct TABLE_NAME FROM information_schema.TABLES' res = self.quick(q, context='MYDB', task_name='listtables...
[ "def", "list_tables", "(", "self", ")", ":", "q", "=", "'SELECT Distinct TABLE_NAME FROM information_schema.TABLES'", "res", "=", "self", ".", "quick", "(", "q", ",", "context", "=", "'MYDB'", ",", "task_name", "=", "'listtables'", ",", "system", "=", "True", ...
Lists the tables in mydb. ## Returns * `tables` (list): A list of strings with all the table names from mydb.
[ "Lists", "the", "tables", "in", "mydb", "." ]
python
train
CZ-NIC/yangson
yangson/instance.py
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L524-L527
def qual_name(self) -> QualName: """Return the receiver's qualified name.""" p, s, loc = self._key.partition(":") return (loc, p) if s else (p, self.namespace)
[ "def", "qual_name", "(", "self", ")", "->", "QualName", ":", "p", ",", "s", ",", "loc", "=", "self", ".", "_key", ".", "partition", "(", "\":\"", ")", "return", "(", "loc", ",", "p", ")", "if", "s", "else", "(", "p", ",", "self", ".", "namespac...
Return the receiver's qualified name.
[ "Return", "the", "receiver", "s", "qualified", "name", "." ]
python
train
apache/incubator-mxnet
example/rcnn/symimdb/imdb.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/example/rcnn/symimdb/imdb.py#L83-L98
def append_flipped_images(self): """Only flip boxes coordinates, images will be flipped when loading into network""" logger.info('%s append flipped images to roidb' % self._name) roidb_flipped = [] for roi_rec in self._roidb: boxes = roi_rec['boxes'].copy() oldx1 ...
[ "def", "append_flipped_images", "(", "self", ")", ":", "logger", ".", "info", "(", "'%s append flipped images to roidb'", "%", "self", ".", "_name", ")", "roidb_flipped", "=", "[", "]", "for", "roi_rec", "in", "self", ".", "_roidb", ":", "boxes", "=", "roi_r...
Only flip boxes coordinates, images will be flipped when loading into network
[ "Only", "flip", "boxes", "coordinates", "images", "will", "be", "flipped", "when", "loading", "into", "network" ]
python
train
20c/xbahn
xbahn/message.py
https://github.com/20c/xbahn/blob/afb27b0576841338a366d7cac0200a782bd84be6/xbahn/message.py#L71-L79
def export(self, contentType): """ Export message to specified contentType via munge contentType <str> - eg. "json", "yaml" """ cls = munge.get_codec(contentType) codec = cls() return codec.dumps(self.__dict__())
[ "def", "export", "(", "self", ",", "contentType", ")", ":", "cls", "=", "munge", ".", "get_codec", "(", "contentType", ")", "codec", "=", "cls", "(", ")", "return", "codec", ".", "dumps", "(", "self", ".", "__dict__", "(", ")", ")" ]
Export message to specified contentType via munge contentType <str> - eg. "json", "yaml"
[ "Export", "message", "to", "specified", "contentType", "via", "munge" ]
python
train
quantopian/zipline
zipline/pipeline/graph.py
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/graph.py#L498-L503
def maybe_specialize(term, domain): """Specialize a term if it's loadable. """ if isinstance(term, LoadableTerm): return term.specialize(domain) return term
[ "def", "maybe_specialize", "(", "term", ",", "domain", ")", ":", "if", "isinstance", "(", "term", ",", "LoadableTerm", ")", ":", "return", "term", ".", "specialize", "(", "domain", ")", "return", "term" ]
Specialize a term if it's loadable.
[ "Specialize", "a", "term", "if", "it", "s", "loadable", "." ]
python
train
OSSOS/MOP
src/jjk/preproc/wcsutil.py
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/jjk/preproc/wcsutil.py#L344-L350
def copy(self,deep=yes): """ Makes a (deep)copy of this object for use by other objects. """ if deep: return copy.deepcopy(self) else: return copy.copy(self)
[ "def", "copy", "(", "self", ",", "deep", "=", "yes", ")", ":", "if", "deep", ":", "return", "copy", ".", "deepcopy", "(", "self", ")", "else", ":", "return", "copy", ".", "copy", "(", "self", ")" ]
Makes a (deep)copy of this object for use by other objects.
[ "Makes", "a", "(", "deep", ")", "copy", "of", "this", "object", "for", "use", "by", "other", "objects", "." ]
python
train
Chilipp/model-organization
model_organization/config.py
https://github.com/Chilipp/model-organization/blob/694d1219c7ed7e1b2b17153afa11bdc21169bca2/model_organization/config.py#L447-L471
def save(self): """Save the experiment configuration This method stores the configuration of each of the experiments in a file ``'<project-dir>/.project/<experiment>.yml'``, where ``'<project-dir>'`` corresponds to the project directory of the specific ``'<experiment>'``. Furthe...
[ "def", "save", "(", "self", ")", ":", "for", "exp", ",", "d", "in", "dict", "(", "self", ")", ".", "items", "(", ")", ":", "if", "isinstance", "(", "d", ",", "dict", ")", ":", "project_path", "=", "self", ".", "projects", "[", "d", "[", "'proje...
Save the experiment configuration This method stores the configuration of each of the experiments in a file ``'<project-dir>/.project/<experiment>.yml'``, where ``'<project-dir>'`` corresponds to the project directory of the specific ``'<experiment>'``. Furthermore it dumps all experime...
[ "Save", "the", "experiment", "configuration" ]
python
train
jaraco/jaraco.itertools
jaraco/itertools.py
https://github.com/jaraco/jaraco.itertools/blob/0dc47c8924fa3d9ab676c3a6e195f03f728b72c6/jaraco/itertools.py#L589-L605
def remove_duplicates(iterable, key=None): """ Given an iterable with items that may come in as sequential duplicates, remove those duplicates. Unlike unique_justseen, this function does not remove triplicates. >>> ' '.join(remove_duplicates('abcaabbccaaabbbcccbcbc')) 'a b c a b c a a b b c c b c b c' >>> ' '....
[ "def", "remove_duplicates", "(", "iterable", ",", "key", "=", "None", ")", ":", "return", "itertools", ".", "chain", ".", "from_iterable", "(", "six", ".", "moves", ".", "map", "(", "every_other", ",", "six", ".", "moves", ".", "map", "(", "operator", ...
Given an iterable with items that may come in as sequential duplicates, remove those duplicates. Unlike unique_justseen, this function does not remove triplicates. >>> ' '.join(remove_duplicates('abcaabbccaaabbbcccbcbc')) 'a b c a b c a a b b c c b c b c' >>> ' '.join(remove_duplicates('aaaabbbbb')) 'a a b b b'
[ "Given", "an", "iterable", "with", "items", "that", "may", "come", "in", "as", "sequential", "duplicates", "remove", "those", "duplicates", "." ]
python
test
molmod/molmod
molmod/molecules.py
https://github.com/molmod/molmod/blob/a7b5b4364ed514ad4c465856c05b5eda1cb561e0/molmod/molecules.py#L191-L202
def chemical_formula(self): """the chemical formula of the molecule""" counts = {} for number in self.numbers: counts[number] = counts.get(number, 0)+1 items = [] for number, count in sorted(counts.items(), reverse=True): if count == 1: ite...
[ "def", "chemical_formula", "(", "self", ")", ":", "counts", "=", "{", "}", "for", "number", "in", "self", ".", "numbers", ":", "counts", "[", "number", "]", "=", "counts", ".", "get", "(", "number", ",", "0", ")", "+", "1", "items", "=", "[", "]"...
the chemical formula of the molecule
[ "the", "chemical", "formula", "of", "the", "molecule" ]
python
train
jmbhughes/suvi-trainer
scripts/make_movie_frames.py
https://github.com/jmbhughes/suvi-trainer/blob/3d89894a4a037286221974c7eb5634d229b4f5d4/scripts/make_movie_frames.py#L61-L74
def main(): """ process the main task """ args = get_args() args.start = date_parser.parse(args.start) args.end = date_parser.parse(args.end) args.step = timedelta(args.step) config = Config(args.config) times = [args.start + i * args.step for i in range(int((args.end - args.start) ...
[ "def", "main", "(", ")", ":", "args", "=", "get_args", "(", ")", "args", ".", "start", "=", "date_parser", ".", "parse", "(", "args", ".", "start", ")", "args", ".", "end", "=", "date_parser", ".", "parse", "(", "args", ".", "end", ")", "args", "...
process the main task
[ "process", "the", "main", "task" ]
python
train
saltstack/salt
salt/modules/mac_desktop.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_desktop.py#L111-L132
def say(*words): ''' Say some words. words The words to execute the say command with. CLI Example: .. code-block:: bash salt '*' desktop.say <word0> <word1> ... <wordN> ''' cmd = 'say {0}'.format(' '.join(words)) call = __salt__['cmd.run_all']( cmd, ou...
[ "def", "say", "(", "*", "words", ")", ":", "cmd", "=", "'say {0}'", ".", "format", "(", "' '", ".", "join", "(", "words", ")", ")", "call", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "cmd", ",", "output_loglevel", "=", "'debug'", ",", "python_s...
Say some words. words The words to execute the say command with. CLI Example: .. code-block:: bash salt '*' desktop.say <word0> <word1> ... <wordN>
[ "Say", "some", "words", "." ]
python
train
quodlibet/mutagen
mutagen/aac.py
https://github.com/quodlibet/mutagen/blob/e393df5971ba41ba5a50de9c2c9e7e5484d82c4e/mutagen/aac.py#L132-L141
def frequency(self): """0 means unknown""" assert self.parsed_frames, "no frame parsed yet" f_index = self._fixed_header_key[4] try: return _FREQS[f_index] except IndexError: return 0
[ "def", "frequency", "(", "self", ")", ":", "assert", "self", ".", "parsed_frames", ",", "\"no frame parsed yet\"", "f_index", "=", "self", ".", "_fixed_header_key", "[", "4", "]", "try", ":", "return", "_FREQS", "[", "f_index", "]", "except", "IndexError", "...
0 means unknown
[ "0", "means", "unknown" ]
python
train
cokelaer/spectrum
src/spectrum/arma.py
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/arma.py#L130-L221
def arma_estimate(X, P, Q, lag): """Autoregressive and moving average estimators. This function provides an estimate of the autoregressive parameters, the moving average parameters, and the driving white noise variance of an ARMA(P,Q) for a complex or real data sequence. The parameters are estima...
[ "def", "arma_estimate", "(", "X", ",", "P", ",", "Q", ",", "lag", ")", ":", "R", "=", "CORRELATION", "(", "X", ",", "maxlags", "=", "lag", ",", "norm", "=", "'unbiased'", ")", "R0", "=", "R", "[", "0", "]", "#C Estimate the AR parameters (no error we...
Autoregressive and moving average estimators. This function provides an estimate of the autoregressive parameters, the moving average parameters, and the driving white noise variance of an ARMA(P,Q) for a complex or real data sequence. The parameters are estimated using three steps: * Estima...
[ "Autoregressive", "and", "moving", "average", "estimators", "." ]
python
valid
yyuu/botornado
boto/pyami/installers/ubuntu/installer.py
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/pyami/installers/ubuntu/installer.py#L34-L49
def add_cron(self, name, command, minute="*", hour="*", mday="*", month="*", wday="*", who="root", env=None): """ Write a file to /etc/cron.d to schedule a command env is a dict containing environment variables you want to set in the file name will be used as the name of the file...
[ "def", "add_cron", "(", "self", ",", "name", ",", "command", ",", "minute", "=", "\"*\"", ",", "hour", "=", "\"*\"", ",", "mday", "=", "\"*\"", ",", "month", "=", "\"*\"", ",", "wday", "=", "\"*\"", ",", "who", "=", "\"root\"", ",", "env", "=", "...
Write a file to /etc/cron.d to schedule a command env is a dict containing environment variables you want to set in the file name will be used as the name of the file
[ "Write", "a", "file", "to", "/", "etc", "/", "cron", ".", "d", "to", "schedule", "a", "command", "env", "is", "a", "dict", "containing", "environment", "variables", "you", "want", "to", "set", "in", "the", "file", "name", "will", "be", "used", "as", ...
python
train
bennylope/django-organizations
organizations/base.py
https://github.com/bennylope/django-organizations/blob/85f753a8f7a8f0f31636c9209fb69e7030a5c79a/organizations/base.py#L190-L230
def update_org_invite(cls, module): """ Adds the links to the organization and to the organization user """ try: cls.module_registry[module]["OrgInviteModel"]._meta.get_field("invited_by") except FieldDoesNotExist: cls.module_registry[module]["OrgInviteMod...
[ "def", "update_org_invite", "(", "cls", ",", "module", ")", ":", "try", ":", "cls", ".", "module_registry", "[", "module", "]", "[", "\"OrgInviteModel\"", "]", ".", "_meta", ".", "get_field", "(", "\"invited_by\"", ")", "except", "FieldDoesNotExist", ":", "c...
Adds the links to the organization and to the organization user
[ "Adds", "the", "links", "to", "the", "organization", "and", "to", "the", "organization", "user" ]
python
train
rdireen/spherepy
spherepy/spherepy.py
https://github.com/rdireen/spherepy/blob/241521401d4d76851d4a1a564a365cfab8e98496/spherepy/spherepy.py#L271-L294
def angular_power_spectrum(self): """Returns the angular power spectrum for the set of coefficients. That is, we compute n c_n = sum cnm * conj( cnm ) m=-n Returns: power_spectrum (numpy.array, dtype=double) spectrum as a fu...
[ "def", "angular_power_spectrum", "(", "self", ")", ":", "# Added this routine as a result of my discussions with Ajinkya Nene\t \r", "#https://github.com/anene\r", "list_of_modes", "=", "self", ".", "_reshape_m_vecs", "(", ")", "Nmodes", "=", "len", "(", "list_of_modes", ")",...
Returns the angular power spectrum for the set of coefficients. That is, we compute n c_n = sum cnm * conj( cnm ) m=-n Returns: power_spectrum (numpy.array, dtype=double) spectrum as a function of n.
[ "Returns", "the", "angular", "power", "spectrum", "for", "the", "set", "of", "coefficients", ".", "That", "is", "we", "compute", "n", "c_n", "=", "sum", "cnm", "*", "conj", "(", "cnm", ")", "m", "=", "-", "n", "Returns", ":", "power_spectrum", "(", "...
python
train
BernardFW/bernard
src/bernard/platforms/facebook/platform.py
https://github.com/BernardFW/bernard/blob/9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab/src/bernard/platforms/facebook/platform.py#L1004-L1022
def _message_from_sr(self, token: Text, payload: Any) \ -> Optional[BaseMessage]: """ Tries to verify the signed request """ page = self.settings() secret = page['app_secret'] try: sr_data = SignedRequest.parse(token, secret) except (Type...
[ "def", "_message_from_sr", "(", "self", ",", "token", ":", "Text", ",", "payload", ":", "Any", ")", "->", "Optional", "[", "BaseMessage", "]", ":", "page", "=", "self", ".", "settings", "(", ")", "secret", "=", "page", "[", "'app_secret'", "]", "try", ...
Tries to verify the signed request
[ "Tries", "to", "verify", "the", "signed", "request" ]
python
train
acrazing/dbapi
dbapi/Group.py
https://github.com/acrazing/dbapi/blob/8c1f85cb1a051daf7be1fc97a62c4499983e9898/dbapi/Group.py#L255-L263
def list_user_topics(self, start=0): """ 发表的话题 :param start: 翻页 :return: 带下一页的列表 """ xml = self.api.xml(API_GROUP_LIST_USER_PUBLISHED_TOPICS % self.api.user_alias, params={'start': start}) return build_list_result(self._parse_topic_table(xml, 'title,comme...
[ "def", "list_user_topics", "(", "self", ",", "start", "=", "0", ")", ":", "xml", "=", "self", ".", "api", ".", "xml", "(", "API_GROUP_LIST_USER_PUBLISHED_TOPICS", "%", "self", ".", "api", ".", "user_alias", ",", "params", "=", "{", "'start'", ":", "start...
发表的话题 :param start: 翻页 :return: 带下一页的列表
[ "发表的话题", ":", "param", "start", ":", "翻页", ":", "return", ":", "带下一页的列表" ]
python
train
juju/charm-helpers
charmhelpers/core/host.py
https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/core/host.py#L669-L681
def check_hash(path, checksum, hash_type='md5'): """Validate a file using a cryptographic checksum. :param str checksum: Value of the checksum used to validate the file. :param str hash_type: Hash algorithm used to generate `checksum`. Can be any hash alrgorithm supported by :mod:`hashlib`, ...
[ "def", "check_hash", "(", "path", ",", "checksum", ",", "hash_type", "=", "'md5'", ")", ":", "actual_checksum", "=", "file_hash", "(", "path", ",", "hash_type", ")", "if", "checksum", "!=", "actual_checksum", ":", "raise", "ChecksumError", "(", "\"'%s' != '%s'...
Validate a file using a cryptographic checksum. :param str checksum: Value of the checksum used to validate the file. :param str hash_type: Hash algorithm used to generate `checksum`. Can be any hash alrgorithm supported by :mod:`hashlib`, such as md5, sha1, sha256, sha512, etc. :raises Che...
[ "Validate", "a", "file", "using", "a", "cryptographic", "checksum", "." ]
python
train
Contraz/demosys-py
demosys/project/base.py
https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/project/base.py#L174-L182
def reload_programs(self): """ Reload all shader programs with the reloadable flag set """ print("Reloading programs:") for name, program in self._programs.items(): if getattr(program, 'program', None): print(" - {}".format(program.meta.label)) ...
[ "def", "reload_programs", "(", "self", ")", ":", "print", "(", "\"Reloading programs:\"", ")", "for", "name", ",", "program", "in", "self", ".", "_programs", ".", "items", "(", ")", ":", "if", "getattr", "(", "program", ",", "'program'", ",", "None", ")"...
Reload all shader programs with the reloadable flag set
[ "Reload", "all", "shader", "programs", "with", "the", "reloadable", "flag", "set" ]
python
valid
Delgan/loguru
loguru/_logger.py
https://github.com/Delgan/loguru/blob/6571879c37904e3a18567e694d70651c6886b860/loguru/_logger.py#L1013-L1079
def opt(self, *, exception=None, record=False, lazy=False, ansi=False, raw=False, depth=0): r"""Parametrize a logging call to slightly change generated log message. Parameters ---------- exception : |bool|, |tuple| or |Exception|, optional If it does not evaluate as ``False`...
[ "def", "opt", "(", "self", ",", "*", ",", "exception", "=", "None", ",", "record", "=", "False", ",", "lazy", "=", "False", ",", "ansi", "=", "False", ",", "raw", "=", "False", ",", "depth", "=", "0", ")", ":", "return", "Logger", "(", "self", ...
r"""Parametrize a logging call to slightly change generated log message. Parameters ---------- exception : |bool|, |tuple| or |Exception|, optional If it does not evaluate as ``False``, the passed exception is formatted and added to the log message. It could be an |Excep...
[ "r", "Parametrize", "a", "logging", "call", "to", "slightly", "change", "generated", "log", "message", "." ]
python
train
inveniosoftware/invenio-pidrelations
invenio_pidrelations/serializers/schemas.py
https://github.com/inveniosoftware/invenio-pidrelations/blob/a49f3725cf595b663c5b04814280b231f88bc333/invenio_pidrelations/serializers/schemas.py#L104-L109
def dump_type(self, obj): """Dump the text name of the relation.""" if not isinstance(obj.relation_type, RelationType): return resolve_relation_type_config(obj.relation_type).name else: return obj.relation_type.name
[ "def", "dump_type", "(", "self", ",", "obj", ")", ":", "if", "not", "isinstance", "(", "obj", ".", "relation_type", ",", "RelationType", ")", ":", "return", "resolve_relation_type_config", "(", "obj", ".", "relation_type", ")", ".", "name", "else", ":", "r...
Dump the text name of the relation.
[ "Dump", "the", "text", "name", "of", "the", "relation", "." ]
python
train
ianmiell/shutit
shutit_class.py
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L718-L754
def send_until(self, send, regexps, not_there=False, shutit_pexpect_child=None, cadence=5, retries=100, echo=None, note=None, debug_command=None, pause_point_on...
[ "def", "send_until", "(", "self", ",", "send", ",", "regexps", ",", "not_there", "=", "False", ",", "shutit_pexpect_child", "=", "None", ",", "cadence", "=", "5", ",", "retries", "=", "100", ",", "echo", "=", "None", ",", "note", "=", "None", ",", "d...
Send string on a regular cadence until a string is either seen, or the timeout is triggered. @param send: See send() @param regexps: List of regexps to wait for. @param not_there: If True, wait until this a regexp is not seen in the output. If False ...
[ "Send", "string", "on", "a", "regular", "cadence", "until", "a", "string", "is", "either", "seen", "or", "the", "timeout", "is", "triggered", "." ]
python
train
Roastero/freshroastsr700
freshroastsr700/__init__.py
https://github.com/Roastero/freshroastsr700/blob/49cf4961444c0f56d051d5ac5088ace480b54f02/freshroastsr700/__init__.py#L259-L264
def heat_setting(self, value): """Verifies that the heat setting is between 0 and 3.""" if value not in range(0, 4): raise exceptions.RoasterValueError self._heat_setting.value = value
[ "def", "heat_setting", "(", "self", ",", "value", ")", ":", "if", "value", "not", "in", "range", "(", "0", ",", "4", ")", ":", "raise", "exceptions", ".", "RoasterValueError", "self", ".", "_heat_setting", ".", "value", "=", "value" ]
Verifies that the heat setting is between 0 and 3.
[ "Verifies", "that", "the", "heat", "setting", "is", "between", "0", "and", "3", "." ]
python
train
saltstack/salt
salt/modules/solarisipspkg.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solarisipspkg.py#L136-L155
def upgrade_available(name, **kwargs): ''' Check if there is an upgrade available for a certain package Accepts full or partial FMRI. Returns all matches found. CLI Example: .. code-block:: bash salt '*' pkg.upgrade_available apache-22 ''' version = None cmd = ['pkg', 'list', ...
[ "def", "upgrade_available", "(", "name", ",", "*", "*", "kwargs", ")", ":", "version", "=", "None", "cmd", "=", "[", "'pkg'", ",", "'list'", ",", "'-Huv'", ",", "name", "]", "lines", "=", "__salt__", "[", "'cmd.run_stdout'", "]", "(", "cmd", ")", "."...
Check if there is an upgrade available for a certain package Accepts full or partial FMRI. Returns all matches found. CLI Example: .. code-block:: bash salt '*' pkg.upgrade_available apache-22
[ "Check", "if", "there", "is", "an", "upgrade", "available", "for", "a", "certain", "package", "Accepts", "full", "or", "partial", "FMRI", ".", "Returns", "all", "matches", "found", "." ]
python
train
arviz-devs/arviz
arviz/plots/compareplot.py
https://github.com/arviz-devs/arviz/blob/d04d8da07f029fd2931f48d2f7f324cf393e5277/arviz/plots/compareplot.py#L7-L171
def plot_compare( comp_df, insample_dev=True, plot_standard_error=True, plot_ic_diff=True, figsize=None, textsize=None, plot_kwargs=None, ax=None, ): """ Summary plot for model comparison. This plot is in the style of the one used in the book Statistical Rethink...
[ "def", "plot_compare", "(", "comp_df", ",", "insample_dev", "=", "True", ",", "plot_standard_error", "=", "True", ",", "plot_ic_diff", "=", "True", ",", "figsize", "=", "None", ",", "textsize", "=", "None", ",", "plot_kwargs", "=", "None", ",", "ax", "=", ...
Summary plot for model comparison. This plot is in the style of the one used in the book Statistical Rethinking (Chapter 6) by Richard McElreath. Notes ----- Defaults to comparing Widely Accepted Information Criterion (WAIC) if present in comp_df column, otherwise compares Leave-one-ou...
[ "Summary", "plot", "for", "model", "comparison", ".", "This", "plot", "is", "in", "the", "style", "of", "the", "one", "used", "in", "the", "book", "Statistical", "Rethinking", "(", "Chapter", "6", ")", "by", "Richard", "McElreath", ".", "Notes", "-----", ...
python
train
boriel/zxbasic
arch/zx48k/translator.py
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/translator.py#L217-L225
def norm_attr(self): """ Normalize attr state """ if not self.HAS_ATTR: return self.HAS_ATTR = False self.emit('call', 'COPY_ATTR', 0) backend.REQUIRES.add('copy_attr.asm')
[ "def", "norm_attr", "(", "self", ")", ":", "if", "not", "self", ".", "HAS_ATTR", ":", "return", "self", ".", "HAS_ATTR", "=", "False", "self", ".", "emit", "(", "'call'", ",", "'COPY_ATTR'", ",", "0", ")", "backend", ".", "REQUIRES", ".", "add", "(",...
Normalize attr state
[ "Normalize", "attr", "state" ]
python
train
CodyKochmann/stricttuple
stricttuple/__init__.py
https://github.com/CodyKochmann/stricttuple/blob/072cbd6f7b90f3f666dc0f2c10ab6056d86dfc72/stricttuple/__init__.py#L40-L55
def shorten(string, max_length=80, trailing_chars=3): ''' trims the 'string' argument down to 'max_length' to make previews to long string values ''' assert type(string).__name__ in {'str', 'unicode'}, 'shorten needs string to be a string, not {}'.format(type(string)) assert type(max_length) == int, 'shorte...
[ "def", "shorten", "(", "string", ",", "max_length", "=", "80", ",", "trailing_chars", "=", "3", ")", ":", "assert", "type", "(", "string", ")", ".", "__name__", "in", "{", "'str'", ",", "'unicode'", "}", ",", "'shorten needs string to be a string, not {}'", ...
trims the 'string' argument down to 'max_length' to make previews to long string values
[ "trims", "the", "string", "argument", "down", "to", "max_length", "to", "make", "previews", "to", "long", "string", "values" ]
python
train
bfrog/whizzer
whizzer/protocol.py
https://github.com/bfrog/whizzer/blob/a1e43084b3ac8c1f3fb4ada081777cdbf791fd77/whizzer/protocol.py#L27-L31
def make_connection(self, transport, address): """Called externally when the transport is ready.""" self.connected = True self.transport = transport self.connection_made(address)
[ "def", "make_connection", "(", "self", ",", "transport", ",", "address", ")", ":", "self", ".", "connected", "=", "True", "self", ".", "transport", "=", "transport", "self", ".", "connection_made", "(", "address", ")" ]
Called externally when the transport is ready.
[ "Called", "externally", "when", "the", "transport", "is", "ready", "." ]
python
train
peerplays-network/python-peerplays
peerplays/cli/account.py
https://github.com/peerplays-network/python-peerplays/blob/188f04238e7e21d5f73e9b01099eea44289ef6b7/peerplays/cli/account.py#L56-L63
def disallow(ctx, foreign_account, permission, threshold, account): """ Remove a key/account from an account's permission """ pprint( ctx.peerplays.disallow( foreign_account, account=account, permission=permission, threshold=threshold ) )
[ "def", "disallow", "(", "ctx", ",", "foreign_account", ",", "permission", ",", "threshold", ",", "account", ")", ":", "pprint", "(", "ctx", ".", "peerplays", ".", "disallow", "(", "foreign_account", ",", "account", "=", "account", ",", "permission", "=", "...
Remove a key/account from an account's permission
[ "Remove", "a", "key", "/", "account", "from", "an", "account", "s", "permission" ]
python
train
openp2pdesign/makerlabs
makerlabs/fablabs_io.py
https://github.com/openp2pdesign/makerlabs/blob/b5838440174f10d370abb671358db9a99d7739fd/makerlabs/fablabs_io.py#L82-L172
def get_labs(format): """Gets Fab Lab data from fablabs.io.""" fablabs_json = data_from_fablabs_io(fablabs_io_labs_api_url_v0) fablabs = {} # Load all the FabLabs for i in fablabs_json["labs"]: current_lab = FabLab() current_lab.name = i["name"] current_lab.address_1 = i["a...
[ "def", "get_labs", "(", "format", ")", ":", "fablabs_json", "=", "data_from_fablabs_io", "(", "fablabs_io_labs_api_url_v0", ")", "fablabs", "=", "{", "}", "# Load all the FabLabs", "for", "i", "in", "fablabs_json", "[", "\"labs\"", "]", ":", "current_lab", "=", ...
Gets Fab Lab data from fablabs.io.
[ "Gets", "Fab", "Lab", "data", "from", "fablabs", ".", "io", "." ]
python
train
yyuu/botornado
boto/sqs/connection.py
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/sqs/connection.py#L339-L354
def remove_permission(self, queue, label): """ Remove a permission from a queue. :type queue: :class:`boto.sqs.queue.Queue` :param queue: The queue object :type label: str or unicode :param label: The unique label associated with the permission bei...
[ "def", "remove_permission", "(", "self", ",", "queue", ",", "label", ")", ":", "params", "=", "{", "'Label'", ":", "label", "}", "return", "self", ".", "get_status", "(", "'RemovePermission'", ",", "params", ",", "queue", ".", "id", ")" ]
Remove a permission from a queue. :type queue: :class:`boto.sqs.queue.Queue` :param queue: The queue object :type label: str or unicode :param label: The unique label associated with the permission being removed. :rtype: bool :return: True if succ...
[ "Remove", "a", "permission", "from", "a", "queue", "." ]
python
train
thisfred/val
val/_val.py
https://github.com/thisfred/val/blob/ba022e0c6c47acb3b8a45e7c44c84cc0f495c41c/val/_val.py#L380-L387
def _validated(self, values): """Validate if the values are validated one by one in order.""" if self.length != len(values): raise NotValid( "%r does not have exactly %d values. (Got %d.)" % ( values, self.length, len(values))) return type(self.sch...
[ "def", "_validated", "(", "self", ",", "values", ")", ":", "if", "self", ".", "length", "!=", "len", "(", "values", ")", ":", "raise", "NotValid", "(", "\"%r does not have exactly %d values. (Got %d.)\"", "%", "(", "values", ",", "self", ".", "length", ",", ...
Validate if the values are validated one by one in order.
[ "Validate", "if", "the", "values", "are", "validated", "one", "by", "one", "in", "order", "." ]
python
train
FutunnOpen/futuquant
futuquant/examples/TinyQuant/TinyQuantBase.py
https://github.com/FutunnOpen/futuquant/blob/1512b321845f92ec9c578ce2689aa4e8482669e4/futuquant/examples/TinyQuant/TinyQuantBase.py#L179-L187
def boll(self, n, dev, array=False): """布林通道""" mid = self.sma(n, array) std = self.std(n, array) up = mid + std * dev down = mid - std * dev return up, down
[ "def", "boll", "(", "self", ",", "n", ",", "dev", ",", "array", "=", "False", ")", ":", "mid", "=", "self", ".", "sma", "(", "n", ",", "array", ")", "std", "=", "self", ".", "std", "(", "n", ",", "array", ")", "up", "=", "mid", "+", "std", ...
布林通道
[ "布林通道" ]
python
train
ngmarchant/oasis
oasis/oasis.py
https://github.com/ngmarchant/oasis/blob/28a037a8924b85ae97db8a93960a910a219d6a4a/oasis/oasis.py#L350-L368
def _sample_item(self, **kwargs): """Sample an item from the pool according to the instrumental distribution """ t = self.t_ # Update instrumental distribution self._calc_inst_pmf() if self.record_inst_hist: inst_pmf = self._inst_pmf[:,t] els...
[ "def", "_sample_item", "(", "self", ",", "*", "*", "kwargs", ")", ":", "t", "=", "self", ".", "t_", "# Update instrumental distribution", "self", ".", "_calc_inst_pmf", "(", ")", "if", "self", ".", "record_inst_hist", ":", "inst_pmf", "=", "self", ".", "_i...
Sample an item from the pool according to the instrumental distribution
[ "Sample", "an", "item", "from", "the", "pool", "according", "to", "the", "instrumental", "distribution" ]
python
train
tanghaibao/jcvi
jcvi/formats/agp.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/formats/agp.py#L269-L275
def getNorthSouthClone(self, i): """ Returns the adjacent clone name from both sides. """ north = self.getAdjacentClone(i, south=False) south = self.getAdjacentClone(i) return north, south
[ "def", "getNorthSouthClone", "(", "self", ",", "i", ")", ":", "north", "=", "self", ".", "getAdjacentClone", "(", "i", ",", "south", "=", "False", ")", "south", "=", "self", ".", "getAdjacentClone", "(", "i", ")", "return", "north", ",", "south" ]
Returns the adjacent clone name from both sides.
[ "Returns", "the", "adjacent", "clone", "name", "from", "both", "sides", "." ]
python
train
lmjohns3/theanets
theanets/feedforward.py
https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/feedforward.py#L155-L178
def decode(self, z, layer=None, **kwargs): '''Decode an encoded dataset by computing the output layer activation. Parameters ---------- z : ndarray A matrix containing encoded data from this autoencoder. layer : int or str or :class:`Layer <layers.Layer>`, optional ...
[ "def", "decode", "(", "self", ",", "z", ",", "layer", "=", "None", ",", "*", "*", "kwargs", ")", ":", "key", "=", "self", ".", "_find_output", "(", "layer", ")", "if", "key", "not", "in", "self", ".", "_functions", ":", "regs", "=", "regularizers",...
Decode an encoded dataset by computing the output layer activation. Parameters ---------- z : ndarray A matrix containing encoded data from this autoencoder. layer : int or str or :class:`Layer <layers.Layer>`, optional The index or name of the hidden layer that ...
[ "Decode", "an", "encoded", "dataset", "by", "computing", "the", "output", "layer", "activation", "." ]
python
test
pyroscope/pyrocore
docs/examples/rt-down-stats.py
https://github.com/pyroscope/pyrocore/blob/89ad01346a570943d20311a0b488440975876612/docs/examples/rt-down-stats.py#L18-L21
def disk_free(path): """Return free bytes on partition holding `path`.""" stats = os.statvfs(path) return stats.f_bavail * stats.f_frsize
[ "def", "disk_free", "(", "path", ")", ":", "stats", "=", "os", ".", "statvfs", "(", "path", ")", "return", "stats", ".", "f_bavail", "*", "stats", ".", "f_frsize" ]
Return free bytes on partition holding `path`.
[ "Return", "free", "bytes", "on", "partition", "holding", "path", "." ]
python
train
coleifer/peewee
examples/analytics/reports.py
https://github.com/coleifer/peewee/blob/ea9403b01acb039adb3a2472186d795c796b77a0/examples/analytics/reports.py#L99-L108
def top_referrers(self, domain_only=True): """ What domains send us the most traffic? """ referrer = self._referrer_clause(domain_only) return (self.get_query() .select(referrer, fn.Count(PageView.id)) .group_by(referrer) .order_by(...
[ "def", "top_referrers", "(", "self", ",", "domain_only", "=", "True", ")", ":", "referrer", "=", "self", ".", "_referrer_clause", "(", "domain_only", ")", "return", "(", "self", ".", "get_query", "(", ")", ".", "select", "(", "referrer", ",", "fn", ".", ...
What domains send us the most traffic?
[ "What", "domains", "send", "us", "the", "most", "traffic?" ]
python
train
eonpatapon/contrail-api-cli
contrail_api_cli/schema.py
https://github.com/eonpatapon/contrail-api-cli/blob/1571bf523fa054f3d6bf83dba43a224fea173a73/contrail_api_cli/schema.py#L103-L113
def create_schema_from_xsd_directory(directory, version): """Create and fill the schema from a directory which contains xsd files. It calls fill_schema_from_xsd_file for each xsd file found. """ schema = Schema(version) for f in _get_xsd_from_directory(directory): logger.info("Loading s...
[ "def", "create_schema_from_xsd_directory", "(", "directory", ",", "version", ")", ":", "schema", "=", "Schema", "(", "version", ")", "for", "f", "in", "_get_xsd_from_directory", "(", "directory", ")", ":", "logger", ".", "info", "(", "\"Loading schema %s\"", "%"...
Create and fill the schema from a directory which contains xsd files. It calls fill_schema_from_xsd_file for each xsd file found.
[ "Create", "and", "fill", "the", "schema", "from", "a", "directory", "which", "contains", "xsd", "files", ".", "It", "calls", "fill_schema_from_xsd_file", "for", "each", "xsd", "file", "found", "." ]
python
train
Pipoline/rocket-python
rocketchat/api.py
https://github.com/Pipoline/rocket-python/blob/643ece8a9db106922e019984a859ca04283262ff/rocketchat/api.py#L172-L178
def get_users(self, **kwargs): """ Gets all of the users in the system and their information :param kwargs: :return: """ return GetUsers(settings=self.settings, **kwargs).call(**kwargs)
[ "def", "get_users", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "GetUsers", "(", "settings", "=", "self", ".", "settings", ",", "*", "*", "kwargs", ")", ".", "call", "(", "*", "*", "kwargs", ")" ]
Gets all of the users in the system and their information :param kwargs: :return:
[ "Gets", "all", "of", "the", "users", "in", "the", "system", "and", "their", "information", ":", "param", "kwargs", ":", ":", "return", ":" ]
python
train
tsroten/dragonmapper
dragonmapper/transcriptions.py
https://github.com/tsroten/dragonmapper/blob/68eaf43c32725f4b4923c01284cfc0112079e8ab/dragonmapper/transcriptions.py#L83-L94
def _parse_numbered_syllable(unparsed_syllable): """Return the syllable and tone of a numbered Pinyin syllable.""" tone_number = unparsed_syllable[-1] if not tone_number.isdigit(): syllable, tone = unparsed_syllable, '5' elif tone_number == '0': syllable, tone = unparsed_syllable[:-1], '...
[ "def", "_parse_numbered_syllable", "(", "unparsed_syllable", ")", ":", "tone_number", "=", "unparsed_syllable", "[", "-", "1", "]", "if", "not", "tone_number", ".", "isdigit", "(", ")", ":", "syllable", ",", "tone", "=", "unparsed_syllable", ",", "'5'", "elif"...
Return the syllable and tone of a numbered Pinyin syllable.
[ "Return", "the", "syllable", "and", "tone", "of", "a", "numbered", "Pinyin", "syllable", "." ]
python
train
senaite/senaite.core
bika/lims/controlpanel/auditlog.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/controlpanel/auditlog.py#L119-L191
def folderitem(self, obj, item, index): """Service triggered each time an item is iterated in folderitems. The use of this service prevents the extra-loops in child objects. :obj: the instance of the class to be foldered :item: dict containing the properties of the object to be used by ...
[ "def", "folderitem", "(", "self", ",", "obj", ",", "item", ",", "index", ")", ":", "# We are using the existing logic from the auditview", "logview", "=", "api", ".", "get_view", "(", "\"auditlog\"", ",", "context", "=", "obj", ",", "request", "=", "self", "."...
Service triggered each time an item is iterated in folderitems. The use of this service prevents the extra-loops in child objects. :obj: the instance of the class to be foldered :item: dict containing the properties of the object to be used by the template :index: current ind...
[ "Service", "triggered", "each", "time", "an", "item", "is", "iterated", "in", "folderitems", ".", "The", "use", "of", "this", "service", "prevents", "the", "extra", "-", "loops", "in", "child", "objects", ".", ":", "obj", ":", "the", "instance", "of", "t...
python
train
google/grr
grr/server/grr_response_server/flow_base.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flow_base.py#L361-L382
def SaveResourceUsage(self, status): """Method to tally resources.""" user_cpu = status.cpu_time_used.user_cpu_time system_cpu = status.cpu_time_used.system_cpu_time self.rdf_flow.cpu_time_used.user_cpu_time += user_cpu self.rdf_flow.cpu_time_used.system_cpu_time += system_cpu self.rdf_flow.net...
[ "def", "SaveResourceUsage", "(", "self", ",", "status", ")", ":", "user_cpu", "=", "status", ".", "cpu_time_used", ".", "user_cpu_time", "system_cpu", "=", "status", ".", "cpu_time_used", ".", "system_cpu_time", "self", ".", "rdf_flow", ".", "cpu_time_used", "."...
Method to tally resources.
[ "Method", "to", "tally", "resources", "." ]
python
train
ga4gh/ga4gh-server
ga4gh/server/cli/repomanager.py
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/cli/repomanager.py#L324-L340
def addPhenotypeAssociationSet(self): """ Adds a new phenotype association set to this repo. """ self._openRepo() name = self._args.name if name is None: name = getNameFromPath(self._args.dirPath) dataset = self._repo.getDatasetByName(self._args.datase...
[ "def", "addPhenotypeAssociationSet", "(", "self", ")", ":", "self", ".", "_openRepo", "(", ")", "name", "=", "self", ".", "_args", ".", "name", "if", "name", "is", "None", ":", "name", "=", "getNameFromPath", "(", "self", ".", "_args", ".", "dirPath", ...
Adds a new phenotype association set to this repo.
[ "Adds", "a", "new", "phenotype", "association", "set", "to", "this", "repo", "." ]
python
train
mopidy/mopidy-spotify
mopidy_spotify/translator.py
https://github.com/mopidy/mopidy-spotify/blob/77a293088e63a7b4b77bf9409ce57cb14048d18c/mopidy_spotify/translator.py#L205-L225
def sp_search_query(query): """Translate a Mopidy search query to a Spotify search query""" result = [] for (field, values) in query.items(): field = SEARCH_FIELD_MAP.get(field, field) if field is None: continue for value in values: if field == 'year': ...
[ "def", "sp_search_query", "(", "query", ")", ":", "result", "=", "[", "]", "for", "(", "field", ",", "values", ")", "in", "query", ".", "items", "(", ")", ":", "field", "=", "SEARCH_FIELD_MAP", ".", "get", "(", "field", ",", "field", ")", "if", "fi...
Translate a Mopidy search query to a Spotify search query
[ "Translate", "a", "Mopidy", "search", "query", "to", "a", "Spotify", "search", "query" ]
python
test
sivy/pystatsd
pystatsd/statsd.py
https://github.com/sivy/pystatsd/blob/69e362654c37df28582b12b964901334326620a7/pystatsd/statsd.py#L32-L39
def timing_since(self, stat, start, sample_rate=1): """ Log timing information as the number of microseconds since the provided time float >>> start = time.time() >>> # do stuff >>> statsd_client.timing_since('some.time', start) """ self.timing(stat, int((time.tim...
[ "def", "timing_since", "(", "self", ",", "stat", ",", "start", ",", "sample_rate", "=", "1", ")", ":", "self", ".", "timing", "(", "stat", ",", "int", "(", "(", "time", ".", "time", "(", ")", "-", "start", ")", "*", "1000000", ")", ",", "sample_r...
Log timing information as the number of microseconds since the provided time float >>> start = time.time() >>> # do stuff >>> statsd_client.timing_since('some.time', start)
[ "Log", "timing", "information", "as", "the", "number", "of", "microseconds", "since", "the", "provided", "time", "float", ">>>", "start", "=", "time", ".", "time", "()", ">>>", "#", "do", "stuff", ">>>", "statsd_client", ".", "timing_since", "(", "some", "...
python
train
wonambi-python/wonambi
wonambi/scroll_data.py
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/scroll_data.py#L243-L251
def closeEvent(self, event): """save the name of the last open dataset.""" max_dataset_history = self.value('max_dataset_history') keep_recent_datasets(max_dataset_history, self.info) settings.setValue('window/geometry', self.saveGeometry()) settings.setValue('window/state', sel...
[ "def", "closeEvent", "(", "self", ",", "event", ")", ":", "max_dataset_history", "=", "self", ".", "value", "(", "'max_dataset_history'", ")", "keep_recent_datasets", "(", "max_dataset_history", ",", "self", ".", "info", ")", "settings", ".", "setValue", "(", ...
save the name of the last open dataset.
[ "save", "the", "name", "of", "the", "last", "open", "dataset", "." ]
python
train
sigvaldm/frmt
frmt.py
https://github.com/sigvaldm/frmt/blob/d077af06c83a7a0533ca2218be55ce086df274b7/frmt.py#L28-L49
def format_fit(text, width=None, align='<', suffix="..."): """ Fits a piece of text to ``width`` characters by truncating too long text and padding too short text with spaces. Defaults to terminal width. Truncation is indicated by a customizable suffix. ``align`` specifies the alignment of the conte...
[ "def", "format_fit", "(", "text", ",", "width", "=", "None", ",", "align", "=", "'<'", ",", "suffix", "=", "\"...\"", ")", ":", "if", "width", "==", "None", ":", "width", "=", "get_terminal_size", "(", ")", ".", "columns", "if", "len", "(", "text", ...
Fits a piece of text to ``width`` characters by truncating too long text and padding too short text with spaces. Defaults to terminal width. Truncation is indicated by a customizable suffix. ``align`` specifies the alignment of the contents if it is padded, and can be: * ``<`` - Left aligned (default) ...
[ "Fits", "a", "piece", "of", "text", "to", "width", "characters", "by", "truncating", "too", "long", "text", "and", "padding", "too", "short", "text", "with", "spaces", ".", "Defaults", "to", "terminal", "width", ".", "Truncation", "is", "indicated", "by", ...
python
train
ArabellaTech/django-basic-cms
basic_cms/http.py
https://github.com/ArabellaTech/django-basic-cms/blob/863f3c6098606f663994930cd8e7723ad0c07caf/basic_cms/http.py#L54-L78
def pages_view(view): """ Make sure the decorated view gets the essential pages variables. """ def pages_view_decorator(request, *args, **kwargs): # if the current page is already there if(kwargs.get('current_page', False) or kwargs.get('pages_navigation', False)): ...
[ "def", "pages_view", "(", "view", ")", ":", "def", "pages_view_decorator", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# if the current page is already there", "if", "(", "kwargs", ".", "get", "(", "'current_page'", ",", "False", ")...
Make sure the decorated view gets the essential pages variables.
[ "Make", "sure", "the", "decorated", "view", "gets", "the", "essential", "pages", "variables", "." ]
python
train
saltstack/salt
salt/modules/x509.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/x509.py#L183-L206
def _get_csr_extensions(csr): ''' Returns a list of dicts containing the name, value and critical value of any extension contained in a csr object. ''' ret = OrderedDict() csrtempfile = tempfile.NamedTemporaryFile() csrtempfile.write(csr.as_pem()) csrtempfile.flush() csryaml = _pars...
[ "def", "_get_csr_extensions", "(", "csr", ")", ":", "ret", "=", "OrderedDict", "(", ")", "csrtempfile", "=", "tempfile", ".", "NamedTemporaryFile", "(", ")", "csrtempfile", ".", "write", "(", "csr", ".", "as_pem", "(", ")", ")", "csrtempfile", ".", "flush"...
Returns a list of dicts containing the name, value and critical value of any extension contained in a csr object.
[ "Returns", "a", "list", "of", "dicts", "containing", "the", "name", "value", "and", "critical", "value", "of", "any", "extension", "contained", "in", "a", "csr", "object", "." ]
python
train
scnerd/miniutils
miniutils/progress_bar.py
https://github.com/scnerd/miniutils/blob/fe927e26afc5877416dead28dabdf6604387f42c/miniutils/progress_bar.py#L23-L36
def progbar(iterable, *a, verbose=True, **kw): """Prints a progress bar as the iterable is iterated over :param iterable: The iterator to iterate over :param a: Arguments to get passed to tqdm (or tqdm_notebook, if in a Jupyter notebook) :param verbose: Whether or not to print the progress bar at all ...
[ "def", "progbar", "(", "iterable", ",", "*", "a", ",", "verbose", "=", "True", ",", "*", "*", "kw", ")", ":", "iterable", "=", "range", "(", "iterable", ")", "if", "isinstance", "(", "iterable", ",", "int", ")", "else", "iterable", "if", "verbose", ...
Prints a progress bar as the iterable is iterated over :param iterable: The iterator to iterate over :param a: Arguments to get passed to tqdm (or tqdm_notebook, if in a Jupyter notebook) :param verbose: Whether or not to print the progress bar at all :param kw: Keyword arguments to get passed to tqdm ...
[ "Prints", "a", "progress", "bar", "as", "the", "iterable", "is", "iterated", "over" ]
python
train
pandas-dev/pandas
pandas/plotting/_misc.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/plotting/_misc.py#L270-L356
def andrews_curves(frame, class_column, ax=None, samples=200, color=None, colormap=None, **kwds): """ Generate a matplotlib plot of Andrews curves, for visualising clusters of multivariate data. Andrews curves have the functional form: f(t) = x_1/sqrt(2) + x_2 sin(t) + x_3 cos(t...
[ "def", "andrews_curves", "(", "frame", ",", "class_column", ",", "ax", "=", "None", ",", "samples", "=", "200", ",", "color", "=", "None", ",", "colormap", "=", "None", ",", "*", "*", "kwds", ")", ":", "from", "math", "import", "sqrt", ",", "pi", "...
Generate a matplotlib plot of Andrews curves, for visualising clusters of multivariate data. Andrews curves have the functional form: f(t) = x_1/sqrt(2) + x_2 sin(t) + x_3 cos(t) + x_4 sin(2t) + x_5 cos(2t) + ... Where x coefficients correspond to the values of each dimension and t is ...
[ "Generate", "a", "matplotlib", "plot", "of", "Andrews", "curves", "for", "visualising", "clusters", "of", "multivariate", "data", "." ]
python
train
cbclab/MOT
mot/optimize/__init__.py
https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/optimize/__init__.py#L245-L296
def _minimize_powell(func, x0, cl_runtime_info, lower_bounds, upper_bounds, constraints_func=None, data=None, options=None): """ Options: patience (int): Used to set the maximum number of iterations to patience*(number_of_parameters+1) reset_method (str): one of 'EXTRAPOLATE...
[ "def", "_minimize_powell", "(", "func", ",", "x0", ",", "cl_runtime_info", ",", "lower_bounds", ",", "upper_bounds", ",", "constraints_func", "=", "None", ",", "data", "=", "None", ",", "options", "=", "None", ")", ":", "options", "=", "options", "or", "{"...
Options: patience (int): Used to set the maximum number of iterations to patience*(number_of_parameters+1) reset_method (str): one of 'EXTRAPOLATED_POINT' or 'RESET_TO_IDENTITY' lower case or upper case. patience_line_search (int): the patience of the searching algorithm. Defaults to the ...
[ "Options", ":", "patience", "(", "int", ")", ":", "Used", "to", "set", "the", "maximum", "number", "of", "iterations", "to", "patience", "*", "(", "number_of_parameters", "+", "1", ")", "reset_method", "(", "str", ")", ":", "one", "of", "EXTRAPOLATED_POINT...
python
train
NASA-AMMOS/AIT-Core
ait/core/cfg.py
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/cfg.py#L362-L388
def get (self, name, default=None): """Returns the attribute value *AitConfig.name* or *default* if name does not exist. The name may be a series of attributes separated periods. For example, "foo.bar.baz". In that case, lookups are attempted in the following order until one s...
[ "def", "get", "(", "self", ",", "name", ",", "default", "=", "None", ")", ":", "if", "name", "in", "self", ":", "return", "self", "[", "name", "]", "config", "=", "self", "parts", "=", "name", ".", "split", "(", "'.'", ")", "heads", "=", "parts",...
Returns the attribute value *AitConfig.name* or *default* if name does not exist. The name may be a series of attributes separated periods. For example, "foo.bar.baz". In that case, lookups are attempted in the following order until one succeeeds: 1. AitConfig['foo.bar.b...
[ "Returns", "the", "attribute", "value", "*", "AitConfig", ".", "name", "*", "or", "*", "default", "*", "if", "name", "does", "not", "exist", "." ]
python
train
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_system_monitor_ext.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_system_monitor_ext.py#L139-L152
def show_system_monitor_output_switch_status_port_status_port_area(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") show_system_monitor = ET.Element("show_system_monitor") config = show_system_monitor output = ET.SubElement(show_system_monitor, "o...
[ "def", "show_system_monitor_output_switch_status_port_status_port_area", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "show_system_monitor", "=", "ET", ".", "Element", "(", "\"show_system_monitor\"", ")...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
paddycarey/dweepy
dweepy/streaming.py
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/streaming.py#L57-L77
def listen_for_dweets_from(thing_name, timeout=900, key=None, session=None): """Create a real-time subscription to dweets """ url = BASE_URL + '/listen/for/dweets/from/{0}'.format(thing_name) session = session or requests.Session() if key is not None: params = {'key': key} else: ...
[ "def", "listen_for_dweets_from", "(", "thing_name", ",", "timeout", "=", "900", ",", "key", "=", "None", ",", "session", "=", "None", ")", ":", "url", "=", "BASE_URL", "+", "'/listen/for/dweets/from/{0}'", ".", "format", "(", "thing_name", ")", "session", "=...
Create a real-time subscription to dweets
[ "Create", "a", "real", "-", "time", "subscription", "to", "dweets" ]
python
train
dusktreader/py-buzz
buzz/__init__.py
https://github.com/dusktreader/py-buzz/blob/f2fd97abe158a1688188647992a5be6531058ec3/buzz/__init__.py#L75-L133
def handle_errors( cls, message, *format_args, re_raise=True, exception_class=Exception, do_finally=None, do_except=None, do_else=None, **format_kwds ): """ provides a context manager that will intercept exceptions and repackage them as Buzz in...
[ "def", "handle_errors", "(", "cls", ",", "message", ",", "*", "format_args", ",", "re_raise", "=", "True", ",", "exception_class", "=", "Exception", ",", "do_finally", "=", "None", ",", "do_except", "=", "None", ",", "do_else", "=", "None", ",", "*", "*"...
provides a context manager that will intercept exceptions and repackage them as Buzz instances with a message attached: .. code-block:: python with Buzz.handle_errors("It didn't work"): some_code_that_might_raise_an_exception() :param: message: The message to attach...
[ "provides", "a", "context", "manager", "that", "will", "intercept", "exceptions", "and", "repackage", "them", "as", "Buzz", "instances", "with", "a", "message", "attached", ":" ]
python
train
pantsbuild/pants
src/python/pants/pantsd/process_manager.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/pantsd/process_manager.py#L550-L563
def fingerprint(self): """The fingerprint of the current process. This can either read the current fingerprint from the running process's psutil.Process.cmdline (if the managed process supports that) or from the `ProcessManager` metadata. :returns: The fingerprint of the running process as read from t...
[ "def", "fingerprint", "(", "self", ")", ":", "return", "(", "self", ".", "parse_fingerprint", "(", "self", ".", "cmdline", ")", "or", "self", ".", "read_metadata_by_name", "(", "self", ".", "name", ",", "self", ".", "FINGERPRINT_KEY", ")", ")" ]
The fingerprint of the current process. This can either read the current fingerprint from the running process's psutil.Process.cmdline (if the managed process supports that) or from the `ProcessManager` metadata. :returns: The fingerprint of the running process as read from the process table, ProcessManag...
[ "The", "fingerprint", "of", "the", "current", "process", "." ]
python
train
ray-project/ray
python/ray/tune/examples/genetic_example.py
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/examples/genetic_example.py#L16-L27
def michalewicz_function(config, reporter): """f(x) = -sum{sin(xi) * [sin(i*xi^2 / pi)]^(2m)}""" import numpy as np x = np.array( [config["x1"], config["x2"], config["x3"], config["x4"], config["x5"]]) sin_x = np.sin(x) z = (np.arange(1, 6) / np.pi * (x * x)) sin_z = np.power(np.sin(z), ...
[ "def", "michalewicz_function", "(", "config", ",", "reporter", ")", ":", "import", "numpy", "as", "np", "x", "=", "np", ".", "array", "(", "[", "config", "[", "\"x1\"", "]", ",", "config", "[", "\"x2\"", "]", ",", "config", "[", "\"x3\"", "]", ",", ...
f(x) = -sum{sin(xi) * [sin(i*xi^2 / pi)]^(2m)}
[ "f", "(", "x", ")", "=", "-", "sum", "{", "sin", "(", "xi", ")", "*", "[", "sin", "(", "i", "*", "xi^2", "/", "pi", ")", "]", "^", "(", "2m", ")", "}" ]
python
train
davidrpugh/pyCollocation
pycollocation/solvers/solvers.py
https://github.com/davidrpugh/pyCollocation/blob/9376f3488a992dc416cfd2a4dbb396d094927569/pycollocation/solvers/solvers.py#L145-L163
def _construct_approximation(self, basis_kwargs, coefs_list): """ Construct a collection of derivatives and functions that approximate the solution to the boundary value problem. Parameters ---------- basis_kwargs : dict(str: ) coefs_list : list(numpy.ndarray) ...
[ "def", "_construct_approximation", "(", "self", ",", "basis_kwargs", ",", "coefs_list", ")", ":", "derivs", "=", "self", ".", "_construct_derivatives", "(", "coefs_list", ",", "*", "*", "basis_kwargs", ")", "funcs", "=", "self", ".", "_construct_functions", "(",...
Construct a collection of derivatives and functions that approximate the solution to the boundary value problem. Parameters ---------- basis_kwargs : dict(str: ) coefs_list : list(numpy.ndarray) Returns ------- basis_derivs : list(function) basis...
[ "Construct", "a", "collection", "of", "derivatives", "and", "functions", "that", "approximate", "the", "solution", "to", "the", "boundary", "value", "problem", "." ]
python
train
rbuffat/pyepw
pyepw/epw.py
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L5725-L5752
def month(self, value=None): """Corresponds to IDD Field `month` Args: value (int): value for IDD Field `month` value >= 1 value <= 12 if `value` is None it will not be checked against the specification and is assumed to be a m...
[ "def", "month", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "int", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'value {} need to be of type int '", ...
Corresponds to IDD Field `month` Args: value (int): value for IDD Field `month` value >= 1 value <= 12 if `value` is None it will not be checked against the specification and is assumed to be a missing value Raises: ...
[ "Corresponds", "to", "IDD", "Field", "month" ]
python
train
ldo/dbussy
dbussy.py
https://github.com/ldo/dbussy/blob/59e4fbe8b8111ceead884e50d1973901a0a2d240/dbussy.py#L3970-L3977
def new_signal(celf, path, iface, name) : "creates a new DBUS.MESSAGE_TYPE_SIGNAL message." result = dbus.dbus_message_new_signal(path.encode(), iface.encode(), name.encode()) if result == None : raise CallFailed("dbus_message_new_signal") #end if return \ ...
[ "def", "new_signal", "(", "celf", ",", "path", ",", "iface", ",", "name", ")", ":", "result", "=", "dbus", ".", "dbus_message_new_signal", "(", "path", ".", "encode", "(", ")", ",", "iface", ".", "encode", "(", ")", ",", "name", ".", "encode", "(", ...
creates a new DBUS.MESSAGE_TYPE_SIGNAL message.
[ "creates", "a", "new", "DBUS", ".", "MESSAGE_TYPE_SIGNAL", "message", "." ]
python
train
mapbox/mapbox-cli-py
mapboxcli/scripts/datasets.py
https://github.com/mapbox/mapbox-cli-py/blob/b75544a2f83a4fda79d78b5673058e16e64a4f6d/mapboxcli/scripts/datasets.py#L13-L24
def datasets(ctx): """Read and write GeoJSON from Mapbox-hosted datasets All endpoints require authentication. An access token with appropriate dataset scopes is required, see `mapbox --help`. Note that this API is currently a limited-access beta. """ access_token = (ctx.obj and ctx.obj.get('...
[ "def", "datasets", "(", "ctx", ")", ":", "access_token", "=", "(", "ctx", ".", "obj", "and", "ctx", ".", "obj", ".", "get", "(", "'access_token'", ")", ")", "or", "None", "service", "=", "mapbox", ".", "Datasets", "(", "access_token", "=", "access_toke...
Read and write GeoJSON from Mapbox-hosted datasets All endpoints require authentication. An access token with appropriate dataset scopes is required, see `mapbox --help`. Note that this API is currently a limited-access beta.
[ "Read", "and", "write", "GeoJSON", "from", "Mapbox", "-", "hosted", "datasets" ]
python
train
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/bson/__init__.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L118-L121
def _get_float(data, position, dummy0, dummy1, dummy2): """Decode a BSON double to python float.""" end = position + 8 return _UNPACK_FLOAT(data[position:end])[0], end
[ "def", "_get_float", "(", "data", ",", "position", ",", "dummy0", ",", "dummy1", ",", "dummy2", ")", ":", "end", "=", "position", "+", "8", "return", "_UNPACK_FLOAT", "(", "data", "[", "position", ":", "end", "]", ")", "[", "0", "]", ",", "end" ]
Decode a BSON double to python float.
[ "Decode", "a", "BSON", "double", "to", "python", "float", "." ]
python
train
dnanexus/dx-toolkit
src/python/dxpy/api.py
https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1473-L1479
def workflow_remove_types(object_id, input_params={}, always_retry=True, **kwargs): """ Invokes the /workflow-xxxx/removeTypes API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Types#API-method%3A-%2Fclass-xxxx%2FremoveTypes """ return DXHTTPRequest('/%s/removeTypes...
[ "def", "workflow_remove_types", "(", "object_id", ",", "input_params", "=", "{", "}", ",", "always_retry", "=", "True", ",", "*", "*", "kwargs", ")", ":", "return", "DXHTTPRequest", "(", "'/%s/removeTypes'", "%", "object_id", ",", "input_params", ",", "always_...
Invokes the /workflow-xxxx/removeTypes API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Types#API-method%3A-%2Fclass-xxxx%2FremoveTypes
[ "Invokes", "the", "/", "workflow", "-", "xxxx", "/", "removeTypes", "API", "method", "." ]
python
train
cds-astro/mocpy
mocpy/interval_set.py
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/interval_set.py#L264-L301
def from_nuniq_interval_set(cls, nuniq_is): """ Convert an IntervalSet containing NUNIQ intervals to an IntervalSet representing HEALPix cells following the NESTED numbering scheme. Parameters ---------- nuniq_is : `IntervalSet` IntervalSet object storing HEA...
[ "def", "from_nuniq_interval_set", "(", "cls", ",", "nuniq_is", ")", ":", "nested_is", "=", "IntervalSet", "(", ")", "# Appending a list is faster than appending a numpy array", "# For these algorithms we append a list and create the interval set from the finished list", "rtmp", "=", ...
Convert an IntervalSet containing NUNIQ intervals to an IntervalSet representing HEALPix cells following the NESTED numbering scheme. Parameters ---------- nuniq_is : `IntervalSet` IntervalSet object storing HEALPix cells as [ipix + 4*4^(order), ipix+1 + 4*4^(order)[ interva...
[ "Convert", "an", "IntervalSet", "containing", "NUNIQ", "intervals", "to", "an", "IntervalSet", "representing", "HEALPix", "cells", "following", "the", "NESTED", "numbering", "scheme", "." ]
python
train
wummel/dosage
scripts/order-symlinks.py
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/scripts/order-symlinks.py#L23-L32
def prepare_output(d): """Clean pre-existing links in output directory.""" outDir = os.path.join(d, 'inorder') if not os.path.exists(outDir): os.mkdir(outDir) for f in os.listdir(outDir): f = os.path.join(outDir, f) if os.path.islink(f): os.remove(f) return outDir
[ "def", "prepare_output", "(", "d", ")", ":", "outDir", "=", "os", ".", "path", ".", "join", "(", "d", ",", "'inorder'", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "outDir", ")", ":", "os", ".", "mkdir", "(", "outDir", ")", "for", ...
Clean pre-existing links in output directory.
[ "Clean", "pre", "-", "existing", "links", "in", "output", "directory", "." ]
python
train
datastax/python-driver
cassandra/policies.py
https://github.com/datastax/python-driver/blob/30a80d0b798b1f45f8cb77163b1fa791f3e3ca29/cassandra/policies.py#L543-L561
def make_query_plan(self, working_keyspace=None, query=None): """ Defers to the child policy's :meth:`.LoadBalancingPolicy.make_query_plan` and filters the results. Note that this filtering may break desirable properties of the wrapped policy in some cases. For instance, imagine...
[ "def", "make_query_plan", "(", "self", ",", "working_keyspace", "=", "None", ",", "query", "=", "None", ")", ":", "child_qp", "=", "self", ".", "_child_policy", ".", "make_query_plan", "(", "working_keyspace", "=", "working_keyspace", ",", "query", "=", "query...
Defers to the child policy's :meth:`.LoadBalancingPolicy.make_query_plan` and filters the results. Note that this filtering may break desirable properties of the wrapped policy in some cases. For instance, imagine if you configure this policy to filter out ``host2``, and to wrap a round...
[ "Defers", "to", "the", "child", "policy", "s", ":", "meth", ":", ".", "LoadBalancingPolicy", ".", "make_query_plan", "and", "filters", "the", "results", "." ]
python
train
DLR-RM/RAFCON
source/rafcon/core/states/state.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L326-L356
def get_default_input_values_for_state(self, state): """ Computes the default input values for a state :param State state: the state to get the default input values for """ from rafcon.core.states.library_state import LibraryState result_dict = {} for input_port_key, va...
[ "def", "get_default_input_values_for_state", "(", "self", ",", "state", ")", ":", "from", "rafcon", ".", "core", ".", "states", ".", "library_state", "import", "LibraryState", "result_dict", "=", "{", "}", "for", "input_port_key", ",", "value", "in", "state", ...
Computes the default input values for a state :param State state: the state to get the default input values for
[ "Computes", "the", "default", "input", "values", "for", "a", "state" ]
python
train
tamasgal/km3pipe
km3pipe/io/root.py
https://github.com/tamasgal/km3pipe/blob/7a9b59ac899a28775b5bdc5d391d9a5340d08040/km3pipe/io/root.py#L70-L91
def interpol_hist2d(h2d, oversamp_factor=10): """Sample the interpolator of a root 2d hist. Root's hist2d has a weird internal interpolation routine, also using neighbouring bins. """ from rootpy import ROOTError xlim = h2d.bins(axis=0) ylim = h2d.bins(axis=1) xn = h2d.nbins(0) yn ...
[ "def", "interpol_hist2d", "(", "h2d", ",", "oversamp_factor", "=", "10", ")", ":", "from", "rootpy", "import", "ROOTError", "xlim", "=", "h2d", ".", "bins", "(", "axis", "=", "0", ")", "ylim", "=", "h2d", ".", "bins", "(", "axis", "=", "1", ")", "x...
Sample the interpolator of a root 2d hist. Root's hist2d has a weird internal interpolation routine, also using neighbouring bins.
[ "Sample", "the", "interpolator", "of", "a", "root", "2d", "hist", "." ]
python
train
loli/medpy
medpy/features/intensity.py
https://github.com/loli/medpy/blob/95216b9e22e7ce301f0edf953ee2a2f1b6c6aee5/medpy/features/intensity.py#L343-L371
def median(image, size = 5, voxelspacing = None, mask = slice(None)): """ Computes the multi-dimensional median filter and returns the resulting values per voxel. Optionally a binary mask can be supplied to select the voxels for which the feature should be extracted. Parameters ---...
[ "def", "median", "(", "image", ",", "size", "=", "5", ",", "voxelspacing", "=", "None", ",", "mask", "=", "slice", "(", "None", ")", ")", ":", "return", "_extract_feature", "(", "_extract_median", ",", "image", ",", "mask", ",", "size", "=", "size", ...
Computes the multi-dimensional median filter and returns the resulting values per voxel. Optionally a binary mask can be supplied to select the voxels for which the feature should be extracted. Parameters ---------- image : array_like or list/tuple of array_like A single image...
[ "Computes", "the", "multi", "-", "dimensional", "median", "filter", "and", "returns", "the", "resulting", "values", "per", "voxel", ".", "Optionally", "a", "binary", "mask", "can", "be", "supplied", "to", "select", "the", "voxels", "for", "which", "the", "fe...
python
train
Skyscanner/skyscanner-python-sdk
skyscanner/skyscanner.py
https://github.com/Skyscanner/skyscanner-python-sdk/blob/26ce4a563f538a689f2a29063f3604731703ddac/skyscanner/skyscanner.py#L102-L132
def get_additional_params(self, **params): """ Filter to get the additional params needed for polling """ # TODO: Move these params to their own vertical if needed. polling_params = [ 'locationschema', 'carrierschema', 'sorttype', ...
[ "def", "get_additional_params", "(", "self", ",", "*", "*", "params", ")", ":", "# TODO: Move these params to their own vertical if needed.", "polling_params", "=", "[", "'locationschema'", ",", "'carrierschema'", ",", "'sorttype'", ",", "'sortorder'", ",", "'originairpor...
Filter to get the additional params needed for polling
[ "Filter", "to", "get", "the", "additional", "params", "needed", "for", "polling" ]
python
train
linkedin/luminol
src/luminol/__init__.py
https://github.com/linkedin/luminol/blob/42e4ab969b774ff98f902d064cb041556017f635/src/luminol/__init__.py#L32-L43
def _analyze_root_causes(self): """ Conduct root cause analysis. The first metric of the list is taken as the root cause right now. """ causes = {} for a in self.anomalies: try: causes[a] = self.correlations[a][0] except IndexError:...
[ "def", "_analyze_root_causes", "(", "self", ")", ":", "causes", "=", "{", "}", "for", "a", "in", "self", ".", "anomalies", ":", "try", ":", "causes", "[", "a", "]", "=", "self", ".", "correlations", "[", "a", "]", "[", "0", "]", "except", "IndexErr...
Conduct root cause analysis. The first metric of the list is taken as the root cause right now.
[ "Conduct", "root", "cause", "analysis", ".", "The", "first", "metric", "of", "the", "list", "is", "taken", "as", "the", "root", "cause", "right", "now", "." ]
python
train
spyder-ide/spyder
spyder/utils/programs.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L478-L484
def is_python_interpreter_valid_name(filename): """Check that the python interpreter file has a valid name.""" pattern = r'.*python(\d\.?\d*)?(w)?(.exe)?$' if re.match(pattern, filename, flags=re.I) is None: return False else: return True
[ "def", "is_python_interpreter_valid_name", "(", "filename", ")", ":", "pattern", "=", "r'.*python(\\d\\.?\\d*)?(w)?(.exe)?$'", "if", "re", ".", "match", "(", "pattern", ",", "filename", ",", "flags", "=", "re", ".", "I", ")", "is", "None", ":", "return", "Fals...
Check that the python interpreter file has a valid name.
[ "Check", "that", "the", "python", "interpreter", "file", "has", "a", "valid", "name", "." ]
python
train
abilian/abilian-core
abilian/services/security/service.py
https://github.com/abilian/abilian-core/blob/0a71275bf108c3d51e13ca9e093c0249235351e3/abilian/services/security/service.py#L81-L130
def query_pa_no_flush(session, permission, role, obj): """Query for a :class:`PermissionAssignment` using `session` without any `flush()`. It works by looking in session `new`, `dirty` and `deleted`, and issuing a query with no autoflush. .. note:: This function is used by `add_permission...
[ "def", "query_pa_no_flush", "(", "session", ",", "permission", ",", "role", ",", "obj", ")", ":", "to_visit", "=", "[", "session", ".", "deleted", ",", "session", ".", "dirty", ",", "session", ".", "new", "]", "with", "session", ".", "no_autoflush", ":",...
Query for a :class:`PermissionAssignment` using `session` without any `flush()`. It works by looking in session `new`, `dirty` and `deleted`, and issuing a query with no autoflush. .. note:: This function is used by `add_permission` and `delete_permission` to allow to add/remove the s...
[ "Query", "for", "a", ":", "class", ":", "PermissionAssignment", "using", "session", "without", "any", "flush", "()", "." ]
python
train
baszoetekouw/janus-py
sr/sr.py
https://github.com/baszoetekouw/janus-py/blob/4f2034436eef010ec8d77e168f6198123b5eb226/sr/sr.py#L150-L155
def list_eids(self): """ Returns a list of all known eids """ entities = self.list() return sorted([int(eid) for eid in entities])
[ "def", "list_eids", "(", "self", ")", ":", "entities", "=", "self", ".", "list", "(", ")", "return", "sorted", "(", "[", "int", "(", "eid", ")", "for", "eid", "in", "entities", "]", ")" ]
Returns a list of all known eids
[ "Returns", "a", "list", "of", "all", "known", "eids" ]
python
train
iotaledger/iota.lib.py
iota/transaction/creation.py
https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/transaction/creation.py#L315-L384
def finalize(self): # type: () -> None """ Finalizes the bundle, preparing it to be attached to the Tangle. """ if self.hash: raise RuntimeError('Bundle is already finalized.') if not self: raise ValueError('Bundle has no transactions.') ...
[ "def", "finalize", "(", "self", ")", ":", "# type: () -> None", "if", "self", ".", "hash", ":", "raise", "RuntimeError", "(", "'Bundle is already finalized.'", ")", "if", "not", "self", ":", "raise", "ValueError", "(", "'Bundle has no transactions.'", ")", "# Quic...
Finalizes the bundle, preparing it to be attached to the Tangle.
[ "Finalizes", "the", "bundle", "preparing", "it", "to", "be", "attached", "to", "the", "Tangle", "." ]
python
test
rpcope1/PythonConfluenceAPI
PythonConfluenceAPI/api.py
https://github.com/rpcope1/PythonConfluenceAPI/blob/b7f0ca2a390f964715fdf3a60b5b0c5ef7116d40/PythonConfluenceAPI/api.py#L23-L52
def all_of(api_call, *args, **kwargs): """ Generator that iterates over all results of an API call that requires limit/start pagination. If the `limit` keyword argument is set, it is used to stop the generator after the given number of result items. >>> for i, v in enumerate(all_of(api.get_content...
[ "def", "all_of", "(", "api_call", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "kwargs", "=", "kwargs", ".", "copy", "(", ")", "pos", ",", "outer_limit", "=", "0", ",", "kwargs", ".", "get", "(", "'limit'", ",", "0", ")", "or", "sys", "...
Generator that iterates over all results of an API call that requires limit/start pagination. If the `limit` keyword argument is set, it is used to stop the generator after the given number of result items. >>> for i, v in enumerate(all_of(api.get_content)): >>> v = bunchify(v) >>> print('...
[ "Generator", "that", "iterates", "over", "all", "results", "of", "an", "API", "call", "that", "requires", "limit", "/", "start", "pagination", "." ]
python
train
gwpy/gwpy
gwpy/timeseries/core.py
https://github.com/gwpy/gwpy/blob/7a92b917e7dd2d99b15895293a1fa1d66cdb210a/gwpy/timeseries/core.py#L267-L310
def read(cls, source, *args, **kwargs): """Read data into a `TimeSeries` Arguments and keywords depend on the output format, see the online documentation for full details for each format, the parameters below are common to most formats. Parameters ---------- sou...
[ "def", "read", "(", "cls", ",", "source", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "from", ".", "io", ".", "core", "import", "read", "as", "timeseries_reader", "return", "timeseries_reader", "(", "cls", ",", "source", ",", "*", "args", ",...
Read data into a `TimeSeries` Arguments and keywords depend on the output format, see the online documentation for full details for each format, the parameters below are common to most formats. Parameters ---------- source : `str`, `list` Source of data, any...
[ "Read", "data", "into", "a", "TimeSeries" ]
python
train
apache/incubator-mxnet
python/mxnet/ndarray/ndarray.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/ndarray/ndarray.py#L2475-L2505
def array(source_array, ctx=None, dtype=None): """Creates an array from any object exposing the array interface. Parameters ---------- source_array : array_like An object exposing the array interface, an object whose `__array__` method returns an array, or any (nested) sequence. ctx...
[ "def", "array", "(", "source_array", ",", "ctx", "=", "None", ",", "dtype", "=", "None", ")", ":", "if", "isinstance", "(", "source_array", ",", "NDArray", ")", ":", "dtype", "=", "source_array", ".", "dtype", "if", "dtype", "is", "None", "else", "dtyp...
Creates an array from any object exposing the array interface. Parameters ---------- source_array : array_like An object exposing the array interface, an object whose `__array__` method returns an array, or any (nested) sequence. ctx : Context, optional Device context (default i...
[ "Creates", "an", "array", "from", "any", "object", "exposing", "the", "array", "interface", "." ]
python
train
andreikop/qutepart
qutepart/indenter/base.py
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/base.py#L132-L161
def findBracketBackward(self, block, column, bracket): """Search for a needle and return (block, column) Raise ValueError, if not found NOTE this method ignores comments """ if bracket in ('(', ')'): opening = '(' closing = ')' elif bracket in ('[...
[ "def", "findBracketBackward", "(", "self", ",", "block", ",", "column", ",", "bracket", ")", ":", "if", "bracket", "in", "(", "'('", ",", "')'", ")", ":", "opening", "=", "'('", "closing", "=", "')'", "elif", "bracket", "in", "(", "'['", ",", "']'", ...
Search for a needle and return (block, column) Raise ValueError, if not found NOTE this method ignores comments
[ "Search", "for", "a", "needle", "and", "return", "(", "block", "column", ")", "Raise", "ValueError", "if", "not", "found" ]
python
train
google/grr
grr/client/grr_response_client/client_actions/tempfiles.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_actions/tempfiles.py#L272-L346
def Run(self, args): """Delete all the GRR temp files in path. If path is a directory, look in the top level for filenames beginning with Client.tempfile_prefix, and delete them. If path is a regular file and starts with Client.tempfile_prefix delete it. Args: args: pathspec pointing to dir...
[ "def", "Run", "(", "self", ",", "args", ")", ":", "allowed_temp_dirs", "=", "[", "GetTempDirForRoot", "(", "root", ")", "for", "root", "in", "config", ".", "CONFIG", "[", "\"Client.tempdir_roots\"", "]", "]", "if", "args", ".", "path", ":", "# Normalize th...
Delete all the GRR temp files in path. If path is a directory, look in the top level for filenames beginning with Client.tempfile_prefix, and delete them. If path is a regular file and starts with Client.tempfile_prefix delete it. Args: args: pathspec pointing to directory containing temp files...
[ "Delete", "all", "the", "GRR", "temp", "files", "in", "path", "." ]
python
train
spry-group/python-vultr
vultr/v1_server.py
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_server.py#L14-L22
def bandwidth(self, subid, params=None): ''' /v1/server/bandwidth GET - account Get the bandwidth used by a virtual machine Link: https://www.vultr.com/api/#server_bandwidth ''' params = update_params(params, {'SUBID': subid}) return self.request('/v1/server/band...
[ "def", "bandwidth", "(", "self", ",", "subid", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SUBID'", ":", "subid", "}", ")", "return", "self", ".", "request", "(", "'/v1/server/bandwidth'", ",", "params...
/v1/server/bandwidth GET - account Get the bandwidth used by a virtual machine Link: https://www.vultr.com/api/#server_bandwidth
[ "/", "v1", "/", "server", "/", "bandwidth", "GET", "-", "account", "Get", "the", "bandwidth", "used", "by", "a", "virtual", "machine" ]
python
train
icometrix/dicom2nifti
dicom2nifti/convert_philips.py
https://github.com/icometrix/dicom2nifti/blob/1462ae5dd979fa3f276fe7a78ceb9b028121536f/dicom2nifti/convert_philips.py#L75-L95
def _is_multiframe_diffusion_imaging(dicom_input): """ Use this function to detect if a dicom series is a philips multiframe dti dataset NOTE: We already assue this is a 4D dataset as input """ header = dicom_input[0] if "PerFrameFunctionalGroupsSequence" not in header: return False ...
[ "def", "_is_multiframe_diffusion_imaging", "(", "dicom_input", ")", ":", "header", "=", "dicom_input", "[", "0", "]", "if", "\"PerFrameFunctionalGroupsSequence\"", "not", "in", "header", ":", "return", "False", "# check if there is diffusion info in the frame", "found_diffu...
Use this function to detect if a dicom series is a philips multiframe dti dataset NOTE: We already assue this is a 4D dataset as input
[ "Use", "this", "function", "to", "detect", "if", "a", "dicom", "series", "is", "a", "philips", "multiframe", "dti", "dataset", "NOTE", ":", "We", "already", "assue", "this", "is", "a", "4D", "dataset", "as", "input" ]
python
train
apache/incubator-heron
heron/instance/src/python/basics/bolt_instance.py
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/basics/bolt_instance.py#L247-L269
def ack(self, tup): """Indicate that processing of a Tuple has succeeded It is compatible with StreamParse API. """ if not isinstance(tup, HeronTuple): Log.error("Only HeronTuple type is supported in ack()") return if self.acking_enabled: ack_tuple = tuple_pb2.AckTuple() ac...
[ "def", "ack", "(", "self", ",", "tup", ")", ":", "if", "not", "isinstance", "(", "tup", ",", "HeronTuple", ")", ":", "Log", ".", "error", "(", "\"Only HeronTuple type is supported in ack()\"", ")", "return", "if", "self", ".", "acking_enabled", ":", "ack_tup...
Indicate that processing of a Tuple has succeeded It is compatible with StreamParse API.
[ "Indicate", "that", "processing", "of", "a", "Tuple", "has", "succeeded" ]
python
valid
CitrineInformatics/pypif-sdk
pypif_sdk/func/calculate_funcs.py
https://github.com/CitrineInformatics/pypif-sdk/blob/8b01d10d9a1426d5eef12e4b2f31c4657aa0fe59/pypif_sdk/func/calculate_funcs.py#L277-L287
def _add_atomic_percents_(elemental_array): """ Adds ideal atomic percents to a emperical compositional element array generated using _create_emprical_compositional_array_() :param elemental_array: an array of dictionaries containing information about the elements in the system :return: the elemental_a...
[ "def", "_add_atomic_percents_", "(", "elemental_array", ")", ":", "n_atoms", "=", "_calculate_n_atoms_", "(", "elemental_array", ")", "for", "e", "in", "elemental_array", ":", "e", "[", "\"atomic_percent\"", "]", "=", "e", "[", "\"occurances\"", "]", "/", "n_ato...
Adds ideal atomic percents to a emperical compositional element array generated using _create_emprical_compositional_array_() :param elemental_array: an array of dictionaries containing information about the elements in the system :return: the elemental_array with the atomic percent of each element added
[ "Adds", "ideal", "atomic", "percents", "to", "a", "emperical", "compositional", "element", "array", "generated", "using", "_create_emprical_compositional_array_", "()" ]
python
train
LasLabs/python-five9
five9/models/base_model.py
https://github.com/LasLabs/python-five9/blob/ef53160d6658604524a2577391280d2b4501a7ce/five9/models/base_model.py#L206-L213
def __check_field(self, key): """Raises a KeyError if the field doesn't exist.""" if not self._props.get(key): raise KeyError( 'The field "%s" does not exist on "%s"' % ( key, self.__class__.__name__, ), )
[ "def", "__check_field", "(", "self", ",", "key", ")", ":", "if", "not", "self", ".", "_props", ".", "get", "(", "key", ")", ":", "raise", "KeyError", "(", "'The field \"%s\" does not exist on \"%s\"'", "%", "(", "key", ",", "self", ".", "__class__", ".", ...
Raises a KeyError if the field doesn't exist.
[ "Raises", "a", "KeyError", "if", "the", "field", "doesn", "t", "exist", "." ]
python
train
crypto101/arthur
arthur/util.py
https://github.com/crypto101/arthur/blob/c32e693fb5af17eac010e3b20f7653ed6e11eb6a/arthur/util.py#L19-L40
def tee(self): """ Produces a new deferred and returns it. If this C{MultiDeferred} has not been fired (callbacked or errbacked) yet, the deferred will not have been fired yet either, but will be fired when and if this C{MultiDeferred} gets fired in the future. If this C{...
[ "def", "tee", "(", "self", ")", ":", "if", "self", ".", "_result", "is", "not", "_NO_RESULT", ":", "if", "not", "self", ".", "_isFailure", ":", "return", "succeed", "(", "self", ".", "_result", ")", "else", ":", "return", "fail", "(", "self", ".", ...
Produces a new deferred and returns it. If this C{MultiDeferred} has not been fired (callbacked or errbacked) yet, the deferred will not have been fired yet either, but will be fired when and if this C{MultiDeferred} gets fired in the future. If this C{MultiDeferred} has been fired, retu...
[ "Produces", "a", "new", "deferred", "and", "returns", "it", ".", "If", "this", "C", "{", "MultiDeferred", "}", "has", "not", "been", "fired", "(", "callbacked", "or", "errbacked", ")", "yet", "the", "deferred", "will", "not", "have", "been", "fired", "ye...
python
train
czielinski/portfolioopt
portfolioopt/portfolioopt.py
https://github.com/czielinski/portfolioopt/blob/96ac25daab0c0dbc8933330a92ff31fb898112f2/portfolioopt/portfolioopt.py#L183-L246
def tangency_portfolio(cov_mat, exp_rets, allow_short=False): """ Computes a tangency portfolio, i.e. a maximum Sharpe ratio portfolio. Note: As the Sharpe ratio is not invariant with respect to leverage, it is not possible to construct non-trivial market neutral tangency portfolios. This is be...
[ "def", "tangency_portfolio", "(", "cov_mat", ",", "exp_rets", ",", "allow_short", "=", "False", ")", ":", "if", "not", "isinstance", "(", "cov_mat", ",", "pd", ".", "DataFrame", ")", ":", "raise", "ValueError", "(", "\"Covariance matrix is not a DataFrame\"", ")...
Computes a tangency portfolio, i.e. a maximum Sharpe ratio portfolio. Note: As the Sharpe ratio is not invariant with respect to leverage, it is not possible to construct non-trivial market neutral tangency portfolios. This is because for a positive initial Sharpe ratio the sharpe grows unbound ...
[ "Computes", "a", "tangency", "portfolio", "i", ".", "e", ".", "a", "maximum", "Sharpe", "ratio", "portfolio", ".", "Note", ":", "As", "the", "Sharpe", "ratio", "is", "not", "invariant", "with", "respect", "to", "leverage", "it", "is", "not", "possible", ...
python
train
jldbc/pybaseball
pybaseball/retrosheet.py
https://github.com/jldbc/pybaseball/blob/085ea26bfd1b5f5926d79d4fac985c88278115f2/pybaseball/retrosheet.py#L125-L133
def wild_card_logs(): """ Pull Retrosheet Wild Card Game Logs """ file_name = 'GLWC.TXT' z = get_zip_file(wild_card_url) data = pd.read_csv(z.open(file_name), header=None, sep=',', quotechar='"') data.columns = gamelog_columns return data
[ "def", "wild_card_logs", "(", ")", ":", "file_name", "=", "'GLWC.TXT'", "z", "=", "get_zip_file", "(", "wild_card_url", ")", "data", "=", "pd", ".", "read_csv", "(", "z", ".", "open", "(", "file_name", ")", ",", "header", "=", "None", ",", "sep", "=", ...
Pull Retrosheet Wild Card Game Logs
[ "Pull", "Retrosheet", "Wild", "Card", "Game", "Logs" ]
python
train
CalebBell/fluids
fluids/particle_size_distribution.py
https://github.com/CalebBell/fluids/blob/57f556752e039f1d3e5a822f408c184783db2828/fluids/particle_size_distribution.py#L1985-L2007
def vssa(self): r'''The volume-specific surface area of a particle size distribution. Note this uses the diameters provided by the method `Dis`. .. math:: \text{VSSA} = \sum_i \text{fraction}_i \frac{SA_i}{V_i} Returns ------- VSSA : float ...
[ "def", "vssa", "(", "self", ")", ":", "ds", "=", "self", ".", "Dis", "Vs", "=", "[", "pi", "/", "6", "*", "di", "**", "3", "for", "di", "in", "ds", "]", "SAs", "=", "[", "pi", "*", "di", "**", "2", "for", "di", "in", "ds", "]", "SASs", ...
r'''The volume-specific surface area of a particle size distribution. Note this uses the diameters provided by the method `Dis`. .. math:: \text{VSSA} = \sum_i \text{fraction}_i \frac{SA_i}{V_i} Returns ------- VSSA : float The volume-specific sur...
[ "r", "The", "volume", "-", "specific", "surface", "area", "of", "a", "particle", "size", "distribution", ".", "Note", "this", "uses", "the", "diameters", "provided", "by", "the", "method", "Dis", ".", "..", "math", "::", "\\", "text", "{", "VSSA", "}", ...
python
train
tanghaibao/jcvi
jcvi/compara/reconstruct.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/compara/reconstruct.py#L111-L186
def adjgraph(args): """ %prog adjgraph adjacency.txt subgraph.txt Construct adjacency graph for graphviz. The file may look like sample below. The lines with numbers are chromosomes with gene order information. genome 0 chr 0 -1 -13 -16 3 4 -6126 -5 17 -6 7 18 5357 8 -5358 5359 -9 -10 -11 ...
[ "def", "adjgraph", "(", "args", ")", ":", "import", "pygraphviz", "as", "pgv", "from", "jcvi", ".", "utils", ".", "iter", "import", "pairwise", "from", "jcvi", ".", "formats", ".", "base", "import", "SetFile", "p", "=", "OptionParser", "(", "adjgraph", "...
%prog adjgraph adjacency.txt subgraph.txt Construct adjacency graph for graphviz. The file may look like sample below. The lines with numbers are chromosomes with gene order information. genome 0 chr 0 -1 -13 -16 3 4 -6126 -5 17 -6 7 18 5357 8 -5358 5359 -9 -10 -11 5362 5360 chr 1 138 6133...
[ "%prog", "adjgraph", "adjacency", ".", "txt", "subgraph", ".", "txt" ]
python
train
thieman/dagobah
dagobah/core/core.py
https://github.com/thieman/dagobah/blob/e624180c2291034960302c9e0b818b65b5a7ee11/dagobah/core/core.py#L888-L893
def local_not_complete(self): """ Returns True if task is local and not completed""" if self.process and self.process.poll() is None: self._timeout_check() return True return False
[ "def", "local_not_complete", "(", "self", ")", ":", "if", "self", ".", "process", "and", "self", ".", "process", ".", "poll", "(", ")", "is", "None", ":", "self", ".", "_timeout_check", "(", ")", "return", "True", "return", "False" ]
Returns True if task is local and not completed
[ "Returns", "True", "if", "task", "is", "local", "and", "not", "completed" ]
python
train
peercoin/peercoin_rpc
peercoin_rpc/peercoin_rpc.py
https://github.com/peercoin/peercoin_rpc/blob/6edd854c7fd607ad9f6f4d5eb8b8b7c7fd8c16cc/peercoin_rpc/peercoin_rpc.py#L191-L194
def sendmany(self, recv_dict, account="", comment=""): """send outgoing tx to many addresses, input is dict of addr:coins, returns txid""" # {"addr1":#coin,"addr2":#coin,"addr3":#coin...} return self.req("sendmany", [account, recv_dict, comment])
[ "def", "sendmany", "(", "self", ",", "recv_dict", ",", "account", "=", "\"\"", ",", "comment", "=", "\"\"", ")", ":", "# {\"addr1\":#coin,\"addr2\":#coin,\"addr3\":#coin...}", "return", "self", ".", "req", "(", "\"sendmany\"", ",", "[", "account", ",", "recv_dic...
send outgoing tx to many addresses, input is dict of addr:coins, returns txid
[ "send", "outgoing", "tx", "to", "many", "addresses", "input", "is", "dict", "of", "addr", ":", "coins", "returns", "txid" ]
python
train
noahbenson/neuropythy
neuropythy/mri/images.py
https://github.com/noahbenson/neuropythy/blob/b588889f6db36ddb9602ae4a72c1c0d3f41586b2/neuropythy/mri/images.py#L120-L129
def create(self, arr, meta_data={}, **kwargs): ''' itype.create(dataobj) yields an image of the given image type itype that represents the given data object dataobj. itype.create(dataobj, meta_data) uses the given meta/header data to create the image. Any number of keyword arg...
[ "def", "create", "(", "self", ",", "arr", ",", "meta_data", "=", "{", "}", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "to_image", "(", "arr", ",", "hdat", "=", "pimms", ".", "merge", "(", "meta_data", ",", "kwargs", ")", ")" ]
itype.create(dataobj) yields an image of the given image type itype that represents the given data object dataobj. itype.create(dataobj, meta_data) uses the given meta/header data to create the image. Any number of keyword arguments may also be appended to the call; these are merged into the ...
[ "itype", ".", "create", "(", "dataobj", ")", "yields", "an", "image", "of", "the", "given", "image", "type", "itype", "that", "represents", "the", "given", "data", "object", "dataobj", ".", "itype", ".", "create", "(", "dataobj", "meta_data", ")", "uses", ...
python
train
jepegit/cellpy
cellpy/readers/core.py
https://github.com/jepegit/cellpy/blob/9f4a84cdd11f72cfa02cda8c2d7b5174abbb7370/cellpy/readers/core.py#L98-L103
def get_raw(self): """Get a list with information about the file. The returned list contains name, size, last_modified and location. """ return [self.name, self.size, self.last_modified, self.location]
[ "def", "get_raw", "(", "self", ")", ":", "return", "[", "self", ".", "name", ",", "self", ".", "size", ",", "self", ".", "last_modified", ",", "self", ".", "location", "]" ]
Get a list with information about the file. The returned list contains name, size, last_modified and location.
[ "Get", "a", "list", "with", "information", "about", "the", "file", "." ]
python
train