repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
rstoneback/pysatMagVect
pysatMagVect/_core.py
https://github.com/rstoneback/pysatMagVect/blob/3fdc87ffbe05be58123f80f880d1237c2f34c7be/pysatMagVect/_core.py#L178-L213
def enu_to_ecef_vector(east, north, up, glat, glong): """Converts vector from East, North, Up components to ECEF Position of vector in geospace may be specified in either geocentric or geodetic coordinates, with corresponding expression of the vector using radial or ellipsoidal unit vectors. ...
[ "def", "enu_to_ecef_vector", "(", "east", ",", "north", ",", "up", ",", "glat", ",", "glong", ")", ":", "# convert lat and lon in degrees to radians", "rlat", "=", "np", ".", "radians", "(", "glat", ")", "rlon", "=", "np", ".", "radians", "(", "glong", ")"...
Converts vector from East, North, Up components to ECEF Position of vector in geospace may be specified in either geocentric or geodetic coordinates, with corresponding expression of the vector using radial or ellipsoidal unit vectors. Parameters ---------- east : float or array-like ...
[ "Converts", "vector", "from", "East", "North", "Up", "components", "to", "ECEF", "Position", "of", "vector", "in", "geospace", "may", "be", "specified", "in", "either", "geocentric", "or", "geodetic", "coordinates", "with", "corresponding", "expression", "of", "...
python
train
OpenGov/carpenter
carpenter/blocks/block.py
https://github.com/OpenGov/carpenter/blob/0ab3c54c05133b9b0468c63e834a7ce3a6fb575b/carpenter/blocks/block.py#L99-L110
def copy_numbered_block(self): ''' Copies the block as it was originally specified by start and end into a new table. Additionally inserts the original table indices in the first row of the block. Returns: A copy of the block with no block transformations. ''' ...
[ "def", "copy_numbered_block", "(", "self", ")", ":", "raw_block", "=", "self", ".", "copy_raw_block", "(", ")", "# Inserts the column number in row 0", "raw_block", ".", "insert", "(", "0", ",", "range", "(", "self", ".", "start", "[", "1", "]", ",", "self",...
Copies the block as it was originally specified by start and end into a new table. Additionally inserts the original table indices in the first row of the block. Returns: A copy of the block with no block transformations.
[ "Copies", "the", "block", "as", "it", "was", "originally", "specified", "by", "start", "and", "end", "into", "a", "new", "table", ".", "Additionally", "inserts", "the", "original", "table", "indices", "in", "the", "first", "row", "of", "the", "block", "." ...
python
train
FujiMakoto/AgentML
agentml/parser/tags/var.py
https://github.com/FujiMakoto/AgentML/blob/c8cb64b460d876666bf29ea2c682189874c7c403/agentml/parser/tags/var.py#L28-L55
def value(self): """ Return the current value of a variable """ # Does the variable name have tags to parse? if len(self._element): var = ''.join(map(str, self.trigger.agentml.parse_tags(self._element, self.trigger))) else: var = self._element.text...
[ "def", "value", "(", "self", ")", ":", "# Does the variable name have tags to parse?", "if", "len", "(", "self", ".", "_element", ")", ":", "var", "=", "''", ".", "join", "(", "map", "(", "str", ",", "self", ".", "trigger", ".", "agentml", ".", "parse_ta...
Return the current value of a variable
[ "Return", "the", "current", "value", "of", "a", "variable" ]
python
train
ros-infrastructure/ros_buildfarm
ros_buildfarm/release_job.py
https://github.com/ros-infrastructure/ros_buildfarm/blob/c63ad85b21470f3262086fcd987528a0efc0cf6d/ros_buildfarm/release_job.py#L44-L333
def configure_release_jobs( config_url, rosdistro_name, release_build_name, groovy_script=None, dry_run=False, whitelist_package_names=None): """ Configure all Jenkins release jobs. L{configure_release_job} will be invoked for every released package and target which matches the build fi...
[ "def", "configure_release_jobs", "(", "config_url", ",", "rosdistro_name", ",", "release_build_name", ",", "groovy_script", "=", "None", ",", "dry_run", "=", "False", ",", "whitelist_package_names", "=", "None", ")", ":", "config", "=", "get_config_index", "(", "c...
Configure all Jenkins release jobs. L{configure_release_job} will be invoked for every released package and target which matches the build file criteria. Additionally a job to import Debian packages into the Debian repository is created.
[ "Configure", "all", "Jenkins", "release", "jobs", "." ]
python
valid
PredixDev/predixpy
predix/admin/logstash.py
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/logstash.py#L54-L60
def add_to_manifest(self, manifest): """ Add to the manifest to make sure it is bound to the application. """ manifest.add_service(self.service.name) manifest.write_manifest()
[ "def", "add_to_manifest", "(", "self", ",", "manifest", ")", ":", "manifest", ".", "add_service", "(", "self", ".", "service", ".", "name", ")", "manifest", ".", "write_manifest", "(", ")" ]
Add to the manifest to make sure it is bound to the application.
[ "Add", "to", "the", "manifest", "to", "make", "sure", "it", "is", "bound", "to", "the", "application", "." ]
python
train
hydraplatform/hydra-base
hydra_base/db/model.py
https://github.com/hydraplatform/hydra-base/blob/9251ff7946505f7a272c87837390acd1c435bc6e/hydra_base/db/model.py#L1687-L1692
def permissions(self): """Return a set with all permissions granted to the user.""" perms = set() for r in self.roles: perms = perms | set(r.permissions) return perms
[ "def", "permissions", "(", "self", ")", ":", "perms", "=", "set", "(", ")", "for", "r", "in", "self", ".", "roles", ":", "perms", "=", "perms", "|", "set", "(", "r", ".", "permissions", ")", "return", "perms" ]
Return a set with all permissions granted to the user.
[ "Return", "a", "set", "with", "all", "permissions", "granted", "to", "the", "user", "." ]
python
train
dmsimard/python-cachetclient
contrib/sensu-cachet.py
https://github.com/dmsimard/python-cachetclient/blob/31bbc6d17ba5de088846e1ffae259b6755e672a0/contrib/sensu-cachet.py#L141-L147
def get_component(id): """ Gets a Cachet component by id """ components = cachet.Components(endpoint=ENDPOINT) component = json.loads(components.get(id=id)) return component['data']
[ "def", "get_component", "(", "id", ")", ":", "components", "=", "cachet", ".", "Components", "(", "endpoint", "=", "ENDPOINT", ")", "component", "=", "json", ".", "loads", "(", "components", ".", "get", "(", "id", "=", "id", ")", ")", "return", "compon...
Gets a Cachet component by id
[ "Gets", "a", "Cachet", "component", "by", "id" ]
python
train
astropy/regions
regions/io/core.py
https://github.com/astropy/regions/blob/452d962c417e4ff20d1268f99535c6ff89c83437/regions/io/core.py#L367-L435
def to_fits(self): """ Converts a `~regions.ShapeList` to a `~astropy.table.Table` object. """ max_length_coord = 1 coord_x = [] coord_y = [] shapes = [] radius = [] rotangle_deg = [] components = [] reg_reverse_mapping = {value: ...
[ "def", "to_fits", "(", "self", ")", ":", "max_length_coord", "=", "1", "coord_x", "=", "[", "]", "coord_y", "=", "[", "]", "shapes", "=", "[", "]", "radius", "=", "[", "]", "rotangle_deg", "=", "[", "]", "components", "=", "[", "]", "reg_reverse_mapp...
Converts a `~regions.ShapeList` to a `~astropy.table.Table` object.
[ "Converts", "a", "~regions", ".", "ShapeList", "to", "a", "~astropy", ".", "table", ".", "Table", "object", "." ]
python
train
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/XMLSchema.py
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/XMLSchema.py#L512-L534
def getItemTrace(self): """Returns a node trace up to the <schema> item. """ item, path, name, ref = self, [], 'name', 'ref' while not isinstance(item,XMLSchema) and not isinstance(item,WSDLToolsAdapter): attr = item.getAttribute(name) if not attr: ...
[ "def", "getItemTrace", "(", "self", ")", ":", "item", ",", "path", ",", "name", ",", "ref", "=", "self", ",", "[", "]", ",", "'name'", ",", "'ref'", "while", "not", "isinstance", "(", "item", ",", "XMLSchema", ")", "and", "not", "isinstance", "(", ...
Returns a node trace up to the <schema> item.
[ "Returns", "a", "node", "trace", "up", "to", "the", "<schema", ">", "item", "." ]
python
train
listen-lavender/webcrawl
webcrawl/prettyprint.py
https://github.com/listen-lavender/webcrawl/blob/905dcfa6e6934aac764045660c0efcef28eae1e6/webcrawl/prettyprint.py#L185-L236
def fileprint(filename, category, level=logging.DEBUG, maxBytes=1024*10124*100, backupCount=0): """ Print files by file size. filename string, file name category string, category path of logs file in log directory level enumerated type of l...
[ "def", "fileprint", "(", "filename", ",", "category", ",", "level", "=", "logging", ".", "DEBUG", ",", "maxBytes", "=", "1024", "*", "10124", "*", "100", ",", "backupCount", "=", "0", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "CFG...
Print files by file size. filename string, file name category string, category path of logs file in log directory level enumerated type of logging module, restrict whether logs to be printed or not maxBytes int, max limit of file size back...
[ "Print", "files", "by", "file", "size", "." ]
python
train
Guake/guake
guake/prefs.py
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/prefs.py#L1375-L1436
def on_accel_edited(self, cellrendereraccel, path, key, mods, hwcode): """Callback that handles key edition in cellrenderer. It makes some tests to validate the key, like looking for already in use keys and look for [A-Z][a-z][0-9] to avoid problems with these common keys. If all tests a...
[ "def", "on_accel_edited", "(", "self", ",", "cellrendereraccel", ",", "path", ",", "key", ",", "mods", ",", "hwcode", ")", ":", "accelerator", "=", "Gtk", ".", "accelerator_name", "(", "key", ",", "mods", ")", "dconf_path", "=", "self", ".", "store", "["...
Callback that handles key edition in cellrenderer. It makes some tests to validate the key, like looking for already in use keys and look for [A-Z][a-z][0-9] to avoid problems with these common keys. If all tests are ok, the value will be stored in dconf.
[ "Callback", "that", "handles", "key", "edition", "in", "cellrenderer", ".", "It", "makes", "some", "tests", "to", "validate", "the", "key", "like", "looking", "for", "already", "in", "use", "keys", "and", "look", "for", "[", "A", "-", "Z", "]", "[", "a...
python
train
sassoo/goldman
goldman/stores/postgres/store.py
https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/stores/postgres/store.py#L126-L143
def field_cols(model): """ Get the models columns in a friendly SQL format This will be a string of comma separated field names prefixed by the models resource type. TIP: to_manys are not located on the table in Postgres & are instead application references, so any referen...
[ "def", "field_cols", "(", "model", ")", ":", "to_many", "=", "model", ".", "to_many", "cols", "=", "[", "f", "for", "f", "in", "model", ".", "all_fields", "if", "f", "not", "in", "to_many", "]", "cols", "=", "', '", ".", "join", "(", "cols", ")", ...
Get the models columns in a friendly SQL format This will be a string of comma separated field names prefixed by the models resource type. TIP: to_manys are not located on the table in Postgres & are instead application references, so any reference to there column nam...
[ "Get", "the", "models", "columns", "in", "a", "friendly", "SQL", "format" ]
python
train
taborlab/FlowCal
FlowCal/plot.py
https://github.com/taborlab/FlowCal/blob/031a7af82acb1d46879a8e384a1a00f27f0bdc7a/FlowCal/plot.py#L706-L731
def limit_range_for_scale(self, vmin, vmax, minpos): """ Return minimum and maximum bounds for the logicle axis. Parameters ---------- vmin : float Minimum data value. vmax : float Maximum data value. minpos : float Minimum pos...
[ "def", "limit_range_for_scale", "(", "self", ",", "vmin", ",", "vmax", ",", "minpos", ")", ":", "vmin_bound", "=", "self", ".", "_transform", ".", "transform_non_affine", "(", "0", ")", "vmax_bound", "=", "self", ".", "_transform", ".", "transform_non_affine",...
Return minimum and maximum bounds for the logicle axis. Parameters ---------- vmin : float Minimum data value. vmax : float Maximum data value. minpos : float Minimum positive value in the data. Ignored by this function. Return ...
[ "Return", "minimum", "and", "maximum", "bounds", "for", "the", "logicle", "axis", "." ]
python
train
petl-developers/petl
petl/transform/setops.py
https://github.com/petl-developers/petl/blob/1d33ca055f7e04e0d28a772041c9fd30c8d415d6/petl/transform/setops.py#L430-L447
def hashcomplement(a, b, strict=False): """ Alternative implementation of :func:`petl.transform.setops.complement`, where the complement is executed by constructing an in-memory set for all rows found in the right hand table, then iterating over rows from the left hand table. May be faster and/...
[ "def", "hashcomplement", "(", "a", ",", "b", ",", "strict", "=", "False", ")", ":", "return", "HashComplementView", "(", "a", ",", "b", ",", "strict", "=", "strict", ")" ]
Alternative implementation of :func:`petl.transform.setops.complement`, where the complement is executed by constructing an in-memory set for all rows found in the right hand table, then iterating over rows from the left hand table. May be faster and/or more resource efficient where the right table is ...
[ "Alternative", "implementation", "of", ":", "func", ":", "petl", ".", "transform", ".", "setops", ".", "complement", "where", "the", "complement", "is", "executed", "by", "constructing", "an", "in", "-", "memory", "set", "for", "all", "rows", "found", "in", ...
python
train
saltstack/salt
salt/modules/boto_elasticsearch_domain.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elasticsearch_domain.py#L184-L210
def describe(DomainName, region=None, key=None, keyid=None, profile=None): ''' Given a domain name describe its properties. Returns a dictionary of interesting properties. CLI Example: .. code-block:: bash salt myminion boto_elasticsearch_domain.describe mydomain ''' ...
[ "def", "describe", "(", "DomainName", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "conn", "=", "_get_conn", "(", "region", "=", "region", ",", "key", "=", "key", ",", "keyid...
Given a domain name describe its properties. Returns a dictionary of interesting properties. CLI Example: .. code-block:: bash salt myminion boto_elasticsearch_domain.describe mydomain
[ "Given", "a", "domain", "name", "describe", "its", "properties", "." ]
python
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/ipk.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/ipk.py#L35-L79
def package(env, target, source, PACKAGEROOT, NAME, VERSION, DESCRIPTION, SUMMARY, X_IPK_PRIORITY, X_IPK_SECTION, SOURCE_URL, X_IPK_MAINTAINER, X_IPK_DEPENDS, **kw): """ This function prepares the packageroot directory for packaging with the ipkg builder. """ SCons.Tool.Tool('ipk...
[ "def", "package", "(", "env", ",", "target", ",", "source", ",", "PACKAGEROOT", ",", "NAME", ",", "VERSION", ",", "DESCRIPTION", ",", "SUMMARY", ",", "X_IPK_PRIORITY", ",", "X_IPK_SECTION", ",", "SOURCE_URL", ",", "X_IPK_MAINTAINER", ",", "X_IPK_DEPENDS", ",",...
This function prepares the packageroot directory for packaging with the ipkg builder.
[ "This", "function", "prepares", "the", "packageroot", "directory", "for", "packaging", "with", "the", "ipkg", "builder", "." ]
python
train
f213/rumetr-client
rumetr/roometr.py
https://github.com/f213/rumetr-client/blob/5180152bcb2eed8246b88035db7c0bb1fe603166/rumetr/roometr.py#L252-L267
def update_appt(self, complex: str, house: str, price: str, square: str, id: str, **kwargs): """ Update existing appartment """ self.check_house(complex, house) kwargs['price'] = self._format_decimal(price) kwargs['square'] = self._format_decimal(square) self.pu...
[ "def", "update_appt", "(", "self", ",", "complex", ":", "str", ",", "house", ":", "str", ",", "price", ":", "str", ",", "square", ":", "str", ",", "id", ":", "str", ",", "*", "*", "kwargs", ")", ":", "self", ".", "check_house", "(", "complex", ",...
Update existing appartment
[ "Update", "existing", "appartment" ]
python
train
santosjorge/cufflinks
cufflinks/tools.py
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/tools.py#L54-L67
def getTheme(theme=None): """ Returns a theme definition. To see the colors translated (hex) use cufflinks.getLayout(theme) instead. """ if not theme: theme = auth.get_config_file()['theme'] if theme in THEMES: return updateColors(copy.deepcopy(THEMES[theme])) else: raise Exception("Invalid Theme: {0}"....
[ "def", "getTheme", "(", "theme", "=", "None", ")", ":", "if", "not", "theme", ":", "theme", "=", "auth", ".", "get_config_file", "(", ")", "[", "'theme'", "]", "if", "theme", "in", "THEMES", ":", "return", "updateColors", "(", "copy", ".", "deepcopy", ...
Returns a theme definition. To see the colors translated (hex) use cufflinks.getLayout(theme) instead.
[ "Returns", "a", "theme", "definition", "." ]
python
train
isislovecruft/python-gnupg
pretty_bad_protocol/_meta.py
https://github.com/isislovecruft/python-gnupg/blob/784571449032e811587249743e183fc5e908a673/pretty_bad_protocol/_meta.py#L82-L139
def _find_agent(cls): """Discover if a gpg-agent process for the current euid is running. If there is a matching gpg-agent process, set a :class:`psutil.Process` instance containing the gpg-agent process' information to ``cls._agent_proc``. For Unix systems, we check that the e...
[ "def", "_find_agent", "(", "cls", ")", ":", "if", "not", "psutil", ":", "return", "False", "this_process", "=", "psutil", ".", "Process", "(", "os", ".", "getpid", "(", ")", ")", "ownership_match", "=", "False", "if", "_util", ".", "_running_windows", ":...
Discover if a gpg-agent process for the current euid is running. If there is a matching gpg-agent process, set a :class:`psutil.Process` instance containing the gpg-agent process' information to ``cls._agent_proc``. For Unix systems, we check that the effective UID of this ``py...
[ "Discover", "if", "a", "gpg", "-", "agent", "process", "for", "the", "current", "euid", "is", "running", "." ]
python
train
stxnext/mappet
mappet/helpers.py
https://github.com/stxnext/mappet/blob/ac7468ac28ed82e45065b1e348cf865c8f73f0db/mappet/helpers.py#L215-L275
def dict_to_etree(d, root): u"""Converts a dict to lxml.etree object. >>> dict_to_etree({'root': {'#text': 'node_text', '@attr': 'val'}}, etree.Element('root')) # doctest: +ELLIPSIS <Element root at 0x...> :param dict d: dict representing the XML tree :param etree.Element root: XML node which will...
[ "def", "dict_to_etree", "(", "d", ",", "root", ")", ":", "def", "_to_etree", "(", "d", ",", "node", ")", ":", "if", "d", "is", "None", "or", "len", "(", "d", ")", "==", "0", ":", "return", "elif", "isinstance", "(", "d", ",", "basestring", ")", ...
u"""Converts a dict to lxml.etree object. >>> dict_to_etree({'root': {'#text': 'node_text', '@attr': 'val'}}, etree.Element('root')) # doctest: +ELLIPSIS <Element root at 0x...> :param dict d: dict representing the XML tree :param etree.Element root: XML node which will be assigned the resulting tree ...
[ "u", "Converts", "a", "dict", "to", "lxml", ".", "etree", "object", "." ]
python
train
google/mobly
mobly/controllers/android_device_lib/services/snippet_management_service.py
https://github.com/google/mobly/blob/38ba2cf7d29a20e6a2fca1718eecb337df38db26/mobly/controllers/android_device_lib/services/snippet_management_service.py#L139-L150
def resume(self): """Resumes all paused snippet clients.""" for client in self._snippet_clients.values(): # Resume is only applicable if a client is alive and does not have # a host port. if client.is_alive and client.host_port is None: self._device.lo...
[ "def", "resume", "(", "self", ")", ":", "for", "client", "in", "self", ".", "_snippet_clients", ".", "values", "(", ")", ":", "# Resume is only applicable if a client is alive and does not have", "# a host port.", "if", "client", ".", "is_alive", "and", "client", "....
Resumes all paused snippet clients.
[ "Resumes", "all", "paused", "snippet", "clients", "." ]
python
train
Alignak-monitoring/alignak
alignak/worker.py
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/worker.py#L343-L360
def check_for_system_time_change(self): # pragma: no cover, hardly testable with unit tests... """Check if our system time change. If so, change our :return: 0 if the difference < 900, difference else :rtype: int """ now = time.time() difference = now - self.t_each_loop...
[ "def", "check_for_system_time_change", "(", "self", ")", ":", "# pragma: no cover, hardly testable with unit tests...", "now", "=", "time", ".", "time", "(", ")", "difference", "=", "now", "-", "self", ".", "t_each_loop", "# Now set the new value for the tick loop", "self...
Check if our system time change. If so, change our :return: 0 if the difference < 900, difference else :rtype: int
[ "Check", "if", "our", "system", "time", "change", ".", "If", "so", "change", "our" ]
python
train
tensorflow/cleverhans
examples/nips17_adversarial_competition/eval_infra/code/eval_lib/work_data.py
https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/examples/nips17_adversarial_competition/eval_infra/code/eval_lib/work_data.py#L150-L168
def write_all_to_datastore(self): """Writes all work pieces into datastore. Each work piece is identified by ID. This method writes/updates only those work pieces which IDs are stored in this class. For examples, if this class has only work pieces with IDs '1' ... '100' and datastore already contains ...
[ "def", "write_all_to_datastore", "(", "self", ")", ":", "client", "=", "self", ".", "_datastore_client", "with", "client", ".", "no_transact_batch", "(", ")", "as", "batch", ":", "parent_key", "=", "client", ".", "key", "(", "KIND_WORK_TYPE", ",", "self", "....
Writes all work pieces into datastore. Each work piece is identified by ID. This method writes/updates only those work pieces which IDs are stored in this class. For examples, if this class has only work pieces with IDs '1' ... '100' and datastore already contains work pieces with IDs '50' ... '200' t...
[ "Writes", "all", "work", "pieces", "into", "datastore", "." ]
python
train
capitalone/giraffez
giraffez/export.py
https://github.com/capitalone/giraffez/blob/6b4d27eb1a1eaf188c6885c7364ef27e92b1b957/giraffez/export.py#L110-L149
def query(self, query): """ Set the query to be run and initiate the connection with Teradata. Only necessary if the query/table name was not specified as an argument to the constructor of the instance. :param str query: Valid SQL query to be executed """ if quer...
[ "def", "query", "(", "self", ",", "query", ")", ":", "if", "query", "is", "None", ":", "return", "if", "log", ".", "level", ">=", "VERBOSE", ":", "self", ".", "options", "(", "\"query\"", ",", "query", ",", "6", ")", "else", ":", "self", ".", "op...
Set the query to be run and initiate the connection with Teradata. Only necessary if the query/table name was not specified as an argument to the constructor of the instance. :param str query: Valid SQL query to be executed
[ "Set", "the", "query", "to", "be", "run", "and", "initiate", "the", "connection", "with", "Teradata", ".", "Only", "necessary", "if", "the", "query", "/", "table", "name", "was", "not", "specified", "as", "an", "argument", "to", "the", "constructor", "of",...
python
test
mozilla/amo-validator
validator/errorbundler.py
https://github.com/mozilla/amo-validator/blob/0251bfbd7d93106e01ecdb6de5fcd1dc1a180664/validator/errorbundler.py#L514-L526
def _compare_version(self, requirements, support): """ Return whether there is an intersection between a support applications GUID set and a set of supported applications. """ for guid in requirements: # If we support any of the GUIDs in the guid_set, test if any of ...
[ "def", "_compare_version", "(", "self", ",", "requirements", ",", "support", ")", ":", "for", "guid", "in", "requirements", ":", "# If we support any of the GUIDs in the guid_set, test if any of", "# the provided versions for the GUID are supported.", "if", "(", "guid", "in",...
Return whether there is an intersection between a support applications GUID set and a set of supported applications.
[ "Return", "whether", "there", "is", "an", "intersection", "between", "a", "support", "applications", "GUID", "set", "and", "a", "set", "of", "supported", "applications", "." ]
python
train
SiLab-Bonn/basil
examples/mio_pixel/pixel.py
https://github.com/SiLab-Bonn/basil/blob/99052482d9334dd1f5598eb2d2fb4d5399a32291/examples/mio_pixel/pixel.py#L70-L84
def _run_seq(self, size): """ Send the contents of self['SEQ'] to the chip and wait until it finishes. """ # Write the sequence to the sequence generator (hw driver) self['SEQ'].write(size) # write pattern to memory self['SEQ'].set_size(size) # set size self[...
[ "def", "_run_seq", "(", "self", ",", "size", ")", ":", "# Write the sequence to the sequence generator (hw driver)", "self", "[", "'SEQ'", "]", ".", "write", "(", "size", ")", "# write pattern to memory", "self", "[", "'SEQ'", "]", ".", "set_size", "(", "size", ...
Send the contents of self['SEQ'] to the chip and wait until it finishes.
[ "Send", "the", "contents", "of", "self", "[", "SEQ", "]", "to", "the", "chip", "and", "wait", "until", "it", "finishes", "." ]
python
train
clalancette/pycdlib
pycdlib/pycdlib.py
https://github.com/clalancette/pycdlib/blob/1e7b77a809e905d67dc71e12d70e850be26b6233/pycdlib/pycdlib.py#L4885-L5005
def rm_directory(self, iso_path=None, rr_name=None, joliet_path=None, udf_path=None): # type: (Optional[str], Optional[str], Optional[str], Optional[str]) -> None ''' Remove a directory from the ISO. Parameters: iso_path - The path to the directory to remove. rr_name -...
[ "def", "rm_directory", "(", "self", ",", "iso_path", "=", "None", ",", "rr_name", "=", "None", ",", "joliet_path", "=", "None", ",", "udf_path", "=", "None", ")", ":", "# type: (Optional[str], Optional[str], Optional[str], Optional[str]) -> None", "if", "not", "self...
Remove a directory from the ISO. Parameters: iso_path - The path to the directory to remove. rr_name - The Rock Ridge name of the directory to remove. joliet_path - The Joliet path to the directory to remove. udf_path - The UDF absolute path to the directory to remove. ...
[ "Remove", "a", "directory", "from", "the", "ISO", "." ]
python
train
jazzband/sorl-thumbnail
sorl/thumbnail/templatetags/thumbnail.py
https://github.com/jazzband/sorl-thumbnail/blob/22ccd9781462a820f963f57018ad3dcef85053ed/sorl/thumbnail/templatetags/thumbnail.py#L171-L190
def resolution(file_, resolution_string): """ A filter to return the URL for the provided resolution of the thumbnail. """ if sorl_settings.THUMBNAIL_DUMMY: dummy_source = sorl_settings.THUMBNAIL_DUMMY_SOURCE source = dummy_source.replace('%(width)s', '(?P<width>[0-9]+)') source ...
[ "def", "resolution", "(", "file_", ",", "resolution_string", ")", ":", "if", "sorl_settings", ".", "THUMBNAIL_DUMMY", ":", "dummy_source", "=", "sorl_settings", ".", "THUMBNAIL_DUMMY_SOURCE", "source", "=", "dummy_source", ".", "replace", "(", "'%(width)s'", ",", ...
A filter to return the URL for the provided resolution of the thumbnail.
[ "A", "filter", "to", "return", "the", "URL", "for", "the", "provided", "resolution", "of", "the", "thumbnail", "." ]
python
train
letuananh/chirptext
chirptext/chio.py
https://github.com/letuananh/chirptext/blob/ce60b47257b272a587c8703ea1f86cd1a45553a7/chirptext/chio.py#L96-L121
def write_file(path, content, mode=None, encoding='utf-8'): ''' Write content to a file. If the path ends with .gz, gzip will be used. ''' if not mode: if isinstance(content, bytes): mode = 'wb' else: mode = 'wt' if not path: raise ValueError("Output path is i...
[ "def", "write_file", "(", "path", ",", "content", ",", "mode", "=", "None", ",", "encoding", "=", "'utf-8'", ")", ":", "if", "not", "mode", ":", "if", "isinstance", "(", "content", ",", "bytes", ")", ":", "mode", "=", "'wb'", "else", ":", "mode", "...
Write content to a file. If the path ends with .gz, gzip will be used.
[ "Write", "content", "to", "a", "file", ".", "If", "the", "path", "ends", "with", ".", "gz", "gzip", "will", "be", "used", "." ]
python
train
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_0/notification/notification_client.py
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_0/notification/notification_client.py#L140-L151
def update_settings(self, update_parameters): """UpdateSettings. [Preview API] :param :class:`<NotificationAdminSettingsUpdateParameters> <azure.devops.v5_0.notification.models.NotificationAdminSettingsUpdateParameters>` update_parameters: :rtype: :class:`<NotificationAdminSettings> <azu...
[ "def", "update_settings", "(", "self", ",", "update_parameters", ")", ":", "content", "=", "self", ".", "_serialize", ".", "body", "(", "update_parameters", ",", "'NotificationAdminSettingsUpdateParameters'", ")", "response", "=", "self", ".", "_send", "(", "http_...
UpdateSettings. [Preview API] :param :class:`<NotificationAdminSettingsUpdateParameters> <azure.devops.v5_0.notification.models.NotificationAdminSettingsUpdateParameters>` update_parameters: :rtype: :class:`<NotificationAdminSettings> <azure.devops.v5_0.notification.models.NotificationAdminSetti...
[ "UpdateSettings", ".", "[", "Preview", "API", "]", ":", "param", ":", "class", ":", "<NotificationAdminSettingsUpdateParameters", ">", "<azure", ".", "devops", ".", "v5_0", ".", "notification", ".", "models", ".", "NotificationAdminSettingsUpdateParameters", ">", "u...
python
train
DataDog/integrations-core
datadog_checks_base/datadog_checks/base/checks/prometheus/mixins.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/checks/prometheus/mixins.py#L633-L662
def _submit_gauges_from_summary(self, name, metric, custom_tags=None, hostname=None): """ Extracts metrics from a prometheus summary metric and sends them as gauges """ if custom_tags is None: custom_tags = [] # summaries do not have a value attribute val = ge...
[ "def", "_submit_gauges_from_summary", "(", "self", ",", "name", ",", "metric", ",", "custom_tags", "=", "None", ",", "hostname", "=", "None", ")", ":", "if", "custom_tags", "is", "None", ":", "custom_tags", "=", "[", "]", "# summaries do not have a value attribu...
Extracts metrics from a prometheus summary metric and sends them as gauges
[ "Extracts", "metrics", "from", "a", "prometheus", "summary", "metric", "and", "sends", "them", "as", "gauges" ]
python
train
saltstack/salt
salt/modules/logadm.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/logadm.py#L182-L217
def list_conf(conf_file=default_conf, log_file=None, include_unset=False): ''' Show parsed configuration .. versionadded:: 2018.3.0 conf_file : string path to logadm.conf, defaults to /etc/logadm.conf log_file : string optional show only one log file include_unset : boolean ...
[ "def", "list_conf", "(", "conf_file", "=", "default_conf", ",", "log_file", "=", "None", ",", "include_unset", "=", "False", ")", ":", "cfg", "=", "_parse_conf", "(", "conf_file", ")", "cfg_parsed", "=", "{", "}", "## parse all options", "for", "entry", "in"...
Show parsed configuration .. versionadded:: 2018.3.0 conf_file : string path to logadm.conf, defaults to /etc/logadm.conf log_file : string optional show only one log file include_unset : boolean include unset flags in output CLI Example: .. code-block:: bash ...
[ "Show", "parsed", "configuration" ]
python
train
klen/graphite-beacon
graphite_beacon/core.py
https://github.com/klen/graphite-beacon/blob/c1f071e9f557693bc90f6acbc314994985dc3b77/graphite_beacon/core.py#L173-L182
def notify(self, level, alert, value, target=None, ntype=None, rule=None): """ Provide the event to the handlers. """ LOGGER.info('Notify %s:%s:%s:%s', level, alert, value, target or "") if ntype is None: ntype = alert.source for handler in self.handlers.get(level, []): ...
[ "def", "notify", "(", "self", ",", "level", ",", "alert", ",", "value", ",", "target", "=", "None", ",", "ntype", "=", "None", ",", "rule", "=", "None", ")", ":", "LOGGER", ".", "info", "(", "'Notify %s:%s:%s:%s'", ",", "level", ",", "alert", ",", ...
Provide the event to the handlers.
[ "Provide", "the", "event", "to", "the", "handlers", "." ]
python
train
openid/python-openid
openid/association.py
https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/association.py#L423-L453
def deserialize(cls, assoc_s): """ Parse an association as stored by serialize(). inverse of serialize @param assoc_s: Association as serialized by serialize() @type assoc_s: str @return: instance of this class """ pairs = kvform.kvToSeq(assoc_s, str...
[ "def", "deserialize", "(", "cls", ",", "assoc_s", ")", ":", "pairs", "=", "kvform", ".", "kvToSeq", "(", "assoc_s", ",", "strict", "=", "True", ")", "keys", "=", "[", "]", "values", "=", "[", "]", "for", "k", ",", "v", "in", "pairs", ":", "keys",...
Parse an association as stored by serialize(). inverse of serialize @param assoc_s: Association as serialized by serialize() @type assoc_s: str @return: instance of this class
[ "Parse", "an", "association", "as", "stored", "by", "serialize", "()", "." ]
python
train
cloudsigma/cgroupspy
cgroupspy/nodes.py
https://github.com/cloudsigma/cgroupspy/blob/e705ac4ccdfe33d8ecc700e9a35a9556084449ca/cgroupspy/nodes.py#L166-L176
def delete_empty_children(self): """ Walk through the children of this node and delete any that are empty. """ for child in self.children: child.delete_empty_children() try: if os.path.exists(child.full_path): os.rmdir(child.ful...
[ "def", "delete_empty_children", "(", "self", ")", ":", "for", "child", "in", "self", ".", "children", ":", "child", ".", "delete_empty_children", "(", ")", "try", ":", "if", "os", ".", "path", ".", "exists", "(", "child", ".", "full_path", ")", ":", "o...
Walk through the children of this node and delete any that are empty.
[ "Walk", "through", "the", "children", "of", "this", "node", "and", "delete", "any", "that", "are", "empty", "." ]
python
train
zerotk/easyfs
zerotk/easyfs/_easyfs.py
https://github.com/zerotk/easyfs/blob/140923db51fb91d5a5847ad17412e8bce51ba3da/zerotk/easyfs/_easyfs.py#L780-L795
def MoveFile(source_filename, target_filename): ''' Moves a file. :param unicode source_filename: :param unicode target_filename: :raises NotImplementedForRemotePathError: If trying to operate with non-local files. ''' _AssertIsLocal(source_filename) _AssertIsLocal(target_file...
[ "def", "MoveFile", "(", "source_filename", ",", "target_filename", ")", ":", "_AssertIsLocal", "(", "source_filename", ")", "_AssertIsLocal", "(", "target_filename", ")", "import", "shutil", "shutil", ".", "move", "(", "source_filename", ",", "target_filename", ")" ...
Moves a file. :param unicode source_filename: :param unicode target_filename: :raises NotImplementedForRemotePathError: If trying to operate with non-local files.
[ "Moves", "a", "file", "." ]
python
valid
ajenhl/tacl
tacl/sequence.py
https://github.com/ajenhl/tacl/blob/b8a343248e77f1c07a5a4ac133a9ad6e0b4781c2/tacl/sequence.py#L293-L310
def _is_inside(self, span1, span2, covered_spans): """Returns True if both `span1` and `span2` fall within `covered_spans`. :param span1: start and end indices of a span :type span1: 2-`tuple` of `int` :param span2: start and end indices of a span :type span2: 2-`tuple` ...
[ "def", "_is_inside", "(", "self", ",", "span1", ",", "span2", ",", "covered_spans", ")", ":", "if", "self", ".", "_is_span_inside", "(", "span1", ",", "covered_spans", "[", "0", "]", ")", "and", "self", ".", "_is_span_inside", "(", "span2", ",", "covered...
Returns True if both `span1` and `span2` fall within `covered_spans`. :param span1: start and end indices of a span :type span1: 2-`tuple` of `int` :param span2: start and end indices of a span :type span2: 2-`tuple` of `int` :param covered_spans: lists of start and end ...
[ "Returns", "True", "if", "both", "span1", "and", "span2", "fall", "within", "covered_spans", "." ]
python
train
recurly/recurly-client-python
recurly/__init__.py
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/__init__.py#L912-L924
def enter_offline_payment(self, transaction): """ Records an offline (external) payment on the invoice. Pass in a Transaction object to set the details of the created transaction. The attributes available to set are (payment_method, collected_at, amount_in_cents, description) ...
[ "def", "enter_offline_payment", "(", "self", ",", "transaction", ")", ":", "url", "=", "urljoin", "(", "self", ".", "_url", ",", "'/transactions'", ")", "transaction", ".", "post", "(", "url", ")", "return", "transaction" ]
Records an offline (external) payment on the invoice. Pass in a Transaction object to set the details of the created transaction. The attributes available to set are (payment_method, collected_at, amount_in_cents, description) Returns: Transaction: The created transaction
[ "Records", "an", "offline", "(", "external", ")", "payment", "on", "the", "invoice", ".", "Pass", "in", "a", "Transaction", "object", "to", "set", "the", "details", "of", "the", "created", "transaction", ".", "The", "attributes", "available", "to", "set", ...
python
train
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/ietf_netconf_notifications.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/ietf_netconf_notifications.py#L39-L51
def netconf_config_change_changed_by_server_or_user_by_user_session_id(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") netconf_config_change = ET.SubElement(config, "netconf-config-change", xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-notifications") ...
[ "def", "netconf_config_change_changed_by_server_or_user_by_user_session_id", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "netconf_config_change", "=", "ET", ".", "SubElement", "(", "config", ",", "\"...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/blacklist.py
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/blacklist.py#L80-L98
def run(self, *args): """List, add or delete entries from the blacklist. By default, it prints the list of entries available on the blacklist. """ params = self.parser.parse_args(args) entry = params.entry if params.add: code = self.add(entry) ...
[ "def", "run", "(", "self", ",", "*", "args", ")", ":", "params", "=", "self", ".", "parser", ".", "parse_args", "(", "args", ")", "entry", "=", "params", ".", "entry", "if", "params", ".", "add", ":", "code", "=", "self", ".", "add", "(", "entry"...
List, add or delete entries from the blacklist. By default, it prints the list of entries available on the blacklist.
[ "List", "add", "or", "delete", "entries", "from", "the", "blacklist", "." ]
python
train
nok/sklearn-porter
sklearn_porter/estimator/classifier/LinearSVC/__init__.py
https://github.com/nok/sklearn-porter/blob/04673f768310bde31f9747a68a5e070592441ef2/sklearn_porter/estimator/classifier/LinearSVC/__init__.py#L251-L266
def create_class(self): """ Build the estimator class. Returns ------- :return : string The built class as string. """ if self.target_language in ['java', 'go']: n_indents = 1 if self.target_language == 'java' else 0 class_head...
[ "def", "create_class", "(", "self", ")", ":", "if", "self", ".", "target_language", "in", "[", "'java'", ",", "'go'", "]", ":", "n_indents", "=", "1", "if", "self", ".", "target_language", "==", "'java'", "else", "0", "class_head_temp", "=", "self", ".",...
Build the estimator class. Returns ------- :return : string The built class as string.
[ "Build", "the", "estimator", "class", "." ]
python
train
cebel/pyuniprot
src/pyuniprot/manager/query.py
https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L982-L988
def tissues_in_references(self): """Distinct tissues (``tissue`` in :class:`.models.TissueInReference`) :return: all distinct tissues in references :rtype: list[str] """ return [x[0] for x in self.session.query(models.TissueInReference.tissue).all()]
[ "def", "tissues_in_references", "(", "self", ")", ":", "return", "[", "x", "[", "0", "]", "for", "x", "in", "self", ".", "session", ".", "query", "(", "models", ".", "TissueInReference", ".", "tissue", ")", ".", "all", "(", ")", "]" ]
Distinct tissues (``tissue`` in :class:`.models.TissueInReference`) :return: all distinct tissues in references :rtype: list[str]
[ "Distinct", "tissues", "(", "tissue", "in", ":", "class", ":", ".", "models", ".", "TissueInReference", ")" ]
python
train
materialsproject/pymatgen
pymatgen/io/abinit/flows.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/flows.py#L627-L631
def node_from_nid(self, nid): """Return the node in the `Flow` with the given `nid` identifier""" for node in self.iflat_nodes(): if node.node_id == nid: return node raise ValueError("Cannot find node with node id: %s" % nid)
[ "def", "node_from_nid", "(", "self", ",", "nid", ")", ":", "for", "node", "in", "self", ".", "iflat_nodes", "(", ")", ":", "if", "node", ".", "node_id", "==", "nid", ":", "return", "node", "raise", "ValueError", "(", "\"Cannot find node with node id: %s\"", ...
Return the node in the `Flow` with the given `nid` identifier
[ "Return", "the", "node", "in", "the", "Flow", "with", "the", "given", "nid", "identifier" ]
python
train
allenai/allennlp
allennlp/models/semantic_parsing/wikitables/wikitables_semantic_parser.py
https://github.com/allenai/allennlp/blob/648a36f77db7e45784c047176074f98534c76636/allennlp/models/semantic_parsing/wikitables/wikitables_semantic_parser.py#L140-L296
def _get_initial_rnn_and_grammar_state(self, question: Dict[str, torch.LongTensor], table: Dict[str, torch.LongTensor], world: List[WikiTablesWorld], ...
[ "def", "_get_initial_rnn_and_grammar_state", "(", "self", ",", "question", ":", "Dict", "[", "str", ",", "torch", ".", "LongTensor", "]", ",", "table", ":", "Dict", "[", "str", ",", "torch", ".", "LongTensor", "]", ",", "world", ":", "List", "[", "WikiTa...
Encodes the question and table, computes a linking between the two, and constructs an initial RnnStatelet and LambdaGrammarStatelet for each batch instance to pass to the decoder. We take ``outputs`` as a parameter here and `modify` it, adding things that we want to visualize in a demo.
[ "Encodes", "the", "question", "and", "table", "computes", "a", "linking", "between", "the", "two", "and", "constructs", "an", "initial", "RnnStatelet", "and", "LambdaGrammarStatelet", "for", "each", "batch", "instance", "to", "pass", "to", "the", "decoder", "." ...
python
train
django-treebeard/django-treebeard
treebeard/ns_tree.py
https://github.com/django-treebeard/django-treebeard/blob/8042ee939cb45394909237da447f8925e3cc6aa3/treebeard/ns_tree.py#L491-L525
def load_bulk(cls, bulk_data, parent=None, keep_ids=False): """Loads a list/dictionary structure to the tree.""" cls = get_result_class(cls) # tree, iterative preorder added = [] if parent: parent_id = parent.pk else: parent_id = None # s...
[ "def", "load_bulk", "(", "cls", ",", "bulk_data", ",", "parent", "=", "None", ",", "keep_ids", "=", "False", ")", ":", "cls", "=", "get_result_class", "(", "cls", ")", "# tree, iterative preorder", "added", "=", "[", "]", "if", "parent", ":", "parent_id", ...
Loads a list/dictionary structure to the tree.
[ "Loads", "a", "list", "/", "dictionary", "structure", "to", "the", "tree", "." ]
python
train
shoebot/shoebot
lib/cornu/__init__.py
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/cornu/__init__.py#L290-L349
def draw_cornu_bezier(x0, y0, t0, t1, s0, c0, flip, cs, ss, cmd, scale, rot): """ Mark Meyer's code draws elegant CURVETO segments. """ s = None for j in range(0, 5): # travel along the function two points at a time (at time t and t2) # the first time through we'll need to get both poi...
[ "def", "draw_cornu_bezier", "(", "x0", ",", "y0", ",", "t0", ",", "t1", ",", "s0", ",", "c0", ",", "flip", ",", "cs", ",", "ss", ",", "cmd", ",", "scale", ",", "rot", ")", ":", "s", "=", "None", "for", "j", "in", "range", "(", "0", ",", "5"...
Mark Meyer's code draws elegant CURVETO segments.
[ "Mark", "Meyer", "s", "code", "draws", "elegant", "CURVETO", "segments", "." ]
python
valid
pymc-devs/pymc
pymc/database/hdf5.py
https://github.com/pymc-devs/pymc/blob/c6e530210bff4c0d7189b35b2c971bc53f93f7cd/pymc/database/hdf5.py#L558-L581
def add_attr(self, name, object, description='', chain=-1, array=False): """Add an attribute to the chain. description may not be supported for every date type. if array is true, create an Array object. """ if not np.isscalar(chain): raise TypeError("chain must be a...
[ "def", "add_attr", "(", "self", ",", "name", ",", "object", ",", "description", "=", "''", ",", "chain", "=", "-", "1", ",", "array", "=", "False", ")", ":", "if", "not", "np", ".", "isscalar", "(", "chain", ")", ":", "raise", "TypeError", "(", "...
Add an attribute to the chain. description may not be supported for every date type. if array is true, create an Array object.
[ "Add", "an", "attribute", "to", "the", "chain", "." ]
python
train
collab-project/django-admin-footer
admin_footer/__init__.py
https://github.com/collab-project/django-admin-footer/blob/55d5b7a4b168fa56f39664091af06820236057c6/admin_footer/__init__.py#L15-L20
def short_version(version=None): """ Return short application version. For example: `1.0.0`. """ v = version or __version__ return '.'.join([str(x) for x in v[:3]])
[ "def", "short_version", "(", "version", "=", "None", ")", ":", "v", "=", "version", "or", "__version__", "return", "'.'", ".", "join", "(", "[", "str", "(", "x", ")", "for", "x", "in", "v", "[", ":", "3", "]", "]", ")" ]
Return short application version. For example: `1.0.0`.
[ "Return", "short", "application", "version", ".", "For", "example", ":", "1", ".", "0", ".", "0", "." ]
python
test
openego/eTraGo
etrago/tools/plot.py
https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/tools/plot.py#L831-L908
def plot_stacked_gen(network, bus=None, resolution='GW', filename=None): """ Plot stacked sum of generation grouped by carrier type Parameters ---------- network : PyPSA network container bus: string Plot all generators at one specific bus. If none, sum is calulated for all bus...
[ "def", "plot_stacked_gen", "(", "network", ",", "bus", "=", "None", ",", "resolution", "=", "'GW'", ",", "filename", "=", "None", ")", ":", "if", "resolution", "==", "'GW'", ":", "reso_int", "=", "1e3", "elif", "resolution", "==", "'MW'", ":", "reso_int"...
Plot stacked sum of generation grouped by carrier type Parameters ---------- network : PyPSA network container bus: string Plot all generators at one specific bus. If none, sum is calulated for all buses resolution: string Unit for y-axis. Can be either GW/MW/KW Return...
[ "Plot", "stacked", "sum", "of", "generation", "grouped", "by", "carrier", "type" ]
python
train
BerkeleyAutomation/autolab_core
autolab_core/random_variables.py
https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/random_variables.py#L134-L148
def sample(self, size=1): """Generate samples of the random variable. Parameters ---------- size : int The number of samples to generate. Returns ------- :obj:`numpy.ndarray` of float The samples of the random variable. """ ...
[ "def", "sample", "(", "self", ",", "size", "=", "1", ")", ":", "samples", "=", "scipy", ".", "stats", ".", "multivariate_normal", ".", "rvs", "(", "self", ".", "mu", ",", "self", ".", "sigma", ",", "size", "=", "size", ")", "return", "samples" ]
Generate samples of the random variable. Parameters ---------- size : int The number of samples to generate. Returns ------- :obj:`numpy.ndarray` of float The samples of the random variable.
[ "Generate", "samples", "of", "the", "random", "variable", "." ]
python
train
flashashen/flange
flange/iterutils.py
https://github.com/flashashen/flange/blob/67ebaf70e39887f65ce1163168d182a8e4c2774a/flange/iterutils.py#L565-L584
def partition(src, key=None): """No relation to :meth:`str.partition`, ``partition`` is like :func:`bucketize`, but for added convenience returns a tuple of ``(truthy_values, falsy_values)``. >>> nonempty, empty = partition(['', '', 'hi', '', 'bye']) >>> nonempty ['hi', 'bye'] *key* defaul...
[ "def", "partition", "(", "src", ",", "key", "=", "None", ")", ":", "bucketized", "=", "bucketize", "(", "src", ",", "key", ")", "return", "bucketized", ".", "get", "(", "True", ",", "[", "]", ")", ",", "bucketized", ".", "get", "(", "False", ",", ...
No relation to :meth:`str.partition`, ``partition`` is like :func:`bucketize`, but for added convenience returns a tuple of ``(truthy_values, falsy_values)``. >>> nonempty, empty = partition(['', '', 'hi', '', 'bye']) >>> nonempty ['hi', 'bye'] *key* defaults to :class:`bool`, but can be caref...
[ "No", "relation", "to", ":", "meth", ":", "str", ".", "partition", "partition", "is", "like", ":", "func", ":", "bucketize", "but", "for", "added", "convenience", "returns", "a", "tuple", "of", "(", "truthy_values", "falsy_values", ")", "." ]
python
train
androguard/androguard
androguard/core/bytecodes/dvm.py
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/bytecodes/dvm.py#L7929-L7940
def get_class(self, name): """ Return a specific class :param name: the name of the class :rtype: a :class:`ClassDefItem` object """ for i in self.get_classes(): if i.get_name() == name: return i return None
[ "def", "get_class", "(", "self", ",", "name", ")", ":", "for", "i", "in", "self", ".", "get_classes", "(", ")", ":", "if", "i", ".", "get_name", "(", ")", "==", "name", ":", "return", "i", "return", "None" ]
Return a specific class :param name: the name of the class :rtype: a :class:`ClassDefItem` object
[ "Return", "a", "specific", "class" ]
python
train
swistakm/graceful
src/graceful/validators.py
https://github.com/swistakm/graceful/blob/d4678cb6349a5c843a5e58002fc80140821609e4/src/graceful/validators.py#L65-L98
def match_validator(expression): """Return validator function that will check if matches given expression. Args: match: if string then this will be converted to regular expression using ``re.compile``. Can be also any object that has ``match()`` method like already compiled regula...
[ "def", "match_validator", "(", "expression", ")", ":", "if", "isinstance", "(", "expression", ",", "str", ")", ":", "compiled", "=", "re", ".", "compile", "(", "expression", ")", "elif", "hasattr", "(", "expression", ",", "'match'", ")", ":", "# check it e...
Return validator function that will check if matches given expression. Args: match: if string then this will be converted to regular expression using ``re.compile``. Can be also any object that has ``match()`` method like already compiled regular regular expression or custom ...
[ "Return", "validator", "function", "that", "will", "check", "if", "matches", "given", "expression", "." ]
python
train
pypa/pipenv
pipenv/vendor/yarg/package.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/yarg/package.py#L166-L176
def downloads(self): """ >>> package = yarg.get('yarg') >>> package.downloads Downloads(day=50100, week=367941, month=1601938) # I wish """ _downloads = self._package['downloads'] downloads = namedtuple('Downloads', 'day week month') return do...
[ "def", "downloads", "(", "self", ")", ":", "_downloads", "=", "self", ".", "_package", "[", "'downloads'", "]", "downloads", "=", "namedtuple", "(", "'Downloads'", ",", "'day week month'", ")", "return", "downloads", "(", "day", "=", "_downloads", "[", "'las...
>>> package = yarg.get('yarg') >>> package.downloads Downloads(day=50100, week=367941, month=1601938) # I wish
[ ">>>", "package", "=", "yarg", ".", "get", "(", "yarg", ")", ">>>", "package", ".", "downloads", "Downloads", "(", "day", "=", "50100", "week", "=", "367941", "month", "=", "1601938", ")", "#", "I", "wish" ]
python
train
taizilongxu/douban.fm
doubanfm/API/api.py
https://github.com/taizilongxu/douban.fm/blob/d65126d3bd3e12d8a7109137caff8da0efc22b2f/doubanfm/API/api.py#L171-L184
def get_first_song(self): """ 初始获取歌曲 :params return: json """ count = 3 while count > 0: song = self.requests_url('n') if song: return song count -= 1 time.sleep(2) raise GenericError('获取第一首歌曲失败,无法完成...
[ "def", "get_first_song", "(", "self", ")", ":", "count", "=", "3", "while", "count", ">", "0", ":", "song", "=", "self", ".", "requests_url", "(", "'n'", ")", "if", "song", ":", "return", "song", "count", "-=", "1", "time", ".", "sleep", "(", "2", ...
初始获取歌曲 :params return: json
[ "初始获取歌曲" ]
python
train
ToucanToco/toucan-data-sdk
toucan_data_sdk/utils/postprocess/math.py
https://github.com/ToucanToco/toucan-data-sdk/blob/c3ca874e1b64f4bdcc2edda750a72d45d1561d8a/toucan_data_sdk/utils/postprocess/math.py#L241-L282
def absolute_values(df, *, column: str, new_column: str = None): """ Get the absolute numeric value of each element of a column --- ### Parameters *mandatory :* - `column` (*str*): name of the column *optional :* - `new_column` (*str*): name of the column containing the result. ...
[ "def", "absolute_values", "(", "df", ",", "*", ",", "column", ":", "str", ",", "new_column", ":", "str", "=", "None", ")", ":", "new_column", "=", "new_column", "or", "column", "df", "[", "new_column", "]", "=", "abs", "(", "df", "[", "column", "]", ...
Get the absolute numeric value of each element of a column --- ### Parameters *mandatory :* - `column` (*str*): name of the column *optional :* - `new_column` (*str*): name of the column containing the result. By default, no new column will be created and `column` will be replaced. ...
[ "Get", "the", "absolute", "numeric", "value", "of", "each", "element", "of", "a", "column" ]
python
test
cmbruns/pyopenvr
src/openvr/__init__.py
https://github.com/cmbruns/pyopenvr/blob/68395d26bb3df6ab1f0f059c38d441f962938be6/src/openvr/__init__.py#L4690-L4695
def setOverlayAlpha(self, ulOverlayHandle, fAlpha): """Sets the alpha of the overlay quad. Use 1.0 for 100 percent opacity to 0.0 for 0 percent opacity.""" fn = self.function_table.setOverlayAlpha result = fn(ulOverlayHandle, fAlpha) return result
[ "def", "setOverlayAlpha", "(", "self", ",", "ulOverlayHandle", ",", "fAlpha", ")", ":", "fn", "=", "self", ".", "function_table", ".", "setOverlayAlpha", "result", "=", "fn", "(", "ulOverlayHandle", ",", "fAlpha", ")", "return", "result" ]
Sets the alpha of the overlay quad. Use 1.0 for 100 percent opacity to 0.0 for 0 percent opacity.
[ "Sets", "the", "alpha", "of", "the", "overlay", "quad", ".", "Use", "1", ".", "0", "for", "100", "percent", "opacity", "to", "0", ".", "0", "for", "0", "percent", "opacity", "." ]
python
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/engine.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/engine.py#L166-L199
def register_action (self, action_name, command='', bound_list = [], flags = [], function = None): """Creates a new build engine action. Creates on bjam side an action named 'action_name', with 'command' as the command to be executed, 'bound_variables' naming th...
[ "def", "register_action", "(", "self", ",", "action_name", ",", "command", "=", "''", ",", "bound_list", "=", "[", "]", ",", "flags", "=", "[", "]", ",", "function", "=", "None", ")", ":", "assert", "isinstance", "(", "action_name", ",", "basestring", ...
Creates a new build engine action. Creates on bjam side an action named 'action_name', with 'command' as the command to be executed, 'bound_variables' naming the list of variables bound when the command is executed and specified flag. If 'function' is not None, it should be a ca...
[ "Creates", "a", "new", "build", "engine", "action", "." ]
python
train
zeth/inputs
inputs.py
https://github.com/zeth/inputs/blob/a46681dbf77d6ab07834f550e5855c1f50701f99/inputs.py#L3190-L3200
def _post_init(self): """Call the find devices method for the relevant platform.""" if WIN: self._find_devices_win() elif MAC: self._find_devices_mac() else: self._find_devices() self._update_all_devices() if NIX: self._find...
[ "def", "_post_init", "(", "self", ")", ":", "if", "WIN", ":", "self", ".", "_find_devices_win", "(", ")", "elif", "MAC", ":", "self", ".", "_find_devices_mac", "(", ")", "else", ":", "self", ".", "_find_devices", "(", ")", "self", ".", "_update_all_devic...
Call the find devices method for the relevant platform.
[ "Call", "the", "find", "devices", "method", "for", "the", "relevant", "platform", "." ]
python
train
iwanbk/nyamuk
nyamuk/nyamuk.py
https://github.com/iwanbk/nyamuk/blob/ac4c6028de288a4c8e0b332ae16eae889deb643d/nyamuk/nyamuk.py#L49-L70
def loop(self, timeout = 1): """Main loop.""" rlist = [self.sock] wlist = [] if len(self.out_packet) > 0: wlist.append(self.sock) to_read, to_write, _ = select.select(rlist, wlist, [], timeout) if len(to_read) > 0: ret, _ = self.loop_read...
[ "def", "loop", "(", "self", ",", "timeout", "=", "1", ")", ":", "rlist", "=", "[", "self", ".", "sock", "]", "wlist", "=", "[", "]", "if", "len", "(", "self", ".", "out_packet", ")", ">", "0", ":", "wlist", ".", "append", "(", "self", ".", "s...
Main loop.
[ "Main", "loop", "." ]
python
train
matiasb/python-unrar
unrar/unrarlib.py
https://github.com/matiasb/python-unrar/blob/b1ac46cbcf42f3d3c5c69ab971fe97369a4da617/unrar/unrarlib.py#L60-L70
def dostime_to_timetuple(dostime): """Convert a RAR archive member DOS time to a Python time tuple.""" dostime = dostime >> 16 dostime = dostime & 0xffff day = dostime & 0x1f month = (dostime >> 5) & 0xf year = 1980 + (dostime >> 9) second = 2 * (dostime & 0x1f) minute = (dostime >> 5) &...
[ "def", "dostime_to_timetuple", "(", "dostime", ")", ":", "dostime", "=", "dostime", ">>", "16", "dostime", "=", "dostime", "&", "0xffff", "day", "=", "dostime", "&", "0x1f", "month", "=", "(", "dostime", ">>", "5", ")", "&", "0xf", "year", "=", "1980",...
Convert a RAR archive member DOS time to a Python time tuple.
[ "Convert", "a", "RAR", "archive", "member", "DOS", "time", "to", "a", "Python", "time", "tuple", "." ]
python
valid
persephone-tools/persephone
persephone/rnn_ctc.py
https://github.com/persephone-tools/persephone/blob/f94c63e4d5fe719fb1deba449b177bb299d225fb/persephone/rnn_ctc.py#L21-L58
def write_desc(self) -> None: """ Writes a description of the model to the exp_dir. """ path = os.path.join(self.exp_dir, "model_description.txt") with open(path, "w") as desc_f: for key, val in self.__dict__.items(): print("%s=%s" % (key, val), file=desc_f) ...
[ "def", "write_desc", "(", "self", ")", "->", "None", ":", "path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "exp_dir", ",", "\"model_description.txt\"", ")", "with", "open", "(", "path", ",", "\"w\"", ")", "as", "desc_f", ":", "for", "ke...
Writes a description of the model to the exp_dir.
[ "Writes", "a", "description", "of", "the", "model", "to", "the", "exp_dir", "." ]
python
train
PMEAL/OpenPNM
openpnm/topotools/topotools.py
https://github.com/PMEAL/OpenPNM/blob/0547b5724ffedc0a593aae48639d36fe10e0baed/openpnm/topotools/topotools.py#L1196-L1268
def merge_networks(network, donor=[]): r""" Combine multiple networks into one without doing any topological manipulations (such as stiching nearby pores to each other). Parameters ---------- network : OpenPNM Network Object The network to which all the other networks should be added. ...
[ "def", "merge_networks", "(", "network", ",", "donor", "=", "[", "]", ")", ":", "if", "type", "(", "donor", ")", "==", "list", ":", "donors", "=", "donor", "else", ":", "donors", "=", "[", "donor", "]", "for", "donor", "in", "donors", ":", "network...
r""" Combine multiple networks into one without doing any topological manipulations (such as stiching nearby pores to each other). Parameters ---------- network : OpenPNM Network Object The network to which all the other networks should be added. donor : OpenPNM Network Object or list ...
[ "r", "Combine", "multiple", "networks", "into", "one", "without", "doing", "any", "topological", "manipulations", "(", "such", "as", "stiching", "nearby", "pores", "to", "each", "other", ")", "." ]
python
train
bcbio/bcbio-nextgen
bcbio/ngsalign/tophat.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/ngsalign/tophat.py#L78-L153
def tophat_align(fastq_file, pair_file, ref_file, out_base, align_dir, data, names=None): """ run alignment using Tophat v2 """ config = data["config"] options = get_in(config, ("resources", "tophat", "options"), {}) options = _set_fusion_mode(options, data) options = _set_q...
[ "def", "tophat_align", "(", "fastq_file", ",", "pair_file", ",", "ref_file", ",", "out_base", ",", "align_dir", ",", "data", ",", "names", "=", "None", ")", ":", "config", "=", "data", "[", "\"config\"", "]", "options", "=", "get_in", "(", "config", ",",...
run alignment using Tophat v2
[ "run", "alignment", "using", "Tophat", "v2" ]
python
train
estnltk/estnltk
estnltk/syntax/maltparser_support.py
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/syntax/maltparser_support.py#L1008-L1041
def _loadKSubcatRelations( inputFile ): ''' Laeb sisendfailist (inputFile) kaassõnade rektsiooniseoste mustrid. Iga muster peab olema failis eraldi real, kujul: (sõnalemma);(sõnaliik);(post|pre);(nõutud_käänete_regexp) nt ees;_K_;post;g eest;_K_;post;g enn...
[ "def", "_loadKSubcatRelations", "(", "inputFile", ")", ":", "kSubCatRelations", "=", "dict", "(", ")", "in_f", "=", "codecs", ".", "open", "(", "inputFile", ",", "mode", "=", "'r'", ",", "encoding", "=", "'utf-8'", ")", "for", "line", "in", "in_f", ":", ...
Laeb sisendfailist (inputFile) kaassõnade rektsiooniseoste mustrid. Iga muster peab olema failis eraldi real, kujul: (sõnalemma);(sõnaliik);(post|pre);(nõutud_käänete_regexp) nt ees;_K_;post;g eest;_K_;post;g enne;_K_;pre;p Tagastab laetud andmed sõnas...
[ "Laeb", "sisendfailist", "(", "inputFile", ")", "kaassõnade", "rektsiooniseoste", "mustrid", ".", "Iga", "muster", "peab", "olema", "failis", "eraldi", "real", "kujul", ":", "(", "sõnalemma", ")", ";", "(", "sõnaliik", ")", ";", "(", "post|pre", ")", ";", ...
python
train
staugur/Flask-PluginKit
flask_pluginkit/flask_pluginkit.py
https://github.com/staugur/Flask-PluginKit/blob/512aabf87fa13f4dc1082abd08d1d1dcf3b03f16/flask_pluginkit/flask_pluginkit.py#L245-L273
def __scanPlugins(self): """Scanning local plugin directories and third-party plugin packages. :returns: No return, but self.__plugins will be updated :raises: PluginError: raises an exception, maybe CSSLoadError, VersionError, based PluginError """ self.logger.info("Initializa...
[ "def", "__scanPlugins", "(", "self", ")", ":", "self", ".", "logger", ".", "info", "(", "\"Initialization Plugins Start, local plugins path: %s, third party plugins: %s\"", "%", "(", "self", ".", "plugins_abspath", ",", "self", ".", "plugin_packages", ")", ")", "#: Lo...
Scanning local plugin directories and third-party plugin packages. :returns: No return, but self.__plugins will be updated :raises: PluginError: raises an exception, maybe CSSLoadError, VersionError, based PluginError
[ "Scanning", "local", "plugin", "directories", "and", "third", "-", "party", "plugin", "packages", "." ]
python
train
Carbonara-Project/Guanciale
guanciale/idblib.py
https://github.com/Carbonara-Project/Guanciale/blob/c239ffac6fb481d09c4071d1de1a09f60dc584ab/guanciale/idblib.py#L1016-L1033
def blob(self, nodeid, tag, start=0, end=0xFFFFFFFF): """ Blobs are stored in sequential nodes with increasing index values. most blobs, like scripts start at index 0, long names start at a specified offset. """ startkey = self.makekey(nodeid, ...
[ "def", "blob", "(", "self", ",", "nodeid", ",", "tag", ",", "start", "=", "0", ",", "end", "=", "0xFFFFFFFF", ")", ":", "startkey", "=", "self", ".", "makekey", "(", "nodeid", ",", "tag", ",", "start", ")", "endkey", "=", "self", ".", "makekey", ...
Blobs are stored in sequential nodes with increasing index values. most blobs, like scripts start at index 0, long names start at a specified offset.
[ "Blobs", "are", "stored", "in", "sequential", "nodes", "with", "increasing", "index", "values", ".", "most", "blobs", "like", "scripts", "start", "at", "index", "0", "long", "names", "start", "at", "a", "specified", "offset", "." ]
python
train
astropy/regions
regions/_utils/examples.py
https://github.com/astropy/regions/blob/452d962c417e4ff20d1268f99535c6ff89c83437/regions/_utils/examples.py#L160-L185
def event_table(self): """Event table (`~astropy.table.Table`). Columns: GLON, GLAT, SOURCE_IDX """ # Create event list table for each source tables = [] for source in self.source_table: lon = source['GLON'] * np.ones(source['COUNTS']) lat = sourc...
[ "def", "event_table", "(", "self", ")", ":", "# Create event list table for each source", "tables", "=", "[", "]", "for", "source", "in", "self", ".", "source_table", ":", "lon", "=", "source", "[", "'GLON'", "]", "*", "np", ".", "ones", "(", "source", "["...
Event table (`~astropy.table.Table`). Columns: GLON, GLAT, SOURCE_IDX
[ "Event", "table", "(", "~astropy", ".", "table", ".", "Table", ")", "." ]
python
train
sanger-pathogens/ariba
ariba/sequence_variant.py
https://github.com/sanger-pathogens/ariba/blob/16a0b1916ce0e886bd22550ba2d648542977001b/ariba/sequence_variant.py#L63-L69
def nucleotide_range(self): '''Returns the nucleotide (start, end) positions inclusive of this variant. start==end if it's an amino acid variant, otherwise start+2==end''' if self.variant_type == 'p': return 3 * self.position, 3 * self.position + 2 else: return...
[ "def", "nucleotide_range", "(", "self", ")", ":", "if", "self", ".", "variant_type", "==", "'p'", ":", "return", "3", "*", "self", ".", "position", ",", "3", "*", "self", ".", "position", "+", "2", "else", ":", "return", "self", ".", "position", ",",...
Returns the nucleotide (start, end) positions inclusive of this variant. start==end if it's an amino acid variant, otherwise start+2==end
[ "Returns", "the", "nucleotide", "(", "start", "end", ")", "positions", "inclusive", "of", "this", "variant", ".", "start", "==", "end", "if", "it", "s", "an", "amino", "acid", "variant", "otherwise", "start", "+", "2", "==", "end" ]
python
train
billy-yoyo/RainbowSixSiege-Python-API
r6sapi/r6sapi.py
https://github.com/billy-yoyo/RainbowSixSiege-Python-API/blob/9860fdfd9a78aabd977eaa71b0a4ab4ed69e94d0/r6sapi/r6sapi.py#L1463-L1511
def load_terrohunt(self): """|coro| Loads the player's general stats for terrorist hunt""" stats = yield from self._fetch_statistics("generalpve_dbnoassists", "generalpve_death", "generalpve_revive", "generalpve_matchwon", "generalpve_suicide", ...
[ "def", "load_terrohunt", "(", "self", ")", ":", "stats", "=", "yield", "from", "self", ".", "_fetch_statistics", "(", "\"generalpve_dbnoassists\"", ",", "\"generalpve_death\"", ",", "\"generalpve_revive\"", ",", "\"generalpve_matchwon\"", ",", "\"generalpve_suicide\"", ...
|coro| Loads the player's general stats for terrorist hunt
[ "|coro|" ]
python
train
libtcod/python-tcod
tcod/libtcodpy.py
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L630-L635
def bsp_contains(node: tcod.bsp.BSP, cx: int, cy: int) -> bool: """ .. deprecated:: 2.0 Use :any:`BSP.contains` instead. """ return node.contains(cx, cy)
[ "def", "bsp_contains", "(", "node", ":", "tcod", ".", "bsp", ".", "BSP", ",", "cx", ":", "int", ",", "cy", ":", "int", ")", "->", "bool", ":", "return", "node", ".", "contains", "(", "cx", ",", "cy", ")" ]
.. deprecated:: 2.0 Use :any:`BSP.contains` instead.
[ "..", "deprecated", "::", "2", ".", "0", "Use", ":", "any", ":", "BSP", ".", "contains", "instead", "." ]
python
train
cgrok/cr-async
crasync/core.py
https://github.com/cgrok/cr-async/blob/f65a968e54704168706d137d1ba662f55f8ab852/crasync/core.py#L95-L104
async def get_clan(self, *tags): '''Get a clan object using tag(s)''' url = '{0.BASE}/clan/{1}'.format(self, ','.join(tags)) data = await self.request(url) if isinstance(data, list): return [Clan(self, c) for c in data] else: return Clan(...
[ "async", "def", "get_clan", "(", "self", ",", "*", "tags", ")", ":", "url", "=", "'{0.BASE}/clan/{1}'", ".", "format", "(", "self", ",", "','", ".", "join", "(", "tags", ")", ")", "data", "=", "await", "self", ".", "request", "(", "url", ")", "if",...
Get a clan object using tag(s)
[ "Get", "a", "clan", "object", "using", "tag", "(", "s", ")" ]
python
train
guma44/GEOparse
GEOparse/GEOTypes.py
https://github.com/guma44/GEOparse/blob/7ee8d5b8678d780382a6bf884afa69d2033f5ca0/GEOparse/GEOTypes.py#L897-L964
def download_SRA(self, email, directory='series', filterby=None, nproc=1, **kwargs): """Download SRA files for each GSM in series. .. warning:: Do not use parallel option (nproc > 1) in the interactive shell. For more details see `this issue <https://stacko...
[ "def", "download_SRA", "(", "self", ",", "email", ",", "directory", "=", "'series'", ",", "filterby", "=", "None", ",", "nproc", "=", "1", ",", "*", "*", "kwargs", ")", ":", "if", "directory", "==", "'series'", ":", "dirpath", "=", "os", ".", "path",...
Download SRA files for each GSM in series. .. warning:: Do not use parallel option (nproc > 1) in the interactive shell. For more details see `this issue <https://stackoverflow.com/questions/23641475/multiprocessing-working-in-python-but-not-in-ipython/23641560#23641560>`_ ...
[ "Download", "SRA", "files", "for", "each", "GSM", "in", "series", "." ]
python
train
jut-io/jut-python-tools
jut/config.py
https://github.com/jut-io/jut-python-tools/blob/65574d23f51a7bbced9bb25010d02da5ca5d906f/jut/config.py#L116-L130
def add(name, **kwargs): """ add a new configuration with the name specified and all of the keywords as attributes of that configuration. """ _CONFIG.add_section(name) for (key, value) in kwargs.items(): _CONFIG.set(name, key, value) with open(_CONFIG_FILEPATH, 'w') as configfile:...
[ "def", "add", "(", "name", ",", "*", "*", "kwargs", ")", ":", "_CONFIG", ".", "add_section", "(", "name", ")", "for", "(", "key", ",", "value", ")", "in", "kwargs", ".", "items", "(", ")", ":", "_CONFIG", ".", "set", "(", "name", ",", "key", ",...
add a new configuration with the name specified and all of the keywords as attributes of that configuration.
[ "add", "a", "new", "configuration", "with", "the", "name", "specified", "and", "all", "of", "the", "keywords", "as", "attributes", "of", "that", "configuration", "." ]
python
train
Projectplace/basepage
basepage/base_page.py
https://github.com/Projectplace/basepage/blob/735476877eb100db0981590a6d12140e68652167/basepage/base_page.py#L400-L416
def get_present_element(self, locator, params=None, timeout=None, visible=False, parent=None): """ Get element present in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be found. ...
[ "def", "get_present_element", "(", "self", ",", "locator", ",", "params", "=", "None", ",", "timeout", "=", "None", ",", "visible", "=", "False", ",", "parent", "=", "None", ")", ":", "error_msg", "=", "\"Child was never present\"", "if", "parent", "else", ...
Get element present in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be found. :param locator: element identifier :param params: (optional) locator parameters :param timeo...
[ "Get", "element", "present", "in", "the", "DOM", "." ]
python
train
FutunnOpen/futuquant
futuquant/examples/TinyQuant/TinyQuantBase.py
https://github.com/FutunnOpen/futuquant/blob/1512b321845f92ec9c578ce2689aa4e8482669e4/futuquant/examples/TinyQuant/TinyQuantBase.py#L154-L159
def rsi(self, n, array=False): """RSI指标""" result = talib.RSI(self.close, n) if array: return result return result[-1]
[ "def", "rsi", "(", "self", ",", "n", ",", "array", "=", "False", ")", ":", "result", "=", "talib", ".", "RSI", "(", "self", ".", "close", ",", "n", ")", "if", "array", ":", "return", "result", "return", "result", "[", "-", "1", "]" ]
RSI指标
[ "RSI指标" ]
python
train
quintusdias/glymur
glymur/codestream.py
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L1906-L1916
def _print_quantization_style(sqcc): """Only to be used with QCC and QCD segments.""" msg = '\n Quantization style: ' if sqcc & 0x1f == 0: msg += 'no quantization, ' elif sqcc & 0x1f == 1: msg += 'scalar implicit, ' elif sqcc & 0x1f == 2: msg += 'scalar explicit, ' r...
[ "def", "_print_quantization_style", "(", "sqcc", ")", ":", "msg", "=", "'\\n Quantization style: '", "if", "sqcc", "&", "0x1f", "==", "0", ":", "msg", "+=", "'no quantization, '", "elif", "sqcc", "&", "0x1f", "==", "1", ":", "msg", "+=", "'scalar implicit,...
Only to be used with QCC and QCD segments.
[ "Only", "to", "be", "used", "with", "QCC", "and", "QCD", "segments", "." ]
python
train
splunk/splunk-sdk-python
splunklib/client.py
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/client.py#L2634-L2648
def cancel(self): """Stops the current search and deletes the results cache. :return: The :class:`Job`. """ try: self.post("control", action="cancel") except HTTPError as he: if he.status == 404: # The job has already been cancelled, so ...
[ "def", "cancel", "(", "self", ")", ":", "try", ":", "self", ".", "post", "(", "\"control\"", ",", "action", "=", "\"cancel\"", ")", "except", "HTTPError", "as", "he", ":", "if", "he", ".", "status", "==", "404", ":", "# The job has already been cancelled, ...
Stops the current search and deletes the results cache. :return: The :class:`Job`.
[ "Stops", "the", "current", "search", "and", "deletes", "the", "results", "cache", "." ]
python
train
mehmetg/streak_client
streak_client/streak_client.py
https://github.com/mehmetg/streak_client/blob/46575510b4e4163a4a3cc06f7283a1ae377cdce6/streak_client/streak_client.py#L968-L984
def get_reminder(self, reminder_key): '''Gets one reminder Args: reminder_key key for the reminder to get return (status code, reminder dict) ''' #required sanity check if reminder_key: return requests.codes.bad_request, None uri = '/'.join([ self.api_uri, self.reminders_suffix, ...
[ "def", "get_reminder", "(", "self", ",", "reminder_key", ")", ":", "#required sanity check", "if", "reminder_key", ":", "return", "requests", ".", "codes", ".", "bad_request", ",", "None", "uri", "=", "'/'", ".", "join", "(", "[", "self", ".", "api_uri", "...
Gets one reminder Args: reminder_key key for the reminder to get return (status code, reminder dict)
[ "Gets", "one", "reminder", "Args", ":", "reminder_key", "key", "for", "the", "reminder", "to", "get", "return", "(", "status", "code", "reminder", "dict", ")" ]
python
train
pythonkc/pythonkc-meetups
pythonkc_meetups/client.py
https://github.com/pythonkc/pythonkc-meetups/blob/54b5062b2825011c87c303256f59c6c13d395ee7/pythonkc_meetups/client.py#L193-L221
def get_events_photos(self, event_ids): """ Get photos for the identified events. Parameters ---------- event_ids List of IDs of events to get photos for. Returns ------- List of tuples of (event id, ``pythonkc_meetups.types.MeetupPhoto``). ...
[ "def", "get_events_photos", "(", "self", ",", "event_ids", ")", ":", "query", "=", "urllib", ".", "urlencode", "(", "{", "'key'", ":", "self", ".", "_api_key", ",", "'event_id'", ":", "','", ".", "join", "(", "event_ids", ")", "}", ")", "url", "=", "...
Get photos for the identified events. Parameters ---------- event_ids List of IDs of events to get photos for. Returns ------- List of tuples of (event id, ``pythonkc_meetups.types.MeetupPhoto``). Exceptions ---------- * PythonKCMeet...
[ "Get", "photos", "for", "the", "identified", "events", "." ]
python
train
openstack/proliantutils
proliantutils/redfish/redfish.py
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/redfish.py#L975-L997
def set_iscsi_initiator_info(self, initiator_iqn): """Set iSCSI initiator information in iLO. :param initiator_iqn: Initiator iqn for iLO. :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedInBiosError, if the system is in the BIOS boot mode. ...
[ "def", "set_iscsi_initiator_info", "(", "self", ",", "initiator_iqn", ")", ":", "sushy_system", "=", "self", ".", "_get_sushy_system", "(", "PROLIANT_SYSTEM_ID", ")", "if", "(", "self", ".", "_is_boot_mode_uefi", "(", ")", ")", ":", "iscsi_data", "=", "{", "'i...
Set iSCSI initiator information in iLO. :param initiator_iqn: Initiator iqn for iLO. :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedInBiosError, if the system is in the BIOS boot mode.
[ "Set", "iSCSI", "initiator", "information", "in", "iLO", "." ]
python
train
heroku/sf-suds
suds/wsdl.py
https://github.com/heroku/sf-suds/blob/44b6743a45ff4447157605d6fecc9bf5922ce68a/suds/wsdl.py#L735-L757
def resolvefaults(self, definitions, op): """ Resolve soap fault I{message} references by cross-referencing with operation defined in port type. @param definitions: A definitions object. @type definitions: L{Definitions} @param op: An I{operation} object. @type op...
[ "def", "resolvefaults", "(", "self", ",", "definitions", ",", "op", ")", ":", "ptop", "=", "self", ".", "type", ".", "operation", "(", "op", ".", "name", ")", "if", "ptop", "is", "None", ":", "raise", "Exception", ",", "\"operation '%s' not defined in port...
Resolve soap fault I{message} references by cross-referencing with operation defined in port type. @param definitions: A definitions object. @type definitions: L{Definitions} @param op: An I{operation} object. @type op: I{operation}
[ "Resolve", "soap", "fault", "I", "{", "message", "}", "references", "by", "cross", "-", "referencing", "with", "operation", "defined", "in", "port", "type", "." ]
python
train
tomplus/kubernetes_asyncio
kubernetes_asyncio/client/api/core_v1_api.py
https://github.com/tomplus/kubernetes_asyncio/blob/f9ab15317ec921409714c7afef11aeb0f579985d/kubernetes_asyncio/client/api/core_v1_api.py#L22283-L22307
def replace_namespaced_resource_quota(self, name, namespace, body, **kwargs): # noqa: E501 """replace_namespaced_resource_quota # noqa: E501 replace the specified ResourceQuota # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request,...
[ "def", "replace_namespaced_resource_quota", "(", "self", ",", "name", ",", "namespace", ",", "body", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'",...
replace_namespaced_resource_quota # noqa: E501 replace the specified ResourceQuota # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.replace_namespaced_resource_quota(name, namespace,...
[ "replace_namespaced_resource_quota", "#", "noqa", ":", "E501" ]
python
train
spotify/luigi
examples/elasticsearch_index.py
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/examples/elasticsearch_index.py#L32-L48
def run(self): """ Writes data in JSON format into the task's output target. The data objects have the following attributes: * `_id` is the default Elasticsearch id field, * `text`: the text, * `date`: the day when the data was created. """ today = date...
[ "def", "run", "(", "self", ")", ":", "today", "=", "datetime", ".", "date", ".", "today", "(", ")", "with", "self", ".", "output", "(", ")", ".", "open", "(", "'w'", ")", "as", "output", ":", "for", "i", "in", "range", "(", "5", ")", ":", "ou...
Writes data in JSON format into the task's output target. The data objects have the following attributes: * `_id` is the default Elasticsearch id field, * `text`: the text, * `date`: the day when the data was created.
[ "Writes", "data", "in", "JSON", "format", "into", "the", "task", "s", "output", "target", "." ]
python
train
IdentityPython/pysaml2
src/saml2/sigver.py
https://github.com/IdentityPython/pysaml2/blob/d3aa78eeb7d37c12688f783cb4db1c7263a14ad6/src/saml2/sigver.py#L733-L776
def encrypt_assertion(self, statement, enc_key, template, key_type='des-192', node_xpath=None, node_id=None): """ Will encrypt an assertion :param statement: A XML document that contains the assertion to encrypt :param enc_key: File name of a file containing the encryption key :...
[ "def", "encrypt_assertion", "(", "self", ",", "statement", ",", "enc_key", ",", "template", ",", "key_type", "=", "'des-192'", ",", "node_xpath", "=", "None", ",", "node_id", "=", "None", ")", ":", "if", "six", ".", "PY2", ":", "_str", "=", "unicode", ...
Will encrypt an assertion :param statement: A XML document that contains the assertion to encrypt :param enc_key: File name of a file containing the encryption key :param template: A template for the encryption part to be added. :param key_type: The type of session key to use. :...
[ "Will", "encrypt", "an", "assertion" ]
python
train
bjodah/pycodeexport
pycodeexport/codeexport.py
https://github.com/bjodah/pycodeexport/blob/7d1d733745ea4e54fdcee8f16fea313794a4c11b/pycodeexport/codeexport.py#L300-L307
def mod(self): """ Cached compiled binary of the Generic_Code class. To clear cache invoke :meth:`clear_mod_cache`. """ if self._mod is None: self._mod = self.compile_and_import_binary() return self._mod
[ "def", "mod", "(", "self", ")", ":", "if", "self", ".", "_mod", "is", "None", ":", "self", ".", "_mod", "=", "self", ".", "compile_and_import_binary", "(", ")", "return", "self", ".", "_mod" ]
Cached compiled binary of the Generic_Code class. To clear cache invoke :meth:`clear_mod_cache`.
[ "Cached", "compiled", "binary", "of", "the", "Generic_Code", "class", "." ]
python
train
abarker/pdfCropMargins
src/pdfCropMargins/external_program_calls.py
https://github.com/abarker/pdfCropMargins/blob/55aca874613750ebf4ae69fd8851bdbb7696d6ac/src/pdfCropMargins/external_program_calls.py#L142-L147
def get_parent_directory(path): """Like os.path.dirname except it returns the absolute name of the parent of the dirname directory. No symbolic link expansion (os.path.realpath) or user expansion (os.path.expanduser) is done.""" if not os.path.isdir(path): path = os.path.dirname(path) return os.pat...
[ "def", "get_parent_directory", "(", "path", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "path", "=", "os", ".", "path", ".", "dirname", "(", "path", ")", "return", "os", ".", "path", ".", "abspath", "(", "os", "...
Like os.path.dirname except it returns the absolute name of the parent of the dirname directory. No symbolic link expansion (os.path.realpath) or user expansion (os.path.expanduser) is done.
[ "Like", "os", ".", "path", ".", "dirname", "except", "it", "returns", "the", "absolute", "name", "of", "the", "parent", "of", "the", "dirname", "directory", ".", "No", "symbolic", "link", "expansion", "(", "os", ".", "path", ".", "realpath", ")", "or", ...
python
train
lltk/lltk
lltk/decorators.py
https://github.com/lltk/lltk/blob/d171de55c1b97695fddedf4b02401ae27bf1d634/lltk/decorators.py#L47-L71
def _load_language_or_die(f): ''' Decorator used to load a custom method for a given language. ''' # This decorator checks if there's a custom method for a given language. # If so, prefer the custom method, otherwise raise exception NotImplementedError. @wraps(f) def loader(language, word, *args, **kwargs): me...
[ "def", "_load_language_or_die", "(", "f", ")", ":", "# This decorator checks if there's a custom method for a given language.", "# If so, prefer the custom method, otherwise raise exception NotImplementedError.", "@", "wraps", "(", "f", ")", "def", "loader", "(", "language", ",", ...
Decorator used to load a custom method for a given language.
[ "Decorator", "used", "to", "load", "a", "custom", "method", "for", "a", "given", "language", "." ]
python
train
woolfson-group/isambard
isambard/add_ons/knobs_into_holes.py
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/knobs_into_holes.py#L206-L255
def from_helices(cls, assembly, cutoff=7.0, min_helix_length=8): """ Generate KnobGroup from the helices in the assembly - classic socket functionality. Notes ----- Socket identifies knobs-into-holes (KIHs) packing motifs in protein structures. The following resources can provid...
[ "def", "from_helices", "(", "cls", ",", "assembly", ",", "cutoff", "=", "7.0", ",", "min_helix_length", "=", "8", ")", ":", "cutoff", "=", "float", "(", "cutoff", ")", "helices", "=", "Assembly", "(", "[", "x", "for", "x", "in", "assembly", ".", "hel...
Generate KnobGroup from the helices in the assembly - classic socket functionality. Notes ----- Socket identifies knobs-into-holes (KIHs) packing motifs in protein structures. The following resources can provide more information: The socket webserver: http://coiledcoils.chm.bris...
[ "Generate", "KnobGroup", "from", "the", "helices", "in", "the", "assembly", "-", "classic", "socket", "functionality", "." ]
python
train
atmos-python/atmos
atmos/plot.py
https://github.com/atmos-python/atmos/blob/f4af8eaca23cce881bde979599d15d322fc1935e/atmos/plot.py#L323-L389
def plot_dry_adiabats(self, p=None, theta=None, **kwargs): r'''Plot dry adiabats. Adds dry adiabats (lines of constant potential temperature) to the plot. The default style of these lines is dashed red lines with an alpha value of 0.5. These can be overridden using keyword arguments. ...
[ "def", "plot_dry_adiabats", "(", "self", ",", "p", "=", "None", ",", "theta", "=", "None", ",", "*", "*", "kwargs", ")", ":", "for", "artist", "in", "self", ".", "_dry_adiabats", ":", "artist", ".", "remove", "(", ")", "self", ".", "_dry_adiabats", "...
r'''Plot dry adiabats. Adds dry adiabats (lines of constant potential temperature) to the plot. The default style of these lines is dashed red lines with an alpha value of 0.5. These can be overridden using keyword arguments. Parameters ---------- p : array_like, option...
[ "r", "Plot", "dry", "adiabats", "." ]
python
train
tensorflow/tensor2tensor
tensor2tensor/models/video/basic_deterministic_params.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/video/basic_deterministic_params.py#L27-L56
def next_frame_basic_deterministic(): """Basic 2-frame conv model.""" hparams = base.next_frame_base() hparams.video_num_input_frames = 4 hparams.video_num_target_frames = 1 hparams.hidden_size = 64 hparams.batch_size = 4 hparams.num_hidden_layers = 2 hparams.optimizer = "Adafactor" hparams.learning_r...
[ "def", "next_frame_basic_deterministic", "(", ")", ":", "hparams", "=", "base", ".", "next_frame_base", "(", ")", "hparams", ".", "video_num_input_frames", "=", "4", "hparams", ".", "video_num_target_frames", "=", "1", "hparams", ".", "hidden_size", "=", "64", "...
Basic 2-frame conv model.
[ "Basic", "2", "-", "frame", "conv", "model", "." ]
python
train
Samreay/ChainConsumer
chainconsumer/plotter.py
https://github.com/Samreay/ChainConsumer/blob/902288e4d85c2677a9051a2172e03128a6169ad7/chainconsumer/plotter.py#L538-L724
def plot_summary(self, parameters=None, truth=None, extents=None, display=False, filename=None, chains=None, figsize=1.0, errorbar=False, include_truth_chain=True, blind=None, watermark=None, extra_parameter_spacing=0.5, vertical_spacing_ratio=1.0, show_nam...
[ "def", "plot_summary", "(", "self", ",", "parameters", "=", "None", ",", "truth", "=", "None", ",", "extents", "=", "None", ",", "display", "=", "False", ",", "filename", "=", "None", ",", "chains", "=", "None", ",", "figsize", "=", "1.0", ",", "erro...
Plots parameter summaries This plot is more for a sanity or consistency check than for use with final results. Plotting this before plotting with :func:`plot` allows you to quickly see if the chains give well behaved distributions, or if certain parameters are suspect or require a great...
[ "Plots", "parameter", "summaries" ]
python
train
contentful/contentful.py
contentful/resource.py
https://github.com/contentful/contentful.py/blob/73fe01d6ae5a1f8818880da65199107b584681dd/contentful/resource.py#L152-L160
def fields(self, locale=None): """Get fields for a specific locale :param locale: (optional) Locale to fetch, defaults to default_locale. """ if locale is None: locale = self._locale() return self._fields.get(locale, {})
[ "def", "fields", "(", "self", ",", "locale", "=", "None", ")", ":", "if", "locale", "is", "None", ":", "locale", "=", "self", ".", "_locale", "(", ")", "return", "self", ".", "_fields", ".", "get", "(", "locale", ",", "{", "}", ")" ]
Get fields for a specific locale :param locale: (optional) Locale to fetch, defaults to default_locale.
[ "Get", "fields", "for", "a", "specific", "locale" ]
python
train
Alignak-monitoring/alignak
alignak/dispatcher.py
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/dispatcher.py#L339-L447
def check_dispatch(self): # pylint: disable=too-many-branches """Check that all active satellites have a configuration dispatched A DispatcherError exception is raised if no configuration is dispatched! :return: None """ if not self.arbiter_link: raise DispatcherEr...
[ "def", "check_dispatch", "(", "self", ")", ":", "# pylint: disable=too-many-branches", "if", "not", "self", ".", "arbiter_link", ":", "raise", "DispatcherError", "(", "\"Dispatcher configuration problem: no valid arbiter link!\"", ")", "if", "not", "self", ".", "first_dis...
Check that all active satellites have a configuration dispatched A DispatcherError exception is raised if no configuration is dispatched! :return: None
[ "Check", "that", "all", "active", "satellites", "have", "a", "configuration", "dispatched" ]
python
train
tradenity/python-sdk
tradenity/resources/store_profile.py
https://github.com/tradenity/python-sdk/blob/d13fbe23f4d6ff22554c6d8d2deaf209371adaf1/tradenity/resources/store_profile.py#L610-L631
def update_store_profile_by_id(cls, store_profile_id, store_profile, **kwargs): """Update StoreProfile Update attributes of StoreProfile This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.update_...
[ "def", "update_store_profile_by_id", "(", "cls", ",", "store_profile_id", ",", "store_profile", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async'", ")", ":", "return", "c...
Update StoreProfile Update attributes of StoreProfile This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.update_store_profile_by_id(store_profile_id, store_profile, async=True) >>> result = threa...
[ "Update", "StoreProfile" ]
python
train
apple/turicreate
src/unity/python/turicreate/_cython/python_printer_callback.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_cython/python_printer_callback.py#L17-L38
def print_callback(val): """ Internal function. This function is called via a call back returning from IPC to Cython to Python. It tries to perform incremental printing to IPython Notebook or Jupyter Notebook and when all else fails, just prints locally. """ success = False try: ...
[ "def", "print_callback", "(", "val", ")", ":", "success", "=", "False", "try", ":", "# for reasons I cannot fathom, regular printing, even directly", "# to io.stdout does not work.", "# I have to intrude rather deep into IPython to make it behave", "if", "have_ipython", ":", "if", ...
Internal function. This function is called via a call back returning from IPC to Cython to Python. It tries to perform incremental printing to IPython Notebook or Jupyter Notebook and when all else fails, just prints locally.
[ "Internal", "function", ".", "This", "function", "is", "called", "via", "a", "call", "back", "returning", "from", "IPC", "to", "Cython", "to", "Python", ".", "It", "tries", "to", "perform", "incremental", "printing", "to", "IPython", "Notebook", "or", "Jupyt...
python
train
tensorflow/cleverhans
examples/nips17_adversarial_competition/dev_toolkit/run_attacks_and_defenses.py
https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/examples/nips17_adversarial_competition/dev_toolkit/run_attacks_and_defenses.py#L216-L254
def clip_and_copy_attack_outputs(self, attack_name, is_targeted): """Clips results of attack and copy it to directory with all images. Args: attack_name: name of the attack. is_targeted: if True then attack is targeted, otherwise non-targeted. """ if is_targeted: self._targeted_attack...
[ "def", "clip_and_copy_attack_outputs", "(", "self", ",", "attack_name", ",", "is_targeted", ")", ":", "if", "is_targeted", ":", "self", ".", "_targeted_attack_names", ".", "add", "(", "attack_name", ")", "else", ":", "self", ".", "_attack_names", ".", "add", "...
Clips results of attack and copy it to directory with all images. Args: attack_name: name of the attack. is_targeted: if True then attack is targeted, otherwise non-targeted.
[ "Clips", "results", "of", "attack", "and", "copy", "it", "to", "directory", "with", "all", "images", "." ]
python
train
Yelp/kafka-utils
kafka_utils/util/ssh.py
https://github.com/Yelp/kafka-utils/blob/cdb4d64308f3079ee0873250bf7b34d0d94eca50/kafka_utils/util/ssh.py#L166-L178
def report_stdout(host, stdout): """Take a stdout and print it's lines to output if lines are present. :param host: the host where the process is running :type host: str :param stdout: the std out of that process :type stdout: paramiko.channel.Channel """ lines = stdout.readlines() if l...
[ "def", "report_stdout", "(", "host", ",", "stdout", ")", ":", "lines", "=", "stdout", ".", "readlines", "(", ")", "if", "lines", ":", "print", "(", "\"STDOUT from {host}:\"", ".", "format", "(", "host", "=", "host", ")", ")", "for", "line", "in", "line...
Take a stdout and print it's lines to output if lines are present. :param host: the host where the process is running :type host: str :param stdout: the std out of that process :type stdout: paramiko.channel.Channel
[ "Take", "a", "stdout", "and", "print", "it", "s", "lines", "to", "output", "if", "lines", "are", "present", "." ]
python
train
tensorflow/tensor2tensor
tensor2tensor/models/mtf_image_transformer.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/mtf_image_transformer.py#L569-L583
def mtf_image_transformer_base_imagenet_mp128(): """Model parallel ImageNet parameters.""" hparams = mtf_image_transformer_base_imagenet() hparams.mesh_shape = "model:8;batch:4" hparams.layout = "batch:batch;d_ff:model;heads:model" hparams.batch_size = 8 hparams.img_len = 128 hparams.block_length = 128 ...
[ "def", "mtf_image_transformer_base_imagenet_mp128", "(", ")", ":", "hparams", "=", "mtf_image_transformer_base_imagenet", "(", ")", "hparams", ".", "mesh_shape", "=", "\"model:8;batch:4\"", "hparams", ".", "layout", "=", "\"batch:batch;d_ff:model;heads:model\"", "hparams", ...
Model parallel ImageNet parameters.
[ "Model", "parallel", "ImageNet", "parameters", "." ]
python
train
hannes-brt/hebel
hebel/pycuda_ops/cublas.py
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cublas.py#L2903-L2914
def cublasSsyr2(handle, uplo, n, alpha, x, incx, y, incy, A, lda): """ Rank-2 operation on real symmetric matrix. """ status = _libcublas.cublasSsyr2_v2(handle, _CUBLAS_FILL_MODE[uplo], n, ctypes.byref(ctypes.c_float(alpha)...
[ "def", "cublasSsyr2", "(", "handle", ",", "uplo", ",", "n", ",", "alpha", ",", "x", ",", "incx", ",", "y", ",", "incy", ",", "A", ",", "lda", ")", ":", "status", "=", "_libcublas", ".", "cublasSsyr2_v2", "(", "handle", ",", "_CUBLAS_FILL_MODE", "[", ...
Rank-2 operation on real symmetric matrix.
[ "Rank", "-", "2", "operation", "on", "real", "symmetric", "matrix", "." ]
python
train