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
axltxl/m2bk
m2bk/mongo.py
https://github.com/axltxl/m2bk/blob/980083dfd17e6e783753a946e9aa809714551141/m2bk/mongo.py#L28-L51
def _set_mongodb_host_val(key, default, mongodb_host, mongodb_defaults): """ Set a value in a 'cascade' fashion for mongodb_host[key] Within 'mongodb', as a last resort, its hardcoded default value is going to be picked. :param key: key name :param default: default last resort value :param...
[ "def", "_set_mongodb_host_val", "(", "key", ",", "default", ",", "mongodb_host", ",", "mongodb_defaults", ")", ":", "# If mongodb_host[key] is not already set, its value is going to be picked", "# from mongodb_defaults[key]", "if", "key", "not", "in", "mongodb_host", ":", "if...
Set a value in a 'cascade' fashion for mongodb_host[key] Within 'mongodb', as a last resort, its hardcoded default value is going to be picked. :param key: key name :param default: default last resort value :param mongodb_host: mongodb 'host' entry :param mongodb_defaults: mongodb 'defaults' d...
[ "Set", "a", "value", "in", "a", "cascade", "fashion", "for", "mongodb_host", "[", "key", "]" ]
python
train
markovmodel/msmtools
msmtools/generation/api.py
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/generation/api.py#L133-L151
def trajectories(self, M, N, start=None, stop=None): """ Generates M trajectories, each of length N, starting from state s Parameters ---------- M : int number of trajectories N : int trajectory length start : int, optional, default = None...
[ "def", "trajectories", "(", "self", ",", "M", ",", "N", ",", "start", "=", "None", ",", "stop", "=", "None", ")", ":", "trajs", "=", "[", "self", ".", "trajectory", "(", "N", ",", "start", "=", "start", ",", "stop", "=", "stop", ")", "for", "_"...
Generates M trajectories, each of length N, starting from state s Parameters ---------- M : int number of trajectories N : int trajectory length start : int, optional, default = None starting state. If not given, will sample from the stationar...
[ "Generates", "M", "trajectories", "each", "of", "length", "N", "starting", "from", "state", "s" ]
python
train
log2timeline/plaso
plaso/parsers/interface.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/parsers/interface.py#L215-L232
def Parse(self, parser_mediator): """Parsers the file entry and extracts event objects. Args: parser_mediator (ParserMediator): a parser mediator. Raises: UnableToParseFile: when the file cannot be parsed. """ file_entry = parser_mediator.GetFileEntry() if not file_entry: rai...
[ "def", "Parse", "(", "self", ",", "parser_mediator", ")", ":", "file_entry", "=", "parser_mediator", ".", "GetFileEntry", "(", ")", "if", "not", "file_entry", ":", "raise", "errors", ".", "UnableToParseFile", "(", "'Invalid file entry'", ")", "parser_mediator", ...
Parsers the file entry and extracts event objects. Args: parser_mediator (ParserMediator): a parser mediator. Raises: UnableToParseFile: when the file cannot be parsed.
[ "Parsers", "the", "file", "entry", "and", "extracts", "event", "objects", "." ]
python
train
pygobject/pgi
pgi/overrides/__init__.py
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/__init__.py#L204-L221
def deprecated_attr(namespace, attr, replacement): """Marks a module level attribute as deprecated. Accessing it will emit a PyGIDeprecationWarning warning. e.g. for ``deprecated_attr("GObject", "STATUS_FOO", "GLib.Status.FOO")`` accessing GObject.STATUS_FOO will emit: "GObject.STATUS_FOO is d...
[ "def", "deprecated_attr", "(", "namespace", ",", "attr", ",", "replacement", ")", ":", "_deprecated_attrs", ".", "setdefault", "(", "namespace", ",", "[", "]", ")", ".", "append", "(", "(", "attr", ",", "replacement", ")", ")" ]
Marks a module level attribute as deprecated. Accessing it will emit a PyGIDeprecationWarning warning. e.g. for ``deprecated_attr("GObject", "STATUS_FOO", "GLib.Status.FOO")`` accessing GObject.STATUS_FOO will emit: "GObject.STATUS_FOO is deprecated; use GLib.Status.FOO instead" :param str na...
[ "Marks", "a", "module", "level", "attribute", "as", "deprecated", ".", "Accessing", "it", "will", "emit", "a", "PyGIDeprecationWarning", "warning", "." ]
python
train
zarr-developers/zarr
zarr/hierarchy.py
https://github.com/zarr-developers/zarr/blob/fb8e6d5ea6bc26e451e5cf0eaaee36977556d5b5/zarr/hierarchy.py#L1002-L1057
def group(store=None, overwrite=False, chunk_store=None, cache_attrs=True, synchronizer=None, path=None): """Create a group. Parameters ---------- store : MutableMapping or string, optional Store or path to directory in file system. overwrite : bool, optional If True, dele...
[ "def", "group", "(", "store", "=", "None", ",", "overwrite", "=", "False", ",", "chunk_store", "=", "None", ",", "cache_attrs", "=", "True", ",", "synchronizer", "=", "None", ",", "path", "=", "None", ")", ":", "# handle polymorphic store arg", "store", "=...
Create a group. Parameters ---------- store : MutableMapping or string, optional Store or path to directory in file system. overwrite : bool, optional If True, delete any pre-existing data in `store` at `path` before creating the group. chunk_store : MutableMapping, optional...
[ "Create", "a", "group", "." ]
python
train
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/bson/__init__.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L698-L728
def _name_value_to_bson(name, value, check_keys, opts): """Encode a single name, value pair.""" # First see if the type is already cached. KeyError will only ever # happen once per subtype. try: return _ENCODERS[type(value)](name, value, check_keys, opts) except KeyError: pass ...
[ "def", "_name_value_to_bson", "(", "name", ",", "value", ",", "check_keys", ",", "opts", ")", ":", "# First see if the type is already cached. KeyError will only ever", "# happen once per subtype.", "try", ":", "return", "_ENCODERS", "[", "type", "(", "value", ")", "]",...
Encode a single name, value pair.
[ "Encode", "a", "single", "name", "value", "pair", "." ]
python
train
pgjones/quart
quart/app.py
https://github.com/pgjones/quart/blob/7cb2d3bd98e8746025764f2b933abc12041fa175/quart/app.py#L244-L258
def logger(self) -> Logger: """A :class:`logging.Logger` logger for the app. This can be used to log messages in a format as defined in the app configuration, for example, .. code-block:: python app.logger.debug("Request method %s", request.method) app.logger.e...
[ "def", "logger", "(", "self", ")", "->", "Logger", ":", "if", "self", ".", "_logger", "is", "None", ":", "self", ".", "_logger", "=", "create_logger", "(", "self", ")", "return", "self", ".", "_logger" ]
A :class:`logging.Logger` logger for the app. This can be used to log messages in a format as defined in the app configuration, for example, .. code-block:: python app.logger.debug("Request method %s", request.method) app.logger.error("Error, of some kind")
[ "A", ":", "class", ":", "logging", ".", "Logger", "logger", "for", "the", "app", "." ]
python
train
twisted/vertex
vertex/q2q.py
https://github.com/twisted/vertex/blob/feb591aa1b9a3b2b8fdcf53e4962dad2a0bc38ca/vertex/q2q.py#L1910-L1935
def requestAvatarId(self, credentials): """ Return the ID associated with these credentials. @param credentials: something which implements one of the interfaces in self.credentialInterfaces. @return: a Deferred which will fire a string which identifies an avatar, an em...
[ "def", "requestAvatarId", "(", "self", ",", "credentials", ")", ":", "username", ",", "domain", "=", "credentials", ".", "username", ".", "split", "(", "\"@\"", ")", "key", "=", "self", ".", "users", ".", "key", "(", "domain", ",", "username", ")", "if...
Return the ID associated with these credentials. @param credentials: something which implements one of the interfaces in self.credentialInterfaces. @return: a Deferred which will fire a string which identifies an avatar, an empty tuple to specify an authenticated anonymous user ...
[ "Return", "the", "ID", "associated", "with", "these", "credentials", "." ]
python
train
numenta/nupic
src/nupic/data/generators/distributions.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/data/generators/distributions.py#L50-L54
def getData(self, n): """Returns the next n values for the distribution as a list.""" records = [self.getNext() for x in range(n)] return records
[ "def", "getData", "(", "self", ",", "n", ")", ":", "records", "=", "[", "self", ".", "getNext", "(", ")", "for", "x", "in", "range", "(", "n", ")", "]", "return", "records" ]
Returns the next n values for the distribution as a list.
[ "Returns", "the", "next", "n", "values", "for", "the", "distribution", "as", "a", "list", "." ]
python
valid
PMBio/limix-backup
limix/core/old/covar/covariance.py
https://github.com/PMBio/limix-backup/blob/1e201fdb5c694d0d5506f207f3de65d8ef66146c/limix/core/old/covar/covariance.py#L50-L56
def setParams(self,params): """ set hyperParams """ self.params = params self.clear_all() self._notify()
[ "def", "setParams", "(", "self", ",", "params", ")", ":", "self", ".", "params", "=", "params", "self", ".", "clear_all", "(", ")", "self", ".", "_notify", "(", ")" ]
set hyperParams
[ "set", "hyperParams" ]
python
train
lsst-sqre/sqre-apikit
apikit/convenience.py
https://github.com/lsst-sqre/sqre-apikit/blob/ff505b63d2e29303ff7f05f2bd5eabd0f6d7026e/apikit/convenience.py#L262-L280
def raise_from_response(resp): """Turn a failed request response into a BackendError. Handy for reflecting HTTP errors from farther back in the call chain. Parameters ---------- resp: :class:`requests.Response` Raises ------ :class:`apikit.BackendError` If `resp.status_code` i...
[ "def", "raise_from_response", "(", "resp", ")", ":", "if", "resp", ".", "status_code", "<", "400", ":", "# Request was successful. Or at least, not a failure.", "return", "raise", "BackendError", "(", "status_code", "=", "resp", ".", "status_code", ",", "reason", "...
Turn a failed request response into a BackendError. Handy for reflecting HTTP errors from farther back in the call chain. Parameters ---------- resp: :class:`requests.Response` Raises ------ :class:`apikit.BackendError` If `resp.status_code` is equal to or greater than 400.
[ "Turn", "a", "failed", "request", "response", "into", "a", "BackendError", ".", "Handy", "for", "reflecting", "HTTP", "errors", "from", "farther", "back", "in", "the", "call", "chain", "." ]
python
train
pydata/xarray
xarray/convert.py
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/convert.py#L139-L178
def to_iris(dataarray): """ Convert a DataArray into a Iris Cube """ # Iris not a hard dependency import iris from iris.fileformats.netcdf import parse_cell_methods dim_coords = [] aux_coords = [] for coord_name in dataarray.coords: coord = encode(dataarray.coords[coord_name]) ...
[ "def", "to_iris", "(", "dataarray", ")", ":", "# Iris not a hard dependency", "import", "iris", "from", "iris", ".", "fileformats", ".", "netcdf", "import", "parse_cell_methods", "dim_coords", "=", "[", "]", "aux_coords", "=", "[", "]", "for", "coord_name", "in"...
Convert a DataArray into a Iris Cube
[ "Convert", "a", "DataArray", "into", "a", "Iris", "Cube" ]
python
train
saltstack/salt
salt/modules/kapacitor.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kapacitor.py#L109-L126
def _run_cmd(cmd): ''' Run a Kapacitor task and return a dictionary of info. ''' ret = {} env_vars = { 'KAPACITOR_URL': _get_url(), 'KAPACITOR_UNSAFE_SSL': __salt__['config.option']('kapacitor.unsafe_ssl', 'false'), } result = __salt__['cmd.run_all'](cmd, env=env_vars) i...
[ "def", "_run_cmd", "(", "cmd", ")", ":", "ret", "=", "{", "}", "env_vars", "=", "{", "'KAPACITOR_URL'", ":", "_get_url", "(", ")", ",", "'KAPACITOR_UNSAFE_SSL'", ":", "__salt__", "[", "'config.option'", "]", "(", "'kapacitor.unsafe_ssl'", ",", "'false'", ")"...
Run a Kapacitor task and return a dictionary of info.
[ "Run", "a", "Kapacitor", "task", "and", "return", "a", "dictionary", "of", "info", "." ]
python
train
flatangle/flatlib
flatlib/angle.py
https://github.com/flatangle/flatlib/blob/44e05b2991a296c678adbc17a1d51b6a21bc867c/flatlib/angle.py#L82-L86
def slistFloat(slist): """ Converts signed list to float. """ values = [v / 60**(i) for (i,v) in enumerate(slist[1:])] value = sum(values) return -value if slist[0] == '-' else value
[ "def", "slistFloat", "(", "slist", ")", ":", "values", "=", "[", "v", "/", "60", "**", "(", "i", ")", "for", "(", "i", ",", "v", ")", "in", "enumerate", "(", "slist", "[", "1", ":", "]", ")", "]", "value", "=", "sum", "(", "values", ")", "r...
Converts signed list to float.
[ "Converts", "signed", "list", "to", "float", "." ]
python
train
oauthlib/oauthlib
oauthlib/oauth2/rfc6749/tokens.py
https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/tokens.py#L245-L262
def get_token_from_header(request): """ Helper function to extract a token from the request header. :param request: OAuthlib request. :type request: oauthlib.common.Request :return: Return the token or None if the Authorization header is malformed. """ token = None if 'Authorization' i...
[ "def", "get_token_from_header", "(", "request", ")", ":", "token", "=", "None", "if", "'Authorization'", "in", "request", ".", "headers", ":", "split_header", "=", "request", ".", "headers", ".", "get", "(", "'Authorization'", ")", ".", "split", "(", ")", ...
Helper function to extract a token from the request header. :param request: OAuthlib request. :type request: oauthlib.common.Request :return: Return the token or None if the Authorization header is malformed.
[ "Helper", "function", "to", "extract", "a", "token", "from", "the", "request", "header", "." ]
python
train
saltstack/salt
salt/cloud/clouds/opennebula.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/opennebula.py#L1789-L1894
def image_update(call=None, kwargs=None): ''' Replaces the image template contents. .. versionadded:: 2016.3.0 image_id The ID of the image to update. Can be used instead of ``image_name``. image_name The name of the image to update. Can be used instead of ``image_id``. path ...
[ "def", "image_update", "(", "call", "=", "None", ",", "kwargs", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The image_allocate function must be called with -f or --function.'", ")", "if", "kwargs", "is", "None...
Replaces the image template contents. .. versionadded:: 2016.3.0 image_id The ID of the image to update. Can be used instead of ``image_name``. image_name The name of the image to update. Can be used instead of ``image_id``. path The path to a file containing the template of ...
[ "Replaces", "the", "image", "template", "contents", "." ]
python
train
librosa/librosa
librosa/effects.py
https://github.com/librosa/librosa/blob/180e8e6eb8f958fa6b20b8cba389f7945d508247/librosa/effects.py#L145-L186
def percussive(y, **kwargs): '''Extract percussive elements from an audio time-series. Parameters ---------- y : np.ndarray [shape=(n,)] audio time series kwargs : additional keyword arguments. See `librosa.decompose.hpss` for details. Returns ------- y_percussive : np....
[ "def", "percussive", "(", "y", ",", "*", "*", "kwargs", ")", ":", "# Compute the STFT matrix", "stft", "=", "core", ".", "stft", "(", "y", ")", "# Remove harmonics", "stft_perc", "=", "decompose", ".", "hpss", "(", "stft", ",", "*", "*", "kwargs", ")", ...
Extract percussive elements from an audio time-series. Parameters ---------- y : np.ndarray [shape=(n,)] audio time series kwargs : additional keyword arguments. See `librosa.decompose.hpss` for details. Returns ------- y_percussive : np.ndarray [shape=(n,)] audio t...
[ "Extract", "percussive", "elements", "from", "an", "audio", "time", "-", "series", "." ]
python
test
raphaelvallat/pingouin
pingouin/external/qsturng.py
https://github.com/raphaelvallat/pingouin/blob/58b19fa4fffbfe09d58b456e3926a148249e4d9b/pingouin/external/qsturng.py#L787-L818
def psturng(q, r, v): """Evaluates the probability from 0 to q for a studentized range having v degrees of freedom and r samples. Parameters ---------- q : (scalar, array_like) quantile value of Studentized Range q >= 0. r : (scalar, array_like) The number of samples ...
[ "def", "psturng", "(", "q", ",", "r", ",", "v", ")", ":", "if", "all", "(", "map", "(", "_isfloat", ",", "[", "q", ",", "r", ",", "v", "]", ")", ")", ":", "return", "_psturng", "(", "q", ",", "r", ",", "v", ")", "return", "_vpsturng", "(", ...
Evaluates the probability from 0 to q for a studentized range having v degrees of freedom and r samples. Parameters ---------- q : (scalar, array_like) quantile value of Studentized Range q >= 0. r : (scalar, array_like) The number of samples r >= 2 and r <= 200 ...
[ "Evaluates", "the", "probability", "from", "0", "to", "q", "for", "a", "studentized", "range", "having", "v", "degrees", "of", "freedom", "and", "r", "samples", "." ]
python
train
pyviz/holoviews
holoviews/plotting/bokeh/renderer.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/renderer.py#L253-L303
def _figure_data(self, plot, fmt='html', doc=None, as_script=False, **kwargs): """ Given a plot instance, an output format and an optional bokeh document, return the corresponding data. If as_script is True, the content will be split in an HTML and a JS component. """ mod...
[ "def", "_figure_data", "(", "self", ",", "plot", ",", "fmt", "=", "'html'", ",", "doc", "=", "None", ",", "as_script", "=", "False", ",", "*", "*", "kwargs", ")", ":", "model", "=", "plot", ".", "state", "if", "doc", "is", "None", ":", "doc", "="...
Given a plot instance, an output format and an optional bokeh document, return the corresponding data. If as_script is True, the content will be split in an HTML and a JS component.
[ "Given", "a", "plot", "instance", "an", "output", "format", "and", "an", "optional", "bokeh", "document", "return", "the", "corresponding", "data", ".", "If", "as_script", "is", "True", "the", "content", "will", "be", "split", "in", "an", "HTML", "and", "a...
python
train
CGATOxford/UMI-tools
umi_tools/umi_methods.py
https://github.com/CGATOxford/UMI-tools/blob/c4b5d84aac391d59916d294f8f4f8f5378abcfbe/umi_tools/umi_methods.py#L100-L124
def joinedFastqIterate(fastq_iterator1, fastq_iterator2, strict=True): '''This will return an iterator that returns tuples of fastq records. At each step it will confirm that the first field of the read name (before the first whitespace character) is identical between the two reads. The response if it i...
[ "def", "joinedFastqIterate", "(", "fastq_iterator1", ",", "fastq_iterator2", ",", "strict", "=", "True", ")", ":", "for", "read1", "in", "fastq_iterator1", ":", "read2", "=", "next", "(", "fastq_iterator2", ")", "pair_id", "=", "read1", ".", "identifier", ".",...
This will return an iterator that returns tuples of fastq records. At each step it will confirm that the first field of the read name (before the first whitespace character) is identical between the two reads. The response if it is not depends on the value of :param:`strict`. If strict is true an error ...
[ "This", "will", "return", "an", "iterator", "that", "returns", "tuples", "of", "fastq", "records", ".", "At", "each", "step", "it", "will", "confirm", "that", "the", "first", "field", "of", "the", "read", "name", "(", "before", "the", "first", "whitespace"...
python
train
google/grr
api_client/python/grr_api_client/hunt.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/api_client/python/grr_api_client/hunt.py#L172-L193
def CreateApproval(self, reason=None, notified_users=None, email_cc_addresses=None): """Create a new approval for the current user to access this hunt.""" if not reason: raise ValueError("reason can't be empty") if not notified_users: ...
[ "def", "CreateApproval", "(", "self", ",", "reason", "=", "None", ",", "notified_users", "=", "None", ",", "email_cc_addresses", "=", "None", ")", ":", "if", "not", "reason", ":", "raise", "ValueError", "(", "\"reason can't be empty\"", ")", "if", "not", "no...
Create a new approval for the current user to access this hunt.
[ "Create", "a", "new", "approval", "for", "the", "current", "user", "to", "access", "this", "hunt", "." ]
python
train
bwohlberg/sporco
sporco/admm/pdcsc.py
https://github.com/bwohlberg/sporco/blob/8946a04331106f4e39904fbdf2dc7351900baa04/sporco/admm/pdcsc.py#L479-L506
def setdict(self, D=None, B=None): """Set dictionary array.""" if D is not None: self.D = np.asarray(D, dtype=self.dtype) if B is not None: self.B = np.asarray(B, dtype=self.dtype) if B is not None or not hasattr(self, 'Gamma'): self.Gamma, self.Q = ...
[ "def", "setdict", "(", "self", ",", "D", "=", "None", ",", "B", "=", "None", ")", ":", "if", "D", "is", "not", "None", ":", "self", ".", "D", "=", "np", ".", "asarray", "(", "D", ",", "dtype", "=", "self", ".", "dtype", ")", "if", "B", "is"...
Set dictionary array.
[ "Set", "dictionary", "array", "." ]
python
train
NaPs/Kolekto
kolekto/commands/link.py
https://github.com/NaPs/Kolekto/blob/29c5469da8782780a06bf9a76c59414bb6fd8fe3/kolekto/commands/link.py#L26-L36
def format_all(format_string, env): """ Format the input string using each possible combination of lists in the provided environment. Returns a list of formated strings. """ prepared_env = parse_pattern(format_string, env, lambda x, y: [FormatWrapper(x, z) for z in y]) # Generate each possible ...
[ "def", "format_all", "(", "format_string", ",", "env", ")", ":", "prepared_env", "=", "parse_pattern", "(", "format_string", ",", "env", ",", "lambda", "x", ",", "y", ":", "[", "FormatWrapper", "(", "x", ",", "z", ")", "for", "z", "in", "y", "]", ")"...
Format the input string using each possible combination of lists in the provided environment. Returns a list of formated strings.
[ "Format", "the", "input", "string", "using", "each", "possible", "combination", "of", "lists", "in", "the", "provided", "environment", ".", "Returns", "a", "list", "of", "formated", "strings", "." ]
python
train
BradRuderman/pyhs2
pyhs2/cursor.py
https://github.com/BradRuderman/pyhs2/blob/1094d4b3a1e9032ee17eeb41f3381bbbd95862c1/pyhs2/cursor.py#L104-L141
def fetchone(self): """ fetch a single row. a lock object is used to assure that a single record will be fetched and all housekeeping done properly in a multithreaded environment. as getting a block is currently synchronous, this also protects against multiple block requests (but does not prot...
[ "def", "fetchone", "(", "self", ")", ":", "self", ".", "_cursorLock", ".", "acquire", "(", ")", "# if there are available records in current block, ", "# return one and advance counter", "if", "self", ".", "_currentBlock", "is", "not", "None", "and", "self", ".", "_...
fetch a single row. a lock object is used to assure that a single record will be fetched and all housekeeping done properly in a multithreaded environment. as getting a block is currently synchronous, this also protects against multiple block requests (but does not protect against explicit calls to...
[ "fetch", "a", "single", "row", ".", "a", "lock", "object", "is", "used", "to", "assure", "that", "a", "single", "record", "will", "be", "fetched", "and", "all", "housekeeping", "done", "properly", "in", "a", "multithreaded", "environment", ".", "as", "gett...
python
train
limpyd/redis-limpyd-jobs
limpyd_jobs/workers.py
https://github.com/limpyd/redis-limpyd-jobs/blob/264c71029bad4377d6132bf8bb9c55c44f3b03a2/limpyd_jobs/workers.py#L888-L914
def prepare_worker(self): """ Prepare the worker, ready to be launched: prepare options, create a log handler if none, and manage dry_run options """ worker_options = self.prepare_worker_options() self.worker = self.options.worker_class(**worker_options) if self.u...
[ "def", "prepare_worker", "(", "self", ")", ":", "worker_options", "=", "self", ".", "prepare_worker_options", "(", ")", "self", ".", "worker", "=", "self", ".", "options", ".", "worker_class", "(", "*", "*", "worker_options", ")", "if", "self", ".", "updat...
Prepare the worker, ready to be launched: prepare options, create a log handler if none, and manage dry_run options
[ "Prepare", "the", "worker", "ready", "to", "be", "launched", ":", "prepare", "options", "create", "a", "log", "handler", "if", "none", "and", "manage", "dry_run", "options" ]
python
train
delfick/nose-of-yeti
noseOfYeti/tokeniser/config.py
https://github.com/delfick/nose-of-yeti/blob/0b545ff350cebd59b40b601333c13033ce40d6dc/noseOfYeti/tokeniser/config.py#L82-L102
def find_config_file(self): """ Find where our config file is if there is any If the value for the config file is a default and it doesn't exist then it is silently ignored. If however, the value isn't a default and it doesn't exist, an error is raised "...
[ "def", "find_config_file", "(", "self", ")", ":", "filename", "=", "self", ".", "values", ".", "get", "(", "'config_file'", ",", "Default", "(", "'noy.json'", ")", ")", "ignore_missing", "=", "False", "if", "isinstance", "(", "filename", ",", "Default", ")...
Find where our config file is if there is any If the value for the config file is a default and it doesn't exist then it is silently ignored. If however, the value isn't a default and it doesn't exist, an error is raised
[ "Find", "where", "our", "config", "file", "is", "if", "there", "is", "any" ]
python
train
inasafe/inasafe
safe/report/expressions/map_report.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/expressions/map_report.py#L509-L513
def aggregation_not_used_text_element(feature, parent): """Retrieve reference title header string from definitions.""" _ = feature, parent # NOQA header = aggregation_not_used_text['string_format'] return header.capitalize()
[ "def", "aggregation_not_used_text_element", "(", "feature", ",", "parent", ")", ":", "_", "=", "feature", ",", "parent", "# NOQA", "header", "=", "aggregation_not_used_text", "[", "'string_format'", "]", "return", "header", ".", "capitalize", "(", ")" ]
Retrieve reference title header string from definitions.
[ "Retrieve", "reference", "title", "header", "string", "from", "definitions", "." ]
python
train
dailymuse/oz
oz/__init__.py
https://github.com/dailymuse/oz/blob/4329f6a207dc9d2a8fbeb4d16d415dbe4570b5bd/oz/__init__.py#L106-L125
def trigger(self, name, *args, **kwargs): """ Triggers an event to run through middleware. This method will execute a chain of relevant trigger callbacks, until one of the callbacks returns the `break_trigger`. """ # Relevant middleware is cached so we don't have to redi...
[ "def", "trigger", "(", "self", ",", "name", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Relevant middleware is cached so we don't have to rediscover it", "# every time. Fetch the cached value if possible.", "listeners", "=", "self", ".", "_triggers", ".", "g...
Triggers an event to run through middleware. This method will execute a chain of relevant trigger callbacks, until one of the callbacks returns the `break_trigger`.
[ "Triggers", "an", "event", "to", "run", "through", "middleware", ".", "This", "method", "will", "execute", "a", "chain", "of", "relevant", "trigger", "callbacks", "until", "one", "of", "the", "callbacks", "returns", "the", "break_trigger", "." ]
python
train
dlintott/gns3-converter
gns3converter/converter.py
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/converter.py#L163-L263
def generate_nodes(self, topology): """ Generate a list of nodes for the new topology :param dict topology: processed topology from :py:meth:`process_topology` :return: a list of dicts on nodes :rtype: list """ nodes = [] de...
[ "def", "generate_nodes", "(", "self", ",", "topology", ")", ":", "nodes", "=", "[", "]", "devices", "=", "topology", "[", "'devices'", "]", "hypervisors", "=", "topology", "[", "'conf'", "]", "for", "device", "in", "sorted", "(", "devices", ")", ":", "...
Generate a list of nodes for the new topology :param dict topology: processed topology from :py:meth:`process_topology` :return: a list of dicts on nodes :rtype: list
[ "Generate", "a", "list", "of", "nodes", "for", "the", "new", "topology" ]
python
train
mosdef-hub/mbuild
mbuild/packing.py
https://github.com/mosdef-hub/mbuild/blob/dcb80a2becd5d0e6a7e3e7bcb1b59793c46a2dd3/mbuild/packing.py#L56-L217
def fill_box(compound, n_compounds=None, box=None, density=None, overlap=0.2, seed=12345, edge=0.2, compound_ratio=None, aspect_ratio=None, fix_orientation=False, temp_file=None): """Fill a box with a compound using packmol. Two arguments of `n_compounds, box, and density` must be spe...
[ "def", "fill_box", "(", "compound", ",", "n_compounds", "=", "None", ",", "box", "=", "None", ",", "density", "=", "None", ",", "overlap", "=", "0.2", ",", "seed", "=", "12345", ",", "edge", "=", "0.2", ",", "compound_ratio", "=", "None", ",", "aspec...
Fill a box with a compound using packmol. Two arguments of `n_compounds, box, and density` must be specified. If `n_compounds` and `box` are not None, the specified number of n_compounds will be inserted into a box of the specified size. If `n_compounds` and `density` are not None, the corresponding ...
[ "Fill", "a", "box", "with", "a", "compound", "using", "packmol", "." ]
python
train
asphalt-framework/asphalt
asphalt/core/context.py
https://github.com/asphalt-framework/asphalt/blob/4114b3ac9743cbd9facb374a3f53e19d3afef22d/asphalt/core/context.py#L176-L184
def context_chain(self) -> List['Context']: """Return a list of contexts starting from this one, its parent and so on.""" contexts = [] ctx = self # type: Optional[Context] while ctx is not None: contexts.append(ctx) ctx = ctx.parent return contexts
[ "def", "context_chain", "(", "self", ")", "->", "List", "[", "'Context'", "]", ":", "contexts", "=", "[", "]", "ctx", "=", "self", "# type: Optional[Context]", "while", "ctx", "is", "not", "None", ":", "contexts", ".", "append", "(", "ctx", ")", "ctx", ...
Return a list of contexts starting from this one, its parent and so on.
[ "Return", "a", "list", "of", "contexts", "starting", "from", "this", "one", "its", "parent", "and", "so", "on", "." ]
python
train
django-dbbackup/django-dbbackup
dbbackup/db/base.py
https://github.com/django-dbbackup/django-dbbackup/blob/77de209e2d5317e51510d0f888e085ee0c400d66/dbbackup/db/base.py#L118-L155
def run_command(self, command, stdin=None, env=None): """ Launch a shell command line. :param command: Command line to launch :type command: str :param stdin: Standard input of command :type stdin: file :param env: Environment variable used in command :ty...
[ "def", "run_command", "(", "self", ",", "command", ",", "stdin", "=", "None", ",", "env", "=", "None", ")", ":", "cmd", "=", "shlex", ".", "split", "(", "command", ")", "stdout", "=", "SpooledTemporaryFile", "(", "max_size", "=", "settings", ".", "TMP_...
Launch a shell command line. :param command: Command line to launch :type command: str :param stdin: Standard input of command :type stdin: file :param env: Environment variable used in command :type env: dict :return: Standard output of command :rtype: f...
[ "Launch", "a", "shell", "command", "line", "." ]
python
train
tradenity/python-sdk
tradenity/resources/store_credit_transaction.py
https://github.com/tradenity/python-sdk/blob/d13fbe23f4d6ff22554c6d8d2deaf209371adaf1/tradenity/resources/store_credit_transaction.py#L553-L575
def list_all_store_credit_transactions(cls, **kwargs): """List StoreCreditTransactions Return a list of StoreCreditTransactions This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.list_all_store_c...
[ "def", "list_all_store_credit_transactions", "(", "cls", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async'", ")", ":", "return", "cls", ".", "_list_all_store_credit_transacti...
List StoreCreditTransactions Return a list of StoreCreditTransactions This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.list_all_store_credit_transactions(async=True) >>> result = thread.get() ...
[ "List", "StoreCreditTransactions" ]
python
train
jlaine/python-netfilter
netfilter/rule.py
https://github.com/jlaine/python-netfilter/blob/e4942c0f6a654a985049b629ead3dc6dcdb30145/netfilter/rule.py#L91-L95
def log(self, level, prefix = ''): """Writes the contents of the Extension to the logging system. """ logging.log(level, "%sname: %s", prefix, self.__name) logging.log(level, "%soptions: %s", prefix, self.__options)
[ "def", "log", "(", "self", ",", "level", ",", "prefix", "=", "''", ")", ":", "logging", ".", "log", "(", "level", ",", "\"%sname: %s\"", ",", "prefix", ",", "self", ".", "__name", ")", "logging", ".", "log", "(", "level", ",", "\"%soptions: %s\"", ",...
Writes the contents of the Extension to the logging system.
[ "Writes", "the", "contents", "of", "the", "Extension", "to", "the", "logging", "system", "." ]
python
train
MisterWil/abodepy
abodepy/devices/cover.py
https://github.com/MisterWil/abodepy/blob/6f84bb428fd1da98855f55083cd427bebbcc57ae/abodepy/devices/cover.py#L19-L26
def switch_off(self): """Turn the switch off.""" success = self.set_status(CONST.STATUS_CLOSED_INT) if success: self._json_state['status'] = CONST.STATUS_CLOSED return success
[ "def", "switch_off", "(", "self", ")", ":", "success", "=", "self", ".", "set_status", "(", "CONST", ".", "STATUS_CLOSED_INT", ")", "if", "success", ":", "self", ".", "_json_state", "[", "'status'", "]", "=", "CONST", ".", "STATUS_CLOSED", "return", "succe...
Turn the switch off.
[ "Turn", "the", "switch", "off", "." ]
python
train
gbowerman/azurerm
azurerm/restfns.py
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/restfns.py#L110-L123
def do_put(endpoint, body, access_token): '''Do an HTTP PUT request and return JSON. Args: endpoint (str): Azure Resource Manager management endpoint. body (str): JSON body of information to put. access_token (str): A valid Azure authentication token. Returns: HTTP response...
[ "def", "do_put", "(", "endpoint", ",", "body", ",", "access_token", ")", ":", "headers", "=", "{", "\"content-type\"", ":", "\"application/json\"", ",", "\"Authorization\"", ":", "'Bearer '", "+", "access_token", "}", "headers", "[", "'User-Agent'", "]", "=", ...
Do an HTTP PUT request and return JSON. Args: endpoint (str): Azure Resource Manager management endpoint. body (str): JSON body of information to put. access_token (str): A valid Azure authentication token. Returns: HTTP response. JSON body.
[ "Do", "an", "HTTP", "PUT", "request", "and", "return", "JSON", "." ]
python
train
lsst-sqre/zenodio
zenodio/harvest.py
https://github.com/lsst-sqre/zenodio/blob/24283e84bee5714450e4f206ec024c4d32f2e761/zenodio/harvest.py#L156-L164
def authors(self): """List of :class:`~zenodio.harvest.Author`\ s (:class:`zenodio.harvest.Author`). Authors correspond to `creators` in the Datacite schema. """ creators = _pluralize(self._r['creators'], 'creator') authors = [Author.from_xmldict(c) for c in creators] ...
[ "def", "authors", "(", "self", ")", ":", "creators", "=", "_pluralize", "(", "self", ".", "_r", "[", "'creators'", "]", ",", "'creator'", ")", "authors", "=", "[", "Author", ".", "from_xmldict", "(", "c", ")", "for", "c", "in", "creators", "]", "retu...
List of :class:`~zenodio.harvest.Author`\ s (:class:`zenodio.harvest.Author`). Authors correspond to `creators` in the Datacite schema.
[ "List", "of", ":", "class", ":", "~zenodio", ".", "harvest", ".", "Author", "\\", "s", "(", ":", "class", ":", "zenodio", ".", "harvest", ".", "Author", ")", "." ]
python
train
dims/etcd3-gateway
etcd3gw/utils.py
https://github.com/dims/etcd3-gateway/blob/ad566c29cbde135aee20cfd32e0a4815ca3b5ee6/etcd3gw/utils.py#L33-L41
def _decode(data): """Decode the base-64 encoded string :param data: :return: decoded data """ if not isinstance(data, bytes_types): data = six.b(str(data)) return base64.b64decode(data.decode("utf-8"))
[ "def", "_decode", "(", "data", ")", ":", "if", "not", "isinstance", "(", "data", ",", "bytes_types", ")", ":", "data", "=", "six", ".", "b", "(", "str", "(", "data", ")", ")", "return", "base64", ".", "b64decode", "(", "data", ".", "decode", "(", ...
Decode the base-64 encoded string :param data: :return: decoded data
[ "Decode", "the", "base", "-", "64", "encoded", "string" ]
python
train
dshean/demcoreg
demcoreg/dem_mask.py
https://github.com/dshean/demcoreg/blob/abd6be75d326b35f52826ee30dff01f9e86b4b52/demcoreg/dem_mask.py#L108-L141
def get_nlcd_mask(nlcd_ds, filter='not_forest', out_fn=None): """Generate raster mask for specified NLCD LULC filter """ print("Loading NLCD LULC") b = nlcd_ds.GetRasterBand(1) l = b.ReadAsArray() print("Filtering NLCD LULC with: %s" % filter) #Original nlcd products have nan as ndv ...
[ "def", "get_nlcd_mask", "(", "nlcd_ds", ",", "filter", "=", "'not_forest'", ",", "out_fn", "=", "None", ")", ":", "print", "(", "\"Loading NLCD LULC\"", ")", "b", "=", "nlcd_ds", ".", "GetRasterBand", "(", "1", ")", "l", "=", "b", ".", "ReadAsArray", "("...
Generate raster mask for specified NLCD LULC filter
[ "Generate", "raster", "mask", "for", "specified", "NLCD", "LULC", "filter" ]
python
train
Tinche/cattrs
src/cattr/converters.py
https://github.com/Tinche/cattrs/blob/481bc9bdb69b2190d699b54f331c8c5c075506d5/src/cattr/converters.py#L227-L236
def _unstructure_mapping(self, mapping): """Convert a mapping of attr classes to primitive equivalents.""" # We can reuse the mapping class, so dicts stay dicts and OrderedDicts # stay OrderedDicts. dispatch = self._unstructure_func.dispatch return mapping.__class__( ...
[ "def", "_unstructure_mapping", "(", "self", ",", "mapping", ")", ":", "# We can reuse the mapping class, so dicts stay dicts and OrderedDicts", "# stay OrderedDicts.", "dispatch", "=", "self", ".", "_unstructure_func", ".", "dispatch", "return", "mapping", ".", "__class__", ...
Convert a mapping of attr classes to primitive equivalents.
[ "Convert", "a", "mapping", "of", "attr", "classes", "to", "primitive", "equivalents", "." ]
python
train
openstack/networking-cisco
networking_cisco/ml2_drivers/nexus/nexus_db_v2.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L399-L407
def get_nve_vni_switch_bindings(vni, switch_ip): """Return the nexus nve binding(s) per switch.""" LOG.debug("get_nve_vni_switch_bindings() called") session = bc.get_reader_session() try: return (session.query(nexus_models_v2.NexusNVEBinding). filter_by(vni=vni, switch_ip=switch_...
[ "def", "get_nve_vni_switch_bindings", "(", "vni", ",", "switch_ip", ")", ":", "LOG", ".", "debug", "(", "\"get_nve_vni_switch_bindings() called\"", ")", "session", "=", "bc", ".", "get_reader_session", "(", ")", "try", ":", "return", "(", "session", ".", "query"...
Return the nexus nve binding(s) per switch.
[ "Return", "the", "nexus", "nve", "binding", "(", "s", ")", "per", "switch", "." ]
python
train
Azure/azure-sdk-for-python
azure-servicebus/azure/servicebus/control_client/servicebusservice.py
https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/control_client/servicebusservice.py#L1129-L1151
def update_event_hub(self, hub_name, hub=None): ''' Updates an Event Hub. hub_name: Name of event hub. hub: Optional. Event hub properties. Instance of EventHub class. hub.message_retention_in_days: Number of days to retain the events for this...
[ "def", "update_event_hub", "(", "self", ",", "hub_name", ",", "hub", "=", "None", ")", ":", "_validate_not_none", "(", "'hub_name'", ",", "hub_name", ")", "request", "=", "HTTPRequest", "(", ")", "request", ".", "method", "=", "'PUT'", "request", ".", "hos...
Updates an Event Hub. hub_name: Name of event hub. hub: Optional. Event hub properties. Instance of EventHub class. hub.message_retention_in_days: Number of days to retain the events for this Event Hub.
[ "Updates", "an", "Event", "Hub", "." ]
python
test
mobinrg/rpi_spark_drives
JMRPiSpark/Drives/Attitude/MPU6050.py
https://github.com/mobinrg/rpi_spark_drives/blob/e1602d8268a5ef48e9e0a8b37de89e0233f946ea/JMRPiSpark/Drives/Attitude/MPU6050.py#L533-L555
def getAllData(self, temp = True, accel = True, gyro = True): """! Get all the available data. @param temp: True - Allow to return Temperature data @param accel: True - Allow to return Accelerometer data @param gyro: True - Allow to return Gyroscope data @return a dicti...
[ "def", "getAllData", "(", "self", ",", "temp", "=", "True", ",", "accel", "=", "True", ",", "gyro", "=", "True", ")", ":", "allData", "=", "{", "}", "if", "temp", ":", "allData", "[", "\"temp\"", "]", "=", "self", ".", "getTemp", "(", ")", "if", ...
! Get all the available data. @param temp: True - Allow to return Temperature data @param accel: True - Allow to return Accelerometer data @param gyro: True - Allow to return Gyroscope data @return a dictionary data @retval {} Did not read any data @retv...
[ "!", "Get", "all", "the", "available", "data", "." ]
python
train
peterldowns/lggr
lggr/__init__.py
https://github.com/peterldowns/lggr/blob/622968f17133e02d9a46a4900dd20fb3b19fe961/lggr/__init__.py#L345-L360
def SocketWriter(host, port, af=None, st=None): """ Writes messages to a socket/host. """ import socket if af is None: af = socket.AF_INET if st is None: st = socket.SOCK_STREAM message = '({0}): {1}' s = socket.socket(af, st) s.connect(host, port) try: while True...
[ "def", "SocketWriter", "(", "host", ",", "port", ",", "af", "=", "None", ",", "st", "=", "None", ")", ":", "import", "socket", "if", "af", "is", "None", ":", "af", "=", "socket", ".", "AF_INET", "if", "st", "is", "None", ":", "st", "=", "socket",...
Writes messages to a socket/host.
[ "Writes", "messages", "to", "a", "socket", "/", "host", "." ]
python
train
ansible/ansible-container
container/docker/engine.py
https://github.com/ansible/ansible-container/blob/d031c1a6133d5482a5d054fcbdbecafb923f8b4b/container/docker/engine.py#L766-L892
def generate_orchestration_playbook(self, url=None, namespace=None, vault_files=None, **kwargs): """ Generate an Ansible playbook to orchestrate services. :param url: registry URL where images will be pulled from :param namespace: registry namespace :return: playbook dict ...
[ "def", "generate_orchestration_playbook", "(", "self", ",", "url", "=", "None", ",", "namespace", "=", "None", ",", "vault_files", "=", "None", ",", "*", "*", "kwargs", ")", ":", "states", "=", "[", "'start'", ",", "'restart'", ",", "'stop'", ",", "'dest...
Generate an Ansible playbook to orchestrate services. :param url: registry URL where images will be pulled from :param namespace: registry namespace :return: playbook dict
[ "Generate", "an", "Ansible", "playbook", "to", "orchestrate", "services", ".", ":", "param", "url", ":", "registry", "URL", "where", "images", "will", "be", "pulled", "from", ":", "param", "namespace", ":", "registry", "namespace", ":", "return", ":", "playb...
python
train
python-rope/rope
rope/base/project.py
https://github.com/python-rope/rope/blob/1c9f9cd5964b099a99a9111e998f0dc728860688/rope/base/project.py#L85-L93
def validate(self, folder): """Validate files and folders contained in this folder It validates all of the files and folders contained in this folder if some observers are interested in them. """ for observer in list(self.observers): observer.validate(folder)
[ "def", "validate", "(", "self", ",", "folder", ")", ":", "for", "observer", "in", "list", "(", "self", ".", "observers", ")", ":", "observer", ".", "validate", "(", "folder", ")" ]
Validate files and folders contained in this folder It validates all of the files and folders contained in this folder if some observers are interested in them.
[ "Validate", "files", "and", "folders", "contained", "in", "this", "folder" ]
python
train
PyThaiNLP/pythainlp
pythainlp/util/keyboard.py
https://github.com/PyThaiNLP/pythainlp/blob/e9a300b8a99dfd1a67a955e7c06f62e4afe0fbca/pythainlp/util/keyboard.py#L116-L125
def thai_to_eng(text: str) -> str: """ Correct text in one language that is incorrectly-typed with a keyboard layout in another language. (type Thai with English keyboard) :param str text: Incorrect input (type English with Thai keyboard) :return: English text """ return "".join( [TH_EN...
[ "def", "thai_to_eng", "(", "text", ":", "str", ")", "->", "str", ":", "return", "\"\"", ".", "join", "(", "[", "TH_EN_KEYB_PAIRS", "[", "ch", "]", "if", "(", "ch", "in", "TH_EN_KEYB_PAIRS", ")", "else", "ch", "for", "ch", "in", "text", "]", ")" ]
Correct text in one language that is incorrectly-typed with a keyboard layout in another language. (type Thai with English keyboard) :param str text: Incorrect input (type English with Thai keyboard) :return: English text
[ "Correct", "text", "in", "one", "language", "that", "is", "incorrectly", "-", "typed", "with", "a", "keyboard", "layout", "in", "another", "language", ".", "(", "type", "Thai", "with", "English", "keyboard", ")" ]
python
train
saltstack/salt
salt/states/pcs.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pcs.py#L939-L981
def stonith_present(name, stonith_id, stonith_device_type, stonith_device_options=None, cibname=None): ''' Ensure that a fencing resource is created Should be run on one cluster node only (there may be races) Can only be run on a node with a functional pacemaker/corosync name Irrelevan...
[ "def", "stonith_present", "(", "name", ",", "stonith_id", ",", "stonith_device_type", ",", "stonith_device_options", "=", "None", ",", "cibname", "=", "None", ")", ":", "return", "_item_present", "(", "name", "=", "name", ",", "item", "=", "'stonith'", ",", ...
Ensure that a fencing resource is created Should be run on one cluster node only (there may be races) Can only be run on a node with a functional pacemaker/corosync name Irrelevant, not used (recommended: pcs_stonith__created_{{stonith_id}}) stonith_id name for the stonith resource...
[ "Ensure", "that", "a", "fencing", "resource", "is", "created" ]
python
train
line/line-bot-sdk-python
linebot/api.py
https://github.com/line/line-bot-sdk-python/blob/1b38bfc2497ff3e3c75be4b50e0f1b7425a07ce0/linebot/api.py#L468-L487
def get_rich_menu_image(self, rich_menu_id, timeout=None): """Call download rich menu image API. https://developers.line.me/en/docs/messaging-api/reference/#download-rich-menu-image :param str rich_menu_id: ID of the rich menu with the image to be downloaded :param timeout: (optional) ...
[ "def", "get_rich_menu_image", "(", "self", ",", "rich_menu_id", ",", "timeout", "=", "None", ")", ":", "response", "=", "self", ".", "_get", "(", "'/v2/bot/richmenu/{rich_menu_id}/content'", ".", "format", "(", "rich_menu_id", "=", "rich_menu_id", ")", ",", "tim...
Call download rich menu image API. https://developers.line.me/en/docs/messaging-api/reference/#download-rich-menu-image :param str rich_menu_id: ID of the rich menu with the image to be downloaded :param timeout: (optional) How long to wait for the server to send data before giving...
[ "Call", "download", "rich", "menu", "image", "API", "." ]
python
train
richardkiss/pycoin
pycoin/satoshi/intops.py
https://github.com/richardkiss/pycoin/blob/1e8d0d9fe20ce0347b97847bb529cd1bd84c7442/pycoin/satoshi/intops.py#L72-L88
def do_OP_RIGHT(vm): """ >>> s = [b'abcdef', b'\\3'] >>> do_OP_RIGHT(s, require_minimal=True) >>> print(s==[b'def']) True >>> s = [b'abcdef', b'\\0'] >>> do_OP_RIGHT(s, require_minimal=False) >>> print(s==[b'']) True """ pos = vm.pop_nonnegative() if pos > 0: vm.a...
[ "def", "do_OP_RIGHT", "(", "vm", ")", ":", "pos", "=", "vm", ".", "pop_nonnegative", "(", ")", "if", "pos", ">", "0", ":", "vm", ".", "append", "(", "vm", ".", "pop", "(", ")", "[", "-", "pos", ":", "]", ")", "else", ":", "vm", ".", "pop", ...
>>> s = [b'abcdef', b'\\3'] >>> do_OP_RIGHT(s, require_minimal=True) >>> print(s==[b'def']) True >>> s = [b'abcdef', b'\\0'] >>> do_OP_RIGHT(s, require_minimal=False) >>> print(s==[b'']) True
[ ">>>", "s", "=", "[", "b", "abcdef", "b", "\\\\", "3", "]", ">>>", "do_OP_RIGHT", "(", "s", "require_minimal", "=", "True", ")", ">>>", "print", "(", "s", "==", "[", "b", "def", "]", ")", "True", ">>>", "s", "=", "[", "b", "abcdef", "b", "\\\\"...
python
train
openthread/openthread
tools/harness-thci/OpenThread.py
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L2409-L2474
def MGMT_PENDING_SET(self, sAddr='', xCommissionerSessionId=None, listPendingTimestamp=None, listActiveTimestamp=None, xDelayTimer=None, xChannel=None, xPanId=None, xMasterKey=None, sMeshLocalPrefix=None, sNetworkName=None): """send MGMT_PENDING_SET command Returns: ...
[ "def", "MGMT_PENDING_SET", "(", "self", ",", "sAddr", "=", "''", ",", "xCommissionerSessionId", "=", "None", ",", "listPendingTimestamp", "=", "None", ",", "listActiveTimestamp", "=", "None", ",", "xDelayTimer", "=", "None", ",", "xChannel", "=", "None", ",", ...
send MGMT_PENDING_SET command Returns: True: successful to send MGMT_PENDING_SET False: fail to send MGMT_PENDING_SET
[ "send", "MGMT_PENDING_SET", "command" ]
python
train
ianepperson/telnetsrvlib
telnetsrv/telnetsrvlib.py
https://github.com/ianepperson/telnetsrvlib/blob/fac52a4a333c2d373d53d295a76a0bbd71e5d682/telnetsrv/telnetsrvlib.py#L992-L995
def handleException(self, exc_type, exc_param, exc_tb): "Exception handler (False to abort)" self.writeline(''.join( traceback.format_exception(exc_type, exc_param, exc_tb) )) return True
[ "def", "handleException", "(", "self", ",", "exc_type", ",", "exc_param", ",", "exc_tb", ")", ":", "self", ".", "writeline", "(", "''", ".", "join", "(", "traceback", ".", "format_exception", "(", "exc_type", ",", "exc_param", ",", "exc_tb", ")", ")", ")...
Exception handler (False to abort)
[ "Exception", "handler", "(", "False", "to", "abort", ")" ]
python
train
openstax/cnx-publishing
cnxpublishing/views/moderation.py
https://github.com/openstax/cnx-publishing/blob/f55b4a2c45d8618737288f1b74b4139d5ac74154/cnxpublishing/views/moderation.py#L17-L31
def get_moderation(request): """Return the list of publications that need moderation.""" with db_connect() as db_conn: with db_conn.cursor() as cursor: cursor.execute("""\ SELECT row_to_json(combined_rows) FROM ( SELECT id, created, publisher, publication_message, (select array_ag...
[ "def", "get_moderation", "(", "request", ")", ":", "with", "db_connect", "(", ")", "as", "db_conn", ":", "with", "db_conn", ".", "cursor", "(", ")", "as", "cursor", ":", "cursor", ".", "execute", "(", "\"\"\"\\\nSELECT row_to_json(combined_rows) FROM (\n SELECT i...
Return the list of publications that need moderation.
[ "Return", "the", "list", "of", "publications", "that", "need", "moderation", "." ]
python
valid
gopalkoduri/intonation
intonation/pitch.py
https://github.com/gopalkoduri/intonation/blob/7f50d2b572755840be960ea990416a7b27f20312/intonation/pitch.py#L16-L54
def discretize(self, intervals, slope_thresh=1500, cents_thresh=50): """ This function takes the pitch data and returns it quantized to given set of intervals. All transactions must happen in cent scale. slope_thresh is the bound beyond which the pitch contour is said to transit ...
[ "def", "discretize", "(", "self", ",", "intervals", ",", "slope_thresh", "=", "1500", ",", "cents_thresh", "=", "50", ")", ":", "#eps = np.finfo(float).eps", "#pitch = median_filter(pitch, 7)+eps", "self", ".", "pitch", "=", "median_filter", "(", "self", ".", "pit...
This function takes the pitch data and returns it quantized to given set of intervals. All transactions must happen in cent scale. slope_thresh is the bound beyond which the pitch contour is said to transit from one svara to another. It is specified in cents/sec. cents_thresh is a limi...
[ "This", "function", "takes", "the", "pitch", "data", "and", "returns", "it", "quantized", "to", "given", "set", "of", "intervals", ".", "All", "transactions", "must", "happen", "in", "cent", "scale", "." ]
python
train
apache/incubator-superset
superset/views/core.py
https://github.com/apache/incubator-superset/blob/ca2996c78f679260eb79c6008e276733df5fb653/superset/views/core.py#L2171-L2246
def dashboard(self, dashboard_id): """Server side rendering for a dashboard""" session = db.session() qry = session.query(models.Dashboard) if dashboard_id.isdigit(): qry = qry.filter_by(id=int(dashboard_id)) else: qry = qry.filter_by(slug=dashboard_id) ...
[ "def", "dashboard", "(", "self", ",", "dashboard_id", ")", ":", "session", "=", "db", ".", "session", "(", ")", "qry", "=", "session", ".", "query", "(", "models", ".", "Dashboard", ")", "if", "dashboard_id", ".", "isdigit", "(", ")", ":", "qry", "="...
Server side rendering for a dashboard
[ "Server", "side", "rendering", "for", "a", "dashboard" ]
python
train
openearth/mmi-python
mmi/mmi_client.py
https://github.com/openearth/mmi-python/blob/a2f4ac96b1e7f2fa903f668b3e05c4e86ad42e8d/mmi/mmi_client.py#L56-L69
def initialize(self, configfile=None): """ Initialize the module """ method = "initialize" A = None metadata = {method: configfile} send_array(self.socket, A, metadata) A, metadata = recv_array( self.socket, poll=self.poll, poll_timeout=self...
[ "def", "initialize", "(", "self", ",", "configfile", "=", "None", ")", ":", "method", "=", "\"initialize\"", "A", "=", "None", "metadata", "=", "{", "method", ":", "configfile", "}", "send_array", "(", "self", ".", "socket", ",", "A", ",", "metadata", ...
Initialize the module
[ "Initialize", "the", "module" ]
python
train
Workiva/furious
example/callback.py
https://github.com/Workiva/furious/blob/c29823ec8b98549e7439d7273aa064d1e5830632/example/callback.py#L125-L140
def handle_an_error(): """Will be run if the async task raises an unhandled exception.""" import os from furious.context import get_current_async async = get_current_async() async_exception = async.result.payload exc_info = async_exception.traceback logging.info('async job blew up, excepti...
[ "def", "handle_an_error", "(", ")", ":", "import", "os", "from", "furious", ".", "context", "import", "get_current_async", "async", "=", "get_current_async", "(", ")", "async_exception", "=", "async", ".", "result", ".", "payload", "exc_info", "=", "async_except...
Will be run if the async task raises an unhandled exception.
[ "Will", "be", "run", "if", "the", "async", "task", "raises", "an", "unhandled", "exception", "." ]
python
train
spoqa/dodotable
dodotable/schema.py
https://github.com/spoqa/dodotable/blob/083ebdeb8ceb109a8f67264b44a652af49b64250/dodotable/schema.py#L244-L247
def append(self, cell): """행에 cell을 붙입니다. """ assert isinstance(cell, Cell) super(Row, self).append(cell)
[ "def", "append", "(", "self", ",", "cell", ")", ":", "assert", "isinstance", "(", "cell", ",", "Cell", ")", "super", "(", "Row", ",", "self", ")", ".", "append", "(", "cell", ")" ]
행에 cell을 붙입니다.
[ "행에", "cell을", "붙입니다", "." ]
python
train
cuihantao/andes
andes/models/line.py
https://github.com/cuihantao/andes/blob/7067898d4f26ce7534e968b8486c4aa8fe3a511a/andes/models/line.py#L392-L396
def v2(self): """Return voltage phasors at the "to buses" (bus2)""" Vm = self.system.dae.y[self.v] Va = self.system.dae.y[self.a] return polar(Vm[self.a2], Va[self.a2])
[ "def", "v2", "(", "self", ")", ":", "Vm", "=", "self", ".", "system", ".", "dae", ".", "y", "[", "self", ".", "v", "]", "Va", "=", "self", ".", "system", ".", "dae", ".", "y", "[", "self", ".", "a", "]", "return", "polar", "(", "Vm", "[", ...
Return voltage phasors at the "to buses" (bus2)
[ "Return", "voltage", "phasors", "at", "the", "to", "buses", "(", "bus2", ")" ]
python
train
googleapis/google-cloud-python
dns/google/cloud/dns/zone.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/dns/google/cloud/dns/zone.py#L138-L148
def description(self, value): """Update description of the zone. :type value: str :param value: (Optional) new description :raises: ValueError for invalid value types. """ if not isinstance(value, six.string_types) and value is not None: raise ValueError("Pa...
[ "def", "description", "(", "self", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "six", ".", "string_types", ")", "and", "value", "is", "not", "None", ":", "raise", "ValueError", "(", "\"Pass a string, or None\"", ")", "self", ".", ...
Update description of the zone. :type value: str :param value: (Optional) new description :raises: ValueError for invalid value types.
[ "Update", "description", "of", "the", "zone", "." ]
python
train
albahnsen/CostSensitiveClassification
costcla/models/regression.py
https://github.com/albahnsen/CostSensitiveClassification/blob/75778ae32c70671c0cdde6c4651277b6a8b58871/costcla/models/regression.py#L259-L276
def predict_proba(self, X): """Probability estimates. The returned estimates. Parameters ---------- X : array-like, shape = [n_samples, n_features] Returns ------- T : array-like, shape = [n_samples, 2] Returns the probability of the sample ...
[ "def", "predict_proba", "(", "self", ",", "X", ")", ":", "y_prob", "=", "np", ".", "zeros", "(", "(", "X", ".", "shape", "[", "0", "]", ",", "2", ")", ")", "y_prob", "[", ":", ",", "1", "]", "=", "_sigmoid", "(", "np", ".", "dot", "(", "X",...
Probability estimates. The returned estimates. Parameters ---------- X : array-like, shape = [n_samples, n_features] Returns ------- T : array-like, shape = [n_samples, 2] Returns the probability of the sample for each class in the model.
[ "Probability", "estimates", "." ]
python
train
saltstack/salt
salt/states/boto_cloudtrail.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_cloudtrail.py#L75-L315
def present(name, Name, S3BucketName, S3KeyPrefix=None, SnsTopicName=None, IncludeGlobalServiceEvents=True, IsMultiRegionTrail=None, EnableLogFileValidation=False, CloudWatchLogsLogGroupArn=None, CloudWatchLogsRoleArn=None, KmsKeyId...
[ "def", "present", "(", "name", ",", "Name", ",", "S3BucketName", ",", "S3KeyPrefix", "=", "None", ",", "SnsTopicName", "=", "None", ",", "IncludeGlobalServiceEvents", "=", "True", ",", "IsMultiRegionTrail", "=", "None", ",", "EnableLogFileValidation", "=", "Fals...
Ensure trail exists. name The name of the state definition Name Name of the trail. S3BucketName Specifies the name of the Amazon S3 bucket designated for publishing log files. S3KeyPrefix Specifies the Amazon S3 key prefix that comes after the name of the ...
[ "Ensure", "trail", "exists", "." ]
python
train
etcher-be/emiz
emiz/weather/custom_metar/custom_metar.py
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/weather/custom_metar/custom_metar.py#L27-L60
def get_metar( metar: typing.Union[str, 'CustomMetar'] ) -> typing.Tuple[typing.Union[str, None], typing.Union['CustomMetar', None]]: """ Builds a CustomMetar object from a CustomMetar object (returns it), an ICAO code or a METAR string Args: metar: CustomMetar objec...
[ "def", "get_metar", "(", "metar", ":", "typing", ".", "Union", "[", "str", ",", "'CustomMetar'", "]", ")", "->", "typing", ".", "Tuple", "[", "typing", ".", "Union", "[", "str", ",", "None", "]", ",", "typing", ".", "Union", "[", "'CustomMetar'", ","...
Builds a CustomMetar object from a CustomMetar object (returns it), an ICAO code or a METAR string Args: metar: CustomMetar object, ICAO string or METAR string Returns: CustomMetar object
[ "Builds", "a", "CustomMetar", "object", "from", "a", "CustomMetar", "object", "(", "returns", "it", ")", "an", "ICAO", "code", "or", "a", "METAR", "string" ]
python
train
Tanganelli/CoAPthon3
coapthon/resources/resource.py
https://github.com/Tanganelli/CoAPthon3/blob/985763bfe2eb9e00f49ec100c5b8877c2ed7d531/coapthon/resources/resource.py#L417-L427
def init_resource(self, request, res): """ Helper function to initialize a new resource. :param request: the request that generate the new resource :param res: the resource :return: the edited resource """ res.location_query = request.uri_query res.payloa...
[ "def", "init_resource", "(", "self", ",", "request", ",", "res", ")", ":", "res", ".", "location_query", "=", "request", ".", "uri_query", "res", ".", "payload", "=", "(", "request", ".", "content_type", ",", "request", ".", "payload", ")", "return", "re...
Helper function to initialize a new resource. :param request: the request that generate the new resource :param res: the resource :return: the edited resource
[ "Helper", "function", "to", "initialize", "a", "new", "resource", "." ]
python
train
Unidata/MetPy
metpy/io/_nexrad_msgs/parse_spec.py
https://github.com/Unidata/MetPy/blob/16f68a94919b9a82dcf9cada2169cf039129e67b/metpy/io/_nexrad_msgs/parse_spec.py#L58-L92
def process_msg18(fname): """Handle information for message type 18.""" with open(fname, 'r') as infile: info = [] for lineno, line in enumerate(infile): parts = line.split(' ') try: if len(parts) == 8: parts = parts[:6] + [parts[6] + ...
[ "def", "process_msg18", "(", "fname", ")", ":", "with", "open", "(", "fname", ",", "'r'", ")", "as", "infile", ":", "info", "=", "[", "]", "for", "lineno", ",", "line", "in", "enumerate", "(", "infile", ")", ":", "parts", "=", "line", ".", "split",...
Handle information for message type 18.
[ "Handle", "information", "for", "message", "type", "18", "." ]
python
train
Kortemme-Lab/klab
klab/general/strutil.py
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/general/strutil.py#L57-L63
def split_pdb_residue(s): '''Splits a PDB residue into the numeric and insertion code components.''' if s.isdigit(): return (int(s), ' ') else: assert(s[:-1].isdigit()) return ((s[:-1], s[-1]))
[ "def", "split_pdb_residue", "(", "s", ")", ":", "if", "s", ".", "isdigit", "(", ")", ":", "return", "(", "int", "(", "s", ")", ",", "' '", ")", "else", ":", "assert", "(", "s", "[", ":", "-", "1", "]", ".", "isdigit", "(", ")", ")", "return",...
Splits a PDB residue into the numeric and insertion code components.
[ "Splits", "a", "PDB", "residue", "into", "the", "numeric", "and", "insertion", "code", "components", "." ]
python
train
gersolar/goescalibration
goescalibration/instrument.py
https://github.com/gersolar/goescalibration/blob/aab7f3e3cede9694e90048ceeaea74566578bc75/goescalibration/instrument.py#L37-L53
def calibrate(filename): """ Append the calibration parameters as variables of the netcdf file. Keyword arguments: filename -- the name of a netcdf file. """ params = calibration_to(filename) with nc.loader(filename) as root: for key, value in params.items(): nc.getdim(r...
[ "def", "calibrate", "(", "filename", ")", ":", "params", "=", "calibration_to", "(", "filename", ")", "with", "nc", ".", "loader", "(", "filename", ")", "as", "root", ":", "for", "key", ",", "value", "in", "params", ".", "items", "(", ")", ":", "nc",...
Append the calibration parameters as variables of the netcdf file. Keyword arguments: filename -- the name of a netcdf file.
[ "Append", "the", "calibration", "parameters", "as", "variables", "of", "the", "netcdf", "file", "." ]
python
train
trailofbits/manticore
manticore/platforms/evm.py
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/evm.py#L2376-L2432
def create_account(self, address=None, balance=0, code=None, storage=None, nonce=None): """ Low level account creation. No transaction is done. :param address: the address of the account, if known. If omitted, a new address will be generated as closely to the Yellow Paper as possible. :p...
[ "def", "create_account", "(", "self", ",", "address", "=", "None", ",", "balance", "=", "0", ",", "code", "=", "None", ",", "storage", "=", "None", ",", "nonce", "=", "None", ")", ":", "if", "code", "is", "None", ":", "code", "=", "bytes", "(", "...
Low level account creation. No transaction is done. :param address: the address of the account, if known. If omitted, a new address will be generated as closely to the Yellow Paper as possible. :param balance: the initial balance of the account in Wei :param code: the runtime code of the account...
[ "Low", "level", "account", "creation", ".", "No", "transaction", "is", "done", ".", ":", "param", "address", ":", "the", "address", "of", "the", "account", "if", "known", ".", "If", "omitted", "a", "new", "address", "will", "be", "generated", "as", "clos...
python
valid
Nic30/hwt
hwt/hdl/transPart.py
https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/hdl/transPart.py#L38-L43
def getBusWordBitRange(self) -> Tuple[int, int]: """ :return: bit range which contains data of this part on bus data signal """ offset = self.startOfPart % self.parent.wordWidth return (offset + self.bit_length(), offset)
[ "def", "getBusWordBitRange", "(", "self", ")", "->", "Tuple", "[", "int", ",", "int", "]", ":", "offset", "=", "self", ".", "startOfPart", "%", "self", ".", "parent", ".", "wordWidth", "return", "(", "offset", "+", "self", ".", "bit_length", "(", ")", ...
:return: bit range which contains data of this part on bus data signal
[ ":", "return", ":", "bit", "range", "which", "contains", "data", "of", "this", "part", "on", "bus", "data", "signal" ]
python
test
chrisspen/burlap
burlap/host.py
https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/host.py#L200-L288
def initrole(self, check=True): """ Called to set default password login for systems that do not yet have passwordless login setup. """ if self.env.original_user is None: self.env.original_user = self.genv.user if self.env.original_key_filename is None: ...
[ "def", "initrole", "(", "self", ",", "check", "=", "True", ")", ":", "if", "self", ".", "env", ".", "original_user", "is", "None", ":", "self", ".", "env", ".", "original_user", "=", "self", ".", "genv", ".", "user", "if", "self", ".", "env", ".", ...
Called to set default password login for systems that do not yet have passwordless login setup.
[ "Called", "to", "set", "default", "password", "login", "for", "systems", "that", "do", "not", "yet", "have", "passwordless", "login", "setup", "." ]
python
valid
materialsproject/pymatgen
pymatgen/core/structure.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2012-L2022
def center_of_mass(self): """ Center of mass of molecule. """ center = np.zeros(3) total_weight = 0 for site in self: wt = site.species.weight center += site.coords * wt total_weight += wt return center / total_weight
[ "def", "center_of_mass", "(", "self", ")", ":", "center", "=", "np", ".", "zeros", "(", "3", ")", "total_weight", "=", "0", "for", "site", "in", "self", ":", "wt", "=", "site", ".", "species", ".", "weight", "center", "+=", "site", ".", "coords", "...
Center of mass of molecule.
[ "Center", "of", "mass", "of", "molecule", "." ]
python
train
gamechanger/schemer
schemer/validators.py
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/validators.py#L68-L80
def between(min_value, max_value): """ Validates that a field value is between the two values given to this validator. """ def validate(value): if value < min_value: return e("{} is not greater than or equal to {}", value, min_value) if value > max_value: ...
[ "def", "between", "(", "min_value", ",", "max_value", ")", ":", "def", "validate", "(", "value", ")", ":", "if", "value", "<", "min_value", ":", "return", "e", "(", "\"{} is not greater than or equal to {}\"", ",", "value", ",", "min_value", ")", "if", "valu...
Validates that a field value is between the two values given to this validator.
[ "Validates", "that", "a", "field", "value", "is", "between", "the", "two", "values", "given", "to", "this", "validator", "." ]
python
train
vladsaveliev/TargQC
targqc/utilz/file_utils.py
https://github.com/vladsaveliev/TargQC/blob/e887c36b2194dbd73c6ea32989b6cb84c6c0e58d/targqc/utilz/file_utils.py#L903-L928
def tx_tmpdir(base_dir, rollback_dirpath): """Context manager to create and remove a transactional temporary directory. """ # tmp_dir_base = join(base_dir, 'tx', str(uuid.uuid4())) # unique_attempts = 0 # while os.path.exists(tmp_dir_base): # if unique_attempts > 5: # break #...
[ "def", "tx_tmpdir", "(", "base_dir", ",", "rollback_dirpath", ")", ":", "# tmp_dir_base = join(base_dir, 'tx', str(uuid.uuid4()))", "# unique_attempts = 0", "# while os.path.exists(tmp_dir_base):", "# if unique_attempts > 5:", "# break", "# tmp_dir_base = join(base_dir, 'tx...
Context manager to create and remove a transactional temporary directory.
[ "Context", "manager", "to", "create", "and", "remove", "a", "transactional", "temporary", "directory", "." ]
python
train
mikekatz04/BOWIE
bowie/plotutils/forminput.py
https://github.com/mikekatz04/BOWIE/blob/a941342a3536cb57c817a1643896d99a3f354a86/bowie/plotutils/forminput.py#L665-L685
def savefig(self, output_path, **kwargs): """Save figure during generation. This method is used to save a completed figure during the main function run. It represents a call to ``matplotlib.pyplot.fig.savefig``. # TODO: Switch to kwargs for matplotlib.pyplot.savefig Args: ...
[ "def", "savefig", "(", "self", ",", "output_path", ",", "*", "*", "kwargs", ")", ":", "self", ".", "figure", ".", "save_figure", "=", "True", "self", ".", "figure", ".", "output_path", "=", "output_path", "self", ".", "figure", ".", "savefig_kwargs", "="...
Save figure during generation. This method is used to save a completed figure during the main function run. It represents a call to ``matplotlib.pyplot.fig.savefig``. # TODO: Switch to kwargs for matplotlib.pyplot.savefig Args: output_path (str): Relative path to the WORKI...
[ "Save", "figure", "during", "generation", "." ]
python
train
spyder-ide/spyder
spyder/plugins/explorer/widgets.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1348-L1385
def chdir(self, directory=None, browsing_history=False): """Set directory as working directory""" if directory is not None: directory = osp.abspath(to_text_string(directory)) if browsing_history: directory = self.history[self.histindex] elif directory in sel...
[ "def", "chdir", "(", "self", ",", "directory", "=", "None", ",", "browsing_history", "=", "False", ")", ":", "if", "directory", "is", "not", "None", ":", "directory", "=", "osp", ".", "abspath", "(", "to_text_string", "(", "directory", ")", ")", "if", ...
Set directory as working directory
[ "Set", "directory", "as", "working", "directory" ]
python
train
cloudendpoints/endpoints-management-python
endpoints_management/control/wsgi.py
https://github.com/cloudendpoints/endpoints-management-python/blob/ec3c4a330ae9d65738861ce6df4dd6c3cb9f7731/endpoints_management/control/wsgi.py#L658-L688
def _create_authenticator(a_service): """Create an instance of :class:`google.auth.tokens.Authenticator`. Args: a_service (:class:`endpoints_management.gen.servicemanagement_v1_messages.Service`): a service instance """ if not isinstance(a_service, sm_messages.Service): raise Valu...
[ "def", "_create_authenticator", "(", "a_service", ")", ":", "if", "not", "isinstance", "(", "a_service", ",", "sm_messages", ".", "Service", ")", ":", "raise", "ValueError", "(", "u\"service is None or not an instance of Service\"", ")", "authentication", "=", "a_serv...
Create an instance of :class:`google.auth.tokens.Authenticator`. Args: a_service (:class:`endpoints_management.gen.servicemanagement_v1_messages.Service`): a service instance
[ "Create", "an", "instance", "of", ":", "class", ":", "google", ".", "auth", ".", "tokens", ".", "Authenticator", "." ]
python
train
oscarbranson/latools
latools/helpers/stat_fns.py
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/stat_fns.py#L51-L96
def gauss_weighted_stats(x, yarray, x_new, fwhm): """ Calculate gaussian weigted moving mean, SD and SE. Parameters ---------- x : array-like The independent variable yarray : (n,m) array Where n = x.size, and m is the number of dependent variables to smooth. x_new :...
[ "def", "gauss_weighted_stats", "(", "x", ",", "yarray", ",", "x_new", ",", "fwhm", ")", ":", "sigma", "=", "fwhm", "/", "(", "2", "*", "np", ".", "sqrt", "(", "2", "*", "np", ".", "log", "(", "2", ")", ")", ")", "# create empty mask array", "mask",...
Calculate gaussian weigted moving mean, SD and SE. Parameters ---------- x : array-like The independent variable yarray : (n,m) array Where n = x.size, and m is the number of dependent variables to smooth. x_new : array-like The new x-scale to interpolate the data ...
[ "Calculate", "gaussian", "weigted", "moving", "mean", "SD", "and", "SE", "." ]
python
test
SpriteLink/NIPAP
pynipap/pynipap.py
https://github.com/SpriteLink/NIPAP/blob/f96069f11ab952d80b13cab06e0528f2d24b3de9/pynipap/pynipap.py#L585-L639
def save(self): """ Save changes made to object to NIPAP. If the object represents a new VRF unknown to NIPAP (attribute `id` is `None`) this function maps to the function :py:func:`nipap.backend.Nipap.add_vrf` in the backend, used to create a new VRF. Otherwise ...
[ "def", "save", "(", "self", ")", ":", "xmlrpc", "=", "XMLRPCConnection", "(", ")", "data", "=", "{", "'rt'", ":", "self", ".", "rt", ",", "'name'", ":", "self", ".", "name", ",", "'description'", ":", "self", ".", "description", ",", "'tags'", ":", ...
Save changes made to object to NIPAP. If the object represents a new VRF unknown to NIPAP (attribute `id` is `None`) this function maps to the function :py:func:`nipap.backend.Nipap.add_vrf` in the backend, used to create a new VRF. Otherwise it maps to the function ...
[ "Save", "changes", "made", "to", "object", "to", "NIPAP", "." ]
python
train
annoviko/pyclustering
pyclustering/cluster/examples/xmeans_examples.py
https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/examples/xmeans_examples.py#L121-L125
def cluster_target(): "Not so applicable for this sample" start_centers = [[0.2, 0.2], [0.0, -2.0], [3.0, -3.0], [3.0, 3.0], [-3.0, 3.0], [-3.0, -3.0]] template_clustering(start_centers, FCPS_SAMPLES.SAMPLE_TARGET, criterion = splitting_type.BAYESIAN_INFORMATION_CRITERION) template_clustering(start_...
[ "def", "cluster_target", "(", ")", ":", "start_centers", "=", "[", "[", "0.2", ",", "0.2", "]", ",", "[", "0.0", ",", "-", "2.0", "]", ",", "[", "3.0", ",", "-", "3.0", "]", ",", "[", "3.0", ",", "3.0", "]", ",", "[", "-", "3.0", ",", "3.0"...
Not so applicable for this sample
[ "Not", "so", "applicable", "for", "this", "sample" ]
python
valid
majerteam/sqla_inspect
sqla_inspect/export.py
https://github.com/majerteam/sqla_inspect/blob/67edb5541e6a56b0a657d3774d1e19c1110cd402/sqla_inspect/export.py#L308-L326
def _merge_many_to_one_field_from_fkey(self, main_infos, prop, result): """ Find the relationship associated with this fkey and set the title :param dict main_infos: The already collected datas about this column :param obj prop: The property mapper of the relationship :param lis...
[ "def", "_merge_many_to_one_field_from_fkey", "(", "self", ",", "main_infos", ",", "prop", ",", "result", ")", ":", "if", "prop", ".", "columns", "[", "0", "]", ".", "foreign_keys", "and", "prop", ".", "key", ".", "endswith", "(", "'_id'", ")", ":", "# We...
Find the relationship associated with this fkey and set the title :param dict main_infos: The already collected datas about this column :param obj prop: The property mapper of the relationship :param list result: The actual collected headers :returns: a main_infos dict or None
[ "Find", "the", "relationship", "associated", "with", "this", "fkey", "and", "set", "the", "title" ]
python
train
ellethee/argparseinator
argparseinator/__init__.py
https://github.com/ellethee/argparseinator/blob/05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e/argparseinator/__init__.py#L552-L555
def _self_event(self, event_name, cmd, *pargs, **kwargs): """Call self event""" if hasattr(self, event_name): getattr(self, event_name)(cmd, *pargs, **kwargs)
[ "def", "_self_event", "(", "self", ",", "event_name", ",", "cmd", ",", "*", "pargs", ",", "*", "*", "kwargs", ")", ":", "if", "hasattr", "(", "self", ",", "event_name", ")", ":", "getattr", "(", "self", ",", "event_name", ")", "(", "cmd", ",", "*",...
Call self event
[ "Call", "self", "event" ]
python
train
10gen/mongo-orchestration
mongo_orchestration/sharded_clusters.py
https://github.com/10gen/mongo-orchestration/blob/81fd2224205922ea2178b08190b53a33aec47261/mongo_orchestration/sharded_clusters.py#L214-L226
def __init_configrs(self, rs_cfg): """Create and start a config replica set.""" # Use 'rs_id' to set the id for consistency, but need to rename # to 'id' to use with ReplicaSets.create() rs_cfg['id'] = rs_cfg.pop('rs_id', None) for member in rs_cfg.setdefault('members', [{}]): ...
[ "def", "__init_configrs", "(", "self", ",", "rs_cfg", ")", ":", "# Use 'rs_id' to set the id for consistency, but need to rename", "# to 'id' to use with ReplicaSets.create()", "rs_cfg", "[", "'id'", "]", "=", "rs_cfg", ".", "pop", "(", "'rs_id'", ",", "None", ")", "for...
Create and start a config replica set.
[ "Create", "and", "start", "a", "config", "replica", "set", "." ]
python
train
Azure/azure-sdk-for-python
azure-servicemanagement-legacy/azure/servicemanagement/servicebusmanagementservice.py
https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/servicebusmanagementservice.py#L134-L145
def delete_namespace(self, name): ''' Delete a service bus namespace. name: Name of the service bus namespace to delete. ''' _validate_not_none('name', name) return self._perform_delete( self._get_path('services/serviceBus/Namespaces', name), ...
[ "def", "delete_namespace", "(", "self", ",", "name", ")", ":", "_validate_not_none", "(", "'name'", ",", "name", ")", "return", "self", ".", "_perform_delete", "(", "self", ".", "_get_path", "(", "'services/serviceBus/Namespaces'", ",", "name", ")", ",", "None...
Delete a service bus namespace. name: Name of the service bus namespace to delete.
[ "Delete", "a", "service", "bus", "namespace", "." ]
python
test
TUNE-Archive/freight_forwarder
freight_forwarder/cli/quality_control.py
https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/cli/quality_control.py#L96-L130
def _quality_control(self, args, **extra_args): """ Export is the entry point for exporting docker images. """ if not isinstance(args, argparse.Namespace): raise Exception("args should of an instance of argparse.Namespace") # create new freight forwarder object ...
[ "def", "_quality_control", "(", "self", ",", "args", ",", "*", "*", "extra_args", ")", ":", "if", "not", "isinstance", "(", "args", ",", "argparse", ".", "Namespace", ")", ":", "raise", "Exception", "(", "\"args should of an instance of argparse.Namespace\"", ")...
Export is the entry point for exporting docker images.
[ "Export", "is", "the", "entry", "point", "for", "exporting", "docker", "images", "." ]
python
train
apache/incubator-heron
heron/tools/cli/src/python/help.py
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/cli/src/python/help.py#L51-L74
def run(command, parser, args, unknown_args): ''' :param command: :param parser: :param args: :param unknown_args: :return: ''' # get the command for detailed help command_help = args['help-command'] # if no command is provided, just print main help if command_help == 'help': parser.print_hel...
[ "def", "run", "(", "command", ",", "parser", ",", "args", ",", "unknown_args", ")", ":", "# get the command for detailed help", "command_help", "=", "args", "[", "'help-command'", "]", "# if no command is provided, just print main help", "if", "command_help", "==", "'he...
:param command: :param parser: :param args: :param unknown_args: :return:
[ ":", "param", "command", ":", ":", "param", "parser", ":", ":", "param", "args", ":", ":", "param", "unknown_args", ":", ":", "return", ":" ]
python
valid
PMBio/limix-backup
limix/deprecated/archive/varianceDecompositionOld.py
https://github.com/PMBio/limix-backup/blob/1e201fdb5c694d0d5506f207f3de65d8ef66146c/limix/deprecated/archive/varianceDecompositionOld.py#L112-L155
def addSingleTraitTerm(self,K=None,is_noise=False,normalize=True,Ks=None): """ add random effects term for single trait models (no trait-trait covariance matrix) Args: K: NxN sample covariance matrix is_noise: bool labeling the noise term (noise term has...
[ "def", "addSingleTraitTerm", "(", "self", ",", "K", "=", "None", ",", "is_noise", "=", "False", ",", "normalize", "=", "True", ",", "Ks", "=", "None", ")", ":", "assert", "self", ".", "P", "==", "1", ",", "'Incompatible number of traits'", "assert", "K",...
add random effects term for single trait models (no trait-trait covariance matrix) Args: K: NxN sample covariance matrix is_noise: bool labeling the noise term (noise term has K=eye) normalize: if True, K and Ks are scales such that K.diagonal().mean()==1 ...
[ "add", "random", "effects", "term", "for", "single", "trait", "models", "(", "no", "trait", "-", "trait", "covariance", "matrix", ")", "Args", ":", "K", ":", "NxN", "sample", "covariance", "matrix", "is_noise", ":", "bool", "labeling", "the", "noise", "ter...
python
train
UB-UNIBAS/simple-elastic
simple_elastic/index.py
https://github.com/UB-UNIBAS/simple-elastic/blob/54f2fdd3405a7eafbf8873f337da263b8d47532a/simple_elastic/index.py#L75-L84
def create(self): """Create the corresponding index. Will overwrite existing indexes of the same name.""" body = dict() if self.mapping is not None: body['mappings'] = self.mapping if self.settings is not None: body['settings'] = self.settings else: ...
[ "def", "create", "(", "self", ")", ":", "body", "=", "dict", "(", ")", "if", "self", ".", "mapping", "is", "not", "None", ":", "body", "[", "'mappings'", "]", "=", "self", ".", "mapping", "if", "self", ".", "settings", "is", "not", "None", ":", "...
Create the corresponding index. Will overwrite existing indexes of the same name.
[ "Create", "the", "corresponding", "index", ".", "Will", "overwrite", "existing", "indexes", "of", "the", "same", "name", "." ]
python
train
DLR-RM/RAFCON
source/rafcon/core/states/state.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L1410-L1417
def is_root_state_of_library(self): """ If self is the attribute LibraryState.state_copy of a LibraryState its the library root state and its parent is a LibraryState :return True or False :rtype bool """ from rafcon.core.states.library_state import LibraryState r...
[ "def", "is_root_state_of_library", "(", "self", ")", ":", "from", "rafcon", ".", "core", ".", "states", ".", "library_state", "import", "LibraryState", "return", "isinstance", "(", "self", ".", "parent", ",", "LibraryState", ")" ]
If self is the attribute LibraryState.state_copy of a LibraryState its the library root state and its parent is a LibraryState :return True or False :rtype bool
[ "If", "self", "is", "the", "attribute", "LibraryState", ".", "state_copy", "of", "a", "LibraryState", "its", "the", "library", "root", "state", "and", "its", "parent", "is", "a", "LibraryState", ":", "return", "True", "or", "False", ":", "rtype", "bool" ]
python
train
OpenGov/carpenter
carpenter/blocks/block.py
https://github.com/OpenGov/carpenter/blob/0ab3c54c05133b9b0468c63e834a7ce3a6fb575b/carpenter/blocks/block.py#L441-L463
def _check_interpret_cell(self, cell, prior_cell, row_index, column_index): ''' Helper function which checks cell type and performs cell translation to strings where necessary. Returns: A tuple of the form '(cell, changed)' where 'changed' indicates if 'cell' differs from ...
[ "def", "_check_interpret_cell", "(", "self", ",", "cell", ",", "prior_cell", ",", "row_index", ",", "column_index", ")", ":", "changed", "=", "False", "if", "(", "not", "is_empty_cell", "(", "cell", ")", "and", "not", "is_text_cell", "(", "cell", ")", ")",...
Helper function which checks cell type and performs cell translation to strings where necessary. Returns: A tuple of the form '(cell, changed)' where 'changed' indicates if 'cell' differs from input.
[ "Helper", "function", "which", "checks", "cell", "type", "and", "performs", "cell", "translation", "to", "strings", "where", "necessary", "." ]
python
train
quantmind/pulsar
pulsar/utils/config.py
https://github.com/quantmind/pulsar/blob/fee44e871954aa6ca36d00bb5a3739abfdb89b26/pulsar/utils/config.py#L594-L611
def set(self, val, default=False, imported=False): """Set ``val`` as the :attr:`value` for this :class:`Setting`. If ``default`` is ``True`` set also the :attr:`default` value. """ if hasattr(self.validator, '__call__'): try: val = self.validator(val) ...
[ "def", "set", "(", "self", ",", "val", ",", "default", "=", "False", ",", "imported", "=", "False", ")", ":", "if", "hasattr", "(", "self", ".", "validator", ",", "'__call__'", ")", ":", "try", ":", "val", "=", "self", ".", "validator", "(", "val",...
Set ``val`` as the :attr:`value` for this :class:`Setting`. If ``default`` is ``True`` set also the :attr:`default` value.
[ "Set", "val", "as", "the", ":", "attr", ":", "value", "for", "this", ":", "class", ":", "Setting", "." ]
python
train
alex-kostirin/pyatomac
atomac/AXClasses.py
https://github.com/alex-kostirin/pyatomac/blob/3f46f6feb4504315eec07abb18bb41be4d257aeb/atomac/AXClasses.py#L1301-L1308
def _convenienceMatch(self, role, attr, match): """Method used by role based convenience functions to find a match""" kwargs = {} # If the user supplied some text to search for, # supply that in the kwargs if match: kwargs[attr] = match return self.findAll(AXR...
[ "def", "_convenienceMatch", "(", "self", ",", "role", ",", "attr", ",", "match", ")", ":", "kwargs", "=", "{", "}", "# If the user supplied some text to search for,", "# supply that in the kwargs", "if", "match", ":", "kwargs", "[", "attr", "]", "=", "match", "r...
Method used by role based convenience functions to find a match
[ "Method", "used", "by", "role", "based", "convenience", "functions", "to", "find", "a", "match" ]
python
valid
MisterY/gnucash-portfolio
gnucash_portfolio/lib/datetimeutils.py
https://github.com/MisterY/gnucash-portfolio/blob/bfaad8345a5479d1cd111acee1939e25c2a638c2/gnucash_portfolio/lib/datetimeutils.py#L15-L19
def get_from_gnucash26_date(date_str: str) -> date: """ Creates a datetime from GnuCash 2.6 date string """ date_format = "%Y%m%d" result = datetime.strptime(date_str, date_format).date() return result
[ "def", "get_from_gnucash26_date", "(", "date_str", ":", "str", ")", "->", "date", ":", "date_format", "=", "\"%Y%m%d\"", "result", "=", "datetime", ".", "strptime", "(", "date_str", ",", "date_format", ")", ".", "date", "(", ")", "return", "result" ]
Creates a datetime from GnuCash 2.6 date string
[ "Creates", "a", "datetime", "from", "GnuCash", "2", ".", "6", "date", "string" ]
python
train
onelogin/python3-saml
src/onelogin/saml2/response.py
https://github.com/onelogin/python3-saml/blob/064b7275fba1e5f39a9116ba1cdcc5d01fc34daa/src/onelogin/saml2/response.py#L330-L348
def check_status(self): """ Check if the status of the response is success or not :raises: Exception. If the status is not success """ status = OneLogin_Saml2_Utils.get_status(self.document) code = status.get('code', None) if code and code != OneLogin_Saml2_Const...
[ "def", "check_status", "(", "self", ")", ":", "status", "=", "OneLogin_Saml2_Utils", ".", "get_status", "(", "self", ".", "document", ")", "code", "=", "status", ".", "get", "(", "'code'", ",", "None", ")", "if", "code", "and", "code", "!=", "OneLogin_Sa...
Check if the status of the response is success or not :raises: Exception. If the status is not success
[ "Check", "if", "the", "status", "of", "the", "response", "is", "success", "or", "not" ]
python
train
ev3dev/ev3dev-lang-python
ev3dev2/motor.py
https://github.com/ev3dev/ev3dev-lang-python/blob/afc98d35004b533dc161a01f7c966e78607d7c1e/ev3dev2/motor.py#L1962-L1967
def on_for_seconds(self, steering, speed, seconds, brake=True, block=True): """ Rotate the motors according to the provided ``steering`` for ``seconds``. """ (left_speed, right_speed) = self.get_speed_steering(steering, speed) MoveTank.on_for_seconds(self, SpeedNativeUnits(left_s...
[ "def", "on_for_seconds", "(", "self", ",", "steering", ",", "speed", ",", "seconds", ",", "brake", "=", "True", ",", "block", "=", "True", ")", ":", "(", "left_speed", ",", "right_speed", ")", "=", "self", ".", "get_speed_steering", "(", "steering", ",",...
Rotate the motors according to the provided ``steering`` for ``seconds``.
[ "Rotate", "the", "motors", "according", "to", "the", "provided", "steering", "for", "seconds", "." ]
python
train
Galarzaa90/tibia.py
tibiapy/character.py
https://github.com/Galarzaa90/tibia.py/blob/02ba1a8f1e18177ef5c7dcd44affc8d761d59e12/tibiapy/character.py#L401-L442
def _parse_deaths(self, rows): """ Parses the character's recent deaths Parameters ---------- rows: :class:`list` of :class:`bs4.Tag` A list of all rows contained in the table. """ for row in rows: cols = row.find_all('td') dea...
[ "def", "_parse_deaths", "(", "self", ",", "rows", ")", ":", "for", "row", "in", "rows", ":", "cols", "=", "row", ".", "find_all", "(", "'td'", ")", "death_time_str", "=", "cols", "[", "0", "]", ".", "text", ".", "replace", "(", "\"\\xa0\"", ",", "\...
Parses the character's recent deaths Parameters ---------- rows: :class:`list` of :class:`bs4.Tag` A list of all rows contained in the table.
[ "Parses", "the", "character", "s", "recent", "deaths" ]
python
train
tensorpack/tensorpack
tensorpack/dataflow/imgaug/geometry.py
https://github.com/tensorpack/tensorpack/blob/d7a13cb74c9066bc791d7aafc3b744b60ee79a9f/tensorpack/dataflow/imgaug/geometry.py#L128-L152
def largest_rotated_rect(w, h, angle): """ Get largest rectangle after rotation. http://stackoverflow.com/questions/16702966/rotate-image-and-crop-out-black-borders """ angle = angle / 180.0 * math.pi if w <= 0 or h <= 0: return 0, 0 width_is_longer =...
[ "def", "largest_rotated_rect", "(", "w", ",", "h", ",", "angle", ")", ":", "angle", "=", "angle", "/", "180.0", "*", "math", ".", "pi", "if", "w", "<=", "0", "or", "h", "<=", "0", ":", "return", "0", ",", "0", "width_is_longer", "=", "w", ">=", ...
Get largest rectangle after rotation. http://stackoverflow.com/questions/16702966/rotate-image-and-crop-out-black-borders
[ "Get", "largest", "rectangle", "after", "rotation", ".", "http", ":", "//", "stackoverflow", ".", "com", "/", "questions", "/", "16702966", "/", "rotate", "-", "image", "-", "and", "-", "crop", "-", "out", "-", "black", "-", "borders" ]
python
train
softlayer/softlayer-python
SoftLayer/managers/account.py
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/account.py#L94-L118
def get_invoices(self, limit=50, closed=False, get_all=False): """Gets an accounts invoices. :param int limit: Number of invoices to get back in a single call. :param bool closed: If True, will also get CLOSED invoices :param bool get_all: If True, will paginate through invoices until a...
[ "def", "get_invoices", "(", "self", ",", "limit", "=", "50", ",", "closed", "=", "False", ",", "get_all", "=", "False", ")", ":", "mask", "=", "\"mask[invoiceTotalAmount, itemCount]\"", "_filter", "=", "{", "'invoices'", ":", "{", "'createDate'", ":", "{", ...
Gets an accounts invoices. :param int limit: Number of invoices to get back in a single call. :param bool closed: If True, will also get CLOSED invoices :param bool get_all: If True, will paginate through invoices until all have been retrieved. :return: Billing_Invoice
[ "Gets", "an", "accounts", "invoices", "." ]
python
train
pmacosta/pexdoc
pexdoc/pinspect.py
https://github.com/pmacosta/pexdoc/blob/201ac243e5781347feb75896a4231429fe6da4b1/pexdoc/pinspect.py#L989-L1029
def visit_Assign(self, node): """ Implement assignment walker. Parse class properties defined via the property() function """ # [[[cog # cog.out("print(pcolor('Enter assign visitor', 'magenta'))") # ]]] # [[[end]]] # ### # Class-level assi...
[ "def", "visit_Assign", "(", "self", ",", "node", ")", ":", "# [[[cog", "# cog.out(\"print(pcolor('Enter assign visitor', 'magenta'))\")", "# ]]]", "# [[[end]]]", "# ###", "# Class-level assignment may also be a class attribute that is not", "# a managed attribute, record it anyway, no ha...
Implement assignment walker. Parse class properties defined via the property() function
[ "Implement", "assignment", "walker", "." ]
python
train
pydata/pandas-gbq
pandas_gbq/gbq.py
https://github.com/pydata/pandas-gbq/blob/e590317b3325939ede7563f49aa6b163bb803b77/pandas_gbq/gbq.py#L1328-L1349
def exists(self, dataset_id): """ Check if a dataset exists in Google BigQuery Parameters ---------- dataset_id : str Name of dataset to be verified Returns ------- boolean true if dataset exists, otherwise false """ from ...
[ "def", "exists", "(", "self", ",", "dataset_id", ")", ":", "from", "google", ".", "api_core", ".", "exceptions", "import", "NotFound", "try", ":", "self", ".", "client", ".", "get_dataset", "(", "self", ".", "client", ".", "dataset", "(", "dataset_id", "...
Check if a dataset exists in Google BigQuery Parameters ---------- dataset_id : str Name of dataset to be verified Returns ------- boolean true if dataset exists, otherwise false
[ "Check", "if", "a", "dataset", "exists", "in", "Google", "BigQuery" ]
python
train
openstates/billy
billy/web/public/views/region.py
https://github.com/openstates/billy/blob/5fc795347f12a949e410a8cfad0c911ea6bced67/billy/web/public/views/region.py#L17-L23
def region_selection(request): '''Handle submission of the region selection form in the base template. ''' form = get_region_select_form(request.GET) abbr = form.data.get('abbr') if not abbr or len(abbr) != 2: return redirect('homepage') return redirect('region', abbr=abbr)
[ "def", "region_selection", "(", "request", ")", ":", "form", "=", "get_region_select_form", "(", "request", ".", "GET", ")", "abbr", "=", "form", ".", "data", ".", "get", "(", "'abbr'", ")", "if", "not", "abbr", "or", "len", "(", "abbr", ")", "!=", "...
Handle submission of the region selection form in the base template.
[ "Handle", "submission", "of", "the", "region", "selection", "form", "in", "the", "base", "template", "." ]
python
train