repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
jrderuiter/pybiomart
src/pybiomart/dataset.py
https://github.com/jrderuiter/pybiomart/blob/7802d45fe88549ab0512d6f37f815fc43b172b39/src/pybiomart/dataset.py#L294-L314
def _add_filter_node(root, filter_, value): """Adds filter xml node to root.""" filter_el = ElementTree.SubElement(root, 'Filter') filter_el.set('name', filter_.name) # Set filter value depending on type. if filter_.type == 'boolean': # Boolean case. if v...
[ "def", "_add_filter_node", "(", "root", ",", "filter_", ",", "value", ")", ":", "filter_el", "=", "ElementTree", ".", "SubElement", "(", "root", ",", "'Filter'", ")", "filter_el", ".", "set", "(", "'name'", ",", "filter_", ".", "name", ")", "# Set filter v...
Adds filter xml node to root.
[ "Adds", "filter", "xml", "node", "to", "root", "." ]
python
train
42.571429
openstack/networking-cisco
networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/services/firewall/native/fw_mgr.py#L907-L919
def fill_fw_dict_from_db(self, fw_data): """ This routine is called to create a local fw_dict with data from DB. """ rule_dict = fw_data.get('rules').get('rules') fw_dict = {'fw_id': fw_data.get('fw_id'), 'fw_name': fw_data.get('name'), 'fire...
[ "def", "fill_fw_dict_from_db", "(", "self", ",", "fw_data", ")", ":", "rule_dict", "=", "fw_data", ".", "get", "(", "'rules'", ")", ".", "get", "(", "'rules'", ")", "fw_dict", "=", "{", "'fw_id'", ":", "fw_data", ".", "get", "(", "'fw_id'", ")", ",", ...
This routine is called to create a local fw_dict with data from DB.
[ "This", "routine", "is", "called", "to", "create", "a", "local", "fw_dict", "with", "data", "from", "DB", "." ]
python
train
45.769231
yinkaisheng/Python-UIAutomation-for-Windows
uiautomation/uiautomation.py
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/blob/2cc91060982cc8b777152e698d677cc2989bf263/uiautomation/uiautomation.py#L2273-L2279
def SetConsoleTitle(text: str) -> bool: """ SetConsoleTitle from Win32. text: str. Return bool, True if succeed otherwise False. """ return bool(ctypes.windll.kernel32.SetConsoleTitleW(ctypes.c_wchar_p(text)))
[ "def", "SetConsoleTitle", "(", "text", ":", "str", ")", "->", "bool", ":", "return", "bool", "(", "ctypes", ".", "windll", ".", "kernel32", ".", "SetConsoleTitleW", "(", "ctypes", ".", "c_wchar_p", "(", "text", ")", ")", ")" ]
SetConsoleTitle from Win32. text: str. Return bool, True if succeed otherwise False.
[ "SetConsoleTitle", "from", "Win32", ".", "text", ":", "str", ".", "Return", "bool", "True", "if", "succeed", "otherwise", "False", "." ]
python
valid
32.428571
HazyResearch/metal
metal/multitask/mt_classifier.py
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/multitask/mt_classifier.py#L52-L77
def predict(self, X, break_ties="random", return_probs=False, **kwargs): """Predicts int labels for an input X on all tasks Args: X: The input for the predict_proba method break_ties: A tie-breaking policy return_probs: Return the predicted probabilities as well ...
[ "def", "predict", "(", "self", ",", "X", ",", "break_ties", "=", "\"random\"", ",", "return_probs", "=", "False", ",", "*", "*", "kwargs", ")", ":", "Y_s", "=", "self", ".", "predict_proba", "(", "X", ",", "*", "*", "kwargs", ")", "self", ".", "_ch...
Predicts int labels for an input X on all tasks Args: X: The input for the predict_proba method break_ties: A tie-breaking policy return_probs: Return the predicted probabilities as well Returns: Y_p: A t-length list of n-dim np.ndarrays of predictions i...
[ "Predicts", "int", "labels", "for", "an", "input", "X", "on", "all", "tasks" ]
python
train
33.538462
qiniu/python-sdk
qiniu/services/compute/qcos_api.py
https://github.com/qiniu/python-sdk/blob/a69fbef4e3e6ea1ebe09f4610a5b18bb2c17de59/qiniu/services/compute/qcos_api.py#L261-L279
def update_service(self, stack, service, args): """更新服务 更新指定名称服务的配置如容器镜像等参数,容器被重新部署后生效。 如果指定manualUpdate参数,则需要额外调用 部署服务 接口并指定参数进行部署;处于人工升级模式的服务禁止执行其他修改操作。 如果不指定manualUpdate参数,平台会自动完成部署。 Args: - stack: 服务所属的服务组名称 - service: 服务名 - args: ...
[ "def", "update_service", "(", "self", ",", "stack", ",", "service", ",", "args", ")", ":", "url", "=", "'{0}/v3/stacks/{1}/services/{2}'", ".", "format", "(", "self", ".", "host", ",", "stack", ",", "service", ")", "return", "self", ".", "__post", "(", "...
更新服务 更新指定名称服务的配置如容器镜像等参数,容器被重新部署后生效。 如果指定manualUpdate参数,则需要额外调用 部署服务 接口并指定参数进行部署;处于人工升级模式的服务禁止执行其他修改操作。 如果不指定manualUpdate参数,平台会自动完成部署。 Args: - stack: 服务所属的服务组名称 - service: 服务名 - args: 服务具体描述请求参数(json),参考 http://kirk-docs.qiniu.com/apidocs/ ...
[ "更新服务" ]
python
train
35.842105
veltzer/pytconf
pytconf/config.py
https://github.com/veltzer/pytconf/blob/8dee43ace35d0dd2ab1105fb94057f650393360f/pytconf/config.py#L711-L726
def create_bool(help_string=NO_HELP, default=NO_DEFAULT): # type: (str, Union[bool, NO_DEFAULT_TYPE]) -> bool """ Create a bool parameter :param help_string: :param default: :return: """ # noinspection PyTypeChecker return ParamFunctions( ...
[ "def", "create_bool", "(", "help_string", "=", "NO_HELP", ",", "default", "=", "NO_DEFAULT", ")", ":", "# type: (str, Union[bool, NO_DEFAULT_TYPE]) -> bool", "# noinspection PyTypeChecker", "return", "ParamFunctions", "(", "help_string", "=", "help_string", ",", "default", ...
Create a bool parameter :param help_string: :param default: :return:
[ "Create", "a", "bool", "parameter", ":", "param", "help_string", ":", ":", "param", "default", ":", ":", "return", ":" ]
python
train
31.1875
dlecocq/nsq-py
nsq/http/__init__.py
https://github.com/dlecocq/nsq-py/blob/3ecacf6ab7719d38031179277113d875554a0c16/nsq/http/__init__.py#L67-L77
def get(self, path, *args, **kwargs): '''GET the provided endpoint''' target = self._host.relative(path).utf8 if not isinstance(target, basestring): # on older versions of the `url` library, .utf8 is a method, not a property target = target() params = kwargs.get('...
[ "def", "get", "(", "self", ",", "path", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "target", "=", "self", ".", "_host", ".", "relative", "(", "path", ")", ".", "utf8", "if", "not", "isinstance", "(", "target", ",", "basestring", ")", ":...
GET the provided endpoint
[ "GET", "the", "provided", "endpoint" ]
python
train
46.363636
ungarj/mapchete
mapchete/tile.py
https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/tile.py#L42-L60
def tile(self, zoom, row, col): """ Return ``BufferedTile`` object of this ``BufferedTilePyramid``. Parameters ---------- zoom : integer zoom level row : integer tile matrix row col : integer tile matrix column Returns...
[ "def", "tile", "(", "self", ",", "zoom", ",", "row", ",", "col", ")", ":", "tile", "=", "self", ".", "tile_pyramid", ".", "tile", "(", "zoom", ",", "row", ",", "col", ")", "return", "BufferedTile", "(", "tile", ",", "pixelbuffer", "=", "self", ".",...
Return ``BufferedTile`` object of this ``BufferedTilePyramid``. Parameters ---------- zoom : integer zoom level row : integer tile matrix row col : integer tile matrix column Returns ------- buffered tile : ``BufferedT...
[ "Return", "BufferedTile", "object", "of", "this", "BufferedTilePyramid", "." ]
python
valid
25.736842
horazont/aioxmpp
aioxmpp/stream.py
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/stream.py#L1680-L1736
def register_presence_callback(self, type_, from_, cb): """ Register a callback to be called when a presence stanza is received. :param type_: Presence type to listen for. :type type_: :class:`~.PresenceType` :param from_: Sender JID to listen for, or :data:`None` for a wildcard...
[ "def", "register_presence_callback", "(", "self", ",", "type_", ",", "from_", ",", "cb", ")", ":", "type_", "=", "self", ".", "_coerce_enum", "(", "type_", ",", "structs", ".", "PresenceType", ")", "warnings", ".", "warn", "(", "\"register_presence_callback is...
Register a callback to be called when a presence stanza is received. :param type_: Presence type to listen for. :type type_: :class:`~.PresenceType` :param from_: Sender JID to listen for, or :data:`None` for a wildcard match. :type from_: :class:`~aioxmpp.JID` or ...
[ "Register", "a", "callback", "to", "be", "called", "when", "a", "presence", "stanza", "is", "received", "." ]
python
train
40.473684
pecan/pecan
pecan/util.py
https://github.com/pecan/pecan/blob/833d0653fa0e6bbfb52545b091c30182105f4a82/pecan/util.py#L12-L54
def getargspec(method): """ Drill through layers of decorators attempting to locate the actual argspec for a method. """ argspec = _getargspec(method) args = argspec[0] if args and args[0] == 'self': return argspec if hasattr(method, '__func__'): method = method.__func__...
[ "def", "getargspec", "(", "method", ")", ":", "argspec", "=", "_getargspec", "(", "method", ")", "args", "=", "argspec", "[", "0", "]", "if", "args", "and", "args", "[", "0", "]", "==", "'self'", ":", "return", "argspec", "if", "hasattr", "(", "metho...
Drill through layers of decorators attempting to locate the actual argspec for a method.
[ "Drill", "through", "layers", "of", "decorators", "attempting", "to", "locate", "the", "actual", "argspec", "for", "a", "method", "." ]
python
train
29.372093
Gandi/gandi.cli
gandi/cli/modules/docker.py
https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/docker.py#L29-L48
def handle(cls, vm, args): """ Setup forwarding connection to given VM and pipe docker cmds over SSH. """ docker = Iaas.info(vm) if not docker: raise Exception('docker vm %s not found' % vm) if docker['state'] != 'running': Iaas.start(vm) ...
[ "def", "handle", "(", "cls", ",", "vm", ",", "args", ")", ":", "docker", "=", "Iaas", ".", "info", "(", "vm", ")", "if", "not", "docker", ":", "raise", "Exception", "(", "'docker vm %s not found'", "%", "vm", ")", "if", "docker", "[", "'state'", "]",...
Setup forwarding connection to given VM and pipe docker cmds over SSH.
[ "Setup", "forwarding", "connection", "to", "given", "VM", "and", "pipe", "docker", "cmds", "over", "SSH", "." ]
python
train
31.25
PmagPy/PmagPy
pmagpy/validate_upload3.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/validate_upload3.py#L191-L225
def cv(row, col_name, arg, current_data_model, df, con): """ row[col_name] must contain only values from the appropriate controlled vocabulary """ vocabulary = con.vocab.vocabularies cell_value = str(row[col_name]) if not cell_value: return None elif cell_value == "None": ret...
[ "def", "cv", "(", "row", ",", "col_name", ",", "arg", ",", "current_data_model", ",", "df", ",", "con", ")", ":", "vocabulary", "=", "con", ".", "vocab", ".", "vocabularies", "cell_value", "=", "str", "(", "row", "[", "col_name", "]", ")", "if", "not...
row[col_name] must contain only values from the appropriate controlled vocabulary
[ "row", "[", "col_name", "]", "must", "contain", "only", "values", "from", "the", "appropriate", "controlled", "vocabulary" ]
python
train
32.628571
rhayes777/PyAutoFit
autofit/conf.py
https://github.com/rhayes777/PyAutoFit/blob/a9e6144abb08edfc6a6906c4030d7119bf8d3e14/autofit/conf.py#L175-L192
def has(self, module_name, class_name, attribute_name): """ Parameters ---------- module_name: String The analysis_path of the module class_name: String The analysis_path of the class attribute_name: String The analysis_path of the attr...
[ "def", "has", "(", "self", ",", "module_name", ",", "class_name", ",", "attribute_name", ")", ":", "self", ".", "read", "(", "module_name", ")", "return", "self", ".", "parser", ".", "has_option", "(", "class_name", ",", "attribute_name", ")" ]
Parameters ---------- module_name: String The analysis_path of the module class_name: String The analysis_path of the class attribute_name: String The analysis_path of the attribute Returns ------- has_prior: bool T...
[ "Parameters", "----------", "module_name", ":", "String", "The", "analysis_path", "of", "the", "module", "class_name", ":", "String", "The", "analysis_path", "of", "the", "class", "attribute_name", ":", "String", "The", "analysis_path", "of", "the", "attribute" ]
python
train
30.333333
adobe-apiplatform/umapi-client.py
umapi_client/functional.py
https://github.com/adobe-apiplatform/umapi-client.py/blob/1c446d79643cc8615adaa23e12dce3ac5782cf76/umapi_client/functional.py#L263-L271
def remove_from_organization(self, delete_account=False): """ Remove a user from the organization's list of visible users. Optionally also delete the account. Deleting the account can only be done if the organization owns the account's domain. :param delete_account: Whether to delete th...
[ "def", "remove_from_organization", "(", "self", ",", "delete_account", "=", "False", ")", ":", "self", ".", "append", "(", "removeFromOrg", "=", "{", "\"deleteAccount\"", ":", "True", "if", "delete_account", "else", "False", "}", ")", "return", "None" ]
Remove a user from the organization's list of visible users. Optionally also delete the account. Deleting the account can only be done if the organization owns the account's domain. :param delete_account: Whether to delete the account after removing from the organization (default false) :return...
[ "Remove", "a", "user", "from", "the", "organization", "s", "list", "of", "visible", "users", ".", "Optionally", "also", "delete", "the", "account", ".", "Deleting", "the", "account", "can", "only", "be", "done", "if", "the", "organization", "owns", "the", ...
python
train
63.333333
aio-libs/aioredis
aioredis/commands/string.py
https://github.com/aio-libs/aioredis/blob/e8c33e39558d4cc91cf70dde490d8b330c97dc2e/aioredis/commands/string.py#L74-L81
def decrby(self, key, decrement): """Decrement the integer value of a key by the given number. :raises TypeError: if decrement is not int """ if not isinstance(decrement, int): raise TypeError("decrement must be of type int") return self.execute(b'DECRBY', key, decre...
[ "def", "decrby", "(", "self", ",", "key", ",", "decrement", ")", ":", "if", "not", "isinstance", "(", "decrement", ",", "int", ")", ":", "raise", "TypeError", "(", "\"decrement must be of type int\"", ")", "return", "self", ".", "execute", "(", "b'DECRBY'", ...
Decrement the integer value of a key by the given number. :raises TypeError: if decrement is not int
[ "Decrement", "the", "integer", "value", "of", "a", "key", "by", "the", "given", "number", "." ]
python
train
39.75
bcbio/bcbio-nextgen
bcbio/cwl/tool.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/cwl/tool.py#L189-L218
def _estimate_runner_memory(json_file): """Estimate Java memory requirements based on number of samples. A rough approach to selecting correct allocated memory for Cromwell. """ with open(json_file) as in_handle: sinfo = json.load(in_handle) num_parallel = 1 for key in ["config__algorit...
[ "def", "_estimate_runner_memory", "(", "json_file", ")", ":", "with", "open", "(", "json_file", ")", "as", "in_handle", ":", "sinfo", "=", "json", ".", "load", "(", "in_handle", ")", "num_parallel", "=", "1", "for", "key", "in", "[", "\"config__algorithm__va...
Estimate Java memory requirements based on number of samples. A rough approach to selecting correct allocated memory for Cromwell.
[ "Estimate", "Java", "memory", "requirements", "based", "on", "number", "of", "samples", "." ]
python
train
30.533333
apache/incubator-mxnet
python/mxnet/contrib/onnx/onnx2mx/_op_translations.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/contrib/onnx/onnx2mx/_op_translations.py#L282-L289
def _elu(attrs, inputs, proto_obj): """Elu function""" if 'alpha' in attrs: new_attrs = translation_utils._fix_attribute_names(attrs, {'alpha' : 'slope'}) else: new_attrs = translation_utils._add_extra_attributes(attrs, {'slope': 1.0}) new_attrs = translation_utils._add_extra_attributes(...
[ "def", "_elu", "(", "attrs", ",", "inputs", ",", "proto_obj", ")", ":", "if", "'alpha'", "in", "attrs", ":", "new_attrs", "=", "translation_utils", ".", "_fix_attribute_names", "(", "attrs", ",", "{", "'alpha'", ":", "'slope'", "}", ")", "else", ":", "ne...
Elu function
[ "Elu", "function" ]
python
train
48.25
astrocatalogs/astrocats
astrocats/catalog/photometry.py
https://github.com/astrocatalogs/astrocats/blob/11abc3131c6366ecd23964369e55ff264add7805/astrocats/catalog/photometry.py#L421-L459
def set_pd_mag_from_counts(photodict, c='', ec='', lec='', uec='', zp=DEFAULT_ZP, sig=DEFAULT_UL_SIGMA): """Set photometry dictionary from a counts measur...
[ "def", "set_pd_mag_from_counts", "(", "photodict", ",", "c", "=", "''", ",", "ec", "=", "''", ",", "lec", "=", "''", ",", "uec", "=", "''", ",", "zp", "=", "DEFAULT_ZP", ",", "sig", "=", "DEFAULT_UL_SIGMA", ")", ":", "with", "localcontext", "(", ")",...
Set photometry dictionary from a counts measurement.
[ "Set", "photometry", "dictionary", "from", "a", "counts", "measurement", "." ]
python
train
44.487179
radjkarl/fancyTools
fancytools/math/scale.py
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/math/scale.py#L2-L15
def scale(arr, mn=0, mx=1): """ Apply min-max scaling (normalize) then scale to (mn,mx) """ amn = arr.min() amx = arr.max() # normalize: arr = (arr - amn) / (amx - amn) # scale: if amn != mn or amx != mx: arr *= mx - mn arr += mn return arr
[ "def", "scale", "(", "arr", ",", "mn", "=", "0", ",", "mx", "=", "1", ")", ":", "amn", "=", "arr", ".", "min", "(", ")", "amx", "=", "arr", ".", "max", "(", ")", "# normalize:", "arr", "=", "(", "arr", "-", "amn", ")", "/", "(", "amx", "-...
Apply min-max scaling (normalize) then scale to (mn,mx)
[ "Apply", "min", "-", "max", "scaling", "(", "normalize", ")", "then", "scale", "to", "(", "mn", "mx", ")" ]
python
train
20.5
quantopian/zipline
zipline/pipeline/factors/factor.py
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/pipeline/factors/factor.py#L1393-L1404
def _compute(self, arrays, dates, assets, mask): """ For each row in the input, compute a like-shaped array of per-row ranks. """ return masked_rankdata_2d( arrays[0], mask, self.inputs[0].missing_value, self._method, se...
[ "def", "_compute", "(", "self", ",", "arrays", ",", "dates", ",", "assets", ",", "mask", ")", ":", "return", "masked_rankdata_2d", "(", "arrays", "[", "0", "]", ",", "mask", ",", "self", ".", "inputs", "[", "0", "]", ".", "missing_value", ",", "self"...
For each row in the input, compute a like-shaped array of per-row ranks.
[ "For", "each", "row", "in", "the", "input", "compute", "a", "like", "-", "shaped", "array", "of", "per", "-", "row", "ranks", "." ]
python
train
27.75
ASMfreaK/habitipy
habitipy/util.py
https://github.com/ASMfreaK/habitipy/blob/555b8b20faf6d553353092614a8a0d612f0adbde/habitipy/util.py#L166-L169
def get_translation_functions(package_name: str, names: Tuple[str, ...] = ('gettext',)): """finds and installs translation functions for package""" translation = get_translation_for(package_name) return [getattr(translation, x) for x in names]
[ "def", "get_translation_functions", "(", "package_name", ":", "str", ",", "names", ":", "Tuple", "[", "str", ",", "...", "]", "=", "(", "'gettext'", ",", ")", ")", ":", "translation", "=", "get_translation_for", "(", "package_name", ")", "return", "[", "ge...
finds and installs translation functions for package
[ "finds", "and", "installs", "translation", "functions", "for", "package" ]
python
train
63
waqasbhatti/astrobase
astrobase/varclass/varfeatures.py
https://github.com/waqasbhatti/astrobase/blob/2922a14619d183fb28005fa7d02027ac436f2265/astrobase/varclass/varfeatures.py#L544-L662
def gilliland_cdpp(times, mags, errs, windowlength=97, polyorder=2, binsize=23400, # in seconds: 6.5 hours for classic CDPP sigclip=5.0, magsarefluxes=False, **kwargs): '''This calculates the CDPP of a...
[ "def", "gilliland_cdpp", "(", "times", ",", "mags", ",", "errs", ",", "windowlength", "=", "97", ",", "polyorder", "=", "2", ",", "binsize", "=", "23400", ",", "# in seconds: 6.5 hours for classic CDPP", "sigclip", "=", "5.0", ",", "magsarefluxes", "=", "False...
This calculates the CDPP of a timeseries using the method in the paper: Gilliland, R. L., Chaplin, W. J., Dunham, E. W., et al. 2011, ApJS, 197, 6 (http://adsabs.harvard.edu/abs/2011ApJS..197....6G) The steps are: - pass the time-series through a Savitsky-Golay filter. - we use `scipy.signal.s...
[ "This", "calculates", "the", "CDPP", "of", "a", "timeseries", "using", "the", "method", "in", "the", "paper", ":" ]
python
valid
34.05042
Duke-GCB/DukeDSClient
ddsc/core/download.py
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/download.py#L366-L379
def download_file_part_run(download_context): """ Function run by CreateProjectCommand to create the project. Runs in a background process. :param download_context: UploadContext: contains data service setup and project name to create. """ destination_dir, file_url_data_dict, seek_amt, bytes_to_...
[ "def", "download_file_part_run", "(", "download_context", ")", ":", "destination_dir", ",", "file_url_data_dict", ",", "seek_amt", ",", "bytes_to_read", "=", "download_context", ".", "params", "project_file", "=", "ProjectFile", "(", "file_url_data_dict", ")", "local_pa...
Function run by CreateProjectCommand to create the project. Runs in a background process. :param download_context: UploadContext: contains data service setup and project name to create.
[ "Function", "run", "by", "CreateProjectCommand", "to", "create", "the", "project", ".", "Runs", "in", "a", "background", "process", ".", ":", "param", "download_context", ":", "UploadContext", ":", "contains", "data", "service", "setup", "and", "project", "name"...
python
train
51.285714
datastax/python-driver
cassandra/encoder.py
https://github.com/datastax/python-driver/blob/30a80d0b798b1f45f8cb77163b1fa791f3e3ca29/cassandra/encoder.py#L227-L235
def cql_encode_all_types(self, val, as_text_type=False): """ Converts any type into a CQL string, defaulting to ``cql_encode_object`` if :attr:`~Encoder.mapping` does not contain an entry for the type. """ encoded = self.mapping.get(type(val), self.cql_encode_object)(val) ...
[ "def", "cql_encode_all_types", "(", "self", ",", "val", ",", "as_text_type", "=", "False", ")", ":", "encoded", "=", "self", ".", "mapping", ".", "get", "(", "type", "(", "val", ")", ",", "self", ".", "cql_encode_object", ")", "(", "val", ")", "if", ...
Converts any type into a CQL string, defaulting to ``cql_encode_object`` if :attr:`~Encoder.mapping` does not contain an entry for the type.
[ "Converts", "any", "type", "into", "a", "CQL", "string", "defaulting", "to", "cql_encode_object", "if", ":", "attr", ":", "~Encoder", ".", "mapping", "does", "not", "contain", "an", "entry", "for", "the", "type", "." ]
python
train
48.666667
GoogleCloudPlatform/google-cloud-datastore
python/googledatastore/helper.py
https://github.com/GoogleCloudPlatform/google-cloud-datastore/blob/a23940d0634d7f537faf01ad9e60598046bcb40a/python/googledatastore/helper.py#L357-L378
def set_property_filter(filter_proto, name, op, value): """Set property filter contraint in the given datastore.Filter proto message. Args: filter_proto: datastore.Filter proto message name: property name op: datastore.PropertyFilter.Operation value: property value Returns: the same datastor...
[ "def", "set_property_filter", "(", "filter_proto", ",", "name", ",", "op", ",", "value", ")", ":", "filter_proto", ".", "Clear", "(", ")", "pf", "=", "filter_proto", ".", "property_filter", "pf", ".", "property", ".", "name", "=", "name", "pf", ".", "op"...
Set property filter contraint in the given datastore.Filter proto message. Args: filter_proto: datastore.Filter proto message name: property name op: datastore.PropertyFilter.Operation value: property value Returns: the same datastore.Filter. Usage: >>> set_property_filter(filter_proto,...
[ "Set", "property", "filter", "contraint", "in", "the", "given", "datastore", ".", "Filter", "proto", "message", "." ]
python
train
26.818182
budacom/trading-bots
trading_bots/contrib/converters/base.py
https://github.com/budacom/trading-bots/blob/8cb68bb8d0b5f822108db1cc5dae336e3d3c3452/trading_bots/contrib/converters/base.py#L83-L86
def convert_money(self, money: Money, to: str, reverse: bool=False) -> Money: """Convert money to another currency""" converted = self.convert(money.amount, money.currency, to, reverse) return Money(converted, to)
[ "def", "convert_money", "(", "self", ",", "money", ":", "Money", ",", "to", ":", "str", ",", "reverse", ":", "bool", "=", "False", ")", "->", "Money", ":", "converted", "=", "self", ".", "convert", "(", "money", ".", "amount", ",", "money", ".", "c...
Convert money to another currency
[ "Convert", "money", "to", "another", "currency" ]
python
train
58.5
Scoppio/RagnarokEngine3
Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py
https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py#L860-L871
def is_identity(): """Check to see if this matrix is an identity matrix.""" for index, row in enumerate(self.dta): if row[index] == 1: for num, element in enumerate(row): if num != index: if element != 0: ...
[ "def", "is_identity", "(", ")", ":", "for", "index", ",", "row", "in", "enumerate", "(", "self", ".", "dta", ")", ":", "if", "row", "[", "index", "]", "==", "1", ":", "for", "num", ",", "element", "in", "enumerate", "(", "row", ")", ":", "if", ...
Check to see if this matrix is an identity matrix.
[ "Check", "to", "see", "if", "this", "matrix", "is", "an", "identity", "matrix", "." ]
python
train
32.5
quantopian/zipline
zipline/utils/functional.py
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/functional.py#L145-L187
def _gen_unzip(it, elem_len): """Helper for unzip which checks the lengths of each element in it. Parameters ---------- it : iterable[tuple] An iterable of tuples. ``unzip`` should map ensure that these are already tuples. elem_len : int or None The expected element length. I...
[ "def", "_gen_unzip", "(", "it", ",", "elem_len", ")", ":", "elem", "=", "next", "(", "it", ")", "first_elem_len", "=", "len", "(", "elem", ")", "if", "elem_len", "is", "not", "None", "and", "elem_len", "!=", "first_elem_len", ":", "raise", "ValueError", ...
Helper for unzip which checks the lengths of each element in it. Parameters ---------- it : iterable[tuple] An iterable of tuples. ``unzip`` should map ensure that these are already tuples. elem_len : int or None The expected element length. If this is None it is infered from the...
[ "Helper", "for", "unzip", "which", "checks", "the", "lengths", "of", "each", "element", "in", "it", ".", "Parameters", "----------", "it", ":", "iterable", "[", "tuple", "]", "An", "iterable", "of", "tuples", ".", "unzip", "should", "map", "ensure", "that"...
python
train
27.465116
Kane610/axis
axis/streammanager.py
https://github.com/Kane610/axis/blob/b2b44ce595c7b722b5e13eabcab7b91f048e1808/axis/streammanager.py#L52-L67
def session_callback(self, signal): """Signalling from stream session. Data - new data available for processing. Playing - Connection is healthy. Retry - if there is no connection to device. """ if signal == SIGNAL_DATA: self.event.new_event(self.data) ...
[ "def", "session_callback", "(", "self", ",", "signal", ")", ":", "if", "signal", "==", "SIGNAL_DATA", ":", "self", ".", "event", ".", "new_event", "(", "self", ".", "data", ")", "elif", "signal", "==", "SIGNAL_FAILED", ":", "self", ".", "retry", "(", "...
Signalling from stream session. Data - new data available for processing. Playing - Connection is healthy. Retry - if there is no connection to device.
[ "Signalling", "from", "stream", "session", "." ]
python
train
32.6875
Azure/azure-sdk-for-python
azure-servicebus/azure/servicebus/control_client/servicebusservice.py
https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicebus/azure/servicebus/control_client/servicebusservice.py#L625-L642
def list_subscriptions(self, topic_name): ''' Retrieves the subscriptions in the specified topic. topic_name: Name of the topic. ''' _validate_not_none('topic_name', topic_name) request = HTTPRequest() request.method = 'GET' request.host = sel...
[ "def", "list_subscriptions", "(", "self", ",", "topic_name", ")", ":", "_validate_not_none", "(", "'topic_name'", ",", "topic_name", ")", "request", "=", "HTTPRequest", "(", ")", "request", ".", "method", "=", "'GET'", "request", ".", "host", "=", "self", "....
Retrieves the subscriptions in the specified topic. topic_name: Name of the topic.
[ "Retrieves", "the", "subscriptions", "in", "the", "specified", "topic", "." ]
python
test
41.555556
pydsigner/pygu
pygu/common.py
https://github.com/pydsigner/pygu/blob/09fe71534900933908ab83db12f5659b7827e31c/pygu/common.py#L17-L23
def center_blit(target, source, dest = (0, 0), area=None, special_flags=0): ''' Blits surface @source to the center of surface @target. Takes the normal Surface.blit() flags; however, @dest is used as an offset. ''' loc = lambda d, s: _vec(d.get_size()) / 2 - _vec(s.get_size()) / 2 _blitter(loc...
[ "def", "center_blit", "(", "target", ",", "source", ",", "dest", "=", "(", "0", ",", "0", ")", ",", "area", "=", "None", ",", "special_flags", "=", "0", ")", ":", "loc", "=", "lambda", "d", ",", "s", ":", "_vec", "(", "d", ".", "get_size", "(",...
Blits surface @source to the center of surface @target. Takes the normal Surface.blit() flags; however, @dest is used as an offset.
[ "Blits", "surface" ]
python
train
51.142857
angr/angr
angr/concretization_strategies/__init__.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/concretization_strategies/__init__.py#L45-L49
def _range(self, memory, addr, **kwargs): """ Gets the (min, max) range of solutions for an address. """ return (self._min(memory, addr, **kwargs), self._max(memory, addr, **kwargs))
[ "def", "_range", "(", "self", ",", "memory", ",", "addr", ",", "*", "*", "kwargs", ")", ":", "return", "(", "self", ".", "_min", "(", "memory", ",", "addr", ",", "*", "*", "kwargs", ")", ",", "self", ".", "_max", "(", "memory", ",", "addr", ","...
Gets the (min, max) range of solutions for an address.
[ "Gets", "the", "(", "min", "max", ")", "range", "of", "solutions", "for", "an", "address", "." ]
python
train
42
RedHatInsights/insights-core
insights/core/dr.py
https://github.com/RedHatInsights/insights-core/blob/b57cbf8ed7c089672426ede0441e0a4f789ef4a1/insights/core/dr.py#L237-L245
def get_name(component): """ Attempt to get the string name of component, including module and class if applicable. """ if six.callable(component): name = getattr(component, "__qualname__", component.__name__) return '.'.join([component.__module__, name]) return str(component)
[ "def", "get_name", "(", "component", ")", ":", "if", "six", ".", "callable", "(", "component", ")", ":", "name", "=", "getattr", "(", "component", ",", "\"__qualname__\"", ",", "component", ".", "__name__", ")", "return", "'.'", ".", "join", "(", "[", ...
Attempt to get the string name of component, including module and class if applicable.
[ "Attempt", "to", "get", "the", "string", "name", "of", "component", "including", "module", "and", "class", "if", "applicable", "." ]
python
train
34.333333
rbuffat/pyepw
pyepw/epw.py
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L5498-L5680
def read(self, vals): """Read values. Args: vals (list): list of strings representing values """ i = 0 if len(vals[i]) == 0: self.year = None else: self.year = vals[i] i += 1 if len(vals[i]) == 0: self.mont...
[ "def", "read", "(", "self", ",", "vals", ")", ":", "i", "=", "0", "if", "len", "(", "vals", "[", "i", "]", ")", "==", "0", ":", "self", ".", "year", "=", "None", "else", ":", "self", ".", "year", "=", "vals", "[", "i", "]", "i", "+=", "1"...
Read values. Args: vals (list): list of strings representing values
[ "Read", "values", "." ]
python
train
28.84153
twilio/twilio-python
twilio/rest/verify/v2/service/__init__.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/verify/v2/service/__init__.py#L517-L543
def update(self, friendly_name=values.unset, code_length=values.unset, lookup_enabled=values.unset, skip_sms_to_landlines=values.unset, dtmf_input_required=values.unset, tts_name=values.unset, psd2_enabled=values.unset): """ Update the ServiceInstance ...
[ "def", "update", "(", "self", ",", "friendly_name", "=", "values", ".", "unset", ",", "code_length", "=", "values", ".", "unset", ",", "lookup_enabled", "=", "values", ".", "unset", ",", "skip_sms_to_landlines", "=", "values", ".", "unset", ",", "dtmf_input_...
Update the ServiceInstance :param unicode friendly_name: A string to describe the verification service :param unicode code_length: The length of the verification code to generate :param bool lookup_enabled: Whether to perform a lookup with each verification :param bool skip_sms_to_landl...
[ "Update", "the", "ServiceInstance" ]
python
train
53.62963
davidcarboni/Flask-Sleuth
sleuth/__init__.py
https://github.com/davidcarboni/Flask-Sleuth/blob/2191aa2a929ec43c0176ec51c7abef924b12d015/sleuth/__init__.py#L71-L88
def _tracing_information(): """Gets B3 distributed tracing information, if available. This is returned as a list, ready to be formatted into Spring Cloud Sleuth compatible format. """ # We'll collate trace information if the B3 headers have been collected: values = b3.values() if values[b3.b3...
[ "def", "_tracing_information", "(", ")", ":", "# We'll collate trace information if the B3 headers have been collected:", "values", "=", "b3", ".", "values", "(", ")", "if", "values", "[", "b3", ".", "b3_trace_id", "]", ":", "# Trace information would normally be sent to Zi...
Gets B3 distributed tracing information, if available. This is returned as a list, ready to be formatted into Spring Cloud Sleuth compatible format.
[ "Gets", "B3", "distributed", "tracing", "information", "if", "available", ".", "This", "is", "returned", "as", "a", "list", "ready", "to", "be", "formatted", "into", "Spring", "Cloud", "Sleuth", "compatible", "format", "." ]
python
train
43.555556
Opentrons/opentrons
api/src/opentrons/protocol_api/contexts.py
https://github.com/Opentrons/opentrons/blob/a7c15cc2636ecb64ab56c7edc1d8a57163aaeadf/api/src/opentrons/protocol_api/contexts.py#L1623-L1632
def load_labware(self, labware: Labware) -> Labware: """ Load labware onto a Magnetic Module, checking if it is compatible """ if labware.magdeck_engage_height is None: MODULE_LOG.warning( "This labware ({}) is not explicitly compatible with the" ...
[ "def", "load_labware", "(", "self", ",", "labware", ":", "Labware", ")", "->", "Labware", ":", "if", "labware", ".", "magdeck_engage_height", "is", "None", ":", "MODULE_LOG", ".", "warning", "(", "\"This labware ({}) is not explicitly compatible with the\"", "\" Magne...
Load labware onto a Magnetic Module, checking if it is compatible
[ "Load", "labware", "onto", "a", "Magnetic", "Module", "checking", "if", "it", "is", "compatible" ]
python
train
45.5
DLR-RM/RAFCON
source/rafcon/gui/controllers/utils/tree_view_controller.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L460-L463
def register_view(self, view): """Register callbacks for button press events and selection changed""" super(ListViewController, self).register_view(view) self.tree_view.connect('button_press_event', self.mouse_click)
[ "def", "register_view", "(", "self", ",", "view", ")", ":", "super", "(", "ListViewController", ",", "self", ")", ".", "register_view", "(", "view", ")", "self", ".", "tree_view", ".", "connect", "(", "'button_press_event'", ",", "self", ".", "mouse_click", ...
Register callbacks for button press events and selection changed
[ "Register", "callbacks", "for", "button", "press", "events", "and", "selection", "changed" ]
python
train
59.25
Contraz/demosys-py
demosys/context/glfw/window.py
https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/context/glfw/window.py#L107-L114
def resize(self, width, height): """ Sets the new size and buffer size internally """ self.width = width self.height = height self.buffer_width, self.buffer_height = glfw.get_framebuffer_size(self.window) self.set_default_viewport()
[ "def", "resize", "(", "self", ",", "width", ",", "height", ")", ":", "self", ".", "width", "=", "width", "self", ".", "height", "=", "height", "self", ".", "buffer_width", ",", "self", ".", "buffer_height", "=", "glfw", ".", "get_framebuffer_size", "(", ...
Sets the new size and buffer size internally
[ "Sets", "the", "new", "size", "and", "buffer", "size", "internally" ]
python
valid
35.125
josegomezr/pqb
pqb/queries.py
https://github.com/josegomezr/pqb/blob/a600cc6e4e9acdaaf2cff171d13eb85c9ed1757c/pqb/queries.py#L287-L294
def to(self, to): """ [Edge-only] especifica el destino del lado """ if self._type.lower() != 'edge': raise ValueError('Cannot set From/To to non-edge objects') self._to = to return self
[ "def", "to", "(", "self", ",", "to", ")", ":", "if", "self", ".", "_type", ".", "lower", "(", ")", "!=", "'edge'", ":", "raise", "ValueError", "(", "'Cannot set From/To to non-edge objects'", ")", "self", ".", "_to", "=", "to", "return", "self" ]
[Edge-only] especifica el destino del lado
[ "[", "Edge", "-", "only", "]", "especifica", "el", "destino", "del", "lado" ]
python
train
29.875
fishtown-analytics/dbt
core/dbt/config/profile.py
https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/config/profile.py#L300-L335
def from_raw_profiles(cls, raw_profiles, profile_name, cli_vars, target_override=None, threads_override=None): """ :param raw_profiles dict: The profile data, from disk as yaml. :param profile_name str: The profile name to use. :param cli_vars dict: The command-...
[ "def", "from_raw_profiles", "(", "cls", ",", "raw_profiles", ",", "profile_name", ",", "cli_vars", ",", "target_override", "=", "None", ",", "threads_override", "=", "None", ")", ":", "if", "profile_name", "not", "in", "raw_profiles", ":", "raise", "DbtProjectEr...
:param raw_profiles dict: The profile data, from disk as yaml. :param profile_name str: The profile name to use. :param cli_vars dict: The command-line variables passed as arguments, as a dict. :param target_override Optional[str]: The target to use, if provided on the co...
[ ":", "param", "raw_profiles", "dict", ":", "The", "profile", "data", "from", "disk", "as", "yaml", ".", ":", "param", "profile_name", "str", ":", "The", "profile", "name", "to", "use", ".", ":", "param", "cli_vars", "dict", ":", "The", "command", "-", ...
python
train
43.194444
dancsalo/TensorBase
tensorbase/base.py
https://github.com/dancsalo/TensorBase/blob/3d42a326452bd03427034916ff2fb90730020204/tensorbase/base.py#L442-L449
def cfg_from_file(self, yaml_filename, config_dict): """Load a config file and merge it into the default options.""" import yaml from easydict import EasyDict as edict with open(yaml_filename, 'r') as f: yaml_cfg = edict(yaml.load(f)) return self._merge_a_into_b(yaml...
[ "def", "cfg_from_file", "(", "self", ",", "yaml_filename", ",", "config_dict", ")", ":", "import", "yaml", "from", "easydict", "import", "EasyDict", "as", "edict", "with", "open", "(", "yaml_filename", ",", "'r'", ")", "as", "f", ":", "yaml_cfg", "=", "edi...
Load a config file and merge it into the default options.
[ "Load", "a", "config", "file", "and", "merge", "it", "into", "the", "default", "options", "." ]
python
train
41.375
Cito/DBUtils
DBUtils/SteadyDB.py
https://github.com/Cito/DBUtils/blob/90e8825e038f08c82044b8e50831480175fa026a/DBUtils/SteadyDB.py#L308-L313
def _store(self, con): """Store a database connection for subsequent use.""" self._con = con self._transaction = False self._closed = False self._usage = 0
[ "def", "_store", "(", "self", ",", "con", ")", ":", "self", ".", "_con", "=", "con", "self", ".", "_transaction", "=", "False", "self", ".", "_closed", "=", "False", "self", ".", "_usage", "=", "0" ]
Store a database connection for subsequent use.
[ "Store", "a", "database", "connection", "for", "subsequent", "use", "." ]
python
train
31.666667
fhs/pyhdf
pyhdf/SD.py
https://github.com/fhs/pyhdf/blob/dbdc1810a74a38df50dcad81fe903e239d2b388d/pyhdf/SD.py#L2206-L2246
def getcal(self): """Retrieve the SDS calibration coefficients. Args:: no argument Returns:: 5-element tuple holding: - cal: calibration factor (attribute 'scale_factor') - cal_error : calibration factor error (attribute 'scale...
[ "def", "getcal", "(", "self", ")", ":", "status", ",", "cal", ",", "cal_error", ",", "offset", ",", "offset_err", ",", "data_type", "=", "_C", ".", "SDgetcal", "(", "self", ".", "_id", ")", "_checkErr", "(", "'getcal'", ",", "status", ",", "'no calibra...
Retrieve the SDS calibration coefficients. Args:: no argument Returns:: 5-element tuple holding: - cal: calibration factor (attribute 'scale_factor') - cal_error : calibration factor error (attribute 'scale_factor_err') - off...
[ "Retrieve", "the", "SDS", "calibration", "coefficients", "." ]
python
train
35.853659
quantumlib/Cirq
cirq/circuits/circuit.py
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/cirq/circuits/circuit.py#L1068-L1100
def insert_at_frontier(self, operations: ops.OP_TREE, start: int, frontier: Dict[ops.Qid, int] = None ) -> Dict[ops.Qid, int]: """Inserts operations inline at frontier. Args: operatio...
[ "def", "insert_at_frontier", "(", "self", ",", "operations", ":", "ops", ".", "OP_TREE", ",", "start", ":", "int", ",", "frontier", ":", "Dict", "[", "ops", ".", "Qid", ",", "int", "]", "=", "None", ")", "->", "Dict", "[", "ops", ".", "Qid", ",", ...
Inserts operations inline at frontier. Args: operations: the operations to insert start: the moment at which to start inserting the operations frontier: frontier[q] is the earliest moment in which an operation acting on qubit q can be placed.
[ "Inserts", "operations", "inline", "at", "frontier", "." ]
python
train
39.666667
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#L585-L617
def _normalize_orders(self): """Helper: adjust orders based on cursors, where clauses.""" orders = list(self._orders) _has_snapshot_cursor = False if self._start_at: if isinstance(self._start_at[0], document.DocumentSnapshot): _has_snapshot_cursor = True ...
[ "def", "_normalize_orders", "(", "self", ")", ":", "orders", "=", "list", "(", "self", ".", "_orders", ")", "_has_snapshot_cursor", "=", "False", "if", "self", ".", "_start_at", ":", "if", "isinstance", "(", "self", ".", "_start_at", "[", "0", "]", ",", ...
Helper: adjust orders based on cursors, where clauses.
[ "Helper", ":", "adjust", "orders", "based", "on", "cursors", "where", "clauses", "." ]
python
train
41.363636
sivy/pystatsd
pystatsd/statsd.py
https://github.com/sivy/pystatsd/blob/69e362654c37df28582b12b964901334326620a7/pystatsd/statsd.py#L78-L87
def update_stats(self, stats, delta, sample_rate=1): """ Updates one or more stats counters by arbitrary amounts >>> statsd_client.update_stats('some.int',10) """ if not isinstance(stats, list): stats = [stats] data = dict((stat, "%s|c" % delta) for stat in s...
[ "def", "update_stats", "(", "self", ",", "stats", ",", "delta", ",", "sample_rate", "=", "1", ")", ":", "if", "not", "isinstance", "(", "stats", ",", "list", ")", ":", "stats", "=", "[", "stats", "]", "data", "=", "dict", "(", "(", "stat", ",", "...
Updates one or more stats counters by arbitrary amounts >>> statsd_client.update_stats('some.int',10)
[ "Updates", "one", "or", "more", "stats", "counters", "by", "arbitrary", "amounts", ">>>", "statsd_client", ".", "update_stats", "(", "some", ".", "int", "10", ")" ]
python
train
35.3
wonambi-python/wonambi
wonambi/widgets/notes.py
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L693-L722
def display_eventtype(self): """Read the list of event types in the annotations and update widgets. """ if self.annot is not None: event_types = sorted(self.annot.event_types, key=str.lower) else: event_types = [] self.idx_eventtype.clear() evtty...
[ "def", "display_eventtype", "(", "self", ")", ":", "if", "self", ".", "annot", "is", "not", "None", ":", "event_types", "=", "sorted", "(", "self", ".", "annot", ".", "event_types", ",", "key", "=", "str", ".", "lower", ")", "else", ":", "event_types",...
Read the list of event types in the annotations and update widgets.
[ "Read", "the", "list", "of", "event", "types", "in", "the", "annotations", "and", "update", "widgets", "." ]
python
train
37.266667
SiLab-Bonn/pyBAR
pybar/analysis/plotting/plotting.py
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/analysis/plotting/plotting.py#L52-L121
def plot_linear_relation(x, y, x_err=None, y_err=None, title=None, point_label=None, legend=None, plot_range=None, plot_range_y=None, x_label=None, y_label=None, y_2_label=None, log_x=False, log_y=False, size=None, filename=None): ''' Takes point data (x,y) with errors(x,y) and fits a straight line. The deviation ...
[ "def", "plot_linear_relation", "(", "x", ",", "y", ",", "x_err", "=", "None", ",", "y_err", "=", "None", ",", "title", "=", "None", ",", "point_label", "=", "None", ",", "legend", "=", "None", ",", "plot_range", "=", "None", ",", "plot_range_y", "=", ...
Takes point data (x,y) with errors(x,y) and fits a straight line. The deviation to this line is also plotted, showing the offset. Parameters ---------- x, y, x_err, y_err: iterable filename: string, PdfPages object or None PdfPages file object: plot is appended to the pdf stri...
[ "Takes", "point", "data", "(", "x", "y", ")", "with", "errors", "(", "x", "y", ")", "and", "fits", "a", "straight", "line", ".", "The", "deviation", "to", "this", "line", "is", "also", "plotted", "showing", "the", "offset", ".", "Parameters", "--------...
python
train
37.557143
Nic30/hwt
hwt/simulator/hdlSimulator.py
https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/simulator/hdlSimulator.py#L296-L307
def _scheduleCombUpdateDoneEv(self) -> Event: """ Schedule combUpdateDoneEv event to let agents know that current delta step is ending and values from combinational logic are stable """ assert not self._combUpdateDonePlaned, self.now cud = Event(self) cud.process_...
[ "def", "_scheduleCombUpdateDoneEv", "(", "self", ")", "->", "Event", ":", "assert", "not", "self", ".", "_combUpdateDonePlaned", ",", "self", ".", "now", "cud", "=", "Event", "(", "self", ")", "cud", ".", "process_to_wake", ".", "append", "(", "self", ".",...
Schedule combUpdateDoneEv event to let agents know that current delta step is ending and values from combinational logic are stable
[ "Schedule", "combUpdateDoneEv", "event", "to", "let", "agents", "know", "that", "current", "delta", "step", "is", "ending", "and", "values", "from", "combinational", "logic", "are", "stable" ]
python
test
42.75
hendrix/hendrix
hendrix/contrib/cache/resource.py
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/cache/resource.py#L72-L90
def handleResponseEnd(self): """ Extends handleResponseEnd to not care about the user closing/refreshing their browser before the response is finished. Also calls cacheContent in a thread that we don't care when it finishes. """ try: if not self._finished: ...
[ "def", "handleResponseEnd", "(", "self", ")", ":", "try", ":", "if", "not", "self", ".", "_finished", ":", "reactor", ".", "callInThread", "(", "self", ".", "resource", ".", "cacheContent", ",", "self", ".", "father", ",", "self", ".", "_response", ",", ...
Extends handleResponseEnd to not care about the user closing/refreshing their browser before the response is finished. Also calls cacheContent in a thread that we don't care when it finishes.
[ "Extends", "handleResponseEnd", "to", "not", "care", "about", "the", "user", "closing", "/", "refreshing", "their", "browser", "before", "the", "response", "is", "finished", ".", "Also", "calls", "cacheContent", "in", "a", "thread", "that", "we", "don", "t", ...
python
train
37.105263
borisbabic/browser_cookie3
__init__.py
https://github.com/borisbabic/browser_cookie3/blob/e695777c54509c286991c5bb5ca65f043d748f55/__init__.py#L183-L202
def _decrypt(self, value, encrypted_value): """Decrypt encoded cookies """ if sys.platform == 'win32': return self._decrypt_windows_chrome(value, encrypted_value) if value or (encrypted_value[:3] != b'v10'): return value # Encrypted cookies should be pr...
[ "def", "_decrypt", "(", "self", ",", "value", ",", "encrypted_value", ")", ":", "if", "sys", ".", "platform", "==", "'win32'", ":", "return", "self", ".", "_decrypt_windows_chrome", "(", "value", ",", "encrypted_value", ")", "if", "value", "or", "(", "encr...
Decrypt encoded cookies
[ "Decrypt", "encoded", "cookies" ]
python
valid
39.8
wind-python/windpowerlib
example/modelchain_example.py
https://github.com/wind-python/windpowerlib/blob/421b316139743311b7cb68a69f6b53d2665f7e23/example/modelchain_example.py#L216-L262
def plot_or_print(my_turbine, e126, dummy_turbine): r""" Plots or prints power output and power (coefficient) curves. Parameters ---------- my_turbine : WindTurbine WindTurbine object with self provided power curve. e126 : WindTurbine WindTurbine object with power curve from dat...
[ "def", "plot_or_print", "(", "my_turbine", ",", "e126", ",", "dummy_turbine", ")", ":", "# plot or print turbine power output", "if", "plt", ":", "e126", ".", "power_output", ".", "plot", "(", "legend", "=", "True", ",", "label", "=", "'Enercon E126'", ")", "m...
r""" Plots or prints power output and power (coefficient) curves. Parameters ---------- my_turbine : WindTurbine WindTurbine object with self provided power curve. e126 : WindTurbine WindTurbine object with power curve from data file provided by the windpowerlib. dummy_t...
[ "r", "Plots", "or", "prints", "power", "output", "and", "power", "(", "coefficient", ")", "curves", "." ]
python
train
37.319149
Karaage-Cluster/karaage
karaage/common/create_update.py
https://github.com/Karaage-Cluster/karaage/blob/2f4c8b4e2d728b3fcbb151160c49000f1c04f5c9/karaage/common/create_update.py#L24-L50
def get_model_and_form_class(model, form_class): """ Returns a model and form class based on the model and form_class parameters that were passed to the generic view. If ``form_class`` is given then its associated model will be returned along with ``form_class`` itself. Otherwise, if ``model`` is ...
[ "def", "get_model_and_form_class", "(", "model", ",", "form_class", ")", ":", "if", "form_class", ":", "return", "form_class", ".", "_meta", ".", "model", ",", "form_class", "if", "model", ":", "# The inner Meta class fails if model = model is used for some reason.", "t...
Returns a model and form class based on the model and form_class parameters that were passed to the generic view. If ``form_class`` is given then its associated model will be returned along with ``form_class`` itself. Otherwise, if ``model`` is given, ``model`` itself will be returned along with a ``M...
[ "Returns", "a", "model", "and", "form", "class", "based", "on", "the", "model", "and", "form_class", "parameters", "that", "were", "passed", "to", "the", "generic", "view", "." ]
python
train
39.925926
briney/abutils
abutils/utils/mongodb.py
https://github.com/briney/abutils/blob/944755fc7d28bfc7d4f1ffad94ca0bf9d74ec54b/abutils/utils/mongodb.py#L239-L312
def mongoimport(json, database, ip='localhost', port=27017, user=None, password=None, delim='_', delim1=None, delim2=None, delim_occurance=1, delim1_occurance=1, delim2_occurance=1): ''' Performs mongoimport on one or more json files. Args: ...
[ "def", "mongoimport", "(", "json", ",", "database", ",", "ip", "=", "'localhost'", ",", "port", "=", "27017", ",", "user", "=", "None", ",", "password", "=", "None", ",", "delim", "=", "'_'", ",", "delim1", "=", "None", ",", "delim2", "=", "None", ...
Performs mongoimport on one or more json files. Args: json: Can be one of several things: - path to a single JSON file - an iterable (list or tuple) of one or more JSON file paths - path to a directory containing one or more JSON files database (str): Name of ...
[ "Performs", "mongoimport", "on", "one", "or", "more", "json", "files", "." ]
python
train
43.743243
Robpol86/colorclass
colorclass/core.py
https://github.com/Robpol86/colorclass/blob/692e2d6f5ad470b6221c8cb9641970dc5563a572/colorclass/core.py#L189-L196
def index(self, sub, start=None, end=None): """Like S.find() but raise ValueError when the substring is not found. :param str sub: Substring to search. :param int start: Beginning position. :param int end: Stop comparison at this position. """ return self.value_no_colors...
[ "def", "index", "(", "self", ",", "sub", ",", "start", "=", "None", ",", "end", "=", "None", ")", ":", "return", "self", ".", "value_no_colors", ".", "index", "(", "sub", ",", "start", ",", "end", ")" ]
Like S.find() but raise ValueError when the substring is not found. :param str sub: Substring to search. :param int start: Beginning position. :param int end: Stop comparison at this position.
[ "Like", "S", ".", "find", "()", "but", "raise", "ValueError", "when", "the", "substring", "is", "not", "found", "." ]
python
train
42
google/grumpy
third_party/stdlib/bisect.py
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/bisect.py#L3-L20
def insort_right(a, x, lo=0, hi=None): """Insert item x in list a, and keep it sorted assuming a is sorted. If x is already in a, insert it to the right of the rightmost x. Optional args lo (default 0) and hi (default len(a)) bound the slice of a to be searched. """ if lo < 0: raise V...
[ "def", "insort_right", "(", "a", ",", "x", ",", "lo", "=", "0", ",", "hi", "=", "None", ")", ":", "if", "lo", "<", "0", ":", "raise", "ValueError", "(", "'lo must be non-negative'", ")", "if", "hi", "is", "None", ":", "hi", "=", "len", "(", "a", ...
Insert item x in list a, and keep it sorted assuming a is sorted. If x is already in a, insert it to the right of the rightmost x. Optional args lo (default 0) and hi (default len(a)) bound the slice of a to be searched.
[ "Insert", "item", "x", "in", "list", "a", "and", "keep", "it", "sorted", "assuming", "a", "is", "sorted", "." ]
python
valid
27.722222
jaraco/tempora
tempora/__init__.py
https://github.com/jaraco/tempora/blob/f0a9ab636103fe829aa9b495c93f5249aac5f2b8/tempora/__init__.py#L282-L294
def get_nearest_year_for_day(day): """ Returns the nearest year to now inferred from a Julian date. """ now = time.gmtime() result = now.tm_year # if the day is far greater than today, it must be from last year if day - now.tm_yday > 365 // 2: result -= 1 # if the day is far less than today, it must be for ne...
[ "def", "get_nearest_year_for_day", "(", "day", ")", ":", "now", "=", "time", ".", "gmtime", "(", ")", "result", "=", "now", ".", "tm_year", "# if the day is far greater than today, it must be from last year", "if", "day", "-", "now", ".", "tm_yday", ">", "365", ...
Returns the nearest year to now inferred from a Julian date.
[ "Returns", "the", "nearest", "year", "to", "now", "inferred", "from", "a", "Julian", "date", "." ]
python
valid
29.153846
apache/airflow
airflow/contrib/hooks/gcp_mlengine_hook.py
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_mlengine_hook.py#L165-L183
def create_version(self, project_id, model_name, version_spec): """ Creates the Version on Google Cloud ML Engine. Returns the operation if the version was created successfully and raises an error otherwise. """ parent_name = 'projects/{}/models/{}'.format(project_id, mo...
[ "def", "create_version", "(", "self", ",", "project_id", ",", "model_name", ",", "version_spec", ")", ":", "parent_name", "=", "'projects/{}/models/{}'", ".", "format", "(", "project_id", ",", "model_name", ")", "create_request", "=", "self", ".", "_mlengine", "...
Creates the Version on Google Cloud ML Engine. Returns the operation if the version was created successfully and raises an error otherwise.
[ "Creates", "the", "Version", "on", "Google", "Cloud", "ML", "Engine", "." ]
python
test
43.421053
caktus/django-timepiece
timepiece/management/commands/check_entries.py
https://github.com/caktus/django-timepiece/blob/52515dec027664890efbc535429e1ba1ee152f40/timepiece/management/commands/check_entries.py#L135-L155
def find_users(self, *args): """ Returns the users to search given names as args. Return all users if there are no args provided. """ if args: names = reduce(lambda query, arg: query | (Q(first_name__icontains=arg) | Q(last_name__icontains=arg)), ...
[ "def", "find_users", "(", "self", ",", "*", "args", ")", ":", "if", "args", ":", "names", "=", "reduce", "(", "lambda", "query", ",", "arg", ":", "query", "|", "(", "Q", "(", "first_name__icontains", "=", "arg", ")", "|", "Q", "(", "last_name__iconta...
Returns the users to search given names as args. Return all users if there are no args provided.
[ "Returns", "the", "users", "to", "search", "given", "names", "as", "args", ".", "Return", "all", "users", "if", "there", "are", "no", "args", "provided", "." ]
python
train
39.904762
saltstack/salt
salt/proxy/nxos.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/nxos.py#L521-L539
def _nxapi_request(commands, method='cli_conf', **kwargs): ''' Executes an nxapi_request request over NX-API. commands The exec or config commands to be sent. method: ``cli_show`` ``cli_show_ascii``: Return raw test or unstructured output. ``cli_show``: Return structured output...
[ "def", "_nxapi_request", "(", "commands", ",", "method", "=", "'cli_conf'", ",", "*", "*", "kwargs", ")", ":", "if", "CONNECTION", "==", "'ssh'", ":", "return", "'_nxapi_request is not available for ssh proxy'", "conn_args", "=", "DEVICE_DETAILS", "[", "'conn_args'"...
Executes an nxapi_request request over NX-API. commands The exec or config commands to be sent. method: ``cli_show`` ``cli_show_ascii``: Return raw test or unstructured output. ``cli_show``: Return structured output. ``cli_conf``: Send configuration commands to the device. ...
[ "Executes", "an", "nxapi_request", "request", "over", "NX", "-", "API", "." ]
python
train
35.315789
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/sql.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/sql.py#L286-L309
def _transactional(self, method, *argv, **argd): """ Begins a transaction and calls the given DAO method. If the method executes successfully the transaction is commited. If the method fails, the transaction is rolled back. @type method: callable @param method: Bound ...
[ "def", "_transactional", "(", "self", ",", "method", ",", "*", "argv", ",", "*", "*", "argd", ")", ":", "self", ".", "_session", ".", "begin", "(", "subtransactions", "=", "True", ")", "try", ":", "result", "=", "method", "(", "self", ",", "*", "ar...
Begins a transaction and calls the given DAO method. If the method executes successfully the transaction is commited. If the method fails, the transaction is rolled back. @type method: callable @param method: Bound method of this class or one of its subclasses. The first ...
[ "Begins", "a", "transaction", "and", "calls", "the", "given", "DAO", "method", "." ]
python
train
32.25
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/utils/notification.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/notification.py#L95-L109
def _observers_for_notification(self, ntype, sender): """Find all registered observers that should recieve notification""" keys = ( (ntype,sender), (ntype, None), (None, sender), (None,None) ) obs = set(...
[ "def", "_observers_for_notification", "(", "self", ",", "ntype", ",", "sender", ")", ":", "keys", "=", "(", "(", "ntype", ",", "sender", ")", ",", "(", "ntype", ",", "None", ")", ",", "(", "None", ",", "sender", ")", ",", "(", "None", ",", "None", ...
Find all registered observers that should recieve notification
[ "Find", "all", "registered", "observers", "that", "should", "recieve", "notification" ]
python
test
26.866667
PyFilesystem/pyfilesystem2
fs/ftpfs.py
https://github.com/PyFilesystem/pyfilesystem2/blob/047f3593f297d1442194cda3da7a7335bcc9c14a/fs/ftpfs.py#L440-L448
def ftp_url(self): # type: () -> Text """Get the FTP url this filesystem will open.""" url = ( "ftp://{}".format(self.host) if self.port == 21 else "ftp://{}:{}".format(self.host, self.port) ) return url
[ "def", "ftp_url", "(", "self", ")", ":", "# type: () -> Text", "url", "=", "(", "\"ftp://{}\"", ".", "format", "(", "self", ".", "host", ")", "if", "self", ".", "port", "==", "21", "else", "\"ftp://{}:{}\"", ".", "format", "(", "self", ".", "host", ","...
Get the FTP url this filesystem will open.
[ "Get", "the", "FTP", "url", "this", "filesystem", "will", "open", "." ]
python
train
30.111111
peopledoc/workalendar
workalendar/core.py
https://github.com/peopledoc/workalendar/blob/d044d5dfc1709ec388db34dab583dd554cc66c4e/workalendar/core.py#L566-L633
def get_chinese_new_year(self, year): """ Compute Chinese New Year days. To return a list of holidays. By default, it'll at least return the Chinese New Year holidays chosen using the following options: * ``include_chinese_new_year_eve`` * ``include_chinese_new_year`` (...
[ "def", "get_chinese_new_year", "(", "self", ",", "year", ")", ":", "days", "=", "[", "]", "lunar_first_day", "=", "ChineseNewYearCalendar", ".", "lunar", "(", "year", ",", "1", ",", "1", ")", "# Chinese new year's eve", "if", "self", ".", "include_chinese_new_...
Compute Chinese New Year days. To return a list of holidays. By default, it'll at least return the Chinese New Year holidays chosen using the following options: * ``include_chinese_new_year_eve`` * ``include_chinese_new_year`` (on by default) * ``include_chinese_second_day`` ...
[ "Compute", "Chinese", "New", "Year", "days", ".", "To", "return", "a", "list", "of", "holidays", "." ]
python
train
38.058824
maxcountryman/atomos
atomos/atomic.py
https://github.com/maxcountryman/atomos/blob/418746c69134efba3c4f999405afe9113dee4827/atomos/atomic.py#L59-L73
def compare_and_set(self, expect, update): ''' Atomically sets the value to `update` if the current value is equal to `expect`. :param expect: The expected current value. :param update: The value to set if and only if `expect` equals the current value. ''' ...
[ "def", "compare_and_set", "(", "self", ",", "expect", ",", "update", ")", ":", "with", "self", ".", "_lock", ".", "exclusive", ":", "if", "self", ".", "_value", "==", "expect", ":", "self", ".", "_value", "=", "update", "return", "True", "return", "Fal...
Atomically sets the value to `update` if the current value is equal to `expect`. :param expect: The expected current value. :param update: The value to set if and only if `expect` equals the current value.
[ "Atomically", "sets", "the", "value", "to", "update", "if", "the", "current", "value", "is", "equal", "to", "expect", "." ]
python
train
31.133333
bukun/TorCMS
torcms/handlers/evaluation_handler.py
https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/evaluation_handler.py#L34-L48
def add_or_update(self, app_id, value): ''' Adding or updating the evalution. :param app_id: the ID of the post. :param value: the evaluation :return: in JSON format. ''' MEvaluation.add_or_update(self.userinfo.uid, app_id, value) out_dic = { ...
[ "def", "add_or_update", "(", "self", ",", "app_id", ",", "value", ")", ":", "MEvaluation", ".", "add_or_update", "(", "self", ".", "userinfo", ".", "uid", ",", "app_id", ",", "value", ")", "out_dic", "=", "{", "'eval0'", ":", "MEvaluation", ".", "app_eva...
Adding or updating the evalution. :param app_id: the ID of the post. :param value: the evaluation :return: in JSON format.
[ "Adding", "or", "updating", "the", "evalution", ".", ":", "param", "app_id", ":", "the", "ID", "of", "the", "post", ".", ":", "param", "value", ":", "the", "evaluation", ":", "return", ":", "in", "JSON", "format", "." ]
python
train
31.8
genialis/resolwe
resolwe/elastic/builder.py
https://github.com/genialis/resolwe/blob/f7bb54932c81ec0cfc5b5e80d238fceaeaa48d86/resolwe/elastic/builder.py#L57-L76
def set(self, obj, build_kwargs): """Set cached value.""" if build_kwargs is None: build_kwargs = {} cached = {} if 'queryset' in build_kwargs: cached = { 'model': build_kwargs['queryset'].model, 'pks': list(build_kwargs['queryset'...
[ "def", "set", "(", "self", ",", "obj", ",", "build_kwargs", ")", ":", "if", "build_kwargs", "is", "None", ":", "build_kwargs", "=", "{", "}", "cached", "=", "{", "}", "if", "'queryset'", "in", "build_kwargs", ":", "cached", "=", "{", "'model'", ":", ...
Set cached value.
[ "Set", "cached", "value", "." ]
python
train
31.45
MycroftAI/mycroft-precise
precise/util.py
https://github.com/MycroftAI/mycroft-precise/blob/e17cebdd171906dbd8a16e282d8a7966fba2eeba/precise/util.py#L68-L77
def play_audio(filename: str): """ Args: filename: Audio filename """ import platform from subprocess import Popen player = 'play' if platform.system() == 'Darwin' else 'aplay' Popen([player, '-q', filename])
[ "def", "play_audio", "(", "filename", ":", "str", ")", ":", "import", "platform", "from", "subprocess", "import", "Popen", "player", "=", "'play'", "if", "platform", ".", "system", "(", ")", "==", "'Darwin'", "else", "'aplay'", "Popen", "(", "[", "player",...
Args: filename: Audio filename
[ "Args", ":", "filename", ":", "Audio", "filename" ]
python
train
23.6
ahwillia/tensortools
tensortools/diagnostics.py
https://github.com/ahwillia/tensortools/blob/f375633ec621caa96665a56205dcf932590d4a6e/tensortools/diagnostics.py#L9-L95
def kruskal_align(U, V, permute_U=False, permute_V=False): """Aligns two KTensors and returns a similarity score. Parameters ---------- U : KTensor First kruskal tensor to align. V : KTensor Second kruskal tensor to align. permute_U : bool If True, modifies 'U' to align ...
[ "def", "kruskal_align", "(", "U", ",", "V", ",", "permute_U", "=", "False", ",", "permute_V", "=", "False", ")", ":", "# Compute similarity matrices.", "unrm", "=", "[", "f", "/", "np", ".", "linalg", ".", "norm", "(", "f", ",", "axis", "=", "0", ")"...
Aligns two KTensors and returns a similarity score. Parameters ---------- U : KTensor First kruskal tensor to align. V : KTensor Second kruskal tensor to align. permute_U : bool If True, modifies 'U' to align the KTensors (default is False). permute_V : bool If T...
[ "Aligns", "two", "KTensors", "and", "returns", "a", "similarity", "score", "." ]
python
train
30.689655
crate/crate-python
src/crate/client/http.py
https://github.com/crate/crate-python/blob/68e39c95f5bbe88b74bbfa26de4347fc644636a8/src/crate/client/http.py#L318-L331
def sql(self, stmt, parameters=None, bulk_parameters=None): """ Execute SQL stmt against the crate server. """ if stmt is None: return None data = _create_sql_payload(stmt, parameters, bulk_parameters) logger.debug( 'Sending request to %s with pay...
[ "def", "sql", "(", "self", ",", "stmt", ",", "parameters", "=", "None", ",", "bulk_parameters", "=", "None", ")", ":", "if", "stmt", "is", "None", ":", "return", "None", "data", "=", "_create_sql_payload", "(", "stmt", ",", "parameters", ",", "bulk_param...
Execute SQL stmt against the crate server.
[ "Execute", "SQL", "stmt", "against", "the", "crate", "server", "." ]
python
train
35.357143
delph-in/pydelphin
delphin/mrs/components.py
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/mrs/components.py#L556-L565
def realpred(cls, lemma, pos, sense=None): """Instantiate a Pred from its components.""" string_tokens = [lemma] if pos is not None: string_tokens.append(pos) if sense is not None: sense = str(sense) string_tokens.append(sense) predstr = '_'.jo...
[ "def", "realpred", "(", "cls", ",", "lemma", ",", "pos", ",", "sense", "=", "None", ")", ":", "string_tokens", "=", "[", "lemma", "]", "if", "pos", "is", "not", "None", ":", "string_tokens", ".", "append", "(", "pos", ")", "if", "sense", "is", "not...
Instantiate a Pred from its components.
[ "Instantiate", "a", "Pred", "from", "its", "components", "." ]
python
train
40.7
ninuxorg/nodeshot
nodeshot/interop/oldimporter/db.py
https://github.com/ninuxorg/nodeshot/blob/2466f0a55f522b2696026f196436ce7ba3f1e5c6/nodeshot/interop/oldimporter/db.py#L24-L30
def allow_relation(self, obj1, obj2, **hints): """ Relations between objects are allowed between nodeshot2 objects only """ if obj1._meta.app_label != 'oldimporter' and obj2._meta.app_label != 'oldimporter': return True return None
[ "def", "allow_relation", "(", "self", ",", "obj1", ",", "obj2", ",", "*", "*", "hints", ")", ":", "if", "obj1", ".", "_meta", ".", "app_label", "!=", "'oldimporter'", "and", "obj2", ".", "_meta", ".", "app_label", "!=", "'oldimporter'", ":", "return", ...
Relations between objects are allowed between nodeshot2 objects only
[ "Relations", "between", "objects", "are", "allowed", "between", "nodeshot2", "objects", "only" ]
python
train
39.571429
redhat-cip/dci-control-server
dci/auth_mechanism.py
https://github.com/redhat-cip/dci-control-server/blob/b416cf935ec93e4fdd5741f61a21cabecf8454d2/dci/auth_mechanism.py#L135-L149
def get_user_and_check_auth(self, username, password): """Check the combination username/password that is valid on the database. """ constraint = sql.or_( models.USERS.c.name == username, models.USERS.c.email == username ) user = self.identity_fro...
[ "def", "get_user_and_check_auth", "(", "self", ",", "username", ",", "password", ")", ":", "constraint", "=", "sql", ".", "or_", "(", "models", ".", "USERS", ".", "c", ".", "name", "==", "username", ",", "models", ".", "USERS", ".", "c", ".", "email", ...
Check the combination username/password that is valid on the database.
[ "Check", "the", "combination", "username", "/", "password", "that", "is", "valid", "on", "the", "database", "." ]
python
train
37.933333
gmcguire/django-db-pool
dbpool/db/backends/postgresql_psycopg2/base.py
https://github.com/gmcguire/django-db-pool/blob/d4e0aa6a150fd7bd2024e079cd3b7147ea341e63/dbpool/db/backends/postgresql_psycopg2/base.py#L85-L98
def _set_up_pool_config(self): ''' Helper to configure pool options during DatabaseWrapper initialization. ''' self._max_conns = self.settings_dict['OPTIONS'].get('MAX_CONNS', pool_config_defaults['MAX_CONNS']) self._min_conns = self.settings_dict['OPTIONS'].get('MIN_CONNS', self._max_conns) ...
[ "def", "_set_up_pool_config", "(", "self", ")", ":", "self", ".", "_max_conns", "=", "self", ".", "settings_dict", "[", "'OPTIONS'", "]", ".", "get", "(", "'MAX_CONNS'", ",", "pool_config_defaults", "[", "'MAX_CONNS'", "]", ")", "self", ".", "_min_conns", "=...
Helper to configure pool options during DatabaseWrapper initialization.
[ "Helper", "to", "configure", "pool", "options", "during", "DatabaseWrapper", "initialization", "." ]
python
train
56.571429
h2non/pook
pook/engine.py
https://github.com/h2non/pook/blob/e64094e41e4d89d98d2d29af7608ef27dc50cf19/pook/engine.py#L166-L173
def remove_mock(self, mock): """ Removes a specific mock instance by object reference. Arguments: mock (pook.Mock): mock instance to remove. """ self.mocks = [m for m in self.mocks if m is not mock]
[ "def", "remove_mock", "(", "self", ",", "mock", ")", ":", "self", ".", "mocks", "=", "[", "m", "for", "m", "in", "self", ".", "mocks", "if", "m", "is", "not", "mock", "]" ]
Removes a specific mock instance by object reference. Arguments: mock (pook.Mock): mock instance to remove.
[ "Removes", "a", "specific", "mock", "instance", "by", "object", "reference", "." ]
python
test
30.5
brutus/wdiffhtml
wdiffhtml/utils.py
https://github.com/brutus/wdiffhtml/blob/e97b524a7945f7a626e33ec141343120c524d9fa/wdiffhtml/utils.py#L108-L121
def wrap_content(content, settings, hard_breaks=False): """ Returns *content* wrapped in a HTML structure. If *hard_breaks* is set, line breaks are converted to `<br />` tags. """ settings.context['content'] = wrap_paragraphs(content, hard_breaks) template = Template(settings.template) try: return t...
[ "def", "wrap_content", "(", "content", ",", "settings", ",", "hard_breaks", "=", "False", ")", ":", "settings", ".", "context", "[", "'content'", "]", "=", "wrap_paragraphs", "(", "content", ",", "hard_breaks", ")", "template", "=", "Template", "(", "setting...
Returns *content* wrapped in a HTML structure. If *hard_breaks* is set, line breaks are converted to `<br />` tags.
[ "Returns", "*", "content", "*", "wrapped", "in", "a", "HTML", "structure", "." ]
python
train
32.214286
iamteem/redisco
redisco/containers.py
https://github.com/iamteem/redisco/blob/a7ba19ff3c38061d6d8bc0c10fa754baadcfeb91/redisco/containers.py#L86-L88
def isdisjoint(self, other): """Return True if the set has no elements in common with other.""" return not bool(self.db.sinter([self.key, other.key]))
[ "def", "isdisjoint", "(", "self", ",", "other", ")", ":", "return", "not", "bool", "(", "self", ".", "db", ".", "sinter", "(", "[", "self", ".", "key", ",", "other", ".", "key", "]", ")", ")" ]
Return True if the set has no elements in common with other.
[ "Return", "True", "if", "the", "set", "has", "no", "elements", "in", "common", "with", "other", "." ]
python
train
54.666667
ga4gh/ga4gh-server
ga4gh/server/response_builder.py
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/response_builder.py#L61-L70
def addValue(self, protocolElement): """ Appends the specified protocolElement to the value list for this response. """ self._numElements += 1 self._bufferSize += protocolElement.ByteSize() attr = getattr(self._protoObject, self._valueListName) obj = attr....
[ "def", "addValue", "(", "self", ",", "protocolElement", ")", ":", "self", ".", "_numElements", "+=", "1", "self", ".", "_bufferSize", "+=", "protocolElement", ".", "ByteSize", "(", ")", "attr", "=", "getattr", "(", "self", ".", "_protoObject", ",", "self",...
Appends the specified protocolElement to the value list for this response.
[ "Appends", "the", "specified", "protocolElement", "to", "the", "value", "list", "for", "this", "response", "." ]
python
train
35.4
llazzaro/django-scheduler
schedule/views.py
https://github.com/llazzaro/django-scheduler/blob/0530b74a5fc0b1125645002deaa4da2337ed0f17/schedule/views.py#L251-L274
def get_occurrence(event_id, occurrence_id=None, year=None, month=None, day=None, hour=None, minute=None, second=None, tzinfo=None): """ Because occurrences don't have to be persisted, there must be two ways to retrieve them. both need an event, but if its persisted the...
[ "def", "get_occurrence", "(", "event_id", ",", "occurrence_id", "=", "None", ",", "year", "=", "None", ",", "month", "=", "None", ",", "day", "=", "None", ",", "hour", "=", "None", ",", "minute", "=", "None", ",", "second", "=", "None", ",", "tzinfo"...
Because occurrences don't have to be persisted, there must be two ways to retrieve them. both need an event, but if its persisted the occurrence can be retrieved with an id. If it is not persisted it takes a date to retrieve it. This function returns an event and occurrence regardless of which method i...
[ "Because", "occurrences", "don", "t", "have", "to", "be", "persisted", "there", "must", "be", "two", "ways", "to", "retrieve", "them", ".", "both", "need", "an", "event", "but", "if", "its", "persisted", "the", "occurrence", "can", "be", "retrieved", "with...
python
train
46.041667
mitsei/dlkit
dlkit/json_/repository/objects.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/objects.py#L964-L974
def get_source_metadata(self): """Gets the metadata for the source. return: (osid.Metadata) - metadata for the source *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template m...
[ "def", "get_source_metadata", "(", "self", ")", ":", "# Implemented from template for osid.resource.ResourceForm.get_group_metadata_template", "metadata", "=", "dict", "(", "self", ".", "_mdata", "[", "'source'", "]", ")", "metadata", ".", "update", "(", "{", "'existing...
Gets the metadata for the source. return: (osid.Metadata) - metadata for the source *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "metadata", "for", "the", "source", "." ]
python
train
41.545455
dogoncouch/logdissect
logdissect/utils.py
https://github.com/dogoncouch/logdissect/blob/426b50264cbfa9665c86df3781e1e415ba8dbbd3/logdissect/utils.py#L171-L200
def get_local_tzone(): """Get the current time zone on the local host""" if localtime().tm_isdst: if altzone < 0: tzone = '+' + \ str(int(float(altzone) / 60 // 60)).rjust(2, '0') + \ str(int(float( ...
[ "def", "get_local_tzone", "(", ")", ":", "if", "localtime", "(", ")", ".", "tm_isdst", ":", "if", "altzone", "<", "0", ":", "tzone", "=", "'+'", "+", "str", "(", "int", "(", "float", "(", "altzone", ")", "/", "60", "//", "60", ")", ")", ".", "r...
Get the current time zone on the local host
[ "Get", "the", "current", "time", "zone", "on", "the", "local", "host" ]
python
train
38.133333
numenta/htmresearch
htmresearch/frameworks/thalamus/thalamus.py
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/htmresearch/frameworks/thalamus/thalamus.py#L282-L292
def relayIndextoCoord(self, i): """ Map 1D cell index to a 2D coordinate :param i: integer 1D cell index :return: (x, y), a 2D coordinate """ x = i % self.relayWidth y = i / self.relayWidth return x, y
[ "def", "relayIndextoCoord", "(", "self", ",", "i", ")", ":", "x", "=", "i", "%", "self", ".", "relayWidth", "y", "=", "i", "/", "self", ".", "relayWidth", "return", "x", ",", "y" ]
Map 1D cell index to a 2D coordinate :param i: integer 1D cell index :return: (x, y), a 2D coordinate
[ "Map", "1D", "cell", "index", "to", "a", "2D", "coordinate" ]
python
train
20.454545
DLR-RM/RAFCON
source/rafcon/gui/controllers/utils/tree_view_controller.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/tree_view_controller.py#L647-L721
def tree_view_keypress_callback(self, widget, event): """Tab back and forward tab-key motion in list widget and the scrollbar motion to follow key cursor motions The method introduce motion and edit functionality by using "tab"- or "shift-tab"-key for a Gtk.TreeView. It is designed to work wi...
[ "def", "tree_view_keypress_callback", "(", "self", ",", "widget", ",", "event", ")", ":", "# self._logger.info(\"key_value: \" + str(event.keyval if event is not None else ''))", "if", "event", "and", "\"GDK_KEY_PRESS\"", "==", "event", ".", "type", ".", "value_name", "and"...
Tab back and forward tab-key motion in list widget and the scrollbar motion to follow key cursor motions The method introduce motion and edit functionality by using "tab"- or "shift-tab"-key for a Gtk.TreeView. It is designed to work with a Gtk.TreeView which model is a Gtk.ListStore and only uses te...
[ "Tab", "back", "and", "forward", "tab", "-", "key", "motion", "in", "list", "widget", "and", "the", "scrollbar", "motion", "to", "follow", "key", "cursor", "motions" ]
python
train
57.386667
bitesofcode/projexui
projexui/widgets/xnodewidget/xnodeconnection.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xnodewidget/xnodeconnection.py#L1135-L1150
def prepareToRemove(self): """ Handles any code that needs to run to cleanup the connection \ before it gets removed from the scene. :return <bool> success """ # disconnect the signals from the input and output nodes for node in (self._outputNode, sel...
[ "def", "prepareToRemove", "(", "self", ")", ":", "# disconnect the signals from the input and output nodes", "for", "node", "in", "(", "self", ".", "_outputNode", ",", "self", ".", "_inputNode", ")", ":", "self", ".", "disconnectSignals", "(", "node", ")", "# clea...
Handles any code that needs to run to cleanup the connection \ before it gets removed from the scene. :return <bool> success
[ "Handles", "any", "code", "that", "needs", "to", "run", "to", "cleanup", "the", "connection", "\\", "before", "it", "gets", "removed", "from", "the", "scene", ".", ":", "return", "<bool", ">", "success" ]
python
train
30.4375
numenta/nupic
src/nupic/algorithms/anomaly_likelihood.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/anomaly_likelihood.py#L521-L610
def updateAnomalyLikelihoods(anomalyScores, params, verbosity=0): """ Compute updated probabilities for anomalyScores using the given params. :param anomalyScores: a list of records. Each record is a list with the following three e...
[ "def", "updateAnomalyLikelihoods", "(", "anomalyScores", ",", "params", ",", "verbosity", "=", "0", ")", ":", "if", "verbosity", ">", "3", ":", "print", "(", "\"In updateAnomalyLikelihoods.\"", ")", "print", "(", "\"Number of anomaly scores:\"", ",", "len", "(", ...
Compute updated probabilities for anomalyScores using the given params. :param anomalyScores: a list of records. Each record is a list with the following three elements: [timestamp, value, score] Example:: [datetime.datetime(2013, 8, 10, 2...
[ "Compute", "updated", "probabilities", "for", "anomalyScores", "using", "the", "given", "params", "." ]
python
valid
35.411111
hugapi/hug
hug/use.py
https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/use.py#L53-L55
def request(self, method, url, url_params=empty.dict, headers=empty.dict, timeout=None, **params): """Calls the service at the specified URL using the "CALL" method""" raise NotImplementedError("Concrete services must define the request method")
[ "def", "request", "(", "self", ",", "method", ",", "url", ",", "url_params", "=", "empty", ".", "dict", ",", "headers", "=", "empty", ".", "dict", ",", "timeout", "=", "None", ",", "*", "*", "params", ")", ":", "raise", "NotImplementedError", "(", "\...
Calls the service at the specified URL using the "CALL" method
[ "Calls", "the", "service", "at", "the", "specified", "URL", "using", "the", "CALL", "method" ]
python
train
86.333333
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/icc.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/icc.py#L38-L50
def generate(env): """Add Builders and construction variables for the OS/2 to an Environment.""" cc.generate(env) env['CC'] = 'icc' env['CCCOM'] = '$CC $CFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo$TARGET' env['CXXCOM'] = '$CXX $CXXFLAGS $CPPFLAGS $_CPPDEFF...
[ "def", "generate", "(", "env", ")", ":", "cc", ".", "generate", "(", "env", ")", "env", "[", "'CC'", "]", "=", "'icc'", "env", "[", "'CCCOM'", "]", "=", "'$CC $CFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo$TARGET'", "env", "[", "'CXXCOM'", ...
Add Builders and construction variables for the OS/2 to an Environment.
[ "Add", "Builders", "and", "construction", "variables", "for", "the", "OS", "/", "2", "to", "an", "Environment", "." ]
python
train
40.846154
edeposit/edeposit.amqp.pdfgen
src/edeposit/amqp/pdfgen/specialization.py
https://github.com/edeposit/edeposit.amqp.pdfgen/blob/1022d6d01196f4928d664a71e49273c2d8c67e63/src/edeposit/amqp/pdfgen/specialization.py#L43-L85
def get_contract(firma, pravni_forma, sidlo, ic, dic, zastoupen): """ Compose contract and create PDF. Args: firma (str): firma pravni_forma (str): pravni_forma sidlo (str): sidlo ic (str): ic dic (str): dic zastoupen (str): zastoupen Returns: ob...
[ "def", "get_contract", "(", "firma", ",", "pravni_forma", ",", "sidlo", ",", "ic", ",", "dic", ",", "zastoupen", ")", ":", "contract_fn", "=", "_resource_context", "(", "\"Licencni_smlouva_o_dodavani_elektronickych_publikaci\"", "\"_a_jejich_uziti.rst\"", ")", "# load c...
Compose contract and create PDF. Args: firma (str): firma pravni_forma (str): pravni_forma sidlo (str): sidlo ic (str): ic dic (str): dic zastoupen (str): zastoupen Returns: obj: StringIO file instance containing PDF file.
[ "Compose", "contract", "and", "create", "PDF", "." ]
python
train
25.465116
shrubberysoft/django-future
src/django_future/models.py
https://github.com/shrubberysoft/django-future/blob/5e19f68fc5a5e1c00297222067697182c7ecd94a/src/django_future/models.py#L79-L98
def reschedule(self, date, callable_name=None, content_object=None, expires='7d', args=None, kwargs=None): """Schedule a clone of this job.""" # Resolve date relative to the expected start of the current job. if isinstance(date, basestring): date = parse_timedelta(...
[ "def", "reschedule", "(", "self", ",", "date", ",", "callable_name", "=", "None", ",", "content_object", "=", "None", ",", "expires", "=", "'7d'", ",", "args", "=", "None", ",", "kwargs", "=", "None", ")", ":", "# Resolve date relative to the expected start of...
Schedule a clone of this job.
[ "Schedule", "a", "clone", "of", "this", "job", "." ]
python
train
44.6
graphql-python/graphql-core-next
graphql/pyutils/suggestion_list.py
https://github.com/graphql-python/graphql-core-next/blob/073dce3f002f897d40f9348ffd8f107815160540/graphql/pyutils/suggestion_list.py#L6-L21
def suggestion_list(input_: str, options: Collection[str]): """Get list with suggestions for a given input. Given an invalid input string and list of valid options, returns a filtered list of valid options sorted based on their similarity with the input. """ options_by_distance = {} input_thres...
[ "def", "suggestion_list", "(", "input_", ":", "str", ",", "options", ":", "Collection", "[", "str", "]", ")", ":", "options_by_distance", "=", "{", "}", "input_threshold", "=", "len", "(", "input_", ")", "//", "2", "for", "option", "in", "options", ":", ...
Get list with suggestions for a given input. Given an invalid input string and list of valid options, returns a filtered list of valid options sorted based on their similarity with the input.
[ "Get", "list", "with", "suggestions", "for", "a", "given", "input", "." ]
python
train
39
gebn/nibble
nibble/expression/lexer.py
https://github.com/gebn/nibble/blob/e82a2c43509ed38f3d039040591cc630fa676cb0/nibble/expression/lexer.py#L47-L63
def t_ID(self, t): r'[a-zA-Z]+' if t.value in self._RESERVED.keys(): t.type = self._RESERVED[t.value] return t if Information.is_valid_symbol(t.value) or \ Information.is_valid_category(t.value): t.type = self._INFORMATION_UNIT ret...
[ "def", "t_ID", "(", "self", ",", "t", ")", ":", "if", "t", ".", "value", "in", "self", ".", "_RESERVED", ".", "keys", "(", ")", ":", "t", ".", "type", "=", "self", ".", "_RESERVED", "[", "t", ".", "value", "]", "return", "t", "if", "Information...
r'[a-zA-Z]+
[ "r", "[", "a", "-", "zA", "-", "Z", "]", "+" ]
python
train
32.411765
eventbrite/eventbrite-sdk-python
eventbrite/access_methods.py
https://github.com/eventbrite/eventbrite-sdk-python/blob/f2e5dc5aa1aa3e45766de13f16fd65722163d91a/eventbrite/access_methods.py#L776-L782
def get_user_events(self, id, **data): """ GET /users/:id/events/ Returns a :ref:`paginated <pagination>` response of :format:`events <event>`, under the key ``events``, of all events the user has access to """ return self.get("/users/{0}/events/".format(id), data=data)
[ "def", "get_user_events", "(", "self", ",", "id", ",", "*", "*", "data", ")", ":", "return", "self", ".", "get", "(", "\"/users/{0}/events/\"", ".", "format", "(", "id", ")", ",", "data", "=", "data", ")" ]
GET /users/:id/events/ Returns a :ref:`paginated <pagination>` response of :format:`events <event>`, under the key ``events``, of all events the user has access to
[ "GET", "/", "users", "/", ":", "id", "/", "events", "/", "Returns", "a", ":", "ref", ":", "paginated", "<pagination", ">", "response", "of", ":", "format", ":", "events", "<event", ">", "under", "the", "key", "events", "of", "all", "events", "the", "...
python
train
44.714286
rameshg87/pyremotevbox
pyremotevbox/ZSI/writer.py
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/writer.py#L59-L81
def serialize_header(self, pyobj, typecode=None, **kw): '''Serialize a Python object in SOAP-ENV:Header, make sure everything in Header unique (no #href). Must call serialize first to create a document. Parameters: pyobjs -- instances to serialize in SOAP Header ...
[ "def", "serialize_header", "(", "self", ",", "pyobj", ",", "typecode", "=", "None", ",", "*", "*", "kw", ")", ":", "kw", "[", "'unique'", "]", "=", "True", "soap_env", "=", "_reserved_ns", "[", "'SOAP-ENV'", "]", "#header = self.dom.getElement(soap_env, 'Heade...
Serialize a Python object in SOAP-ENV:Header, make sure everything in Header unique (no #href). Must call serialize first to create a document. Parameters: pyobjs -- instances to serialize in SOAP Header typecode -- default typecode
[ "Serialize", "a", "Python", "object", "in", "SOAP", "-", "ENV", ":", "Header", "make", "sure", "everything", "in", "Header", "unique", "(", "no", "#href", ")", ".", "Must", "call", "serialize", "first", "to", "create", "a", "document", "." ]
python
train
40.434783
djgagne/hagelslag
hagelslag/processing/ObjectMatcher.py
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/ObjectMatcher.py#L190-L224
def match(self, set_a, set_b): """ For each step in each track from set_a, identify all steps in all tracks from set_b that meet all cost function criteria Args: set_a: List of STObjects set_b: List of STObjects Returns: track_pairing...
[ "def", "match", "(", "self", ",", "set_a", ",", "set_b", ")", ":", "track_step_matches", "=", "[", "[", "]", "*", "len", "(", "set_a", ")", "]", "costs", "=", "self", ".", "cost_matrix", "(", "set_a", ",", "set_b", ")", "valid_costs", "=", "np", "....
For each step in each track from set_a, identify all steps in all tracks from set_b that meet all cost function criteria Args: set_a: List of STObjects set_b: List of STObjects Returns: track_pairings: pandas.DataFrame
[ "For", "each", "step", "in", "each", "track", "from", "set_a", "identify", "all", "steps", "in", "all", "tracks", "from", "set_b", "that", "meet", "all", "cost", "function", "criteria", "Args", ":", "set_a", ":", "List", "of", "STObjects", "set_b", ":", ...
python
train
43.771429
napalm-automation/napalm-junos
napalm_junos/junos.py
https://github.com/napalm-automation/napalm-junos/blob/78c0d161daf2abf26af5835b773f6db57c46efff/napalm_junos/junos.py#L244-L248
def discard_config(self): """Discard changes (rollback 0).""" self.device.cu.rollback(rb_id=0) if not self.config_lock: self._unlock()
[ "def", "discard_config", "(", "self", ")", ":", "self", ".", "device", ".", "cu", ".", "rollback", "(", "rb_id", "=", "0", ")", "if", "not", "self", ".", "config_lock", ":", "self", ".", "_unlock", "(", ")" ]
Discard changes (rollback 0).
[ "Discard", "changes", "(", "rollback", "0", ")", "." ]
python
train
33.2
olitheolix/qtmacs
qtmacs/logging_handler.py
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/logging_handler.py#L127-L165
def fetch(self, start=None, stop=None): """ Fetch log records and return them as a list. |Args| * ``start`` (**int**): non-negative index of the first log record to return. * ``stop`` (**int**): non-negative index of the last log record to return. ...
[ "def", "fetch", "(", "self", ",", "start", "=", "None", ",", "stop", "=", "None", ")", ":", "# Set defaults if no explicit indices were provided.", "if", "not", "start", ":", "start", "=", "0", "if", "not", "stop", ":", "stop", "=", "len", "(", "self", "...
Fetch log records and return them as a list. |Args| * ``start`` (**int**): non-negative index of the first log record to return. * ``stop`` (**int**): non-negative index of the last log record to return. |Returns| * **list**: list of log records (see ``lo...
[ "Fetch", "log", "records", "and", "return", "them", "as", "a", "list", "." ]
python
train
25.538462
zaturox/glin
glin/app.py
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/app.py#L283-L287
def publish_scene_remove(self, scene_id): """publish the removal of a scene""" self.sequence_number += 1 self.publisher.send_multipart(msgs.MessageBuilder.scene_remove(self.sequence_number, scene_id)) return self.sequence_number
[ "def", "publish_scene_remove", "(", "self", ",", "scene_id", ")", ":", "self", ".", "sequence_number", "+=", "1", "self", ".", "publisher", ".", "send_multipart", "(", "msgs", ".", "MessageBuilder", ".", "scene_remove", "(", "self", ".", "sequence_number", ","...
publish the removal of a scene
[ "publish", "the", "removal", "of", "a", "scene" ]
python
train
51.2
casouri/launchdman
launchdman/__init__.py
https://github.com/casouri/launchdman/blob/c83840e640cb075fab2534049f1e25fac6933c64/launchdman/__init__.py#L309-L319
def add(self, *value): '''convert value and add to self.value Subclass must overwrite this method. Subclass are responsible of creating whatever single instance it need from its ``add(*value)`` and call ``_add()`` to add them to ``self.value`` Args: *value: the value to be ...
[ "def", "add", "(", "self", ",", "*", "value", ")", ":", "flattenedValueList", "=", "list", "(", "flatten", "(", "value", ")", ")", "return", "self", ".", "_add", "(", "flattenedValueList", ",", "self", ".", "value", ")" ]
convert value and add to self.value Subclass must overwrite this method. Subclass are responsible of creating whatever single instance it need from its ``add(*value)`` and call ``_add()`` to add them to ``self.value`` Args: *value: the value to be added
[ "convert", "value", "and", "add", "to", "self", ".", "value" ]
python
train
39.454545
cuducos/getgist
getgist/local.py
https://github.com/cuducos/getgist/blob/c70a0a9353eca43360b82c759d1e1514ec265d3b/getgist/local.py#L43-L53
def backup(self): """Backups files with the same name of the instance filename""" count = 0 name = "{}.bkp".format(self.filename) backup = os.path.join(self.cwd, name) while os.path.exists(backup): count += 1 name = "{}.bkp{}".format(self.filename, count) ...
[ "def", "backup", "(", "self", ")", ":", "count", "=", "0", "name", "=", "\"{}.bkp\"", ".", "format", "(", "self", ".", "filename", ")", "backup", "=", "os", ".", "path", ".", "join", "(", "self", ".", "cwd", ",", "name", ")", "while", "os", ".", ...
Backups files with the same name of the instance filename
[ "Backups", "files", "with", "the", "same", "name", "of", "the", "instance", "filename" ]
python
train
45.181818