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
rwl/godot
godot/util.py
https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/util.py#L98-L108
def load_from_file(cls, filename, format=None): """ Return an instance of the class that is saved in the file with the given filename in the specified format. """ if format is None: # try to derive protocol from file extension format = format_from_extension(fi...
[ "def", "load_from_file", "(", "cls", ",", "filename", ",", "format", "=", "None", ")", ":", "if", "format", "is", "None", ":", "# try to derive protocol from file extension", "format", "=", "format_from_extension", "(", "filename", ")", "with", "file", "(", "fil...
Return an instance of the class that is saved in the file with the given filename in the specified format.
[ "Return", "an", "instance", "of", "the", "class", "that", "is", "saved", "in", "the", "file", "with", "the", "given", "filename", "in", "the", "specified", "format", "." ]
python
test
Esri/ArcREST
src/arcrest/manageportal/administration.py
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageportal/administration.py#L421-L437
def deleteCertificate(self, certName): """ This operation deletes an SSL certificate from the key store. Once a certificate is deleted, it cannot be retrieved or used to enable SSL. Inputs: certName - name of the cert to delete """ params = {"f" : "js...
[ "def", "deleteCertificate", "(", "self", ",", "certName", ")", ":", "params", "=", "{", "\"f\"", ":", "\"json\"", "}", "url", "=", "self", ".", "_url", "+", "\"/sslCertificates/{cert}/delete\"", ".", "format", "(", "cert", "=", "certName", ")", "return", "...
This operation deletes an SSL certificate from the key store. Once a certificate is deleted, it cannot be retrieved or used to enable SSL. Inputs: certName - name of the cert to delete
[ "This", "operation", "deletes", "an", "SSL", "certificate", "from", "the", "key", "store", ".", "Once", "a", "certificate", "is", "deleted", "it", "cannot", "be", "retrieved", "or", "used", "to", "enable", "SSL", "." ]
python
train
PlaidWeb/Publ
publ/image/__init__.py
https://github.com/PlaidWeb/Publ/blob/ce7893632ddc3cb70b4978a41ffd7dd06fa13565/publ/image/__init__.py#L212-L232
def parse_image_spec(spec): """ Parses out a Publ-Markdown image spec into a tuple of path, args, title """ # I was having trouble coming up with a single RE that did it right, # so let's just break it down into sub-problems. First, parse out the # alt text... match = re.match(r'(.+)\s+\"(.*)\"\s*$...
[ "def", "parse_image_spec", "(", "spec", ")", ":", "# I was having trouble coming up with a single RE that did it right,", "# so let's just break it down into sub-problems. First, parse out the", "# alt text...", "match", "=", "re", ".", "match", "(", "r'(.+)\\s+\\\"(.*)\\\"\\s*$'", "...
Parses out a Publ-Markdown image spec into a tuple of path, args, title
[ "Parses", "out", "a", "Publ", "-", "Markdown", "image", "spec", "into", "a", "tuple", "of", "path", "args", "title" ]
python
train
nabla-c0d3/sslyze
sslyze/plugins/openssl_cipher_suites_plugin.py
https://github.com/nabla-c0d3/sslyze/blob/0fb3ae668453d7ecf616d0755f237ca7be9f62fa/sslyze/plugins/openssl_cipher_suites_plugin.py#L366-L369
def name(self) -> str: """OpenSSL uses a different naming convention than the corresponding RFCs. """ return OPENSSL_TO_RFC_NAMES_MAPPING[self.ssl_version].get(self.openssl_name, self.openssl_name)
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "OPENSSL_TO_RFC_NAMES_MAPPING", "[", "self", ".", "ssl_version", "]", ".", "get", "(", "self", ".", "openssl_name", ",", "self", ".", "openssl_name", ")" ]
OpenSSL uses a different naming convention than the corresponding RFCs.
[ "OpenSSL", "uses", "a", "different", "naming", "convention", "than", "the", "corresponding", "RFCs", "." ]
python
train
splunk/splunk-sdk-python
splunklib/client.py
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L1443-L1472
def list(self, count=None, **kwargs): """Retrieves a list of entities in this collection. The entire collection is loaded at once and is returned as a list. This function makes a single roundtrip to the server, plus at most two more if the ``autologin`` field of :func:`connect` is set t...
[ "def", "list", "(", "self", ",", "count", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# response = self.get(count=count, **kwargs)", "# return self._load_list(response)", "return", "list", "(", "self", ".", "iter", "(", "count", "=", "count", ",", "*", "*...
Retrieves a list of entities in this collection. The entire collection is loaded at once and is returned as a list. This function makes a single roundtrip to the server, plus at most two more if the ``autologin`` field of :func:`connect` is set to ``True``. There is no caching--every ca...
[ "Retrieves", "a", "list", "of", "entities", "in", "this", "collection", "." ]
python
train
joar/mig
mig/__init__.py
https://github.com/joar/mig/blob/e1a7a8b9ea5941a05a27d5afbb5952965bb20ae5/mig/__init__.py#L171-L190
def dry_run(self): """ Print out a dry run of what we would have upgraded. """ if self.database_current_migration is None: self.printer( u'~> Woulda initialized: %s\n' % self.name_for_printing()) return u'inited' migrations_to_run = se...
[ "def", "dry_run", "(", "self", ")", ":", "if", "self", ".", "database_current_migration", "is", "None", ":", "self", ".", "printer", "(", "u'~> Woulda initialized: %s\\n'", "%", "self", ".", "name_for_printing", "(", ")", ")", "return", "u'inited'", "migrations_...
Print out a dry run of what we would have upgraded.
[ "Print", "out", "a", "dry", "run", "of", "what", "we", "would", "have", "upgraded", "." ]
python
train
napalm-automation/napalm-junos
napalm_junos/junos.py
https://github.com/napalm-automation/napalm-junos/blob/78c0d161daf2abf26af5835b773f6db57c46efff/napalm_junos/junos.py#L132-L136
def _unlock(self): """Unlock the config DB.""" if self.locked: self.device.cu.unlock() self.locked = False
[ "def", "_unlock", "(", "self", ")", ":", "if", "self", ".", "locked", ":", "self", ".", "device", ".", "cu", ".", "unlock", "(", ")", "self", ".", "locked", "=", "False" ]
Unlock the config DB.
[ "Unlock", "the", "config", "DB", "." ]
python
train
pyQode/pyqode.python
pyqode/python/managers/file.py
https://github.com/pyQode/pyqode.python/blob/821e000ea2e2638a82ce095a559e69afd9bd4f38/pyqode/python/managers/file.py#L23-L47
def detect_encoding(self, path): """ For the implementation of encoding definitions in Python, look at: - http://www.python.org/dev/peps/pep-0263/ .. note:: code taken and adapted from ```jedi.common.source_to_unicode.detect_encoding``` """ with open(path, 'r...
[ "def", "detect_encoding", "(", "self", ",", "path", ")", ":", "with", "open", "(", "path", ",", "'rb'", ")", "as", "file", ":", "source", "=", "file", ".", "read", "(", ")", "# take care of line encodings (not in jedi)", "source", "=", "source", ".", "repl...
For the implementation of encoding definitions in Python, look at: - http://www.python.org/dev/peps/pep-0263/ .. note:: code taken and adapted from ```jedi.common.source_to_unicode.detect_encoding```
[ "For", "the", "implementation", "of", "encoding", "definitions", "in", "Python", "look", "at", ":", "-", "http", ":", "//", "www", ".", "python", ".", "org", "/", "dev", "/", "peps", "/", "pep", "-", "0263", "/" ]
python
valid
frascoweb/frasco-models
frasco_models/backends/mongoengine.py
https://github.com/frascoweb/frasco-models/blob/f7c1e14424cadf3dc07c2bd81cc32b0fd046ccba/frasco_models/backends/mongoengine.py#L45-L90
def reload(self, *fields, **kwargs): """Reloads all attributes from the database. :param fields: (optional) args list of fields to reload :param max_depth: (optional) depth of dereferencing to follow .. versionadded:: 0.1.2 .. versionchanged:: 0.6 Now chainable .. versio...
[ "def", "reload", "(", "self", ",", "*", "fields", ",", "*", "*", "kwargs", ")", ":", "max_depth", "=", "1", "if", "fields", "and", "isinstance", "(", "fields", "[", "0", "]", ",", "int", ")", ":", "max_depth", "=", "fields", "[", "0", "]", "field...
Reloads all attributes from the database. :param fields: (optional) args list of fields to reload :param max_depth: (optional) depth of dereferencing to follow .. versionadded:: 0.1.2 .. versionchanged:: 0.6 Now chainable .. versionchanged:: 0.9 Can provide specific fields to r...
[ "Reloads", "all", "attributes", "from", "the", "database", ".", ":", "param", "fields", ":", "(", "optional", ")", "args", "list", "of", "fields", "to", "reload", ":", "param", "max_depth", ":", "(", "optional", ")", "depth", "of", "dereferencing", "to", ...
python
valid
Neurosim-lab/netpyne
netpyne/support/morphology.py
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/morphology.py#L149-L171
def sequential_spherical(xyz): """ Converts sequence of cartesian coordinates into a sequence of line segments defined by spherical coordinates. Args: xyz = 2d numpy array, each row specifies a point in cartesian coordinates (x,y,z) tracing out a path in 3D space...
[ "def", "sequential_spherical", "(", "xyz", ")", ":", "d_xyz", "=", "np", ".", "diff", "(", "xyz", ",", "axis", "=", "0", ")", "r", "=", "np", ".", "linalg", ".", "norm", "(", "d_xyz", ",", "axis", "=", "1", ")", "theta", "=", "np", ".", "arctan...
Converts sequence of cartesian coordinates into a sequence of line segments defined by spherical coordinates. Args: xyz = 2d numpy array, each row specifies a point in cartesian coordinates (x,y,z) tracing out a path in 3D space. Returns: r = lengths of ...
[ "Converts", "sequence", "of", "cartesian", "coordinates", "into", "a", "sequence", "of", "line", "segments", "defined", "by", "spherical", "coordinates", ".", "Args", ":", "xyz", "=", "2d", "numpy", "array", "each", "row", "specifies", "a", "point", "in", "c...
python
train
pilosus/ForgeryPy3
forgery_py/forgery/date.py
https://github.com/pilosus/ForgeryPy3/blob/e15f2e59538deb4cbfceaac314f5ea897f2d5450/forgery_py/forgery/date.py#L95-L98
def date(past=False, min_delta=0, max_delta=20): """Return a random `dt.date` object. Delta args are days.""" timedelta = dt.timedelta(days=_delta(past, min_delta, max_delta)) return dt.date.today() + timedelta
[ "def", "date", "(", "past", "=", "False", ",", "min_delta", "=", "0", ",", "max_delta", "=", "20", ")", ":", "timedelta", "=", "dt", ".", "timedelta", "(", "days", "=", "_delta", "(", "past", ",", "min_delta", ",", "max_delta", ")", ")", "return", ...
Return a random `dt.date` object. Delta args are days.
[ "Return", "a", "random", "dt", ".", "date", "object", ".", "Delta", "args", "are", "days", "." ]
python
valid
brutasse/graphite-api
graphite_api/render/glyph.py
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/render/glyph.py#L2147-L2153
def safeArgs(args): """Iterate over valid, finite values in an iterable. Skip any items that are None, NaN, or infinite. """ return (arg for arg in args if arg is not None and not math.isnan(arg) and not math.isinf(arg))
[ "def", "safeArgs", "(", "args", ")", ":", "return", "(", "arg", "for", "arg", "in", "args", "if", "arg", "is", "not", "None", "and", "not", "math", ".", "isnan", "(", "arg", ")", "and", "not", "math", ".", "isinf", "(", "arg", ")", ")" ]
Iterate over valid, finite values in an iterable. Skip any items that are None, NaN, or infinite.
[ "Iterate", "over", "valid", "finite", "values", "in", "an", "iterable", "." ]
python
train
hydraplatform/hydra-base
hydra_base/lib/users.py
https://github.com/hydraplatform/hydra-base/blob/9251ff7946505f7a272c87837390acd1c435bc6e/hydra_base/lib/users.py#L75-L81
def get_usernames_like(username,**kwargs): """ Return a list of usernames like the given string. """ checkname = "%%%s%%"%username rs = db.DBSession.query(User.username).filter(User.username.like(checkname)).all() return [r.username for r in rs]
[ "def", "get_usernames_like", "(", "username", ",", "*", "*", "kwargs", ")", ":", "checkname", "=", "\"%%%s%%\"", "%", "username", "rs", "=", "db", ".", "DBSession", ".", "query", "(", "User", ".", "username", ")", ".", "filter", "(", "User", ".", "user...
Return a list of usernames like the given string.
[ "Return", "a", "list", "of", "usernames", "like", "the", "given", "string", "." ]
python
train
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavutil.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavutil.py#L377-L379
def setup_logfile_raw(self, logfile, mode='w'): '''start logging raw bytes to the given logfile, without timestamps''' self.logfile_raw = open(logfile, mode=mode)
[ "def", "setup_logfile_raw", "(", "self", ",", "logfile", ",", "mode", "=", "'w'", ")", ":", "self", ".", "logfile_raw", "=", "open", "(", "logfile", ",", "mode", "=", "mode", ")" ]
start logging raw bytes to the given logfile, without timestamps
[ "start", "logging", "raw", "bytes", "to", "the", "given", "logfile", "without", "timestamps" ]
python
train
SeabornGames/Table
seaborn_table/table.py
https://github.com/SeabornGames/Table/blob/0c474ef2fb00db0e7cf47e8af91e3556c2e7485a/seaborn_table/table.py#L315-L334
def txt_to_obj(cls, file_path=None, text='', columns=None, remove_empty_rows=True, key_on=None, row_columns=None, deliminator='\t', eval_cells=True): """ This will convert text file or text to a seaborn table and return it :param file_path: str of th...
[ "def", "txt_to_obj", "(", "cls", ",", "file_path", "=", "None", ",", "text", "=", "''", ",", "columns", "=", "None", ",", "remove_empty_rows", "=", "True", ",", "key_on", "=", "None", ",", "row_columns", "=", "None", ",", "deliminator", "=", "'\\t'", "...
This will convert text file or text to a seaborn table and return it :param file_path: str of the path to the file :param text: str of the csv text :param columns: list of str of columns to use :param row_columns: list of str of columns in data but not to use :param remov...
[ "This", "will", "convert", "text", "file", "or", "text", "to", "a", "seaborn", "table", "and", "return", "it", ":", "param", "file_path", ":", "str", "of", "the", "path", "to", "the", "file", ":", "param", "text", ":", "str", "of", "the", "csv", "tex...
python
train
materialsproject/custodian
custodian/vasp/jobs.py
https://github.com/materialsproject/custodian/blob/b33b01574fc899f959acb3c495398fd3d0fc41d0/custodian/vasp/jobs.py#L216-L241
def postprocess(self): """ Postprocessing includes renaming and gzipping where necessary. Also copies the magmom to the incar if necessary """ for f in VASP_OUTPUT_FILES + [self.output_file]: if os.path.exists(f): if self.final and self.suffix != "": ...
[ "def", "postprocess", "(", "self", ")", ":", "for", "f", "in", "VASP_OUTPUT_FILES", "+", "[", "self", ".", "output_file", "]", ":", "if", "os", ".", "path", ".", "exists", "(", "f", ")", ":", "if", "self", ".", "final", "and", "self", ".", "suffix"...
Postprocessing includes renaming and gzipping where necessary. Also copies the magmom to the incar if necessary
[ "Postprocessing", "includes", "renaming", "and", "gzipping", "where", "necessary", ".", "Also", "copies", "the", "magmom", "to", "the", "incar", "if", "necessary" ]
python
train
OnroerendErfgoed/oe_utils
oe_utils/__init__.py
https://github.com/OnroerendErfgoed/oe_utils/blob/7b2014bda8ac6bb71b7138eaa06ac17ef3ff4a6d/oe_utils/__init__.py#L5-L37
def conditional_http_tween_factory(handler, registry): """ Tween that adds ETag headers and tells Pyramid to enable conditional responses where appropriate. """ settings = registry.settings if hasattr(registry, 'settings') else {} not_cacheble_list = [] if 'not.cachable.list' in settings: ...
[ "def", "conditional_http_tween_factory", "(", "handler", ",", "registry", ")", ":", "settings", "=", "registry", ".", "settings", "if", "hasattr", "(", "registry", ",", "'settings'", ")", "else", "{", "}", "not_cacheble_list", "=", "[", "]", "if", "'not.cachab...
Tween that adds ETag headers and tells Pyramid to enable conditional responses where appropriate.
[ "Tween", "that", "adds", "ETag", "headers", "and", "tells", "Pyramid", "to", "enable", "conditional", "responses", "where", "appropriate", "." ]
python
train
Opentrons/opentrons
api/src/opentrons/hardware_control/__init__.py
https://github.com/Opentrons/opentrons/blob/a7c15cc2636ecb64ab56c7edc1d8a57163aaeadf/api/src/opentrons/hardware_control/__init__.py#L898-L917
async def blow_out(self, mount): """ Force any remaining liquid to dispense. The liquid will be dispensed at the current location of pipette """ this_pipette = self._attached_instruments[mount] if not this_pipette: raise top_types.PipetteNotAttachedError( ...
[ "async", "def", "blow_out", "(", "self", ",", "mount", ")", ":", "this_pipette", "=", "self", ".", "_attached_instruments", "[", "mount", "]", "if", "not", "this_pipette", ":", "raise", "top_types", ".", "PipetteNotAttachedError", "(", "\"No pipette attached to {}...
Force any remaining liquid to dispense. The liquid will be dispensed at the current location of pipette
[ "Force", "any", "remaining", "liquid", "to", "dispense", ".", "The", "liquid", "will", "be", "dispensed", "at", "the", "current", "location", "of", "pipette" ]
python
train
neuropsychology/NeuroKit.py
neurokit/bio/bio_ecg.py
https://github.com/neuropsychology/NeuroKit.py/blob/c9589348fbbde0fa7e986048c48f38e6b488adfe/neurokit/bio/bio_ecg.py#L393-L683
def ecg_hrv(rpeaks=None, rri=None, sampling_rate=1000, hrv_features=["time", "frequency", "nonlinear"]): """ Computes the Heart-Rate Variability (HRV). Shamelessly stolen from the `hrv <https://github.com/rhenanbartels/hrv/blob/develop/hrv>`_ package by Rhenan Bartels. All credits go to him. Parameters ...
[ "def", "ecg_hrv", "(", "rpeaks", "=", "None", ",", "rri", "=", "None", ",", "sampling_rate", "=", "1000", ",", "hrv_features", "=", "[", "\"time\"", ",", "\"frequency\"", ",", "\"nonlinear\"", "]", ")", ":", "# Check arguments: exactly one of rpeaks or rri has to ...
Computes the Heart-Rate Variability (HRV). Shamelessly stolen from the `hrv <https://github.com/rhenanbartels/hrv/blob/develop/hrv>`_ package by Rhenan Bartels. All credits go to him. Parameters ---------- rpeaks : list or ndarray R-peak location indices. rri: list or ndarray RR interva...
[ "Computes", "the", "Heart", "-", "Rate", "Variability", "(", "HRV", ")", ".", "Shamelessly", "stolen", "from", "the", "hrv", "<https", ":", "//", "github", ".", "com", "/", "rhenanbartels", "/", "hrv", "/", "blob", "/", "develop", "/", "hrv", ">", "_",...
python
train
watson-developer-cloud/python-sdk
ibm_watson/speech_to_text_v1.py
https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/speech_to_text_v1.py#L4323-L4356
def _from_dict(cls, _dict): """Initialize a RecognitionJob object from a json dictionary.""" args = {} if 'id' in _dict: args['id'] = _dict.get('id') else: raise ValueError( 'Required property \'id\' not present in RecognitionJob JSON') if ...
[ "def", "_from_dict", "(", "cls", ",", "_dict", ")", ":", "args", "=", "{", "}", "if", "'id'", "in", "_dict", ":", "args", "[", "'id'", "]", "=", "_dict", ".", "get", "(", "'id'", ")", "else", ":", "raise", "ValueError", "(", "'Required property \\'id...
Initialize a RecognitionJob object from a json dictionary.
[ "Initialize", "a", "RecognitionJob", "object", "from", "a", "json", "dictionary", "." ]
python
train
Ex-Mente/auxi.0
auxi/modelling/business/models.py
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/business/models.py#L94-L101
def prepare_to_run(self): """ Prepare the model for execution. """ self.clock.reset() for e in self.entities: e.prepare_to_run(self.clock, self.period_count)
[ "def", "prepare_to_run", "(", "self", ")", ":", "self", ".", "clock", ".", "reset", "(", ")", "for", "e", "in", "self", ".", "entities", ":", "e", ".", "prepare_to_run", "(", "self", ".", "clock", ",", "self", ".", "period_count", ")" ]
Prepare the model for execution.
[ "Prepare", "the", "model", "for", "execution", "." ]
python
valid
romanvm/python-web-pdb
web_pdb/wsgi_app.py
https://github.com/romanvm/python-web-pdb/blob/f2df2207e870dbf50a4bb30ca12a59cab39a809f/web_pdb/wsgi_app.py#L49-L67
def compress(func): """ Compress route return data with gzip compression """ @wraps(func) def wrapper(*args, **kwargs): result = func(*args, **kwargs) if ('gzip' in bottle.request.headers.get('Accept-Encoding', '') and isinstance(result, string_type) and ...
[ "def", "compress", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "result", "=", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "(", "'gzip'", "in", ...
Compress route return data with gzip compression
[ "Compress", "route", "return", "data", "with", "gzip", "compression" ]
python
train
fjwCode/cerium
cerium/service.py
https://github.com/fjwCode/cerium/blob/f6e06e0dcf83a0bc924828e9d6cb81383ed2364f/cerium/service.py#L68-L71
def version(self) -> str: '''Show the version number of Android Debug Bridge.''' output, _ = self._execute('version') return output.splitlines()[0].split()[-1]
[ "def", "version", "(", "self", ")", "->", "str", ":", "output", ",", "_", "=", "self", ".", "_execute", "(", "'version'", ")", "return", "output", ".", "splitlines", "(", ")", "[", "0", "]", ".", "split", "(", ")", "[", "-", "1", "]" ]
Show the version number of Android Debug Bridge.
[ "Show", "the", "version", "number", "of", "Android", "Debug", "Bridge", "." ]
python
train
schocco/django-staticfiles-webpack
webpack/storage.py
https://github.com/schocco/django-staticfiles-webpack/blob/fd591decfd51f8c83ee78380ef03cba46ea46f0a/webpack/storage.py#L29-L39
def check_assets(self): """ Throws an exception if assets file is not configured or cannot be found. :param assets: path to the assets file """ if not self.assets_file: raise ImproperlyConfigured("You must specify the path to the assets.json file via WEBPACK_ASSETS_FI...
[ "def", "check_assets", "(", "self", ")", ":", "if", "not", "self", ".", "assets_file", ":", "raise", "ImproperlyConfigured", "(", "\"You must specify the path to the assets.json file via WEBPACK_ASSETS_FILE\"", ")", "elif", "not", "os", ".", "path", ".", "exists", "("...
Throws an exception if assets file is not configured or cannot be found. :param assets: path to the assets file
[ "Throws", "an", "exception", "if", "assets", "file", "is", "not", "configured", "or", "cannot", "be", "found", ".", ":", "param", "assets", ":", "path", "to", "the", "assets", "file" ]
python
train
trailofbits/manticore
manticore/platforms/evm.py
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/evm.py#L751-L770
def _push(self, value): """ Push into the stack ITEM0 ITEM1 ITEM2 sp-> {empty} """ assert isinstance(value, int) or isinstance(value, BitVec) and value.size == 256 if len(self.stack) >= 1024: raise StackOverflow() ...
[ "def", "_push", "(", "self", ",", "value", ")", ":", "assert", "isinstance", "(", "value", ",", "int", ")", "or", "isinstance", "(", "value", ",", "BitVec", ")", "and", "value", ".", "size", "==", "256", "if", "len", "(", "self", ".", "stack", ")",...
Push into the stack ITEM0 ITEM1 ITEM2 sp-> {empty}
[ "Push", "into", "the", "stack" ]
python
valid
santosjorge/cufflinks
cufflinks/datagen.py
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/datagen.py#L173-L197
def lines(n_traces=5,n=100,columns=None,dateIndex=True,mode=None): """ Returns a DataFrame with the required format for a scatter (lines) plot Parameters: ----------- n_traces : int Number of traces n : int Number of points for each trace columns : [str] List of column names dateIndex : bool ...
[ "def", "lines", "(", "n_traces", "=", "5", ",", "n", "=", "100", ",", "columns", "=", "None", ",", "dateIndex", "=", "True", ",", "mode", "=", "None", ")", ":", "index", "=", "pd", ".", "date_range", "(", "'1/1/15'", ",", "periods", "=", "n", ")"...
Returns a DataFrame with the required format for a scatter (lines) plot Parameters: ----------- n_traces : int Number of traces n : int Number of points for each trace columns : [str] List of column names dateIndex : bool If True it will return a datetime index if False it will return a enu...
[ "Returns", "a", "DataFrame", "with", "the", "required", "format", "for", "a", "scatter", "(", "lines", ")", "plot" ]
python
train
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_fcoe_ext.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_fcoe_ext.py#L65-L79
def fcoe_get_interface_output_fcoe_intf_list_fcoe_intf_port_type(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") fcoe_get_interface = ET.Element("fcoe_get_interface") config = fcoe_get_interface output = ET.SubElement(fcoe_get_interface, "output"...
[ "def", "fcoe_get_interface_output_fcoe_intf_list_fcoe_intf_port_type", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "fcoe_get_interface", "=", "ET", ".", "Element", "(", "\"fcoe_get_interface\"", ")", ...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
Unidata/MetPy
metpy/interpolate/tools.py
https://github.com/Unidata/MetPy/blob/16f68a94919b9a82dcf9cada2169cf039129e67b/metpy/interpolate/tools.py#L94-L130
def remove_repeat_coordinates(x, y, z): r"""Remove all x, y, and z where (x,y) is repeated and keep the first occurrence only. Will not destroy original values. Parameters ---------- x: array_like x coordinate y: array_like y coordinate z: array_like observation val...
[ "def", "remove_repeat_coordinates", "(", "x", ",", "y", ",", "z", ")", ":", "coords", "=", "[", "]", "variable", "=", "[", "]", "for", "(", "x_", ",", "y_", ",", "t_", ")", "in", "zip", "(", "x", ",", "y", ",", "z", ")", ":", "if", "(", "x_...
r"""Remove all x, y, and z where (x,y) is repeated and keep the first occurrence only. Will not destroy original values. Parameters ---------- x: array_like x coordinate y: array_like y coordinate z: array_like observation value Returns ------- x, y, z ...
[ "r", "Remove", "all", "x", "y", "and", "z", "where", "(", "x", "y", ")", "is", "repeated", "and", "keep", "the", "first", "occurrence", "only", "." ]
python
train
manns/pyspread
pyspread/src/gui/_grid.py
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_grid.py#L801-L811
def OnCellBackgroundColor(self, event): """Cell background color event handler""" with undo.group(_("Background color")): self.grid.actions.set_attr("bgcolor", event.color) self.grid.ForceRefresh() self.grid.update_attribute_toolbar() event.Skip()
[ "def", "OnCellBackgroundColor", "(", "self", ",", "event", ")", ":", "with", "undo", ".", "group", "(", "_", "(", "\"Background color\"", ")", ")", ":", "self", ".", "grid", ".", "actions", ".", "set_attr", "(", "\"bgcolor\"", ",", "event", ".", "color",...
Cell background color event handler
[ "Cell", "background", "color", "event", "handler" ]
python
train
amaas-fintech/amaas-core-sdk-python
amaascore/core/amaas_model.py
https://github.com/amaas-fintech/amaas-core-sdk-python/blob/347b71f8e776b2dde582b015e31b4802d91e8040/amaascore/core/amaas_model.py#L58-L63
def version(self, version): """ Cast string versions to int (if read from a file etc) """ if isinstance(version, type_check): self._version = int(version) elif isinstance(version, int): self._version = version
[ "def", "version", "(", "self", ",", "version", ")", ":", "if", "isinstance", "(", "version", ",", "type_check", ")", ":", "self", ".", "_version", "=", "int", "(", "version", ")", "elif", "isinstance", "(", "version", ",", "int", ")", ":", "self", "....
Cast string versions to int (if read from a file etc)
[ "Cast", "string", "versions", "to", "int", "(", "if", "read", "from", "a", "file", "etc", ")" ]
python
train
python-gitlab/python-gitlab
gitlab/mixins.py
https://github.com/python-gitlab/python-gitlab/blob/16de1b03fde3dbbe8f851614dd1d8c09de102fe5/gitlab/mixins.py#L241-L283
def update(self, id=None, new_data={}, **kwargs): """Update an object on the server. Args: id: ID of the object to update (can be None if not required) new_data: the update data for the object **kwargs: Extra options to send to the server (e.g. sudo) Returns...
[ "def", "update", "(", "self", ",", "id", "=", "None", ",", "new_data", "=", "{", "}", ",", "*", "*", "kwargs", ")", ":", "if", "id", "is", "None", ":", "path", "=", "self", ".", "path", "else", ":", "path", "=", "'%s/%s'", "%", "(", "self", "...
Update an object on the server. Args: id: ID of the object to update (can be None if not required) new_data: the update data for the object **kwargs: Extra options to send to the server (e.g. sudo) Returns: dict: The new object data (*not* a RESTObject) ...
[ "Update", "an", "object", "on", "the", "server", "." ]
python
train
saltstack/salt
salt/cloud/clouds/aliyun.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/aliyun.py#L415-L431
def get_image(vm_): ''' Return the image object to use ''' images = avail_images() vm_image = six.text_type(config.get_cloud_config_value( 'image', vm_, __opts__, search_global=False )) if not vm_image: raise SaltCloudNotFound('No image specified for this VM.') if vm_im...
[ "def", "get_image", "(", "vm_", ")", ":", "images", "=", "avail_images", "(", ")", "vm_image", "=", "six", ".", "text_type", "(", "config", ".", "get_cloud_config_value", "(", "'image'", ",", "vm_", ",", "__opts__", ",", "search_global", "=", "False", ")",...
Return the image object to use
[ "Return", "the", "image", "object", "to", "use" ]
python
train
sethmlarson/virtualbox-python
virtualbox/library.py
https://github.com/sethmlarson/virtualbox-python/blob/706c8e3f6e3aee17eb06458e73cbb4bc2d37878b/virtualbox/library.py#L17042-L17061
def find_host_network_interface_by_id(self, id_p): """Searches through all host network interfaces for an interface with the given GUID. The method returns an error if the given GUID does not correspond to any host network interface. in id_p of type str GUID...
[ "def", "find_host_network_interface_by_id", "(", "self", ",", "id_p", ")", ":", "if", "not", "isinstance", "(", "id_p", ",", "basestring", ")", ":", "raise", "TypeError", "(", "\"id_p can only be an instance of type basestring\"", ")", "network_interface", "=", "self"...
Searches through all host network interfaces for an interface with the given GUID. The method returns an error if the given GUID does not correspond to any host network interface. in id_p of type str GUID of the host network interface to search for. return ...
[ "Searches", "through", "all", "host", "network", "interfaces", "for", "an", "interface", "with", "the", "given", "GUID", ".", "The", "method", "returns", "an", "error", "if", "the", "given", "GUID", "does", "not", "correspond", "to", "any", "host", "network"...
python
train
rfosterslo/wagtailplus
wagtailplus/wagtaillinks/views/chooser.py
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtaillinks/views/chooser.py#L14-L29
def get_json(self, link): """ Returns specified link instance as JSON. :param link: the link instance. :rtype: JSON. """ return json.dumps({ 'id': link.id, 'title': link.title, 'url': link.get_absolute_url(), ...
[ "def", "get_json", "(", "self", ",", "link", ")", ":", "return", "json", ".", "dumps", "(", "{", "'id'", ":", "link", ".", "id", ",", "'title'", ":", "link", ".", "title", ",", "'url'", ":", "link", ".", "get_absolute_url", "(", ")", ",", "'edit_li...
Returns specified link instance as JSON. :param link: the link instance. :rtype: JSON.
[ "Returns", "specified", "link", "instance", "as", "JSON", "." ]
python
train
mdavidsaver/p4p
src/p4p/client/cothread.py
https://github.com/mdavidsaver/p4p/blob/c5e45eac01edfdad9cc2857bc283c7f2695802b8/src/p4p/client/cothread.py#L265-L273
def close(self): """Close subscription. """ if self._S is not None: # after .close() self._event should never be called self._S.close() self._S = None self._Q.Signal(None) self._T.Wait()
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "_S", "is", "not", "None", ":", "# after .close() self._event should never be called", "self", ".", "_S", ".", "close", "(", ")", "self", ".", "_S", "=", "None", "self", ".", "_Q", ".", "Signal", ...
Close subscription.
[ "Close", "subscription", "." ]
python
train
azraq27/neural
neural/scheduler.py
https://github.com/azraq27/neural/blob/fe91bfeecbf73ad99708cf5dca66cb61fcd529f5/neural/scheduler.py#L114-L150
def add_server(self,address,port=default_port,password=None,speed=None,valid_times=None,invalid_times=None): ''' :address: remote address of server, or special string ``local`` to run the command locally :valid_times: times when this server is availabl...
[ "def", "add_server", "(", "self", ",", "address", ",", "port", "=", "default_port", ",", "password", "=", "None", ",", "speed", "=", "None", ",", "valid_times", "=", "None", ",", "invalid_times", "=", "None", ")", ":", "for", "t", "in", "[", "valid_tim...
:address: remote address of server, or special string ``local`` to run the command locally :valid_times: times when this server is available, given as a list of tuples of 2 strings of form "HH:MM" that define the ...
[ ":", "address", ":", "remote", "address", "of", "server", "or", "special", "string", "local", "to", "run", "the", "command", "locally", ":", "valid_times", ":", "times", "when", "this", "server", "is", "available", "given", "as", "a", "list", "of", "tuples...
python
train
BreakingBytes/simkit
simkit/core/outputs.py
https://github.com/BreakingBytes/simkit/blob/205163d879d3880b6c9ef609f1b723a58773026b/simkit/core/outputs.py#L31-L52
def register(self, new_outputs, *args, **kwargs): """ Register outputs and metadata. * ``initial_value`` - used in dynamic calculations * ``size`` - number of elements per timestep * ``uncertainty`` - in percent of nominal value * ``variance`` - dictionary of covariances...
[ "def", "register", "(", "self", ",", "new_outputs", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "update", "(", "zip", "(", "self", ".", "meta_names", ",", "args", ")", ")", "# call super method", "super", "(", "OutputRegistry", ...
Register outputs and metadata. * ``initial_value`` - used in dynamic calculations * ``size`` - number of elements per timestep * ``uncertainty`` - in percent of nominal value * ``variance`` - dictionary of covariances, diagonal is square of uncertianties, no units * ``...
[ "Register", "outputs", "and", "metadata", "." ]
python
train
uw-it-aca/uw-restclients-bookstore
uw_bookstore/__init__.py
https://github.com/uw-it-aca/uw-restclients-bookstore/blob/c9b187505ad0af0ee8ce3b163a13613a52701f54/uw_bookstore/__init__.py#L76-L92
def get_url_for_schedule(self, schedule): """ Returns a link to verba. The link varies by campus and schedule. Multiple calls to this with the same schedule may result in different urls. """ url = self._get_url(schedule) if url is None: return None ...
[ "def", "get_url_for_schedule", "(", "self", ",", "schedule", ")", ":", "url", "=", "self", ".", "_get_url", "(", "schedule", ")", "if", "url", "is", "None", ":", "return", "None", "response", "=", "DAO", ".", "getURL", "(", "url", ",", "{", "\"Accept\"...
Returns a link to verba. The link varies by campus and schedule. Multiple calls to this with the same schedule may result in different urls.
[ "Returns", "a", "link", "to", "verba", ".", "The", "link", "varies", "by", "campus", "and", "schedule", ".", "Multiple", "calls", "to", "this", "with", "the", "same", "schedule", "may", "result", "in", "different", "urls", "." ]
python
train
twilio/twilio-python
twilio/rest/flex_api/v1/flex_flow.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/flex_api/v1/flex_flow.py#L537-L585
def update(self, friendly_name=values.unset, chat_service_sid=values.unset, channel_type=values.unset, contact_identity=values.unset, enabled=values.unset, integration_type=values.unset, integration_flow_sid=values.unset, integration_url=values.unset, integrat...
[ "def", "update", "(", "self", ",", "friendly_name", "=", "values", ".", "unset", ",", "chat_service_sid", "=", "values", ".", "unset", ",", "channel_type", "=", "values", ".", "unset", ",", "contact_identity", "=", "values", ".", "unset", ",", "enabled", "...
Update the FlexFlowInstance :param unicode friendly_name: Human readable description of this FlexFlow :param unicode chat_service_sid: Service Sid. :param FlexFlowInstance.ChannelType channel_type: Channel type :param unicode contact_identity: Channel contact Identity :param boo...
[ "Update", "the", "FlexFlowInstance" ]
python
train
prompt-toolkit/pyvim
pyvim/commands/commands.py
https://github.com/prompt-toolkit/pyvim/blob/5928b53b9d700863c1a06d2181a034a955f94594/pyvim/commands/commands.py#L76-L92
def cmd(name, accepts_force=False): """ Decarator that registers a command that doesn't take any parameters. """ def decorator(func): @_cmd(name) def command_wrapper(editor, variables): force = bool(variables['force']) if force and not accepts_force: ...
[ "def", "cmd", "(", "name", ",", "accepts_force", "=", "False", ")", ":", "def", "decorator", "(", "func", ")", ":", "@", "_cmd", "(", "name", ")", "def", "command_wrapper", "(", "editor", ",", "variables", ")", ":", "force", "=", "bool", "(", "variab...
Decarator that registers a command that doesn't take any parameters.
[ "Decarator", "that", "registers", "a", "command", "that", "doesn", "t", "take", "any", "parameters", "." ]
python
train
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1897-L1911
def com_google_fonts_check_metadata_valid_copyright(font_metadata): """Copyright notices match canonical pattern in METADATA.pb""" import re string = font_metadata.copyright does_match = re.search(r'Copyright [0-9]{4} The .* Project Authors \([^\@]*\)', string) if does_match: yi...
[ "def", "com_google_fonts_check_metadata_valid_copyright", "(", "font_metadata", ")", ":", "import", "re", "string", "=", "font_metadata", ".", "copyright", "does_match", "=", "re", ".", "search", "(", "r'Copyright [0-9]{4} The .* Project Authors \\([^\\@]*\\)'", ",", "strin...
Copyright notices match canonical pattern in METADATA.pb
[ "Copyright", "notices", "match", "canonical", "pattern", "in", "METADATA", ".", "pb" ]
python
train
SiLab-Bonn/pyBAR
pybar/daq/fifo_readout.py
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/daq/fifo_readout.py#L322-L352
def worker(self, fifo): '''Worker thread continuously filtering and converting data when data becomes available. ''' logging.debug('Starting worker thread for %s', fifo) self._fifo_conditions[fifo].acquire() while True: try: data_tuple = self._f...
[ "def", "worker", "(", "self", ",", "fifo", ")", ":", "logging", ".", "debug", "(", "'Starting worker thread for %s'", ",", "fifo", ")", "self", ".", "_fifo_conditions", "[", "fifo", "]", ".", "acquire", "(", ")", "while", "True", ":", "try", ":", "data_t...
Worker thread continuously filtering and converting data when data becomes available.
[ "Worker", "thread", "continuously", "filtering", "and", "converting", "data", "when", "data", "becomes", "available", "." ]
python
train
waqasbhatti/astrobase
astrobase/lcmath.py
https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/lcmath.py#L118-L235
def normalize_magseries(times, mags, mingap=4.0, normto='globalmedian', magsarefluxes=False, debugmode=False): '''This normalizes the magnitude time-series to a specified value. This is used ...
[ "def", "normalize_magseries", "(", "times", ",", "mags", ",", "mingap", "=", "4.0", ",", "normto", "=", "'globalmedian'", ",", "magsarefluxes", "=", "False", ",", "debugmode", "=", "False", ")", ":", "ngroups", ",", "timegroups", "=", "find_lc_timegroups", "...
This normalizes the magnitude time-series to a specified value. This is used to normalize time series measurements that may have large time gaps and vertical offsets in mag/flux measurement between these 'timegroups', either due to instrument changes or different filters. NOTE: this works in-place! Th...
[ "This", "normalizes", "the", "magnitude", "time", "-", "series", "to", "a", "specified", "value", "." ]
python
valid
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/parallel/controller/hub.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/controller/hub.py#L497-L530
def dispatch_query(self, msg): """Route registration requests and queries from clients.""" try: idents, msg = self.session.feed_identities(msg) except ValueError: idents = [] if not idents: self.log.error("Bad Query Message: %r", msg) retur...
[ "def", "dispatch_query", "(", "self", ",", "msg", ")", ":", "try", ":", "idents", ",", "msg", "=", "self", ".", "session", ".", "feed_identities", "(", "msg", ")", "except", "ValueError", ":", "idents", "=", "[", "]", "if", "not", "idents", ":", "sel...
Route registration requests and queries from clients.
[ "Route", "registration", "requests", "and", "queries", "from", "clients", "." ]
python
test
bioidiap/bob.ip.facedetect
bob/ip/facedetect/train/TrainingSet.py
https://github.com/bioidiap/bob.ip.facedetect/blob/601da5141ca7302ad36424d1421b33190ba46779/bob/ip/facedetect/train/TrainingSet.py#L146-L150
def _feature_file(self, parallel = None, index = None): """Returns the name of an intermediate file for storing features.""" if index is None: index = 0 if parallel is None or "SGE_TASK_ID" not in os.environ else int(os.environ["SGE_TASK_ID"]) return os.path.join(self.feature_directory, "Features_%02d...
[ "def", "_feature_file", "(", "self", ",", "parallel", "=", "None", ",", "index", "=", "None", ")", ":", "if", "index", "is", "None", ":", "index", "=", "0", "if", "parallel", "is", "None", "or", "\"SGE_TASK_ID\"", "not", "in", "os", ".", "environ", "...
Returns the name of an intermediate file for storing features.
[ "Returns", "the", "name", "of", "an", "intermediate", "file", "for", "storing", "features", "." ]
python
train
StellarCN/py-stellar-base
stellar_base/horizon.py
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/horizon.py#L414-L432
def transaction_operations(self, tx_hash, cursor=None, order='asc', include_failed=False, limit=10): """This endpoint represents all operations that are part of a given transaction. `GET /transactions/{hash}/operations{?cursor,limit,order} <https://www.stellar.org/developers/horizon/ref...
[ "def", "transaction_operations", "(", "self", ",", "tx_hash", ",", "cursor", "=", "None", ",", "order", "=", "'asc'", ",", "include_failed", "=", "False", ",", "limit", "=", "10", ")", ":", "endpoint", "=", "'/transactions/{tx_hash}/operations'", ".", "format"...
This endpoint represents all operations that are part of a given transaction. `GET /transactions/{hash}/operations{?cursor,limit,order} <https://www.stellar.org/developers/horizon/reference/endpoints/operations-for-transaction.html>`_ :param str tx_hash: The hex-encoded transaction has...
[ "This", "endpoint", "represents", "all", "operations", "that", "are", "part", "of", "a", "given", "transaction", "." ]
python
train
PolyJIT/benchbuild
benchbuild/utils/db.py
https://github.com/PolyJIT/benchbuild/blob/9ad2ec54d96e97b642b1f06eddcbad9ba7aeaf58/benchbuild/utils/db.py#L23-L55
def create_run(cmd, project, exp, grp): """ Create a new 'run' in the database. This creates a new transaction in the database and creates a new run in this transaction. Afterwards we return both the transaction as well as the run itself. The user is responsible for committing it when the time ...
[ "def", "create_run", "(", "cmd", ",", "project", ",", "exp", ",", "grp", ")", ":", "from", "benchbuild", ".", "utils", "import", "schema", "as", "s", "session", "=", "s", ".", "Session", "(", ")", "run", "=", "s", ".", "Run", "(", "command", "=", ...
Create a new 'run' in the database. This creates a new transaction in the database and creates a new run in this transaction. Afterwards we return both the transaction as well as the run itself. The user is responsible for committing it when the time comes. Args: cmd: The command that has ...
[ "Create", "a", "new", "run", "in", "the", "database", "." ]
python
train
timstaley/voeventdb
voeventdb/server/database/models.py
https://github.com/timstaley/voeventdb/blob/e37b176d65fced4ca4f059109a95d6974bb8a091/voeventdb/server/database/models.py#L122-L150
def from_etree(root, received=pytz.UTC.localize(datetime.utcnow())): """ Init a Voevent row from an LXML etree loaded with voevent-parse """ ivorn = root.attrib['ivorn'] # Stream- Everything except before the '#' separator, # with the prefix 'ivo://' removed: stre...
[ "def", "from_etree", "(", "root", ",", "received", "=", "pytz", ".", "UTC", ".", "localize", "(", "datetime", ".", "utcnow", "(", ")", ")", ")", ":", "ivorn", "=", "root", ".", "attrib", "[", "'ivorn'", "]", "# Stream- Everything except before the '#' separa...
Init a Voevent row from an LXML etree loaded with voevent-parse
[ "Init", "a", "Voevent", "row", "from", "an", "LXML", "etree", "loaded", "with", "voevent", "-", "parse" ]
python
train
deepmind/sonnet
sonnet/python/modules/gated_rnn.py
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/python/modules/gated_rnn.py#L1509-L1583
def _build(self, inputs, prev_state): """Connects the GRU module into the graph. If this is not the first time the module has been connected to the graph, the Tensors provided as inputs and state must have the same final dimension, in order for the existing variables to be the correct size for thei...
[ "def", "_build", "(", "self", ",", "inputs", ",", "prev_state", ")", ":", "input_size", "=", "inputs", ".", "get_shape", "(", ")", "[", "1", "]", "weight_shape", "=", "(", "input_size", ",", "self", ".", "_hidden_size", ")", "u_shape", "=", "(", "self"...
Connects the GRU module into the graph. If this is not the first time the module has been connected to the graph, the Tensors provided as inputs and state must have the same final dimension, in order for the existing variables to be the correct size for their corresponding multiplications. The batch si...
[ "Connects", "the", "GRU", "module", "into", "the", "graph", "." ]
python
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/javac.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/javac.py#L48-L129
def emit_java_classes(target, source, env): """Create and return lists of source java files and their corresponding target class files. """ java_suffix = env.get('JAVASUFFIX', '.java') class_suffix = env.get('JAVACLASSSUFFIX', '.class') target[0].must_be_same(SCons.Node.FS.Dir) classdir = t...
[ "def", "emit_java_classes", "(", "target", ",", "source", ",", "env", ")", ":", "java_suffix", "=", "env", ".", "get", "(", "'JAVASUFFIX'", ",", "'.java'", ")", "class_suffix", "=", "env", ".", "get", "(", "'JAVACLASSSUFFIX'", ",", "'.class'", ")", "target...
Create and return lists of source java files and their corresponding target class files.
[ "Create", "and", "return", "lists", "of", "source", "java", "files", "and", "their", "corresponding", "target", "class", "files", "." ]
python
train
kodexlab/reliure
reliure/pipeline.py
https://github.com/kodexlab/reliure/blob/0450c7a9254c5c003162738458bbe0c49e777ba5/reliure/pipeline.py#L246-L256
def get_option_default(self, opt_name): """ Return the default value of a given option :param opt_name: option name :type opt_name: str :returns: the default value of the option """ if not self.has_option(opt_name): raise ValueError("Unknow o...
[ "def", "get_option_default", "(", "self", ",", "opt_name", ")", ":", "if", "not", "self", ".", "has_option", "(", "opt_name", ")", ":", "raise", "ValueError", "(", "\"Unknow option name (%s)\"", "%", "opt_name", ")", "return", "self", ".", "_options", "[", "...
Return the default value of a given option :param opt_name: option name :type opt_name: str :returns: the default value of the option
[ "Return", "the", "default", "value", "of", "a", "given", "option", ":", "param", "opt_name", ":", "option", "name", ":", "type", "opt_name", ":", "str", ":", "returns", ":", "the", "default", "value", "of", "the", "option" ]
python
train
opencobra/memote
memote/suite/results/result.py
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/suite/results/result.py#L46-L52
def add_environment_information(meta): """Record environment information.""" meta["timestamp"] = datetime.utcnow().isoformat(" ") meta["platform"] = platform.system() meta["release"] = platform.release() meta["python"] = platform.python_version() meta["packages"] = get_pk...
[ "def", "add_environment_information", "(", "meta", ")", ":", "meta", "[", "\"timestamp\"", "]", "=", "datetime", ".", "utcnow", "(", ")", ".", "isoformat", "(", "\" \"", ")", "meta", "[", "\"platform\"", "]", "=", "platform", ".", "system", "(", ")", "me...
Record environment information.
[ "Record", "environment", "information", "." ]
python
train
tk0miya/tk.phpautodoc
src/phply/phpparse.py
https://github.com/tk0miya/tk.phpautodoc/blob/cf789f64abaf76351485cee231a075227e665fb6/src/phply/phpparse.py#L135-L147
def p_use_declaration(p): '''use_declaration : namespace_name | NS_SEPARATOR namespace_name | namespace_name AS STRING | NS_SEPARATOR namespace_name AS STRING''' if len(p) == 2: p[0] = ast.UseDeclaration(p[1], None, lineno=p.lineno(1))...
[ "def", "p_use_declaration", "(", "p", ")", ":", "if", "len", "(", "p", ")", "==", "2", ":", "p", "[", "0", "]", "=", "ast", ".", "UseDeclaration", "(", "p", "[", "1", "]", ",", "None", ",", "lineno", "=", "p", ".", "lineno", "(", "1", ")", ...
use_declaration : namespace_name | NS_SEPARATOR namespace_name | namespace_name AS STRING | NS_SEPARATOR namespace_name AS STRING
[ "use_declaration", ":", "namespace_name", "|", "NS_SEPARATOR", "namespace_name", "|", "namespace_name", "AS", "STRING", "|", "NS_SEPARATOR", "namespace_name", "AS", "STRING" ]
python
train
vtkiorg/vtki
vtki/plotting.py
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L1927-L1984
def add_text(self, text, position=None, font_size=50, color=None, font=None, shadow=False, name=None, loc=None): """ Adds text to plot object in the top left corner by default Parameters ---------- text : str The text to add the the rendering ...
[ "def", "add_text", "(", "self", ",", "text", ",", "position", "=", "None", ",", "font_size", "=", "50", ",", "color", "=", "None", ",", "font", "=", "None", ",", "shadow", "=", "False", ",", "name", "=", "None", ",", "loc", "=", "None", ")", ":",...
Adds text to plot object in the top left corner by default Parameters ---------- text : str The text to add the the rendering position : tuple(float) Length 2 tuple of the pixelwise position to place the bottom left corner of the text box. Default is...
[ "Adds", "text", "to", "plot", "object", "in", "the", "top", "left", "corner", "by", "default" ]
python
train
has2k1/plotnine
plotnine/data/__init__.py
https://github.com/has2k1/plotnine/blob/566e579af705367e584fb27a74e6c5199624ca89/plotnine/data/__init__.py#L34-L47
def _ordered_categories(df, categories): """ Make the columns in df categorical Parameters: ----------- categories: dict Of the form {str: list}, where the key the column name and the value is the ordered category list """ for col, cats in categories.items(): ...
[ "def", "_ordered_categories", "(", "df", ",", "categories", ")", ":", "for", "col", ",", "cats", "in", "categories", ".", "items", "(", ")", ":", "df", "[", "col", "]", "=", "df", "[", "col", "]", ".", "astype", "(", "CategoricalDtype", "(", "cats", ...
Make the columns in df categorical Parameters: ----------- categories: dict Of the form {str: list}, where the key the column name and the value is the ordered category list
[ "Make", "the", "columns", "in", "df", "categorical" ]
python
train
Fantomas42/django-blog-zinnia
zinnia/comparison.py
https://github.com/Fantomas42/django-blog-zinnia/blob/b4949304b104a8e1a7a7a0773cbfd024313c3a15/zinnia/comparison.py#L101-L109
def raw_clean(self, datas): """ Apply a cleaning on raw datas. """ datas = strip_tags(datas) # Remove HTML datas = STOP_WORDS.rebase(datas, '') # Remove STOP WORDS datas = PUNCTUATION.sub('', datas) # Remove punctuation datas = datas.lower() ...
[ "def", "raw_clean", "(", "self", ",", "datas", ")", ":", "datas", "=", "strip_tags", "(", "datas", ")", "# Remove HTML", "datas", "=", "STOP_WORDS", ".", "rebase", "(", "datas", ",", "''", ")", "# Remove STOP WORDS", "datas", "=", "PUNCTUATION", ".", "sub"...
Apply a cleaning on raw datas.
[ "Apply", "a", "cleaning", "on", "raw", "datas", "." ]
python
train
bcbio/bcbio-nextgen
bcbio/ngsalign/alignprep.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/alignprep.py#L294-L309
def _find_read_splits(in_file, split_size): """Determine sections of fastq files to process in splits. Assumes a 4 line order to input files (name, read, name, quality). grabix is 1-based inclusive, so return coordinates in that format. """ num_lines = total_reads_from_grabix(in_file) * 4 asser...
[ "def", "_find_read_splits", "(", "in_file", ",", "split_size", ")", ":", "num_lines", "=", "total_reads_from_grabix", "(", "in_file", ")", "*", "4", "assert", "num_lines", "and", "num_lines", ">", "0", ",", "\"Did not find grabix index reads: %s %s\"", "%", "(", "...
Determine sections of fastq files to process in splits. Assumes a 4 line order to input files (name, read, name, quality). grabix is 1-based inclusive, so return coordinates in that format.
[ "Determine", "sections", "of", "fastq", "files", "to", "process", "in", "splits", "." ]
python
train
baccuslab/shannon
shannon/bottleneck.py
https://github.com/baccuslab/shannon/blob/38abb4d9e53208ffd1c4149ef9fdf3abceccac48/shannon/bottleneck.py#L95-L110
def sample(self, *args): ''' generate a random number in [0,1) and return the index into self.prob such that self.prob[index] <= random_number but self.prob[index+1] > random_number implementation note: the problem is identical to finding the index into self.cumsum where the ran...
[ "def", "sample", "(", "self", ",", "*", "args", ")", ":", "return", "self", ".", "cumsum", ".", "searchsorted", "(", "np", ".", "random", ".", "rand", "(", "*", "args", ")", ")" ]
generate a random number in [0,1) and return the index into self.prob such that self.prob[index] <= random_number but self.prob[index+1] > random_number implementation note: the problem is identical to finding the index into self.cumsum where the random number should be inserted to keep the arr...
[ "generate", "a", "random", "number", "in", "[", "0", "1", ")", "and", "return", "the", "index", "into", "self", ".", "prob", "such", "that", "self", ".", "prob", "[", "index", "]", "<", "=", "random_number", "but", "self", ".", "prob", "[", "index", ...
python
train
asweigart/pyautogui
pyautogui/_pyautogui_win.py
https://github.com/asweigart/pyautogui/blob/77524bd47334a89024013fd48e05151c3ac9289a/pyautogui/_pyautogui_win.py#L451-L479
def _click(x, y, button): """Send the mouse click event to Windows by calling the mouse_event() win32 function. Args: button (str): The mouse button, either 'left', 'middle', or 'right' x (int): The x position of the mouse event. y (int): The y position of the mouse event. Returns: ...
[ "def", "_click", "(", "x", ",", "y", ",", "button", ")", ":", "if", "button", "==", "'left'", ":", "try", ":", "_sendMouseEvent", "(", "MOUSEEVENTF_LEFTCLICK", ",", "x", ",", "y", ")", "except", "(", "PermissionError", ",", "OSError", ")", ":", "# TODO...
Send the mouse click event to Windows by calling the mouse_event() win32 function. Args: button (str): The mouse button, either 'left', 'middle', or 'right' x (int): The x position of the mouse event. y (int): The y position of the mouse event. Returns: None
[ "Send", "the", "mouse", "click", "event", "to", "Windows", "by", "calling", "the", "mouse_event", "()", "win32", "function", "." ]
python
train
kwikteam/phy
phy/gui/widgets.py
https://github.com/kwikteam/phy/blob/7e9313dc364304b7d2bd03b92938347343703003/phy/gui/widgets.py#L272-L275
def column_names(self): """List of column names.""" return [name for (name, d) in self._columns.items() if d.get('show', True)]
[ "def", "column_names", "(", "self", ")", ":", "return", "[", "name", "for", "(", "name", ",", "d", ")", "in", "self", ".", "_columns", ".", "items", "(", ")", "if", "d", ".", "get", "(", "'show'", ",", "True", ")", "]" ]
List of column names.
[ "List", "of", "column", "names", "." ]
python
train
castelao/oceansdb
oceansdb/etopo.py
https://github.com/castelao/oceansdb/blob/a154c5b845845a602800f9bc53d1702d4cb0f9c5/oceansdb/etopo.py#L129-L187
def interpolate(self, lat, lon, var): """ Interpolate each var on the coordinates requested """ subset, dims = self.crop(lat, lon, var) if np.all([y in dims['lat'] for y in lat]) & \ np.all([x in dims['lon'] for x in lon]): yn = np.nonzero([y in lat...
[ "def", "interpolate", "(", "self", ",", "lat", ",", "lon", ",", "var", ")", ":", "subset", ",", "dims", "=", "self", ".", "crop", "(", "lat", ",", "lon", ",", "var", ")", "if", "np", ".", "all", "(", "[", "y", "in", "dims", "[", "'lat'", "]",...
Interpolate each var on the coordinates requested
[ "Interpolate", "each", "var", "on", "the", "coordinates", "requested" ]
python
train
bapakode/OmMongo
ommongo/query_expression.py
https://github.com/bapakode/OmMongo/blob/52b5a5420516dc709f2d2eb065818c7973991ce3/ommongo/query_expression.py#L121-L131
def get_absolute_name(self): """ Returns the full dotted name of this field """ res = [] current = self while type(current) != type(None): if current.__matched_index: res.append('$') res.append(current.get_type().db_field) current = cu...
[ "def", "get_absolute_name", "(", "self", ")", ":", "res", "=", "[", "]", "current", "=", "self", "while", "type", "(", "current", ")", "!=", "type", "(", "None", ")", ":", "if", "current", ".", "__matched_index", ":", "res", ".", "append", "(", "'$'"...
Returns the full dotted name of this field
[ "Returns", "the", "full", "dotted", "name", "of", "this", "field" ]
python
train
fossasia/AYABInterface
AYABInterface/communication/states.py
https://github.com/fossasia/AYABInterface/blob/e2065eed8daf17b2936f6ca5e488c9bfb850914e/AYABInterface/communication/states.py#L316-L330
def receive_information_confirmation(self, message): """A InformationConfirmation is received. If :meth:`the api version is supported <AYABInterface.communication.Communication.api_version_is_supported>`, the communication object transitions into a :class:`InitializingMachine`, ...
[ "def", "receive_information_confirmation", "(", "self", ",", "message", ")", ":", "if", "message", ".", "api_version_is_supported", "(", ")", ":", "self", ".", "_next", "(", "InitializingMachine", ")", "else", ":", "self", ".", "_next", "(", "UnsupportedApiVersi...
A InformationConfirmation is received. If :meth:`the api version is supported <AYABInterface.communication.Communication.api_version_is_supported>`, the communication object transitions into a :class:`InitializingMachine`, if unsupported, into a :class:`UnsupportedApiVersion`
[ "A", "InformationConfirmation", "is", "received", "." ]
python
train
saltstack/salt
salt/states/boto_apigateway.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_apigateway.py#L1097-L1128
def delete_stage(self, ret): ''' Method to delete the given stage_name. If the current deployment tied to the given stage_name has no other stages associated with it, the deployment will be removed as well ''' deploymentId = self._get_current_deployment_id() if d...
[ "def", "delete_stage", "(", "self", ",", "ret", ")", ":", "deploymentId", "=", "self", ".", "_get_current_deployment_id", "(", ")", "if", "deploymentId", ":", "result", "=", "__salt__", "[", "'boto_apigateway.delete_api_stage'", "]", "(", "restApiId", "=", "self...
Method to delete the given stage_name. If the current deployment tied to the given stage_name has no other stages associated with it, the deployment will be removed as well
[ "Method", "to", "delete", "the", "given", "stage_name", ".", "If", "the", "current", "deployment", "tied", "to", "the", "given", "stage_name", "has", "no", "other", "stages", "associated", "with", "it", "the", "deployment", "will", "be", "removed", "as", "we...
python
train
osrg/ryu
ryu/ofproto/ofproto_utils.py
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/ofproto/ofproto_utils.py#L109-L123
def _error_to_jsondict(mod, type_, code): """ This method is registered as ofp_error_to_jsondict(type_, code) method into ryu.ofproto.ofproto_v1_* modules. And this method returns ofp_error_msg as a json format for given 'type' and 'code' defined in ofp_error_msg structure. Example:: >...
[ "def", "_error_to_jsondict", "(", "mod", ",", "type_", ",", "code", ")", ":", "(", "t_name", ",", "c_name", ")", "=", "_get_error_names", "(", "mod", ",", "type_", ",", "code", ")", "return", "{", "'type'", ":", "'%s(%d)'", "%", "(", "t_name", ",", "...
This method is registered as ofp_error_to_jsondict(type_, code) method into ryu.ofproto.ofproto_v1_* modules. And this method returns ofp_error_msg as a json format for given 'type' and 'code' defined in ofp_error_msg structure. Example:: >>> ofproto.ofp_error_to_jsondict(4, 9) {'code'...
[ "This", "method", "is", "registered", "as", "ofp_error_to_jsondict", "(", "type_", "code", ")", "method", "into", "ryu", ".", "ofproto", ".", "ofproto_v1_", "*", "modules", ".", "And", "this", "method", "returns", "ofp_error_msg", "as", "a", "json", "format", ...
python
train
rstoneback/pysat
pysat/ssnl/occur_prob.py
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/ssnl/occur_prob.py#L168-L207
def daily3D(inst, bin1, label1, bin2, label2, bin3, label3, data_label, gate, returnBins=False): """3D Daily Occurrence Probability of data_label > gate over a season. If data_label is greater than gate atleast once per day, then a 100% occurrence probability results. Season delineated by...
[ "def", "daily3D", "(", "inst", ",", "bin1", ",", "label1", ",", "bin2", ",", "label2", ",", "bin3", ",", "label3", ",", "data_label", ",", "gate", ",", "returnBins", "=", "False", ")", ":", "return", "_occurrence3D", "(", "inst", ",", "bin1", ",", "l...
3D Daily Occurrence Probability of data_label > gate over a season. If data_label is greater than gate atleast once per day, then a 100% occurrence probability results. Season delineated by the bounds attached to Instrument object. Prob = (# of times with at least one hit)/(# of times in bin) ...
[ "3D", "Daily", "Occurrence", "Probability", "of", "data_label", ">", "gate", "over", "a", "season", ".", "If", "data_label", "is", "greater", "than", "gate", "atleast", "once", "per", "day", "then", "a", "100%", "occurrence", "probability", "results", ".", "...
python
train
inveniosoftware-attic/invenio-utils
invenio_utils/text.py
https://github.com/inveniosoftware-attic/invenio-utils/blob/9a1c6db4e3f1370901f329f510480dd8df188296/invenio_utils/text.py#L422-L432
def wash_for_utf8(text, correct=True): """Return UTF-8 encoded binary string with incorrect characters washed away. :param text: input string to wash (can be either a binary or Unicode string) :param correct: whether to correct bad characters or throw exception """ if isinstance(text, unicode): ...
[ "def", "wash_for_utf8", "(", "text", ",", "correct", "=", "True", ")", ":", "if", "isinstance", "(", "text", ",", "unicode", ")", ":", "return", "text", ".", "encode", "(", "'utf-8'", ")", "errors", "=", "\"ignore\"", "if", "correct", "else", "\"strict\"...
Return UTF-8 encoded binary string with incorrect characters washed away. :param text: input string to wash (can be either a binary or Unicode string) :param correct: whether to correct bad characters or throw exception
[ "Return", "UTF", "-", "8", "encoded", "binary", "string", "with", "incorrect", "characters", "washed", "away", "." ]
python
train
coldfix/udiskie
udiskie/mount.py
https://github.com/coldfix/udiskie/blob/804c9d27df6f7361fec3097c432398f2d702f911/udiskie/mount.py#L320-L354
async def add(self, device, recursive=None): """ Mount or unlock the device depending on its type. :param device: device object, block device path or mount path :param bool recursive: recursively mount and unlock child devices :returns: whether all attempted operations succeeded...
[ "async", "def", "add", "(", "self", ",", "device", ",", "recursive", "=", "None", ")", ":", "device", ",", "created", "=", "await", "self", ".", "_find_device_losetup", "(", "device", ")", "if", "created", "and", "recursive", "is", "False", ":", "return"...
Mount or unlock the device depending on its type. :param device: device object, block device path or mount path :param bool recursive: recursively mount and unlock child devices :returns: whether all attempted operations succeeded
[ "Mount", "or", "unlock", "the", "device", "depending", "on", "its", "type", "." ]
python
train
witchard/grole
grole.py
https://github.com/witchard/grole/blob/54c0bd13e4d4c74a2997ec4254527d937d6e0565/grole.py#L433-L446
def main(args=sys.argv[1:]): """ Run Grole static file server """ args = parse_args(args) if args.verbose: logging.basicConfig(level=logging.DEBUG) elif args.quiet: logging.basicConfig(level=logging.ERROR) else: logging.basicConfig(level=logging.INFO) app = Grole(...
[ "def", "main", "(", "args", "=", "sys", ".", "argv", "[", "1", ":", "]", ")", ":", "args", "=", "parse_args", "(", "args", ")", "if", "args", ".", "verbose", ":", "logging", ".", "basicConfig", "(", "level", "=", "logging", ".", "DEBUG", ")", "el...
Run Grole static file server
[ "Run", "Grole", "static", "file", "server" ]
python
train
feliperyan/EinsteinVisionPython
EinsteinVision/EinsteinVision.py
https://github.com/feliperyan/EinsteinVisionPython/blob/c761c46c7dc5fe8bbe7b15a6e1166a3585ed3cfb/EinsteinVision/EinsteinVision.py#L155-L172
def get_b64_image_prediction(self, model_id, b64_encoded_string, token=None, url=API_GET_PREDICTION_IMAGE_URL): """ Gets a prediction from a supplied image enconded as a b64 string, useful when uploading images to a server backed by this library. :param model_id: string, once you train a...
[ "def", "get_b64_image_prediction", "(", "self", ",", "model_id", ",", "b64_encoded_string", ",", "token", "=", "None", ",", "url", "=", "API_GET_PREDICTION_IMAGE_URL", ")", ":", "auth", "=", "'Bearer '", "+", "self", ".", "check_for_token", "(", "token", ")", ...
Gets a prediction from a supplied image enconded as a b64 string, useful when uploading images to a server backed by this library. :param model_id: string, once you train a model you'll be given a model id to use. :param b64_encoded_string: string, a b64 enconded string representatio...
[ "Gets", "a", "prediction", "from", "a", "supplied", "image", "enconded", "as", "a", "b64", "string", "useful", "when", "uploading", "images", "to", "a", "server", "backed", "by", "this", "library", ".", ":", "param", "model_id", ":", "string", "once", "you...
python
train
vatlab/SoS
src/sos/actions.py
https://github.com/vatlab/SoS/blob/6b60ed0770916d135e17322e469520d778e9d4e7/src/sos/actions.py#L682-L687
def stop_if(expr, msg='', no_output=False): '''Abort the execution of the current step or loop and yield an warning message `msg` if `expr` is False ''' if expr: raise StopInputGroup(msg=msg, keep_output=not no_output) return 0
[ "def", "stop_if", "(", "expr", ",", "msg", "=", "''", ",", "no_output", "=", "False", ")", ":", "if", "expr", ":", "raise", "StopInputGroup", "(", "msg", "=", "msg", ",", "keep_output", "=", "not", "no_output", ")", "return", "0" ]
Abort the execution of the current step or loop and yield an warning message `msg` if `expr` is False
[ "Abort", "the", "execution", "of", "the", "current", "step", "or", "loop", "and", "yield", "an", "warning", "message", "msg", "if", "expr", "is", "False" ]
python
train
timothydmorton/VESPA
vespa/stars/populations.py
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L1956-L2036
def generate(self, mA=1, age=9.6, feh=0.0, n=1e5, ichrone='mist', orbpop=None, bands=None, **kwargs): """ Generates population. Called if :class:`MultipleStarPopulation` is initialized without providing ``stars``, and if ``mA`` is provided. """ ichrone ...
[ "def", "generate", "(", "self", ",", "mA", "=", "1", ",", "age", "=", "9.6", ",", "feh", "=", "0.0", ",", "n", "=", "1e5", ",", "ichrone", "=", "'mist'", ",", "orbpop", "=", "None", ",", "bands", "=", "None", ",", "*", "*", "kwargs", ")", ":"...
Generates population. Called if :class:`MultipleStarPopulation` is initialized without providing ``stars``, and if ``mA`` is provided.
[ "Generates", "population", "." ]
python
train
spacetelescope/pysynphot
pysynphot/reddening.py
https://github.com/spacetelescope/pysynphot/blob/a125ff956f4d94beb157bd51899747a13234bb97/pysynphot/reddening.py#L158-L202
def print_red_laws(): """Print available extinction laws to screen. Available extinction laws are extracted from ``pysynphot.locations.EXTDIR``. The printed names may be used with :func:`Extinction` to retrieve available reddening laws. Examples -------- >>> S.reddening.print_red_laws() ...
[ "def", "print_red_laws", "(", ")", ":", "laws", "=", "{", "}", "# start by converting the Cache.RedLaws file names to RedLaw objects", "# if they aren't already", "for", "k", "in", "Cache", ".", "RedLaws", ":", "if", "isinstance", "(", "Cache", ".", "RedLaws", "[", ...
Print available extinction laws to screen. Available extinction laws are extracted from ``pysynphot.locations.EXTDIR``. The printed names may be used with :func:`Extinction` to retrieve available reddening laws. Examples -------- >>> S.reddening.print_red_laws() name reference --...
[ "Print", "available", "extinction", "laws", "to", "screen", "." ]
python
train
Becksteinlab/GromacsWrapper
gromacs/cbook.py
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L1707-L1716
def outfile(self, p): """Path for an output file. If :attr:`outdir` is set then the path is ``outdir/basename(p)`` else just ``p`` """ if self.outdir is not None: return os.path.join(self.outdir, os.path.basename(p)) else: return p
[ "def", "outfile", "(", "self", ",", "p", ")", ":", "if", "self", ".", "outdir", "is", "not", "None", ":", "return", "os", ".", "path", ".", "join", "(", "self", ".", "outdir", ",", "os", ".", "path", ".", "basename", "(", "p", ")", ")", "else",...
Path for an output file. If :attr:`outdir` is set then the path is ``outdir/basename(p)`` else just ``p``
[ "Path", "for", "an", "output", "file", "." ]
python
valid
ToucanToco/toucan-data-sdk
toucan_data_sdk/utils/postprocess/text.py
https://github.com/ToucanToco/toucan-data-sdk/blob/c3ca874e1b64f4bdcc2edda750a72d45d1561d8a/toucan_data_sdk/utils/postprocess/text.py#L544-L575
def replace_pattern( df, column: str, *, pat: str, repl: str, new_column: str = None, case: bool = True, regex: bool = True ): """ Replace occurrences of pattern/regex in `column` with some other string See [pandas doc]( https://pandas.pyda...
[ "def", "replace_pattern", "(", "df", ",", "column", ":", "str", ",", "*", ",", "pat", ":", "str", ",", "repl", ":", "str", ",", "new_column", ":", "str", "=", "None", ",", "case", ":", "bool", "=", "True", ",", "regex", ":", "bool", "=", "True", ...
Replace occurrences of pattern/regex in `column` with some other string See [pandas doc]( https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.str.replace.html) for more information --- ### Parameters *mandatory :* - `column` (*str*): the column - `pat` (*str*): charac...
[ "Replace", "occurrences", "of", "pattern", "/", "regex", "in", "column", "with", "some", "other", "string", "See", "[", "pandas", "doc", "]", "(", "https", ":", "//", "pandas", ".", "pydata", ".", "org", "/", "pandas", "-", "docs", "/", "stable", "/", ...
python
test
tensorpack/tensorpack
examples/DoReFa-Net/dorefa.py
https://github.com/tensorpack/tensorpack/blob/d7a13cb74c9066bc791d7aafc3b744b60ee79a9f/examples/DoReFa-Net/dorefa.py#L67-L99
def ternarize(x, thresh=0.05): """ Implemented Trained Ternary Quantization: https://arxiv.org/abs/1612.01064 Code modified from the authors' at: https://github.com/czhu95/ternarynet/blob/master/examples/Ternary-Net/ternary.py """ shape = x.get_shape() thre_x = tf.stop_gradient(tf.redu...
[ "def", "ternarize", "(", "x", ",", "thresh", "=", "0.05", ")", ":", "shape", "=", "x", ".", "get_shape", "(", ")", "thre_x", "=", "tf", ".", "stop_gradient", "(", "tf", ".", "reduce_max", "(", "tf", ".", "abs", "(", "x", ")", ")", "*", "thresh", ...
Implemented Trained Ternary Quantization: https://arxiv.org/abs/1612.01064 Code modified from the authors' at: https://github.com/czhu95/ternarynet/blob/master/examples/Ternary-Net/ternary.py
[ "Implemented", "Trained", "Ternary", "Quantization", ":", "https", ":", "//", "arxiv", ".", "org", "/", "abs", "/", "1612", ".", "01064" ]
python
train
cmap/cmapPy
cmapPy/pandasGEXpress/write_gct.py
https://github.com/cmap/cmapPy/blob/59d833b64fd2c3a494cdf67fe1eb11fc8008bf76/cmapPy/pandasGEXpress/write_gct.py#L54-L65
def write_version_and_dims(version, dims, f): """Write first two lines of gct file. Args: version (string): 1.3 by default dims (list of strings): length = 4 f (file handle): handle of output file Returns: nothing """ f.write(("#" + version + "\n")) f.write((dims...
[ "def", "write_version_and_dims", "(", "version", ",", "dims", ",", "f", ")", ":", "f", ".", "write", "(", "(", "\"#\"", "+", "version", "+", "\"\\n\"", ")", ")", "f", ".", "write", "(", "(", "dims", "[", "0", "]", "+", "\"\\t\"", "+", "dims", "["...
Write first two lines of gct file. Args: version (string): 1.3 by default dims (list of strings): length = 4 f (file handle): handle of output file Returns: nothing
[ "Write", "first", "two", "lines", "of", "gct", "file", "." ]
python
train
ic-labs/django-icekit
icekit/utils/search/facets.py
https://github.com/ic-labs/django-icekit/blob/c507ea5b1864303732c53ad7c5800571fca5fa94/icekit/utils/search/facets.py#L131-L139
def is_default(self): """Return True if no active values, or if the active value is the default""" if not self.get_applicable_values(): return True if self.get_value().is_default: return True return False
[ "def", "is_default", "(", "self", ")", ":", "if", "not", "self", ".", "get_applicable_values", "(", ")", ":", "return", "True", "if", "self", ".", "get_value", "(", ")", ".", "is_default", ":", "return", "True", "return", "False" ]
Return True if no active values, or if the active value is the default
[ "Return", "True", "if", "no", "active", "values", "or", "if", "the", "active", "value", "is", "the", "default" ]
python
train
mitsei/dlkit
dlkit/handcar/relationship/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/relationship/sessions.py#L199-L232
def get_relationships_by_ids(self, relationship_ids=None): """Gets a ``RelationshipList`` corresponding to the given ``IdList``. arg: relationship_ids (osid.id.IdList): the list of ``Ids`` to retrieve return: (osid.relationship.RelationshipList) - the returned ...
[ "def", "get_relationships_by_ids", "(", "self", ",", "relationship_ids", "=", "None", ")", ":", "if", "relationship_ids", "is", "None", ":", "raise", "NullArgument", "(", ")", "relationships", "=", "[", "]", "for", "i", "in", "relationship_ids", ":", "relation...
Gets a ``RelationshipList`` corresponding to the given ``IdList``. arg: relationship_ids (osid.id.IdList): the list of ``Ids`` to retrieve return: (osid.relationship.RelationshipList) - the returned ``Relationship list`` raise: NotFound - an ``Id`` was not fo...
[ "Gets", "a", "RelationshipList", "corresponding", "to", "the", "given", "IdList", "." ]
python
train
pmneila/morphsnakes
morphsnakes_v1.py
https://github.com/pmneila/morphsnakes/blob/aab66e70f86308d7b1927d76869a1a562120f849/morphsnakes_v1.py#L94-L111
def operator_is(u): """operator_is operator.""" global _aux if np.ndim(u) == 2: P = _P2 elif np.ndim(u) == 3: P = _P3 else: raise ValueError("u has an invalid number of dimensions " "(should be 2 or 3)") if u.shape != _aux.shape[1:]: ...
[ "def", "operator_is", "(", "u", ")", ":", "global", "_aux", "if", "np", ".", "ndim", "(", "u", ")", "==", "2", ":", "P", "=", "_P2", "elif", "np", ".", "ndim", "(", "u", ")", "==", "3", ":", "P", "=", "_P3", "else", ":", "raise", "ValueError"...
operator_is operator.
[ "operator_is", "operator", "." ]
python
train
not-na/peng3d
peng3d/window.py
https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/window.py#L255-L277
def dispatch_event(self,event_type,*args): """ Internal event handling method. This method extends the behavior inherited from :py:meth:`pyglet.window.Window.dispatch_event()` by calling the various :py:meth:`handleEvent()` methods. By default, :py:meth:`Peng.handleEven...
[ "def", "dispatch_event", "(", "self", ",", "event_type", ",", "*", "args", ")", ":", "super", "(", "PengWindow", ",", "self", ")", ".", "dispatch_event", "(", "event_type", ",", "*", "args", ")", "try", ":", "p", "=", "self", ".", "peng", "m", "=", ...
Internal event handling method. This method extends the behavior inherited from :py:meth:`pyglet.window.Window.dispatch_event()` by calling the various :py:meth:`handleEvent()` methods. By default, :py:meth:`Peng.handleEvent()`\ , :py:meth:`handleEvent()` and :py:meth:`Menu.handleEvent...
[ "Internal", "event", "handling", "method", ".", "This", "method", "extends", "the", "behavior", "inherited", "from", ":", "py", ":", "meth", ":", "pyglet", ".", "window", ".", "Window", ".", "dispatch_event", "()", "by", "calling", "the", "various", ":", "...
python
test
zblz/naima
naima/utils.py
https://github.com/zblz/naima/blob/d6a6781d73bf58fd8269e8b0e3b70be22723cd5b/naima/utils.py#L382-L408
def generate_energy_edges(ene, groups=None): """Generate energy bin edges from given energy array. Generate an array of energy edges from given energy array to be used as abcissa error bar limits when no energy uncertainty or energy band is provided. Parameters ---------- ene : `astropy.un...
[ "def", "generate_energy_edges", "(", "ene", ",", "groups", "=", "None", ")", ":", "if", "groups", "is", "None", "or", "len", "(", "ene", ")", "!=", "len", "(", "groups", ")", ":", "return", "_generate_energy_edges_single", "(", "ene", ")", "else", ":", ...
Generate energy bin edges from given energy array. Generate an array of energy edges from given energy array to be used as abcissa error bar limits when no energy uncertainty or energy band is provided. Parameters ---------- ene : `astropy.units.Quantity` array instance 1-D array of en...
[ "Generate", "energy", "bin", "edges", "from", "given", "energy", "array", "." ]
python
train
singularityhub/sregistry-cli
sregistry/utils/fileio.py
https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/utils/fileio.py#L74-L98
def get_tmpdir(requested_tmpdir=None, prefix="", create=True): '''get a temporary directory for an operation. If SREGISTRY_TMPDIR is set, return that. Otherwise, return the output of tempfile.mkdtemp Parameters ========== requested_tmpdir: an optional requested temporary directory, firs...
[ "def", "get_tmpdir", "(", "requested_tmpdir", "=", "None", ",", "prefix", "=", "\"\"", ",", "create", "=", "True", ")", ":", "from", "sregistry", ".", "defaults", "import", "SREGISTRY_TMPDIR", "# First priority for the base goes to the user requested.", "tmpdir", "=",...
get a temporary directory for an operation. If SREGISTRY_TMPDIR is set, return that. Otherwise, return the output of tempfile.mkdtemp Parameters ========== requested_tmpdir: an optional requested temporary directory, first priority as is coming from calling function. prefix: G...
[ "get", "a", "temporary", "directory", "for", "an", "operation", ".", "If", "SREGISTRY_TMPDIR", "is", "set", "return", "that", ".", "Otherwise", "return", "the", "output", "of", "tempfile", ".", "mkdtemp" ]
python
test
fusepy/fusepy
fusell.py
https://github.com/fusepy/fusepy/blob/5d997d6706cc0204e1b3ca679651485a7e7dda49/fusell.py#L720-L727
def setattr(self, req, ino, attr, to_set, fi): """Set file attributes Valid replies: reply_attr reply_err """ self.reply_err(req, errno.EROFS)
[ "def", "setattr", "(", "self", ",", "req", ",", "ino", ",", "attr", ",", "to_set", ",", "fi", ")", ":", "self", ".", "reply_err", "(", "req", ",", "errno", ".", "EROFS", ")" ]
Set file attributes Valid replies: reply_attr reply_err
[ "Set", "file", "attributes" ]
python
train
cltrudeau/screwdriver
screwdriver.py
https://github.com/cltrudeau/screwdriver/blob/6b70b545c5df1e6ac5a78367e47d63e3be1b57ba/screwdriver.py#L12-L21
def dynamic_load(name): """Equivalent of "from X import Y" statement using dot notation to specify what to import and return. For example, foo.bar.thing returns the item "thing" in the module "foo.bar" """ pieces = name.split('.') item = pieces[-1] mod_name = '.'.join(pieces[:-1]) mod = __...
[ "def", "dynamic_load", "(", "name", ")", ":", "pieces", "=", "name", ".", "split", "(", "'.'", ")", "item", "=", "pieces", "[", "-", "1", "]", "mod_name", "=", "'.'", ".", "join", "(", "pieces", "[", ":", "-", "1", "]", ")", "mod", "=", "__impo...
Equivalent of "from X import Y" statement using dot notation to specify what to import and return. For example, foo.bar.thing returns the item "thing" in the module "foo.bar"
[ "Equivalent", "of", "from", "X", "import", "Y", "statement", "using", "dot", "notation", "to", "specify", "what", "to", "import", "and", "return", ".", "For", "example", "foo", ".", "bar", ".", "thing", "returns", "the", "item", "thing", "in", "the", "mo...
python
train
SmokinCaterpillar/pypet
pypet/parameter.py
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/parameter.py#L2191-L2227
def f_set_single(self, name, item): """Sets a single data item of the result. Raises TypeError if the type of the outer data structure is not understood. Note that the type check is shallow. For example, if the data item is a list, the individual list elements are NOT checked whether th...
[ "def", "f_set_single", "(", "self", ",", "name", ",", "item", ")", ":", "if", "self", ".", "v_stored", ":", "self", ".", "_logger", ".", "debug", "(", "'You are changing an already stored result. If '", "'you not explicitly overwrite the data on disk, this change '", "'...
Sets a single data item of the result. Raises TypeError if the type of the outer data structure is not understood. Note that the type check is shallow. For example, if the data item is a list, the individual list elements are NOT checked whether their types are appropriate. :param name...
[ "Sets", "a", "single", "data", "item", "of", "the", "result", "." ]
python
test
UCSBarchlab/PyRTL
pyrtl/rtllib/adders.py
https://github.com/UCSBarchlab/PyRTL/blob/0988e5c9c10ededd5e1f58d5306603f9edf4b3e2/pyrtl/rtllib/adders.py#L140-L182
def wallace_reducer(wire_array_2, result_bitwidth, final_adder=kogge_stone): """ The reduction and final adding part of a dada tree. Useful for adding many numbers together The use of single bitwidth wires is to allow for additional flexibility :param [[Wirevector]] wire_array_2: An array of arrays of ...
[ "def", "wallace_reducer", "(", "wire_array_2", ",", "result_bitwidth", ",", "final_adder", "=", "kogge_stone", ")", ":", "# verification that the wires are actually wirevectors of length 1", "for", "wire_set", "in", "wire_array_2", ":", "for", "a_wire", "in", "wire_set", ...
The reduction and final adding part of a dada tree. Useful for adding many numbers together The use of single bitwidth wires is to allow for additional flexibility :param [[Wirevector]] wire_array_2: An array of arrays of single bitwidth wirevectors :param int result_bitwidth: The bitwidth you want...
[ "The", "reduction", "and", "final", "adding", "part", "of", "a", "dada", "tree", ".", "Useful", "for", "adding", "many", "numbers", "together", "The", "use", "of", "single", "bitwidth", "wires", "is", "to", "allow", "for", "additional", "flexibility" ]
python
train
wandb/client
wandb/vendor/prompt_toolkit/interface.py
https://github.com/wandb/client/blob/7d08954ed5674fee223cd85ed0d8518fe47266b2/wandb/vendor/prompt_toolkit/interface.py#L390-L432
def run(self, reset_current_buffer=False, pre_run=None): """ Read input from the command line. This runs the eventloop until a return value has been set. :param reset_current_buffer: XXX: Not used anymore. :param pre_run: Callable that is called right after the reset has taken ...
[ "def", "run", "(", "self", ",", "reset_current_buffer", "=", "False", ",", "pre_run", "=", "None", ")", ":", "assert", "pre_run", "is", "None", "or", "callable", "(", "pre_run", ")", "try", ":", "self", ".", "_is_running", "=", "True", "self", ".", "on...
Read input from the command line. This runs the eventloop until a return value has been set. :param reset_current_buffer: XXX: Not used anymore. :param pre_run: Callable that is called right after the reset has taken place. This allows custom initialisation.
[ "Read", "input", "from", "the", "command", "line", ".", "This", "runs", "the", "eventloop", "until", "a", "return", "value", "has", "been", "set", "." ]
python
train
wmayner/pyphi
pyphi/models/mechanism.py
https://github.com/wmayner/pyphi/blob/deeca69a084d782a6fde7bf26f59e93b593c5d77/pyphi/models/mechanism.py#L443-L449
def emd_eq(self, other): """Return whether this concept is equal to another in the context of an EMD calculation. """ return (self.phi == other.phi and self.mechanism == other.mechanism and self.eq_repertoires(other))
[ "def", "emd_eq", "(", "self", ",", "other", ")", ":", "return", "(", "self", ".", "phi", "==", "other", ".", "phi", "and", "self", ".", "mechanism", "==", "other", ".", "mechanism", "and", "self", ".", "eq_repertoires", "(", "other", ")", ")" ]
Return whether this concept is equal to another in the context of an EMD calculation.
[ "Return", "whether", "this", "concept", "is", "equal", "to", "another", "in", "the", "context", "of", "an", "EMD", "calculation", "." ]
python
train
spotify/luigi
luigi/contrib/hdfs/config.py
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hdfs/config.py#L102-L144
def tmppath(path=None, include_unix_username=True): """ @param path: target path for which it is needed to generate temporary location @type path: str @type include_unix_username: bool @rtype: str Note that include_unix_username might work on windows too. """ addon = "luigitemp-%08d" % ...
[ "def", "tmppath", "(", "path", "=", "None", ",", "include_unix_username", "=", "True", ")", ":", "addon", "=", "\"luigitemp-%08d\"", "%", "random", ".", "randrange", "(", "1e9", ")", "temp_dir", "=", "'/tmp'", "# default tmp dir if none is specified in config", "#...
@param path: target path for which it is needed to generate temporary location @type path: str @type include_unix_username: bool @rtype: str Note that include_unix_username might work on windows too.
[ "@param", "path", ":", "target", "path", "for", "which", "it", "is", "needed", "to", "generate", "temporary", "location", "@type", "path", ":", "str", "@type", "include_unix_username", ":", "bool", "@rtype", ":", "str" ]
python
train
phoebe-project/phoebe2
phoebe/frontend/bundle.py
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L3011-L3025
def rename_compute(self, old_compute, new_compute): """ Change the label of a compute attached to the Bundle :parameter str old_compute: the current name of the compute options (must exist) :parameter str new_compute: the desired new name of the compute options (...
[ "def", "rename_compute", "(", "self", ",", "old_compute", ",", "new_compute", ")", ":", "# TODO: raise error if old_compute not found?", "self", ".", "_check_label", "(", "new_compute", ")", "self", ".", "_rename_label", "(", "'compute'", ",", "old_compute", ",", "n...
Change the label of a compute attached to the Bundle :parameter str old_compute: the current name of the compute options (must exist) :parameter str new_compute: the desired new name of the compute options (must not exist) :return: None :raises ValueError: if the...
[ "Change", "the", "label", "of", "a", "compute", "attached", "to", "the", "Bundle" ]
python
train
zebpalmer/WeatherAlerts
weatheralerts/geo.py
https://github.com/zebpalmer/WeatherAlerts/blob/b99513571571fa0d65b90be883bb3bc000994027/weatheralerts/geo.py#L37-L43
def lookup_samecode(self, local, state): """Given County, State return the SAME code for specified location. Return False if not found""" for location in self.samecodes: if state.lower() == self.samecodes[location]['state'].lower(): if local.lower() == self.samecodes[location...
[ "def", "lookup_samecode", "(", "self", ",", "local", ",", "state", ")", ":", "for", "location", "in", "self", ".", "samecodes", ":", "if", "state", ".", "lower", "(", ")", "==", "self", ".", "samecodes", "[", "location", "]", "[", "'state'", "]", "."...
Given County, State return the SAME code for specified location. Return False if not found
[ "Given", "County", "State", "return", "the", "SAME", "code", "for", "specified", "location", ".", "Return", "False", "if", "not", "found" ]
python
train
hhatto/autopep8
autopep8.py
https://github.com/hhatto/autopep8/blob/fda3bb39181437b6b8a0aa0185f21ae5f14385dd/autopep8.py#L4219-L4227
def generate_tokens(self, text): """A stand-in for tokenize.generate_tokens().""" if text != self.last_text: string_io = io.StringIO(text) self.last_tokens = list( tokenize.generate_tokens(string_io.readline) ) self.last_text = text ...
[ "def", "generate_tokens", "(", "self", ",", "text", ")", ":", "if", "text", "!=", "self", ".", "last_text", ":", "string_io", "=", "io", ".", "StringIO", "(", "text", ")", "self", ".", "last_tokens", "=", "list", "(", "tokenize", ".", "generate_tokens", ...
A stand-in for tokenize.generate_tokens().
[ "A", "stand", "-", "in", "for", "tokenize", ".", "generate_tokens", "()", "." ]
python
train
funkybob/knights-templater
knights/tags.py
https://github.com/funkybob/knights-templater/blob/b15cdbaae7d824d02f7f03ca04599ae94bb759dd/knights/tags.py#L74-L93
def _create_with_scope(body, kwargs): ''' Helper function to wrap a block in a scope stack: with ContextScope(context, **kwargs) as context: ... body ... ''' return ast.With( items=[ ast.withitem( context_expr=_a.Call( _a.Name('Context...
[ "def", "_create_with_scope", "(", "body", ",", "kwargs", ")", ":", "return", "ast", ".", "With", "(", "items", "=", "[", "ast", ".", "withitem", "(", "context_expr", "=", "_a", ".", "Call", "(", "_a", ".", "Name", "(", "'ContextScope'", ")", ",", "["...
Helper function to wrap a block in a scope stack: with ContextScope(context, **kwargs) as context: ... body ...
[ "Helper", "function", "to", "wrap", "a", "block", "in", "a", "scope", "stack", ":" ]
python
train
aiidateam/aiida-ase
aiida_ase/calculations/ase.py
https://github.com/aiidateam/aiida-ase/blob/688a01fa872717ee3babdb1f10405b306371cf44/aiida_ase/calculations/ase.py#L453-L474
def convert_the_args(raw_args): """ Function used to convert the arguments of methods """ if not raw_args: return "" if isinstance(raw_args,dict): out_args = ", ".join([ "{}={}".format(k,v) for k,v in raw_args.iteritems() ]) elif isinstance(raw_args,(list,tuple)): ...
[ "def", "convert_the_args", "(", "raw_args", ")", ":", "if", "not", "raw_args", ":", "return", "\"\"", "if", "isinstance", "(", "raw_args", ",", "dict", ")", ":", "out_args", "=", "\", \"", ".", "join", "(", "[", "\"{}={}\"", ".", "format", "(", "k", ",...
Function used to convert the arguments of methods
[ "Function", "used", "to", "convert", "the", "arguments", "of", "methods" ]
python
train
RedHatInsights/insights-core
insights/core/dr.py
https://github.com/RedHatInsights/insights-core/blob/b57cbf8ed7c089672426ede0441e0a4f789ef4a1/insights/core/dr.py#L844-L859
def get_missing_requirements(func, requires, d): """ .. deprecated:: 1.x """ if not requires: return None if any(i in d for i in IGNORE.get(func, [])): raise SkipComponent() req_all, req_any = split_requirements(requires) d = set(d.keys()) req_all = [r for r in req_all if...
[ "def", "get_missing_requirements", "(", "func", ",", "requires", ",", "d", ")", ":", "if", "not", "requires", ":", "return", "None", "if", "any", "(", "i", "in", "d", "for", "i", "in", "IGNORE", ".", "get", "(", "func", ",", "[", "]", ")", ")", "...
.. deprecated:: 1.x
[ "..", "deprecated", "::", "1", ".", "x" ]
python
train
log2timeline/dfvfs
dfvfs/vfs/tsk_file_entry.py
https://github.com/log2timeline/dfvfs/blob/2b3ccd115f9901d89f383397d4a1376a873c83c4/dfvfs/vfs/tsk_file_entry.py#L784-L811
def GetFileObject(self, data_stream_name=''): """Retrieves the file-like object. Args: data_stream_name (Optional[str]): data stream name, where an empty string represents the default data stream. Returns: TSKFileIO: file-like object or None. """ data_stream_names = [ ...
[ "def", "GetFileObject", "(", "self", ",", "data_stream_name", "=", "''", ")", ":", "data_stream_names", "=", "[", "data_stream", ".", "name", "for", "data_stream", "in", "self", ".", "_GetDataStreams", "(", ")", "]", "if", "data_stream_name", "and", "data_stre...
Retrieves the file-like object. Args: data_stream_name (Optional[str]): data stream name, where an empty string represents the default data stream. Returns: TSKFileIO: file-like object or None.
[ "Retrieves", "the", "file", "-", "like", "object", "." ]
python
train
AirSage/Petrel
petrel/petrel/mock.py
https://github.com/AirSage/Petrel/blob/c4be9b7da5916dcc028ddb88850e7703203eeb79/petrel/petrel/mock.py#L108-L164
def run_simple_topology(cls, config, emitters, result_type=NAMEDTUPLE, max_spout_emits=None): """Tests a simple topology. "Simple" means there it has no branches or cycles. "emitters" is a list of emitters, starting with a spout followed by 0 or more bolts that run in a chain.""" ...
[ "def", "run_simple_topology", "(", "cls", ",", "config", ",", "emitters", ",", "result_type", "=", "NAMEDTUPLE", ",", "max_spout_emits", "=", "None", ")", ":", "# The config is almost always required. The only known reason to pass", "# None is when calling run_simple_topology()...
Tests a simple topology. "Simple" means there it has no branches or cycles. "emitters" is a list of emitters, starting with a spout followed by 0 or more bolts that run in a chain.
[ "Tests", "a", "simple", "topology", ".", "Simple", "means", "there", "it", "has", "no", "branches", "or", "cycles", ".", "emitters", "is", "a", "list", "of", "emitters", "starting", "with", "a", "spout", "followed", "by", "0", "or", "more", "bolts", "tha...
python
train
PlatformStories/geojsontools
geojsontools/geojsontools.py
https://github.com/PlatformStories/geojsontools/blob/80bf5cdde017a14338ee3962d1b59523ef2efdf1/geojsontools/geojsontools.py#L62-L83
def get_from(input_file, property_names): ''' Reads a geojson and returns a list of value tuples, each value corresponding to a property in property_names. Args: input_file (str): File name. property_names: List of strings; each string is a property name. Returns: List ...
[ "def", "get_from", "(", "input_file", ",", "property_names", ")", ":", "# get feature collections", "with", "open", "(", "input_file", ")", "as", "f", ":", "feature_collection", "=", "geojson", ".", "load", "(", "f", ")", "features", "=", "feature_collection", ...
Reads a geojson and returns a list of value tuples, each value corresponding to a property in property_names. Args: input_file (str): File name. property_names: List of strings; each string is a property name. Returns: List of value tuples.
[ "Reads", "a", "geojson", "and", "returns", "a", "list", "of", "value", "tuples", "each", "value", "corresponding", "to", "a", "property", "in", "property_names", "." ]
python
train
santoshphilip/eppy
eppy/useful_scripts/idfdiff_missing.py
https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/useful_scripts/idfdiff_missing.py#L92-L127
def idfdiffs(idf1, idf2): """return the diffs between the two idfs""" thediffs = {} keys = idf1.model.dtls # undocumented variable for akey in keys: idfobjs1 = idf1.idfobjects[akey] idfobjs2 = idf2.idfobjects[akey] names = set([getobjname(i) for i in idfobjs1] + ...
[ "def", "idfdiffs", "(", "idf1", ",", "idf2", ")", ":", "thediffs", "=", "{", "}", "keys", "=", "idf1", ".", "model", ".", "dtls", "# undocumented variable", "for", "akey", "in", "keys", ":", "idfobjs1", "=", "idf1", ".", "idfobjects", "[", "akey", "]",...
return the diffs between the two idfs
[ "return", "the", "diffs", "between", "the", "two", "idfs" ]
python
train