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
bio2bel/bio2bel
src/bio2bel/manager/cli_manager.py
https://github.com/bio2bel/bio2bel/blob/d80762d891fa18b248709ff0b0f97ebb65ec64c2/src/bio2bel/manager/cli_manager.py#L23-L41
def get_cli(cls) -> click.Group: """Build a :mod:`click` CLI main function. :param Type[AbstractManager] cls: A Manager class :return: The main function for click """ group_help = 'Default connection at {}\n\nusing Bio2BEL v{}'.format(cls._get_connection(), get_version()) ...
[ "def", "get_cli", "(", "cls", ")", "->", "click", ".", "Group", ":", "group_help", "=", "'Default connection at {}\\n\\nusing Bio2BEL v{}'", ".", "format", "(", "cls", ".", "_get_connection", "(", ")", ",", "get_version", "(", ")", ")", "@", "click", ".", "g...
Build a :mod:`click` CLI main function. :param Type[AbstractManager] cls: A Manager class :return: The main function for click
[ "Build", "a", ":", "mod", ":", "click", "CLI", "main", "function", "." ]
python
valid
saltstack/salt
salt/modules/saltutil.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1175-L1204
def clear_cache(days=-1): ''' Forcibly removes all caches on a minion. .. versionadded:: 2014.7.0 WARNING: The safest way to clear a minion cache is by first stopping the minion and then deleting the cache files before restarting it. CLI Example: .. code-block:: bash salt '*' sa...
[ "def", "clear_cache", "(", "days", "=", "-", "1", ")", ":", "threshold", "=", "time", ".", "time", "(", ")", "-", "days", "*", "24", "*", "60", "*", "60", "for", "root", ",", "dirs", ",", "files", "in", "salt", ".", "utils", ".", "files", ".", ...
Forcibly removes all caches on a minion. .. versionadded:: 2014.7.0 WARNING: The safest way to clear a minion cache is by first stopping the minion and then deleting the cache files before restarting it. CLI Example: .. code-block:: bash salt '*' saltutil.clear_cache days=7
[ "Forcibly", "removes", "all", "caches", "on", "a", "minion", "." ]
python
train
mrstephenneal/mysql-toolkit
mysql/toolkit/datatypes/numeric.py
https://github.com/mrstephenneal/mysql-toolkit/blob/6964f718f4b72eb30f2259adfcfaf3090526c53d/mysql/toolkit/datatypes/numeric.py#L41-L48
def _is_numeric_data(self, data_type): """Private method for testing text data types.""" dt = DATA_TYPES[data_type] if dt['min'] and dt['max']: if type(self.data) is dt['type'] and dt['min'] < self.data < dt['max']: self.type = data_type.upper() self.l...
[ "def", "_is_numeric_data", "(", "self", ",", "data_type", ")", ":", "dt", "=", "DATA_TYPES", "[", "data_type", "]", "if", "dt", "[", "'min'", "]", "and", "dt", "[", "'max'", "]", ":", "if", "type", "(", "self", ".", "data", ")", "is", "dt", "[", ...
Private method for testing text data types.
[ "Private", "method", "for", "testing", "text", "data", "types", "." ]
python
train
saltstack/salt
salt/modules/consul.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/consul.py#L540-L594
def agent_maintenance(consul_url=None, token=None, **kwargs): ''' Manages node maintenance mode :param consul_url: The Consul server URL. :param enable: The enable flag is required. Acceptable values are either true (to enter maintenance mode) or ...
[ "def", "agent_maintenance", "(", "consul_url", "=", "None", ",", "token", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "}", "query_params", "=", "{", "}", "if", "not", "consul_url", ":", "consul_url", "=", "_get_config", "(", ")", ...
Manages node maintenance mode :param consul_url: The Consul server URL. :param enable: The enable flag is required. Acceptable values are either true (to enter maintenance mode) or false (to resume normal operation). :param reason: If provided, its v...
[ "Manages", "node", "maintenance", "mode" ]
python
train
istresearch/scrapy-cluster
rest/rest_service.py
https://github.com/istresearch/scrapy-cluster/blob/13aaed2349af5d792d6bcbfcadc5563158aeb599/rest/rest_service.py#L480-L491
def _close_thread(self, thread, thread_name): """Closes daemon threads @param thread: the thread to close @param thread_name: a human readable name of the thread """ if thread is not None and thread.isAlive(): self.logger.debug("Waiting for {} thread to close".format...
[ "def", "_close_thread", "(", "self", ",", "thread", ",", "thread_name", ")", ":", "if", "thread", "is", "not", "None", "and", "thread", ".", "isAlive", "(", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"Waiting for {} thread to close\"", ".", "for...
Closes daemon threads @param thread: the thread to close @param thread_name: a human readable name of the thread
[ "Closes", "daemon", "threads" ]
python
train
nielstron/pysyncthru
pysyncthru/__init__.py
https://github.com/nielstron/pysyncthru/blob/850a85ba0a74cbd5c408102bb02fd005d8b61ffb/pysyncthru/__init__.py#L131-L144
def input_tray_status(self, filter_supported: bool = True) -> Dict[int, Any]: """Return the state of all input trays.""" tray_status = {} for i in range(1, 5): try: tray_stat = self.data.get('{}{}'.format(SyncThru.TRAY, i), {}) ...
[ "def", "input_tray_status", "(", "self", ",", "filter_supported", ":", "bool", "=", "True", ")", "->", "Dict", "[", "int", ",", "Any", "]", ":", "tray_status", "=", "{", "}", "for", "i", "in", "range", "(", "1", ",", "5", ")", ":", "try", ":", "t...
Return the state of all input trays.
[ "Return", "the", "state", "of", "all", "input", "trays", "." ]
python
train
pschmitt/pyteleloisirs
pyteleloisirs/pyteleloisirs.py
https://github.com/pschmitt/pyteleloisirs/blob/d63610fd3729862455ac42afca440469f8063fba/pyteleloisirs/pyteleloisirs.py#L235-L249
async def async_get_current_program(channel, no_cache=False): ''' Get the current program info ''' chan = await async_determine_channel(channel) guide = await async_get_program_guide(chan, no_cache) if not guide: _LOGGER.warning('Could not retrieve TV program for %s', channel) re...
[ "async", "def", "async_get_current_program", "(", "channel", ",", "no_cache", "=", "False", ")", ":", "chan", "=", "await", "async_determine_channel", "(", "channel", ")", "guide", "=", "await", "async_get_program_guide", "(", "chan", ",", "no_cache", ")", "if",...
Get the current program info
[ "Get", "the", "current", "program", "info" ]
python
train
flyte/upnpclient
upnpclient/ssdp.py
https://github.com/flyte/upnpclient/blob/5529b950df33c0eaf0c24a9a307cf00fe627d0ad/upnpclient/ssdp.py#L7-L22
def discover(timeout=5): """ Convenience method to discover UPnP devices on the network. Returns a list of `upnp.Device` instances. Any invalid servers are silently ignored. """ devices = {} for entry in scan(timeout): if entry.location in devices: continue try: ...
[ "def", "discover", "(", "timeout", "=", "5", ")", ":", "devices", "=", "{", "}", "for", "entry", "in", "scan", "(", "timeout", ")", ":", "if", "entry", ".", "location", "in", "devices", ":", "continue", "try", ":", "devices", "[", "entry", ".", "lo...
Convenience method to discover UPnP devices on the network. Returns a list of `upnp.Device` instances. Any invalid servers are silently ignored.
[ "Convenience", "method", "to", "discover", "UPnP", "devices", "on", "the", "network", ".", "Returns", "a", "list", "of", "upnp", ".", "Device", "instances", ".", "Any", "invalid", "servers", "are", "silently", "ignored", "." ]
python
train
yhat/db.py
db/utils.py
https://github.com/yhat/db.py/blob/df2dbb8ef947c2d4253d31f29eb58c4084daffc5/db/utils.py#L5-L8
def profile_path(profile_id, profile): """Create full path to given provide for the current user.""" user = os.path.expanduser("~") return os.path.join(user, profile_id + profile)
[ "def", "profile_path", "(", "profile_id", ",", "profile", ")", ":", "user", "=", "os", ".", "path", ".", "expanduser", "(", "\"~\"", ")", "return", "os", ".", "path", ".", "join", "(", "user", ",", "profile_id", "+", "profile", ")" ]
Create full path to given provide for the current user.
[ "Create", "full", "path", "to", "given", "provide", "for", "the", "current", "user", "." ]
python
train
QualiSystems/vCenterShell
package/cloudshell/cp/vcenter/commands/command_orchestrator.py
https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/command_orchestrator.py#L523-L551
def orchestration_save(self, context, mode="shallow", custom_params=None): """ Creates a snapshot with a unique name and returns SavedResults as JSON :param context: resource context of the vCenterShell :param mode: Snapshot save mode, default shallow. Currently not it use :param...
[ "def", "orchestration_save", "(", "self", ",", "context", ",", "mode", "=", "\"shallow\"", ",", "custom_params", "=", "None", ")", ":", "resource_details", "=", "self", ".", "_parse_remote_model", "(", "context", ")", "created_date", "=", "datetime", ".", "now...
Creates a snapshot with a unique name and returns SavedResults as JSON :param context: resource context of the vCenterShell :param mode: Snapshot save mode, default shallow. Currently not it use :param custom_params: Set of custom parameter to be supported in the future :return: SavedRes...
[ "Creates", "a", "snapshot", "with", "a", "unique", "name", "and", "returns", "SavedResults", "as", "JSON", ":", "param", "context", ":", "resource", "context", "of", "the", "vCenterShell", ":", "param", "mode", ":", "Snapshot", "save", "mode", "default", "sh...
python
train
cga-harvard/Hypermap-Registry
hypermap/aggregator/utils.py
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/aggregator/utils.py#L435-L445
def get_sanitized_endpoint(url): """ Sanitize an endpoint, as removing unneeded parameters """ # sanitize esri sanitized_url = url.rstrip() esri_string = '/rest/services' if esri_string in url: match = re.search(esri_string, sanitized_url) sanitized_url = url[0:(match.start(0...
[ "def", "get_sanitized_endpoint", "(", "url", ")", ":", "# sanitize esri", "sanitized_url", "=", "url", ".", "rstrip", "(", ")", "esri_string", "=", "'/rest/services'", "if", "esri_string", "in", "url", ":", "match", "=", "re", ".", "search", "(", "esri_string"...
Sanitize an endpoint, as removing unneeded parameters
[ "Sanitize", "an", "endpoint", "as", "removing", "unneeded", "parameters" ]
python
train
lark-parser/lark
lark/tree.py
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/lark/tree.py#L144-L180
def pydot__tree_to_png(tree, filename, rankdir="LR"): """Creates a colorful image that represents the tree (data+children, without meta) Possible values for `rankdir` are "TB", "LR", "BT", "RL", corresponding to directed graphs drawn from top to bottom, from left to right, from bottom to top, and from ...
[ "def", "pydot__tree_to_png", "(", "tree", ",", "filename", ",", "rankdir", "=", "\"LR\"", ")", ":", "import", "pydot", "graph", "=", "pydot", ".", "Dot", "(", "graph_type", "=", "'digraph'", ",", "rankdir", "=", "rankdir", ")", "i", "=", "[", "0", "]",...
Creates a colorful image that represents the tree (data+children, without meta) Possible values for `rankdir` are "TB", "LR", "BT", "RL", corresponding to directed graphs drawn from top to bottom, from left to right, from bottom to top, and from right to left, respectively. See: https://www.graphviz.or...
[ "Creates", "a", "colorful", "image", "that", "represents", "the", "tree", "(", "data", "+", "children", "without", "meta", ")" ]
python
train
Ouranosinc/xclim
xclim/utils.py
https://github.com/Ouranosinc/xclim/blob/2080d139188bd8de2aeca097a025c2d89d6e0e09/xclim/utils.py#L692-L717
def adjust_doy_calendar(source, target): """Interpolate from one set of dayofyear range to another calendar. Interpolate an array defined over a `dayofyear` range (say 1 to 360) to another `dayofyear` range (say 1 to 365). Parameters ---------- source : xarray.DataArray Array with `dayof...
[ "def", "adjust_doy_calendar", "(", "source", ",", "target", ")", ":", "doy_max_source", "=", "source", ".", "dayofyear", ".", "max", "(", ")", "doy_max", "=", "infer_doy_max", "(", "target", ")", "if", "doy_max_source", "==", "doy_max", ":", "return", "sourc...
Interpolate from one set of dayofyear range to another calendar. Interpolate an array defined over a `dayofyear` range (say 1 to 360) to another `dayofyear` range (say 1 to 365). Parameters ---------- source : xarray.DataArray Array with `dayofyear` coordinates. target : xarray.DataArray...
[ "Interpolate", "from", "one", "set", "of", "dayofyear", "range", "to", "another", "calendar", "." ]
python
train
skorch-dev/skorch
skorch/history.py
https://github.com/skorch-dev/skorch/blob/5b9b8b7b7712cb6e5aaa759d9608ea6269d5bcd3/skorch/history.py#L27-L37
def _getitem(item, i): """Extract value or values from dicts. Covers the case of a single key or multiple keys. If not found, return placeholders instead. """ if not isinstance(i, (tuple, list)): return item.get(i, _none) type_ = list if isinstance(item, list) else tuple return typ...
[ "def", "_getitem", "(", "item", ",", "i", ")", ":", "if", "not", "isinstance", "(", "i", ",", "(", "tuple", ",", "list", ")", ")", ":", "return", "item", ".", "get", "(", "i", ",", "_none", ")", "type_", "=", "list", "if", "isinstance", "(", "i...
Extract value or values from dicts. Covers the case of a single key or multiple keys. If not found, return placeholders instead.
[ "Extract", "value", "or", "values", "from", "dicts", "." ]
python
train
googleapis/google-cloud-python
storage/google/cloud/storage/blob.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/storage/google/cloud/storage/blob.py#L730-L759
def _get_writable_metadata(self): """Get the object / blob metadata which is writable. This is intended to be used when creating a new object / blob. See the `API reference docs`_ for more information, the fields marked as writable are: * ``acl`` * ``cacheControl`` ...
[ "def", "_get_writable_metadata", "(", "self", ")", ":", "# NOTE: This assumes `self.name` is unicode.", "object_metadata", "=", "{", "\"name\"", ":", "self", ".", "name", "}", "for", "key", "in", "self", ".", "_changes", ":", "if", "key", "in", "_WRITABLE_FIELDS",...
Get the object / blob metadata which is writable. This is intended to be used when creating a new object / blob. See the `API reference docs`_ for more information, the fields marked as writable are: * ``acl`` * ``cacheControl`` * ``contentDisposition`` * ``con...
[ "Get", "the", "object", "/", "blob", "metadata", "which", "is", "writable", "." ]
python
train
saltstack/salt
salt/modules/btrfs.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/btrfs.py#L802-L832
def subvolume_find_new(name, last_gen): ''' List the recently modified files in a subvolume name Name of the subvolume last_gen Last transid marker from where to compare CLI Example: .. code-block:: bash salt '*' btrfs.subvolume_find_new /var/volumes/tmp 1024 ''...
[ "def", "subvolume_find_new", "(", "name", ",", "last_gen", ")", ":", "cmd", "=", "[", "'btrfs'", ",", "'subvolume'", ",", "'find-new'", ",", "name", ",", "last_gen", "]", "res", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "cmd", ")", "salt", ".", ...
List the recently modified files in a subvolume name Name of the subvolume last_gen Last transid marker from where to compare CLI Example: .. code-block:: bash salt '*' btrfs.subvolume_find_new /var/volumes/tmp 1024
[ "List", "the", "recently", "modified", "files", "in", "a", "subvolume" ]
python
train
sprockets/sprockets-influxdb
sprockets_influxdb.py
https://github.com/sprockets/sprockets-influxdb/blob/cce73481b8f26b02e65e3f9914a9a22eceff3063/sprockets_influxdb.py#L423-L435
def set_timeout(milliseconds): """Override the maximum duration to wait for submitting measurements to InfluxDB. :param int milliseconds: Maximum wait in milliseconds """ global _timeout, _timeout_interval LOGGER.debug('Setting batch wait timeout to %i ms', milliseconds) _timeout_interval...
[ "def", "set_timeout", "(", "milliseconds", ")", ":", "global", "_timeout", ",", "_timeout_interval", "LOGGER", ".", "debug", "(", "'Setting batch wait timeout to %i ms'", ",", "milliseconds", ")", "_timeout_interval", "=", "milliseconds", "_maybe_stop_timeout", "(", ")"...
Override the maximum duration to wait for submitting measurements to InfluxDB. :param int milliseconds: Maximum wait in milliseconds
[ "Override", "the", "maximum", "duration", "to", "wait", "for", "submitting", "measurements", "to", "InfluxDB", "." ]
python
train
azavea/python-omgeo
omgeo/services/us_census.py
https://github.com/azavea/python-omgeo/blob/40f4e006f087dbc795a5d954ffa2c0eab433f8c9/omgeo/services/us_census.py#L53-L78
def _street_addr_from_response(self, match): """Construct a street address (no city, region, etc.) from a geocoder response. :param match: The match object returned by the geocoder. """ # Same caveat as above regarding the ordering of these fields; the # documentation is not exp...
[ "def", "_street_addr_from_response", "(", "self", ",", "match", ")", ":", "# Same caveat as above regarding the ordering of these fields; the", "# documentation is not explicit about the correct ordering for", "# reconstructing a full address, but implies that this is the ordering.", "ordered_...
Construct a street address (no city, region, etc.) from a geocoder response. :param match: The match object returned by the geocoder.
[ "Construct", "a", "street", "address", "(", "no", "city", "region", "etc", ".", ")", "from", "a", "geocoder", "response", "." ]
python
train
mangalam-research/selenic
selenic/util.py
https://github.com/mangalam-research/selenic/blob/2284c68e15fa3d34b88aa2eec1a2e8ecd37f44ad/selenic/util.py#L479-L525
def locations_within(a, b, tolerance): """ Verifies whether two positions are the same. A tolerance value determines how close the two positions must be to be considered "same". The two locations must be dictionaries that have the same keys. If a key is pesent in one but not in the other, this ...
[ "def", "locations_within", "(", "a", ",", "b", ",", "tolerance", ")", ":", "ret", "=", "''", "# Clone b so that we can destroy it.", "b", "=", "dict", "(", "b", ")", "for", "(", "key", ",", "value", ")", "in", "a", ".", "items", "(", ")", ":", "if", ...
Verifies whether two positions are the same. A tolerance value determines how close the two positions must be to be considered "same". The two locations must be dictionaries that have the same keys. If a key is pesent in one but not in the other, this is an error. The values must be integers or any...
[ "Verifies", "whether", "two", "positions", "are", "the", "same", ".", "A", "tolerance", "value", "determines", "how", "close", "the", "two", "positions", "must", "be", "to", "be", "considered", "same", "." ]
python
train
GaretJax/lancet
lancet/commands/workflow.py
https://github.com/GaretJax/lancet/blob/cf438c5c6166b18ee0dc5ffce55220793019bb95/lancet/commands/workflow.py#L158-L179
def pause(ctx): """ Pause work on the current issue. This command puts the issue in the configured paused status and stops the current Harvest timer. """ lancet = ctx.obj paused_status = lancet.config.get("tracker", "paused_status") # Get the issue issue = get_issue(lancet) # ...
[ "def", "pause", "(", "ctx", ")", ":", "lancet", "=", "ctx", ".", "obj", "paused_status", "=", "lancet", ".", "config", ".", "get", "(", "\"tracker\"", ",", "\"paused_status\"", ")", "# Get the issue", "issue", "=", "get_issue", "(", "lancet", ")", "# Make ...
Pause work on the current issue. This command puts the issue in the configured paused status and stops the current Harvest timer.
[ "Pause", "work", "on", "the", "current", "issue", "." ]
python
train
scanny/python-pptx
pptx/shapes/shapetree.py
https://github.com/scanny/python-pptx/blob/d6ab8234f8b03953d2f831ff9394b1852db34130/pptx/shapes/shapetree.py#L867-L873
def _pic(self): """Return the new `p:pic` element referencing the video.""" return CT_Picture.new_video_pic( self._shape_id, self._shape_name, self._video_rId, self._media_rId, self._poster_frame_rId, self._x, self._y, self._cx, self._cy )
[ "def", "_pic", "(", "self", ")", ":", "return", "CT_Picture", ".", "new_video_pic", "(", "self", ".", "_shape_id", ",", "self", ".", "_shape_name", ",", "self", ".", "_video_rId", ",", "self", ".", "_media_rId", ",", "self", ".", "_poster_frame_rId", ",", ...
Return the new `p:pic` element referencing the video.
[ "Return", "the", "new", "p", ":", "pic", "element", "referencing", "the", "video", "." ]
python
train
opencobra/cobrapy
cobra/io/json.py
https://github.com/opencobra/cobrapy/blob/9d1987cdb3a395cf4125a3439c3b002ff2be2009/cobra/io/json.py#L69-L112
def save_json_model(model, filename, sort=False, pretty=False, **kwargs): """ Write the cobra model to a file in JSON format. ``kwargs`` are passed on to ``json.dump``. Parameters ---------- model : cobra.Model The cobra model to represent. filename : str or file-like File ...
[ "def", "save_json_model", "(", "model", ",", "filename", ",", "sort", "=", "False", ",", "pretty", "=", "False", ",", "*", "*", "kwargs", ")", ":", "obj", "=", "model_to_dict", "(", "model", ",", "sort", "=", "sort", ")", "obj", "[", "u\"version\"", ...
Write the cobra model to a file in JSON format. ``kwargs`` are passed on to ``json.dump``. Parameters ---------- model : cobra.Model The cobra model to represent. filename : str or file-like File path or descriptor that the JSON representation should be written to. sort...
[ "Write", "the", "cobra", "model", "to", "a", "file", "in", "JSON", "format", "." ]
python
valid
RLBot/RLBot
src/main/python/rlbot/gui/qt_root.py
https://github.com/RLBot/RLBot/blob/3f9b6bec8b9baf4dcfff0f6cf3103c8744ac6234/src/main/python/rlbot/gui/qt_root.py#L79-L95
def fixed_indices(self): """ Agents in the GUI might not have following overall indices, thereby a file saved through the GUI would cause other bots to start than the GUI when ran :return: CustomConfig instance, copy of the overall config which has the indices sorted out """ ...
[ "def", "fixed_indices", "(", "self", ")", ":", "config", "=", "self", ".", "overall_config", ".", "copy", "(", ")", "used_indices", "=", "sorted", "(", "self", ".", "index_manager", ".", "numbers", ")", "not_used_indices", "=", "[", "e", "for", "e", "in"...
Agents in the GUI might not have following overall indices, thereby a file saved through the GUI would cause other bots to start than the GUI when ran :return: CustomConfig instance, copy of the overall config which has the indices sorted out
[ "Agents", "in", "the", "GUI", "might", "not", "have", "following", "overall", "indices", "thereby", "a", "file", "saved", "through", "the", "GUI", "would", "cause", "other", "bots", "to", "start", "than", "the", "GUI", "when", "ran", ":", "return", ":", ...
python
train
saltstack/salt
salt/modules/boto_iam.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iam.py#L567-L593
def delete_group_policy(group_name, policy_name, region=None, key=None, keyid=None, profile=None): ''' Delete a group policy. CLI Example:: .. code-block:: bash salt myminion boto_iam.delete_group_policy mygroup mypolicy ''' conn = _get_conn(region=region, key=...
[ "def", "delete_group_policy", "(", "group_name", ",", "policy_name", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "conn", "=", "_get_conn", "(", "region", "=", "region", ",", "ke...
Delete a group policy. CLI Example:: .. code-block:: bash salt myminion boto_iam.delete_group_policy mygroup mypolicy
[ "Delete", "a", "group", "policy", "." ]
python
train
OCA/openupgradelib
openupgradelib/openupgrade.py
https://github.com/OCA/openupgradelib/blob/b220b6498075d62c1b64073cc934513a465cfd85/openupgradelib/openupgrade.py#L836-L956
def set_defaults(cr, pool, default_spec, force=False, use_orm=False): """ Set default value. Useful for fields that are newly required. Uses orm, so call from the post script. :param pool: you can pass 'env' as well. :param default_spec: a hash with model names as keys. Values are lists \ of tu...
[ "def", "set_defaults", "(", "cr", ",", "pool", ",", "default_spec", ",", "force", "=", "False", ",", "use_orm", "=", "False", ")", ":", "def", "write_value", "(", "ids", ",", "field", ",", "value", ")", ":", "logger", ".", "debug", "(", "\"model %s, fi...
Set default value. Useful for fields that are newly required. Uses orm, so call from the post script. :param pool: you can pass 'env' as well. :param default_spec: a hash with model names as keys. Values are lists \ of tuples (field, value). None as a value has a special meaning: it \ assigns the d...
[ "Set", "default", "value", ".", "Useful", "for", "fields", "that", "are", "newly", "required", ".", "Uses", "orm", "so", "call", "from", "the", "post", "script", "." ]
python
train
PmagPy/PmagPy
dialogs/pmag_er_magic_dialogs.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/pmag_er_magic_dialogs.py#L577-L681
def InitSiteCheck(self): """make an interactive grid in which users can edit site names as well as which location a site belongs to""" self.panel = wx.Panel(self, style=wx.SIMPLE_BORDER) text = """Step 3: Check that all sites are correctly named, and that they belong to the correct loca...
[ "def", "InitSiteCheck", "(", "self", ")", ":", "self", ".", "panel", "=", "wx", ".", "Panel", "(", "self", ",", "style", "=", "wx", ".", "SIMPLE_BORDER", ")", "text", "=", "\"\"\"Step 3:\nCheck that all sites are correctly named, and that they belong to the correct lo...
make an interactive grid in which users can edit site names as well as which location a site belongs to
[ "make", "an", "interactive", "grid", "in", "which", "users", "can", "edit", "site", "names", "as", "well", "as", "which", "location", "a", "site", "belongs", "to" ]
python
train
kshlm/gant
gant/utils/docker_helper.py
https://github.com/kshlm/gant/blob/eabaa17ebfd31b1654ee1f27e7026f6d7b370609/gant/utils/docker_helper.py#L61-L71
def container_by_name(self, name): """ Returns container with given name """ if not name: return None # docker prepends a '/' to container names in the container dict name = '/'+name return next((container for container in self.containers(all=True) ...
[ "def", "container_by_name", "(", "self", ",", "name", ")", ":", "if", "not", "name", ":", "return", "None", "# docker prepends a '/' to container names in the container dict", "name", "=", "'/'", "+", "name", "return", "next", "(", "(", "container", "for", "contai...
Returns container with given name
[ "Returns", "container", "with", "given", "name" ]
python
train
notifiers/notifiers
notifiers/logging.py
https://github.com/notifiers/notifiers/blob/6dd8aafff86935dbb4763db9c56f9cdd7fc08b65/notifiers/logging.py#L41-L52
def emit(self, record): """ Override the :meth:`~logging.Handler.emit` method that takes the ``msg`` attribute from the log record passed :param record: :class:`logging.LogRecord` """ data = copy.deepcopy(self.defaults) data["message"] = self.format(record) try: ...
[ "def", "emit", "(", "self", ",", "record", ")", ":", "data", "=", "copy", ".", "deepcopy", "(", "self", ".", "defaults", ")", "data", "[", "\"message\"", "]", "=", "self", ".", "format", "(", "record", ")", "try", ":", "self", ".", "provider", ".",...
Override the :meth:`~logging.Handler.emit` method that takes the ``msg`` attribute from the log record passed :param record: :class:`logging.LogRecord`
[ "Override", "the", ":", "meth", ":", "~logging", ".", "Handler", ".", "emit", "method", "that", "takes", "the", "msg", "attribute", "from", "the", "log", "record", "passed" ]
python
train
brbsix/subnuker
subnuker.py
https://github.com/brbsix/subnuker/blob/a94260a6e84b790a9e39e0b1793443ffd4e1f496/subnuker.py#L283-L292
def renumber(self): """Re-number cells.""" num = 0 for cell in self.cells: cell_split = cell.splitlines() if len(cell_split) >= 2: num += 1 cell_split[0] = str(num) yield '\n'.join(cell_split)
[ "def", "renumber", "(", "self", ")", ":", "num", "=", "0", "for", "cell", "in", "self", ".", "cells", ":", "cell_split", "=", "cell", ".", "splitlines", "(", ")", "if", "len", "(", "cell_split", ")", ">=", "2", ":", "num", "+=", "1", "cell_split", ...
Re-number cells.
[ "Re", "-", "number", "cells", "." ]
python
train
briney/abutils
abutils/core/pair.py
https://github.com/briney/abutils/blob/944755fc7d28bfc7d4f1ffad94ca0bf9d74ec54b/abutils/core/pair.py#L305-L325
def fasta(self, key='vdj_nt', append_chain=True): ''' Returns the sequence pair as a fasta string. If the Pair object contains both heavy and light chain sequences, both will be returned as a single string. By default, the fasta string contains the 'vdj_nt' sequence for each chain. To c...
[ "def", "fasta", "(", "self", ",", "key", "=", "'vdj_nt'", ",", "append_chain", "=", "True", ")", ":", "fastas", "=", "[", "]", "for", "s", ",", "chain", "in", "[", "(", "self", ".", "heavy", ",", "'heavy'", ")", ",", "(", "self", ".", "light", ...
Returns the sequence pair as a fasta string. If the Pair object contains both heavy and light chain sequences, both will be returned as a single string. By default, the fasta string contains the 'vdj_nt' sequence for each chain. To change, use the <key> option to select an alternate sequence. ...
[ "Returns", "the", "sequence", "pair", "as", "a", "fasta", "string", ".", "If", "the", "Pair", "object", "contains", "both", "heavy", "and", "light", "chain", "sequences", "both", "will", "be", "returned", "as", "a", "single", "string", "." ]
python
train
proycon/clam
clam/common/parameters.py
https://github.com/proycon/clam/blob/09d15cfc26d7cbe0f5976cdd5424dc446d10dbf3/clam/common/parameters.py#L459-L487
def xml(self, indent = ""): """This methods renders an XML representation of this parameter, along with its selected value, and feedback on validation errors""" xml = indent + "<" + self.__class__.__name__ xml += ' id="'+self.id + '"' xml += ' name="'+xmlescape(self.name) + '"' ...
[ "def", "xml", "(", "self", ",", "indent", "=", "\"\"", ")", ":", "xml", "=", "indent", "+", "\"<\"", "+", "self", ".", "__class__", ".", "__name__", "xml", "+=", "' id=\"'", "+", "self", ".", "id", "+", "'\"'", "xml", "+=", "' name=\"'", "+", "xmle...
This methods renders an XML representation of this parameter, along with its selected value, and feedback on validation errors
[ "This", "methods", "renders", "an", "XML", "representation", "of", "this", "parameter", "along", "with", "its", "selected", "value", "and", "feedback", "on", "validation", "errors" ]
python
train
BerkeleyAutomation/autolab_core
autolab_core/csv_model.py
https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/csv_model.py#L117-L149
def insert(self, data): """Insert a row into the .csv file. Parameters ---------- data : :obj:`dict` A dictionary mapping keys (header strings) to values. Returns ------- int The UID for the new row. Raises ------ ...
[ "def", "insert", "(", "self", ",", "data", ")", ":", "row", "=", "{", "key", ":", "self", ".", "_default_entry", "for", "key", "in", "self", ".", "_headers", "}", "row", "[", "'_uid'", "]", "=", "self", ".", "_get_new_uid", "(", ")", "for", "key", ...
Insert a row into the .csv file. Parameters ---------- data : :obj:`dict` A dictionary mapping keys (header strings) to values. Returns ------- int The UID for the new row. Raises ------ Exception If the value...
[ "Insert", "a", "row", "into", "the", ".", "csv", "file", "." ]
python
train
crazy-canux/arguspy
scripts/check_mssql.py
https://github.com/crazy-canux/arguspy/blob/e9486b5df61978a990d56bf43de35f3a4cdefcc3/scripts/check_mssql.py#L475-L485
def main(): """Register your own mode and handle method here.""" plugin = Register() if plugin.args.option == 'sql': plugin.sql_handle() elif plugin.args.option == 'database-used': plugin.database_used_handle() elif plugin.args.option == 'databaselog-used': plugin.database_lo...
[ "def", "main", "(", ")", ":", "plugin", "=", "Register", "(", ")", "if", "plugin", ".", "args", ".", "option", "==", "'sql'", ":", "plugin", ".", "sql_handle", "(", ")", "elif", "plugin", ".", "args", ".", "option", "==", "'database-used'", ":", "plu...
Register your own mode and handle method here.
[ "Register", "your", "own", "mode", "and", "handle", "method", "here", "." ]
python
valid
googleapis/google-cloud-python
firestore/google/cloud/firestore_v1beta1/query.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/query.py#L165-L206
def select(self, field_paths): """Project documents matching query to a limited set of fields. See :meth:`~.firestore_v1beta1.client.Client.field_path` for more information on **field paths**. If the current query already has a projection set (i.e. has already called :meth:`~.f...
[ "def", "select", "(", "self", ",", "field_paths", ")", ":", "field_paths", "=", "list", "(", "field_paths", ")", "for", "field_path", "in", "field_paths", ":", "field_path_module", ".", "split_field_path", "(", "field_path", ")", "# raises", "new_projection", "=...
Project documents matching query to a limited set of fields. See :meth:`~.firestore_v1beta1.client.Client.field_path` for more information on **field paths**. If the current query already has a projection set (i.e. has already called :meth:`~.firestore_v1beta1.query.Query.select`), thi...
[ "Project", "documents", "matching", "query", "to", "a", "limited", "set", "of", "fields", "." ]
python
train
HewlettPackard/python-hpOneView
hpOneView/resources/fc_sans/san_managers.py
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/fc_sans/san_managers.py#L161-L173
def get_by_name(self, name): """ Gets a SAN Manager by name. Args: name: Name of the SAN Manager Returns: dict: SAN Manager. """ san_managers = self._client.get_all() result = [x for x in san_managers if x['name'] == name] return ...
[ "def", "get_by_name", "(", "self", ",", "name", ")", ":", "san_managers", "=", "self", ".", "_client", ".", "get_all", "(", ")", "result", "=", "[", "x", "for", "x", "in", "san_managers", "if", "x", "[", "'name'", "]", "==", "name", "]", "return", ...
Gets a SAN Manager by name. Args: name: Name of the SAN Manager Returns: dict: SAN Manager.
[ "Gets", "a", "SAN", "Manager", "by", "name", "." ]
python
train
vtkiorg/vtki
vtki/filters.py
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/filters.py#L897-L911
def triangulate(dataset): """ Returns an all triangle mesh. More complex polygons will be broken down into triangles. Returns ------- mesh : vtki.UnstructuredGrid Mesh containing only triangles. """ alg = vtk.vtkDataSetTriangleFilter() ...
[ "def", "triangulate", "(", "dataset", ")", ":", "alg", "=", "vtk", ".", "vtkDataSetTriangleFilter", "(", ")", "alg", ".", "SetInputData", "(", "dataset", ")", "alg", ".", "Update", "(", ")", "return", "_get_output", "(", "alg", ")" ]
Returns an all triangle mesh. More complex polygons will be broken down into triangles. Returns ------- mesh : vtki.UnstructuredGrid Mesh containing only triangles.
[ "Returns", "an", "all", "triangle", "mesh", ".", "More", "complex", "polygons", "will", "be", "broken", "down", "into", "triangles", "." ]
python
train
ioos/cc-plugin-ncei
cc_plugin_ncei/ncei_base.py
https://github.com/ioos/cc-plugin-ncei/blob/963fefd7fa43afd32657ac4c36aad4ddb4c25acf/cc_plugin_ncei/ncei_base.py#L92-L115
def _check_min_max_range(self, var, test_ctx): """ Checks that either both valid_min and valid_max exist, or valid_range exists. """ if 'valid_range' in var.ncattrs(): test_ctx.assert_true(var.valid_range.dtype == var.dtype and len(var...
[ "def", "_check_min_max_range", "(", "self", ",", "var", ",", "test_ctx", ")", ":", "if", "'valid_range'", "in", "var", ".", "ncattrs", "(", ")", ":", "test_ctx", ".", "assert_true", "(", "var", ".", "valid_range", ".", "dtype", "==", "var", ".", "dtype",...
Checks that either both valid_min and valid_max exist, or valid_range exists.
[ "Checks", "that", "either", "both", "valid_min", "and", "valid_max", "exist", "or", "valid_range", "exists", "." ]
python
train
abilian/abilian-core
abilian/i18n.py
https://github.com/abilian/abilian-core/blob/0a71275bf108c3d51e13ca9e093c0249235351e3/abilian/i18n.py#L323-L343
def get_template_i18n(template_name, locale): """Build template list with preceding locale if found.""" if locale is None: return [template_name] template_list = [] parts = template_name.rsplit(".", 1) root = parts[0] suffix = parts[1] if locale.territory is not None: local...
[ "def", "get_template_i18n", "(", "template_name", ",", "locale", ")", ":", "if", "locale", "is", "None", ":", "return", "[", "template_name", "]", "template_list", "=", "[", "]", "parts", "=", "template_name", ".", "rsplit", "(", "\".\"", ",", "1", ")", ...
Build template list with preceding locale if found.
[ "Build", "template", "list", "with", "preceding", "locale", "if", "found", "." ]
python
train
edx/XBlock
xblock/core.py
https://github.com/edx/XBlock/blob/368bf46e2c0ee69bbb21817f428c4684936e18ee/xblock/core.py#L157-L174
def load_tagged_classes(cls, tag, fail_silently=True): """ Produce a sequence of all XBlock classes tagged with `tag`. fail_silently causes the code to simply log warnings if a plugin cannot import. The goal is to be able to use part of libraries from an XBlock (and thus have it...
[ "def", "load_tagged_classes", "(", "cls", ",", "tag", ",", "fail_silently", "=", "True", ")", ":", "# Allow this method to access the `_class_tags`", "# pylint: disable=W0212", "for", "name", ",", "class_", "in", "cls", ".", "load_classes", "(", "fail_silently", ")", ...
Produce a sequence of all XBlock classes tagged with `tag`. fail_silently causes the code to simply log warnings if a plugin cannot import. The goal is to be able to use part of libraries from an XBlock (and thus have it installed), even if the overall XBlock cannot be used (e.g. depend...
[ "Produce", "a", "sequence", "of", "all", "XBlock", "classes", "tagged", "with", "tag", "." ]
python
train
pudo/jsongraph
jsongraph/context.py
https://github.com/pudo/jsongraph/blob/35e4f397dbe69cd5553cf9cb9ab98859c3620f03/jsongraph/context.py#L29-L36
def add(self, schema, data): """ Stage ``data`` as a set of statements, based on the given ``schema`` definition. """ binding = self.get_binding(schema, data) uri, triples = triplify(binding) for triple in triples: self.graph.add(triple) return uri
[ "def", "add", "(", "self", ",", "schema", ",", "data", ")", ":", "binding", "=", "self", ".", "get_binding", "(", "schema", ",", "data", ")", "uri", ",", "triples", "=", "triplify", "(", "binding", ")", "for", "triple", "in", "triples", ":", "self", ...
Stage ``data`` as a set of statements, based on the given ``schema`` definition.
[ "Stage", "data", "as", "a", "set", "of", "statements", "based", "on", "the", "given", "schema", "definition", "." ]
python
train
thespacedoctor/astrocalc
astrocalc/coords/unit_conversion.py
https://github.com/thespacedoctor/astrocalc/blob/dfbebf9b86d7b2d2110c48a6a4f4194bf8885b86/astrocalc/coords/unit_conversion.py#L451-L503
def ra_dec_to_cartesian( self, ra, dec): """*Convert an RA, DEC coordinate set to x, y, z cartesian coordinates* **Key Arguments:** - ``ra`` -- right ascension in sexegesimal or decimal degress. - ``dec`` -- declination in sexegesimal or decim...
[ "def", "ra_dec_to_cartesian", "(", "self", ",", "ra", ",", "dec", ")", ":", "self", ".", "log", ".", "info", "(", "'starting the ``ra_dec_to_cartesian`` method'", ")", "ra", "=", "self", ".", "ra_sexegesimal_to_decimal", "(", "ra", "=", "ra", ")", "dec", "="...
*Convert an RA, DEC coordinate set to x, y, z cartesian coordinates* **Key Arguments:** - ``ra`` -- right ascension in sexegesimal or decimal degress. - ``dec`` -- declination in sexegesimal or decimal degress. **Return:** - ``cartesians`` -- tuple of (x, y, z) coor...
[ "*", "Convert", "an", "RA", "DEC", "coordinate", "set", "to", "x", "y", "z", "cartesian", "coordinates", "*" ]
python
train
JensRantil/rewind
rewind/server/eventstores.py
https://github.com/JensRantil/rewind/blob/7f645d20186c1db55cfe53a0310c9fd6292f91ea/rewind/server/eventstores.py#L803-L823
def _find_batch_containing_event(self, uuid): """Find the batch number that contains a certain event. Parameters: uuid -- the event uuid to search for. returns -- a batch number, or None if not found. """ if self.estore.key_exists(uuid): # Reusing alread...
[ "def", "_find_batch_containing_event", "(", "self", ",", "uuid", ")", ":", "if", "self", ".", "estore", ".", "key_exists", "(", "uuid", ")", ":", "# Reusing already opened DB if possible", "return", "self", ".", "batchno", "else", ":", "for", "batchno", "in", ...
Find the batch number that contains a certain event. Parameters: uuid -- the event uuid to search for. returns -- a batch number, or None if not found.
[ "Find", "the", "batch", "number", "that", "contains", "a", "certain", "event", "." ]
python
train
digmore/pypushed
pushed/pushed.py
https://github.com/digmore/pypushed/blob/4240fc27323b89d59f0c652dcea4b65f78437c5b/pushed/pushed.py#L24-L35
def push_app(self, content, content_url=None): '''Push a notification to a Pushed application. Param: content -> content of Pushed notification message content_url (optional) -> enrich message with URL Returns Shipment ID as string ''' parameters = { '...
[ "def", "push_app", "(", "self", ",", "content", ",", "content_url", "=", "None", ")", ":", "parameters", "=", "{", "'app_key'", ":", "self", ".", "app_key", ",", "'app_secret'", ":", "self", ".", "app_secret", "}", "return", "self", ".", "_push", "(", ...
Push a notification to a Pushed application. Param: content -> content of Pushed notification message content_url (optional) -> enrich message with URL Returns Shipment ID as string
[ "Push", "a", "notification", "to", "a", "Pushed", "application", "." ]
python
train
mrstephenneal/mysql-toolkit
mysql/toolkit/components/connector.py
https://github.com/mrstephenneal/mysql-toolkit/blob/6964f718f4b72eb30f2259adfcfaf3090526c53d/mysql/toolkit/components/connector.py#L74-L87
def _connect(self, config): """Establish a connection with a MySQL database.""" if 'connection_timeout' not in self._config: self._config['connection_timeout'] = 480 try: self._cnx = connect(**config) self._cursor = self._cnx.cursor() self._printer...
[ "def", "_connect", "(", "self", ",", "config", ")", ":", "if", "'connection_timeout'", "not", "in", "self", ".", "_config", ":", "self", ".", "_config", "[", "'connection_timeout'", "]", "=", "480", "try", ":", "self", ".", "_cnx", "=", "connect", "(", ...
Establish a connection with a MySQL database.
[ "Establish", "a", "connection", "with", "a", "MySQL", "database", "." ]
python
train
pantsbuild/pants
src/python/pants/backend/jvm/tasks/run_jvm_prep_command.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/backend/jvm/tasks/run_jvm_prep_command.py#L50-L57
def prepare(cls, options, round_manager): """ :API: public """ super(RunJvmPrepCommandBase, cls).prepare(options, round_manager) round_manager.require_data('compile_classpath') if not cls.classpath_product_only: round_manager.require_data('runtime_classpath')
[ "def", "prepare", "(", "cls", ",", "options", ",", "round_manager", ")", ":", "super", "(", "RunJvmPrepCommandBase", ",", "cls", ")", ".", "prepare", "(", "options", ",", "round_manager", ")", "round_manager", ".", "require_data", "(", "'compile_classpath'", "...
:API: public
[ ":", "API", ":", "public" ]
python
train
senaite/senaite.core
bika/lims/browser/publish/emailview.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/browser/publish/emailview.py#L91-L97
def fail(self, message, status=500, **kw): """Set a JSON error object and a status to the response """ self.request.response.setStatus(status) result = {"success": False, "errors": message, "status": status} result.update(kw) return result
[ "def", "fail", "(", "self", ",", "message", ",", "status", "=", "500", ",", "*", "*", "kw", ")", ":", "self", ".", "request", ".", "response", ".", "setStatus", "(", "status", ")", "result", "=", "{", "\"success\"", ":", "False", ",", "\"errors\"", ...
Set a JSON error object and a status to the response
[ "Set", "a", "JSON", "error", "object", "and", "a", "status", "to", "the", "response" ]
python
train
nicodv/kmodes
kmodes/kmodes.py
https://github.com/nicodv/kmodes/blob/cdb19fe5448aba1bf501626694bb52e68eafab45/kmodes/kmodes.py#L21-L50
def init_huang(X, n_clusters, dissim, random_state): """Initialize centroids according to method by Huang [1997].""" n_attrs = X.shape[1] centroids = np.empty((n_clusters, n_attrs), dtype='object') # determine frequencies of attributes for iattr in range(n_attrs): freq = defaultdict(int) ...
[ "def", "init_huang", "(", "X", ",", "n_clusters", ",", "dissim", ",", "random_state", ")", ":", "n_attrs", "=", "X", ".", "shape", "[", "1", "]", "centroids", "=", "np", ".", "empty", "(", "(", "n_clusters", ",", "n_attrs", ")", ",", "dtype", "=", ...
Initialize centroids according to method by Huang [1997].
[ "Initialize", "centroids", "according", "to", "method", "by", "Huang", "[", "1997", "]", "." ]
python
train
django-danceschool/django-danceschool
danceschool/financial/helpers.py
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/helpers.py#L280-L508
def createExpenseItemsForEvents(request=None, datetimeTuple=None, rule=None, event=None): ''' For each StaffMember-related Repeated Expense Rule, look for EventStaffMember instances in the designated time window that do not already have expenses associated with them. For hourly rental expenses, the...
[ "def", "createExpenseItemsForEvents", "(", "request", "=", "None", ",", "datetimeTuple", "=", "None", ",", "rule", "=", "None", ",", "event", "=", "None", ")", ":", "# This is used repeatedly, so it is put at the top\r", "submissionUser", "=", "getattr", "(", "reque...
For each StaffMember-related Repeated Expense Rule, look for EventStaffMember instances in the designated time window that do not already have expenses associated with them. For hourly rental expenses, then generate new expenses that are associated with this rule. For non-hourly expenses, generate new ...
[ "For", "each", "StaffMember", "-", "related", "Repeated", "Expense", "Rule", "look", "for", "EventStaffMember", "instances", "in", "the", "designated", "time", "window", "that", "do", "not", "already", "have", "expenses", "associated", "with", "them", ".", "For"...
python
train
stevelittlefish/littlefish
littlefish/viewutil.py
https://github.com/stevelittlefish/littlefish/blob/6deee7f81fab30716c743efe2e94e786c6e17016/littlefish/viewutil.py#L15-L63
def internal_error(exception, template_path, is_admin, db=None): """ Render an "internal error" page. The following variables will be populated when rendering the template: title: The page title message: The body of the error message to display to the user preformat: Boolean stating whethe...
[ "def", "internal_error", "(", "exception", ",", "template_path", ",", "is_admin", ",", "db", "=", "None", ")", ":", "if", "db", ":", "try", ":", "db", ".", "session", ".", "rollback", "(", ")", "except", ":", "# noqa: E722", "pass", "title", "=", "str"...
Render an "internal error" page. The following variables will be populated when rendering the template: title: The page title message: The body of the error message to display to the user preformat: Boolean stating whether to wrap the error message in a pre As well as rendering the error mess...
[ "Render", "an", "internal", "error", "page", ".", "The", "following", "variables", "will", "be", "populated", "when", "rendering", "the", "template", ":", "title", ":", "The", "page", "title", "message", ":", "The", "body", "of", "the", "error", "message", ...
python
test
ellethee/argparseinator
argparseinator/utils.py
https://github.com/ellethee/argparseinator/blob/05e9c00dfaa938b9c4ee2aadc6206f5e0918e24e/argparseinator/utils.py#L228-L247
def get_shared(func): """ return shared. """ shared = [] if not hasattr(func, '__cls__'): return shared if not hasattr(func.__cls__, '__shared_arguments__'): return shared if hasattr(func, '__no_share__'): if func.__no_share__ is True: return shared ...
[ "def", "get_shared", "(", "func", ")", ":", "shared", "=", "[", "]", "if", "not", "hasattr", "(", "func", ",", "'__cls__'", ")", ":", "return", "shared", "if", "not", "hasattr", "(", "func", ".", "__cls__", ",", "'__shared_arguments__'", ")", ":", "ret...
return shared.
[ "return", "shared", "." ]
python
train
echonest/pyechonest
pyechonest/catalog.py
https://github.com/echonest/pyechonest/blob/d8c7af6c1da699b50b2f4b1bd3c0febe72e7f1ee/pyechonest/catalog.py#L293-L331
def get_feed(self, buckets=None, since=None, results=15, start=0): """ Returns feed (news, blogs, reviews, audio, video) for the catalog artists; response depends on requested buckets Args: Kwargs: buckets (list): A list of strings specifying which feed items to retrieve ...
[ "def", "get_feed", "(", "self", ",", "buckets", "=", "None", ",", "since", "=", "None", ",", "results", "=", "15", ",", "start", "=", "0", ")", ":", "kwargs", "=", "{", "}", "kwargs", "[", "'bucket'", "]", "=", "buckets", "or", "[", "]", "if", ...
Returns feed (news, blogs, reviews, audio, video) for the catalog artists; response depends on requested buckets Args: Kwargs: buckets (list): A list of strings specifying which feed items to retrieve results (int): An integer number of results to return start (in...
[ "Returns", "feed", "(", "news", "blogs", "reviews", "audio", "video", ")", "for", "the", "catalog", "artists", ";", "response", "depends", "on", "requested", "buckets" ]
python
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py#L223-L242
def from_mapping(cls, x0, x1): """ Create an STTransform from the given mapping See `set_mapping` for details. Parameters ---------- x0 : array-like Start. x1 : array-like End. Returns ------- t : instance of STTransform ...
[ "def", "from_mapping", "(", "cls", ",", "x0", ",", "x1", ")", ":", "t", "=", "cls", "(", ")", "t", ".", "set_mapping", "(", "x0", ",", "x1", ")", "return", "t" ]
Create an STTransform from the given mapping See `set_mapping` for details. Parameters ---------- x0 : array-like Start. x1 : array-like End. Returns ------- t : instance of STTransform The transform.
[ "Create", "an", "STTransform", "from", "the", "given", "mapping" ]
python
train
stephrdev/django-formwizard
formwizard/views.py
https://github.com/stephrdev/django-formwizard/blob/7b35165f0340aae4e8302d5b05b0cb443f6c9904/formwizard/views.py#L463-L475
def get_next_step(self, step=None): """ Returns the next step after the given `step`. If no more steps are available, None will be returned. If the `step` argument is None, the current step will be determined automatically. """ if step is None: step = self.ste...
[ "def", "get_next_step", "(", "self", ",", "step", "=", "None", ")", ":", "if", "step", "is", "None", ":", "step", "=", "self", ".", "steps", ".", "current", "form_list", "=", "self", ".", "get_form_list", "(", ")", "key", "=", "form_list", ".", "keyO...
Returns the next step after the given `step`. If no more steps are available, None will be returned. If the `step` argument is None, the current step will be determined automatically.
[ "Returns", "the", "next", "step", "after", "the", "given", "step", ".", "If", "no", "more", "steps", "are", "available", "None", "will", "be", "returned", ".", "If", "the", "step", "argument", "is", "None", "the", "current", "step", "will", "be", "determ...
python
train
quodlibet/mutagen
mutagen/easymp4.py
https://github.com/quodlibet/mutagen/blob/e393df5971ba41ba5a50de9c2c9e7e5484d82c4e/mutagen/easymp4.py#L83-L101
def RegisterTextKey(cls, key, atomid): """Register a text key. If the key you need to register is a simple one-to-one mapping of MP4 atom name to EasyMP4Tags key, then you can use this function:: EasyMP4Tags.RegisterTextKey("artist", "\xa9ART") """ def gette...
[ "def", "RegisterTextKey", "(", "cls", ",", "key", ",", "atomid", ")", ":", "def", "getter", "(", "tags", ",", "key", ")", ":", "return", "tags", "[", "atomid", "]", "def", "setter", "(", "tags", ",", "key", ",", "value", ")", ":", "tags", "[", "a...
Register a text key. If the key you need to register is a simple one-to-one mapping of MP4 atom name to EasyMP4Tags key, then you can use this function:: EasyMP4Tags.RegisterTextKey("artist", "\xa9ART")
[ "Register", "a", "text", "key", "." ]
python
train
saltstack/salt
salt/key.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/key.py#L314-L325
def _check_minions_directories(self): ''' Return the minion keys directory paths ''' minions_accepted = os.path.join(self.opts['pki_dir'], self.ACC) minions_pre = os.path.join(self.opts['pki_dir'], self.PEND) minions_rejected = os.path.join(self.opts['pki_dir'], ...
[ "def", "_check_minions_directories", "(", "self", ")", ":", "minions_accepted", "=", "os", ".", "path", ".", "join", "(", "self", ".", "opts", "[", "'pki_dir'", "]", ",", "self", ".", "ACC", ")", "minions_pre", "=", "os", ".", "path", ".", "join", "(",...
Return the minion keys directory paths
[ "Return", "the", "minion", "keys", "directory", "paths" ]
python
train
rq/rq-scheduler
rq_scheduler/scheduler.py
https://github.com/rq/rq-scheduler/blob/ee60c19e42a46ba787f762733a0036aa0cf2f7b7/rq_scheduler/scheduler.py#L60-L66
def register_death(self): """Registers its own death.""" self.log.info('Registering death') with self.connection.pipeline() as p: p.hset(self.scheduler_key, 'death', time.time()) p.expire(self.scheduler_key, 60) p.execute()
[ "def", "register_death", "(", "self", ")", ":", "self", ".", "log", ".", "info", "(", "'Registering death'", ")", "with", "self", ".", "connection", ".", "pipeline", "(", ")", "as", "p", ":", "p", ".", "hset", "(", "self", ".", "scheduler_key", ",", ...
Registers its own death.
[ "Registers", "its", "own", "death", "." ]
python
train
draperjames/qtpandas
qtpandas/views/BigIntSpinbox.py
https://github.com/draperjames/qtpandas/blob/64294fb69f1839e53dee5ea453337266bfaf24f4/qtpandas/views/BigIntSpinbox.py#L57-L72
def setValue(self, value): """setter function to _lineEdit.text. Sets minimum/maximum as new value if value is out of bounds. Args: value (int/long): new value to set. Returns True if all went fine. """ if value >= self.minimum() and value <= self.maxim...
[ "def", "setValue", "(", "self", ",", "value", ")", ":", "if", "value", ">=", "self", ".", "minimum", "(", ")", "and", "value", "<=", "self", ".", "maximum", "(", ")", ":", "self", ".", "_lineEdit", ".", "setText", "(", "str", "(", "value", ")", "...
setter function to _lineEdit.text. Sets minimum/maximum as new value if value is out of bounds. Args: value (int/long): new value to set. Returns True if all went fine.
[ "setter", "function", "to", "_lineEdit", ".", "text", ".", "Sets", "minimum", "/", "maximum", "as", "new", "value", "if", "value", "is", "out", "of", "bounds", "." ]
python
train
click-contrib/click-configfile
tasks/clean.py
https://github.com/click-contrib/click-configfile/blob/a616204cb9944125fd5051556f27a7ccef611e22/tasks/clean.py#L191-L205
def path_glob(pattern, current_dir=None): """Use pathlib for ant-like patterns, like: "**/*.py" :param pattern: File/directory pattern to use (as string). :param current_dir: Current working directory (as Path, pathlib.Path, str) :return Resolved Path (as path.Path). """ if not current_di...
[ "def", "path_glob", "(", "pattern", ",", "current_dir", "=", "None", ")", ":", "if", "not", "current_dir", ":", "current_dir", "=", "pathlib", ".", "Path", ".", "cwd", "(", ")", "elif", "not", "isinstance", "(", "current_dir", ",", "pathlib", ".", "Path"...
Use pathlib for ant-like patterns, like: "**/*.py" :param pattern: File/directory pattern to use (as string). :param current_dir: Current working directory (as Path, pathlib.Path, str) :return Resolved Path (as path.Path).
[ "Use", "pathlib", "for", "ant", "-", "like", "patterns", "like", ":", "**", "/", "*", ".", "py" ]
python
train
seb-m/tss
tss.py
https://github.com/seb-m/tss/blob/ab45176b8585ba6bbbcaeffd21ec0c63f615dce0/tss.py#L253-L307
def reconstruct_secret(shares, strict_mode=True): """ shares must be a container with a sufficient number of well-formatted shares used to reconstruct the secret value. If any share format is invalid a TSSError exception is raised. If strict_mode is False all combinations of shares are tried in orde...
[ "def", "reconstruct_secret", "(", "shares", ",", "strict_mode", "=", "True", ")", ":", "ref_header", "=", "None", "data_shares", "=", "[", "]", "for", "share", "in", "shares", ":", "share", "=", "encode", "(", "share", ")", "if", "len", "(", "share", "...
shares must be a container with a sufficient number of well-formatted shares used to reconstruct the secret value. If any share format is invalid a TSSError exception is raised. If strict_mode is False all combinations of shares are tried in order to reconstruct the secret. Otherwise this function raise...
[ "shares", "must", "be", "a", "container", "with", "a", "sufficient", "number", "of", "well", "-", "formatted", "shares", "used", "to", "reconstruct", "the", "secret", "value", ".", "If", "any", "share", "format", "is", "invalid", "a", "TSSError", "exception"...
python
train
paramiko/paramiko
paramiko/sftp_handle.py
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_handle.py#L180-L187
def _get_next_files(self): """ Used by the SFTP server code to retrieve a cached directory listing. """ fnlist = self.__files[:16] self.__files = self.__files[16:] return fnlist
[ "def", "_get_next_files", "(", "self", ")", ":", "fnlist", "=", "self", ".", "__files", "[", ":", "16", "]", "self", ".", "__files", "=", "self", ".", "__files", "[", "16", ":", "]", "return", "fnlist" ]
Used by the SFTP server code to retrieve a cached directory listing.
[ "Used", "by", "the", "SFTP", "server", "code", "to", "retrieve", "a", "cached", "directory", "listing", "." ]
python
train
salu133445/pypianoroll
pypianoroll/utilities.py
https://github.com/salu133445/pypianoroll/blob/6224dc1e29222de2124d249acb80f3d072166917/pypianoroll/utilities.py#L154-L167
def parse(filepath, beat_resolution=24, name='unknown'): """ Return a :class:`pypianoroll.Multitrack` object loaded from a MIDI (.mid, .midi, .MID, .MIDI) file. Parameters ---------- filepath : str The file path to the MIDI file. """ if not filepath.endswith(('.mid', '.midi', '...
[ "def", "parse", "(", "filepath", ",", "beat_resolution", "=", "24", ",", "name", "=", "'unknown'", ")", ":", "if", "not", "filepath", ".", "endswith", "(", "(", "'.mid'", ",", "'.midi'", ",", "'.MID'", ",", "'.MIDI'", ")", ")", ":", "raise", "ValueErro...
Return a :class:`pypianoroll.Multitrack` object loaded from a MIDI (.mid, .midi, .MID, .MIDI) file. Parameters ---------- filepath : str The file path to the MIDI file.
[ "Return", "a", ":", "class", ":", "pypianoroll", ".", "Multitrack", "object", "loaded", "from", "a", "MIDI", "(", ".", "mid", ".", "midi", ".", "MID", ".", "MIDI", ")", "file", "." ]
python
train
shichao-an/twitter-photos
twphotos/photos.py
https://github.com/shichao-an/twitter-photos/blob/32de6e8805edcbb431d08af861e9d2f0ab221106/twphotos/photos.py#L62-L84
def get(self, count=None, since_id=None, silent=False): """ Get all photos from the user or members of the list :param count: Number of tweets to try and retrieve. If None, return all photos since `since_id` :param since_id: An integer specifying the oldest tweet id "...
[ "def", "get", "(", "self", ",", "count", "=", "None", ",", "since_id", "=", "None", ",", "silent", "=", "False", ")", ":", "if", "not", "silent", ":", "print", "(", "'Retrieving photos from Twitter API...'", ")", "self", ".", "auth_user", "=", "self", "....
Get all photos from the user or members of the list :param count: Number of tweets to try and retrieve. If None, return all photos since `since_id` :param since_id: An integer specifying the oldest tweet id
[ "Get", "all", "photos", "from", "the", "user", "or", "members", "of", "the", "list", ":", "param", "count", ":", "Number", "of", "tweets", "to", "try", "and", "retrieve", ".", "If", "None", "return", "all", "photos", "since", "since_id", ":", "param", ...
python
train
helium/helium-python
helium/resource.py
https://github.com/helium/helium-python/blob/db73480b143da4fc48e95c4414bd69c576a3a390/helium/resource.py#L445-L456
def delete(self): """Delete the resource. Returns: True if the delete is successful. Will throw an error if other errors occur """ session = self._session url = session._build_url(self._resource_path(), self.id) return session.delete(url, CB.boolean...
[ "def", "delete", "(", "self", ")", ":", "session", "=", "self", ".", "_session", "url", "=", "session", ".", "_build_url", "(", "self", ".", "_resource_path", "(", ")", ",", "self", ".", "id", ")", "return", "session", ".", "delete", "(", "url", ",",...
Delete the resource. Returns: True if the delete is successful. Will throw an error if other errors occur
[ "Delete", "the", "resource", "." ]
python
train
rembish/cfb
cfb/exceptions.py
https://github.com/rembish/cfb/blob/9bcd75caad4353b186ce518d2da78aeeb52d3131/cfb/exceptions.py#L48-L55
def raise_if(self, exception, message, *args, **kwargs): """ If current exception has smaller priority than minimum, subclass of this class only warns user, otherwise normal exception will be raised. """ if issubclass(exception, self.minimum_defect): raise exception(*...
[ "def", "raise_if", "(", "self", ",", "exception", ",", "message", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "issubclass", "(", "exception", ",", "self", ".", "minimum_defect", ")", ":", "raise", "exception", "(", "*", "args", ",", "*...
If current exception has smaller priority than minimum, subclass of this class only warns user, otherwise normal exception will be raised.
[ "If", "current", "exception", "has", "smaller", "priority", "than", "minimum", "subclass", "of", "this", "class", "only", "warns", "user", "otherwise", "normal", "exception", "will", "be", "raised", "." ]
python
train
novopl/peltak
src/peltak/logic/root.py
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/logic/root.py#L114-L128
def init(quick): # type: () -> None """ Create an empty pelconf.yaml from template """ config_file = 'pelconf.yaml' prompt = "-- <35>{} <32>already exists. Wipe it?<0>".format(config_file) if exists(config_file) and not click.confirm(shell.fmt(prompt)): log.info("Canceled") return ...
[ "def", "init", "(", "quick", ")", ":", "# type: () -> None", "config_file", "=", "'pelconf.yaml'", "prompt", "=", "\"-- <35>{} <32>already exists. Wipe it?<0>\"", ".", "format", "(", "config_file", ")", "if", "exists", "(", "config_file", ")", "and", "not", "click",...
Create an empty pelconf.yaml from template
[ "Create", "an", "empty", "pelconf", ".", "yaml", "from", "template" ]
python
train
saltstack/salt
salt/renderers/aws_kms.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/renderers/aws_kms.py#L162-L176
def _api_decrypt(): ''' Return the response dictionary from the KMS decrypt API call. ''' kms = _kms() data_key = _cfg_data_key() try: return kms.decrypt(CiphertextBlob=data_key) except botocore.exceptions.ClientError as orig_exc: error_code = orig_exc.response.get('Error', {...
[ "def", "_api_decrypt", "(", ")", ":", "kms", "=", "_kms", "(", ")", "data_key", "=", "_cfg_data_key", "(", ")", "try", ":", "return", "kms", ".", "decrypt", "(", "CiphertextBlob", "=", "data_key", ")", "except", "botocore", ".", "exceptions", ".", "Clien...
Return the response dictionary from the KMS decrypt API call.
[ "Return", "the", "response", "dictionary", "from", "the", "KMS", "decrypt", "API", "call", "." ]
python
train
StackStorm/pybind
pybind/nos/v6_0_2f/brocade_lag_rpc/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/nos/v6_0_2f/brocade_lag_rpc/__init__.py#L106-L131
def _set_get_port_channel_detail(self, v, load=False): """ Setter method for get_port_channel_detail, mapped from YANG variable /brocade_lag_rpc/get_port_channel_detail (rpc) If this variable is read-only (config: false) in the source YANG file, then _set_get_port_channel_detail is considered as a priva...
[ "def", "_set_get_port_channel_detail", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ...
Setter method for get_port_channel_detail, mapped from YANG variable /brocade_lag_rpc/get_port_channel_detail (rpc) If this variable is read-only (config: false) in the source YANG file, then _set_get_port_channel_detail is considered as a private method. Backends looking to populate this variable should ...
[ "Setter", "method", "for", "get_port_channel_detail", "mapped", "from", "YANG", "variable", "/", "brocade_lag_rpc", "/", "get_port_channel_detail", "(", "rpc", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "config", ":", "false", ")", "in", "t...
python
train
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_objc.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/generator/mavgen_objc.py#L14-L113
def generate_mavlink(directory, xml): '''generate MVMavlink header and implementation''' f = open(os.path.join(directory, "MVMavlink.h"), mode='w') t.write(f,''' // // MVMavlink.h // MAVLink communications protocol built from ${basename}.xml // // Created on ${parse_time} by mavgen_objc.py // http://qgr...
[ "def", "generate_mavlink", "(", "directory", ",", "xml", ")", ":", "f", "=", "open", "(", "os", ".", "path", ".", "join", "(", "directory", ",", "\"MVMavlink.h\"", ")", ",", "mode", "=", "'w'", ")", "t", ".", "write", "(", "f", ",", "'''\n//\n// MVM...
generate MVMavlink header and implementation
[ "generate", "MVMavlink", "header", "and", "implementation" ]
python
train
woolfson-group/isambard
isambard/ampal/protein.py
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/protein.py#L585-L684
def n_join(self, other, psi=-40.76, omega=-178.25, phi=-65.07, o_c_n_angle=None, c_n_ca_angle=None, c_n_length=None, relabel=True): """Joins other to self at the N-terminus via a peptide bond. Notes ----- This function directly modifies self. It does not return a new obje...
[ "def", "n_join", "(", "self", ",", "other", ",", "psi", "=", "-", "40.76", ",", "omega", "=", "-", "178.25", ",", "phi", "=", "-", "65.07", ",", "o_c_n_angle", "=", "None", ",", "c_n_ca_angle", "=", "None", ",", "c_n_length", "=", "None", ",", "rel...
Joins other to self at the N-terminus via a peptide bond. Notes ----- This function directly modifies self. It does not return a new object. Parameters ---------- other: Residue or Polypeptide psi: float Psi torsion angle (degrees) between final `Res...
[ "Joins", "other", "to", "self", "at", "the", "N", "-", "terminus", "via", "a", "peptide", "bond", "." ]
python
train
AtteqCom/zsl
src/zsl/utils/deploy/js_model_generator.py
https://github.com/AtteqCom/zsl/blob/ab51a96da1780ff642912396d4b85bdcb72560c1/src/zsl/utils/deploy/js_model_generator.py#L56-L70
def _map_table_name(self, model_names): """ Pre foregin_keys potrbejeme pre z nazvu tabulky zistit class, tak si to namapujme """ for model in model_names: if isinstance(model, tuple): model = model[0] try: model_cls = get...
[ "def", "_map_table_name", "(", "self", ",", "model_names", ")", ":", "for", "model", "in", "model_names", ":", "if", "isinstance", "(", "model", ",", "tuple", ")", ":", "model", "=", "model", "[", "0", "]", "try", ":", "model_cls", "=", "getattr", "(",...
Pre foregin_keys potrbejeme pre z nazvu tabulky zistit class, tak si to namapujme
[ "Pre", "foregin_keys", "potrbejeme", "pre", "z", "nazvu", "tabulky", "zistit", "class", "tak", "si", "to", "namapujme" ]
python
train
Erotemic/utool
utool/util_sysreq.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_sysreq.py#L85-L104
def get_local_dist_packages_dir(): """ Attempts to work around virtualenvs and find the system dist_pacakges. Essentially this is implmenented as a lookuptable """ import utool as ut if not ut.in_virtual_env(): # Non venv case return get_site_packages_dir() else: cand...
[ "def", "get_local_dist_packages_dir", "(", ")", ":", "import", "utool", "as", "ut", "if", "not", "ut", ".", "in_virtual_env", "(", ")", ":", "# Non venv case", "return", "get_site_packages_dir", "(", ")", "else", ":", "candidates", "=", "[", "]", "if", "ut",...
Attempts to work around virtualenvs and find the system dist_pacakges. Essentially this is implmenented as a lookuptable
[ "Attempts", "to", "work", "around", "virtualenvs", "and", "find", "the", "system", "dist_pacakges", ".", "Essentially", "this", "is", "implmenented", "as", "a", "lookuptable" ]
python
train
thejunglejane/datums
datums/models/base.py
https://github.com/thejunglejane/datums/blob/2250b365e37ba952c2426edc615c1487afabae6e/datums/models/base.py#L161-L172
def update(self, response, **kwargs): ''' If a record matching the instance already exists in the database, update both the column and venue column attributes, else create a new record. ''' response_cls = super( LocationResponseClassLegacyAccessor, self)._get_instance...
[ "def", "update", "(", "self", ",", "response", ",", "*", "*", "kwargs", ")", ":", "response_cls", "=", "super", "(", "LocationResponseClassLegacyAccessor", ",", "self", ")", ".", "_get_instance", "(", "*", "*", "kwargs", ")", "if", "response_cls", ":", "se...
If a record matching the instance already exists in the database, update both the column and venue column attributes, else create a new record.
[ "If", "a", "record", "matching", "the", "instance", "already", "exists", "in", "the", "database", "update", "both", "the", "column", "and", "venue", "column", "attributes", "else", "create", "a", "new", "record", "." ]
python
train
dbtsai/python-mimeparse
mimeparse.py
https://github.com/dbtsai/python-mimeparse/blob/cf605c0994149b1a1936b3a8a597203fe3fbb62e/mimeparse.py#L42-L66
def parse_media_range(range): """Parse a media-range into its component parts. Carves up a media range and returns a tuple of the (type, subtype, params) where 'params' is a dictionary of all the parameters for the media range. For example, the media range 'application/*;q=0.5' would get parsed in...
[ "def", "parse_media_range", "(", "range", ")", ":", "(", "type", ",", "subtype", ",", "params", ")", "=", "parse_mime_type", "(", "range", ")", "params", ".", "setdefault", "(", "'q'", ",", "params", ".", "pop", "(", "'Q'", ",", "None", ")", ")", "# ...
Parse a media-range into its component parts. Carves up a media range and returns a tuple of the (type, subtype, params) where 'params' is a dictionary of all the parameters for the media range. For example, the media range 'application/*;q=0.5' would get parsed into: ('application', '*', {'q'...
[ "Parse", "a", "media", "-", "range", "into", "its", "component", "parts", "." ]
python
train
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fabric_setup_base.py#L938-L944
def _update_partition_srvc_node_ip(self, tenant_name, srvc_ip, vrf_prof=None, part_name=None): """Function to update srvc_node address of partition. """ self.dcnm_obj.update_project(tenant_name, part_name, service_node_ip=srvc_i...
[ "def", "_update_partition_srvc_node_ip", "(", "self", ",", "tenant_name", ",", "srvc_ip", ",", "vrf_prof", "=", "None", ",", "part_name", "=", "None", ")", ":", "self", ".", "dcnm_obj", ".", "update_project", "(", "tenant_name", ",", "part_name", ",", "service...
Function to update srvc_node address of partition.
[ "Function", "to", "update", "srvc_node", "address", "of", "partition", "." ]
python
train
great-expectations/great_expectations
great_expectations/dataset/sqlalchemy_dataset.py
https://github.com/great-expectations/great_expectations/blob/08385c40529d4f14a1c46916788aecc47f33ee9d/great_expectations/dataset/sqlalchemy_dataset.py#L30-L160
def column_map_expectation(cls, func): """For SqlAlchemy, this decorator allows individual column_map_expectations to simply return the filter that describes the expected condition on their data. The decorator will then use that filter to obtain unexpected elements, relevant counts, and return ...
[ "def", "column_map_expectation", "(", "cls", ",", "func", ")", ":", "if", "PY3", ":", "argspec", "=", "inspect", ".", "getfullargspec", "(", "func", ")", "[", "0", "]", "[", "1", ":", "]", "else", ":", "argspec", "=", "inspect", ".", "getargspec", "(...
For SqlAlchemy, this decorator allows individual column_map_expectations to simply return the filter that describes the expected condition on their data. The decorator will then use that filter to obtain unexpected elements, relevant counts, and return the formatted object.
[ "For", "SqlAlchemy", "this", "decorator", "allows", "individual", "column_map_expectations", "to", "simply", "return", "the", "filter", "that", "describes", "the", "expected", "condition", "on", "their", "data", "." ]
python
train
ilevkivskyi/typing_inspect
typing_inspect.py
https://github.com/ilevkivskyi/typing_inspect/blob/fd81278cc440b6003f8298bcb22d5bc0f82ee3cd/typing_inspect.py#L228-L254
def get_parameters(tp): """Return type parameters of a parameterizable type as a tuple in lexicographic order. Parameterizable types are generic types, unions, tuple types and callable types. Examples:: get_parameters(int) == () get_parameters(Generic) == () get_parameters(Union) ==...
[ "def", "get_parameters", "(", "tp", ")", ":", "if", "NEW_TYPING", ":", "if", "(", "isinstance", "(", "tp", ",", "_GenericAlias", ")", "or", "isinstance", "(", "tp", ",", "type", ")", "and", "issubclass", "(", "tp", ",", "Generic", ")", "and", "tp", "...
Return type parameters of a parameterizable type as a tuple in lexicographic order. Parameterizable types are generic types, unions, tuple types and callable types. Examples:: get_parameters(int) == () get_parameters(Generic) == () get_parameters(Union) == () get_parameters(List...
[ "Return", "type", "parameters", "of", "a", "parameterizable", "type", "as", "a", "tuple", "in", "lexicographic", "order", ".", "Parameterizable", "types", "are", "generic", "types", "unions", "tuple", "types", "and", "callable", "types", ".", "Examples", "::" ]
python
train
edx/edx-enterprise
enterprise/api/v1/serializers.py
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/serializers.py#L618-L633
def validate_lms_user_id(self, value): """ Validates the lms_user_id, if is given, to see if there is an existing EnterpriseCustomerUser for it. """ enterprise_customer = self.context.get('enterprise_customer') try: # Ensure the given user is associated with the ente...
[ "def", "validate_lms_user_id", "(", "self", ",", "value", ")", ":", "enterprise_customer", "=", "self", ".", "context", ".", "get", "(", "'enterprise_customer'", ")", "try", ":", "# Ensure the given user is associated with the enterprise.", "return", "models", ".", "E...
Validates the lms_user_id, if is given, to see if there is an existing EnterpriseCustomerUser for it.
[ "Validates", "the", "lms_user_id", "if", "is", "given", "to", "see", "if", "there", "is", "an", "existing", "EnterpriseCustomerUser", "for", "it", "." ]
python
valid
tBuLi/symfit
symfit/core/support.py
https://github.com/tBuLi/symfit/blob/759dd3d1d4270510d651f40b23dd26b1b10eee83/symfit/core/support.py#L162-L188
def sympy_to_scipy(func, vars, params): """ Convert a symbolic expression to one scipy digs. Not used by ``symfit`` any more. :param func: sympy expression :param vars: variables :param params: parameters :return: Scipy-style function to be used for numerical evaluation of the model. """ ...
[ "def", "sympy_to_scipy", "(", "func", ",", "vars", ",", "params", ")", ":", "lambda_func", "=", "sympy_to_py", "(", "func", ",", "vars", ",", "params", ")", "def", "f", "(", "x", ",", "p", ")", ":", "\"\"\"\n Scipy style function.\n\n :param x: l...
Convert a symbolic expression to one scipy digs. Not used by ``symfit`` any more. :param func: sympy expression :param vars: variables :param params: parameters :return: Scipy-style function to be used for numerical evaluation of the model.
[ "Convert", "a", "symbolic", "expression", "to", "one", "scipy", "digs", ".", "Not", "used", "by", "symfit", "any", "more", "." ]
python
train
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/interactiveshell.py#L2692-L2735
def run_code(self, code_obj): """Execute a code object. When an exception occurs, self.showtraceback() is called to display a traceback. Parameters ---------- code_obj : code object A compiled code object, to be executed Returns ------- ...
[ "def", "run_code", "(", "self", ",", "code_obj", ")", ":", "# Set our own excepthook in case the user code tries to call it", "# directly, so that the IPython crash handler doesn't get triggered", "old_excepthook", ",", "sys", ".", "excepthook", "=", "sys", ".", "excepthook", "...
Execute a code object. When an exception occurs, self.showtraceback() is called to display a traceback. Parameters ---------- code_obj : code object A compiled code object, to be executed Returns ------- False : successful execution. T...
[ "Execute", "a", "code", "object", "." ]
python
test
nchopin/particles
particles/kalman.py
https://github.com/nchopin/particles/blob/3faa97a1073db45c5889eef3e015dd76ef350b52/particles/kalman.py#L163-L187
def predict_step(F, covX, filt): """Predictive step of Kalman filter. Parameters ---------- F: (dx, dx) numpy array Mean of X_t | X_{t-1} is F * X_{t-1} covX: (dx, dx) numpy array covariance of X_t | X_{t-1} filt: MeanAndCov object filtering distribution at time t-1 ...
[ "def", "predict_step", "(", "F", ",", "covX", ",", "filt", ")", ":", "pred_mean", "=", "np", ".", "matmul", "(", "filt", ".", "mean", ",", "F", ".", "T", ")", "pred_cov", "=", "dotdot", "(", "F", ",", "filt", ".", "cov", ",", "F", ".", "T", "...
Predictive step of Kalman filter. Parameters ---------- F: (dx, dx) numpy array Mean of X_t | X_{t-1} is F * X_{t-1} covX: (dx, dx) numpy array covariance of X_t | X_{t-1} filt: MeanAndCov object filtering distribution at time t-1 Returns ------- pred: MeanAn...
[ "Predictive", "step", "of", "Kalman", "filter", "." ]
python
train
ladybug-tools/ladybug
ladybug/sunpath.py
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/sunpath.py#L96-L100
def latitude(self, value): """Set latitude value.""" self._latitude = math.radians(float(value)) assert -self.PI / 2 <= self._latitude <= self.PI / 2, \ "latitude value should be between -90..90."
[ "def", "latitude", "(", "self", ",", "value", ")", ":", "self", ".", "_latitude", "=", "math", ".", "radians", "(", "float", "(", "value", ")", ")", "assert", "-", "self", ".", "PI", "/", "2", "<=", "self", ".", "_latitude", "<=", "self", ".", "P...
Set latitude value.
[ "Set", "latitude", "value", "." ]
python
train
DMSC-Instrument-Data/lewis
src/lewis/adapters/modbus.py
https://github.com/DMSC-Instrument-Data/lewis/blob/931d96b8c761550a6a58f6e61e202690db04233a/src/lewis/adapters/modbus.py#L218-L229
def is_valid(self): """ Check integrity and validity of this frame. :return: bool True if this frame is structurally valid. """ conditions = [ self.protocol_id == 0, # Modbus always uses protocol 0 2 <= self.length <= 260, # Absolute length limits ...
[ "def", "is_valid", "(", "self", ")", ":", "conditions", "=", "[", "self", ".", "protocol_id", "==", "0", ",", "# Modbus always uses protocol 0", "2", "<=", "self", ".", "length", "<=", "260", ",", "# Absolute length limits", "len", "(", "self", ".", "data", ...
Check integrity and validity of this frame. :return: bool True if this frame is structurally valid.
[ "Check", "integrity", "and", "validity", "of", "this", "frame", "." ]
python
train
weld-project/weld
python/grizzly/grizzly/seriesweld.py
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/seriesweld.py#L192-L213
def lower(self): """Summary Returns: TYPE: Description """ # TODO : Bug in nested map operating on strings # TODO : Check that self.weld_type is a string type vectype = self.weld_type if isinstance(vectype, WeldVec): elem_type = vectype.el...
[ "def", "lower", "(", "self", ")", ":", "# TODO : Bug in nested map operating on strings", "# TODO : Check that self.weld_type is a string type", "vectype", "=", "self", ".", "weld_type", "if", "isinstance", "(", "vectype", ",", "WeldVec", ")", ":", "elem_type", "=", "ve...
Summary Returns: TYPE: Description
[ "Summary" ]
python
train
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_maps_ext.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_maps_ext.py#L66-L78
def maps_get_rules_output_rules_rulename(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") maps_get_rules = ET.Element("maps_get_rules") config = maps_get_rules output = ET.SubElement(maps_get_rules, "output") rules = ET.SubElement(output, ...
[ "def", "maps_get_rules_output_rules_rulename", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "maps_get_rules", "=", "ET", ".", "Element", "(", "\"maps_get_rules\"", ")", "config", "=", "maps_get_ru...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
inveniosoftware-attic/invenio-utils
invenio_utils/shell.py
https://github.com/inveniosoftware-attic/invenio-utils/blob/9a1c6db4e3f1370901f329f510480dd8df188296/invenio_utils/shell.py#L378-L400
def split_cli_ids_arg(value): """ Split ids given in the command line Possible formats are: * 1 * 1,2,3,4 * 1-5,20,30,40 Returns respectively * set([1]) * set([1,2,3,4]) * set([1,2,3,4,5,20,30,40]) """ def parse(el): el = el.strip() if not el: ...
[ "def", "split_cli_ids_arg", "(", "value", ")", ":", "def", "parse", "(", "el", ")", ":", "el", "=", "el", ".", "strip", "(", ")", "if", "not", "el", ":", "ret", "=", "[", "]", "elif", "'-'", "in", "el", ":", "start", ",", "end", "=", "el", "....
Split ids given in the command line Possible formats are: * 1 * 1,2,3,4 * 1-5,20,30,40 Returns respectively * set([1]) * set([1,2,3,4]) * set([1,2,3,4,5,20,30,40])
[ "Split", "ids", "given", "in", "the", "command", "line", "Possible", "formats", "are", ":", "*", "1", "*", "1", "2", "3", "4", "*", "1", "-", "5", "20", "30", "40", "Returns", "respectively", "*", "set", "(", "[", "1", "]", ")", "*", "set", "("...
python
train
PyMySQL/PyMySQL
pymysql/cursors.py
https://github.com/PyMySQL/PyMySQL/blob/3674bc6fd064bf88524e839c07690e8c35223709/pymysql/cursors.py#L128-L142
def mogrify(self, query, args=None): """ Returns the exact string that is sent to the database by calling the execute() method. This method follows the extension to the DB API 2.0 followed by Psycopg. """ conn = self._get_db() if PY2: # Use bytes on Python 2 alw...
[ "def", "mogrify", "(", "self", ",", "query", ",", "args", "=", "None", ")", ":", "conn", "=", "self", ".", "_get_db", "(", ")", "if", "PY2", ":", "# Use bytes on Python 2 always", "query", "=", "self", ".", "_ensure_bytes", "(", "query", ",", "encoding",...
Returns the exact string that is sent to the database by calling the execute() method. This method follows the extension to the DB API 2.0 followed by Psycopg.
[ "Returns", "the", "exact", "string", "that", "is", "sent", "to", "the", "database", "by", "calling", "the", "execute", "()", "method", "." ]
python
train
mollie/mollie-api-python
mollie/api/resources/orders.py
https://github.com/mollie/mollie-api-python/blob/307836b70f0439c066718f1e375fa333dc6e5d77/mollie/api/resources/orders.py#L20-L32
def delete(self, order_id, data=None): """Cancel order and return the order object. Deleting an order causes the order status to change to canceled. The updated order object is returned. """ if not order_id or not order_id.startswith(self.RESOURCE_ID_PREFIX): raise I...
[ "def", "delete", "(", "self", ",", "order_id", ",", "data", "=", "None", ")", ":", "if", "not", "order_id", "or", "not", "order_id", ".", "startswith", "(", "self", ".", "RESOURCE_ID_PREFIX", ")", ":", "raise", "IdentifierError", "(", "\"Invalid order ID: '{...
Cancel order and return the order object. Deleting an order causes the order status to change to canceled. The updated order object is returned.
[ "Cancel", "order", "and", "return", "the", "order", "object", "." ]
python
train
Clinical-Genomics/scout
scout/server/blueprints/variants/controllers.py
https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/variants/controllers.py#L205-L277
def parse_variant(store, institute_obj, case_obj, variant_obj, update=False, genome_build='37', get_compounds = True): """Parse information about variants. - Adds information about compounds - Updates the information about compounds if necessary and 'update=True' Args: store(...
[ "def", "parse_variant", "(", "store", ",", "institute_obj", ",", "case_obj", ",", "variant_obj", ",", "update", "=", "False", ",", "genome_build", "=", "'37'", ",", "get_compounds", "=", "True", ")", ":", "has_changed", "=", "False", "compounds", "=", "varia...
Parse information about variants. - Adds information about compounds - Updates the information about compounds if necessary and 'update=True' Args: store(scout.adapter.MongoAdapter) institute_obj(scout.models.Institute) case_obj(scout.models.Case) variant_obj(scout.models.V...
[ "Parse", "information", "about", "variants", "." ]
python
test
fastai/fastai
fastai/callbacks/tensorboard.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/callbacks/tensorboard.py#L330-L333
def _write_median_gradient(self)->None: "Writes the median of the gradients to Tensorboard." median_gradient = statistics.median(x.data.median() for x in self.gradients) self._add_gradient_scalar('median_gradient', scalar_value=median_gradient)
[ "def", "_write_median_gradient", "(", "self", ")", "->", "None", ":", "median_gradient", "=", "statistics", ".", "median", "(", "x", ".", "data", ".", "median", "(", ")", "for", "x", "in", "self", ".", "gradients", ")", "self", ".", "_add_gradient_scalar",...
Writes the median of the gradients to Tensorboard.
[ "Writes", "the", "median", "of", "the", "gradients", "to", "Tensorboard", "." ]
python
train
apple/turicreate
src/unity/python/turicreate/data_structures/gframe.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/gframe.py#L321-L333
def num_rows(self): """ Returns the number of rows. Returns ------- out : int Number of rows in the SFrame. """ if self._is_vertex_frame(): return self.__graph__.summary()['num_vertices'] elif self._is_edge_frame(): ret...
[ "def", "num_rows", "(", "self", ")", ":", "if", "self", ".", "_is_vertex_frame", "(", ")", ":", "return", "self", ".", "__graph__", ".", "summary", "(", ")", "[", "'num_vertices'", "]", "elif", "self", ".", "_is_edge_frame", "(", ")", ":", "return", "s...
Returns the number of rows. Returns ------- out : int Number of rows in the SFrame.
[ "Returns", "the", "number", "of", "rows", "." ]
python
train
bsmurphy/PyKrige
pykrige/uk.py
https://github.com/bsmurphy/PyKrige/blob/a4db3003b0b5688658c12faeb95a5a8b2b14b433/pykrige/uk.py#L618-L633
def get_variogram_points(self): """Returns both the lags and the variogram function evaluated at each of them. The evaluation of the variogram function and the lags are produced internally. This method is convenient when the user wants to access to the lags and the resulti...
[ "def", "get_variogram_points", "(", "self", ")", ":", "return", "self", ".", "lags", ",", "self", ".", "variogram_function", "(", "self", ".", "variogram_model_parameters", ",", "self", ".", "lags", ")" ]
Returns both the lags and the variogram function evaluated at each of them. The evaluation of the variogram function and the lags are produced internally. This method is convenient when the user wants to access to the lags and the resulting variogram (according to the model provide...
[ "Returns", "both", "the", "lags", "and", "the", "variogram", "function", "evaluated", "at", "each", "of", "them", ".", "The", "evaluation", "of", "the", "variogram", "function", "and", "the", "lags", "are", "produced", "internally", ".", "This", "method", "i...
python
train
pmuller/versions
versions/constraints.py
https://github.com/pmuller/versions/blob/951bc3fd99b6a675190f11ee0752af1d7ff5b440/versions/constraints.py#L109-L224
def merge(constraints): """Merge ``constraints``. It removes dupplicate, pruned and merged constraints. :param constraints: Current constraints. :type constraints: Iterable of :class:`.Constraint` objects. :rtype: :func:`list` of :class:`.Constraint` objects. :raises: :exc:`.ExclusiveConstrain...
[ "def", "merge", "(", "constraints", ")", ":", "# Dictionary :class:`Operator`: set of :class:`Version`.", "operators", "=", "defaultdict", "(", "set", ")", "for", "constraint", "in", "constraints", ":", "operators", "[", "constraint", ".", "operator", "]", ".", "add...
Merge ``constraints``. It removes dupplicate, pruned and merged constraints. :param constraints: Current constraints. :type constraints: Iterable of :class:`.Constraint` objects. :rtype: :func:`list` of :class:`.Constraint` objects. :raises: :exc:`.ExclusiveConstraints`
[ "Merge", "constraints", "." ]
python
train
ONSdigital/sdc-cryptography
sdc/crypto/scripts/generate_keys.py
https://github.com/ONSdigital/sdc-cryptography/blob/846feb2b27b1c62d35ff2c290c05abcead68b23c/sdc/crypto/scripts/generate_keys.py#L137-L164
def get_private_key(platform, service, purpose, key_use, version, private_key, keys_folder): ''' Loads a private key from the file system and adds it to a dict of keys :param keys: A dict of keys :param platform the platform the key is for :param service the service the key is for :param key_use...
[ "def", "get_private_key", "(", "platform", ",", "service", ",", "purpose", ",", "key_use", ",", "version", ",", "private_key", ",", "keys_folder", ")", ":", "private_key_data", "=", "get_file_contents", "(", "keys_folder", ",", "private_key", ")", "private_key", ...
Loads a private key from the file system and adds it to a dict of keys :param keys: A dict of keys :param platform the platform the key is for :param service the service the key is for :param key_use what the key is used for :param version the version of the key :param purpose: The purpose of th...
[ "Loads", "a", "private", "key", "from", "the", "file", "system", "and", "adds", "it", "to", "a", "dict", "of", "keys", ":", "param", "keys", ":", "A", "dict", "of", "keys", ":", "param", "platform", "the", "platform", "the", "key", "is", "for", ":", ...
python
test
harabchuk/kibana-dashboard-api
kibana_dashboard_api/paneltools.py
https://github.com/harabchuk/kibana-dashboard-api/blob/8a13d5078fa92fb73f06498757ba9f51632e8a23/kibana_dashboard_api/paneltools.py#L12-L25
def find_shape(bottom_lines, max_len): """ Finds a shape of lowest horizontal lines with step=1 :param bottom_lines: :param max_len: :return: list of levels (row values), list indexes are columns """ shape = [1] * max_len for i in range(max_len): for line in bottom_lines: ...
[ "def", "find_shape", "(", "bottom_lines", ",", "max_len", ")", ":", "shape", "=", "[", "1", "]", "*", "max_len", "for", "i", "in", "range", "(", "max_len", ")", ":", "for", "line", "in", "bottom_lines", ":", "if", "line", "[", "0", "]", "<=", "i", ...
Finds a shape of lowest horizontal lines with step=1 :param bottom_lines: :param max_len: :return: list of levels (row values), list indexes are columns
[ "Finds", "a", "shape", "of", "lowest", "horizontal", "lines", "with", "step", "=", "1", ":", "param", "bottom_lines", ":", ":", "param", "max_len", ":", ":", "return", ":", "list", "of", "levels", "(", "row", "values", ")", "list", "indexes", "are", "c...
python
train
bcbio/bcbio-nextgen
scripts/bcbio_nextgen_install.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/bcbio_nextgen_install.py#L119-L137
def install_anaconda_python(args): """Provide isolated installation of Anaconda python for running bcbio-nextgen. http://docs.continuum.io/anaconda/index.html """ anaconda_dir = os.path.join(args.datadir, "anaconda") bindir = os.path.join(anaconda_dir, "bin") conda = os.path.join(bindir, "conda"...
[ "def", "install_anaconda_python", "(", "args", ")", ":", "anaconda_dir", "=", "os", ".", "path", ".", "join", "(", "args", ".", "datadir", ",", "\"anaconda\"", ")", "bindir", "=", "os", ".", "path", ".", "join", "(", "anaconda_dir", ",", "\"bin\"", ")", ...
Provide isolated installation of Anaconda python for running bcbio-nextgen. http://docs.continuum.io/anaconda/index.html
[ "Provide", "isolated", "installation", "of", "Anaconda", "python", "for", "running", "bcbio", "-", "nextgen", ".", "http", ":", "//", "docs", ".", "continuum", ".", "io", "/", "anaconda", "/", "index", ".", "html" ]
python
train
thomasdelaet/python-velbus
velbus/messages/kwh_status.py
https://github.com/thomasdelaet/python-velbus/blob/af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd/velbus/messages/kwh_status.py#L25-L44
def populate(self, priority, address, rtr, data): """ -DB1 last 2 bits = channel -DB1 first 6 bist = pulses -DB2-5 = pulse counter -DB6-7 = ms/pulse :return: None """ assert isinstance(data, bytes) ...
[ "def", "populate", "(", "self", ",", "priority", ",", "address", ",", "rtr", ",", "data", ")", ":", "assert", "isinstance", "(", "data", ",", "bytes", ")", "self", ".", "needs_no_rtr", "(", "rtr", ")", "self", ".", "needs_data", "(", "data", ",", "7"...
-DB1 last 2 bits = channel -DB1 first 6 bist = pulses -DB2-5 = pulse counter -DB6-7 = ms/pulse :return: None
[ "-", "DB1", "last", "2", "bits", "=", "channel", "-", "DB1", "first", "6", "bist", "=", "pulses", "-", "DB2", "-", "5", "=", "pulse", "counter", "-", "DB6", "-", "7", "=", "ms", "/", "pulse", ":", "return", ":", "None" ]
python
train
yinkaisheng/Python-UIAutomation-for-Windows
uiautomation/uiautomation.py
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L4559-L4572
def MoveEndpointByRange(self, srcEndPoint: int, textRange: 'TextRange', targetEndPoint: int, waitTime: float = OPERATION_WAIT_TIME) -> bool: """ Call IUIAutomationTextRange::MoveEndpointByRange. Move one endpoint of the current text range to the specified endpoint of a second text range. ...
[ "def", "MoveEndpointByRange", "(", "self", ",", "srcEndPoint", ":", "int", ",", "textRange", ":", "'TextRange'", ",", "targetEndPoint", ":", "int", ",", "waitTime", ":", "float", "=", "OPERATION_WAIT_TIME", ")", "->", "bool", ":", "ret", "=", "self", ".", ...
Call IUIAutomationTextRange::MoveEndpointByRange. Move one endpoint of the current text range to the specified endpoint of a second text range. srcEndPoint: int, a value in class `TextPatternRangeEndpoint`. textRange: `TextRange`. targetEndPoint: int, a value in class `TextPatternRangeEn...
[ "Call", "IUIAutomationTextRange", "::", "MoveEndpointByRange", ".", "Move", "one", "endpoint", "of", "the", "current", "text", "range", "to", "the", "specified", "endpoint", "of", "a", "second", "text", "range", ".", "srcEndPoint", ":", "int", "a", "value", "i...
python
valid
fedora-infra/fedora-messaging
fedora_messaging/config.py
https://github.com/fedora-infra/fedora-messaging/blob/be3e88534e2b15d579bcd24f9c4b7e795cb7e0b7/fedora_messaging/config.py#L421-L439
def validate_client_properties(props): """ Validate the client properties setting. This will add the "version", "information", and "product" keys if they are missing. All other keys are application-specific. Raises: exceptions.ConfigurationException: If any of the basic keys are overridden...
[ "def", "validate_client_properties", "(", "props", ")", ":", "for", "key", "in", "(", "\"version\"", ",", "\"information\"", ",", "\"product\"", ")", ":", "# Nested dictionaries are not merged so key can be missing", "if", "key", "not", "in", "props", ":", "props", ...
Validate the client properties setting. This will add the "version", "information", and "product" keys if they are missing. All other keys are application-specific. Raises: exceptions.ConfigurationException: If any of the basic keys are overridden.
[ "Validate", "the", "client", "properties", "setting", "." ]
python
train
maartenbreddels/ipyvolume
ipyvolume/pylab.py
https://github.com/maartenbreddels/ipyvolume/blob/e68b72852b61276f8e6793bc8811f5b2432a155f/ipyvolume/pylab.py#L1158-L1182
def view(azimuth=None, elevation=None, distance=None): """Set camera angles and distance and return the current. :param float azimuth: rotation around the axis pointing up in degrees :param float elevation: rotation where +90 means 'up', -90 means 'down', in degrees :param float distance: radial distan...
[ "def", "view", "(", "azimuth", "=", "None", ",", "elevation", "=", "None", ",", "distance", "=", "None", ")", ":", "fig", "=", "gcf", "(", ")", "# first calculate the current values", "x", ",", "y", ",", "z", "=", "fig", ".", "camera", ".", "position",...
Set camera angles and distance and return the current. :param float azimuth: rotation around the axis pointing up in degrees :param float elevation: rotation where +90 means 'up', -90 means 'down', in degrees :param float distance: radial distance from the center to the camera.
[ "Set", "camera", "angles", "and", "distance", "and", "return", "the", "current", "." ]
python
train
mayfield/cellulario
cellulario/iocell.py
https://github.com/mayfield/cellulario/blob/e9dc10532a0357bc90ebaa2655b36822f9249673/cellulario/iocell.py#L248-L252
def clean(self): """ Run all of the cleaners added by the user. """ if self.cleaners: yield from asyncio.wait([x() for x in self.cleaners], loop=self.loop)
[ "def", "clean", "(", "self", ")", ":", "if", "self", ".", "cleaners", ":", "yield", "from", "asyncio", ".", "wait", "(", "[", "x", "(", ")", "for", "x", "in", "self", ".", "cleaners", "]", ",", "loop", "=", "self", ".", "loop", ")" ]
Run all of the cleaners added by the user.
[ "Run", "all", "of", "the", "cleaners", "added", "by", "the", "user", "." ]
python
train