repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
henrysher/kotocore
kotocore/connection.py
https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/connection.py#L258-L291
def construct_for(self, service_name): """ Builds a new, specialized ``Connection`` subclass for a given service. This will introspect a service, determine all the API calls it has & constructs a brand new class with those methods on it. :param service_name: The name of the ser...
[ "def", "construct_for", "(", "self", ",", "service_name", ")", ":", "# Construct a new ``ConnectionDetails`` (or similar class) for storing", "# the relevant details about the service & its operations.", "details", "=", "self", ".", "details_class", "(", "service_name", ",", "sel...
Builds a new, specialized ``Connection`` subclass for a given service. This will introspect a service, determine all the API calls it has & constructs a brand new class with those methods on it. :param service_name: The name of the service to construct a connection for. Ex. ``sqs``...
[ "Builds", "a", "new", "specialized", "Connection", "subclass", "for", "a", "given", "service", "." ]
python
train
35.911765
neovim/pynvim
pynvim/api/common.py
https://github.com/neovim/pynvim/blob/5e577188e6d7133f597ad0ce60dc6a4b1314064a/pynvim/api/common.py#L173-L180
def walk(fn, obj, *args, **kwargs): """Recursively walk an object graph applying `fn`/`args` to objects.""" if type(obj) in [list, tuple]: return list(walk(fn, o, *args) for o in obj) if type(obj) is dict: return dict((walk(fn, k, *args), walk(fn, v, *args)) for k, v in o...
[ "def", "walk", "(", "fn", ",", "obj", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "type", "(", "obj", ")", "in", "[", "list", ",", "tuple", "]", ":", "return", "list", "(", "walk", "(", "fn", ",", "o", ",", "*", "args", ")", ...
Recursively walk an object graph applying `fn`/`args` to objects.
[ "Recursively", "walk", "an", "object", "graph", "applying", "fn", "/", "args", "to", "objects", "." ]
python
train
45
alpha-xone/xone
xone/cache.py
https://github.com/alpha-xone/xone/blob/68534a30f7f1760b220ba58040be3927f7dfbcf4/xone/cache.py#L12-L43
def cache_file(symbol, func, has_date, root, date_type='date'): """ Data file Args: symbol: symbol func: use function to categorize data has_date: contains date in data file root: root path date_type: parameters pass to utils.cur_time, [date, time, time_path, ...] ...
[ "def", "cache_file", "(", "symbol", ",", "func", ",", "has_date", ",", "root", ",", "date_type", "=", "'date'", ")", ":", "cur_mod", "=", "sys", ".", "modules", "[", "func", ".", "__module__", "]", "data_tz", "=", "getattr", "(", "cur_mod", ",", "'DATA...
Data file Args: symbol: symbol func: use function to categorize data has_date: contains date in data file root: root path date_type: parameters pass to utils.cur_time, [date, time, time_path, ...] Returns: str: date file
[ "Data", "file" ]
python
train
31.8125
Asana/python-asana
asana/resources/gen/projects.py
https://github.com/Asana/python-asana/blob/6deb7a34495db23f44858e53b6bb2c9eccff7872/asana/resources/gen/projects.py#L188-L198
def add_members(self, project, params={}, **options): """Adds the specified list of users as members of the project. Returns the updated project record. Parameters ---------- project : {Id} The project to add members to. [data] : {Object} Data for the request - member...
[ "def", "add_members", "(", "self", ",", "project", ",", "params", "=", "{", "}", ",", "*", "*", "options", ")", ":", "path", "=", "\"/projects/%s/addMembers\"", "%", "(", "project", ")", "return", "self", ".", "client", ".", "post", "(", "path", ",", ...
Adds the specified list of users as members of the project. Returns the updated project record. Parameters ---------- project : {Id} The project to add members to. [data] : {Object} Data for the request - members : {Array} An array of members to add to the project.
[ "Adds", "the", "specified", "list", "of", "users", "as", "members", "of", "the", "project", ".", "Returns", "the", "updated", "project", "record", "." ]
python
train
44.181818
tanghaibao/goatools
goatools/gosubdag/rpt/write_hierarchy.py
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/rpt/write_hierarchy.py#L34-L39
def prt_hier_down(self, goid, prt=sys.stdout): """Write hierarchy for all GO IDs below GO ID in arg, goid.""" wrhiercfg = self._get_wrhiercfg() obj = WrHierPrt(self.gosubdag.go2obj, self.gosubdag.go2nt, wrhiercfg, prt) obj.prt_hier_rec(goid) return obj.items_list
[ "def", "prt_hier_down", "(", "self", ",", "goid", ",", "prt", "=", "sys", ".", "stdout", ")", ":", "wrhiercfg", "=", "self", ".", "_get_wrhiercfg", "(", ")", "obj", "=", "WrHierPrt", "(", "self", ".", "gosubdag", ".", "go2obj", ",", "self", ".", "gos...
Write hierarchy for all GO IDs below GO ID in arg, goid.
[ "Write", "hierarchy", "for", "all", "GO", "IDs", "below", "GO", "ID", "in", "arg", "goid", "." ]
python
train
49.666667
riga/scinum
scinum.py
https://github.com/riga/scinum/blob/55eb6d8aa77beacee5a07443392954b8a0aad8cb/scinum.py#L1343-L1348
def ensure_number(num, *args, **kwargs): """ Returns *num* again if it is an instance of :py:class:`Number`, or uses all passed arguments to create one and returns it. """ return num if isinstance(num, Number) else Number(num, *args, **kwargs)
[ "def", "ensure_number", "(", "num", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "num", "if", "isinstance", "(", "num", ",", "Number", ")", "else", "Number", "(", "num", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Returns *num* again if it is an instance of :py:class:`Number`, or uses all passed arguments to create one and returns it.
[ "Returns", "*", "num", "*", "again", "if", "it", "is", "an", "instance", "of", ":", "py", ":", "class", ":", "Number", "or", "uses", "all", "passed", "arguments", "to", "create", "one", "and", "returns", "it", "." ]
python
train
43
mathiasertl/django-ca
ca/django_ca/managers.py
https://github.com/mathiasertl/django-ca/blob/976d7ea05276320f20daed2a6d59c8f5660fe976/ca/django_ca/managers.py#L270-L440
def sign_cert(self, ca, csr, expires=None, algorithm=None, subject=None, cn_in_san=True, csr_format=Encoding.PEM, subject_alternative_name=None, key_usage=None, extended_key_usage=None, tls_feature=None, ocsp_no_check=False, extra_extensions=None, password=None): ...
[ "def", "sign_cert", "(", "self", ",", "ca", ",", "csr", ",", "expires", "=", "None", ",", "algorithm", "=", "None", ",", "subject", "=", "None", ",", "cn_in_san", "=", "True", ",", "csr_format", "=", "Encoding", ".", "PEM", ",", "subject_alternative_name...
Create a signed certificate from a CSR. **PLEASE NOTE:** This function creates the raw certificate and is usually not invoked directly. It is called by :py:func:`Certificate.objects.init() <django_ca.managers.CertificateManager.init>`, which passes along all parameters unchanged and saves the r...
[ "Create", "a", "signed", "certificate", "from", "a", "CSR", "." ]
python
train
53.649123
fermiPy/fermipy
fermipy/skymap.py
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/skymap.py#L633-L667
def _interpolate_cube(self, lon, lat, egy=None, interp_log=True): """Perform interpolation on a healpix cube. If egy is None then interpolation will be performed on the existing energy planes. """ shape = np.broadcast(lon, lat, egy).shape lon = lon * np.ones(shape) ...
[ "def", "_interpolate_cube", "(", "self", ",", "lon", ",", "lat", ",", "egy", "=", "None", ",", "interp_log", "=", "True", ")", ":", "shape", "=", "np", ".", "broadcast", "(", "lon", ",", "lat", ",", "egy", ")", ".", "shape", "lon", "=", "lon", "*...
Perform interpolation on a healpix cube. If egy is None then interpolation will be performed on the existing energy planes.
[ "Perform", "interpolation", "on", "a", "healpix", "cube", ".", "If", "egy", "is", "None", "then", "interpolation", "will", "be", "performed", "on", "the", "existing", "energy", "planes", "." ]
python
train
33.714286
google/grr
grr/server/grr_response_server/databases/mysql_artifacts.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mysql_artifacts.py#L38-L46
def ReadArtifact(self, name, cursor=None): """Looks up an artifact with given name from the database.""" cursor.execute("SELECT definition FROM artifacts WHERE name = %s", [name]) row = cursor.fetchone() if row is None: raise db.UnknownArtifactError(name) else: return _RowToArtifact(row...
[ "def", "ReadArtifact", "(", "self", ",", "name", ",", "cursor", "=", "None", ")", ":", "cursor", ".", "execute", "(", "\"SELECT definition FROM artifacts WHERE name = %s\"", ",", "[", "name", "]", ")", "row", "=", "cursor", ".", "fetchone", "(", ")", "if", ...
Looks up an artifact with given name from the database.
[ "Looks", "up", "an", "artifact", "with", "given", "name", "from", "the", "database", "." ]
python
train
34.777778
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavutil.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/mavutil.py#L657-L670
def location(self, relative_alt=False): '''return current location''' self.wait_gps_fix() # wait for another VFR_HUD, to ensure we have correct altitude self.recv_match(type='VFR_HUD', blocking=True) self.recv_match(type='GLOBAL_POSITION_INT', blocking=True) if relative_a...
[ "def", "location", "(", "self", ",", "relative_alt", "=", "False", ")", ":", "self", ".", "wait_gps_fix", "(", ")", "# wait for another VFR_HUD, to ensure we have correct altitude", "self", ".", "recv_match", "(", "type", "=", "'VFR_HUD'", ",", "blocking", "=", "T...
return current location
[ "return", "current", "location" ]
python
train
47.285714
StanfordBioinformatics/loom
client/loomengine/playbooks/files/gcloud_utils.py
https://github.com/StanfordBioinformatics/loom/blob/db2031a1a87124fee1aeb7414a668c03d774a698/client/loomengine/playbooks/files/gcloud_utils.py#L64-L82
def get_gcloud_pricelist(): """Retrieve latest pricelist from Google Cloud, or use cached copy if not reachable. """ try: r = requests.get('http://cloudpricingcalculator.appspot.com' '/static/data/pricelist.json') content = json.loads(r.content) except Connec...
[ "def", "get_gcloud_pricelist", "(", ")", ":", "try", ":", "r", "=", "requests", ".", "get", "(", "'http://cloudpricingcalculator.appspot.com'", "'/static/data/pricelist.json'", ")", "content", "=", "json", ".", "loads", "(", "r", ".", "content", ")", "except", "...
Retrieve latest pricelist from Google Cloud, or use cached copy if not reachable.
[ "Retrieve", "latest", "pricelist", "from", "Google", "Cloud", "or", "use", "cached", "copy", "if", "not", "reachable", "." ]
python
train
37.842105
MacHu-GWU/angora-project
angora/baseclass/classtree.py
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/baseclass/classtree.py#L251-L323
def gencode(data, output=None, tab=" ", indent=0, overwrite=False): """Generate code. :param data: must be list of class data, see a valid data example below :param output: default None, the python script file name you want to create :param tab: default " " :param indent: global indent se...
[ "def", "gencode", "(", "data", ",", "output", "=", "None", ",", "tab", "=", "\" \"", ",", "indent", "=", "0", ",", "overwrite", "=", "False", ")", ":", "codegen", "=", "CodeGenerator", "(", "tab", "=", "tab", ",", "indent", "=", "indent", ")", "...
Generate code. :param data: must be list of class data, see a valid data example below :param output: default None, the python script file name you want to create :param tab: default " " :param indent: global indent setting :param overwrite: if True, silently overwrite the output file ...
[ "Generate", "code", ".", ":", "param", "data", ":", "must", "be", "list", "of", "class", "data", "see", "a", "valid", "data", "example", "below", ":", "param", "output", ":", "default", "None", "the", "python", "script", "file", "name", "you", "want", ...
python
train
38.630137
pypa/pipenv
pipenv/patched/notpip/_internal/cli/parser.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/cli/parser.py#L176-L223
def _update_defaults(self, defaults): """Updates the given defaults with values from the config files and the environ. Does a little special handling for certain types of options (lists).""" # Accumulate complex default state. self.values = optparse.Values(self.defaults) ...
[ "def", "_update_defaults", "(", "self", ",", "defaults", ")", ":", "# Accumulate complex default state.", "self", ".", "values", "=", "optparse", ".", "Values", "(", "self", ".", "defaults", ")", "late_eval", "=", "set", "(", ")", "# Then set the options with thos...
Updates the given defaults with values from the config files and the environ. Does a little special handling for certain types of options (lists).
[ "Updates", "the", "given", "defaults", "with", "values", "from", "the", "config", "files", "and", "the", "environ", ".", "Does", "a", "little", "special", "handling", "for", "certain", "types", "of", "options", "(", "lists", ")", "." ]
python
train
39.9375
google/grr
grr/server/grr_response_server/databases/mem_flows.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_flows.py#L235-L240
def ReadFlowObject(self, client_id, flow_id): """Reads a flow object from the database.""" try: return self.flows[(client_id, flow_id)].Copy() except KeyError: raise db.UnknownFlowError(client_id, flow_id)
[ "def", "ReadFlowObject", "(", "self", ",", "client_id", ",", "flow_id", ")", ":", "try", ":", "return", "self", ".", "flows", "[", "(", "client_id", ",", "flow_id", ")", "]", ".", "Copy", "(", ")", "except", "KeyError", ":", "raise", "db", ".", "Unkn...
Reads a flow object from the database.
[ "Reads", "a", "flow", "object", "from", "the", "database", "." ]
python
train
37.333333
gem/oq-engine
openquake/risklib/riskinput.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/risklib/riskinput.py#L119-L160
def read(cls, dstore): """ :param dstore: a DataStore instance :returns: a :class:`CompositeRiskModel` instance """ oqparam = dstore['oqparam'] tmap = (dstore['taxonomy_mapping'] if 'taxonomy_mapping' in dstore else {}) crm = dstore.getitem('risk_m...
[ "def", "read", "(", "cls", ",", "dstore", ")", ":", "oqparam", "=", "dstore", "[", "'oqparam'", "]", "tmap", "=", "(", "dstore", "[", "'taxonomy_mapping'", "]", "if", "'taxonomy_mapping'", "in", "dstore", "else", "{", "}", ")", "crm", "=", "dstore", "....
:param dstore: a DataStore instance :returns: a :class:`CompositeRiskModel` instance
[ ":", "param", "dstore", ":", "a", "DataStore", "instance", ":", "returns", ":", "a", ":", "class", ":", "CompositeRiskModel", "instance" ]
python
train
46.214286
mitsei/dlkit
dlkit/services/authorization.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/authorization.py#L1175-L1183
def use_isolated_vault_view(self): """Pass through to provider AuthorizationLookupSession.use_isolated_vault_view""" self._vault_view = ISOLATED # self._get_provider_session('authorization_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions()...
[ "def", "use_isolated_vault_view", "(", "self", ")", ":", "self", ".", "_vault_view", "=", "ISOLATED", "# self._get_provider_session('authorization_lookup_session') # To make sure the session is tracked", "for", "session", "in", "self", ".", "_get_provider_sessions", "(", ")", ...
Pass through to provider AuthorizationLookupSession.use_isolated_vault_view
[ "Pass", "through", "to", "provider", "AuthorizationLookupSession", ".", "use_isolated_vault_view" ]
python
train
48.444444
saltstack/salt
salt/modules/vsphere.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vsphere.py#L1287-L1355
def upload_ssh_key(host, username, password, ssh_key=None, ssh_key_file=None, protocol=None, port=None, certificate_verify=False): ''' Upload an ssh key for root to an ESXi host via http PUT. This function only works for ESXi, not vCenter. Only one ssh key can be uploaded for root. U...
[ "def", "upload_ssh_key", "(", "host", ",", "username", ",", "password", ",", "ssh_key", "=", "None", ",", "ssh_key_file", "=", "None", ",", "protocol", "=", "None", ",", "port", "=", "None", ",", "certificate_verify", "=", "False", ")", ":", "if", "proto...
Upload an ssh key for root to an ESXi host via http PUT. This function only works for ESXi, not vCenter. Only one ssh key can be uploaded for root. Uploading a second key will replace any existing key. :param host: The location of the ESXi Host :param username: Username to connect as :param pa...
[ "Upload", "an", "ssh", "key", "for", "root", "to", "an", "ESXi", "host", "via", "http", "PUT", ".", "This", "function", "only", "works", "for", "ESXi", "not", "vCenter", ".", "Only", "one", "ssh", "key", "can", "be", "uploaded", "for", "root", ".", "...
python
train
42.84058
FutunnOpen/futuquant
futuquant/examples/TinyQuant/TinyQuantBase.py
https://github.com/FutunnOpen/futuquant/blob/1512b321845f92ec9c578ce2689aa4e8482669e4/futuquant/examples/TinyQuant/TinyQuantBase.py#L191-L199
def keltner(self, n, dev, array=False): """肯特纳通道""" mid = self.sma(n, array) atr = self.atr(n, array) up = mid + atr * dev down = mid - atr * dev return up, down
[ "def", "keltner", "(", "self", ",", "n", ",", "dev", ",", "array", "=", "False", ")", ":", "mid", "=", "self", ".", "sma", "(", "n", ",", "array", ")", "atr", "=", "self", ".", "atr", "(", "n", ",", "array", ")", "up", "=", "mid", "+", "atr...
肯特纳通道
[ "肯特纳通道" ]
python
train
22.555556
twitterdev/tweet_parser
tweet_parser/getter_methods/tweet_text.py
https://github.com/twitterdev/tweet_parser/blob/3435de8367d36b483a6cfd8d46cc28694ee8a42e/tweet_parser/getter_methods/tweet_text.py#L285-L306
def remove_links(text): """ Helper function to remove the links from the input text Args: text (str): A string Returns: str: the same text, but with any substring that matches the regex for a link removed and replaced with a space Example: >>> from tweet_parser.get...
[ "def", "remove_links", "(", "text", ")", ":", "tco_link_regex", "=", "re", ".", "compile", "(", "\"https?://t.co/[A-z0-9].*\"", ")", "generic_link_regex", "=", "re", ".", "compile", "(", "\"(https?://)?(\\w*[.]\\w+)+([/?=&]+\\w+)*\"", ")", "remove_tco", "=", "re", "...
Helper function to remove the links from the input text Args: text (str): A string Returns: str: the same text, but with any substring that matches the regex for a link removed and replaced with a space Example: >>> from tweet_parser.getter_methods.tweet_text import remove...
[ "Helper", "function", "to", "remove", "the", "links", "from", "the", "input", "text" ]
python
train
34.727273
andreafioraldi/angrdbg
angrdbg/core.py
https://github.com/andreafioraldi/angrdbg/blob/939b20fb9b341aee695d2db12142b1eddc5b555a/angrdbg/core.py#L115-L143
def sim(self, key, size=None): ''' key: memory address(int) or register name(str) size: size of object in bytes ''' project = load_project() if key in project.arch.registers: if size is None: size = project.arch.registers[key][1] si...
[ "def", "sim", "(", "self", ",", "key", ",", "size", "=", "None", ")", ":", "project", "=", "load_project", "(", ")", "if", "key", "in", "project", ".", "arch", ".", "registers", ":", "if", "size", "is", "None", ":", "size", "=", "project", ".", "...
key: memory address(int) or register name(str) size: size of object in bytes
[ "key", ":", "memory", "address", "(", "int", ")", "or", "register", "name", "(", "str", ")", "size", ":", "size", "of", "object", "in", "bytes" ]
python
train
37.517241
tensorflow/datasets
tensorflow_datasets/core/utils/gcs_utils.py
https://github.com/tensorflow/datasets/blob/46ceb0cf7b4690f38ecbbc689e4d659a903d08dc/tensorflow_datasets/core/utils/gcs_utils.py#L69-L72
def is_dataset_on_gcs(dataset_name): """If the dataset is available on the GCS bucket gs://tfds-data/datasets.""" dir_name = posixpath.join(GCS_DATASETS_DIR, dataset_name) return len(gcs_files(prefix_filter=dir_name)) > 2
[ "def", "is_dataset_on_gcs", "(", "dataset_name", ")", ":", "dir_name", "=", "posixpath", ".", "join", "(", "GCS_DATASETS_DIR", ",", "dataset_name", ")", "return", "len", "(", "gcs_files", "(", "prefix_filter", "=", "dir_name", ")", ")", ">", "2" ]
If the dataset is available on the GCS bucket gs://tfds-data/datasets.
[ "If", "the", "dataset", "is", "available", "on", "the", "GCS", "bucket", "gs", ":", "//", "tfds", "-", "data", "/", "datasets", "." ]
python
train
56
rbuffat/pyepw
pyepw/epw.py
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L5344-L5365
def export(self, top=True): """Exports object to its string representation. Args: top (bool): if True appends `internal_name` before values. All non list objects should be exported with value top=True, all list objects, that are embedded in as fields inlist ...
[ "def", "export", "(", "self", ",", "top", "=", "True", ")", ":", "out", "=", "[", "]", "if", "top", ":", "out", ".", "append", "(", "self", ".", "_internal_name", ")", "out", ".", "append", "(", "self", ".", "_to_str", "(", "self", ".", "number_o...
Exports object to its string representation. Args: top (bool): if True appends `internal_name` before values. All non list objects should be exported with value top=True, all list objects, that are embedded in as fields inlist objects should be expor...
[ "Exports", "object", "to", "its", "string", "representation", "." ]
python
train
39.636364
elastic/apm-agent-python
elasticapm/utils/compat.py
https://github.com/elastic/apm-agent-python/blob/2975663d7bd22282dc39336b2c37b37c12c7a774/elasticapm/utils/compat.py#L49-L69
def atexit_register(func): """ Uses either uwsgi's atexit mechanism, or atexit from the stdlib. When running under uwsgi, using their atexit handler is more reliable, especially when using gevent :param func: the function to call at exit """ try: import uwsgi orig = getattr...
[ "def", "atexit_register", "(", "func", ")", ":", "try", ":", "import", "uwsgi", "orig", "=", "getattr", "(", "uwsgi", ",", "\"atexit\"", ",", "None", ")", "def", "uwsgi_atexit", "(", ")", ":", "if", "callable", "(", "orig", ")", ":", "orig", "(", ")"...
Uses either uwsgi's atexit mechanism, or atexit from the stdlib. When running under uwsgi, using their atexit handler is more reliable, especially when using gevent :param func: the function to call at exit
[ "Uses", "either", "uwsgi", "s", "atexit", "mechanism", "or", "atexit", "from", "the", "stdlib", "." ]
python
train
24.571429
kiwiz/gkeepapi
gkeepapi/node.py
https://github.com/kiwiz/gkeepapi/blob/78aaae8b988b1cf616e3973f7f15d4c6d5e996cc/gkeepapi/node.py#L225-L239
def save(self, clean=True): """Serialize into raw representation. Clears the dirty bit by default. Args: clean (bool): Whether to clear the dirty bit. Returns: dict: Raw. """ ret = {} if clean: self._dirty = False else: ...
[ "def", "save", "(", "self", ",", "clean", "=", "True", ")", ":", "ret", "=", "{", "}", "if", "clean", ":", "self", ".", "_dirty", "=", "False", "else", ":", "ret", "[", "'_dirty'", "]", "=", "self", ".", "_dirty", "return", "ret" ]
Serialize into raw representation. Clears the dirty bit by default. Args: clean (bool): Whether to clear the dirty bit. Returns: dict: Raw.
[ "Serialize", "into", "raw", "representation", ".", "Clears", "the", "dirty", "bit", "by", "default", "." ]
python
train
23.866667
MediaFire/mediafire-python-open-sdk
mediafire/api.py
https://github.com/MediaFire/mediafire-python-open-sdk/blob/8f1f23db1b16f16e026f5c6777aec32d00baa05f/mediafire/api.py#L97-L134
def _build_query(self, uri, params=None, action_token_type=None): """Prepare query string""" if params is None: params = QueryParams() params['response_format'] = 'json' session_token = None if action_token_type in self._action_tokens: # Favor action t...
[ "def", "_build_query", "(", "self", ",", "uri", ",", "params", "=", "None", ",", "action_token_type", "=", "None", ")", ":", "if", "params", "is", "None", ":", "params", "=", "QueryParams", "(", ")", "params", "[", "'response_format'", "]", "=", "'json'"...
Prepare query string
[ "Prepare", "query", "string" ]
python
train
31.526316
frawau/aiolifx
aiolifx/aiolifx.py
https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L699-L710
def device_firmware_str(self, indent): """Convenience to string method. """ host_build_ns = self.host_firmware_build_timestamp host_build_s = datetime.datetime.utcfromtimestamp(host_build_ns/1000000000) if host_build_ns != None else None wifi_build_ns = self.wifi_firmware_build_t...
[ "def", "device_firmware_str", "(", "self", ",", "indent", ")", ":", "host_build_ns", "=", "self", ".", "host_firmware_build_timestamp", "host_build_s", "=", "datetime", ".", "datetime", ".", "utcfromtimestamp", "(", "host_build_ns", "/", "1000000000", ")", "if", "...
Convenience to string method.
[ "Convenience", "to", "string", "method", "." ]
python
train
69.916667
NerdWalletOSS/savage
src/savage/models/__init__.py
https://github.com/NerdWalletOSS/savage/blob/54f64ac1c912528710365107952967d31d56e60d/src/savage/models/__init__.py#L176-L194
def register(cls, archive_table, engine): """ :param archive_table: the model for the users archive table :param engine: the database engine :param version_col_names: strings which correspond to columns that versioning will pivot \ around. These columns must have a unique con...
[ "def", "register", "(", "cls", ",", "archive_table", ",", "engine", ")", ":", "version_col_names", "=", "cls", ".", "version_columns", "if", "not", "version_col_names", ":", "raise", "LogTableCreationError", "(", "'Need to specify version cols in cls.version_columns'", ...
:param archive_table: the model for the users archive table :param engine: the database engine :param version_col_names: strings which correspond to columns that versioning will pivot \ around. These columns must have a unique constraint set on them.
[ ":", "param", "archive_table", ":", "the", "model", "for", "the", "users", "archive", "table", ":", "param", "engine", ":", "the", "database", "engine", ":", "param", "version_col_names", ":", "strings", "which", "correspond", "to", "columns", "that", "version...
python
train
45.526316
trailofbits/manticore
manticore/native/cpu/x86.py
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L1448-L1497
def DAS(cpu): """ Decimal adjusts AL after subtraction. Adjusts the result of the subtraction of two packed BCD values to create a packed BCD result. The AL register is the implied source and destination operand. If a decimal borrow is detected, the CF and AF flags are set accor...
[ "def", "DAS", "(", "cpu", ")", ":", "oldAL", "=", "cpu", ".", "AL", "oldCF", "=", "cpu", ".", "CF", "cpu", ".", "AF", "=", "Operators", ".", "OR", "(", "(", "cpu", ".", "AL", "&", "0x0f", ")", ">", "9", ",", "cpu", ".", "AF", ")", "cpu", ...
Decimal adjusts AL after subtraction. Adjusts the result of the subtraction of two packed BCD values to create a packed BCD result. The AL register is the implied source and destination operand. If a decimal borrow is detected, the CF and AF flags are set accordingly. This instruction is not va...
[ "Decimal", "adjusts", "AL", "after", "subtraction", "." ]
python
valid
35.24
edeposit/edeposit.amqp.ftp
src/edeposit/amqp/ftp/decoders/__init__.py
https://github.com/edeposit/edeposit.amqp.ftp/blob/fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71/src/edeposit/amqp/ftp/decoders/__init__.py#L30-L55
def parse_meta(filename, data): """ Parse `data` to EPublication. Args: filename (str): Used to choose right parser based at suffix. data (str): Content of the metadata file. Returns: EPublication: object. """ if "." not in filename: raise MetaParsingException( ...
[ "def", "parse_meta", "(", "filename", ",", "data", ")", ":", "if", "\".\"", "not", "in", "filename", ":", "raise", "MetaParsingException", "(", "\"Can't recognize type of your metadata ('%s')!\"", "%", "filename", ")", "suffix", "=", "filename", ".", "rsplit", "("...
Parse `data` to EPublication. Args: filename (str): Used to choose right parser based at suffix. data (str): Content of the metadata file. Returns: EPublication: object.
[ "Parse", "data", "to", "EPublication", "." ]
python
train
26.807692
codelv/enaml-native
src/enamlnative/core/eventloop/gen.py
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/eventloop/gen.py#L1301-L1325
def convert_yielded(yielded): """Convert a yielded object into a `.Future`. The default implementation accepts lists, dictionaries, and Futures. If the `~functools.singledispatch` library is available, this function may be extended to support additional types. For example:: @convert_yielded.r...
[ "def", "convert_yielded", "(", "yielded", ")", ":", "# Lists and dicts containing YieldPoints were handled earlier.", "if", "yielded", "is", "None", ":", "return", "moment", "elif", "isinstance", "(", "yielded", ",", "(", "list", ",", "dict", ")", ")", ":", "retur...
Convert a yielded object into a `.Future`. The default implementation accepts lists, dictionaries, and Futures. If the `~functools.singledispatch` library is available, this function may be extended to support additional types. For example:: @convert_yielded.register(asyncio.Future) def _...
[ "Convert", "a", "yielded", "object", "into", "a", ".", "Future", "." ]
python
train
34.12
stain/forgetSQL
lib/forgetSQL.py
https://github.com/stain/forgetSQL/blob/2e13f983020b121fd75a95fcafce3ea75573fb6b/lib/forgetSQL.py#L429-L437
def save(self): """Save to database if anything has changed since last load""" if ( self._new or (self._validID() and self._changed) or (self._updated and self._changed > self._updated) ): # Don't save if we have not loaded existing data! self._saveDB() ...
[ "def", "save", "(", "self", ")", ":", "if", "(", "self", ".", "_new", "or", "(", "self", ".", "_validID", "(", ")", "and", "self", ".", "_changed", ")", "or", "(", "self", ".", "_updated", "and", "self", ".", "_changed", ">", "self", ".", "_updat...
Save to database if anything has changed since last load
[ "Save", "to", "database", "if", "anything", "has", "changed", "since", "last", "load" ]
python
train
39.333333
abseil/abseil-py
absl/flags/_validators.py
https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_validators.py#L367-L384
def mark_flags_as_required(flag_names, flag_values=_flagvalues.FLAGS): """Ensures that flags are not None during program execution. Recommended usage: if __name__ == '__main__': flags.mark_flags_as_required(['flag1', 'flag2', 'flag3']) app.run() Args: flag_names: Sequence[str], names of the...
[ "def", "mark_flags_as_required", "(", "flag_names", ",", "flag_values", "=", "_flagvalues", ".", "FLAGS", ")", ":", "for", "flag_name", "in", "flag_names", ":", "mark_flag_as_required", "(", "flag_name", ",", "flag_values", ")" ]
Ensures that flags are not None during program execution. Recommended usage: if __name__ == '__main__': flags.mark_flags_as_required(['flag1', 'flag2', 'flag3']) app.run() Args: flag_names: Sequence[str], names of the flags. flag_values: flags.FlagValues, optional FlagValues instance wher...
[ "Ensures", "that", "flags", "are", "not", "None", "during", "program", "execution", "." ]
python
train
32.666667
pmacosta/peng
docs/support/requirements_to_rst.py
https://github.com/pmacosta/peng/blob/976935377adaa3de26fc5677aceb2cdfbd6f93a7/docs/support/requirements_to_rst.py#L40-L43
def make_common_entry(plist, pyver, suffix, req_ver): """Generate Python interpreter version entries for 2.x or 3.x series.""" prefix = "Python {pyver}.x{suffix}".format(pyver=pyver, suffix=suffix) plist.append("{prefix}{ver}".format(prefix=prefix, ver=ops_to_words(req_ver)))
[ "def", "make_common_entry", "(", "plist", ",", "pyver", ",", "suffix", ",", "req_ver", ")", ":", "prefix", "=", "\"Python {pyver}.x{suffix}\"", ".", "format", "(", "pyver", "=", "pyver", ",", "suffix", "=", "suffix", ")", "plist", ".", "append", "(", "\"{p...
Generate Python interpreter version entries for 2.x or 3.x series.
[ "Generate", "Python", "interpreter", "version", "entries", "for", "2", ".", "x", "or", "3", ".", "x", "series", "." ]
python
test
71.25
dwavesystems/dimod
dimod/binary_quadratic_model.py
https://github.com/dwavesystems/dimod/blob/beff1b7f86b559d923ac653c1de6d593876d6d38/dimod/binary_quadratic_model.py#L2027-L2054
def to_qubo(self): """Convert a binary quadratic model to QUBO format. If the binary quadratic model's vartype is not :class:`.Vartype.BINARY`, values are converted. Returns: tuple: 2-tuple of form (`biases`, `offset`), where `biases` is a dict in which keys are...
[ "def", "to_qubo", "(", "self", ")", ":", "qubo", "=", "dict", "(", "self", ".", "binary", ".", "quadratic", ")", "qubo", ".", "update", "(", "(", "(", "v", ",", "v", ")", ",", "bias", ")", "for", "v", ",", "bias", "in", "iteritems", "(", "self"...
Convert a binary quadratic model to QUBO format. If the binary quadratic model's vartype is not :class:`.Vartype.BINARY`, values are converted. Returns: tuple: 2-tuple of form (`biases`, `offset`), where `biases` is a dict in which keys are pairs of variables and values...
[ "Convert", "a", "binary", "quadratic", "model", "to", "QUBO", "format", "." ]
python
train
44.5
pantsbuild/pants
src/python/pants/help/help_info_extracter.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/help/help_info_extracter.py#L109-L127
def get_option_scope_help_info(self, option_registrations_iter): """Returns an OptionScopeHelpInfo for the options registered with the (args, kwargs) pairs.""" basic_options = [] recursive_options = [] advanced_options = [] # Sort the arguments, so we display the help in alphabetical order. for ...
[ "def", "get_option_scope_help_info", "(", "self", ",", "option_registrations_iter", ")", ":", "basic_options", "=", "[", "]", "recursive_options", "=", "[", "]", "advanced_options", "=", "[", "]", "# Sort the arguments, so we display the help in alphabetical order.", "for",...
Returns an OptionScopeHelpInfo for the options registered with the (args, kwargs) pairs.
[ "Returns", "an", "OptionScopeHelpInfo", "for", "the", "options", "registered", "with", "the", "(", "args", "kwargs", ")", "pairs", "." ]
python
train
44.842105
tantale/deprecated
deprecated/sphinx.py
https://github.com/tantale/deprecated/blob/3dc742c571de7cebbbdaaf4c554f2f36fc61b3db/deprecated/sphinx.py#L100-L124
def versionadded(reason="", version=""): """ This decorator can be used to insert a "versionadded" directive in your function/class docstring in order to documents the version of the project which adds this new functionality in your library. :param str reason: Reason message which documents...
[ "def", "versionadded", "(", "reason", "=", "\"\"", ",", "version", "=", "\"\"", ")", ":", "adapter", "=", "SphinxAdapter", "(", "'versionadded'", ",", "reason", "=", "reason", ",", "version", "=", "version", ")", "# noinspection PyUnusedLocal", "@", "wrapt", ...
This decorator can be used to insert a "versionadded" directive in your function/class docstring in order to documents the version of the project which adds this new functionality in your library. :param str reason: Reason message which documents the addition in your library (can be omitted). ...
[ "This", "decorator", "can", "be", "used", "to", "insert", "a", "versionadded", "directive", "in", "your", "function", "/", "class", "docstring", "in", "order", "to", "documents", "the", "version", "of", "the", "project", "which", "adds", "this", "new", "func...
python
train
38
alexhayes/django-toolkit
django_toolkit/views.py
https://github.com/alexhayes/django-toolkit/blob/b64106392fad596defc915b8235fe6e1d0013b5b/django_toolkit/views.py#L147-L153
def render_to_response(self, context=False): """Send file to client.""" f = self.openfile() wrapper = FileWrapper(f) response = HttpResponse(wrapper, content_type=self.content_type()) self.headers(response) return response
[ "def", "render_to_response", "(", "self", ",", "context", "=", "False", ")", ":", "f", "=", "self", ".", "openfile", "(", ")", "wrapper", "=", "FileWrapper", "(", "f", ")", "response", "=", "HttpResponse", "(", "wrapper", ",", "content_type", "=", "self"...
Send file to client.
[ "Send", "file", "to", "client", "." ]
python
train
37.714286
singularityhub/sregistry-cli
sregistry/main/__template__/query.py
https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/__template__/query.py#L46-L73
def search_all(self): '''a "show all" search that doesn't require a query''' # This should be your apis url for a search url = '...' # paginte get is what it sounds like, and what you want for multiple # pages of results results = self._paginate_get(url) if len(results) == 0: b...
[ "def", "search_all", "(", "self", ")", ":", "# This should be your apis url for a search", "url", "=", "'...'", "# paginte get is what it sounds like, and what you want for multiple", "# pages of results", "results", "=", "self", ".", "_paginate_get", "(", "url", ")", "if", ...
a "show all" search that doesn't require a query
[ "a", "show", "all", "search", "that", "doesn", "t", "require", "a", "query" ]
python
test
28.392857
Azure/azure-sdk-for-python
azure-common/azure/common/client_factory.py
https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-common/azure/common/client_factory.py#L51-L100
def get_client_from_cli_profile(client_class, **kwargs): """Return a SDK client initialized with current CLI credentials, CLI default subscription and CLI default cloud. This method will fill automatically the following client parameters: - credentials - subscription_id - base_url Parameters p...
[ "def", "get_client_from_cli_profile", "(", "client_class", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_cli_active_cloud", "(", ")", "parameters", "=", "{", "}", "if", "'credentials'", "not", "in", "kwargs", "or", "'subscription_id'", "not", "in", "kw...
Return a SDK client initialized with current CLI credentials, CLI default subscription and CLI default cloud. This method will fill automatically the following client parameters: - credentials - subscription_id - base_url Parameters provided in kwargs will override CLI parameters and be passed dir...
[ "Return", "a", "SDK", "client", "initialized", "with", "current", "CLI", "credentials", "CLI", "default", "subscription", "and", "CLI", "default", "cloud", "." ]
python
test
44.28
spyder-ide/spyder
spyder/plugins/base.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/base.py#L76-L89
def initialize_plugin_in_mainwindow_layout(self): """ If this is the first time the plugin is shown, perform actions to initialize plugin position in Spyder's window layout. Use on_first_registration to define the actions to be run by your plugin """ if self.get_...
[ "def", "initialize_plugin_in_mainwindow_layout", "(", "self", ")", ":", "if", "self", ".", "get_option", "(", "'first_time'", ",", "True", ")", ":", "try", ":", "self", ".", "on_first_registration", "(", ")", "except", "NotImplementedError", ":", "return", "self...
If this is the first time the plugin is shown, perform actions to initialize plugin position in Spyder's window layout. Use on_first_registration to define the actions to be run by your plugin
[ "If", "this", "is", "the", "first", "time", "the", "plugin", "is", "shown", "perform", "actions", "to", "initialize", "plugin", "position", "in", "Spyder", "s", "window", "layout", "." ]
python
train
36.285714
thombashi/pathvalidate
pathvalidate/_file.py
https://github.com/thombashi/pathvalidate/blob/22d64038fb08c04aa9d0e8dd9fd1a955c1a9bfef/pathvalidate/_file.py#L533-L575
def sanitize_filename( filename, replacement_text="", platform=None, max_len=_DEFAULT_MAX_FILENAME_LEN ): """Make a valid filename from a string. To make a valid filename the function does: - Replace invalid characters as file names included in the ``filename`` with the ``replacement_tex...
[ "def", "sanitize_filename", "(", "filename", ",", "replacement_text", "=", "\"\"", ",", "platform", "=", "None", ",", "max_len", "=", "_DEFAULT_MAX_FILENAME_LEN", ")", ":", "return", "FileNameSanitizer", "(", "platform", "=", "platform", ",", "max_len", "=", "ma...
Make a valid filename from a string. To make a valid filename the function does: - Replace invalid characters as file names included in the ``filename`` with the ``replacement_text``. Invalid characters are: - unprintable characters - |invalid_filename_chars| ...
[ "Make", "a", "valid", "filename", "from", "a", "string", "." ]
python
train
33.418605
thombashi/SimpleSQLite
simplesqlite/core.py
https://github.com/thombashi/SimpleSQLite/blob/b16f212132b9b98773e68bf7395abc2f60f56fe5/simplesqlite/core.py#L471-L501
def select_as_memdb(self, table_name, columns=None, where=None, extra=None): """ Get data in the database and return fetched data as a in-memory |SimpleSQLite| instance. :param str table_name: |arg_select_table_name| :param list columns: |arg_select_as_xx_columns| :param...
[ "def", "select_as_memdb", "(", "self", ",", "table_name", ",", "columns", "=", "None", ",", "where", "=", "None", ",", "extra", "=", "None", ")", ":", "table_schema", "=", "self", ".", "schema_extractor", ".", "fetch_table_schema", "(", "table_name", ")", ...
Get data in the database and return fetched data as a in-memory |SimpleSQLite| instance. :param str table_name: |arg_select_table_name| :param list columns: |arg_select_as_xx_columns| :param where: |arg_select_where| :type where: |arg_where_type| :param str extra: |arg_s...
[ "Get", "data", "in", "the", "database", "and", "return", "fetched", "data", "as", "a", "in", "-", "memory", "|SimpleSQLite|", "instance", "." ]
python
train
38.096774
blockstack/blockstack-core
blockstack/lib/atlas.py
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/atlas.py#L2863-L2942
def random_walk_graph( self, prev_peer, prev_peer_degree, current_peer, current_peer_neighbors, con=None, path=None, peer_table=None ): """ Take one step from current_peer to a neighbor in current_peer_neighbors, based on Metropolis-Hastings Random Walk with Delayed Acceptance (MHRWDA). ...
[ "def", "random_walk_graph", "(", "self", ",", "prev_peer", ",", "prev_peer_degree", ",", "current_peer", ",", "current_peer_neighbors", ",", "con", "=", "None", ",", "path", "=", "None", ",", "peer_table", "=", "None", ")", ":", "if", "path", "is", "None", ...
Take one step from current_peer to a neighbor in current_peer_neighbors, based on Metropolis-Hastings Random Walk with Delayed Acceptance (MHRWDA). The basic idea is to reduce the probability (versus MH alone) that we transition to the previous node. We do so using the Metropolis-Hastings Rando...
[ "Take", "one", "step", "from", "current_peer", "to", "a", "neighbor", "in", "current_peer_neighbors", "based", "on", "Metropolis", "-", "Hastings", "Random", "Walk", "with", "Delayed", "Acceptance", "(", "MHRWDA", ")", "." ]
python
train
45.5125
halcy/Mastodon.py
mastodon/Mastodon.py
https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L1993-L1999
def suggestion_delete(self, account_id): """ Remove the user with the given `account_id` from the follow suggestions. """ account_id = self.__unpack_id(account_id) url = '/api/v1/suggestions/{0}'.format(str(account_id)) self.__api_request('DELETE', url)
[ "def", "suggestion_delete", "(", "self", ",", "account_id", ")", ":", "account_id", "=", "self", ".", "__unpack_id", "(", "account_id", ")", "url", "=", "'/api/v1/suggestions/{0}'", ".", "format", "(", "str", "(", "account_id", ")", ")", "self", ".", "__api_...
Remove the user with the given `account_id` from the follow suggestions.
[ "Remove", "the", "user", "with", "the", "given", "account_id", "from", "the", "follow", "suggestions", "." ]
python
train
42.142857
acutesoftware/AIKIF
aikif/toolbox/audio_tools.py
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/toolbox/audio_tools.py#L31-L63
def get_audio_metadata(fname): """ collects basic MP3 metadata Works, once you use mutagenx (buried deep in issues page) ['Angels'] ['Red Back Fever'] ['Red Back Fever'] {'album': ['Red Back Fever'], 'title': ['Red Back Fever'], 'artist': ['Angels']} """ from mutagenx.easyid3 import ...
[ "def", "get_audio_metadata", "(", "fname", ")", ":", "from", "mutagenx", ".", "easyid3", "import", "EasyID3", "audio", "=", "EasyID3", "(", "fname", ")", "audio_dict", "=", "{", "}", "try", ":", "artist", "=", "audio", "[", "\"artist\"", "]", "except", "...
collects basic MP3 metadata Works, once you use mutagenx (buried deep in issues page) ['Angels'] ['Red Back Fever'] ['Red Back Fever'] {'album': ['Red Back Fever'], 'title': ['Red Back Fever'], 'artist': ['Angels']}
[ "collects", "basic", "MP3", "metadata", "Works", "once", "you", "use", "mutagenx", "(", "buried", "deep", "in", "issues", "page", ")", "[", "Angels", "]", "[", "Red", "Back", "Fever", "]", "[", "Red", "Back", "Fever", "]", "{", "album", ":", "[", "Re...
python
train
23.151515
Erotemic/utool
utool/util_dbg.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_dbg.py#L456-L556
def embed(parent_locals=None, parent_globals=None, exec_lines=None, remove_pyqt_hook=True, N=0): """ Starts interactive session. Similar to keyboard command in matlab. Wrapper around IPython.embed """ import utool as ut from functools import partial import IPython if parent_g...
[ "def", "embed", "(", "parent_locals", "=", "None", ",", "parent_globals", "=", "None", ",", "exec_lines", "=", "None", ",", "remove_pyqt_hook", "=", "True", ",", "N", "=", "0", ")", ":", "import", "utool", "as", "ut", "from", "functools", "import", "part...
Starts interactive session. Similar to keyboard command in matlab. Wrapper around IPython.embed
[ "Starts", "interactive", "session", ".", "Similar", "to", "keyboard", "command", "in", "matlab", ".", "Wrapper", "around", "IPython", ".", "embed" ]
python
train
35.306931
hvac/hvac
hvac/api/secrets_engines/identity.py
https://github.com/hvac/hvac/blob/cce5b86889193f622c2a72a4a1b7e1c9c8aff1ce/hvac/api/secrets_engines/identity.py#L436-L464
def list_entity_aliases(self, method='LIST', mount_point=DEFAULT_MOUNT_POINT): """List available entity aliases by their identifiers. :param method: Supported methods: LIST: /{mount_point}/entity-alias/id. Produces: 200 application/json GET: /{mount_point}/entity-alias/id?list=t...
[ "def", "list_entity_aliases", "(", "self", ",", "method", "=", "'LIST'", ",", "mount_point", "=", "DEFAULT_MOUNT_POINT", ")", ":", "if", "method", "==", "'LIST'", ":", "api_path", "=", "'/v1/{mount_point}/entity-alias/id'", ".", "format", "(", "mount_point", "=", ...
List available entity aliases by their identifiers. :param method: Supported methods: LIST: /{mount_point}/entity-alias/id. Produces: 200 application/json GET: /{mount_point}/entity-alias/id?list=true. Produces: 200 application/json :type method: str | unicode :param mou...
[ "List", "available", "entity", "aliases", "by", "their", "identifiers", "." ]
python
train
42.724138
usc-isi-i2/etk
etk/segment.py
https://github.com/usc-isi-i2/etk/blob/aab077c984ea20f5e8ae33af622fe11d3c4df866/etk/segment.py#L40-L115
def store(self, extractions: List[Extraction], attribute: str, group_by_tags: bool = True) -> None: """ Records extractions in the container, and for each individual extraction inserts a ProvenanceRecord to record where the extraction is stored. Records the "output_segment" in the proven...
[ "def", "store", "(", "self", ",", "extractions", ":", "List", "[", "Extraction", "]", ",", "attribute", ":", "str", ",", "group_by_tags", ":", "bool", "=", "True", ")", "->", "None", ":", "if", "not", "isinstance", "(", "self", ".", "_value", ",", "d...
Records extractions in the container, and for each individual extraction inserts a ProvenanceRecord to record where the extraction is stored. Records the "output_segment" in the provenance. Extractions are always recorded in a list. Errors out if the segment is primitive, such as a str...
[ "Records", "extractions", "in", "the", "container", "and", "for", "each", "individual", "extraction", "inserts", "a", "ProvenanceRecord", "to", "record", "where", "the", "extraction", "is", "stored", ".", "Records", "the", "output_segment", "in", "the", "provenanc...
python
train
54.894737
mikedh/trimesh
trimesh/triangles.py
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/triangles.py#L415-L449
def barycentric_to_points(triangles, barycentric): """ Convert a list of barycentric coordinates on a list of triangles to cartesian points. Parameters ------------ triangles : (n, 3, 3) float Triangles in space barycentric : (n, 2) float Barycentric coordinates Returns ...
[ "def", "barycentric_to_points", "(", "triangles", ",", "barycentric", ")", ":", "barycentric", "=", "np", ".", "asanyarray", "(", "barycentric", ",", "dtype", "=", "np", ".", "float64", ")", "triangles", "=", "np", ".", "asanyarray", "(", "triangles", ",", ...
Convert a list of barycentric coordinates on a list of triangles to cartesian points. Parameters ------------ triangles : (n, 3, 3) float Triangles in space barycentric : (n, 2) float Barycentric coordinates Returns ----------- points : (m, 3) float Points in space
[ "Convert", "a", "list", "of", "barycentric", "coordinates", "on", "a", "list", "of", "triangles", "to", "cartesian", "points", "." ]
python
train
33.628571
bpsmith/tia
tia/analysis/model/ins.py
https://github.com/bpsmith/tia/blob/a7043b6383e557aeea8fc7112bbffd6e36a230e9/tia/analysis/model/ins.py#L93-L100
def get_eod_frame(self): """Return the eod market data frame for pricing""" close = self.pxs.close mktval = self.get_mkt_val(close) dvds = self.pxs.dvds df = pd.DataFrame({'close': close, 'mkt_val': mktval, 'dvds': dvds}) df.index.name = 'date' return df
[ "def", "get_eod_frame", "(", "self", ")", ":", "close", "=", "self", ".", "pxs", ".", "close", "mktval", "=", "self", ".", "get_mkt_val", "(", "close", ")", "dvds", "=", "self", ".", "pxs", ".", "dvds", "df", "=", "pd", ".", "DataFrame", "(", "{", ...
Return the eod market data frame for pricing
[ "Return", "the", "eod", "market", "data", "frame", "for", "pricing" ]
python
train
37.875
EmbodiedCognition/pagoda
pagoda/cooper.py
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/cooper.py#L190-L246
def load_attachments(self, source, skeleton): '''Load attachment configuration from the given text source. The attachment configuration file has a simple format. After discarding Unix-style comments (any part of a line that starts with the pound (#) character), each line in the file is ...
[ "def", "load_attachments", "(", "self", ",", "source", ",", "skeleton", ")", ":", "self", ".", "targets", "=", "{", "}", "self", ".", "offsets", "=", "{", "}", "filename", "=", "source", "if", "isinstance", "(", "source", ",", "str", ")", ":", "sourc...
Load attachment configuration from the given text source. The attachment configuration file has a simple format. After discarding Unix-style comments (any part of a line that starts with the pound (#) character), each line in the file is then expected to have the following format:: ...
[ "Load", "attachment", "configuration", "from", "the", "given", "text", "source", "." ]
python
valid
40.824561
PMBio/limix-backup
limix/varDecomp/varianceDecomposition.py
https://github.com/PMBio/limix-backup/blob/1e201fdb5c694d0d5506f207f3de65d8ef66146c/limix/varDecomp/varianceDecomposition.py#L538-L563
def getTraitCovarStdErrors(self,term_i): """ Returns standard errors on trait covariances from term_i (for the covariance estimate \see getTraitCovar) Args: term_i: index of the term we are interested in """ assert self.init, 'GP not initialised' a...
[ "def", "getTraitCovarStdErrors", "(", "self", ",", "term_i", ")", ":", "assert", "self", ".", "init", ",", "'GP not initialised'", "assert", "self", ".", "fast", "==", "False", ",", "'Not supported for fast implementation'", "if", "self", ".", "P", "==", "1", ...
Returns standard errors on trait covariances from term_i (for the covariance estimate \see getTraitCovar) Args: term_i: index of the term we are interested in
[ "Returns", "standard", "errors", "on", "trait", "covariances", "from", "term_i", "(", "for", "the", "covariance", "estimate", "\\", "see", "getTraitCovar", ")" ]
python
train
45.846154
guyzmo/git-repo
git_repo/services/service.py
https://github.com/guyzmo/git-repo/blob/2974c3f52bc64fa8a467ac2b0e9a485ba7ed333b/git_repo/services/service.py#L287-L310
def format_path(self, repository, namespace=None, rw=False): '''format the repository's URL :param repository: name of the repository :param namespace: namespace of the repository :param rw: return a git+ssh URL if true, an https URL otherwise :return: the full URI of the reposi...
[ "def", "format_path", "(", "self", ",", "repository", ",", "namespace", "=", "None", ",", "rw", "=", "False", ")", ":", "repo", "=", "repository", "if", "namespace", ":", "repo", "=", "'{}/{}'", ".", "format", "(", "namespace", ",", "repository", ")", ...
format the repository's URL :param repository: name of the repository :param namespace: namespace of the repository :param rw: return a git+ssh URL if true, an https URL otherwise :return: the full URI of the repository ready to use as remote if namespace is not given, reposito...
[ "format", "the", "repository", "s", "URL" ]
python
train
43.458333
googledatalab/pydatalab
google/datalab/utils/facets/base_generic_feature_statistics_generator.py
https://github.com/googledatalab/pydatalab/blob/d9031901d5bca22fe0d5925d204e6698df9852e1/google/datalab/utils/facets/base_generic_feature_statistics_generator.py#L35-L56
def ProtoFromDataFrames(self, dataframes): """Creates a feature statistics proto from a set of pandas dataframes. Args: dataframes: A list of dicts describing tables for each dataset for the proto. Each entry contains a 'table' field of the dataframe of the data and a 'name...
[ "def", "ProtoFromDataFrames", "(", "self", ",", "dataframes", ")", ":", "datasets", "=", "[", "]", "for", "dataframe", "in", "dataframes", ":", "table", "=", "dataframe", "[", "'table'", "]", "table_entries", "=", "{", "}", "for", "col", "in", "table", "...
Creates a feature statistics proto from a set of pandas dataframes. Args: dataframes: A list of dicts describing tables for each dataset for the proto. Each entry contains a 'table' field of the dataframe of the data and a 'name' field to identify the dataset in the proto. ...
[ "Creates", "a", "feature", "statistics", "proto", "from", "a", "set", "of", "pandas", "dataframes", ".", "Args", ":", "dataframes", ":", "A", "list", "of", "dicts", "describing", "tables", "for", "each", "dataset", "for", "the", "proto", ".", "Each", "entr...
python
train
36.227273
Kronuz/pyScss
scss/cssdefs.py
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/cssdefs.py#L227-L239
def count_base_units(units): """Returns a dict mapping names of base units to how many times they appear in the given iterable of units. Effectively this counts how many length units you have, how many time units, and so forth. """ ret = {} for unit in units: factor, base_unit = get_con...
[ "def", "count_base_units", "(", "units", ")", ":", "ret", "=", "{", "}", "for", "unit", "in", "units", ":", "factor", ",", "base_unit", "=", "get_conversion_factor", "(", "unit", ")", "ret", ".", "setdefault", "(", "base_unit", ",", "0", ")", "ret", "[...
Returns a dict mapping names of base units to how many times they appear in the given iterable of units. Effectively this counts how many length units you have, how many time units, and so forth.
[ "Returns", "a", "dict", "mapping", "names", "of", "base", "units", "to", "how", "many", "times", "they", "appear", "in", "the", "given", "iterable", "of", "units", ".", "Effectively", "this", "counts", "how", "many", "length", "units", "you", "have", "how"...
python
train
31.538462
mperlet/PyDect200
PyDect200/PyDect200.py
https://github.com/mperlet/PyDect200/blob/4758d80c663324a612c2772e6442db1472016913/PyDect200/PyDect200.py#L141-L146
def get_power(self): """Returns the Power in Watt""" power_dict = self.get_power_all() for device in power_dict.keys(): power_dict[device] = float(power_dict[device]) / 1000.0 return power_dict
[ "def", "get_power", "(", "self", ")", ":", "power_dict", "=", "self", ".", "get_power_all", "(", ")", "for", "device", "in", "power_dict", ".", "keys", "(", ")", ":", "power_dict", "[", "device", "]", "=", "float", "(", "power_dict", "[", "device", "]"...
Returns the Power in Watt
[ "Returns", "the", "Power", "in", "Watt" ]
python
train
38.666667
ricequant/rqalpha
rqalpha/mod/rqalpha_mod_sys_accounts/api/api_future.py
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/mod/rqalpha_mod_sys_accounts/api/api_future.py#L265-L281
def sell_open(id_or_ins, amount, price=None, style=None): """ 卖出开仓 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要用于简化 `style` 参数。 ...
[ "def", "sell_open", "(", "id_or_ins", ",", "amount", ",", "price", "=", "None", ",", "style", "=", "None", ")", ":", "return", "order", "(", "id_or_ins", ",", "amount", ",", "SIDE", ".", "SELL", ",", "POSITION_EFFECT", ".", "OPEN", ",", "cal_style", "(...
卖出开仓 :param id_or_ins: 下单标的物 :type id_or_ins: :class:`~Instrument` object | `str` | List[:class:`~Instrument`] | List[`str`] :param int amount: 下单手数 :param float price: 下单价格,默认为None,表示 :class:`~MarketOrder`, 此参数主要用于简化 `style` 参数。 :param style: 下单类型, 默认是市价单。目前支持的订单类型有 :class:`~LimitOrder` 和 :clas...
[ "卖出开仓" ]
python
train
33.705882
rflamary/POT
ot/stochastic.py
https://github.com/rflamary/POT/blob/c5108efc7b6702e1af3928bef1032e6b37734d1c/ot/stochastic.py#L341-L444
def solve_semi_dual_entropic(a, b, M, reg, method, numItermax=10000, lr=None, log=False): ''' Compute the transportation matrix to solve the regularized discrete measures optimal transport max problem The function solves the following optimization problem: .. ma...
[ "def", "solve_semi_dual_entropic", "(", "a", ",", "b", ",", "M", ",", "reg", ",", "method", ",", "numItermax", "=", "10000", ",", "lr", "=", "None", ",", "log", "=", "False", ")", ":", "if", "method", ".", "lower", "(", ")", "==", "\"sag\"", ":", ...
Compute the transportation matrix to solve the regularized discrete measures optimal transport max problem The function solves the following optimization problem: .. math:: \gamma = arg\min_\gamma <\gamma,M>_F + reg\cdot\Omega(\gamma) s.t. \gamma 1 = a \gamma^T 1= b ...
[ "Compute", "the", "transportation", "matrix", "to", "solve", "the", "regularized", "discrete", "measures", "optimal", "transport", "max", "problem" ]
python
train
27.711538
DavidDoukhan/py_sonicvisualiser
py_sonicvisualiser/SVEnv.py
https://github.com/DavidDoukhan/py_sonicvisualiser/blob/ebe83bd7dffb0275393255dcbcc6671cf0ade4a5/py_sonicvisualiser/SVEnv.py#L79-L100
def init_from_wave_file(wavpath): """Init a sonic visualiser environment structure based the analysis of the main audio file. The audio file have to be encoded in wave Args: wavpath(str): the full path to the wavfile """ try: samplerate, data = SW.read(...
[ "def", "init_from_wave_file", "(", "wavpath", ")", ":", "try", ":", "samplerate", ",", "data", "=", "SW", ".", "read", "(", "wavpath", ")", "nframes", "=", "data", ".", "shape", "[", "0", "]", "except", ":", "# scipy cannot handle 24 bit wav files", "# and w...
Init a sonic visualiser environment structure based the analysis of the main audio file. The audio file have to be encoded in wave Args: wavpath(str): the full path to the wavfile
[ "Init", "a", "sonic", "visualiser", "environment", "structure", "based", "the", "analysis", "of", "the", "main", "audio", "file", ".", "The", "audio", "file", "have", "to", "be", "encoded", "in", "wave" ]
python
train
34
HPAC/matchpy
matchpy/expressions/expressions.py
https://github.com/HPAC/matchpy/blob/06b2ec50ee0efdf3dd183768c0ffdb51b7efc393/matchpy/expressions/expressions.py#L755-L770
def optional(name, default) -> 'Wildcard': """Create a `Wildcard` that matches a single argument with a default value. If the wildcard does not match, the substitution will contain the default value instead. Args: name: The name for the wildcard. ...
[ "def", "optional", "(", "name", ",", "default", ")", "->", "'Wildcard'", ":", "return", "Wildcard", "(", "min_count", "=", "1", ",", "fixed_size", "=", "True", ",", "variable_name", "=", "name", ",", "optional", "=", "default", ")" ]
Create a `Wildcard` that matches a single argument with a default value. If the wildcard does not match, the substitution will contain the default value instead. Args: name: The name for the wildcard. default: The default value of the wil...
[ "Create", "a", "Wildcard", "that", "matches", "a", "single", "argument", "with", "a", "default", "value", "." ]
python
train
32.625
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_interface_ext.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_interface_ext.py#L808-L824
def get_interface_detail_output_interface_if_name(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_interface_detail = ET.Element("get_interface_detail") config = get_interface_detail output = ET.SubElement(get_interface_detail, "output") ...
[ "def", "get_interface_detail_output_interface_if_name", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "get_interface_detail", "=", "ET", ".", "Element", "(", "\"get_interface_detail\"", ")", "config", ...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
47.823529
AdvancedClimateSystems/uModbus
umodbus/server/serial/__init__.py
https://github.com/AdvancedClimateSystems/uModbus/blob/0560a42308003f4072d988f28042b8d55b694ad4/umodbus/server/serial/__init__.py#L88-L117
def execute_route(self, meta_data, request_pdu): """ Execute configured route based on requests meta data and request PDU. :param meta_data: A dict with meta data. It must at least contain key 'unit_id'. :param request_pdu: A bytearray containing request PDU. :return...
[ "def", "execute_route", "(", "self", ",", "meta_data", ",", "request_pdu", ")", ":", "try", ":", "function", "=", "create_function_from_request_pdu", "(", "request_pdu", ")", "results", "=", "function", ".", "execute", "(", "meta_data", "[", "'unit_id'", "]", ...
Execute configured route based on requests meta data and request PDU. :param meta_data: A dict with meta data. It must at least contain key 'unit_id'. :param request_pdu: A bytearray containing request PDU. :return: A bytearry containing reponse PDU.
[ "Execute", "configured", "route", "based", "on", "requests", "meta", "data", "and", "request", "PDU", "." ]
python
train
43.5
BeyondTheClouds/enoslib
enoslib/infra/enos_g5k/provider.py
https://github.com/BeyondTheClouds/enoslib/blob/fb00be58e56a7848cfe482187d659744919fe2f7/enoslib/infra/enos_g5k/provider.py#L12-L34
def _to_enos_roles(roles): """Transform the roles to use enoslib.host.Host hosts. Args: roles (dict): roles returned by :py:func:`enoslib.infra.provider.Provider.init` """ def to_host(h): extra = {} # create extra_vars for the nics # network_role = ethX ...
[ "def", "_to_enos_roles", "(", "roles", ")", ":", "def", "to_host", "(", "h", ")", ":", "extra", "=", "{", "}", "# create extra_vars for the nics", "# network_role = ethX", "for", "nic", ",", "roles", "in", "h", "[", "\"nics\"", "]", ":", "for", "role", "in...
Transform the roles to use enoslib.host.Host hosts. Args: roles (dict): roles returned by :py:func:`enoslib.infra.provider.Provider.init`
[ "Transform", "the", "roles", "to", "use", "enoslib", ".", "host", ".", "Host", "hosts", "." ]
python
train
26.869565
kensho-technologies/graphql-compiler
graphql_compiler/query_formatting/sql_formatting.py
https://github.com/kensho-technologies/graphql-compiler/blob/f6079c6d10f64932f6b3af309b79bcea2123ca8f/graphql_compiler/query_formatting/sql_formatting.py#L10-L23
def insert_arguments_into_sql_query(compilation_result, arguments): """Insert the arguments into the compiled SQL query to form a complete query. Args: compilation_result: CompilationResult, compilation result from the GraphQL compiler. arguments: Dict[str, Any], parameter name -> value, for ev...
[ "def", "insert_arguments_into_sql_query", "(", "compilation_result", ",", "arguments", ")", ":", "if", "compilation_result", ".", "language", "!=", "SQL_LANGUAGE", ":", "raise", "AssertionError", "(", "u'Unexpected query output language: {}'", ".", "format", "(", "compila...
Insert the arguments into the compiled SQL query to form a complete query. Args: compilation_result: CompilationResult, compilation result from the GraphQL compiler. arguments: Dict[str, Any], parameter name -> value, for every parameter the query expects. Returns: SQLAlchemy Selectabl...
[ "Insert", "the", "arguments", "into", "the", "compiled", "SQL", "query", "to", "form", "a", "complete", "query", "." ]
python
train
47.928571
neurodata/ndio
ndio/remote/neurodata.py
https://github.com/neurodata/ndio/blob/792dd5816bc770b05a3db2f4327da42ff6253531/ndio/remote/neurodata.py#L644-L694
def create_channel(self, channel_name, project_name, dataset_name, channel_type, dtype, startwindow, endwindow, readonly=0, ...
[ "def", "create_channel", "(", "self", ",", "channel_name", ",", "project_name", ",", "dataset_name", ",", "channel_type", ",", "dtype", ",", "startwindow", ",", "endwindow", ",", "readonly", "=", "0", ",", "start_time", "=", "0", ",", "end_time", "=", "0", ...
Create a new channel on the Remote, using channel_data. Arguments: channel_name (str): Channel name project_name (str): Project name dataset_name (str): Dataset name channel_type (str): Type of the channel (e.g. `neurodata.IMAGE`) dtype (str): The dat...
[ "Create", "a", "new", "channel", "on", "the", "Remote", "using", "channel_data", "." ]
python
test
43.215686
senaite/senaite.core
bika/lims/browser/auditlog.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/browser/auditlog.py#L118-L124
def get_widget_label_for(self, fieldname, default=None): """Lookup the widget of the field and return the label """ widget = self.get_widget_for(fieldname) if widget is None: return default return widget.label
[ "def", "get_widget_label_for", "(", "self", ",", "fieldname", ",", "default", "=", "None", ")", ":", "widget", "=", "self", ".", "get_widget_for", "(", "fieldname", ")", "if", "widget", "is", "None", ":", "return", "default", "return", "widget", ".", "labe...
Lookup the widget of the field and return the label
[ "Lookup", "the", "widget", "of", "the", "field", "and", "return", "the", "label" ]
python
train
36.428571
teffland/pytorch-monitor
build/lib/pytorch_monitor/monitor.py
https://github.com/teffland/pytorch-monitor/blob/56dce63ba85c0f9faf9df11df78161ee60f5fae9/build/lib/pytorch_monitor/monitor.py#L19-L35
def set_monitoring(module): """ Defines the monitoring method on the module. """ def monitoring(is_monitoring, track_data=None, track_grad=None, track_update=None, track_update_ratio=None): """ Turn monitoring on or off....
[ "def", "set_monitoring", "(", "module", ")", ":", "def", "monitoring", "(", "is_monitoring", ",", "track_data", "=", "None", ",", "track_grad", "=", "None", ",", "track_update", "=", "None", ",", "track_update_ratio", "=", "None", ")", ":", "\"\"\"\n Tu...
Defines the monitoring method on the module.
[ "Defines", "the", "monitoring", "method", "on", "the", "module", "." ]
python
train
51.058824
jcrist/skein
skein/core.py
https://github.com/jcrist/skein/blob/16f8b1d3b3d9f79f36e2f152e45893339a1793e8/skein/core.py#L516-L539
def submit_and_connect(self, spec): """Submit a new skein application, and wait to connect to it. If an error occurs before the application connects, the application is killed. Parameters ---------- spec : ApplicationSpec, str, or dict A description of the a...
[ "def", "submit_and_connect", "(", "self", ",", "spec", ")", ":", "spec", "=", "ApplicationSpec", ".", "_from_any", "(", "spec", ")", "app_id", "=", "self", ".", "submit", "(", "spec", ")", "try", ":", "return", "self", ".", "connect", "(", "app_id", ",...
Submit a new skein application, and wait to connect to it. If an error occurs before the application connects, the application is killed. Parameters ---------- spec : ApplicationSpec, str, or dict A description of the application to run. Can be an ``Appl...
[ "Submit", "a", "new", "skein", "application", "and", "wait", "to", "connect", "to", "it", "." ]
python
train
33.583333
broadinstitute/fiss
firecloud/supervisor.py
https://github.com/broadinstitute/fiss/blob/dddf91547479506dbbafb69ec84d44dcc4a94ab4/firecloud/supervisor.py#L130-L145
def recover_and_supervise(recovery_file): """ Retrieve monitor data from recovery_file and resume monitoring """ try: logging.info("Attempting to recover Supervisor data from " + recovery_file) with open(recovery_file) as rf: recovery_data = json.load(rf) monitor_data = r...
[ "def", "recover_and_supervise", "(", "recovery_file", ")", ":", "try", ":", "logging", ".", "info", "(", "\"Attempting to recover Supervisor data from \"", "+", "recovery_file", ")", "with", "open", "(", "recovery_file", ")", "as", "rf", ":", "recovery_data", "=", ...
Retrieve monitor data from recovery_file and resume monitoring
[ "Retrieve", "monitor", "data", "from", "recovery_file", "and", "resume", "monitoring" ]
python
train
42.125
vinci1it2000/schedula
schedula/utils/blue.py
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/blue.py#L565-L589
def set_default_value(self, data_id, value=EMPTY, initial_dist=0.0): """ Set the default value of a data node in the dispatcher. :param data_id: Data node id. :type data_id: str :param value: Data node default value. .. note:: If `EMPTY` the...
[ "def", "set_default_value", "(", "self", ",", "data_id", ",", "value", "=", "EMPTY", ",", "initial_dist", "=", "0.0", ")", ":", "self", ".", "deferred", ".", "append", "(", "(", "'set_default_value'", ",", "_call_kw", "(", "locals", "(", ")", ")", ")", ...
Set the default value of a data node in the dispatcher. :param data_id: Data node id. :type data_id: str :param value: Data node default value. .. note:: If `EMPTY` the previous default value is removed. :type value: T, optional :param init...
[ "Set", "the", "default", "value", "of", "a", "data", "node", "in", "the", "dispatcher", "." ]
python
train
29.08
mrcagney/gtfstk
gtfstk/stops.py
https://github.com/mrcagney/gtfstk/blob/c91494e6fefc02523889655a0dc92d1c0eee8d03/gtfstk/stops.py#L905-L961
def map_stops( feed: "Feed", stop_ids: List[str], stop_style: Dict = STOP_STYLE ): """ Return a Folium map showing the given stops. Parameters ---------- feed : Feed stop_ids : list IDs of trips in ``feed.stops`` stop_style: dictionary Folium CircleMarker parameters to u...
[ "def", "map_stops", "(", "feed", ":", "\"Feed\"", ",", "stop_ids", ":", "List", "[", "str", "]", ",", "stop_style", ":", "Dict", "=", "STOP_STYLE", ")", ":", "import", "folium", "as", "fl", "# Initialize map", "my_map", "=", "fl", ".", "Map", "(", "til...
Return a Folium map showing the given stops. Parameters ---------- feed : Feed stop_ids : list IDs of trips in ``feed.stops`` stop_style: dictionary Folium CircleMarker parameters to use for styling stops. Returns ------- dictionary A Folium Map depicting the st...
[ "Return", "a", "Folium", "map", "showing", "the", "given", "stops", "." ]
python
train
23.596491
DLR-RM/RAFCON
source/rafcon/gui/mygaphas/tools.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/tools.py#L646-L660
def _disconnect_temporarily(self, port_v, target=True): """Removes a connection between the current connection and the given port :param rafcon.gui.mygaphas.items.ports.PortView port_v: The port that was connected :param bool target: Whether the connection origin or target should be disconnecte...
[ "def", "_disconnect_temporarily", "(", "self", ",", "port_v", ",", "target", "=", "True", ")", ":", "if", "target", ":", "handle", "=", "self", ".", "_connection_v", ".", "to_handle", "(", ")", "else", ":", "handle", "=", "self", ".", "_connection_v", "....
Removes a connection between the current connection and the given port :param rafcon.gui.mygaphas.items.ports.PortView port_v: The port that was connected :param bool target: Whether the connection origin or target should be disconnected
[ "Removes", "a", "connection", "between", "the", "current", "connection", "and", "the", "given", "port" ]
python
train
45.8
openvax/varcode
varcode/cli/genes_script.py
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/cli/genes_script.py#L32-L52
def main(args_list=None): """ Script which loads variants and annotates them with overlapping genes. Example usage: varcode-genes --vcf mutect.vcf \ --vcf strelka.vcf \ --maf tcga_brca.maf \ --variant chr1 498584 C G \ --json-variants more...
[ "def", "main", "(", "args_list", "=", "None", ")", ":", "print_version_info", "(", ")", "if", "args_list", "is", "None", ":", "args_list", "=", "sys", ".", "argv", "[", "1", ":", "]", "args", "=", "arg_parser", ".", "parse_args", "(", "args_list", ")",...
Script which loads variants and annotates them with overlapping genes. Example usage: varcode-genes --vcf mutect.vcf \ --vcf strelka.vcf \ --maf tcga_brca.maf \ --variant chr1 498584 C G \ --json-variants more_variants.json
[ "Script", "which", "loads", "variants", "and", "annotates", "them", "with", "overlapping", "genes", "." ]
python
train
32.428571
PGower/PyCanvas
pycanvas/apis/groups.py
https://github.com/PGower/PyCanvas/blob/68520005382b440a1e462f9df369f54d364e21e8/pycanvas/apis/groups.py#L130-L169
def create_group_groups(self, description=None, is_public=None, join_level=None, name=None, storage_quota_mb=None): """ Create a group. Creates a new group. Groups created using the "/api/v1/groups/" endpoint will be community groups. """ path = {} data =...
[ "def", "create_group_groups", "(", "self", ",", "description", "=", "None", ",", "is_public", "=", "None", ",", "join_level", "=", "None", ",", "name", "=", "None", ",", "storage_quota_mb", "=", "None", ")", ":", "path", "=", "{", "}", "data", "=", "{"...
Create a group. Creates a new group. Groups created using the "/api/v1/groups/" endpoint will be community groups.
[ "Create", "a", "group", ".", "Creates", "a", "new", "group", ".", "Groups", "created", "using", "the", "/", "api", "/", "v1", "/", "groups", "/", "endpoint", "will", "be", "community", "groups", "." ]
python
train
40.675
mardix/Juice
juice/cli.py
https://github.com/mardix/Juice/blob/7afa8d4238868235dfcdae82272bd77958dd416a/juice/cli.py#L119-L127
def get_deploy_assets2s3_list(cwd, file="propel.yml"): """ Return the list of all the assets2s3 repo to publish when deploying :param cwd: :param file: :return: list """ conf = propel_deploy_config(cwd=cwd, file=file) return conf["assets2s3"] if "assets2s3" in conf else []
[ "def", "get_deploy_assets2s3_list", "(", "cwd", ",", "file", "=", "\"propel.yml\"", ")", ":", "conf", "=", "propel_deploy_config", "(", "cwd", "=", "cwd", ",", "file", "=", "file", ")", "return", "conf", "[", "\"assets2s3\"", "]", "if", "\"assets2s3\"", "in"...
Return the list of all the assets2s3 repo to publish when deploying :param cwd: :param file: :return: list
[ "Return", "the", "list", "of", "all", "the", "assets2s3", "repo", "to", "publish", "when", "deploying", ":", "param", "cwd", ":", ":", "param", "file", ":", ":", "return", ":", "list" ]
python
train
33
assamite/creamas
creamas/mp.py
https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/mp.py#L77-L87
async def report(self, msg, timeout=5): """Report message to the host manager. """ try: host_manager = await self.env.connect(self.host_manager, timeout=timeout) except: raise ConnectionError("Could not reach host ...
[ "async", "def", "report", "(", "self", ",", "msg", ",", "timeout", "=", "5", ")", ":", "try", ":", "host_manager", "=", "await", "self", ".", "env", ".", "connect", "(", "self", ".", "host_manager", ",", "timeout", "=", "timeout", ")", "except", ":",...
Report message to the host manager.
[ "Report", "message", "to", "the", "host", "manager", "." ]
python
train
40.909091
Contraz/demosys-py
demosys/scene/camera.py
https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/scene/camera.py#L180-L209
def rot_state(self, x, y): """ Set the rotation state of the camera :param x: viewport x pos :param y: viewport y pos """ if self.last_x is None: self.last_x = x if self.last_y is None: self.last_y = y x_offset = self.last_x - x ...
[ "def", "rot_state", "(", "self", ",", "x", ",", "y", ")", ":", "if", "self", ".", "last_x", "is", "None", ":", "self", ".", "last_x", "=", "x", "if", "self", ".", "last_y", "is", "None", ":", "self", ".", "last_y", "=", "y", "x_offset", "=", "s...
Set the rotation state of the camera :param x: viewport x pos :param y: viewport y pos
[ "Set", "the", "rotation", "state", "of", "the", "camera" ]
python
valid
22.733333
saltstack/salt
salt/modules/gnomedesktop.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gnomedesktop.py#L66-L89
def _get(self): ''' get the value for user in gsettings ''' user = self.USER try: uid = pwd.getpwnam(user).pw_uid except KeyError: log.info('User does not exist') return False cmd = self.gsetting_command + ['get', str(self.SCH...
[ "def", "_get", "(", "self", ")", ":", "user", "=", "self", ".", "USER", "try", ":", "uid", "=", "pwd", ".", "getpwnam", "(", "user", ")", ".", "pw_uid", "except", "KeyError", ":", "log", ".", "info", "(", "'User does not exist'", ")", "return", "Fals...
get the value for user in gsettings
[ "get", "the", "value", "for", "user", "in", "gsettings" ]
python
train
30.458333
itamarst/eliot
eliot/_generators.py
https://github.com/itamarst/eliot/blob/c03c96520c5492fadfc438b4b0f6336e2785ba2d/eliot/_generators.py#L29-L36
def in_generator(self, generator): """Context manager: set the given generator as the current generator.""" previous_generator = self._current_generator try: self._current_generator = generator yield finally: self._current_generator = previous_generato...
[ "def", "in_generator", "(", "self", ",", "generator", ")", ":", "previous_generator", "=", "self", ".", "_current_generator", "try", ":", "self", ".", "_current_generator", "=", "generator", "yield", "finally", ":", "self", ".", "_current_generator", "=", "previ...
Context manager: set the given generator as the current generator.
[ "Context", "manager", ":", "set", "the", "given", "generator", "as", "the", "current", "generator", "." ]
python
train
39.25
tensorflow/probability
tensorflow_probability/python/bijectors/reshape.py
https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/bijectors/reshape.py#L316-L382
def _replace_event_shape_in_tensorshape( input_tensorshape, event_shape_in, event_shape_out): """Replaces the event shape dims of a `TensorShape`. Args: input_tensorshape: a `TensorShape` instance in which to attempt replacing event shape. event_shape_in: `Tensor` shape representing the event sha...
[ "def", "_replace_event_shape_in_tensorshape", "(", "input_tensorshape", ",", "event_shape_in", ",", "event_shape_out", ")", ":", "event_shape_in_ndims", "=", "tensorshape_util", ".", "num_elements", "(", "event_shape_in", ".", "shape", ")", "if", "tensorshape_util", ".", ...
Replaces the event shape dims of a `TensorShape`. Args: input_tensorshape: a `TensorShape` instance in which to attempt replacing event shape. event_shape_in: `Tensor` shape representing the event shape expected to be present in (rightmost dims of) `tensorshape_in`. Must be compatible with ...
[ "Replaces", "the", "event", "shape", "dims", "of", "a", "TensorShape", "." ]
python
test
45.074627
jbittel/django-mama-cas
mama_cas/request.py
https://github.com/jbittel/django-mama-cas/blob/03935d97442b46d8127ab9e1cd8deb96953fe156/mama_cas/request.py#L19-L24
def ns(self, prefix, tag): """ Given a prefix and an XML tag, output the qualified name for proper namespace handling on output. """ return etree.QName(self.prefixes[prefix], tag)
[ "def", "ns", "(", "self", ",", "prefix", ",", "tag", ")", ":", "return", "etree", ".", "QName", "(", "self", ".", "prefixes", "[", "prefix", "]", ",", "tag", ")" ]
Given a prefix and an XML tag, output the qualified name for proper namespace handling on output.
[ "Given", "a", "prefix", "and", "an", "XML", "tag", "output", "the", "qualified", "name", "for", "proper", "namespace", "handling", "on", "output", "." ]
python
train
35.666667
CiscoUcs/UcsPythonSDK
src/UcsSdk/UcsBase.py
https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L1180-L1188
def GetChildClassId(self, classId): """ Method extracts and returns the child object list same as the given classId """ childList = [] for ch in self.child: if ch.classId.lower() == classId.lower(): childList.append(ch) return childList
[ "def", "GetChildClassId", "(", "self", ",", "classId", ")", ":", "childList", "=", "[", "]", "for", "ch", "in", "self", ".", "child", ":", "if", "ch", ".", "classId", ".", "lower", "(", ")", "==", "classId", ".", "lower", "(", ")", ":", "childList"...
Method extracts and returns the child object list same as the given classId
[ "Method", "extracts", "and", "returns", "the", "child", "object", "list", "same", "as", "the", "given", "classId" ]
python
train
27.444444
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/widgets/filebrowser.py
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/filebrowser.py#L567-L582
def asset_ver_sel_changed(self, index): """Callback for when the version selection has changed Emit asset_taskfile_sel_changed signal. :param index: the selected index :type index: QtCore.QModelIndex :returns: None :rtype: None :raises: None """ ...
[ "def", "asset_ver_sel_changed", "(", "self", ",", "index", ")", ":", "taskfile", "=", "None", "if", "index", ".", "isValid", "(", ")", ":", "item", "=", "index", ".", "internalPointer", "(", ")", "taskfile", "=", "item", ".", "internal_data", "(", ")", ...
Callback for when the version selection has changed Emit asset_taskfile_sel_changed signal. :param index: the selected index :type index: QtCore.QModelIndex :returns: None :rtype: None :raises: None
[ "Callback", "for", "when", "the", "version", "selection", "has", "changed" ]
python
train
30.625
Shapeways/coyote_framework
coyote_framework/requests/requestdriver.py
https://github.com/Shapeways/coyote_framework/blob/cb29899b984a21d56bf65d0b1d907073948fe16c/coyote_framework/requests/requestdriver.py#L34-L80
def request(self, uri, method=GET, headers=None, cookies=None, params=None, data=None, post_files=None,**kwargs): """Makes a request using requests @param uri: The uri to send request @param method: Method to use to send request @param headers: Any headers to send with request @...
[ "def", "request", "(", "self", ",", "uri", ",", "method", "=", "GET", ",", "headers", "=", "None", ",", "cookies", "=", "None", ",", "params", "=", "None", ",", "data", "=", "None", ",", "post_files", "=", "None", ",", "*", "*", "kwargs", ")", ":...
Makes a request using requests @param uri: The uri to send request @param method: Method to use to send request @param headers: Any headers to send with request @param cookies: Request cookies (in addition to session cookies) @param params: Request parameters @param data...
[ "Makes", "a", "request", "using", "requests" ]
python
train
31.382979
cloud9ers/gurumate
environment/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/command/bdist_egg.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg/setuptools/command/bdist_egg.py#L420-L453
def scan_module(egg_dir, base, name, stubs): """Check whether module possibly uses unsafe-for-zipfile stuff""" filename = os.path.join(base,name) if filename[:-1] in stubs: return True # Extension module pkg = base[len(egg_dir)+1:].replace(os.sep,'.') module = pkg+(pkg and '.' or '')+os...
[ "def", "scan_module", "(", "egg_dir", ",", "base", ",", "name", ",", "stubs", ")", ":", "filename", "=", "os", ".", "path", ".", "join", "(", "base", ",", "name", ")", "if", "filename", "[", ":", "-", "1", "]", "in", "stubs", ":", "return", "True...
Check whether module possibly uses unsafe-for-zipfile stuff
[ "Check", "whether", "module", "possibly", "uses", "unsafe", "-", "for", "-", "zipfile", "stuff" ]
python
test
41.441176
mkouhei/tonicdnscli
src/tonicdnscli/command.py
https://github.com/mkouhei/tonicdnscli/blob/df2d6fb2104ae4d49fa89d1bba2f3ccd2fed388c/src/tonicdnscli/command.py#L685-L697
def parse_get_tmpl(prs, conn): """Retrieve template. Arguments: prs: parser object of argparse conn: dictionary of connection information """ prs_tmpl_get = prs.add_parser( 'tmpl_get', help='retrieve templates') set_option(prs_tmpl_get, 'template') conn_options(prs_tmp...
[ "def", "parse_get_tmpl", "(", "prs", ",", "conn", ")", ":", "prs_tmpl_get", "=", "prs", ".", "add_parser", "(", "'tmpl_get'", ",", "help", "=", "'retrieve templates'", ")", "set_option", "(", "prs_tmpl_get", ",", "'template'", ")", "conn_options", "(", "prs_tm...
Retrieve template. Arguments: prs: parser object of argparse conn: dictionary of connection information
[ "Retrieve", "template", "." ]
python
train
28.461538
portfors-lab/sparkle
sparkle/acq/daq_tasks.py
https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/acq/daq_tasks.py#L45-L58
def register_callback(self, fun, npts): """ Provide a function to be executed periodically on data collection, every time after the specified number of points are collected. :param fun: the function that gets called, it must have a single positional argument that will be the d...
[ "def", "register_callback", "(", "self", ",", "fun", ",", "npts", ")", ":", "self", ".", "callback_fun", "=", "fun", "self", ".", "n", "=", "npts", "self", ".", "AutoRegisterEveryNSamplesEvent", "(", "DAQmx_Val_Acquired_Into_Buffer", ",", "npts", ",", "0", "...
Provide a function to be executed periodically on data collection, every time after the specified number of points are collected. :param fun: the function that gets called, it must have a single positional argument that will be the data buffer read :type fun: function ...
[ "Provide", "a", "function", "to", "be", "executed", "periodically", "on", "data", "collection", "every", "time", "after", "the", "specified", "number", "of", "points", "are", "collected", ".", ":", "param", "fun", ":", "the", "function", "that", "gets", "cal...
python
train
48.571429
klavinslab/coral
coral/utils/tempdirs.py
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/utils/tempdirs.py#L9-L30
def tempdir(fun): '''For use as a decorator of instance methods - creates a temporary dir named self._tempdir and then deletes it after the method runs. :param fun: function to decorate :type fun: instance method ''' def wrapper(*args, **kwargs): self = args[0] if os.path.isdir...
[ "def", "tempdir", "(", "fun", ")", ":", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", "=", "args", "[", "0", "]", "if", "os", ".", "path", ".", "isdir", "(", "self", ".", "_tempdir", ")", ":", "shutil", ".", "...
For use as a decorator of instance methods - creates a temporary dir named self._tempdir and then deletes it after the method runs. :param fun: function to decorate :type fun: instance method
[ "For", "use", "as", "a", "decorator", "of", "instance", "methods", "-", "creates", "a", "temporary", "dir", "named", "self", ".", "_tempdir", "and", "then", "deletes", "it", "after", "the", "method", "runs", "." ]
python
train
32.045455
prompt-toolkit/pymux
pymux/pipes/win32_server.py
https://github.com/prompt-toolkit/pymux/blob/3f66e62b9de4b2251c7f9afad6c516dc5a30ec67/pymux/pipes/win32_server.py#L147-L170
def _connect_client(self): """ Wait for a client to connect to this pipe. """ overlapped = OVERLAPPED() overlapped.hEvent = create_event() while True: success = windll.kernel32.ConnectNamedPipe( self.pipe_handle, byref(overlapp...
[ "def", "_connect_client", "(", "self", ")", ":", "overlapped", "=", "OVERLAPPED", "(", ")", "overlapped", ".", "hEvent", "=", "create_event", "(", ")", "while", "True", ":", "success", "=", "windll", ".", "kernel32", ".", "ConnectNamedPipe", "(", "self", "...
Wait for a client to connect to this pipe.
[ "Wait", "for", "a", "client", "to", "connect", "to", "this", "pipe", "." ]
python
train
29.833333
saltstack/salt
salt/modules/cpan.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cpan.py#L35-L63
def install(module): ''' Install a Perl module from CPAN CLI Example: .. code-block:: bash salt '*' cpan.install Template::Alloy ''' ret = { 'old': None, 'new': None, } old_info = show(module) cmd = 'cpan -i {0}'.format(module) out = __salt__['cmd.run...
[ "def", "install", "(", "module", ")", ":", "ret", "=", "{", "'old'", ":", "None", ",", "'new'", ":", "None", ",", "}", "old_info", "=", "show", "(", "module", ")", "cmd", "=", "'cpan -i {0}'", ".", "format", "(", "module", ")", "out", "=", "__salt_...
Install a Perl module from CPAN CLI Example: .. code-block:: bash salt '*' cpan.install Template::Alloy
[ "Install", "a", "Perl", "module", "from", "CPAN" ]
python
train
19.517241
HDI-Project/MLPrimitives
mlprimitives/custom/timeseries_preprocessing.py
https://github.com/HDI-Project/MLPrimitives/blob/bf415f9f751724ff545a1156ddfd7524e320f469/mlprimitives/custom/timeseries_preprocessing.py#L7-L23
def rolling_window_sequences(X, index, window_size, target_size, target_column): """Create rolling window sequences out of timeseries data.""" out_X = list() out_y = list() X_index = list() y_index = list() target = X[:, target_column] for start in range(len(X) - window_size - target_size ...
[ "def", "rolling_window_sequences", "(", "X", ",", "index", ",", "window_size", ",", "target_size", ",", "target_column", ")", ":", "out_X", "=", "list", "(", ")", "out_y", "=", "list", "(", ")", "X_index", "=", "list", "(", ")", "y_index", "=", "list", ...
Create rolling window sequences out of timeseries data.
[ "Create", "rolling", "window", "sequences", "out", "of", "timeseries", "data", "." ]
python
train
34.882353
peopledoc/django-agnocomplete
agnocomplete/fields.py
https://github.com/peopledoc/django-agnocomplete/blob/9bf21db2f2036ba5059b843acd32902a09192053/agnocomplete/fields.py#L163-L173
def clear_list_value(self, value): """ Clean the argument value to eliminate None or Falsy values if needed. """ # Don't go any further: this value is empty. if not value: return self.empty_value # Clean empty items if wanted if self.clean_empty: ...
[ "def", "clear_list_value", "(", "self", ",", "value", ")", ":", "# Don't go any further: this value is empty.", "if", "not", "value", ":", "return", "self", ".", "empty_value", "# Clean empty items if wanted", "if", "self", ".", "clean_empty", ":", "value", "=", "["...
Clean the argument value to eliminate None or Falsy values if needed.
[ "Clean", "the", "argument", "value", "to", "eliminate", "None", "or", "Falsy", "values", "if", "needed", "." ]
python
train
35.363636
maxfischer2781/include
include/base/import_hook.py
https://github.com/maxfischer2781/include/blob/d8b0404f4996b6abcd39fdebf282b31fad8bb6f5/include/base/import_hook.py#L47-L52
def module2uri(self, module_name): """Convert an encoded module name to an unencoded source uri""" assert module_name.startswith(self.module_prefix), 'incompatible module name' path = module_name[len(self.module_prefix):] path = path.replace('&#DOT', '.') return path.replace('&#S...
[ "def", "module2uri", "(", "self", ",", "module_name", ")", ":", "assert", "module_name", ".", "startswith", "(", "self", ".", "module_prefix", ")", ",", "'incompatible module name'", "path", "=", "module_name", "[", "len", "(", "self", ".", "module_prefix", ")...
Convert an encoded module name to an unencoded source uri
[ "Convert", "an", "encoded", "module", "name", "to", "an", "unencoded", "source", "uri" ]
python
train
54.5
isambard-uob/ampal
src/ampal/dssp.py
https://github.com/isambard-uob/ampal/blob/906e2afacb435ffb129b381f262ff8e7bfb324c5/src/ampal/dssp.py#L61-L108
def extract_all_ss_dssp(in_dssp, path=True): """Uses DSSP to extract secondary structure information on every residue. Parameters ---------- in_dssp : str Path to DSSP file. path : bool, optional Indicates if pdb is a path or a string. Returns ------- dssp_residues : [t...
[ "def", "extract_all_ss_dssp", "(", "in_dssp", ",", "path", "=", "True", ")", ":", "if", "path", ":", "with", "open", "(", "in_dssp", ",", "'r'", ")", "as", "inf", ":", "dssp_out", "=", "inf", ".", "read", "(", ")", "else", ":", "dssp_out", "=", "in...
Uses DSSP to extract secondary structure information on every residue. Parameters ---------- in_dssp : str Path to DSSP file. path : bool, optional Indicates if pdb is a path or a string. Returns ------- dssp_residues : [tuple] Each internal list contains: ...
[ "Uses", "DSSP", "to", "extract", "secondary", "structure", "information", "on", "every", "residue", "." ]
python
train
29.5625
dgovil/PySignal
PySignal.py
https://github.com/dgovil/PySignal/blob/72f4ced949f81e5438bd8f15247ef7890e8cc5ff/PySignal.py#L75-L100
def disconnect(self, slot): """ Disconnects the slot from the signal """ if not callable(slot): return if inspect.ismethod(slot): # If it's a method, then find it by its instance slotSelf = slot.__self__ for s in self._slots: ...
[ "def", "disconnect", "(", "self", ",", "slot", ")", ":", "if", "not", "callable", "(", "slot", ")", ":", "return", "if", "inspect", ".", "ismethod", "(", "slot", ")", ":", "# If it's a method, then find it by its instance", "slotSelf", "=", "slot", ".", "__s...
Disconnects the slot from the signal
[ "Disconnects", "the", "slot", "from", "the", "signal" ]
python
train
35.307692
rosenbrockc/fortpy
fortpy/interop/converter.py
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/converter.py#L432-L445
def convert(self, path, version, target): """Converts the specified source file to a new version number.""" source = self.comparer.get_representation(path) lines = [ '# <fortpy version="{}"></fortpy>\n'.format(version) ] for line in self.comparer.template.contents[version].preamble: ...
[ "def", "convert", "(", "self", ",", "path", ",", "version", ",", "target", ")", ":", "source", "=", "self", ".", "comparer", ".", "get_representation", "(", "path", ")", "lines", "=", "[", "'# <fortpy version=\"{}\"></fortpy>\\n'", ".", "format", "(", "versi...
Converts the specified source file to a new version number.
[ "Converts", "the", "specified", "source", "file", "to", "a", "new", "version", "number", "." ]
python
train
48.785714
bcbio/bcbio-nextgen
bcbio/distributed/objectstore.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/objectstore.py#L281-L294
def parse_remote(cls, filename): """Parses a remote filename into bucket and key information. Handles S3 with optional region name specified in key: BUCKETNAME@REGIONNAME/KEY """ parts = filename.split("//")[-1].split("/", 1) bucket, key = parts if len(parts) == 2 el...
[ "def", "parse_remote", "(", "cls", ",", "filename", ")", ":", "parts", "=", "filename", ".", "split", "(", "\"//\"", ")", "[", "-", "1", "]", ".", "split", "(", "\"/\"", ",", "1", ")", "bucket", ",", "key", "=", "parts", "if", "len", "(", "parts"...
Parses a remote filename into bucket and key information. Handles S3 with optional region name specified in key: BUCKETNAME@REGIONNAME/KEY
[ "Parses", "a", "remote", "filename", "into", "bucket", "and", "key", "information", "." ]
python
train
36.142857
cisco-sas/kitty
kitty/data/data_manager.py
https://github.com/cisco-sas/kitty/blob/cb0760989dcdfe079e43ac574d872d0b18953a32/kitty/data/data_manager.py#L89-L103
def synced(func): ''' Decorator for functions that should be called synchronously from another thread :param func: function to call ''' def wrapper(self, *args, **kwargs): ''' Actual wrapper for the synchronous function ''' task = DataManagerTask(func, *args, **kwar...
[ "def", "synced", "(", "func", ")", ":", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "'''\n Actual wrapper for the synchronous function\n '''", "task", "=", "DataManagerTask", "(", "func", ",", "*", "args", ...
Decorator for functions that should be called synchronously from another thread :param func: function to call
[ "Decorator", "for", "functions", "that", "should", "be", "called", "synchronously", "from", "another", "thread" ]
python
train
26.2
log2timeline/plaso
plaso/cli/status_view.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/cli/status_view.py#L376-L388
def GetAnalysisStatusUpdateCallback(self): """Retrieves the analysis status update callback function. Returns: function: status update callback function or None if not available. """ if self._mode == self.MODE_LINEAR: return self._PrintAnalysisStatusUpdateLinear if self._mode == self.M...
[ "def", "GetAnalysisStatusUpdateCallback", "(", "self", ")", ":", "if", "self", ".", "_mode", "==", "self", ".", "MODE_LINEAR", ":", "return", "self", ".", "_PrintAnalysisStatusUpdateLinear", "if", "self", ".", "_mode", "==", "self", ".", "MODE_WINDOW", ":", "r...
Retrieves the analysis status update callback function. Returns: function: status update callback function or None if not available.
[ "Retrieves", "the", "analysis", "status", "update", "callback", "function", "." ]
python
train
29.769231
eaton-lab/toytree
toytree/Drawing.py
https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/Drawing.py#L352-L421
def assign_edge_colors_and_widths(self): """ Resolve conflict of 'node_color' and 'node_style['fill'] args which are redundant. Default is node_style.fill unless user entered node_color. To enter multiple colors user must use node_color not style fill. Either way, we build a lis...
[ "def", "assign_edge_colors_and_widths", "(", "self", ")", ":", "# node_color overrides fill. Tricky to catch cuz it can be many types.", "# SET edge_widths and POP edge_style.stroke-width", "if", "self", ".", "style", ".", "edge_widths", "is", "None", ":", "if", "not", "self", ...
Resolve conflict of 'node_color' and 'node_style['fill'] args which are redundant. Default is node_style.fill unless user entered node_color. To enter multiple colors user must use node_color not style fill. Either way, we build a list of colors to pass to Drawing.node_colors which is ...
[ "Resolve", "conflict", "of", "node_color", "and", "node_style", "[", "fill", "]", "args", "which", "are", "redundant", ".", "Default", "is", "node_style", ".", "fill", "unless", "user", "entered", "node_color", ".", "To", "enter", "multiple", "colors", "user",...
python
train
51.328571