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
ska-sa/purr
Purr/MainWindow.py
https://github.com/ska-sa/purr/blob/4c848768d0485d0f88b30850d0d5372221b21b66/Purr/MainWindow.py#L815-L829
def _showItemContextMenu(self, item, point, col): """Callback for contextMenuRequested() signal. Pops up item menu, if defined""" menu = getattr(item, '_menu', None) if menu: settitle = getattr(item, '_set_menu_title', None) if settitle: settitle() ...
[ "def", "_showItemContextMenu", "(", "self", ",", "item", ",", "point", ",", "col", ")", ":", "menu", "=", "getattr", "(", "item", ",", "'_menu'", ",", "None", ")", "if", "menu", ":", "settitle", "=", "getattr", "(", "item", ",", "'_set_menu_title'", ",...
Callback for contextMenuRequested() signal. Pops up item menu, if defined
[ "Callback", "for", "contextMenuRequested", "()", "signal", ".", "Pops", "up", "item", "menu", "if", "defined" ]
python
train
42.533333
jut-io/jut-python-tools
jut/common.py
https://github.com/jut-io/jut-python-tools/blob/65574d23f51a7bbced9bb25010d02da5ca5d906f/jut/common.py#L9-L24
def info(message, *args, **kwargs): """ write a message to stdout """ if 'end' in kwargs: end = kwargs['end'] else: end = '\n' if len(args) == 0: sys.stdout.write(message) else: sys.stdout.write(message % args) sys.stdout.write(end) sys.stdout.flush(...
[ "def", "info", "(", "message", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "'end'", "in", "kwargs", ":", "end", "=", "kwargs", "[", "'end'", "]", "else", ":", "end", "=", "'\\n'", "if", "len", "(", "args", ")", "==", "0", ":", ...
write a message to stdout
[ "write", "a", "message", "to", "stdout" ]
python
train
19.125
jerith/txTwitter
txtwitter/twitter.py
https://github.com/jerith/txTwitter/blob/f07afd21184cd1bee697737bf98fd143378dbdff/txtwitter/twitter.py#L986-L1005
def friendships_destroy(self, user_id=None, screen_name=None): """ Allows the authenticating user to unfollow the specified user. https://dev.twitter.com/docs/api/1.1/post/friendships/destroy :param str user_id: The screen name of the user for whom to unfollow. Required if ...
[ "def", "friendships_destroy", "(", "self", ",", "user_id", "=", "None", ",", "screen_name", "=", "None", ")", ":", "params", "=", "{", "}", "set_str_param", "(", "params", ",", "'user_id'", ",", "user_id", ")", "set_str_param", "(", "params", ",", "'screen...
Allows the authenticating user to unfollow the specified user. https://dev.twitter.com/docs/api/1.1/post/friendships/destroy :param str user_id: The screen name of the user for whom to unfollow. Required if ``screen_name`` isn't given. :param str screen_name: ...
[ "Allows", "the", "authenticating", "user", "to", "unfollow", "the", "specified", "user", "." ]
python
train
37.85
saltstack/salt
salt/transport/frame.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/transport/frame.py#L24-L40
def frame_msg_ipc(body, header=None, raw_body=False): # pylint: disable=unused-argument ''' Frame the given message with our wire protocol for IPC For IPC, we don't need to be backwards compatible, so use the more efficient "use_bin_type=True" on Python 3. ''' framed_msg = {} if header is ...
[ "def", "frame_msg_ipc", "(", "body", ",", "header", "=", "None", ",", "raw_body", "=", "False", ")", ":", "# pylint: disable=unused-argument", "framed_msg", "=", "{", "}", "if", "header", "is", "None", ":", "header", "=", "{", "}", "framed_msg", "[", "'hea...
Frame the given message with our wire protocol for IPC For IPC, we don't need to be backwards compatible, so use the more efficient "use_bin_type=True" on Python 3.
[ "Frame", "the", "given", "message", "with", "our", "wire", "protocol", "for", "IPC" ]
python
train
31.823529
MSchnei/pyprf_feature
pyprf_feature/analysis/old/pRF_calcR2_getBetas.py
https://github.com/MSchnei/pyprf_feature/blob/49004ede7ae1ddee07a30afe9ce3e2776750805c/pyprf_feature/analysis/old/pRF_calcR2_getBetas.py#L25-L359
def getBetas(idxPrc, aryPrfTc, lstAllMdlInd, aryFuncChnk, aryBstIndChnk, betaSw, queOut): """Calculate voxel betas and R^2 for the best model. Parameters ---------- idxPrc : TODO (?) aryPrfTc : np.array, shape (?)...
[ "def", "getBetas", "(", "idxPrc", ",", "aryPrfTc", ",", "lstAllMdlInd", ",", "aryFuncChnk", ",", "aryBstIndChnk", ",", "betaSw", ",", "queOut", ")", ":", "# get number of motion directions", "varNumMtnDrctns", "=", "aryPrfTc", ".", "shape", "[", "3", "]", "varNu...
Calculate voxel betas and R^2 for the best model. Parameters ---------- idxPrc : TODO (?) aryPrfTc : np.array, shape (?) Population receptive field time courses. lstAllMdlInd : list List of the indices of all models. aryFuncChnk : TODO Chunk of something(?) a...
[ "Calculate", "voxel", "betas", "and", "R^2", "for", "the", "best", "model", "." ]
python
train
42.889552
saltstack/salt
salt/utils/pkg/rpm.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/rpm.py#L98-L123
def parse_pkginfo(line, osarch=None): ''' A small helper to parse an rpm/repoquery command's output. Returns a pkginfo namedtuple. ''' try: name, epoch, version, release, arch, repoid, install_time = line.split('_|-') # Handle unpack errors (should never happen with the queryformat we ar...
[ "def", "parse_pkginfo", "(", "line", ",", "osarch", "=", "None", ")", ":", "try", ":", "name", ",", "epoch", ",", "version", ",", "release", ",", "arch", ",", "repoid", ",", "install_time", "=", "line", ".", "split", "(", "'_|-'", ")", "# Handle unpack...
A small helper to parse an rpm/repoquery command's output. Returns a pkginfo namedtuple.
[ "A", "small", "helper", "to", "parse", "an", "rpm", "/", "repoquery", "command", "s", "output", ".", "Returns", "a", "pkginfo", "namedtuple", "." ]
python
train
35.115385
aaugustin/websockets
src/websockets/exceptions.py
https://github.com/aaugustin/websockets/blob/17b3f47549b6f752a1be07fa1ba3037cb59c7d56/src/websockets/exceptions.py#L202-L221
def format_close(code: int, reason: str) -> str: """ Display a human-readable version of the close code and reason. """ if 3000 <= code < 4000: explanation = "registered" elif 4000 <= code < 5000: explanation = "private use" else: explanation = CLOSE_CODES.get(code, "un...
[ "def", "format_close", "(", "code", ":", "int", ",", "reason", ":", "str", ")", "->", "str", ":", "if", "3000", "<=", "code", "<", "4000", ":", "explanation", "=", "\"registered\"", "elif", "4000", "<=", "code", "<", "5000", ":", "explanation", "=", ...
Display a human-readable version of the close code and reason.
[ "Display", "a", "human", "-", "readable", "version", "of", "the", "close", "code", "and", "reason", "." ]
python
train
23.5
datastax/python-driver
cassandra/cqlengine/statements.py
https://github.com/datastax/python-driver/blob/30a80d0b798b1f45f8cb77163b1fa791f3e3ca29/cassandra/cqlengine/statements.py#L544-L552
def get_context(self): """ returns the context dict for this statement :rtype: dict """ ctx = {} for clause in self.where_clauses or []: clause.update_context(ctx) return ctx
[ "def", "get_context", "(", "self", ")", ":", "ctx", "=", "{", "}", "for", "clause", "in", "self", ".", "where_clauses", "or", "[", "]", ":", "clause", ".", "update_context", "(", "ctx", ")", "return", "ctx" ]
returns the context dict for this statement :rtype: dict
[ "returns", "the", "context", "dict", "for", "this", "statement", ":", "rtype", ":", "dict" ]
python
train
26
gouthambs/Flask-Blogging
flask_blogging/sqlastorage.py
https://github.com/gouthambs/Flask-Blogging/blob/6636b8941175e9910f116a329521f96b8b05a9ac/flask_blogging/sqlastorage.py#L516-L524
def _create_all_tables(self): """ Creates all the required tables by calling the required functions. :return: """ self._create_post_table() self._create_tag_table() self._create_tag_posts_table() self._create_user_posts_table()
[ "def", "_create_all_tables", "(", "self", ")", ":", "self", ".", "_create_post_table", "(", ")", "self", ".", "_create_tag_table", "(", ")", "self", ".", "_create_tag_posts_table", "(", ")", "self", ".", "_create_user_posts_table", "(", ")" ]
Creates all the required tables by calling the required functions. :return:
[ "Creates", "all", "the", "required", "tables", "by", "calling", "the", "required", "functions", ".", ":", "return", ":" ]
python
train
31.444444
rosenbrockc/fortpy
fortpy/interop/ftypes.py
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L488-L513
def _process_module_needs(self, modules): """Adds the module and its dependencies to the result list in dependency order.""" result = list(modules) for i, module in enumerate(modules): #It is possible that the parser couldn't find it, if so #we can't create the executable...
[ "def", "_process_module_needs", "(", "self", ",", "modules", ")", ":", "result", "=", "list", "(", "modules", ")", "for", "i", ",", "module", "in", "enumerate", "(", "modules", ")", ":", "#It is possible that the parser couldn't find it, if so", "#we can't create th...
Adds the module and its dependencies to the result list in dependency order.
[ "Adds", "the", "module", "and", "its", "dependencies", "to", "the", "result", "list", "in", "dependency", "order", "." ]
python
train
45.692308
karan/TPB
tpb/tpb.py
https://github.com/karan/TPB/blob/f424a73a10d4bcf4e363d7e7e8cb915a3a057671/tpb/tpb.py#L390-L407
def print_torrent(self): """ Print the details of a torrent """ print('Title: %s' % self.title) print('URL: %s' % self.url) print('Category: %s' % self.category) print('Sub-Category: %s' % self.sub_category) print('Magnet Link: %s' % self.magnet_link) ...
[ "def", "print_torrent", "(", "self", ")", ":", "print", "(", "'Title: %s'", "%", "self", ".", "title", ")", "print", "(", "'URL: %s'", "%", "self", ".", "url", ")", "print", "(", "'Category: %s'", "%", "self", ".", "category", ")", "print", "(", "'Sub-...
Print the details of a torrent
[ "Print", "the", "details", "of", "a", "torrent" ]
python
train
39.722222
linkedin/shiv
src/shiv/pip.py
https://github.com/linkedin/shiv/blob/6bda78676170b35d0877f67b71095c39ce41a74a/src/shiv/pip.py#L31-L67
def install(args: List[str]) -> None: """`pip install` as a function. Accepts a list of pip arguments. .. code-block:: py >>> install(['numpy', '--target', 'site-packages']) Collecting numpy Downloading numpy-1.13.3-cp35-cp35m-manylinux1_x86_64.whl (16.9MB) 100% || 16....
[ "def", "install", "(", "args", ":", "List", "[", "str", "]", ")", "->", "None", ":", "with", "clean_pip_env", "(", ")", ":", "# if being invoked as a pyz, we must ensure we have access to our own", "# site-packages when subprocessing since there is no guarantee that pip", "# ...
`pip install` as a function. Accepts a list of pip arguments. .. code-block:: py >>> install(['numpy', '--target', 'site-packages']) Collecting numpy Downloading numpy-1.13.3-cp35-cp35m-manylinux1_x86_64.whl (16.9MB) 100% || 16.9MB 53kB/s Installing collected packa...
[ "pip", "install", "as", "a", "function", "." ]
python
train
32.351351
ncmiller/roku-cli
rokucli/discover.py
https://github.com/ncmiller/roku-cli/blob/9101952edf9802146c794e63353abf2bf116c052/rokucli/discover.py#L6-L42
def discover_roku(): """ Search LAN for available Roku devices. Returns a Roku object. """ print("Searching for Roku devices within LAN ...") rokus = Roku.discover() if not rokus: print("Unable to discover Roku devices. " + "Try again, or manually specify the IP address with " + ...
[ "def", "discover_roku", "(", ")", ":", "print", "(", "\"Searching for Roku devices within LAN ...\"", ")", "rokus", "=", "Roku", ".", "discover", "(", ")", "if", "not", "rokus", ":", "print", "(", "\"Unable to discover Roku devices. \"", "+", "\"Try again, or manually...
Search LAN for available Roku devices. Returns a Roku object.
[ "Search", "LAN", "for", "available", "Roku", "devices", ".", "Returns", "a", "Roku", "object", "." ]
python
train
32.810811
xtrementl/focus
focus/plugin/registration.py
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/registration.py#L206-L256
def get_registered(option_hooks=None, event_hooks=None, command_hooks=None, root_access=None, task_active=True): """ Returns a generator of registered plugins matching filters. `option_hooks` Boolean to include or exclude plugins using option hooks. ...
[ "def", "get_registered", "(", "option_hooks", "=", "None", ",", "event_hooks", "=", "None", ",", "command_hooks", "=", "None", ",", "root_access", "=", "None", ",", "task_active", "=", "True", ")", ":", "plugins", "=", "[", "]", "for", "_", ",", "item", ...
Returns a generator of registered plugins matching filters. `option_hooks` Boolean to include or exclude plugins using option hooks. `event_hooks` Boolean to include or exclude task event plugins. `command_hooks` Boolean to include or exclude command plugins....
[ "Returns", "a", "generator", "of", "registered", "plugins", "matching", "filters", "." ]
python
train
29.509804
PyCQA/pydocstyle
src/pydocstyle/parser.py
https://github.com/PyCQA/pydocstyle/blob/2549847f9efad225789f931e83dfe782418ca13e/src/pydocstyle/parser.py#L511-L560
def parse_definition(self, class_): """Parse a definition and return its value in a `class_` object.""" start = self.line self.consume(tk.NAME) name = self.current.value self.log.debug("parsing %s '%s'", class_.__name__, name) self.stream.move() if self.current.ki...
[ "def", "parse_definition", "(", "self", ",", "class_", ")", ":", "start", "=", "self", ".", "line", "self", ".", "consume", "(", "tk", ".", "NAME", ")", "name", "=", "self", ".", "current", ".", "value", "self", ".", "log", ".", "debug", "(", "\"pa...
Parse a definition and return its value in a `class_` object.
[ "Parse", "a", "definition", "and", "return", "its", "value", "in", "a", "class_", "object", "." ]
python
train
44.78
juicer/juicer
juicer/utils/texttable.py
https://github.com/juicer/juicer/blob/0c9f0fd59e293d45df6b46e81f675d33221c600d/juicer/utils/texttable.py#L399-L406
def _check_align(self): """Check if alignment has been specified, set default one if not """ if not hasattr(self, "_align"): self._align = ["l"]*self._row_size if not hasattr(self, "_valign"): self._valign = ["t"]*self._row_size
[ "def", "_check_align", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "\"_align\"", ")", ":", "self", ".", "_align", "=", "[", "\"l\"", "]", "*", "self", ".", "_row_size", "if", "not", "hasattr", "(", "self", ",", "\"_valign\"", ")"...
Check if alignment has been specified, set default one if not
[ "Check", "if", "alignment", "has", "been", "specified", "set", "default", "one", "if", "not" ]
python
train
34.75
rhayes777/PyAutoFit
autofit/tools/fit_util.py
https://github.com/rhayes777/PyAutoFit/blob/a9e6144abb08edfc6a6906c4030d7119bf8d3e14/autofit/tools/fit_util.py#L56-L69
def noise_normalization_from_noise_map_and_mask(noise_map, mask): """Compute the noise-map normalization terms of a list of masked 1D noise-maps, summing the noise_map vale in every pixel as: [Noise_Term] = sum(log(2*pi*[Noise]**2.0)) Parameters ---------- noise_map : np.ndarray The ma...
[ "def", "noise_normalization_from_noise_map_and_mask", "(", "noise_map", ",", "mask", ")", ":", "return", "np", ".", "sum", "(", "np", ".", "log", "(", "2", "*", "np", ".", "pi", "*", "noise_map", "[", "np", ".", "asarray", "(", "mask", ")", "==", "0", ...
Compute the noise-map normalization terms of a list of masked 1D noise-maps, summing the noise_map vale in every pixel as: [Noise_Term] = sum(log(2*pi*[Noise]**2.0)) Parameters ---------- noise_map : np.ndarray The masked noise-map of the observed data. mask : np.ndarray The ma...
[ "Compute", "the", "noise", "-", "map", "normalization", "terms", "of", "a", "list", "of", "masked", "1D", "noise", "-", "maps", "summing", "the", "noise_map", "vale", "in", "every", "pixel", "as", ":" ]
python
train
39.285714
okpy/ok-client
client/utils/guidance.py
https://github.com/okpy/ok-client/blob/517f57dd76284af40ba9766e42d9222b644afd9c/client/utils/guidance.py#L132-L319
def show_guidance_msg(self, unique_id, input_lines, hash_key, guidance_flag=False): """ Based on the student's answer (input_lines), we grab each associated message if its corresponding misunderstanding's count is above the threshold """ if self.load_err...
[ "def", "show_guidance_msg", "(", "self", ",", "unique_id", ",", "input_lines", ",", "hash_key", ",", "guidance_flag", "=", "False", ")", ":", "if", "self", ".", "load_error", ":", "print", "(", "GUIDANCE_DEFAULT_MSG", ")", "return", "EMPTY_MISUCOUNT_TGID_PRNTEDMSG...
Based on the student's answer (input_lines), we grab each associated message if its corresponding misunderstanding's count is above the threshold
[ "Based", "on", "the", "student", "s", "answer", "(", "input_lines", ")", "we", "grab", "each", "associated", "message", "if", "its", "corresponding", "misunderstanding", "s", "count", "is", "above", "the", "threshold" ]
python
train
46.670213
pantsbuild/pants
contrib/node/src/python/pants/contrib/node/subsystems/node_distribution.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/contrib/node/src/python/pants/contrib/node/subsystems/node_distribution.py#L174-L207
def eslint_supportdir(self, task_workdir): """ Returns the path where the ESLint is bootstrapped. :param string task_workdir: The task's working directory :returns: The path where ESLint is bootstrapped and whether or not it is configured :rtype: (string, bool) """ bootstrapped_support_path = o...
[ "def", "eslint_supportdir", "(", "self", ",", "task_workdir", ")", ":", "bootstrapped_support_path", "=", "os", ".", "path", ".", "join", "(", "task_workdir", ",", "'eslint'", ")", "# TODO(nsaechao): Should only have to check if the \"eslint\" dir exists in the task_workdir",...
Returns the path where the ESLint is bootstrapped. :param string task_workdir: The task's working directory :returns: The path where ESLint is bootstrapped and whether or not it is configured :rtype: (string, bool)
[ "Returns", "the", "path", "where", "the", "ESLint", "is", "bootstrapped", "." ]
python
train
42.5
biolink/ontobio
ontobio/util/scigraph_util.py
https://github.com/biolink/ontobio/blob/4e512a7831cfe6bc1b32f2c3be2ba41bc5cf7345/ontobio/util/scigraph_util.py#L168-L179
def get_curie_map(url): """ Get CURIE prefix map from SciGraph cypher/curies endpoint """ curie_map = {} response = requests.get(url) if response.status_code == 200: curie_map = response.json() else: curie_map = {} return curie_map
[ "def", "get_curie_map", "(", "url", ")", ":", "curie_map", "=", "{", "}", "response", "=", "requests", ".", "get", "(", "url", ")", "if", "response", ".", "status_code", "==", "200", ":", "curie_map", "=", "response", ".", "json", "(", ")", "else", "...
Get CURIE prefix map from SciGraph cypher/curies endpoint
[ "Get", "CURIE", "prefix", "map", "from", "SciGraph", "cypher", "/", "curies", "endpoint" ]
python
train
22.416667
cdgriffith/Reusables
reusables/web.py
https://github.com/cdgriffith/Reusables/blob/bc32f72e4baee7d76a6d58b88fcb23dd635155cd/reusables/web.py#L31-L93
def download(url, save_to_file=True, save_dir=".", filename=None, block_size=64000, overwrite=False, quiet=False): """ Download a given URL to either file or memory :param url: Full url (with protocol) of path to download :param save_to_file: boolean if it should be saved to file or not ...
[ "def", "download", "(", "url", ",", "save_to_file", "=", "True", ",", "save_dir", "=", "\".\"", ",", "filename", "=", "None", ",", "block_size", "=", "64000", ",", "overwrite", "=", "False", ",", "quiet", "=", "False", ")", ":", "if", "save_to_file", "...
Download a given URL to either file or memory :param url: Full url (with protocol) of path to download :param save_to_file: boolean if it should be saved to file or not :param save_dir: location of saved file, default is current working dir :param filename: filename to save as :param block_size: do...
[ "Download", "a", "given", "URL", "to", "either", "file", "or", "memory" ]
python
train
37.666667
suds-community/suds
suds/xsd/sxbasic.py
https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/xsd/sxbasic.py#L587-L598
def __download(self, url, loaded_schemata, options): """Download the schema.""" try: reader = DocumentReader(options) d = reader.open(url) root = d.root() root.set("url", url) return self.schema.instance(root, url, loaded_schemata, options) ...
[ "def", "__download", "(", "self", ",", "url", ",", "loaded_schemata", ",", "options", ")", ":", "try", ":", "reader", "=", "DocumentReader", "(", "options", ")", "d", "=", "reader", ".", "open", "(", "url", ")", "root", "=", "d", ".", "root", "(", ...
Download the schema.
[ "Download", "the", "schema", "." ]
python
train
42.083333
sassoftware/saspy
saspy/sasproccommons.py
https://github.com/sassoftware/saspy/blob/e433f71990f249d3a6c3db323ceb11cb2d462cf9/saspy/sasproccommons.py#L458-L514
def _target_stmt(self, stmt: object) -> tuple: """ takes the target key from kwargs and processes it to aid in the generation of a model statement :param stmt: str, list, or dict that contains the model information. :return: tuple of strings one for the class statement one for the model ...
[ "def", "_target_stmt", "(", "self", ",", "stmt", ":", "object", ")", "->", "tuple", ":", "# make sure target is a single variable extra split to account for level= option", "code", "=", "''", "cls", "=", "''", "if", "isinstance", "(", "stmt", ",", "str", ")", ":",...
takes the target key from kwargs and processes it to aid in the generation of a model statement :param stmt: str, list, or dict that contains the model information. :return: tuple of strings one for the class statement one for the model statements
[ "takes", "the", "target", "key", "from", "kwargs", "and", "processes", "it", "to", "aid", "in", "the", "generation", "of", "a", "model", "statement", ":", "param", "stmt", ":", "str", "list", "or", "dict", "that", "contains", "the", "model", "information",...
python
train
46.210526
Azure/azure-sdk-for-python
azure-mgmt-redis/azure/mgmt/redis/operations/redis_operations.py
https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-mgmt-redis/azure/mgmt/redis/operations/redis_operations.py#L864-L908
def import_data( self, resource_group_name, name, files, format=None, custom_headers=None, raw=False, polling=True, **operation_config): """Import data into Redis cache. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param name: T...
[ "def", "import_data", "(", "self", ",", "resource_group_name", ",", "name", ",", "files", ",", "format", "=", "None", ",", "custom_headers", "=", "None", ",", "raw", "=", "False", ",", "polling", "=", "True", ",", "*", "*", "operation_config", ")", ":", ...
Import data into Redis cache. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param name: The name of the Redis cache. :type name: str :param files: files to import. :type files: list[str] :param format: File format. ...
[ "Import", "data", "into", "Redis", "cache", "." ]
python
test
45.8
ebu/PlugIt
plugit/api.py
https://github.com/ebu/PlugIt/blob/de5f1e870f67caaef7a4a58e4bb1ed54d9c5dc53/plugit/api.py#L49-L55
def get_subscription_labels(self, userPk): """Returns a list with all the labels the user is subscribed to""" r = self._request('subscriptions/' + str(userPk)) if r: s = r.json() return s return []
[ "def", "get_subscription_labels", "(", "self", ",", "userPk", ")", ":", "r", "=", "self", ".", "_request", "(", "'subscriptions/'", "+", "str", "(", "userPk", ")", ")", "if", "r", ":", "s", "=", "r", ".", "json", "(", ")", "return", "s", "return", ...
Returns a list with all the labels the user is subscribed to
[ "Returns", "a", "list", "with", "all", "the", "labels", "the", "user", "is", "subscribed", "to" ]
python
train
35.285714
ghukill/pyfc4
pyfc4/models.py
https://github.com/ghukill/pyfc4/blob/59011df592f08978c4a901a908862d112a5dcf02/pyfc4/models.py#L105-L138
def parse_uri(self, uri=None): ''' parses and cleans up possible uri inputs, return instance of rdflib.term.URIRef Args: uri (rdflib.term.URIRef,str): input URI Returns: rdflib.term.URIRef ''' # no uri provided, assume root if not uri: return rdflib.term.URIRef(self.root) # string uri prov...
[ "def", "parse_uri", "(", "self", ",", "uri", "=", "None", ")", ":", "# no uri provided, assume root", "if", "not", "uri", ":", "return", "rdflib", ".", "term", ".", "URIRef", "(", "self", ".", "root", ")", "# string uri provided", "elif", "type", "(", "uri...
parses and cleans up possible uri inputs, return instance of rdflib.term.URIRef Args: uri (rdflib.term.URIRef,str): input URI Returns: rdflib.term.URIRef
[ "parses", "and", "cleans", "up", "possible", "uri", "inputs", "return", "instance", "of", "rdflib", ".", "term", ".", "URIRef" ]
python
train
20.617647
tensorflow/tensorboard
tensorboard/backend/event_processing/sqlite_writer.py
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/sqlite_writer.py#L176-L214
def write_summaries(self, tagged_data, experiment_name, run_name): """Transactionally writes the given tagged summary data to the DB. Args: tagged_data: map from tag to TagData instances. experiment_name: name of experiment. run_name: name of run. """ logger.debug('Writing summaries f...
[ "def", "write_summaries", "(", "self", ",", "tagged_data", ",", "experiment_name", ",", "run_name", ")", ":", "logger", ".", "debug", "(", "'Writing summaries for %s tags'", ",", "len", "(", "tagged_data", ")", ")", "# Connection used as context manager for auto commit/...
Transactionally writes the given tagged summary data to the DB. Args: tagged_data: map from tag to TagData instances. experiment_name: name of experiment. run_name: name of run.
[ "Transactionally", "writes", "the", "given", "tagged", "summary", "data", "to", "the", "DB", "." ]
python
train
45.128205
ageitgey/face_recognition
face_recognition/api.py
https://github.com/ageitgey/face_recognition/blob/c96b010c02f15e8eeb0f71308c641179ac1f19bb/face_recognition/api.py#L203-L213
def face_encodings(face_image, known_face_locations=None, num_jitters=1): """ Given an image, return the 128-dimension face encoding for each face in the image. :param face_image: The image that contains one or more faces :param known_face_locations: Optional - the bounding boxes of each face if you al...
[ "def", "face_encodings", "(", "face_image", ",", "known_face_locations", "=", "None", ",", "num_jitters", "=", "1", ")", ":", "raw_landmarks", "=", "_raw_face_landmarks", "(", "face_image", ",", "known_face_locations", ",", "model", "=", "\"small\"", ")", "return"...
Given an image, return the 128-dimension face encoding for each face in the image. :param face_image: The image that contains one or more faces :param known_face_locations: Optional - the bounding boxes of each face if you already know them. :param num_jitters: How many times to re-sample the face when cal...
[ "Given", "an", "image", "return", "the", "128", "-", "dimension", "face", "encoding", "for", "each", "face", "in", "the", "image", "." ]
python
train
72.818182
saltstack/salt
salt/modules/boto_cloudtrail.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_cloudtrail.py#L345-L366
def start_logging(Name, region=None, key=None, keyid=None, profile=None): ''' Start logging for a trail Returns {started: true} if the trail was started and returns {started: False} if the trail was not started. CLI Example: .. code-block:: bash salt myminion boto_cloudtra...
[ "def", "start_logging", "(", "Name", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "try", ":", "conn", "=", "_get_conn", "(", "region", "=", "region", ",", "key", "=", "key", ...
Start logging for a trail Returns {started: true} if the trail was started and returns {started: False} if the trail was not started. CLI Example: .. code-block:: bash salt myminion boto_cloudtrail.start_logging my_trail
[ "Start", "logging", "for", "a", "trail" ]
python
train
27.181818
knipknap/SpiffWorkflow
SpiffWorkflow/serializer/xml.py
https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/serializer/xml.py#L345-L352
def serialize_acquire_mutex(self, spec): """ Serializer for :meth:`SpiffWorkflow.specs.AcquireMutex`. """ elem = etree.Element('acquire-mutex') self.serialize_task_spec(spec, elem) SubElement(elem, 'mutex').text = spec.mutex return elem
[ "def", "serialize_acquire_mutex", "(", "self", ",", "spec", ")", ":", "elem", "=", "etree", ".", "Element", "(", "'acquire-mutex'", ")", "self", ".", "serialize_task_spec", "(", "spec", ",", "elem", ")", "SubElement", "(", "elem", ",", "'mutex'", ")", ".",...
Serializer for :meth:`SpiffWorkflow.specs.AcquireMutex`.
[ "Serializer", "for", ":", "meth", ":", "SpiffWorkflow", ".", "specs", ".", "AcquireMutex", "." ]
python
valid
35.625
bukun/TorCMS
torcms/handlers/wiki_handler.py
https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/wiki_handler.py#L150-L162
def view(self, view): ''' View the wiki. ''' kwd = { 'pager': '', 'editable': self.editable(), } self.render('wiki_page/wiki_view.html', postinfo=view, kwd=kwd, userinfo=self.userinfo)
[ "def", "view", "(", "self", ",", "view", ")", ":", "kwd", "=", "{", "'pager'", ":", "''", ",", "'editable'", ":", "self", ".", "editable", "(", ")", ",", "}", "self", ".", "render", "(", "'wiki_page/wiki_view.html'", ",", "postinfo", "=", "view", ","...
View the wiki.
[ "View", "the", "wiki", "." ]
python
train
23.461538
zetaops/zengine
zengine/views/auth.py
https://github.com/zetaops/zengine/blob/b5bc32d3b37bca799f8985be916f04528ac79e4a/zengine/views/auth.py#L123-L131
def show_view(self): """ Show :attr:`LoginForm` form. """ self.current.output['login_process'] = True if self.current.is_auth: self._do_upgrade() else: self.current.output['forms'] = LoginForm(current=self.current).serialize()
[ "def", "show_view", "(", "self", ")", ":", "self", ".", "current", ".", "output", "[", "'login_process'", "]", "=", "True", "if", "self", ".", "current", ".", "is_auth", ":", "self", ".", "_do_upgrade", "(", ")", "else", ":", "self", ".", "current", ...
Show :attr:`LoginForm` form.
[ "Show", ":", "attr", ":", "LoginForm", "form", "." ]
python
train
32.222222
kgori/treeCl
treeCl/bootstrap.py
https://github.com/kgori/treeCl/blob/fed624b3db1c19cc07175ca04e3eda6905a8d305/treeCl/bootstrap.py#L300-L306
def newton(self, start_x=None, tolerance=1.0e-6): """ Optimise value of x using newton gauss """ if start_x is None: start_x = self._analytical_fitter.fit(self._c) return optimise_newton(start_x, self._a, self._c, tolerance)
[ "def", "newton", "(", "self", ",", "start_x", "=", "None", ",", "tolerance", "=", "1.0e-6", ")", ":", "if", "start_x", "is", "None", ":", "start_x", "=", "self", ".", "_analytical_fitter", ".", "fit", "(", "self", ".", "_c", ")", "return", "optimise_ne...
Optimise value of x using newton gauss
[ "Optimise", "value", "of", "x", "using", "newton", "gauss" ]
python
train
38.571429
ntucllab/libact
libact/query_strategies/uncertainty_sampling.py
https://github.com/ntucllab/libact/blob/e37e9ed6c36febe701d84b2d495c958ab02f0bc8/libact/query_strategies/uncertainty_sampling.py#L98-L141
def make_query(self, return_score=False): """Return the index of the sample to be queried and labeled and selection score of each sample. Read-only. No modification to the internal states. Returns ------- ask_id : int The index of the next unlabeled sample t...
[ "def", "make_query", "(", "self", ",", "return_score", "=", "False", ")", ":", "dataset", "=", "self", ".", "dataset", "self", ".", "model", ".", "train", "(", "dataset", ")", "unlabeled_entry_ids", ",", "X_pool", "=", "zip", "(", "*", "dataset", ".", ...
Return the index of the sample to be queried and labeled and selection score of each sample. Read-only. No modification to the internal states. Returns ------- ask_id : int The index of the next unlabeled sample to be queried and labeled. score : list of (i...
[ "Return", "the", "index", "of", "the", "sample", "to", "be", "queried", "and", "labeled", "and", "selection", "score", "of", "each", "sample", ".", "Read", "-", "only", "." ]
python
train
33.772727
saltstack/salt
salt/modules/solrcloud.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/solrcloud.py#L445-L473
def collection_get_options(collection_name, **kwargs): ''' Get collection options Additional parameters (kwargs) may be passed, they will be proxied to http.query CLI Example: .. code-block:: bash salt '*' solrcloud.collection_get_options collection_name ''' cluster = cluster_st...
[ "def", "collection_get_options", "(", "collection_name", ",", "*", "*", "kwargs", ")", ":", "cluster", "=", "cluster_status", "(", "*", "*", "kwargs", ")", "options", "=", "{", "\"collection.configName\"", ":", "cluster", "[", "\"collections\"", "]", "[", "col...
Get collection options Additional parameters (kwargs) may be passed, they will be proxied to http.query CLI Example: .. code-block:: bash salt '*' solrcloud.collection_get_options collection_name
[ "Get", "collection", "options" ]
python
train
36.965517
aiortc/aiortc
aiortc/rtcsctptransport.py
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L1383-L1434
async def _transmit(self): """ Transmit outbound data. """ # send FORWARD TSN if self._forward_tsn_chunk is not None: await self._send_chunk(self._forward_tsn_chunk) self._forward_tsn_chunk = None # ensure T3 is running if not self...
[ "async", "def", "_transmit", "(", "self", ")", ":", "# send FORWARD TSN", "if", "self", ".", "_forward_tsn_chunk", "is", "not", "None", ":", "await", "self", ".", "_send_chunk", "(", "self", ".", "_forward_tsn_chunk", ")", "self", ".", "_forward_tsn_chunk", "=...
Transmit outbound data.
[ "Transmit", "outbound", "data", "." ]
python
train
33.75
CxAalto/gtfspy
gtfspy/exports.py
https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/exports.py#L172-L213
def _write_stop_to_stop_network_edges(net, file_name, data=True, fmt=None): """ Write out a network Parameters ---------- net: networkx.DiGraph base_name: str path to the filename (without extension) data: bool, optional whether or not to write out any edge data present ...
[ "def", "_write_stop_to_stop_network_edges", "(", "net", ",", "file_name", ",", "data", "=", "True", ",", "fmt", "=", "None", ")", ":", "if", "fmt", "is", "None", ":", "fmt", "=", "\"edg\"", "if", "fmt", "==", "\"edg\"", ":", "if", "data", ":", "network...
Write out a network Parameters ---------- net: networkx.DiGraph base_name: str path to the filename (without extension) data: bool, optional whether or not to write out any edge data present fmt: str, optional If "csv" write out the network in csv format.
[ "Write", "out", "a", "network" ]
python
valid
36.785714
inveniosoftware-contrib/record-recommender
record_recommender/recommender.py
https://github.com/inveniosoftware-contrib/record-recommender/blob/07f71e783369e6373218b5e6ba0bf15901e9251a/record_recommender/recommender.py#L140-L203
def dfs_edges(G, start, depth_limit=1, get_only=True, get_path=False): """Deepest first search.""" depth_limit = depth_limit - 1 # creates unsigned int array (2 Byte) output_nodes = array('L') output_depth = array('I') # creates float array (4 Byte) output_weights = array('f') apath = [...
[ "def", "dfs_edges", "(", "G", ",", "start", ",", "depth_limit", "=", "1", ",", "get_only", "=", "True", ",", "get_path", "=", "False", ")", ":", "depth_limit", "=", "depth_limit", "-", "1", "# creates unsigned int array (2 Byte)", "output_nodes", "=", "array",...
Deepest first search.
[ "Deepest", "first", "search", "." ]
python
train
34.828125
mozilla/Marketplace.Python
marketplace/connection.py
https://github.com/mozilla/Marketplace.Python/blob/88176b12201f766b6b96bccc1e4c3e82f0676283/marketplace/connection.py#L32-L51
def prepare_request(self, method, url, body=''): """Prepare the request body and headers :returns: headers of the signed request """ headers = { 'Content-type': 'application/json', } # Note: we don't pass body to sign() since it's only for bodies that ...
[ "def", "prepare_request", "(", "self", ",", "method", ",", "url", ",", "body", "=", "''", ")", ":", "headers", "=", "{", "'Content-type'", ":", "'application/json'", ",", "}", "# Note: we don't pass body to sign() since it's only for bodies that", "# are form-urlencoded...
Prepare the request body and headers :returns: headers of the signed request
[ "Prepare", "the", "request", "body", "and", "headers" ]
python
train
37.9
echinopsii/net.echinopsii.ariane.community.cli.python3
ariane_clip3/injector.py
https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L987-L1017
def save(self, running=None): """ save or update this cached gear into the Ariane server cache :param running: the new running value. if None ignored :return: """ LOGGER.debug("InjectorCachedGear.save") ret = True if running is not None: self....
[ "def", "save", "(", "self", ",", "running", "=", "None", ")", ":", "LOGGER", ".", "debug", "(", "\"InjectorCachedGear.save\"", ")", "ret", "=", "True", "if", "running", "is", "not", "None", ":", "self", ".", "running", "=", "running", "if", "self", "."...
save or update this cached gear into the Ariane server cache :param running: the new running value. if None ignored :return:
[ "save", "or", "update", "this", "cached", "gear", "into", "the", "Ariane", "server", "cache", ":", "param", "running", ":", "the", "new", "running", "value", ".", "if", "None", "ignored", ":", "return", ":" ]
python
train
38.870968
SCIP-Interfaces/PySCIPOpt
examples/finished/lotsizing_lazy.py
https://github.com/SCIP-Interfaces/PySCIPOpt/blob/9c960b40d94a48b0304d73dbe28b467b9c065abe/examples/finished/lotsizing_lazy.py#L130-L141
def mk_example(): """mk_example: book example for the single item lot sizing""" T = 5 _,f,c,d,h = multidict({ 1 : [3,1,5,1], 2 : [3,1,7,1], 3 : [3,3,3,1], 4 : [3,3,6,1], 5 : [3,3,4,1], }) return T,f,c,d,h
[ "def", "mk_example", "(", ")", ":", "T", "=", "5", "_", ",", "f", ",", "c", ",", "d", ",", "h", "=", "multidict", "(", "{", "1", ":", "[", "3", ",", "1", ",", "5", ",", "1", "]", ",", "2", ":", "[", "3", ",", "1", ",", "7", ",", "1"...
mk_example: book example for the single item lot sizing
[ "mk_example", ":", "book", "example", "for", "the", "single", "item", "lot", "sizing" ]
python
train
21.916667
saltstack/salt
salt/modules/salt_proxy.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/salt_proxy.py#L44-L70
def _proxy_conf_file(proxyfile, test): ''' Check if proxy conf exists and update ''' changes_old = [] changes_new = [] success = True if not os.path.exists(proxyfile): try: if not test: changes_new.append(_write_proxy_conf(proxyfile)) msg =...
[ "def", "_proxy_conf_file", "(", "proxyfile", ",", "test", ")", ":", "changes_old", "=", "[", "]", "changes_new", "=", "[", "]", "success", "=", "True", "if", "not", "os", ".", "path", ".", "exists", "(", "proxyfile", ")", ":", "try", ":", "if", "not"...
Check if proxy conf exists and update
[ "Check", "if", "proxy", "conf", "exists", "and", "update" ]
python
train
34.148148
pytroll/satpy
satpy/scene.py
https://github.com/pytroll/satpy/blob/1f21d20ac686b745fb0da9b4030d139893e066dd/satpy/scene.py#L220-L267
def _compare_areas(self, datasets=None, compare_func=max): """Get for the provided datasets. Args: datasets (iterable): Datasets whose areas will be compared. Can be either `xarray.DataArray` objects or identifiers to get th...
[ "def", "_compare_areas", "(", "self", ",", "datasets", "=", "None", ",", "compare_func", "=", "max", ")", ":", "if", "datasets", "is", "None", ":", "datasets", "=", "list", "(", "self", ".", "values", "(", ")", ")", "areas", "=", "[", "]", "for", "...
Get for the provided datasets. Args: datasets (iterable): Datasets whose areas will be compared. Can be either `xarray.DataArray` objects or identifiers to get the DataArrays from the current Scene. ...
[ "Get", "for", "the", "provided", "datasets", "." ]
python
train
39.041667
PSPC-SPAC-buyandsell/von_anchor
von_anchor/tails.py
https://github.com/PSPC-SPAC-buyandsell/von_anchor/blob/78ac1de67be42a676274f4bf71fe12f66e72f309/von_anchor/tails.py#L175-L196
def linked(base_dir: str, rr_id: str) -> str: """ Get, from the specified directory, the path to the tails file associated with the input revocation registry identifier, or None for no such file. :param base_dir: base directory for tails files, thereafter split by cred def id :p...
[ "def", "linked", "(", "base_dir", ":", "str", ",", "rr_id", ":", "str", ")", "->", "str", ":", "LOGGER", ".", "debug", "(", "'Tails.linked >>> base_dir: %s, rr_id: %s'", ",", "base_dir", ",", "rr_id", ")", "if", "not", "ok_rev_reg_id", "(", "rr_id", ")", "...
Get, from the specified directory, the path to the tails file associated with the input revocation registry identifier, or None for no such file. :param base_dir: base directory for tails files, thereafter split by cred def id :param rr_id: rev reg id :return: (stringified) path to tail...
[ "Get", "from", "the", "specified", "directory", "the", "path", "to", "the", "tails", "file", "associated", "with", "the", "input", "revocation", "registry", "identifier", "or", "None", "for", "no", "such", "file", "." ]
python
train
41.590909
gwww/elkm1
elkm1_lib/message.py
https://github.com/gwww/elkm1/blob/078d0de30840c3fab46f1f8534d98df557931e91/elkm1_lib/message.py#L100-L104
def _ee_decode(self, msg): """EE: Entry/exit timer report.""" return {'area': int(msg[4:5])-1, 'is_exit': msg[5:6] == '0', 'timer1': int(msg[6:9]), 'timer2': int(msg[9:12]), 'armed_status': msg[12:13]}
[ "def", "_ee_decode", "(", "self", ",", "msg", ")", ":", "return", "{", "'area'", ":", "int", "(", "msg", "[", "4", ":", "5", "]", ")", "-", "1", ",", "'is_exit'", ":", "msg", "[", "5", ":", "6", "]", "==", "'0'", ",", "'timer1'", ":", "int", ...
EE: Entry/exit timer report.
[ "EE", ":", "Entry", "/", "exit", "timer", "report", "." ]
python
train
49
mitsei/dlkit
dlkit/json_/learning/managers.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/managers.py#L2073-L2091
def get_activity_objective_bank_assignment_session(self, proxy): """Gets the session for assigning activity to objective bank mappings. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.learning.ActivityObjectiveBankAssignmentSession) - an ``ActivityObjectiveBankAssignment...
[ "def", "get_activity_objective_bank_assignment_session", "(", "self", ",", "proxy", ")", ":", "if", "not", "self", ".", "supports_activity_objective_bank_assignment", "(", ")", ":", "raise", "errors", ".", "Unimplemented", "(", ")", "# pylint: disable=no-member", "retur...
Gets the session for assigning activity to objective bank mappings. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.learning.ActivityObjectiveBankAssignmentSession) - an ``ActivityObjectiveBankAssignmentSession`` raise: NullArgument - ``proxy`` is ``null`` raise...
[ "Gets", "the", "session", "for", "assigning", "activity", "to", "objective", "bank", "mappings", "." ]
python
train
49.894737
aewallin/allantools
allantools/ci.py
https://github.com/aewallin/allantools/blob/b5c695a5af4379fcea4d4ce93a066cb902e7ee0a/allantools/ci.py#L693-L708
def edf_totdev(N, m, alpha): """ Equivalent degrees of freedom for Total Deviation FIXME: what is the right behavior for alpha outside 0,-1,-2? NIST SP1065 page 41, Table 7 """ alpha = int(alpha) if alpha in [0, -1, -2]: # alpha 0 WFM # alpha -1 FFM # al...
[ "def", "edf_totdev", "(", "N", ",", "m", ",", "alpha", ")", ":", "alpha", "=", "int", "(", "alpha", ")", "if", "alpha", "in", "[", "0", ",", "-", "1", ",", "-", "2", "]", ":", "# alpha 0 WFM", "# alpha -1 FFM", "# alpha -2 RWFM", "NIST_SP1065_table7",...
Equivalent degrees of freedom for Total Deviation FIXME: what is the right behavior for alpha outside 0,-1,-2? NIST SP1065 page 41, Table 7
[ "Equivalent", "degrees", "of", "freedom", "for", "Total", "Deviation", "FIXME", ":", "what", "is", "the", "right", "behavior", "for", "alpha", "outside", "0", "-", "1", "-", "2?", "NIST", "SP1065", "page", "41", "Table", "7" ]
python
train
33
QUANTAXIS/QUANTAXIS
QUANTAXIS/QAMarket/QAPosition.py
https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAMarket/QAPosition.py#L464-L468
def orderAction(self, order:QA_Order): """ 委托回报 """ return self.pms[order.code][order.order_id].receive_order(order)
[ "def", "orderAction", "(", "self", ",", "order", ":", "QA_Order", ")", ":", "return", "self", ".", "pms", "[", "order", ".", "code", "]", "[", "order", ".", "order_id", "]", ".", "receive_order", "(", "order", ")" ]
委托回报
[ "委托回报" ]
python
train
28.8
BlueBrain/NeuroM
neurom/view/common.py
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/view/common.py#L280-L309
def plot_ticks(ax, tick_fontsize=12, xticks=None, xticks_args=None, yticks=None, yticks_args=None, zticks=None, zticks_args=None): """Function that defines the labels options of a matplotlib plot. Args: ax: matplotlib axes tick_fontsize (int): Define...
[ "def", "plot_ticks", "(", "ax", ",", "tick_fontsize", "=", "12", ",", "xticks", "=", "None", ",", "xticks_args", "=", "None", ",", "yticks", "=", "None", ",", "yticks_args", "=", "None", ",", "zticks", "=", "None", ",", "zticks_args", "=", "None", ")",...
Function that defines the labels options of a matplotlib plot. Args: ax: matplotlib axes tick_fontsize (int): Defines the size of the ticks' font xticks([list of ticks]): Defines the values of x ticks in the figure xticks_arg(dict): Passsed into matplotlib as xticks arguments ...
[ "Function", "that", "defines", "the", "labels", "options", "of", "a", "matplotlib", "plot", "." ]
python
train
43.6
squaresLab/BugZoo
bugzoo/mgr/build.py
https://github.com/squaresLab/BugZoo/blob/68664f1977e85b37a78604f7c570382ffae1fa3b/bugzoo/mgr/build.py#L170-L190
def download(self, name: str, force: bool = False ) -> bool: """ Attempts to download a given Docker image. If `force=True`, then any previously installed version of the image (described by the instructions) will be replaced by the image...
[ "def", "download", "(", "self", ",", "name", ":", "str", ",", "force", ":", "bool", "=", "False", ")", "->", "bool", ":", "try", ":", "self", ".", "__docker", ".", "images", ".", "pull", "(", "name", ")", "return", "True", "except", "docker", ".", ...
Attempts to download a given Docker image. If `force=True`, then any previously installed version of the image (described by the instructions) will be replaced by the image on DockerHub. Parameters: name: the name of the Docker image. Returns: `True` if successf...
[ "Attempts", "to", "download", "a", "given", "Docker", "image", ".", "If", "force", "=", "True", "then", "any", "previously", "installed", "version", "of", "the", "image", "(", "described", "by", "the", "instructions", ")", "will", "be", "replaced", "by", "...
python
train
33.238095
inasafe/inasafe
safe/gui/tools/wizard/step_kw25_classification.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/step_kw25_classification.py#L89-L103
def on_lstClassifications_itemSelectionChanged(self): """Update classification description label and unlock the Next button. .. note:: This is an automatic Qt slot executed when the field selection changes. """ self.clear_further_steps() classification = self.selected...
[ "def", "on_lstClassifications_itemSelectionChanged", "(", "self", ")", ":", "self", ".", "clear_further_steps", "(", ")", "classification", "=", "self", ".", "selected_classification", "(", ")", "# Exit if no selection", "if", "not", "classification", ":", "return", "...
Update classification description label and unlock the Next button. .. note:: This is an automatic Qt slot executed when the field selection changes.
[ "Update", "classification", "description", "label", "and", "unlock", "the", "Next", "button", "." ]
python
train
39.466667
sdispater/orator
orator/connectors/connector.py
https://github.com/sdispater/orator/blob/bd90bf198ee897751848f9a92e49d18e60a74136/orator/connectors/connector.py#L65-L78
def _detect_database_platform(self): """ Detects and sets the database platform. Evaluates custom platform class and version in order to set the correct platform. :raises InvalidPlatformSpecified: if an invalid platform was specified for this connection. """ version = s...
[ "def", "_detect_database_platform", "(", "self", ")", ":", "version", "=", "self", ".", "_get_database_platform_version", "(", ")", "if", "version", "is", "not", "None", ":", "self", ".", "_platform", "=", "self", ".", "_create_database_platform_for_version", "(",...
Detects and sets the database platform. Evaluates custom platform class and version in order to set the correct platform. :raises InvalidPlatformSpecified: if an invalid platform was specified for this connection.
[ "Detects", "and", "sets", "the", "database", "platform", "." ]
python
train
37.5
crytic/slither
slither/core/declarations/contract.py
https://github.com/crytic/slither/blob/04c147f7e50223c6af458ca430befae747ccd259/slither/core/declarations/contract.py#L381-L389
def get_modifier_from_signature(self, modifier_signature): """ Return a modifier from a signature Args: modifier_name (str): signature of the modifier Returns: Modifier """ return next((m for m in self.modifiers if m.full_name == modifier_signa...
[ "def", "get_modifier_from_signature", "(", "self", ",", "modifier_signature", ")", ":", "return", "next", "(", "(", "m", "for", "m", "in", "self", ".", "modifiers", "if", "m", ".", "full_name", "==", "modifier_signature", ")", ",", "None", ")" ]
Return a modifier from a signature Args: modifier_name (str): signature of the modifier Returns: Modifier
[ "Return", "a", "modifier", "from", "a", "signature", "Args", ":", "modifier_name", "(", "str", ")", ":", "signature", "of", "the", "modifier", "Returns", ":", "Modifier" ]
python
train
36
openid/JWTConnect-Python-OidcService
src/oidcservice/client_auth.py
https://github.com/openid/JWTConnect-Python-OidcService/blob/759ab7adef30a7e3b9d75475e2971433b9613788/src/oidcservice/client_auth.py#L186-L220
def find_token(request, token_type, service, **kwargs): """ The access token can be in a number of places. There are priority rules as to which one to use, abide by those: 1 If it's among the request parameters use that 2 If among the extra keyword arguments 3 Acquired by a previous run service...
[ "def", "find_token", "(", "request", ",", "token_type", ",", "service", ",", "*", "*", "kwargs", ")", ":", "if", "request", "is", "not", "None", ":", "try", ":", "_token", "=", "request", "[", "token_type", "]", "except", "KeyError", ":", "pass", "else...
The access token can be in a number of places. There are priority rules as to which one to use, abide by those: 1 If it's among the request parameters use that 2 If among the extra keyword arguments 3 Acquired by a previous run service. :param request: :param token_type: :param service: ...
[ "The", "access", "token", "can", "be", "in", "a", "number", "of", "places", ".", "There", "are", "priority", "rules", "as", "to", "which", "one", "to", "use", "abide", "by", "those", ":" ]
python
train
31.8
crocs-muni/roca
roca/detect.py
https://github.com/crocs-muni/roca/blob/74ad6ce63c428d83dcffce9c5e26ef7b9e30faa5/roca/detect.py#L675-L692
def mul_inv(a, b): """ Modular inversion a mod b :param a: :param b: :return: """ b0 = b x0, x1 = 0, 1 if b == 1: return 1 while a > 1: q = a // b a, b = b, a % b x0, x1 = x1 - q * x0, x0 ...
[ "def", "mul_inv", "(", "a", ",", "b", ")", ":", "b0", "=", "b", "x0", ",", "x1", "=", "0", ",", "1", "if", "b", "==", "1", ":", "return", "1", "while", "a", ">", "1", ":", "q", "=", "a", "//", "b", "a", ",", "b", "=", "b", ",", "a", ...
Modular inversion a mod b :param a: :param b: :return:
[ "Modular", "inversion", "a", "mod", "b", ":", "param", "a", ":", ":", "param", "b", ":", ":", "return", ":" ]
python
train
19.777778
ic-labs/django-icekit
glamkit_collections/contrib/work_creator/plugins/person/models.py
https://github.com/ic-labs/django-icekit/blob/c507ea5b1864303732c53ad7c5800571fca5fa94/glamkit_collections/contrib/work_creator/plugins/person/models.py#L93-L123
def derive_and_set_name_fields_and_slug( self, set_name_sort=True, set_slug=True ): """ Override this method from `CreatorBase` to handle additional name fields for Person creators. This method is called during `save()` """ super(PersonCreator, self).derive_a...
[ "def", "derive_and_set_name_fields_and_slug", "(", "self", ",", "set_name_sort", "=", "True", ",", "set_slug", "=", "True", ")", ":", "super", "(", "PersonCreator", ",", "self", ")", ".", "derive_and_set_name_fields_and_slug", "(", "set_name_sort", "=", "False", "...
Override this method from `CreatorBase` to handle additional name fields for Person creators. This method is called during `save()`
[ "Override", "this", "method", "from", "CreatorBase", "to", "handle", "additional", "name", "fields", "for", "Person", "creators", "." ]
python
train
41.612903
DLR-RM/RAFCON
source/rafcon/gui/mygaphas/utils/cache/image_cache.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/utils/cache/image_cache.py#L128-L177
def __compare_parameters(self, width, height, zoom, parameters): """Compare parameters for equality Checks if a cached image is existing, the the dimensions agree and finally if the properties are equal. If so, True is returned, else False, :param width: The width of the image :...
[ "def", "__compare_parameters", "(", "self", ",", "width", ",", "height", ",", "zoom", ",", "parameters", ")", ":", "# Deactivated caching", "if", "not", "global_gui_config", ".", "get_config_value", "(", "'ENABLE_CACHING'", ",", "True", ")", ":", "return", "Fals...
Compare parameters for equality Checks if a cached image is existing, the the dimensions agree and finally if the properties are equal. If so, True is returned, else False, :param width: The width of the image :param height: The height of the image :param zoom: The current scale...
[ "Compare", "parameters", "for", "equality" ]
python
train
40.68
adafruit/Adafruit_Python_GPIO
Adafruit_GPIO/I2C.py
https://github.com/adafruit/Adafruit_Python_GPIO/blob/a92a23d6b5869663b2bc1ccf78bb11585076a9c4/Adafruit_GPIO/I2C.py#L133-L139
def readList(self, register, length): """Read a length number of bytes from the specified register. Results will be returned as a bytearray.""" results = self._bus.read_i2c_block_data(self._address, register, length) self._logger.debug("Read the following from register 0x%02X: %s", ...
[ "def", "readList", "(", "self", ",", "register", ",", "length", ")", ":", "results", "=", "self", ".", "_bus", ".", "read_i2c_block_data", "(", "self", ".", "_address", ",", "register", ",", "length", ")", "self", ".", "_logger", ".", "debug", "(", "\"...
Read a length number of bytes from the specified register. Results will be returned as a bytearray.
[ "Read", "a", "length", "number", "of", "bytes", "from", "the", "specified", "register", ".", "Results", "will", "be", "returned", "as", "a", "bytearray", "." ]
python
valid
53.142857
inveniosoftware/invenio-records-rest
invenio_records_rest/links.py
https://github.com/inveniosoftware/invenio-records-rest/blob/e7b63c5f72cef03d06d3f1b4c12c0d37e3a628b9/invenio_records_rest/links.py#L33-L48
def default_links_factory_with_additional(additional_links): """Generate a links generation factory with the specified additional links. :param additional_links: A dict of link names to links to be added to the returned object. :returns: A link generation factory. """ def factory(pid, **...
[ "def", "default_links_factory_with_additional", "(", "additional_links", ")", ":", "def", "factory", "(", "pid", ",", "*", "*", "kwargs", ")", ":", "links", "=", "default_links_factory", "(", "pid", ")", "for", "link", "in", "additional_links", ":", "links", "...
Generate a links generation factory with the specified additional links. :param additional_links: A dict of link names to links to be added to the returned object. :returns: A link generation factory.
[ "Generate", "a", "links", "generation", "factory", "with", "the", "specified", "additional", "links", "." ]
python
train
40.875
ihgazni2/elist
elist/elist.py
https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L5326-L5349
def rangize_supplement(spans,lngth): ''' spans = [(0, 3), (4, 7), (8, 10), (11, 12), (13, 16), (17, 20)] rangize_supplement(spans,24) ''' rslt = [] si = 0 ei = spans[0][0] if(si == ei): pass else: rslt.append((si,ei)) prev_ei = spans[0][1] for...
[ "def", "rangize_supplement", "(", "spans", ",", "lngth", ")", ":", "rslt", "=", "[", "]", "si", "=", "0", "ei", "=", "spans", "[", "0", "]", "[", "0", "]", "if", "(", "si", "==", "ei", ")", ":", "pass", "else", ":", "rslt", ".", "append", "("...
spans = [(0, 3), (4, 7), (8, 10), (11, 12), (13, 16), (17, 20)] rangize_supplement(spans,24)
[ "spans", "=", "[", "(", "0", "3", ")", "(", "4", "7", ")", "(", "8", "10", ")", "(", "11", "12", ")", "(", "13", "16", ")", "(", "17", "20", ")", "]", "rangize_supplement", "(", "spans", "24", ")" ]
python
valid
23.375
MagicStack/asyncpg
asyncpg/connect_utils.py
https://github.com/MagicStack/asyncpg/blob/92c2d81256a1efd8cab12c0118d74ccd1c18131b/asyncpg/connect_utils.py#L105-L139
def _read_password_from_pgpass( *, passfile: typing.Optional[pathlib.Path], hosts: typing.List[str], ports: typing.List[int], database: str, user: str): """Parse the pgpass file and return the matching password. :return: Password string, if found, ``None`` otherw...
[ "def", "_read_password_from_pgpass", "(", "*", ",", "passfile", ":", "typing", ".", "Optional", "[", "pathlib", ".", "Path", "]", ",", "hosts", ":", "typing", ".", "List", "[", "str", "]", ",", "ports", ":", "typing", ".", "List", "[", "int", "]", ",...
Parse the pgpass file and return the matching password. :return: Password string, if found, ``None`` otherwise.
[ "Parse", "the", "pgpass", "file", "and", "return", "the", "matching", "password", "." ]
python
train
28.457143
Esri/ArcREST
tools/src/createGroup.py
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/tools/src/createGroup.py#L35-L88
def main(*argv): """ main driver of program """ try: # Inputs # adminUsername = argv[0] adminPassword = argv[1] siteURL = argv[2] groupTitle = argv[3] groupTags = argv[4] description = argv[5] access = argv[6] # Logic #...
[ "def", "main", "(", "*", "argv", ")", ":", "try", ":", "# Inputs", "#", "adminUsername", "=", "argv", "[", "0", "]", "adminPassword", "=", "argv", "[", "1", "]", "siteURL", "=", "argv", "[", "2", "]", "groupTitle", "=", "argv", "[", "3", "]", "...
main driver of program
[ "main", "driver", "of", "program" ]
python
train
41.388889
uogbuji/versa
tools/py/writer/md.py
https://github.com/uogbuji/versa/blob/f092ffc7ed363a5b170890955168500f32de0dd5/tools/py/writer/md.py#L42-L79
def write(models, out=None, base=None, propertybase=None, shorteners=None, logger=logging): ''' models - input Versa models from which output is generated. Must be a sequence object, not an iterator ''' assert out is not None #Output stream required if not isinstance(models, list): m...
[ "def", "write", "(", "models", ",", "out", "=", "None", ",", "base", "=", "None", ",", "propertybase", "=", "None", ",", "shorteners", "=", "None", ",", "logger", "=", "logging", ")", ":", "assert", "out", "is", "not", "None", "#Output stream required", ...
models - input Versa models from which output is generated. Must be a sequence object, not an iterator
[ "models", "-", "input", "Versa", "models", "from", "which", "output", "is", "generated", ".", "Must", "be", "a", "sequence", "object", "not", "an", "iterator" ]
python
train
33.763158
mushkevych/scheduler
synergy/system/time_helper.py
https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/system/time_helper.py#L78-L82
def day_to_month(timeperiod): """:param timeperiod: as string in YYYYMMDD00 format :return string in YYYYMM0000 format""" t = datetime.strptime(timeperiod, SYNERGY_DAILY_PATTERN) return t.strftime(SYNERGY_MONTHLY_PATTERN)
[ "def", "day_to_month", "(", "timeperiod", ")", ":", "t", "=", "datetime", ".", "strptime", "(", "timeperiod", ",", "SYNERGY_DAILY_PATTERN", ")", "return", "t", ".", "strftime", "(", "SYNERGY_MONTHLY_PATTERN", ")" ]
:param timeperiod: as string in YYYYMMDD00 format :return string in YYYYMM0000 format
[ ":", "param", "timeperiod", ":", "as", "string", "in", "YYYYMMDD00", "format", ":", "return", "string", "in", "YYYYMM0000", "format" ]
python
train
46.6
zomux/deepy
deepy/layers/recurrent.py
https://github.com/zomux/deepy/blob/090fbad22a08a809b12951cd0d4984f5bd432698/deepy/layers/recurrent.py#L109-L122
def get_initial_states(self, input_var, init_state=None): """ :type input_var: T.var :rtype: dict """ initial_states = {} for state in self.state_names: if state != "state" or not init_state: if self._input_type == 'sequence' and input_var.ndim...
[ "def", "get_initial_states", "(", "self", ",", "input_var", ",", "init_state", "=", "None", ")", ":", "initial_states", "=", "{", "}", "for", "state", "in", "self", ".", "state_names", ":", "if", "state", "!=", "\"state\"", "or", "not", "init_state", ":", ...
:type input_var: T.var :rtype: dict
[ ":", "type", "input_var", ":", "T", ".", "var", ":", "rtype", ":", "dict" ]
python
test
42.857143
lowandrew/OLCTools
databasesetup/rest_auth_class.py
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/databasesetup/rest_auth_class.py#L276-L285
def download_loci(self): """ Uses a multi-threaded approach to download allele files """ # Setup the multiprocessing pool. pool = multiprocessing.Pool(processes=self.threads) # Map the list of loci URLs to the download method pool.map(self.download_threads, self.l...
[ "def", "download_loci", "(", "self", ")", ":", "# Setup the multiprocessing pool.", "pool", "=", "multiprocessing", ".", "Pool", "(", "processes", "=", "self", ".", "threads", ")", "# Map the list of loci URLs to the download method", "pool", ".", "map", "(", "self", ...
Uses a multi-threaded approach to download allele files
[ "Uses", "a", "multi", "-", "threaded", "approach", "to", "download", "allele", "files" ]
python
train
36
ghukill/pyfc4
pyfc4/models.py
https://github.com/ghukill/pyfc4/blob/59011df592f08978c4a901a908862d112a5dcf02/pyfc4/models.py#L1609-L1632
def revert_to(self): ''' method to revert resource to this version by issuing PATCH Args: None Returns: None: sends PATCH request, and refreshes parent resource ''' # send patch response = self.resource.repo.api.http_request('PATCH', self.uri) # if response 204 if response.status_code == 20...
[ "def", "revert_to", "(", "self", ")", ":", "# send patch", "response", "=", "self", ".", "resource", ".", "repo", ".", "api", ".", "http_request", "(", "'PATCH'", ",", "self", ".", "uri", ")", "# if response 204", "if", "response", ".", "status_code", "=="...
method to revert resource to this version by issuing PATCH Args: None Returns: None: sends PATCH request, and refreshes parent resource
[ "method", "to", "revert", "resource", "to", "this", "version", "by", "issuing", "PATCH" ]
python
train
23.541667
bcbio/bcbio-nextgen
bcbio/pipeline/main.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/main.py#L29-L55
def run_main(workdir, config_file=None, fc_dir=None, run_info_yaml=None, parallel=None, workflow=None): """Run variant analysis, handling command line options. """ # Set environment to standard to use periods for decimals and avoid localization os.environ["LC_ALL"] = "C" os.environ["LC"...
[ "def", "run_main", "(", "workdir", ",", "config_file", "=", "None", ",", "fc_dir", "=", "None", ",", "run_info_yaml", "=", "None", ",", "parallel", "=", "None", ",", "workflow", "=", "None", ")", ":", "# Set environment to standard to use periods for decimals and ...
Run variant analysis, handling command line options.
[ "Run", "variant", "analysis", "handling", "command", "line", "options", "." ]
python
train
49.851852
ArchiveTeam/wpull
wpull/application/tasks/rule.py
https://github.com/ArchiveTeam/wpull/blob/ddf051aa3322479325ba20aa778cb2cb97606bf5/wpull/application/tasks/rule.py#L24-L31
def _build_url_rewriter(cls, session: AppSession): '''Build URL rewriter if needed.''' if session.args.escaped_fragment or session.args.strip_session_id: return session.factory.new( 'URLRewriter', hash_fragment=session.args.escaped_fragment, se...
[ "def", "_build_url_rewriter", "(", "cls", ",", "session", ":", "AppSession", ")", ":", "if", "session", ".", "args", ".", "escaped_fragment", "or", "session", ".", "args", ".", "strip_session_id", ":", "return", "session", ".", "factory", ".", "new", "(", ...
Build URL rewriter if needed.
[ "Build", "URL", "rewriter", "if", "needed", "." ]
python
train
45.625
modin-project/modin
modin/pandas/base.py
https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/base.py#L674-L691
def cummax(self, axis=None, skipna=True, *args, **kwargs): """Perform a cumulative maximum across the DataFrame. Args: axis (int): The axis to take maximum on. skipna (bool): True to skip NA values, false otherwise. Returns: The cumulative maximum of...
[ "def", "cummax", "(", "self", ",", "axis", "=", "None", ",", "skipna", "=", "True", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "axis", "=", "self", ".", "_get_axis_number", "(", "axis", ")", "if", "axis", "is", "not", "None", "else", "0...
Perform a cumulative maximum across the DataFrame. Args: axis (int): The axis to take maximum on. skipna (bool): True to skip NA values, false otherwise. Returns: The cumulative maximum of the DataFrame.
[ "Perform", "a", "cumulative", "maximum", "across", "the", "DataFrame", ".", "Args", ":", "axis", "(", "int", ")", ":", "The", "axis", "to", "take", "maximum", "on", ".", "skipna", "(", "bool", ")", ":", "True", "to", "skip", "NA", "values", "false", ...
python
train
35
5monkeys/django-bananas
bananas/admin/api/versioning.py
https://github.com/5monkeys/django-bananas/blob/cfd318c737f6c4580036c13d2acf32bca96654bf/bananas/admin/api/versioning.py#L14-L22
def get_versioned_viewname(self, viewname, request): """ Prefix viewname with full namespace bananas:vX.Y: """ namespace = request.resolver_match.namespace if namespace: viewname = "{}:{}".format(namespace, viewname) return viewname
[ "def", "get_versioned_viewname", "(", "self", ",", "viewname", ",", "request", ")", ":", "namespace", "=", "request", ".", "resolver_match", ".", "namespace", "if", "namespace", ":", "viewname", "=", "\"{}:{}\"", ".", "format", "(", "namespace", ",", "viewname...
Prefix viewname with full namespace bananas:vX.Y:
[ "Prefix", "viewname", "with", "full", "namespace", "bananas", ":", "vX", ".", "Y", ":" ]
python
test
31.666667
mgbarrero/xbob.db.atvskeystroke
xbob/db/atvskeystroke/query.py
https://github.com/mgbarrero/xbob.db.atvskeystroke/blob/b7358a73e21757b43334df7c89ba057b377ca704/xbob/db/atvskeystroke/query.py#L68-L91
def clients(self, protocol=None, groups=None): """Returns a list of :py:class:`.Client` for the specific query by the user. Keyword Parameters: protocol Ignored. groups The groups (types) to which the clients belong either from ('Genuine', 'Impostor') Note that 'eval' is an alias fo...
[ "def", "clients", "(", "self", ",", "protocol", "=", "None", ",", "groups", "=", "None", ")", ":", "groups", "=", "self", ".", "__group_replace_eval_by_genuine__", "(", "groups", ")", "groups", "=", "self", ".", "check_parameters_for_validity", "(", "groups", ...
Returns a list of :py:class:`.Client` for the specific query by the user. Keyword Parameters: protocol Ignored. groups The groups (types) to which the clients belong either from ('Genuine', 'Impostor') Note that 'eval' is an alias for 'Genuine'. If no groups are specified, then bo...
[ "Returns", "a", "list", "of", ":", "py", ":", "class", ":", ".", "Client", "for", "the", "specific", "query", "by", "the", "user", "." ]
python
train
32.708333
Shizmob/pydle
pydle/client.py
https://github.com/Shizmob/pydle/blob/7ec7d65d097318ed0bcdc5d8401470287d8c7cf7/pydle/client.py#L87-L93
def run(self, *args, **kwargs): """ Connect and run bot in event loop. """ self.eventloop.run_until_complete(self.connect(*args, **kwargs)) try: self.eventloop.run_forever() finally: self.eventloop.stop()
[ "def", "run", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "eventloop", ".", "run_until_complete", "(", "self", ".", "connect", "(", "*", "args", ",", "*", "*", "kwargs", ")", ")", "try", ":", "self", ".", "event...
Connect and run bot in event loop.
[ "Connect", "and", "run", "bot", "in", "event", "loop", "." ]
python
train
36.285714
datastore/datastore
datastore/core/basic.py
https://github.com/datastore/datastore/blob/7ccf0cd4748001d3dbf5e6dda369b0f63e0269d3/datastore/core/basic.py#L773-L786
def put(self, key, value): '''Stores the object named by `key`. Follows links.''' # if value is a link, don't follow links if self._link_for_value(value): super(SymlinkDatastore, self).put(key, value) return # if `key` points to a symlink, need to follow it. current_value = super(Symlin...
[ "def", "put", "(", "self", ",", "key", ",", "value", ")", ":", "# if value is a link, don't follow links", "if", "self", ".", "_link_for_value", "(", "value", ")", ":", "super", "(", "SymlinkDatastore", ",", "self", ")", ".", "put", "(", "key", ",", "value...
Stores the object named by `key`. Follows links.
[ "Stores", "the", "object", "named", "by", "key", ".", "Follows", "links", "." ]
python
train
37.857143
LogicalDash/LiSE
ELiDE/ELiDE/board/board.py
https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/board/board.py#L147-L201
def on_touch_down(self, touch): """Check for collisions and select an appropriate entity.""" if hasattr(self, '_lasttouch') and self._lasttouch == touch: return if not self.collide_point(*touch.pos): return touch.push() touch.apply_transform_2d(self.to_loc...
[ "def", "on_touch_down", "(", "self", ",", "touch", ")", ":", "if", "hasattr", "(", "self", ",", "'_lasttouch'", ")", "and", "self", ".", "_lasttouch", "==", "touch", ":", "return", "if", "not", "self", ".", "collide_point", "(", "*", "touch", ".", "pos...
Check for collisions and select an appropriate entity.
[ "Check", "for", "collisions", "and", "select", "an", "appropriate", "entity", "." ]
python
train
41.636364
echinopsii/net.echinopsii.ariane.community.cli.python3
ariane_clip3/rest/driver.py
https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/rest/driver.py#L134-L141
def start(self): """ instanciate request session with authent :return: """ LOGGER.debug("rest.Driver.start") self.session = requests.Session() self.session.auth = (self.user, self.password)
[ "def", "start", "(", "self", ")", ":", "LOGGER", ".", "debug", "(", "\"rest.Driver.start\"", ")", "self", ".", "session", "=", "requests", ".", "Session", "(", ")", "self", ".", "session", ".", "auth", "=", "(", "self", ".", "user", ",", "self", ".",...
instanciate request session with authent :return:
[ "instanciate", "request", "session", "with", "authent", ":", "return", ":" ]
python
train
29.75
mitsei/dlkit
dlkit/json_/commenting/managers.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/managers.py#L248-L263
def get_comment_lookup_session(self): """Gets the ``OsidSession`` associated with the comment lookup service. return: (osid.commenting.CommentLookupSession) - a ``CommentLookupSession`` raise: OperationFailed - unable to complete request raise: Unimplemented - ``suppor...
[ "def", "get_comment_lookup_session", "(", "self", ")", ":", "if", "not", "self", ".", "supports_comment_lookup", "(", ")", ":", "raise", "errors", ".", "Unimplemented", "(", ")", "# pylint: disable=no-member", "return", "sessions", ".", "CommentLookupSession", "(", ...
Gets the ``OsidSession`` associated with the comment lookup service. return: (osid.commenting.CommentLookupSession) - a ``CommentLookupSession`` raise: OperationFailed - unable to complete request raise: Unimplemented - ``supports_comment_lookup()`` is ``false`...
[ "Gets", "the", "OsidSession", "associated", "with", "the", "comment", "lookup", "service", "." ]
python
train
42.5
pandas-dev/pandas
pandas/core/internals/managers.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/managers.py#L1392-L1428
def unstack(self, unstacker_func, fill_value): """Return a blockmanager with all blocks unstacked. Parameters ---------- unstacker_func : callable A (partially-applied) ``pd.core.reshape._Unstacker`` class. fill_value : Any fill_value for newly introduced...
[ "def", "unstack", "(", "self", ",", "unstacker_func", ",", "fill_value", ")", ":", "n_rows", "=", "self", ".", "shape", "[", "-", "1", "]", "dummy", "=", "unstacker_func", "(", "np", ".", "empty", "(", "(", "0", ",", "0", ")", ")", ",", "value_colu...
Return a blockmanager with all blocks unstacked. Parameters ---------- unstacker_func : callable A (partially-applied) ``pd.core.reshape._Unstacker`` class. fill_value : Any fill_value for newly introduced missing values. Returns ------- ...
[ "Return", "a", "blockmanager", "with", "all", "blocks", "unstacked", "." ]
python
train
30.081081
gwastro/pycbc-glue
pycbc_glue/segments.py
https://github.com/gwastro/pycbc-glue/blob/a3e906bae59fbfd707c3ff82e5d008d939ec5e24/pycbc_glue/segments.py#L1098-L1103
def intersects_segment(self, seg): """ Returns True if any segmentlist in self intersects the segment, otherwise returns False. """ return any(value.intersects_segment(seg) for value in self.itervalues())
[ "def", "intersects_segment", "(", "self", ",", "seg", ")", ":", "return", "any", "(", "value", ".", "intersects_segment", "(", "seg", ")", "for", "value", "in", "self", ".", "itervalues", "(", ")", ")" ]
Returns True if any segmentlist in self intersects the segment, otherwise returns False.
[ "Returns", "True", "if", "any", "segmentlist", "in", "self", "intersects", "the", "segment", "otherwise", "returns", "False", "." ]
python
train
34.833333
onnx/onnxmltools
onnxmltools/convert/coreml/shape_calculators/neural_network/Concat.py
https://github.com/onnx/onnxmltools/blob/d4e4c31990fc2d9fd1f92139f497d360914c9df2/onnxmltools/convert/coreml/shape_calculators/neural_network/Concat.py#L11-L31
def calculate_concat_output_shapes(operator): ''' Allowed input/output patterns are 1. [N_1, C, H, W], ..., [N_n, C, H, W] ---> [N_1 + ... + N_n, C, H, W] 2. [N, C_1, H, W], ..., [N, C_n, H, W] ---> [N, C_1 + ... + C_n, H, W] ''' check_input_and_output_numbers(operator, input_count_range...
[ "def", "calculate_concat_output_shapes", "(", "operator", ")", ":", "check_input_and_output_numbers", "(", "operator", ",", "input_count_range", "=", "[", "1", ",", "None", "]", ",", "output_count_range", "=", "[", "1", ",", "1", "]", ")", "output_shape", "=", ...
Allowed input/output patterns are 1. [N_1, C, H, W], ..., [N_n, C, H, W] ---> [N_1 + ... + N_n, C, H, W] 2. [N, C_1, H, W], ..., [N, C_n, H, W] ---> [N, C_1 + ... + C_n, H, W]
[ "Allowed", "input", "/", "output", "patterns", "are", "1", ".", "[", "N_1", "C", "H", "W", "]", "...", "[", "N_n", "C", "H", "W", "]", "---", ">", "[", "N_1", "+", "...", "+", "N_n", "C", "H", "W", "]", "2", ".", "[", "N", "C_1", "H", "W"...
python
train
53.52381
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_kmlread.py
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_kmlread.py#L237-L248
def clearkml(self): '''Clear the kmls from the map''' #go through all the current layers and remove them for layer in self.curlayers: self.mpstate.map.remove_object(layer) for layer in self.curtextlayers: self.mpstate.map.remove_object(layer) self.allayers...
[ "def", "clearkml", "(", "self", ")", ":", "#go through all the current layers and remove them", "for", "layer", "in", "self", ".", "curlayers", ":", "self", ".", "mpstate", ".", "map", ".", "remove_object", "(", "layer", ")", "for", "layer", "in", "self", ".",...
Clear the kmls from the map
[ "Clear", "the", "kmls", "from", "the", "map" ]
python
train
37.333333
inasafe/inasafe
safe/impact_function/impact_function.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/impact_function.py#L602-L638
def _outputs(self): """List of layers containing outputs from the IF. :returns: A list of vector layers. :rtype: list """ layers = OrderedDict() layers[layer_purpose_exposure_summary['key']] = ( self._exposure_summary) layers[layer_purpose_aggregate_h...
[ "def", "_outputs", "(", "self", ")", ":", "layers", "=", "OrderedDict", "(", ")", "layers", "[", "layer_purpose_exposure_summary", "[", "'key'", "]", "]", "=", "(", "self", ".", "_exposure_summary", ")", "layers", "[", "layer_purpose_aggregate_hazard_impacted", ...
List of layers containing outputs from the IF. :returns: A list of vector layers. :rtype: list
[ "List", "of", "layers", "containing", "outputs", "from", "the", "IF", "." ]
python
train
41.486486
gwastro/pycbc
pycbc/conversions.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/conversions.py#L1316-L1355
def nltides_gw_phase_difference(f, f0, amplitude, n, m1, m2): """Calculate the gravitational-wave phase shift bwtween f and f_coalescence = infinity due to non-linear tides. To compute the phase shift between e.g. f_low and f_isco, call this function twice and compute the difference. Parameters ...
[ "def", "nltides_gw_phase_difference", "(", "f", ",", "f0", ",", "amplitude", ",", "n", ",", "m1", ",", "m2", ")", ":", "f", ",", "f0", ",", "amplitude", ",", "n", ",", "m1", ",", "m2", ",", "input_is_array", "=", "ensurearray", "(", "f", ",", "f0",...
Calculate the gravitational-wave phase shift bwtween f and f_coalescence = infinity due to non-linear tides. To compute the phase shift between e.g. f_low and f_isco, call this function twice and compute the difference. Parameters ---------- f: float or numpy.array Frequency from which ...
[ "Calculate", "the", "gravitational", "-", "wave", "phase", "shift", "bwtween", "f", "and", "f_coalescence", "=", "infinity", "due", "to", "non", "-", "linear", "tides", ".", "To", "compute", "the", "phase", "shift", "between", "e", ".", "g", ".", "f_low", ...
python
train
30.775
Becksteinlab/GromacsWrapper
gromacs/core.py
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/core.py#L581-L606
def _build_arg_list(self, **kwargs): """Build list of arguments from the dict; keys must be valid gromacs flags.""" arglist = [] for flag, value in kwargs.items(): # XXX: check flag against allowed values flag = str(flag) if flag.startswith('_'): ...
[ "def", "_build_arg_list", "(", "self", ",", "*", "*", "kwargs", ")", ":", "arglist", "=", "[", "]", "for", "flag", ",", "value", "in", "kwargs", ".", "items", "(", ")", ":", "# XXX: check flag against allowed values", "flag", "=", "str", "(", "flag", ")"...
Build list of arguments from the dict; keys must be valid gromacs flags.
[ "Build", "list", "of", "arguments", "from", "the", "dict", ";", "keys", "must", "be", "valid", "gromacs", "flags", "." ]
python
valid
50.884615
Kortemme-Lab/pull_into_place
pull_into_place/structures.py
https://github.com/Kortemme-Lab/pull_into_place/blob/247f303100a612cc90cf31c86e4fe5052eb28c8d/pull_into_place/structures.py#L564-L572
def angle(array_of_xyzs): """ Calculates angle between three coordinate points (I could not find a package that does this but if one exists that would probably be better). Used for Angle constraints. """ ab = array_of_xyzs[0] - array_of_xyzs[1] cb = array_of_xyzs[2] - array_of_xyzs[1] retur...
[ "def", "angle", "(", "array_of_xyzs", ")", ":", "ab", "=", "array_of_xyzs", "[", "0", "]", "-", "array_of_xyzs", "[", "1", "]", "cb", "=", "array_of_xyzs", "[", "2", "]", "-", "array_of_xyzs", "[", "1", "]", "return", "np", ".", "arccos", "(", "(", ...
Calculates angle between three coordinate points (I could not find a package that does this but if one exists that would probably be better). Used for Angle constraints.
[ "Calculates", "angle", "between", "three", "coordinate", "points", "(", "I", "could", "not", "find", "a", "package", "that", "does", "this", "but", "if", "one", "exists", "that", "would", "probably", "be", "better", ")", ".", "Used", "for", "Angle", "const...
python
train
48.555556
senaite/senaite.core
bika/lims/upgrade/v01_03_000.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/upgrade/v01_03_000.py#L2260-L2286
def restore_review_history_for_affected_objects(portal): """Applies the review history for objects that are bound to new senaite_* workflows """ logger.info("Restoring review_history ...") query = dict(portal_type=NEW_SENAITE_WORKFLOW_BINDINGS) brains = api.search(query, UID_CATALOG) total =...
[ "def", "restore_review_history_for_affected_objects", "(", "portal", ")", ":", "logger", ".", "info", "(", "\"Restoring review_history ...\"", ")", "query", "=", "dict", "(", "portal_type", "=", "NEW_SENAITE_WORKFLOW_BINDINGS", ")", "brains", "=", "api", ".", "search"...
Applies the review history for objects that are bound to new senaite_* workflows
[ "Applies", "the", "review", "history", "for", "objects", "that", "are", "bound", "to", "new", "senaite_", "*", "workflows" ]
python
train
35.62963
richardkiss/pycoin
pycoin/coins/tx_utils.py
https://github.com/richardkiss/pycoin/blob/1e8d0d9fe20ce0347b97847bb529cd1bd84c7442/pycoin/coins/tx_utils.py#L134-L158
def create_signed_tx(network, spendables, payables, wifs=[], fee="standard", lock_time=0, version=1, **kwargs): """ This convenience function calls :func:`create_tx` and :func:`sign_tx` in turn. Read the documentation for those functions for information on the parameters. Usage:: ...
[ "def", "create_signed_tx", "(", "network", ",", "spendables", ",", "payables", ",", "wifs", "=", "[", "]", ",", "fee", "=", "\"standard\"", ",", "lock_time", "=", "0", ",", "version", "=", "1", ",", "*", "*", "kwargs", ")", ":", "tx", "=", "create_tx...
This convenience function calls :func:`create_tx` and :func:`sign_tx` in turn. Read the documentation for those functions for information on the parameters. Usage:: >>> spendables = spendables_for_address("1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH") >>> wifs = ["KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9...
[ "This", "convenience", "function", "calls", ":", "func", ":", "create_tx", "and", ":", "func", ":", "sign_tx", "in", "turn", ".", "Read", "the", "documentation", "for", "those", "functions", "for", "information", "on", "the", "parameters", "." ]
python
train
48.76
obriencj/python-javatools
javatools/__init__.py
https://github.com/obriencj/python-javatools/blob/9e2332b452ddc508bed0615937dddcb2cf051557/javatools/__init__.py#L1412-L1436
def pretty_descriptor(self): """ assemble a long member name from access flags, type, argument types, exceptions as applicable """ f = " ".join(self.pretty_access_flags()) p = self.pretty_type() n = self.get_name() t = ",".join(self.pretty_exceptions()) ...
[ "def", "pretty_descriptor", "(", "self", ")", ":", "f", "=", "\" \"", ".", "join", "(", "self", ".", "pretty_access_flags", "(", ")", ")", "p", "=", "self", ".", "pretty_type", "(", ")", "n", "=", "self", ".", "get_name", "(", ")", "t", "=", "\",\"...
assemble a long member name from access flags, type, argument types, exceptions as applicable
[ "assemble", "a", "long", "member", "name", "from", "access", "flags", "type", "argument", "types", "exceptions", "as", "applicable" ]
python
train
30.16
kenneth-reitz/args
args.py
https://github.com/kenneth-reitz/args/blob/9460f1a35eb3055e9e4de1f0a6932e0883c72d65/args.py#L121-L137
def first(self, x): """Returns first found index of given value (or list of values).""" def _find(x): try: return self.all.index(str(x)) except ValueError: return None if _is_collection(x): for item in x: found...
[ "def", "first", "(", "self", ",", "x", ")", ":", "def", "_find", "(", "x", ")", ":", "try", ":", "return", "self", ".", "all", ".", "index", "(", "str", "(", "x", ")", ")", "except", "ValueError", ":", "return", "None", "if", "_is_collection", "(...
Returns first found index of given value (or list of values).
[ "Returns", "first", "found", "index", "of", "given", "value", "(", "or", "list", "of", "values", ")", "." ]
python
train
26.764706
freevoid/django-datafilters
datafilters/filterform.py
https://github.com/freevoid/django-datafilters/blob/99051b3b3e97946981c0e9697576b0100093287c/datafilters/filterform.py#L118-L125
def is_empty(self): ''' Return `True` if form is valid and contains an empty lookup. ''' return (self.is_valid() and not self.simple_lookups and not self.complex_conditions and not self.extra_conditions)
[ "def", "is_empty", "(", "self", ")", ":", "return", "(", "self", ".", "is_valid", "(", ")", "and", "not", "self", ".", "simple_lookups", "and", "not", "self", ".", "complex_conditions", "and", "not", "self", ".", "extra_conditions", ")" ]
Return `True` if form is valid and contains an empty lookup.
[ "Return", "True", "if", "form", "is", "valid", "and", "contains", "an", "empty", "lookup", "." ]
python
train
33
CZ-NIC/yangson
yangson/datatype.py
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/datatype.py#L438-L440
def sorted_enums(self) -> List[Tuple[str, int]]: """Return list of enum items sorted by value.""" return sorted(self.enum.items(), key=lambda x: x[1])
[ "def", "sorted_enums", "(", "self", ")", "->", "List", "[", "Tuple", "[", "str", ",", "int", "]", "]", ":", "return", "sorted", "(", "self", ".", "enum", ".", "items", "(", ")", ",", "key", "=", "lambda", "x", ":", "x", "[", "1", "]", ")" ]
Return list of enum items sorted by value.
[ "Return", "list", "of", "enum", "items", "sorted", "by", "value", "." ]
python
train
54.666667
nickoala/telepot
telepot/__init__.py
https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/__init__.py#L816-L819
def leaveChat(self, chat_id): """ See: https://core.telegram.org/bots/api#leavechat """ p = _strip(locals()) return self._api_request('leaveChat', _rectify(p))
[ "def", "leaveChat", "(", "self", ",", "chat_id", ")", ":", "p", "=", "_strip", "(", "locals", "(", ")", ")", "return", "self", ".", "_api_request", "(", "'leaveChat'", ",", "_rectify", "(", "p", ")", ")" ]
See: https://core.telegram.org/bots/api#leavechat
[ "See", ":", "https", ":", "//", "core", ".", "telegram", ".", "org", "/", "bots", "/", "api#leavechat" ]
python
train
45
MacHu-GWU/pymongo_mate-project
pymongo_mate/pkg/pandas_mate/pkg/rolex/__init__.py
https://github.com/MacHu-GWU/pymongo_mate-project/blob/be53170c2db54cb705b9e548d32ef26c773ff7f3/pymongo_mate/pkg/pandas_mate/pkg/rolex/__init__.py#L297-L349
def _freq_parser(self, freq): """Parse timedelta. Valid keywords "days", "day", "d", "hours", "hour", "h", "minutes", "minute", "min", "m", "seconds", "second", "sec", "s", "weeks", "week", "w", """ freq = freq.lower().strip() valid_keywords = [ "day...
[ "def", "_freq_parser", "(", "self", ",", "freq", ")", ":", "freq", "=", "freq", ".", "lower", "(", ")", ".", "strip", "(", ")", "valid_keywords", "=", "[", "\"days\"", ",", "\"day\"", ",", "\"d\"", ",", "\"hours\"", ",", "\"hour\"", ",", "\"h\"", ","...
Parse timedelta. Valid keywords "days", "day", "d", "hours", "hour", "h", "minutes", "minute", "min", "m", "seconds", "second", "sec", "s", "weeks", "week", "w",
[ "Parse", "timedelta", "." ]
python
train
33.056604
django-leonardo/django-leonardo
leonardo/module/web/middlewares/horizon.py
https://github.com/django-leonardo/django-leonardo/blob/4b933e1792221a13b4028753d5f1d3499b0816d4/leonardo/module/web/middlewares/horizon.py#L145-L195
def process_exception(self, request, exception): """Catches internal Horizon exception classes such as NotAuthorized, NotFound and Http302 and handles them gracefully. """ if isinstance(exception, (exceptions.NotAuthorized, exceptions.NotAuthenticated))...
[ "def", "process_exception", "(", "self", ",", "request", ",", "exception", ")", ":", "if", "isinstance", "(", "exception", ",", "(", "exceptions", ".", "NotAuthorized", ",", "exceptions", ".", "NotAuthenticated", ")", ")", ":", "auth_url", "=", "settings", "...
Catches internal Horizon exception classes such as NotAuthorized, NotFound and Http302 and handles them gracefully.
[ "Catches", "internal", "Horizon", "exception", "classes", "such", "as", "NotAuthorized", "NotFound", "and", "Http302", "and", "handles", "them", "gracefully", "." ]
python
train
42
ARMmbed/icetea
icetea_lib/LogManager.py
https://github.com/ARMmbed/icetea/blob/b2b97ac607429830cf7d62dae2e3903692c7c778/icetea_lib/LogManager.py#L762-L780
def _read_config(config_location): """ Read configuration for logging from a json file. Merges the read dictionary to LOGGING_CONFIG. :param config_location: Location of file. :return: nothing. """ global LOGGING_CONFIG with open(config_location, "r") as config_loc: cfg_file = json....
[ "def", "_read_config", "(", "config_location", ")", ":", "global", "LOGGING_CONFIG", "with", "open", "(", "config_location", ",", "\"r\"", ")", "as", "config_loc", ":", "cfg_file", "=", "json", ".", "load", "(", "config_loc", ")", "if", "\"logging\"", "in", ...
Read configuration for logging from a json file. Merges the read dictionary to LOGGING_CONFIG. :param config_location: Location of file. :return: nothing.
[ "Read", "configuration", "for", "logging", "from", "a", "json", "file", ".", "Merges", "the", "read", "dictionary", "to", "LOGGING_CONFIG", "." ]
python
train
44.421053
relekang/python-semantic-release
semantic_release/history/logs.py
https://github.com/relekang/python-semantic-release/blob/76123f410180599a19e7c48da413880185bbea20/semantic_release/history/logs.py#L25-L63
def evaluate_version_bump(current_version: str, force: str = None) -> Optional[str]: """ Reads git log since last release to find out if should be a major, minor or patch release. :param current_version: A string with the current version number. :param force: A string with the bump level that should be...
[ "def", "evaluate_version_bump", "(", "current_version", ":", "str", ",", "force", ":", "str", "=", "None", ")", "->", "Optional", "[", "str", "]", ":", "debug", "(", "'evaluate_version_bump(\"{}\", \"{}\")'", ".", "format", "(", "current_version", ",", "force", ...
Reads git log since last release to find out if should be a major, minor or patch release. :param current_version: A string with the current version number. :param force: A string with the bump level that should be forced. :return: A string with either major, minor or patch if there should be a release. If...
[ "Reads", "git", "log", "since", "last", "release", "to", "find", "out", "if", "should", "be", "a", "major", "minor", "or", "patch", "release", "." ]
python
train
36.230769
billyoverton/tweetqueue
tweetqueue/__main__.py
https://github.com/billyoverton/tweetqueue/blob/e54972a0137ea2a21b2357b81408d9d4c92fdd61/tweetqueue/__main__.py#L78-L88
def tweet(ctx, message): """Sends a tweet directly to your timeline""" if not valid_tweet(message): click.echo("Message is too long for twitter.") click.echo("Message:" + message) ctx.exit(2) if not ctx.obj['DRYRUN']: ctx.obj['TWEEPY_API'].update_status(message) else: ...
[ "def", "tweet", "(", "ctx", ",", "message", ")", ":", "if", "not", "valid_tweet", "(", "message", ")", ":", "click", ".", "echo", "(", "\"Message is too long for twitter.\"", ")", "click", ".", "echo", "(", "\"Message:\"", "+", "message", ")", "ctx", ".", ...
Sends a tweet directly to your timeline
[ "Sends", "a", "tweet", "directly", "to", "your", "timeline" ]
python
train
33.181818
mbedmicro/pyOCD
pyocd/utility/server.py
https://github.com/mbedmicro/pyOCD/blob/41a174718a9739f3cbe785c2ba21cb7fd1310c6f/pyocd/utility/server.py#L116-L129
def write(self, data): """! @brief Write bytes into the connection.""" # If nobody is connected, act like all data was written anyway. if self.connected is None: return 0 data = to_bytes_safe(data) size = len(data) remaining = size while remaining: ...
[ "def", "write", "(", "self", ",", "data", ")", ":", "# If nobody is connected, act like all data was written anyway.", "if", "self", ".", "connected", "is", "None", ":", "return", "0", "data", "=", "to_bytes_safe", "(", "data", ")", "size", "=", "len", "(", "d...
! @brief Write bytes into the connection.
[ "!" ]
python
train
33.571429
contentful/contentful-management.py
contentful_management/uploads_proxy.py
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/uploads_proxy.py#L58-L63
def find(self, upload_id, **kwargs): """ Finds an upload by ID. """ return super(UploadsProxy, self).find(upload_id, file_upload=True)
[ "def", "find", "(", "self", ",", "upload_id", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "UploadsProxy", ",", "self", ")", ".", "find", "(", "upload_id", ",", "file_upload", "=", "True", ")" ]
Finds an upload by ID.
[ "Finds", "an", "upload", "by", "ID", "." ]
python
train
27
saltstack/salt
salt/utils/pkg/win.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L235-L261
def __squid_to_guid(self, squid): ''' Squished GUID (SQUID) to GUID. A SQUID is a Squished/Compressed version of a GUID to use up less space in the registry. Args: squid (str): Squished GUID. Returns: str: the GUID if a valid SQUID provided. ...
[ "def", "__squid_to_guid", "(", "self", ",", "squid", ")", ":", "if", "not", "squid", ":", "return", "''", "squid_match", "=", "self", ".", "__squid_pattern", ".", "match", "(", "squid", ")", "guid", "=", "''", "if", "squid_match", "is", "not", "None", ...
Squished GUID (SQUID) to GUID. A SQUID is a Squished/Compressed version of a GUID to use up less space in the registry. Args: squid (str): Squished GUID. Returns: str: the GUID if a valid SQUID provided.
[ "Squished", "GUID", "(", "SQUID", ")", "to", "GUID", "." ]
python
train
31.333333