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
Shizmob/pydle
pydle/client.py
https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/client.py#L115-L123
async def disconnect(self, expected=True): """ Disconnect from server. """ if self.connected: # Unschedule ping checker. if self._ping_checker_handle: self._ping_checker_handle.cancel() # Schedule disconnect. await self._disconnect(expecte...
[ "async", "def", "disconnect", "(", "self", ",", "expected", "=", "True", ")", ":", "if", "self", ".", "connected", ":", "# Unschedule ping checker.", "if", "self", ".", "_ping_checker_handle", ":", "self", ".", "_ping_checker_handle", ".", "cancel", "(", ")", ...
Disconnect from server.
[ "Disconnect", "from", "server", "." ]
python
train
titusjan/argos
argos/repo/repotreemodel.py
https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/repo/repotreemodel.py#L126-L142
def fetchMore(self, parentIndex): # TODO: Make LazyLoadRepoTreeModel? """ Fetches any available data for the items with the parent specified by the parent index. """ parentItem = self.getItem(parentIndex) if not parentItem: return if not parentItem.canFetchChildren(...
[ "def", "fetchMore", "(", "self", ",", "parentIndex", ")", ":", "# TODO: Make LazyLoadRepoTreeModel?", "parentItem", "=", "self", ".", "getItem", "(", "parentIndex", ")", "if", "not", "parentItem", ":", "return", "if", "not", "parentItem", ".", "canFetchChildren", ...
Fetches any available data for the items with the parent specified by the parent index.
[ "Fetches", "any", "available", "data", "for", "the", "items", "with", "the", "parent", "specified", "by", "the", "parent", "index", "." ]
python
train
casouri/launchdman
launchdman/__init__.py
https://github.com/casouri/launchdman/blob/c83840e640cb075fab2534049f1e25fac6933c64/launchdman/__init__.py#L1062-L1111
def genInterval(self, month=(), day=(), week=(), weekday=(), hour=(), minute=()): '''Generate list of config dictionarie(s) that represent a interval of time. Used to be passed into add() or r...
[ "def", "genInterval", "(", "self", ",", "month", "=", "(", ")", ",", "day", "=", "(", ")", ",", "week", "=", "(", ")", ",", "weekday", "=", "(", ")", ",", "hour", "=", "(", ")", ",", "minute", "=", "(", ")", ")", ":", "dic", "=", "{", "'M...
Generate list of config dictionarie(s) that represent a interval of time. Used to be passed into add() or remove(). For example:: genInterval(month=(1,4), week(1,4)) # generate list contains from first to third week in from January to March Args: month (tuple): (sta...
[ "Generate", "list", "of", "config", "dictionarie", "(", "s", ")", "that", "represent", "a", "interval", "of", "time", ".", "Used", "to", "be", "passed", "into", "add", "()", "or", "remove", "()", ".", "For", "example", "::" ]
python
train
cobrateam/flask-mongoalchemy
flask_mongoalchemy/__init__.py
https://github.com/cobrateam/flask-mongoalchemy/blob/66ab6f857cae69e35d37035880c1dfaf1dc9bd15/flask_mongoalchemy/__init__.py#L222-L228
def get(self, mongo_id): """Returns a :class:`Document` instance from its ``mongo_id`` or ``None`` if not found""" try: return self.filter(self.type.mongo_id == mongo_id).first() except exceptions.BadValueException: return None
[ "def", "get", "(", "self", ",", "mongo_id", ")", ":", "try", ":", "return", "self", ".", "filter", "(", "self", ".", "type", ".", "mongo_id", "==", "mongo_id", ")", ".", "first", "(", ")", "except", "exceptions", ".", "BadValueException", ":", "return"...
Returns a :class:`Document` instance from its ``mongo_id`` or ``None`` if not found
[ "Returns", "a", ":", "class", ":", "Document", "instance", "from", "its", "mongo_id", "or", "None", "if", "not", "found" ]
python
train
StackStorm/pybind
pybind/slxos/v17r_1_01a/show/show_firmware_dummy/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17r_1_01a/show/show_firmware_dummy/__init__.py#L92-L113
def _set_show_firmware_option(self, v, load=False): """ Setter method for show_firmware_option, mapped from YANG variable /show/show_firmware_dummy/show_firmware_option (container) If this variable is read-only (config: false) in the source YANG file, then _set_show_firmware_option is considered as a pr...
[ "def", "_set_show_firmware_option", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", "...
Setter method for show_firmware_option, mapped from YANG variable /show/show_firmware_dummy/show_firmware_option (container) If this variable is read-only (config: false) in the source YANG file, then _set_show_firmware_option is considered as a private method. Backends looking to populate this variable sho...
[ "Setter", "method", "for", "show_firmware_option", "mapped", "from", "YANG", "variable", "/", "show", "/", "show_firmware_dummy", "/", "show_firmware_option", "(", "container", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "config", ":", "false"...
python
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/preprocessor.py
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/preprocessor.py#L12-L28
def remove_comments(code): """Remove C-style comment from GLSL code string.""" pattern = r"(\".*?\"|\'.*?\')|(/\*.*?\*/|//[^\r\n]*\n)" # first group captures quoted strings (double or single) # second group captures comments (//single-line or /* multi-line */) regex = re.compile(pattern, re.MULTILI...
[ "def", "remove_comments", "(", "code", ")", ":", "pattern", "=", "r\"(\\\".*?\\\"|\\'.*?\\')|(/\\*.*?\\*/|//[^\\r\\n]*\\n)\"", "# first group captures quoted strings (double or single)", "# second group captures comments (//single-line or /* multi-line */)", "regex", "=", "re", ".", "c...
Remove C-style comment from GLSL code string.
[ "Remove", "C", "-", "style", "comment", "from", "GLSL", "code", "string", "." ]
python
train
apache/spark
python/pyspark/rdd.py
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/rdd.py#L369-L383
def mapPartitionsWithSplit(self, f, preservesPartitioning=False): """ Deprecated: use mapPartitionsWithIndex instead. Return a new RDD by applying a function to each partition of this RDD, while tracking the index of the original partition. >>> rdd = sc.parallelize([1, 2, 3, 4]...
[ "def", "mapPartitionsWithSplit", "(", "self", ",", "f", ",", "preservesPartitioning", "=", "False", ")", ":", "warnings", ".", "warn", "(", "\"mapPartitionsWithSplit is deprecated; \"", "\"use mapPartitionsWithIndex instead\"", ",", "DeprecationWarning", ",", "stacklevel", ...
Deprecated: use mapPartitionsWithIndex instead. Return a new RDD by applying a function to each partition of this RDD, while tracking the index of the original partition. >>> rdd = sc.parallelize([1, 2, 3, 4], 4) >>> def f(splitIndex, iterator): yield splitIndex >>> rdd.mapPart...
[ "Deprecated", ":", "use", "mapPartitionsWithIndex", "instead", "." ]
python
train
ToFuProject/tofu
tofu/data/_core.py
https://github.com/ToFuProject/tofu/blob/39d6b2e7ced9e13666572dfd37e19403f1d6ff8d/tofu/data/_core.py#L1341-L1349
def clear_ddata(self): """ Clear the working copy of data Harmless, as it preserves the reference copy and the treatment dict Use only to free some memory """ self._ddata = dict.fromkeys(self._get_keys_ddata()) self._ddata['uptodate'] = False
[ "def", "clear_ddata", "(", "self", ")", ":", "self", ".", "_ddata", "=", "dict", ".", "fromkeys", "(", "self", ".", "_get_keys_ddata", "(", ")", ")", "self", ".", "_ddata", "[", "'uptodate'", "]", "=", "False" ]
Clear the working copy of data Harmless, as it preserves the reference copy and the treatment dict Use only to free some memory
[ "Clear", "the", "working", "copy", "of", "data" ]
python
train
ewels/MultiQC
multiqc/modules/deeptools/plotEnrichment.py
https://github.com/ewels/MultiQC/blob/2037d6322b2554146a74efbf869156ad20d4c4ec/multiqc/modules/deeptools/plotEnrichment.py#L16-L51
def parse_plotEnrichment(self): """Find plotEnrichment output.""" self.deeptools_plotEnrichment = dict() for f in self.find_log_files('deeptools/plotEnrichment'): parsed_data = self.parsePlotEnrichment(f) for k, v in parsed_data.items(): if k in self.deept...
[ "def", "parse_plotEnrichment", "(", "self", ")", ":", "self", ".", "deeptools_plotEnrichment", "=", "dict", "(", ")", "for", "f", "in", "self", ".", "find_log_files", "(", "'deeptools/plotEnrichment'", ")", ":", "parsed_data", "=", "self", ".", "parsePlotEnrichm...
Find plotEnrichment output.
[ "Find", "plotEnrichment", "output", "." ]
python
train
sorgerlab/indra
indra/sources/trips/processor.py
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L695-L715
def get_modifications(self): """Extract all types of Modification INDRA Statements.""" # Get all the specific mod types mod_event_types = list(ont_to_mod_type.keys()) # Add ONT::PTMs as a special case mod_event_types += ['ONT::PTM'] mod_events = [] for mod_event_t...
[ "def", "get_modifications", "(", "self", ")", ":", "# Get all the specific mod types", "mod_event_types", "=", "list", "(", "ont_to_mod_type", ".", "keys", "(", ")", ")", "# Add ONT::PTMs as a special case", "mod_event_types", "+=", "[", "'ONT::PTM'", "]", "mod_events",...
Extract all types of Modification INDRA Statements.
[ "Extract", "all", "types", "of", "Modification", "INDRA", "Statements", "." ]
python
train
IdentityPython/SATOSA
src/satosa/backends/saml2.py
https://github.com/IdentityPython/SATOSA/blob/49da5d4c0ac1a5ebf1a71b4f7aaf04f0e52d8fdb/src/satosa/backends/saml2.py#L143-L195
def authn_request(self, context, entity_id): """ Do an authorization request on idp with given entity id. This is the start of the authorization. :type context: satosa.context.Context :type entity_id: str :rtype: satosa.response.Response :param context: The curr...
[ "def", "authn_request", "(", "self", ",", "context", ",", "entity_id", ")", ":", "# If IDP blacklisting is enabled and the selected IDP is blacklisted,", "# stop here", "if", "self", ".", "idp_blacklist_file", ":", "with", "open", "(", "self", ".", "idp_blacklist_file", ...
Do an authorization request on idp with given entity id. This is the start of the authorization. :type context: satosa.context.Context :type entity_id: str :rtype: satosa.response.Response :param context: The current context :param entity_id: Target IDP entity id ...
[ "Do", "an", "authorization", "request", "on", "idp", "with", "given", "entity", "id", ".", "This", "is", "the", "start", "of", "the", "authorization", "." ]
python
train
Autodesk/aomi
aomi/model/resource.py
https://github.com/Autodesk/aomi/blob/84da2dfb0424837adf9c4ddc1aa352e942bb7a4a/aomi/model/resource.py#L53-L66
def tunable(self, obj): """A tunable resource maps against a backend...""" self.tune = dict() if 'tune' in obj: for tunable in MOUNT_TUNABLES: tunable_key = tunable[0] map_val(self.tune, obj['tune'], tunable_key) if tunable_key in self....
[ "def", "tunable", "(", "self", ",", "obj", ")", ":", "self", ".", "tune", "=", "dict", "(", ")", "if", "'tune'", "in", "obj", ":", "for", "tunable", "in", "MOUNT_TUNABLES", ":", "tunable_key", "=", "tunable", "[", "0", "]", "map_val", "(", "self", ...
A tunable resource maps against a backend...
[ "A", "tunable", "resource", "maps", "against", "a", "backend", "..." ]
python
train
Jammy2211/PyAutoLens
autolens/data/array/grids.py
https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/array/grids.py#L873-L892
def padded_grid_from_shape_psf_shape_and_pixel_scale(cls, shape, psf_shape, pixel_scale): """Setup a regular padded grid from a 2D array shape, psf-shape and pixel-scale. The center of every pixel is used to setup the grid's (y,x) arc-second coordinates, including padded pixels \ which are beyo...
[ "def", "padded_grid_from_shape_psf_shape_and_pixel_scale", "(", "cls", ",", "shape", ",", "psf_shape", ",", "pixel_scale", ")", ":", "padded_shape", "=", "(", "shape", "[", "0", "]", "+", "psf_shape", "[", "0", "]", "-", "1", ",", "shape", "[", "1", "]", ...
Setup a regular padded grid from a 2D array shape, psf-shape and pixel-scale. The center of every pixel is used to setup the grid's (y,x) arc-second coordinates, including padded pixels \ which are beyond the input shape but will blurred light into the 2D array's shape due to the psf. Paramete...
[ "Setup", "a", "regular", "padded", "grid", "from", "a", "2D", "array", "shape", "psf", "-", "shape", "and", "pixel", "-", "scale", "." ]
python
valid
calmjs/calmjs
src/calmjs/interrogate.py
https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/interrogate.py#L184-L199
def yield_module_imports(root, checks=string_imports()): """ Gather all require and define calls from unbundled JavaScript source files and yield all module names. The imports can either be of the CommonJS or AMD syntax. """ if not isinstance(root, asttypes.Node): raise TypeError('prov...
[ "def", "yield_module_imports", "(", "root", ",", "checks", "=", "string_imports", "(", ")", ")", ":", "if", "not", "isinstance", "(", "root", ",", "asttypes", ".", "Node", ")", ":", "raise", "TypeError", "(", "'provided root must be a node'", ")", "for", "ch...
Gather all require and define calls from unbundled JavaScript source files and yield all module names. The imports can either be of the CommonJS or AMD syntax.
[ "Gather", "all", "require", "and", "define", "calls", "from", "unbundled", "JavaScript", "source", "files", "and", "yield", "all", "module", "names", ".", "The", "imports", "can", "either", "be", "of", "the", "CommonJS", "or", "AMD", "syntax", "." ]
python
train
dmwm/DBS
Server/Python/src/dbs/dao/MySQL/SequenceManager.py
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/dao/MySQL/SequenceManager.py#L15-L38
def increment(self, conn, seqName, transaction = False, incCount=1): """ increments the sequence `seqName` by default `Incremented by one` and returns its value """ try: seqTable = "%sS" %seqName tlock = "lock tables %s write" %seqTable self.dbi.processData(tlock, [], con...
[ "def", "increment", "(", "self", ",", "conn", ",", "seqName", ",", "transaction", "=", "False", ",", "incCount", "=", "1", ")", ":", "try", ":", "seqTable", "=", "\"%sS\"", "%", "seqName", "tlock", "=", "\"lock tables %s write\"", "%", "seqTable", "self", ...
increments the sequence `seqName` by default `Incremented by one` and returns its value
[ "increments", "the", "sequence", "seqName", "by", "default", "Incremented", "by", "one", "and", "returns", "its", "value" ]
python
train
Valuehorizon/valuehorizon-companies
companies/models.py
https://github.com/Valuehorizon/valuehorizon-companies/blob/5366e230da69ee30fcdc1bf4beddc99310f6b767/companies/models.py#L291-L324
def save(self, *args, **kwargs): """ This method autogenerates the auto_generated_description field """ # Cache basic data self.cache_data() # Ensure slug doesn't change if self.id is not None: db_company = Company.objects.get(id=self.id) ...
[ "def", "save", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Cache basic data", "self", ".", "cache_data", "(", ")", "# Ensure slug doesn't change", "if", "self", ".", "id", "is", "not", "None", ":", "db_company", "=", "Company", "...
This method autogenerates the auto_generated_description field
[ "This", "method", "autogenerates", "the", "auto_generated_description", "field" ]
python
train
shmir/PyIxNetwork
ixnetwork/ixn_port.py
https://github.com/shmir/PyIxNetwork/blob/e7d7a89c08a5d3a1382b4dcfd915bbfc7eedd33f/ixnetwork/ixn_port.py#L21-L50
def reserve(self, location=None, force=False, wait_for_up=True, timeout=80): """ Reserve port and optionally wait for port to come up. :param location: port location as 'ip/module/port'. If None, the location will be taken from the configuration. :param force: whether to revoke existing reserva...
[ "def", "reserve", "(", "self", ",", "location", "=", "None", ",", "force", "=", "False", ",", "wait_for_up", "=", "True", ",", "timeout", "=", "80", ")", ":", "if", "not", "location", "or", "is_local_host", "(", "location", ")", ":", "return", "hostnam...
Reserve port and optionally wait for port to come up. :param location: port location as 'ip/module/port'. If None, the location will be taken from the configuration. :param force: whether to revoke existing reservation (True) or not (False). :param wait_for_up: True - wait for port to come up, ...
[ "Reserve", "port", "and", "optionally", "wait", "for", "port", "to", "come", "up", "." ]
python
train
aiogram/aiogram
aiogram/bot/bot.py
https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L96-L127
async def set_webhook(self, url: base.String, certificate: typing.Union[base.InputFile, None] = None, max_connections: typing.Union[base.Integer, None] = None, allowed_updates: typing.Union[typing.List[base.String], None] = None) -> base.Bool...
[ "async", "def", "set_webhook", "(", "self", ",", "url", ":", "base", ".", "String", ",", "certificate", ":", "typing", ".", "Union", "[", "base", ".", "InputFile", ",", "None", "]", "=", "None", ",", "max_connections", ":", "typing", ".", "Union", "[",...
Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amo...
[ "Use", "this", "method", "to", "specify", "a", "url", "and", "receive", "incoming", "updates", "via", "an", "outgoing", "webhook", ".", "Whenever", "there", "is", "an", "update", "for", "the", "bot", "we", "will", "send", "an", "HTTPS", "POST", "request", ...
python
train
lucasmaystre/choix
choix/lsr.py
https://github.com/lucasmaystre/choix/blob/05a57a10bb707338113a9d91601ca528ead7a881/choix/lsr.py#L74-L109
def ilsr_pairwise( n_items, data, alpha=0.0, initial_params=None, max_iter=100, tol=1e-8): """Compute the ML estimate of model parameters using I-LSR. This function computes the maximum-likelihood (ML) estimate of model parameters given pairwise-comparison data (see :ref:`data-pairwise`), using ...
[ "def", "ilsr_pairwise", "(", "n_items", ",", "data", ",", "alpha", "=", "0.0", ",", "initial_params", "=", "None", ",", "max_iter", "=", "100", ",", "tol", "=", "1e-8", ")", ":", "fun", "=", "functools", ".", "partial", "(", "lsr_pairwise", ",", "n_ite...
Compute the ML estimate of model parameters using I-LSR. This function computes the maximum-likelihood (ML) estimate of model parameters given pairwise-comparison data (see :ref:`data-pairwise`), using the iterative Luce Spectral Ranking algorithm [MG15]_. The transition rates of the LSR Markov chain ...
[ "Compute", "the", "ML", "estimate", "of", "model", "parameters", "using", "I", "-", "LSR", "." ]
python
train
saltstack/salt
salt/modules/inspectlib/fsdb.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/inspectlib/fsdb.py#L142-L154
def open(self, dbname=None): ''' Open database from the path with the name or latest. If there are no yet databases, create a new implicitly. :return: ''' databases = self.list() if self.is_closed(): self.db_path = os.path.join(self.path, dbname or (d...
[ "def", "open", "(", "self", ",", "dbname", "=", "None", ")", ":", "databases", "=", "self", ".", "list", "(", ")", "if", "self", ".", "is_closed", "(", ")", ":", "self", ".", "db_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "pa...
Open database from the path with the name or latest. If there are no yet databases, create a new implicitly. :return:
[ "Open", "database", "from", "the", "path", "with", "the", "name", "or", "latest", ".", "If", "there", "are", "no", "yet", "databases", "create", "a", "new", "implicitly", "." ]
python
train
biocore/burrito-fillings
bfillings/sortmerna_v2.py
https://github.com/biocore/burrito-fillings/blob/02ab71a46119b40793bd56a4ae00ca15f6dc3329/bfillings/sortmerna_v2.py#L421-L544
def sortmerna_map(seq_path, output_dir, refseqs_fp, sortmerna_db, e_value=1, threads=1, best=None, num_alignments=None, HALT_EXEC=False, output_sam=False, ...
[ "def", "sortmerna_map", "(", "seq_path", ",", "output_dir", ",", "refseqs_fp", ",", "sortmerna_db", ",", "e_value", "=", "1", ",", "threads", "=", "1", ",", "best", "=", "None", ",", "num_alignments", "=", "None", ",", "HALT_EXEC", "=", "False", ",", "ou...
Launch sortmerna mapper Parameters ---------- seq_path : str filepath to reads. output_dir : str dirpath to sortmerna output. refseqs_fp : str filepath of reference sequences. sortmerna_db : str indexed reference database. ...
[ "Launch", "sortmerna", "mapper" ]
python
train
marcotcr/lime
lime/lime_tabular.py
https://github.com/marcotcr/lime/blob/08133d47df00ed918e22005e0c98f6eefd5a1d71/lime/lime_tabular.py#L45-L57
def map_exp_ids(self, exp): """Maps ids to feature names. Args: exp: list of tuples [(id, weight), (id,weight)] Returns: list of tuples (feature_name, weight) """ names = self.exp_feature_names if self.discretized_feature_names is not None: ...
[ "def", "map_exp_ids", "(", "self", ",", "exp", ")", ":", "names", "=", "self", ".", "exp_feature_names", "if", "self", ".", "discretized_feature_names", "is", "not", "None", ":", "names", "=", "self", ".", "discretized_feature_names", "return", "[", "(", "na...
Maps ids to feature names. Args: exp: list of tuples [(id, weight), (id,weight)] Returns: list of tuples (feature_name, weight)
[ "Maps", "ids", "to", "feature", "names", "." ]
python
train
ranaroussi/pywallet
pywallet/utils/ethereum.py
https://github.com/ranaroussi/pywallet/blob/206ff224389c490d8798f660c9e79fe97ebb64cf/pywallet/utils/ethereum.py#L969-L981
def to_der(self): """ Encodes this signature using DER Returns: bytes: The DER encoding of (self.r, self.s). """ # Output should be: # 0x30 <length> 0x02 <length r> r 0x02 <length s> s r, s = self._canonicalize() total_length = 6 + len(r) + len(s) ...
[ "def", "to_der", "(", "self", ")", ":", "# Output should be:", "# 0x30 <length> 0x02 <length r> r 0x02 <length s> s", "r", ",", "s", "=", "self", ".", "_canonicalize", "(", ")", "total_length", "=", "6", "+", "len", "(", "r", ")", "+", "len", "(", "s", ")", ...
Encodes this signature using DER Returns: bytes: The DER encoding of (self.r, self.s).
[ "Encodes", "this", "signature", "using", "DER" ]
python
train
nrcharles/caelum
caelum/tmy3.py
https://github.com/nrcharles/caelum/blob/9a8e65806385978556d7bb2e6870f003ff82023e/caelum/tmy3.py#L128-L134
def next(self): """iterate.""" record = self.tmy_data.next() _sd = record['Date (MM/DD/YYYY)'] + ' ' + record['Time (HH:MM)'] record['utc_datetime'] = strptime(_sd, self.tz) record['datetime'] = strptime(_sd) return record
[ "def", "next", "(", "self", ")", ":", "record", "=", "self", ".", "tmy_data", ".", "next", "(", ")", "_sd", "=", "record", "[", "'Date (MM/DD/YYYY)'", "]", "+", "' '", "+", "record", "[", "'Time (HH:MM)'", "]", "record", "[", "'utc_datetime'", "]", "="...
iterate.
[ "iterate", "." ]
python
train
senaite/senaite.jsonapi
src/senaite/jsonapi/api.py
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/api.py#L457-L545
def get_workflow_info(brain_or_object, endpoint=None): """Generate workflow information of the assigned workflows :param brain_or_object: A single catalog brain or content object :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain :param endpoint: The named URL endpoint for the root ...
[ "def", "get_workflow_info", "(", "brain_or_object", ",", "endpoint", "=", "None", ")", ":", "# ensure we have a full content object", "obj", "=", "get_object", "(", "brain_or_object", ")", "# get the portal workflow tool", "wf_tool", "=", "get_tool", "(", "\"portal_workfl...
Generate workflow information of the assigned workflows :param brain_or_object: A single catalog brain or content object :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain :param endpoint: The named URL endpoint for the root of the items :type endpoint: str/unicode :returns: Wor...
[ "Generate", "workflow", "information", "of", "the", "assigned", "workflows" ]
python
train
saltstack/salt
salt/states/azurearm_network.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/azurearm_network.py#L737-L1052
def security_rule_present(name, access, direction, priority, protocol, security_group, resource_group, destination_address_prefix=None, destination_port_range=None, source_address_prefix=None, source_port_range=None, description=None, destination_address_prefixes=None...
[ "def", "security_rule_present", "(", "name", ",", "access", ",", "direction", ",", "priority", ",", "protocol", ",", "security_group", ",", "resource_group", ",", "destination_address_prefix", "=", "None", ",", "destination_port_range", "=", "None", ",", "source_add...
.. versionadded:: 2019.2.0 Ensure a security rule exists. :param name: Name of the security rule. :param access: 'allow' or 'deny' :param direction: 'inbound' or 'outbound' :param priority: Integer between 100 and 4096 used for ordering rule application. :pa...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
python
train
billy-yoyo/RainbowSixSiege-Python-API
r6sapi/r6sapi.py
https://github.com/billy-yoyo/RainbowSixSiege-Python-API/blob/9860fdfd9a78aabd977eaa71b0a4ab4ed69e94d0/r6sapi/r6sapi.py#L518-L539
def get_player(self, name=None, platform=None, uid=None): """|coro| Calls get_players and returns the first element, exactly one of uid and name must be given, platform must be given Parameters ---------- name : str the name of the player you're searching fo...
[ "def", "get_player", "(", "self", ",", "name", "=", "None", ",", "platform", "=", "None", ",", "uid", "=", "None", ")", ":", "results", "=", "yield", "from", "self", ".", "get_players", "(", "name", "=", "name", ",", "platform", "=", "platform", ",",...
|coro| Calls get_players and returns the first element, exactly one of uid and name must be given, platform must be given Parameters ---------- name : str the name of the player you're searching for platform : str the name of the platform you're ...
[ "|coro|" ]
python
train
gaqzi/gocd-cli
gocd_cli/utils.py
https://github.com/gaqzi/gocd-cli/blob/ca8df8ec2274fdc69bce0619aa3794463c4f5a6f/gocd_cli/utils.py#L126-L151
def get_settings(section='gocd', settings_paths=('~/.gocd/gocd-cli.cfg', '/etc/go/gocd-cli.cfg')): """Returns a `gocd_cli.settings.Settings` configured for settings file The settings will be read from environment variables first, then it'll be read from the first config file found (if any). Environmen...
[ "def", "get_settings", "(", "section", "=", "'gocd'", ",", "settings_paths", "=", "(", "'~/.gocd/gocd-cli.cfg'", ",", "'/etc/go/gocd-cli.cfg'", ")", ")", ":", "if", "isinstance", "(", "settings_paths", ",", "basestring", ")", ":", "settings_paths", "=", "(", "se...
Returns a `gocd_cli.settings.Settings` configured for settings file The settings will be read from environment variables first, then it'll be read from the first config file found (if any). Environment variables are expected to be in UPPERCASE and to be prefixed with `GOCD_`. Args: section:...
[ "Returns", "a", "gocd_cli", ".", "settings", ".", "Settings", "configured", "for", "settings", "file" ]
python
train
gccxml/pygccxml
pygccxml/declarations/type_traits.py
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits.py#L288-L294
def array_size(type_): """returns array size""" nake_type = remove_alias(type_) nake_type = remove_reference(nake_type) nake_type = remove_cv(nake_type) assert isinstance(nake_type, cpptypes.array_t) return nake_type.size
[ "def", "array_size", "(", "type_", ")", ":", "nake_type", "=", "remove_alias", "(", "type_", ")", "nake_type", "=", "remove_reference", "(", "nake_type", ")", "nake_type", "=", "remove_cv", "(", "nake_type", ")", "assert", "isinstance", "(", "nake_type", ",", ...
returns array size
[ "returns", "array", "size" ]
python
train
astorfi/speechpy
speechpy/processing.py
https://github.com/astorfi/speechpy/blob/9e99ae81398e7584e6234db371d6d7b5e8736192/speechpy/processing.py#L239-L271
def cmvn(vec, variance_normalization=False): """ This function is aimed to perform global cepstral mean and variance normalization (CMVN) on input feature vector "vec". The code assumes that there is one observation per row. Args: vec (array): input feature matrix (size:(num...
[ "def", "cmvn", "(", "vec", ",", "variance_normalization", "=", "False", ")", ":", "eps", "=", "2", "**", "-", "30", "rows", ",", "cols", "=", "vec", ".", "shape", "# Mean calculation", "norm", "=", "np", ".", "mean", "(", "vec", ",", "axis", "=", "...
This function is aimed to perform global cepstral mean and variance normalization (CMVN) on input feature vector "vec". The code assumes that there is one observation per row. Args: vec (array): input feature matrix (size:(num_observation,num_features)) variance_normaliz...
[ "This", "function", "is", "aimed", "to", "perform", "global", "cepstral", "mean", "and", "variance", "normalization", "(", "CMVN", ")", "on", "input", "feature", "vector", "vec", ".", "The", "code", "assumes", "that", "there", "is", "one", "observation", "pe...
python
train
tensorflow/tensor2tensor
tensor2tensor/models/resnet.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/resnet.py#L719-L727
def resnet_cifar_15(): """Set of hyperparameters.""" hp = resnet_base() hp.block_fn = "residual" hp.is_cifar = True hp.layer_sizes = [2, 2, 2] hp.filter_sizes = [16, 32, 64, 128] return hp
[ "def", "resnet_cifar_15", "(", ")", ":", "hp", "=", "resnet_base", "(", ")", "hp", ".", "block_fn", "=", "\"residual\"", "hp", ".", "is_cifar", "=", "True", "hp", ".", "layer_sizes", "=", "[", "2", ",", "2", ",", "2", "]", "hp", ".", "filter_sizes", ...
Set of hyperparameters.
[ "Set", "of", "hyperparameters", "." ]
python
train
fitnr/convertdate
convertdate/islamic.py
https://github.com/fitnr/convertdate/blob/e920f168a87f99183b0aa7290d6c3af222582d43/convertdate/islamic.py#L28-L30
def to_jd(year, month, day): '''Determine Julian day count from Islamic date''' return (day + ceil(29.5 * (month - 1)) + (year - 1) * 354 + trunc((3 + (11 * year)) / 30) + EPOCH) - 1
[ "def", "to_jd", "(", "year", ",", "month", ",", "day", ")", ":", "return", "(", "day", "+", "ceil", "(", "29.5", "*", "(", "month", "-", "1", ")", ")", "+", "(", "year", "-", "1", ")", "*", "354", "+", "trunc", "(", "(", "3", "+", "(", "1...
Determine Julian day count from Islamic date
[ "Determine", "Julian", "day", "count", "from", "Islamic", "date" ]
python
train
thumbor/thumbor
thumbor/filters/frame.py
https://github.com/thumbor/thumbor/blob/558ccdd6e3bc29e1c9ee3687372c4b3eb05ac607/thumbor/filters/frame.py#L50-L76
def handle_padding(self, padding): '''Pads the image with transparent pixels if necessary.''' left = padding[0] top = padding[1] right = padding[2] bottom = padding[3] offset_x = 0 offset_y = 0 new_width = self.engine.size[0] new_height = self.eng...
[ "def", "handle_padding", "(", "self", ",", "padding", ")", ":", "left", "=", "padding", "[", "0", "]", "top", "=", "padding", "[", "1", "]", "right", "=", "padding", "[", "2", "]", "bottom", "=", "padding", "[", "3", "]", "offset_x", "=", "0", "o...
Pads the image with transparent pixels if necessary.
[ "Pads", "the", "image", "with", "transparent", "pixels", "if", "necessary", "." ]
python
train
PmagPy/PmagPy
programs/conversion_scripts2/sio_magic2.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/conversion_scripts2/sio_magic2.py#L8-L693
def main(command_line=True, **kwargs): """ NAME sio_magic.py DESCRIPTION converts SIO .mag format files to magic_measurements format files SYNTAX sio_magic.py [command line options] OPTIONS -h: prints the help message and quits. -usr USER: identify user, ...
[ "def", "main", "(", "command_line", "=", "True", ",", "*", "*", "kwargs", ")", ":", "# initialize some stuff", "mag_file", "=", "None", "codelist", "=", "None", "infile_type", "=", "\"mag\"", "noave", "=", "0", "methcode", ",", "inst", "=", "\"LP-NO\"", ",...
NAME sio_magic.py DESCRIPTION converts SIO .mag format files to magic_measurements format files SYNTAX sio_magic.py [command line options] OPTIONS -h: prints the help message and quits. -usr USER: identify user, default is "" -f FILE: specify .mag format ...
[ "NAME", "sio_magic", ".", "py" ]
python
train
lokhman/pydbal
pydbal/threading.py
https://github.com/lokhman/pydbal/blob/53f396a2a18826e9fff178cd2c0636c1656cbaea/pydbal/threading.py#L161-L169
def insert(self, table, values): """Inserts a table row with specified data. :param table: the expression of the table to insert data into, quoted or unquoted :param values: a dictionary containing column-value pairs :return: last inserted ID """ with self.locked() as co...
[ "def", "insert", "(", "self", ",", "table", ",", "values", ")", ":", "with", "self", ".", "locked", "(", ")", "as", "conn", ":", "return", "conn", ".", "insert", "(", "table", ",", "values", ")" ]
Inserts a table row with specified data. :param table: the expression of the table to insert data into, quoted or unquoted :param values: a dictionary containing column-value pairs :return: last inserted ID
[ "Inserts", "a", "table", "row", "with", "specified", "data", "." ]
python
train
pylast/pylast
src/pylast/__init__.py
https://github.com/pylast/pylast/blob/a52f66d316797fc819b5f1d186d77f18ba97b4ff/src/pylast/__init__.py#L514-L521
def get_album_by_mbid(self, mbid): """Looks up an album by its MusicBrainz ID""" params = {"mbid": mbid} doc = _Request(self, "album.getInfo", params).execute(True) return Album(_extract(doc, "artist"), _extract(doc, "name"), self)
[ "def", "get_album_by_mbid", "(", "self", ",", "mbid", ")", ":", "params", "=", "{", "\"mbid\"", ":", "mbid", "}", "doc", "=", "_Request", "(", "self", ",", "\"album.getInfo\"", ",", "params", ")", ".", "execute", "(", "True", ")", "return", "Album", "(...
Looks up an album by its MusicBrainz ID
[ "Looks", "up", "an", "album", "by", "its", "MusicBrainz", "ID" ]
python
train
mk-fg/feedjack
feedjack/fjlib.py
https://github.com/mk-fg/feedjack/blob/3fe65c0f66dc2cfdf45834aaa7235ec9f81b3ca3/feedjack/fjlib.py#L131-L169
def get_page(site, page=1, **criterias): 'Returns a paginator object and a requested page from it.' global _since_formats_vary if 'since' in criterias: since = criterias['since'] if since in _since_offsets: since = datetime.today() - timedelta(_since_offsets[since]) else: if _since_formats_vary: for...
[ "def", "get_page", "(", "site", ",", "page", "=", "1", ",", "*", "*", "criterias", ")", ":", "global", "_since_formats_vary", "if", "'since'", "in", "criterias", ":", "since", "=", "criterias", "[", "'since'", "]", "if", "since", "in", "_since_offsets", ...
Returns a paginator object and a requested page from it.
[ "Returns", "a", "paginator", "object", "and", "a", "requested", "page", "from", "it", "." ]
python
train
KyleWpppd/css-audit
cssaudit/parser.py
https://github.com/KyleWpppd/css-audit/blob/cab4d4204cf30d54bc1881deee6ad92ae6aacc56/cssaudit/parser.py#L154-L200
def parse_inline_styles(self, data=None, import_type ='string'): """ Function for parsing styles defined in the body of the document. This only includes data inside of HTML <style> tags, a URL, or file to open. """ if data is None: raise parser = cssutils.CSS...
[ "def", "parse_inline_styles", "(", "self", ",", "data", "=", "None", ",", "import_type", "=", "'string'", ")", ":", "if", "data", "is", "None", ":", "raise", "parser", "=", "cssutils", ".", "CSSParser", "(", ")", "if", "import_type", "==", "'string'", ":...
Function for parsing styles defined in the body of the document. This only includes data inside of HTML <style> tags, a URL, or file to open.
[ "Function", "for", "parsing", "styles", "defined", "in", "the", "body", "of", "the", "document", ".", "This", "only", "includes", "data", "inside", "of", "HTML", "<style", ">", "tags", "a", "URL", "or", "file", "to", "open", "." ]
python
train
wooyek/django-powerbank
setup.py
https://github.com/wooyek/django-powerbank/blob/df91189f2ac18bacc545ccf3c81c4465fb993949/setup.py#L42-L50
def get_version(*file_paths): """Retrieves the version from path""" filename = os.path.join(os.path.dirname(__file__), *file_paths) print("Looking for version in: {}".format(filename)) version_file = open(filename).read() version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file,...
[ "def", "get_version", "(", "*", "file_paths", ")", ":", "filename", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "*", "file_paths", ")", "print", "(", "\"Looking for version in: {}\"", ".", "form...
Retrieves the version from path
[ "Retrieves", "the", "version", "from", "path" ]
python
train
bollwyvl/nosebook
nosebook.py
https://github.com/bollwyvl/nosebook/blob/6a79104b9be4b5acf1ff06cbf745f220a54a4613/nosebook.py#L136-L165
def configure(self, options, conf): """ apply configured options """ super(Nosebook, self).configure(options, conf) self.testMatch = re.compile(options.nosebookTestMatch).match self.testMatchCell = re.compile(options.nosebookTestMatchCell).match scrubs = [] ...
[ "def", "configure", "(", "self", ",", "options", ",", "conf", ")", ":", "super", "(", "Nosebook", ",", "self", ")", ".", "configure", "(", "options", ",", "conf", ")", "self", ".", "testMatch", "=", "re", ".", "compile", "(", "options", ".", "noseboo...
apply configured options
[ "apply", "configured", "options" ]
python
train
jaraco/irc
irc/message.py
https://github.com/jaraco/irc/blob/571c1f448d5d5bb92bbe2605c33148bf6e698413/irc/message.py#L6-L36
def parse(item): r""" >>> Tag.parse('x') == {'key': 'x', 'value': None} True >>> Tag.parse('x=yes') == {'key': 'x', 'value': 'yes'} True >>> Tag.parse('x=3')['value'] '3' >>> Tag.parse('x=red fox\\:green eggs')['value'] 'red fox;green eggs' ...
[ "def", "parse", "(", "item", ")", ":", "key", ",", "sep", ",", "value", "=", "item", ".", "partition", "(", "'='", ")", "value", "=", "value", ".", "replace", "(", "'\\\\:'", ",", "';'", ")", "value", "=", "value", ".", "replace", "(", "'\\\\s'", ...
r""" >>> Tag.parse('x') == {'key': 'x', 'value': None} True >>> Tag.parse('x=yes') == {'key': 'x', 'value': 'yes'} True >>> Tag.parse('x=3')['value'] '3' >>> Tag.parse('x=red fox\\:green eggs')['value'] 'red fox;green eggs' >>> Tag.parse('x=red...
[ "r", ">>>", "Tag", ".", "parse", "(", "x", ")", "==", "{", "key", ":", "x", "value", ":", "None", "}", "True" ]
python
train
keans/lmnotify
lmnotify/ssdp.py
https://github.com/keans/lmnotify/blob/b0a5282a582e5090852dc20fea8a135ca258d0d3/lmnotify/ssdp.py#L117-L180
def get_filtered_devices( self, model_name, device_types="upnp:rootdevice", timeout=2 ): """ returns a dict of devices that contain the given model name """ # get list of all UPNP devices in the network upnp_devices = self.discover_upnp_devices(st=device_types) ...
[ "def", "get_filtered_devices", "(", "self", ",", "model_name", ",", "device_types", "=", "\"upnp:rootdevice\"", ",", "timeout", "=", "2", ")", ":", "# get list of all UPNP devices in the network", "upnp_devices", "=", "self", ".", "discover_upnp_devices", "(", "st", "...
returns a dict of devices that contain the given model name
[ "returns", "a", "dict", "of", "devices", "that", "contain", "the", "given", "model", "name" ]
python
train
StackStorm/pybind
pybind/nos/v6_0_2f/brocade_xstp_ext_rpc/get_stp_brief_info/output/spanning_tree_info/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/nos/v6_0_2f/brocade_xstp_ext_rpc/get_stp_brief_info/output/spanning_tree_info/__init__.py#L140-L161
def _set_stp(self, v, load=False): """ Setter method for stp, mapped from YANG variable /brocade_xstp_ext_rpc/get_stp_brief_info/output/spanning_tree_info/stp (container) If this variable is read-only (config: false) in the source YANG file, then _set_stp is considered as a private method. Backends ...
[ "def", "_set_stp", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", "base", "...
Setter method for stp, mapped from YANG variable /brocade_xstp_ext_rpc/get_stp_brief_info/output/spanning_tree_info/stp (container) If this variable is read-only (config: false) in the source YANG file, then _set_stp is considered as a private method. Backends looking to populate this variable should do...
[ "Setter", "method", "for", "stp", "mapped", "from", "YANG", "variable", "/", "brocade_xstp_ext_rpc", "/", "get_stp_brief_info", "/", "output", "/", "spanning_tree_info", "/", "stp", "(", "container", ")", "If", "this", "variable", "is", "read", "-", "only", "(...
python
train
pywbem/pywbem
pywbem/_subscription_manager.py
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/_subscription_manager.py#L442-L455
def remove_all_servers(self): """ Remove all registered WBEM servers from the subscription manager. This also unregisters listeners from these servers and removes all owned indication subscriptions, owned indication filters, and owned listener destinations. Raises: ...
[ "def", "remove_all_servers", "(", "self", ")", ":", "for", "server_id", "in", "list", "(", "self", ".", "_servers", ".", "keys", "(", ")", ")", ":", "self", ".", "remove_server", "(", "server_id", ")" ]
Remove all registered WBEM servers from the subscription manager. This also unregisters listeners from these servers and removes all owned indication subscriptions, owned indication filters, and owned listener destinations. Raises: Exceptions raised by :class:`~pywbem.WBEMC...
[ "Remove", "all", "registered", "WBEM", "servers", "from", "the", "subscription", "manager", ".", "This", "also", "unregisters", "listeners", "from", "these", "servers", "and", "removes", "all", "owned", "indication", "subscriptions", "owned", "indication", "filters"...
python
train
henocdz/workon
workon/script.py
https://github.com/henocdz/workon/blob/46f1f6dc4ea95d8efd10adf93a06737237a6874d/workon/script.py#L49-L66
def _path_is_valid(self, path): """validates if a given path is: - absolute, - exists on current machine - is a directory """ VALIDATORS = [ (os.path.isabs, self._ERROR_PATH_NOT_ABSOLUTE), (os.path.exists, self._ERROR_PATH_DOESNT_EXISTS), ...
[ "def", "_path_is_valid", "(", "self", ",", "path", ")", ":", "VALIDATORS", "=", "[", "(", "os", ".", "path", ".", "isabs", ",", "self", ".", "_ERROR_PATH_NOT_ABSOLUTE", ")", ",", "(", "os", ".", "path", ".", "exists", ",", "self", ".", "_ERROR_PATH_DOE...
validates if a given path is: - absolute, - exists on current machine - is a directory
[ "validates", "if", "a", "given", "path", "is", ":", "-", "absolute", "-", "exists", "on", "current", "machine", "-", "is", "a", "directory" ]
python
train
Chilipp/psyplot
psyplot/data.py
https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L4602-L4613
def _register_update(self, method='isel', replot=False, dims={}, fmt={}, force=False, todefault=False): """ Register new dimensions and formatoptions for updating Parameters ---------- %(InteractiveArray._register_update.parameters)s""" ArrayList...
[ "def", "_register_update", "(", "self", ",", "method", "=", "'isel'", ",", "replot", "=", "False", ",", "dims", "=", "{", "}", ",", "fmt", "=", "{", "}", ",", "force", "=", "False", ",", "todefault", "=", "False", ")", ":", "ArrayList", ".", "_regi...
Register new dimensions and formatoptions for updating Parameters ---------- %(InteractiveArray._register_update.parameters)s
[ "Register", "new", "dimensions", "and", "formatoptions", "for", "updating" ]
python
train
mental32/spotify.py
spotify/http.py
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/http.py#L286-L295
def artist_related_artists(self, spotify_id): """Get related artists for an artist by their ID. Parameters ---------- spotify_id : str The spotify_id to search by. """ route = Route('GET', '/artists/{spotify_id}/related-artists', spotify_id=spotify_id) ...
[ "def", "artist_related_artists", "(", "self", ",", "spotify_id", ")", ":", "route", "=", "Route", "(", "'GET'", ",", "'/artists/{spotify_id}/related-artists'", ",", "spotify_id", "=", "spotify_id", ")", "return", "self", ".", "request", "(", "route", ")" ]
Get related artists for an artist by their ID. Parameters ---------- spotify_id : str The spotify_id to search by.
[ "Get", "related", "artists", "for", "an", "artist", "by", "their", "ID", "." ]
python
test
tkf/rash
rash/watchrecord.py
https://github.com/tkf/rash/blob/585da418ec37dd138f1a4277718b6f507e9536a2/rash/watchrecord.py#L48-L74
def watch_record(indexer, use_polling=False): """ Start watching `cfstore.record_path`. :type indexer: rash.indexer.Indexer """ if use_polling: from watchdog.observers.polling import PollingObserver as Observer Observer # fool pyflakes else: from watchdog.observers imp...
[ "def", "watch_record", "(", "indexer", ",", "use_polling", "=", "False", ")", ":", "if", "use_polling", ":", "from", "watchdog", ".", "observers", ".", "polling", "import", "PollingObserver", "as", "Observer", "Observer", "# fool pyflakes", "else", ":", "from", ...
Start watching `cfstore.record_path`. :type indexer: rash.indexer.Indexer
[ "Start", "watching", "cfstore", ".", "record_path", "." ]
python
train
developersociety/django-glitter
glitter/page.py
https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/page.py#L176-L184
def add_block_widget(self, top=False): """ Return a select widget for blocks which can be added to this column. """ widget = AddBlockSelect(attrs={ 'class': 'glitter-add-block-select', }, choices=self.add_block_options(top=top)) return widget.render(name='', ...
[ "def", "add_block_widget", "(", "self", ",", "top", "=", "False", ")", ":", "widget", "=", "AddBlockSelect", "(", "attrs", "=", "{", "'class'", ":", "'glitter-add-block-select'", ",", "}", ",", "choices", "=", "self", ".", "add_block_options", "(", "top", ...
Return a select widget for blocks which can be added to this column.
[ "Return", "a", "select", "widget", "for", "blocks", "which", "can", "be", "added", "to", "this", "column", "." ]
python
train
philklei/tahoma-api
tahoma_api/tahoma_api.py
https://github.com/philklei/tahoma-api/blob/fc84f6ba3b673d0cd0e9e618777834a74a3c7b64/tahoma_api/tahoma_api.py#L70-L114
def get_user(self): """Get the user informations from the server. :return: a dict with all the informations :rtype: dict raises ValueError in case of protocol issues :Example: >>> "creationTime": <time>, >>> "lastUpdateTime": <time>, >>> "userId": "<em...
[ "def", "get_user", "(", "self", ")", ":", "header", "=", "BASE_HEADERS", ".", "copy", "(", ")", "header", "[", "'Cookie'", "]", "=", "self", ".", "__cookie", "request", "=", "requests", ".", "get", "(", "BASE_URL", "+", "'getEndUser'", ",", "headers", ...
Get the user informations from the server. :return: a dict with all the informations :rtype: dict raises ValueError in case of protocol issues :Example: >>> "creationTime": <time>, >>> "lastUpdateTime": <time>, >>> "userId": "<email for login>", >>> "t...
[ "Get", "the", "user", "informations", "from", "the", "server", "." ]
python
train
rsmuc/health_monitoring_plugins
health_monitoring_plugins/__init__.py
https://github.com/rsmuc/health_monitoring_plugins/blob/7ac29dfb9fe46c055b018cb72ad0d7d8065589b9/health_monitoring_plugins/__init__.py#L87-L103
def walk_snmp_values(sess, helper, oid, check): """ return a snmp value or exits the plugin with unknown""" try: snmp_walk = sess.walk_oid(oid) result_list = [] for x in range(len(snmp_walk)): result_list.append(snmp_walk[x].val) if resul...
[ "def", "walk_snmp_values", "(", "sess", ",", "helper", ",", "oid", ",", "check", ")", ":", "try", ":", "snmp_walk", "=", "sess", ".", "walk_oid", "(", "oid", ")", "result_list", "=", "[", "]", "for", "x", "in", "range", "(", "len", "(", "snmp_walk", ...
return a snmp value or exits the plugin with unknown
[ "return", "a", "snmp", "value", "or", "exits", "the", "plugin", "with", "unknown" ]
python
train
openspending/os-package-registry
os_package_registry/package_registry.py
https://github.com/openspending/os-package-registry/blob/02f3628340417ed7d943a6cc6c25ea0469de22cd/os_package_registry/package_registry.py#L256-L290
def get_stats(self): """ Get some stats on the packages in the registry """ try: query = { # We only care about the aggregations, so don't return the hits 'size': 0, 'aggs': { 'num_packages': { ...
[ "def", "get_stats", "(", "self", ")", ":", "try", ":", "query", "=", "{", "# We only care about the aggregations, so don't return the hits", "'size'", ":", "0", ",", "'aggs'", ":", "{", "'num_packages'", ":", "{", "'value_count'", ":", "{", "'field'", ":", "'id'...
Get some stats on the packages in the registry
[ "Get", "some", "stats", "on", "the", "packages", "in", "the", "registry" ]
python
train
psd-tools/psd-tools
src/psd_tools/api/smart_object.py
https://github.com/psd-tools/psd-tools/blob/4952b57bcf1cf2c1f16fd9d6d51d4fa0b53bce4e/src/psd_tools/api/smart_object.py#L94-L98
def filesize(self): """File size of the object.""" if self.kind == 'data': return len(self._data.data) return self._data.filesize
[ "def", "filesize", "(", "self", ")", ":", "if", "self", ".", "kind", "==", "'data'", ":", "return", "len", "(", "self", ".", "_data", ".", "data", ")", "return", "self", ".", "_data", ".", "filesize" ]
File size of the object.
[ "File", "size", "of", "the", "object", "." ]
python
train
tensorflow/tensorboard
tensorboard/summary/writer/event_file_writer.py
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/summary/writer/event_file_writer.py#L157-L165
def close(self): '''Closes the underlying writer, flushing any pending writes first.''' if not self._closed: with self._lock: if not self._closed: self._closed = True self._worker.stop() self._writer.flush() ...
[ "def", "close", "(", "self", ")", ":", "if", "not", "self", ".", "_closed", ":", "with", "self", ".", "_lock", ":", "if", "not", "self", ".", "_closed", ":", "self", ".", "_closed", "=", "True", "self", ".", "_worker", ".", "stop", "(", ")", "sel...
Closes the underlying writer, flushing any pending writes first.
[ "Closes", "the", "underlying", "writer", "flushing", "any", "pending", "writes", "first", "." ]
python
train
PmagPy/PmagPy
programs/thellier_magic.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/thellier_magic.py#L18-L100
def main(): """ NAME thellier_magic.py DESCRIPTION plots Thellier-Thellier data in version 3.0 format Reads saved interpretations from a specimen formatted table, default: specimens.txt SYNTAX thellier_magic.py [command line options] OPTIONS -h prints help ...
[ "def", "main", "(", ")", ":", "#", "# parse command line options", "#", "if", "'-h'", "in", "sys", ".", "argv", ":", "print", "(", "main", ".", "__doc__", ")", "sys", ".", "exit", "(", ")", "dir_path", "=", "pmag", ".", "get_named_arg", "(", "\"-WD\"",...
NAME thellier_magic.py DESCRIPTION plots Thellier-Thellier data in version 3.0 format Reads saved interpretations from a specimen formatted table, default: specimens.txt SYNTAX thellier_magic.py [command line options] OPTIONS -h prints help message and quits ...
[ "NAME", "thellier_magic", ".", "py" ]
python
train
SHTOOLS/SHTOOLS
pyshtools/make_docs.py
https://github.com/SHTOOLS/SHTOOLS/blob/9a115cf83002df2ddec6b7f41aeb6be688e285de/pyshtools/make_docs.py#L143-L188
def process_f2pydoc(f2pydoc): """ this function replace all optional _d0 arguments with their default values in the function signature. These arguments are not intended to be used and signify merely the array dimensions of the associated argument. """ # ---- split f2py document in its parts ...
[ "def", "process_f2pydoc", "(", "f2pydoc", ")", ":", "# ---- split f2py document in its parts", "# 0=Call Signature", "# 1=Parameters", "# 2=Other (optional) Parameters (only if present)", "# 3=Returns", "docparts", "=", "re", ".", "split", "(", "'\\n--'", ",", "f2pydoc", ")",...
this function replace all optional _d0 arguments with their default values in the function signature. These arguments are not intended to be used and signify merely the array dimensions of the associated argument.
[ "this", "function", "replace", "all", "optional", "_d0", "arguments", "with", "their", "default", "values", "in", "the", "function", "signature", ".", "These", "arguments", "are", "not", "intended", "to", "be", "used", "and", "signify", "merely", "the", "array...
python
train
knipknap/exscript
Exscript/protocols/protocol.py
https://github.com/knipknap/exscript/blob/72718eee3e87b345d5a5255be9824e867e42927b/Exscript/protocols/protocol.py#L989-L1030
def waitfor(self, prompt): """ Monitors the data received from the remote host and waits until the response matches the given prompt. Once a match has been found, the buffer containing incoming data is NOT changed. In other words, consecutive calls to this function will a...
[ "def", "waitfor", "(", "self", ",", "prompt", ")", ":", "while", "True", ":", "try", ":", "result", "=", "self", ".", "_waitfor", "(", "prompt", ")", "except", "DriverReplacedException", ":", "continue", "# retry", "return", "result" ]
Monitors the data received from the remote host and waits until the response matches the given prompt. Once a match has been found, the buffer containing incoming data is NOT changed. In other words, consecutive calls to this function will always work, e.g.:: conn.waitfor('m...
[ "Monitors", "the", "data", "received", "from", "the", "remote", "host", "and", "waits", "until", "the", "response", "matches", "the", "given", "prompt", ".", "Once", "a", "match", "has", "been", "found", "the", "buffer", "containing", "incoming", "data", "is...
python
train
PyPSA/PyPSA
pypsa/components.py
https://github.com/PyPSA/PyPSA/blob/46954b1b3c21460550f7104681517065279a53b7/pypsa/components.py#L472-L503
def remove(self, class_name, name): """ Removes a single component from the network. Removes it from component DataFrames. Parameters ---------- class_name : string Component class name name : string Component name Examples ...
[ "def", "remove", "(", "self", ",", "class_name", ",", "name", ")", ":", "if", "class_name", "not", "in", "self", ".", "components", ":", "logger", ".", "error", "(", "\"Component class {} not found\"", ".", "format", "(", "class_name", ")", ")", "return", ...
Removes a single component from the network. Removes it from component DataFrames. Parameters ---------- class_name : string Component class name name : string Component name Examples -------- >>> network.remove("Line","my_line 1...
[ "Removes", "a", "single", "component", "from", "the", "network", "." ]
python
train
satellogic/telluric
telluric/georaster.py
https://github.com/satellogic/telluric/blob/e752cd3ee71e339f79717e526fde362e80055d9e/telluric/georaster.py#L1364-L1421
def reproject(self, dst_crs=None, resolution=None, dimensions=None, src_bounds=None, dst_bounds=None, target_aligned_pixels=False, resampling=Resampling.cubic, creation_options=None, **kwargs): """Return re-projected raster to new raster. Parameters ---------...
[ "def", "reproject", "(", "self", ",", "dst_crs", "=", "None", ",", "resolution", "=", "None", ",", "dimensions", "=", "None", ",", "src_bounds", "=", "None", ",", "dst_bounds", "=", "None", ",", "target_aligned_pixels", "=", "False", ",", "resampling", "="...
Return re-projected raster to new raster. Parameters ------------ dst_crs: rasterio.crs.CRS, optional Target coordinate reference system. resolution: tuple (x resolution, y resolution) or float, optional Target resolution, in units of target coordinate reference ...
[ "Return", "re", "-", "projected", "raster", "to", "new", "raster", "." ]
python
train
nerdvegas/rez
src/rez/solver.py
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L2137-L2157
def dump(self): """Print a formatted summary of the current solve state.""" from rez.utils.formatting import columnise rows = [] for i, phase in enumerate(self.phase_stack): rows.append((self._depth_label(i), phase.status, str(phase))) print "status: %s (%s)" % (sel...
[ "def", "dump", "(", "self", ")", ":", "from", "rez", ".", "utils", ".", "formatting", "import", "columnise", "rows", "=", "[", "]", "for", "i", ",", "phase", "in", "enumerate", "(", "self", ".", "phase_stack", ")", ":", "rows", ".", "append", "(", ...
Print a formatted summary of the current solve state.
[ "Print", "a", "formatted", "summary", "of", "the", "current", "solve", "state", "." ]
python
train
tensorflow/datasets
tensorflow_datasets/image/image_folder.py
https://github.com/tensorflow/datasets/blob/46ceb0cf7b4690f38ecbbc689e4d659a903d08dc/tensorflow_datasets/image/image_folder.py#L156-L164
def _generate_examples(self, label_images): """Generate example for each image in the dict.""" for label, image_paths in label_images.items(): for image_path in image_paths: yield { "image": image_path, "label": label, }
[ "def", "_generate_examples", "(", "self", ",", "label_images", ")", ":", "for", "label", ",", "image_paths", "in", "label_images", ".", "items", "(", ")", ":", "for", "image_path", "in", "image_paths", ":", "yield", "{", "\"image\"", ":", "image_path", ",", ...
Generate example for each image in the dict.
[ "Generate", "example", "for", "each", "image", "in", "the", "dict", "." ]
python
train
gccxml/pygccxml
pygccxml/declarations/type_traits_classes.py
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/declarations/type_traits_classes.py#L788-L818
def is_unary_operator(oper): """returns True, if operator is unary operator, otherwise False""" # definition: # member in class # ret-type operator symbol() # ret-type operator [++ --](int) # globally # ret-type operator symbol( arg ) # ret-type operator [++ --](X&, int) symbols = ['...
[ "def", "is_unary_operator", "(", "oper", ")", ":", "# definition:", "# member in class", "# ret-type operator symbol()", "# ret-type operator [++ --](int)", "# globally", "# ret-type operator symbol( arg )", "# ret-type operator [++ --](X&, int)", "symbols", "=", "[", "'!'", ",", ...
returns True, if operator is unary operator, otherwise False
[ "returns", "True", "if", "operator", "is", "unary", "operator", "otherwise", "False" ]
python
train
bukun/TorCMS
torcms/model/user_model.py
https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/user_model.py#L66-L76
def check_user(user_id, u_pass): ''' Checking the password by user's ID. ''' user_count = TabMember.select().where(TabMember.uid == user_id).count() if user_count == 0: return -1 the_user = TabMember.get(uid=user_id) if the_user.user_pass == tools.md5(...
[ "def", "check_user", "(", "user_id", ",", "u_pass", ")", ":", "user_count", "=", "TabMember", ".", "select", "(", ")", ".", "where", "(", "TabMember", ".", "uid", "==", "user_id", ")", ".", "count", "(", ")", "if", "user_count", "==", "0", ":", "retu...
Checking the password by user's ID.
[ "Checking", "the", "password", "by", "user", "s", "ID", "." ]
python
train
diffeo/rejester
rejester/_task_master.py
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L378-L441
def _refresh(self, session, stopping=False): '''Get this task's current state. This must be called under the registry's lock. It updates the :attr:`finished` and :attr:`failed` flags and the :attr:`data` dictionary based on the current state in the registry. In the nor...
[ "def", "_refresh", "(", "self", ",", "session", ",", "stopping", "=", "False", ")", ":", "data", "=", "session", ".", "get", "(", "WORK_UNITS_", "+", "self", ".", "work_spec_name", "+", "_FINISHED", ",", "self", ".", "key", ")", "if", "data", "is", "...
Get this task's current state. This must be called under the registry's lock. It updates the :attr:`finished` and :attr:`failed` flags and the :attr:`data` dictionary based on the current state in the registry. In the normal case, nothing will change and this function ...
[ "Get", "this", "task", "s", "current", "state", "." ]
python
train
ralphbean/taskw
taskw/warrior.py
https://github.com/ralphbean/taskw/blob/11e2f9132eaedd157f514538de9b5f3b69c30a52/taskw/warrior.py#L827-L833
def task_start(self, **kw): """ Marks a task as started. """ id, task = self.get_task(**kw) self._execute(id, 'start') return self.get_task(uuid=task['uuid'])[1]
[ "def", "task_start", "(", "self", ",", "*", "*", "kw", ")", ":", "id", ",", "task", "=", "self", ".", "get_task", "(", "*", "*", "kw", ")", "self", ".", "_execute", "(", "id", ",", "'start'", ")", "return", "self", ".", "get_task", "(", "uuid", ...
Marks a task as started.
[ "Marks", "a", "task", "as", "started", "." ]
python
train
uber/rides-python-sdk
uber_rides/client.py
https://github.com/uber/rides-python-sdk/blob/76ecd75ab5235d792ec1010e36eca679ba285127/uber_rides/client.py#L109-L127
def get_products(self, latitude, longitude): """Get information about the Uber products offered at a given location. Parameters latitude (float) The latitude component of a location. longitude (float) The longitude component of a location. ...
[ "def", "get_products", "(", "self", ",", "latitude", ",", "longitude", ")", ":", "args", "=", "OrderedDict", "(", "[", "(", "'latitude'", ",", "latitude", ")", ",", "(", "'longitude'", ",", "longitude", ")", ",", "]", ")", "return", "self", ".", "_api_...
Get information about the Uber products offered at a given location. Parameters latitude (float) The latitude component of a location. longitude (float) The longitude component of a location. Returns (Response) A Respo...
[ "Get", "information", "about", "the", "Uber", "products", "offered", "at", "a", "given", "location", "." ]
python
train
CityOfZion/neo-boa
boa/code/module.py
https://github.com/CityOfZion/neo-boa/blob/5ec0f0acb2e2e3e4bbd3530252e6eae61b23d59b/boa/code/module.py#L234-L280
def link_methods(self): """ Perform linkage of addresses between methods. """ from ..compiler import Compiler for method in self.methods: method.prepare() self.all_vm_tokens = OrderedDict() address = 0 for method in self.orderered_methods:...
[ "def", "link_methods", "(", "self", ")", ":", "from", ".", ".", "compiler", "import", "Compiler", "for", "method", "in", "self", ".", "methods", ":", "method", ".", "prepare", "(", ")", "self", ".", "all_vm_tokens", "=", "OrderedDict", "(", ")", "address...
Perform linkage of addresses between methods.
[ "Perform", "linkage", "of", "addresses", "between", "methods", "." ]
python
train
spencerahill/aospy
aospy/data_loader.py
https://github.com/spencerahill/aospy/blob/2f6e775b9b9956c54af117fdcdce2c87196afb6c/aospy/data_loader.py#L267-L272
def _setattr_default(obj, attr, value, default): """Set an attribute of an object to a value or default value.""" if value is None: setattr(obj, attr, default) else: setattr(obj, attr, value)
[ "def", "_setattr_default", "(", "obj", ",", "attr", ",", "value", ",", "default", ")", ":", "if", "value", "is", "None", ":", "setattr", "(", "obj", ",", "attr", ",", "default", ")", "else", ":", "setattr", "(", "obj", ",", "attr", ",", "value", ")...
Set an attribute of an object to a value or default value.
[ "Set", "an", "attribute", "of", "an", "object", "to", "a", "value", "or", "default", "value", "." ]
python
train
tensorflow/tensor2tensor
tensor2tensor/layers/common_layers.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L3740-L3761
def double_discriminator(x, filters1=128, filters2=None, kernel_size=8, strides=4, pure_mean=False): """A convolutional discriminator with 2 layers and concatenated output.""" if filters2 is None: filters2 = 4 * filters1 with tf.variable_scope("discriminator"): batch_size = shape_...
[ "def", "double_discriminator", "(", "x", ",", "filters1", "=", "128", ",", "filters2", "=", "None", ",", "kernel_size", "=", "8", ",", "strides", "=", "4", ",", "pure_mean", "=", "False", ")", ":", "if", "filters2", "is", "None", ":", "filters2", "=", ...
A convolutional discriminator with 2 layers and concatenated output.
[ "A", "convolutional", "discriminator", "with", "2", "layers", "and", "concatenated", "output", "." ]
python
train
zblz/naima
naima/extern/minimize.py
https://github.com/zblz/naima/blob/d6a6781d73bf58fd8269e8b0e3b70be22723cd5b/naima/extern/minimize.py#L70-L243
def _minimize_neldermead( func, x0, args=(), callback=None, xtol=1e-4, ftol=1e-4, maxiter=None, maxfev=None, disp=False, return_all=False, ): # pragma: no cover """ Minimization of scalar function of one or more variables using the Nelder-Mead algorithm. Options...
[ "def", "_minimize_neldermead", "(", "func", ",", "x0", ",", "args", "=", "(", ")", ",", "callback", "=", "None", ",", "xtol", "=", "1e-4", ",", "ftol", "=", "1e-4", ",", "maxiter", "=", "None", ",", "maxfev", "=", "None", ",", "disp", "=", "False",...
Minimization of scalar function of one or more variables using the Nelder-Mead algorithm. Options for the Nelder-Mead algorithm are: disp : bool Set to True to print convergence messages. xtol : float Relative error in solution `xopt` acceptable for convergence. ...
[ "Minimization", "of", "scalar", "function", "of", "one", "or", "more", "variables", "using", "the", "Nelder", "-", "Mead", "algorithm", "." ]
python
train
jtwhite79/pyemu
pyemu/utils/gw_utils.py
https://github.com/jtwhite79/pyemu/blob/c504d8e7a4097cec07655a6318d275739bd8148a/pyemu/utils/gw_utils.py#L24-L57
def modflow_pval_to_template_file(pval_file,tpl_file=None): """write a template file for a modflow parameter value file. Uses names in the first column in the pval file as par names. Parameters ---------- pval_file : str parameter value file tpl_file : str, optional template fil...
[ "def", "modflow_pval_to_template_file", "(", "pval_file", ",", "tpl_file", "=", "None", ")", ":", "if", "tpl_file", "is", "None", ":", "tpl_file", "=", "pval_file", "+", "\".tpl\"", "pval_df", "=", "pd", ".", "read_csv", "(", "pval_file", ",", "delim_whitespac...
write a template file for a modflow parameter value file. Uses names in the first column in the pval file as par names. Parameters ---------- pval_file : str parameter value file tpl_file : str, optional template file to write. If None, use <pval_file>.tpl. Default is None ...
[ "write", "a", "template", "file", "for", "a", "modflow", "parameter", "value", "file", ".", "Uses", "names", "in", "the", "first", "column", "in", "the", "pval", "file", "as", "par", "names", "." ]
python
train
openvax/varcode
varcode/effects/effect_ordering.py
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/effect_ordering.py#L190-L201
def effect_has_complete_transcript(effect): """ Parameters ---------- effect : subclass of MutationEffect Returns True if effect has transcript and that transcript has complete CDS """ return apply_to_transcript_if_exists( effect=effect, fn=lambda t: t.complete, defa...
[ "def", "effect_has_complete_transcript", "(", "effect", ")", ":", "return", "apply_to_transcript_if_exists", "(", "effect", "=", "effect", ",", "fn", "=", "lambda", "t", ":", "t", ".", "complete", ",", "default", "=", "False", ")" ]
Parameters ---------- effect : subclass of MutationEffect Returns True if effect has transcript and that transcript has complete CDS
[ "Parameters", "----------", "effect", ":", "subclass", "of", "MutationEffect" ]
python
train
IvanMalison/okcupyd
okcupyd/question.py
https://github.com/IvanMalison/okcupyd/blob/46f4eaa9419098f6c299738ce148af55c64deb64/okcupyd/question.py#L148-L160
def get_answer_id_for_question(self, question): """Get the answer_id corresponding to the answer given for question by looking at this :class:`~.UserQuestion`'s answer_options. The given :class:`~.Question` instance must have the same id as this :class:`~.UserQuestion`. That thi...
[ "def", "get_answer_id_for_question", "(", "self", ",", "question", ")", ":", "assert", "question", ".", "id", "==", "self", ".", "id", "for", "answer_option", "in", "self", ".", "answer_options", ":", "if", "answer_option", ".", "text", "==", "question", "."...
Get the answer_id corresponding to the answer given for question by looking at this :class:`~.UserQuestion`'s answer_options. The given :class:`~.Question` instance must have the same id as this :class:`~.UserQuestion`. That this method exists is admittedly somewhat weird. Unfortunately...
[ "Get", "the", "answer_id", "corresponding", "to", "the", "answer", "given", "for", "question", "by", "looking", "at", "this", ":", "class", ":", "~", ".", "UserQuestion", "s", "answer_options", ".", "The", "given", ":", "class", ":", "~", ".", "Question", ...
python
train
calmjs/calmjs.parse
src/calmjs/parse/parsers/es5.py
https://github.com/calmjs/calmjs.parse/blob/369f0ee346c5a84c4d5c35a7733a0e63b02eac59/src/calmjs/parse/parsers/es5.py#L423-L429
def p_identifier_name_string(self, p): """identifier_name_string : identifier_name """ p[0] = asttypes.PropIdentifier(p[1].value) # manually clone the position attributes. for k in ('_token_map', 'lexpos', 'lineno', 'colno'): setattr(p[0], k, getattr(p[1], k))
[ "def", "p_identifier_name_string", "(", "self", ",", "p", ")", ":", "p", "[", "0", "]", "=", "asttypes", ".", "PropIdentifier", "(", "p", "[", "1", "]", ".", "value", ")", "# manually clone the position attributes.", "for", "k", "in", "(", "'_token_map'", ...
identifier_name_string : identifier_name
[ "identifier_name_string", ":", "identifier_name" ]
python
train
armet/python-armet
armet/http/response.py
https://github.com/armet/python-armet/blob/d61eca9082256cb1e7f7f3c7f2fbc4b697157de7/armet/http/response.py#L104-L106
def insert(self, name, index, value): """Insert a value at the passed index in the named header.""" return self._sequence[name].insert(index, value)
[ "def", "insert", "(", "self", ",", "name", ",", "index", ",", "value", ")", ":", "return", "self", ".", "_sequence", "[", "name", "]", ".", "insert", "(", "index", ",", "value", ")" ]
Insert a value at the passed index in the named header.
[ "Insert", "a", "value", "at", "the", "passed", "index", "in", "the", "named", "header", "." ]
python
valid
Azure/azure-storage-python
azure-storage-queue/azure/storage/queue/queueservice.py
https://github.com/Azure/azure-storage-python/blob/52327354b192cbcf6b7905118ec6b5d57fa46275/azure-storage-queue/azure/storage/queue/queueservice.py#L692-L730
def set_queue_acl(self, queue_name, signed_identifiers=None, timeout=None): ''' Sets stored access policies for the queue that may be used with Shared Access Signatures. When you set permissions for a queue, the existing permissions are replaced. To update the queue's...
[ "def", "set_queue_acl", "(", "self", ",", "queue_name", ",", "signed_identifiers", "=", "None", ",", "timeout", "=", "None", ")", ":", "_validate_not_none", "(", "'queue_name'", ",", "queue_name", ")", "_validate_access_policies", "(", "signed_identifiers", ")", "...
Sets stored access policies for the queue that may be used with Shared Access Signatures. When you set permissions for a queue, the existing permissions are replaced. To update the queue's permissions, call :func:`~get_queue_acl` to fetch all access policies associated with ...
[ "Sets", "stored", "access", "policies", "for", "the", "queue", "that", "may", "be", "used", "with", "Shared", "Access", "Signatures", ".", "When", "you", "set", "permissions", "for", "a", "queue", "the", "existing", "permissions", "are", "replaced", ".", "To...
python
train
SeabornGames/Table
seaborn_table/table.py
https://github.com/SeabornGames/Table/blob/0c474ef2fb00db0e7cf47e8af91e3556c2e7485a/seaborn_table/table.py#L1600-L1631
def _index_iterator(column_size, max_size, mix_index=False): """ This will iterate over the indexes and return a list of indexes :param column_size: list of int of the size of each list :param max_size: int of the max number of iterations :param mix_index: bool if True will g...
[ "def", "_index_iterator", "(", "column_size", ",", "max_size", ",", "mix_index", "=", "False", ")", ":", "# todo implement a proper partial factorial design", "indexes", "=", "[", "0", "]", "*", "len", "(", "column_size", ")", "index_order", "=", "[", "0", "]", ...
This will iterate over the indexes and return a list of indexes :param column_size: list of int of the size of each list :param max_size: int of the max number of iterations :param mix_index: bool if True will go first then last then middle :return: list of int of indexes
[ "This", "will", "iterate", "over", "the", "indexes", "and", "return", "a", "list", "of", "indexes", ":", "param", "column_size", ":", "list", "of", "int", "of", "the", "size", "of", "each", "list", ":", "param", "max_size", ":", "int", "of", "the", "ma...
python
train
bcbio/bcbio-nextgen
bcbio/variation/cortex.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/cortex.py#L122-L157
def _run_cortex_on_region(region, align_bam, ref_file, work_dir, out_file_base, config): """Run cortex on a specified chromosome start/end region. """ kmers = [31, 51, 71] min_reads = 1750 cortex_dir = config_utils.get_program("cortex", config, "dir") stampy_dir = config_utils.get_program("stamp...
[ "def", "_run_cortex_on_region", "(", "region", ",", "align_bam", ",", "ref_file", ",", "work_dir", ",", "out_file_base", ",", "config", ")", ":", "kmers", "=", "[", "31", ",", "51", ",", "71", "]", "min_reads", "=", "1750", "cortex_dir", "=", "config_utils...
Run cortex on a specified chromosome start/end region.
[ "Run", "cortex", "on", "a", "specified", "chromosome", "start", "/", "end", "region", "." ]
python
train
joerick/pyinstrument
pyinstrument/__main__.py
https://github.com/joerick/pyinstrument/blob/cc4f3f6fc1b493d7cd058ecf41ad012e0030a512/pyinstrument/__main__.py#L255-L274
def save_report(session): ''' Saves the session to a temp file, and returns that path. Also prunes the number of reports to 10 so there aren't loads building up. ''' # prune this folder to contain the last 10 sessions previous_reports = glob.glob(os.path.join(report_dir(), '*.pyireport')) pr...
[ "def", "save_report", "(", "session", ")", ":", "# prune this folder to contain the last 10 sessions", "previous_reports", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "report_dir", "(", ")", ",", "'*.pyireport'", ")", ")", "previous_reports...
Saves the session to a temp file, and returns that path. Also prunes the number of reports to 10 so there aren't loads building up.
[ "Saves", "the", "session", "to", "a", "temp", "file", "and", "returns", "that", "path", ".", "Also", "prunes", "the", "number", "of", "reports", "to", "10", "so", "there", "aren", "t", "loads", "building", "up", "." ]
python
train
mathandy/svgpathtools
svgpathtools/document.py
https://github.com/mathandy/svgpathtools/blob/fd7348a1dfd88b65ea61da02325c6605aedf8c4f/svgpathtools/document.py#L213-L219
def flatten_all_paths(self, group_filter=lambda x: True, path_filter=lambda x: True, path_conversions=CONVERSIONS): """Forward the tree of this document into the more general flatten_all_paths function and return the result.""" return flatten_a...
[ "def", "flatten_all_paths", "(", "self", ",", "group_filter", "=", "lambda", "x", ":", "True", ",", "path_filter", "=", "lambda", "x", ":", "True", ",", "path_conversions", "=", "CONVERSIONS", ")", ":", "return", "flatten_all_paths", "(", "self", ".", "tree"...
Forward the tree of this document into the more general flatten_all_paths function and return the result.
[ "Forward", "the", "tree", "of", "this", "document", "into", "the", "more", "general", "flatten_all_paths", "function", "and", "return", "the", "result", "." ]
python
train
horazont/aioxmpp
aioxmpp/security_layer.py
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/security_layer.py#L595-L614
def import_from_json(self, data, *, override=False): """ Import a JSON dictionary which must have the same format as exported by :meth:`export`. If *override* is true, the existing data in the pin store will be overriden with the data from `data`. Otherwise, the `data` will be ...
[ "def", "import_from_json", "(", "self", ",", "data", ",", "*", ",", "override", "=", "False", ")", ":", "if", "override", ":", "self", ".", "_storage", "=", "{", "hostname", ":", "set", "(", "self", ".", "_decode_key", "(", "key", ")", "for", "key", ...
Import a JSON dictionary which must have the same format as exported by :meth:`export`. If *override* is true, the existing data in the pin store will be overriden with the data from `data`. Otherwise, the `data` will be merged into the store.
[ "Import", "a", "JSON", "dictionary", "which", "must", "have", "the", "same", "format", "as", "exported", "by", ":", "meth", ":", "export", "." ]
python
train
mdgoldberg/sportsref
sportsref/nfl/boxscores.py
https://github.com/mdgoldberg/sportsref/blob/09f11ac856a23c96d666d1d510bb35d6f050b5c3/sportsref/nfl/boxscores.py#L105-L112
def away_score(self): """Returns score of the away team. :returns: int of the away score. """ doc = self.get_doc() table = doc('table.linescore') away_score = table('tr').eq(1)('td')[-1].text_content() return int(away_score)
[ "def", "away_score", "(", "self", ")", ":", "doc", "=", "self", ".", "get_doc", "(", ")", "table", "=", "doc", "(", "'table.linescore'", ")", "away_score", "=", "table", "(", "'tr'", ")", ".", "eq", "(", "1", ")", "(", "'td'", ")", "[", "-", "1",...
Returns score of the away team. :returns: int of the away score.
[ "Returns", "score", "of", "the", "away", "team", ".", ":", "returns", ":", "int", "of", "the", "away", "score", "." ]
python
test
JukeboxPipeline/jukeboxmaya
src/jukeboxmaya/commands.py
https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/commands.py#L101-L127
def update_scenenode(f): """Set the id of the current scene node to the id for the given file :param f: the file to save the current scene to :type f: :class:`jukeboxcore.filesys.JB_File` :returns: None :rtype: None :raises: None """ n = get_current_scene_node() if not n: ms...
[ "def", "update_scenenode", "(", "f", ")", ":", "n", "=", "get_current_scene_node", "(", ")", "if", "not", "n", ":", "msg", "=", "\"Could not find a scene node.\"", "return", "ActionStatus", "(", "ActionStatus", ".", "FAILURE", ",", "msg", ")", "# get dbentry for...
Set the id of the current scene node to the id for the given file :param f: the file to save the current scene to :type f: :class:`jukeboxcore.filesys.JB_File` :returns: None :rtype: None :raises: None
[ "Set", "the", "id", "of", "the", "current", "scene", "node", "to", "the", "id", "for", "the", "given", "file" ]
python
train
timkpaine/pyEX
pyEX/stocks.py
https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/stocks.py#L1491-L1507
def priceDF(symbol, token='', version=''): '''Price of ticker https://iexcloud.io/docs/api/#price 4:30am-8pm ET Mon-Fri Args: symbol (string); Ticker to request token (string); Access token version (string); API version Returns: DataFrame: result ''' df = p...
[ "def", "priceDF", "(", "symbol", ",", "token", "=", "''", ",", "version", "=", "''", ")", ":", "df", "=", "pd", ".", "io", ".", "json", ".", "json_normalize", "(", "{", "'price'", ":", "price", "(", "symbol", ",", "token", ",", "version", ")", "}...
Price of ticker https://iexcloud.io/docs/api/#price 4:30am-8pm ET Mon-Fri Args: symbol (string); Ticker to request token (string); Access token version (string); API version Returns: DataFrame: result
[ "Price", "of", "ticker" ]
python
valid
daler/metaseq
metaseq/integration/chipseq.py
https://github.com/daler/metaseq/blob/fa875d1f72317aa7ef95cb128b739956b16eef9f/metaseq/integration/chipseq.py#L410-L429
def xcorr(x, y, maxlags): """ Streamlined version of matplotlib's `xcorr`, without the plots. :param x, y: NumPy arrays to cross-correlate :param maxlags: Max number of lags; result will be `2*maxlags+1` in length """ xlen = len(x) ylen = len(y) assert xlen == ylen c = np.correlate...
[ "def", "xcorr", "(", "x", ",", "y", ",", "maxlags", ")", ":", "xlen", "=", "len", "(", "x", ")", "ylen", "=", "len", "(", "y", ")", "assert", "xlen", "==", "ylen", "c", "=", "np", ".", "correlate", "(", "x", ",", "y", ",", "mode", "=", "2",...
Streamlined version of matplotlib's `xcorr`, without the plots. :param x, y: NumPy arrays to cross-correlate :param maxlags: Max number of lags; result will be `2*maxlags+1` in length
[ "Streamlined", "version", "of", "matplotlib", "s", "xcorr", "without", "the", "plots", "." ]
python
train
ninuxorg/nodeshot
nodeshot/networking/net/models/interfaces/ethernet.py
https://github.com/ninuxorg/nodeshot/blob/2466f0a55f522b2696026f196436ce7ba3f1e5c6/nodeshot/networking/net/models/interfaces/ethernet.py#L21-L24
def save(self, *args, **kwargs): """ automatically set Interface.type to ethernet """ self.type = INTERFACE_TYPES.get('ethernet') super(Ethernet, self).save(*args, **kwargs)
[ "def", "save", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "type", "=", "INTERFACE_TYPES", ".", "get", "(", "'ethernet'", ")", "super", "(", "Ethernet", ",", "self", ")", ".", "save", "(", "*", "args", ",", "*",...
automatically set Interface.type to ethernet
[ "automatically", "set", "Interface", ".", "type", "to", "ethernet" ]
python
train
lowandrew/OLCTools
databasesetup/database_setup.py
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/databasesetup/database_setup.py#L197-L214
def clark(self, databasepath): """ Download and set-up the CLARK database using the set_targets.sh script. Use defaults of bacteria for database type, and species for taxonomic level :param databasepath: path to use to save the database """ if self.clarkpath: ...
[ "def", "clark", "(", "self", ",", "databasepath", ")", ":", "if", "self", ".", "clarkpath", ":", "logging", ".", "info", "(", "'Downloading CLARK database'", ")", "# Create the folder in which the database is to be stored", "databasepath", "=", "self", ".", "create_da...
Download and set-up the CLARK database using the set_targets.sh script. Use defaults of bacteria for database type, and species for taxonomic level :param databasepath: path to use to save the database
[ "Download", "and", "set", "-", "up", "the", "CLARK", "database", "using", "the", "set_targets", ".", "sh", "script", ".", "Use", "defaults", "of", "bacteria", "for", "database", "type", "and", "species", "for", "taxonomic", "level", ":", "param", "databasepa...
python
train
apache/incubator-mxnet
python/mxnet/module/base_module.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/module/base_module.py#L719-L743
def load_params(self, fname): """Loads model parameters from file. Parameters ---------- fname : str Path to input param file. Examples -------- >>> # An example of loading module parameters. >>> mod.load_params('myfile') """ ...
[ "def", "load_params", "(", "self", ",", "fname", ")", ":", "save_dict", "=", "ndarray", ".", "load", "(", "fname", ")", "arg_params", "=", "{", "}", "aux_params", "=", "{", "}", "for", "k", ",", "value", "in", "save_dict", ".", "items", "(", ")", "...
Loads model parameters from file. Parameters ---------- fname : str Path to input param file. Examples -------- >>> # An example of loading module parameters. >>> mod.load_params('myfile')
[ "Loads", "model", "parameters", "from", "file", "." ]
python
train
CTPUG/wafer
wafer/utils.py
https://github.com/CTPUG/wafer/blob/a20af3c399267f76373dc342f4d542a9bc457c35/wafer/utils.py#L34-L54
def cache_result(cache_key, timeout): """A decorator for caching the result of a function.""" def decorator(f): cache_name = settings.WAFER_CACHE @functools.wraps(f) def wrapper(*args, **kw): cache = caches[cache_name] result = cache.get(cache_key) if...
[ "def", "cache_result", "(", "cache_key", ",", "timeout", ")", ":", "def", "decorator", "(", "f", ")", ":", "cache_name", "=", "settings", ".", "WAFER_CACHE", "@", "functools", ".", "wraps", "(", "f", ")", "def", "wrapper", "(", "*", "args", ",", "*", ...
A decorator for caching the result of a function.
[ "A", "decorator", "for", "caching", "the", "result", "of", "a", "function", "." ]
python
train
jmcgeheeiv/pyfakefs
pyfakefs/fake_filesystem.py
https://github.com/jmcgeheeiv/pyfakefs/blob/6c36fb8987108107fc861fc3013620d46c7d2f9c/pyfakefs/fake_filesystem.py#L3696-L3707
def close(self, file_des): """Close a file descriptor. Args: file_des: An integer file descriptor for the file object requested. Raises: OSError: bad file descriptor. TypeError: if file descriptor is not an integer. """ file_handle = self.fil...
[ "def", "close", "(", "self", ",", "file_des", ")", ":", "file_handle", "=", "self", ".", "filesystem", ".", "get_open_file", "(", "file_des", ")", "file_handle", ".", "close", "(", ")" ]
Close a file descriptor. Args: file_des: An integer file descriptor for the file object requested. Raises: OSError: bad file descriptor. TypeError: if file descriptor is not an integer.
[ "Close", "a", "file", "descriptor", "." ]
python
train
productml/blurr
blurr/core/store.py
https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/core/store.py#L63-L70
def _get_range_timestamp_key(self, start: Key, end: Key, count: int = 0) -> List[Tuple[Key, Any]]: """ Returns the list of items from the store based on the given time range or count. This is used when the key being used is a TIMESTAMP key. """ r...
[ "def", "_get_range_timestamp_key", "(", "self", ",", "start", ":", "Key", ",", "end", ":", "Key", ",", "count", ":", "int", "=", "0", ")", "->", "List", "[", "Tuple", "[", "Key", ",", "Any", "]", "]", ":", "raise", "NotImplementedError", "(", ")" ]
Returns the list of items from the store based on the given time range or count. This is used when the key being used is a TIMESTAMP key.
[ "Returns", "the", "list", "of", "items", "from", "the", "store", "based", "on", "the", "given", "time", "range", "or", "count", "." ]
python
train
goose3/goose3
goose3/extractors/content.py
https://github.com/goose3/goose3/blob/e6994b1b1826af2720a091d1bff5ca15594f558d/goose3/extractors/content.py#L281-L306
def is_highlink_density(self, element): """ checks the density of links within a node, is there not much text and most of it contains linky shit? if so it's no good """ links = self.parser.getElementsByTag(element, tag='a') if not links: return False ...
[ "def", "is_highlink_density", "(", "self", ",", "element", ")", ":", "links", "=", "self", ".", "parser", ".", "getElementsByTag", "(", "element", ",", "tag", "=", "'a'", ")", "if", "not", "links", ":", "return", "False", "text", "=", "self", ".", "par...
checks the density of links within a node, is there not much text and most of it contains linky shit? if so it's no good
[ "checks", "the", "density", "of", "links", "within", "a", "node", "is", "there", "not", "much", "text", "and", "most", "of", "it", "contains", "linky", "shit?", "if", "so", "it", "s", "no", "good" ]
python
valid
Spinmob/spinmob
_pylab_tweaks.py
https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_tweaks.py#L388-L416
def image_format_figure(figure=None, draw=True): """ This formats the figure in a compact way with (hopefully) enough useful information for printing large data sets. Used mostly for line and scatter plots with long, information-filled titles. Chances are somewhat slim this will be ideal for you bu...
[ "def", "image_format_figure", "(", "figure", "=", "None", ",", "draw", "=", "True", ")", ":", "_pylab", ".", "ioff", "(", ")", "if", "figure", "==", "None", ":", "figure", "=", "_pylab", ".", "gcf", "(", ")", "set_figure_window_geometry", "(", "figure", ...
This formats the figure in a compact way with (hopefully) enough useful information for printing large data sets. Used mostly for line and scatter plots with long, information-filled titles. Chances are somewhat slim this will be ideal for you but it very well might and is at least a good starting poin...
[ "This", "formats", "the", "figure", "in", "a", "compact", "way", "with", "(", "hopefully", ")", "enough", "useful", "information", "for", "printing", "large", "data", "sets", ".", "Used", "mostly", "for", "line", "and", "scatter", "plots", "with", "long", ...
python
train
inasafe/inasafe
safe/gui/tools/wizard/step_fc05_functions2.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/step_fc05_functions2.py#L141-L202
def set_widgets(self): """Set widgets on the Impact Functions Table 2 tab.""" self.tblFunctions2.clear() hazard, exposure, _, _ = self.parent.\ selected_impact_function_constraints() hazard_layer_geometries = get_allowed_geometries( layer_purpose_hazard['key']) ...
[ "def", "set_widgets", "(", "self", ")", ":", "self", ".", "tblFunctions2", ".", "clear", "(", ")", "hazard", ",", "exposure", ",", "_", ",", "_", "=", "self", ".", "parent", ".", "selected_impact_function_constraints", "(", ")", "hazard_layer_geometries", "=...
Set widgets on the Impact Functions Table 2 tab.
[ "Set", "widgets", "on", "the", "Impact", "Functions", "Table", "2", "tab", "." ]
python
train
PMEAL/OpenPNM
openpnm/models/phases/diffusivity.py
https://github.com/PMEAL/OpenPNM/blob/0547b5724ffedc0a593aae48639d36fe10e0baed/openpnm/models/phases/diffusivity.py#L76-L113
def tyn_calus(target, VA, VB, sigma_A, sigma_B, temperature='pore.temperature', viscosity='pore.viscosity'): r""" Uses Tyn_Calus model to estimate diffusion coefficient in a dilute liquid solution of A in B from first principles at conditions of interest Parameters ---------- targ...
[ "def", "tyn_calus", "(", "target", ",", "VA", ",", "VB", ",", "sigma_A", ",", "sigma_B", ",", "temperature", "=", "'pore.temperature'", ",", "viscosity", "=", "'pore.viscosity'", ")", ":", "T", "=", "target", "[", "temperature", "]", "mu", "=", "target", ...
r""" Uses Tyn_Calus model to estimate diffusion coefficient in a dilute liquid solution of A in B from first principles at conditions of interest Parameters ---------- target : OpenPNM Object The object for which these values are being calculated. This controls the length of the ca...
[ "r", "Uses", "Tyn_Calus", "model", "to", "estimate", "diffusion", "coefficient", "in", "a", "dilute", "liquid", "solution", "of", "A", "in", "B", "from", "first", "principles", "at", "conditions", "of", "interest" ]
python
train
MaritimeRenewable/PyResis
PyResis/propulsion_power.py
https://github.com/MaritimeRenewable/PyResis/blob/c53f83598c8760d532c44036ea3ecd0c84eada95/PyResis/propulsion_power.py#L13-L24
def frictional_resistance_coef(length, speed, **kwargs): """ Flat plate frictional resistance of the ship according to ITTC formula. ref: https://ittc.info/media/2021/75-02-02-02.pdf :param length: metres length of the vehicle :param speed: m/s speed of the vehicle :param kwargs: optional could...
[ "def", "frictional_resistance_coef", "(", "length", ",", "speed", ",", "*", "*", "kwargs", ")", ":", "Cf", "=", "0.075", "/", "(", "np", ".", "log10", "(", "reynolds_number", "(", "length", ",", "speed", ",", "*", "*", "kwargs", ")", ")", "-", "2", ...
Flat plate frictional resistance of the ship according to ITTC formula. ref: https://ittc.info/media/2021/75-02-02-02.pdf :param length: metres length of the vehicle :param speed: m/s speed of the vehicle :param kwargs: optional could take in temperature to take account change of water property :re...
[ "Flat", "plate", "frictional", "resistance", "of", "the", "ship", "according", "to", "ITTC", "formula", ".", "ref", ":", "https", ":", "//", "ittc", ".", "info", "/", "media", "/", "2021", "/", "75", "-", "02", "-", "02", "-", "02", ".", "pdf" ]
python
valid
bukun/TorCMS
torcms/model/collect_model.py
https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/collect_model.py#L55-L67
def count_of_user(user_id): ''' Get the cound of views. ''' return TabCollect.select( TabCollect, TabPost.uid.alias('post_uid'), TabPost.title.alias('post_title'), TabPost.view_count.alias('post_view_count') ).where( TabCollect.user...
[ "def", "count_of_user", "(", "user_id", ")", ":", "return", "TabCollect", ".", "select", "(", "TabCollect", ",", "TabPost", ".", "uid", ".", "alias", "(", "'post_uid'", ")", ",", "TabPost", ".", "title", ".", "alias", "(", "'post_title'", ")", ",", "TabP...
Get the cound of views.
[ "Get", "the", "cound", "of", "views", "." ]
python
train
pydsigner/pygu
pygu/pygw.py
https://github.com/pydsigner/pygu/blob/09fe71534900933908ab83db12f5659b7827e31c/pygu/pygw.py#L252-L257
def unbind(self, func, etype): ''' Wraps around container.unbind(). ''' wrapped = self.event_cbs[func] self.container.unbind(self, wrapped, etype)
[ "def", "unbind", "(", "self", ",", "func", ",", "etype", ")", ":", "wrapped", "=", "self", ".", "event_cbs", "[", "func", "]", "self", ".", "container", ".", "unbind", "(", "self", ",", "wrapped", ",", "etype", ")" ]
Wraps around container.unbind().
[ "Wraps", "around", "container", ".", "unbind", "()", "." ]
python
train
AndrewAnnex/SpiceyPy
spiceypy/spiceypy.py
https://github.com/AndrewAnnex/SpiceyPy/blob/fc20a9b9de68b58eed5b332f0c051fb343a6e335/spiceypy/spiceypy.py#L9891-L9905
def prsint(string): """ Parse a string as an integer, encapsulating error handling. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/prsint_c.html :param string: String representing an integer. :type string: str :return: Integer value obtained by parsing string. :rtype: int """ ...
[ "def", "prsint", "(", "string", ")", ":", "string", "=", "stypes", ".", "stringToCharP", "(", "string", ")", "intval", "=", "ctypes", ".", "c_int", "(", ")", "libspice", ".", "prsint_c", "(", "string", ",", "ctypes", ".", "byref", "(", "intval", ")", ...
Parse a string as an integer, encapsulating error handling. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/prsint_c.html :param string: String representing an integer. :type string: str :return: Integer value obtained by parsing string. :rtype: int
[ "Parse", "a", "string", "as", "an", "integer", "encapsulating", "error", "handling", "." ]
python
train
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_xstp_ext.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_xstp_ext.py#L4296-L4309
def get_stp_mst_detail_output_cist_port_edge_port(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_stp_mst_detail = ET.Element("get_stp_mst_detail") config = get_stp_mst_detail output = ET.SubElement(get_stp_mst_detail, "output") cist ...
[ "def", "get_stp_mst_detail_output_cist_port_edge_port", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "get_stp_mst_detail", "=", "ET", ".", "Element", "(", "\"get_stp_mst_detail\"", ")", "config", "=...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train