partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
BotSkeleton.perform_batch_reply
Performs batch reply on target accounts. Looks up the recent messages of the target user, applies the callback, and replies with what the callback generates. :param callback: a callback taking a message id, message contents, and optional extra keys, ...
botskeleton/botskeleton.py
def perform_batch_reply( self, *, callback: Callable[..., str]=None, target_handles: Dict[str, str]=None, lookback_limit: int=20, per_service_lookback_limit: Dict[str, int]=None, ) -> IterationRecord: """ Performs batch reply on...
def perform_batch_reply( self, *, callback: Callable[..., str]=None, target_handles: Dict[str, str]=None, lookback_limit: int=20, per_service_lookback_limit: Dict[str, int]=None, ) -> IterationRecord: """ Performs batch reply on...
[ "Performs", "batch", "reply", "on", "target", "accounts", ".", "Looks", "up", "the", "recent", "messages", "of", "the", "target", "user", "applies", "the", "callback", "and", "replies", "with", "what", "the", "callback", "generates", "." ]
alixnovosi/botskeleton
python
https://github.com/alixnovosi/botskeleton/blob/55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9/botskeleton/botskeleton.py#L271-L341
[ "def", "perform_batch_reply", "(", "self", ",", "*", ",", "callback", ":", "Callable", "[", "...", ",", "str", "]", "=", "None", ",", "target_handles", ":", "Dict", "[", "str", ",", "str", "]", "=", "None", ",", "lookback_limit", ":", "int", "=", "20...
55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9
train
BotSkeleton.nap
Go to sleep for the duration of self.delay. :returns: None
botskeleton/botskeleton.py
def nap(self) -> None: """ Go to sleep for the duration of self.delay. :returns: None """ self.log.info(f"Sleeping for {self.delay} seconds.") for _ in progress.bar(range(self.delay)): time.sleep(1)
def nap(self) -> None: """ Go to sleep for the duration of self.delay. :returns: None """ self.log.info(f"Sleeping for {self.delay} seconds.") for _ in progress.bar(range(self.delay)): time.sleep(1)
[ "Go", "to", "sleep", "for", "the", "duration", "of", "self", ".", "delay", "." ]
alixnovosi/botskeleton
python
https://github.com/alixnovosi/botskeleton/blob/55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9/botskeleton/botskeleton.py#L343-L351
[ "def", "nap", "(", "self", ")", "->", "None", ":", "self", ".", "log", ".", "info", "(", "f\"Sleeping for {self.delay} seconds.\"", ")", "for", "_", "in", "progress", ".", "bar", "(", "range", "(", "self", ".", "delay", ")", ")", ":", "time", ".", "s...
55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9
train
BotSkeleton.store_extra_info
Store some extra value in the messaging storage. :param key: key of dictionary entry to add. :param value: value of dictionary entry to add. :returns: None
botskeleton/botskeleton.py
def store_extra_info(self, key: str, value: Any) -> None: """ Store some extra value in the messaging storage. :param key: key of dictionary entry to add. :param value: value of dictionary entry to add. :returns: None """ self.extra_keys[key] = value
def store_extra_info(self, key: str, value: Any) -> None: """ Store some extra value in the messaging storage. :param key: key of dictionary entry to add. :param value: value of dictionary entry to add. :returns: None """ self.extra_keys[key] = value
[ "Store", "some", "extra", "value", "in", "the", "messaging", "storage", "." ]
alixnovosi/botskeleton
python
https://github.com/alixnovosi/botskeleton/blob/55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9/botskeleton/botskeleton.py#L353-L361
[ "def", "store_extra_info", "(", "self", ",", "key", ":", "str", ",", "value", ":", "Any", ")", "->", "None", ":", "self", ".", "extra_keys", "[", "key", "]", "=", "value" ]
55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9
train
BotSkeleton.store_extra_keys
Store several extra values in the messaging storage. :param d: dictionary entry to merge with current self.extra_keys. :returns: None
botskeleton/botskeleton.py
def store_extra_keys(self, d: Dict[str, Any]) -> None: """ Store several extra values in the messaging storage. :param d: dictionary entry to merge with current self.extra_keys. :returns: None """ new_dict = dict(self.extra_keys, **d) self.extra_keys = new_dict.c...
def store_extra_keys(self, d: Dict[str, Any]) -> None: """ Store several extra values in the messaging storage. :param d: dictionary entry to merge with current self.extra_keys. :returns: None """ new_dict = dict(self.extra_keys, **d) self.extra_keys = new_dict.c...
[ "Store", "several", "extra", "values", "in", "the", "messaging", "storage", "." ]
alixnovosi/botskeleton
python
https://github.com/alixnovosi/botskeleton/blob/55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9/botskeleton/botskeleton.py#L363-L371
[ "def", "store_extra_keys", "(", "self", ",", "d", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "None", ":", "new_dict", "=", "dict", "(", "self", ".", "extra_keys", ",", "*", "*", "d", ")", "self", ".", "extra_keys", "=", "new_dict", ".", ...
55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9
train
BotSkeleton.update_history
Update messaging history on disk. :returns: None
botskeleton/botskeleton.py
def update_history(self) -> None: """ Update messaging history on disk. :returns: None """ self.log.debug(f"Saving history. History is: \n{self.history}") jsons = [] for item in self.history: json_item = item.__dict__ # Convert sub-entri...
def update_history(self) -> None: """ Update messaging history on disk. :returns: None """ self.log.debug(f"Saving history. History is: \n{self.history}") jsons = [] for item in self.history: json_item = item.__dict__ # Convert sub-entri...
[ "Update", "messaging", "history", "on", "disk", "." ]
alixnovosi/botskeleton
python
https://github.com/alixnovosi/botskeleton/blob/55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9/botskeleton/botskeleton.py#L373-L395
[ "def", "update_history", "(", "self", ")", "->", "None", ":", "self", ".", "log", ".", "debug", "(", "f\"Saving history. History is: \\n{self.history}\"", ")", "jsons", "=", "[", "]", "for", "item", "in", "self", ".", "history", ":", "json_item", "=", "item"...
55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9
train
BotSkeleton.load_history
Load messaging history from disk to self. :returns: List of iteration records comprising history.
botskeleton/botskeleton.py
def load_history(self) -> List["IterationRecord"]: """ Load messaging history from disk to self. :returns: List of iteration records comprising history. """ if path.isfile(self.history_filename): with open(self.history_filename, "r") as f: try: ...
def load_history(self) -> List["IterationRecord"]: """ Load messaging history from disk to self. :returns: List of iteration records comprising history. """ if path.isfile(self.history_filename): with open(self.history_filename, "r") as f: try: ...
[ "Load", "messaging", "history", "from", "disk", "to", "self", "." ]
alixnovosi/botskeleton
python
https://github.com/alixnovosi/botskeleton/blob/55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9/botskeleton/botskeleton.py#L397-L447
[ "def", "load_history", "(", "self", ")", "->", "List", "[", "\"IterationRecord\"", "]", ":", "if", "path", ".", "isfile", "(", "self", ".", "history_filename", ")", ":", "with", "open", "(", "self", ".", "history_filename", ",", "\"r\"", ")", "as", "f", ...
55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9
train
BotSkeleton._setup_all_outputs
Set up all output methods. Provide them credentials and anything else they need.
botskeleton/botskeleton.py
def _setup_all_outputs(self) -> None: """Set up all output methods. Provide them credentials and anything else they need.""" # The way this is gonna work is that we assume an output should be set up iff it has a # credentials_ directory under our secrets dir. for key in self.outputs.key...
def _setup_all_outputs(self) -> None: """Set up all output methods. Provide them credentials and anything else they need.""" # The way this is gonna work is that we assume an output should be set up iff it has a # credentials_ directory under our secrets dir. for key in self.outputs.key...
[ "Set", "up", "all", "output", "methods", ".", "Provide", "them", "credentials", "and", "anything", "else", "they", "need", "." ]
alixnovosi/botskeleton
python
https://github.com/alixnovosi/botskeleton/blob/55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9/botskeleton/botskeleton.py#L452-L475
[ "def", "_setup_all_outputs", "(", "self", ")", "->", "None", ":", "# The way this is gonna work is that we assume an output should be set up iff it has a", "# credentials_ directory under our secrets dir.", "for", "key", "in", "self", ".", "outputs", ".", "keys", "(", ")", ":...
55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9
train
BotSkeleton._parse_output_records
Parse output records into dicts ready for JSON.
botskeleton/botskeleton.py
def _parse_output_records(self, item: IterationRecord) -> Dict[str, Any]: """Parse output records into dicts ready for JSON.""" output_records = {} for key, sub_item in item.output_records.items(): if isinstance(sub_item, dict) or isinstance(sub_item, list): output_re...
def _parse_output_records(self, item: IterationRecord) -> Dict[str, Any]: """Parse output records into dicts ready for JSON.""" output_records = {} for key, sub_item in item.output_records.items(): if isinstance(sub_item, dict) or isinstance(sub_item, list): output_re...
[ "Parse", "output", "records", "into", "dicts", "ready", "for", "JSON", "." ]
alixnovosi/botskeleton
python
https://github.com/alixnovosi/botskeleton/blob/55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9/botskeleton/botskeleton.py#L477-L486
[ "def", "_parse_output_records", "(", "self", ",", "item", ":", "IterationRecord", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "output_records", "=", "{", "}", "for", "key", ",", "sub_item", "in", "item", ".", "output_records", ".", "items", "(",...
55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9
train
make_dir
Create the directory of a fully qualified file name if it does not exist. :param fname: File name :type fname: string Equivalent to these Bash shell commands: .. code-block:: bash $ fname="${HOME}/mydir/myfile.txt" $ dir=$(dirname "${fname}") $ mkdir -p "${dir}" :param ...
pmisc/file.py
def make_dir(fname): """ Create the directory of a fully qualified file name if it does not exist. :param fname: File name :type fname: string Equivalent to these Bash shell commands: .. code-block:: bash $ fname="${HOME}/mydir/myfile.txt" $ dir=$(dirname "${fname}") ...
def make_dir(fname): """ Create the directory of a fully qualified file name if it does not exist. :param fname: File name :type fname: string Equivalent to these Bash shell commands: .. code-block:: bash $ fname="${HOME}/mydir/myfile.txt" $ dir=$(dirname "${fname}") ...
[ "Create", "the", "directory", "of", "a", "fully", "qualified", "file", "name", "if", "it", "does", "not", "exist", "." ]
pmacosta/pmisc
python
https://github.com/pmacosta/pmisc/blob/dd2bb32e59eee872f1ef2db2d9921a396ab9f50b/pmisc/file.py#L14-L34
[ "def", "make_dir", "(", "fname", ")", ":", "file_path", ",", "fname", "=", "os", ".", "path", ".", "split", "(", "os", ".", "path", ".", "abspath", "(", "fname", ")", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "file_path", ")", ":",...
dd2bb32e59eee872f1ef2db2d9921a396ab9f50b
train
normalize_windows_fname
r""" Fix potential problems with a Microsoft Windows file name. Superfluous backslashes are removed and unintended escape sequences are converted to their equivalent (presumably correct and intended) representation, for example :code:`r'\\\\x07pps'` is transformed to :code:`r'\\\\\\\\apps'`. A file...
pmisc/file.py
def normalize_windows_fname(fname, _force=False): r""" Fix potential problems with a Microsoft Windows file name. Superfluous backslashes are removed and unintended escape sequences are converted to their equivalent (presumably correct and intended) representation, for example :code:`r'\\\\x07pps'`...
def normalize_windows_fname(fname, _force=False): r""" Fix potential problems with a Microsoft Windows file name. Superfluous backslashes are removed and unintended escape sequences are converted to their equivalent (presumably correct and intended) representation, for example :code:`r'\\\\x07pps'`...
[ "r", "Fix", "potential", "problems", "with", "a", "Microsoft", "Windows", "file", "name", "." ]
pmacosta/pmisc
python
https://github.com/pmacosta/pmisc/blob/dd2bb32e59eee872f1ef2db2d9921a396ab9f50b/pmisc/file.py#L37-L79
[ "def", "normalize_windows_fname", "(", "fname", ",", "_force", "=", "False", ")", ":", "if", "(", "platform", ".", "system", "(", ")", ".", "lower", "(", ")", "!=", "\"windows\"", ")", "and", "(", "not", "_force", ")", ":", "# pragma: no cover", "return"...
dd2bb32e59eee872f1ef2db2d9921a396ab9f50b
train
_homogenize_linesep
Enforce line separators to be the right one depending on platform.
pmisc/rst.py
def _homogenize_linesep(line): """Enforce line separators to be the right one depending on platform.""" token = str(uuid.uuid4()) line = line.replace(os.linesep, token).replace("\n", "").replace("\r", "") return line.replace(token, os.linesep)
def _homogenize_linesep(line): """Enforce line separators to be the right one depending on platform.""" token = str(uuid.uuid4()) line = line.replace(os.linesep, token).replace("\n", "").replace("\r", "") return line.replace(token, os.linesep)
[ "Enforce", "line", "separators", "to", "be", "the", "right", "one", "depending", "on", "platform", "." ]
pmacosta/pmisc
python
https://github.com/pmacosta/pmisc/blob/dd2bb32e59eee872f1ef2db2d9921a396ab9f50b/pmisc/rst.py#L25-L29
[ "def", "_homogenize_linesep", "(", "line", ")", ":", "token", "=", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", "line", "=", "line", ".", "replace", "(", "os", ".", "linesep", ",", "token", ")", ".", "replace", "(", "\"\\n\"", ",", "\"\"", ")",...
dd2bb32e59eee872f1ef2db2d9921a396ab9f50b
train
_proc_token
Process line range tokens.
pmisc/rst.py
def _proc_token(spec, mlines): """Process line range tokens.""" spec = spec.strip().replace(" ", "") regexp = re.compile(r".*[^0123456789\-,]+.*") tokens = spec.split(",") cond = any([not item for item in tokens]) if ("--" in spec) or ("-," in spec) or (",-" in spec) or cond or regexp.match(spec...
def _proc_token(spec, mlines): """Process line range tokens.""" spec = spec.strip().replace(" ", "") regexp = re.compile(r".*[^0123456789\-,]+.*") tokens = spec.split(",") cond = any([not item for item in tokens]) if ("--" in spec) or ("-," in spec) or (",-" in spec) or cond or regexp.match(spec...
[ "Process", "line", "range", "tokens", "." ]
pmacosta/pmisc
python
https://github.com/pmacosta/pmisc/blob/dd2bb32e59eee872f1ef2db2d9921a396ab9f50b/pmisc/rst.py#L32-L56
[ "def", "_proc_token", "(", "spec", ",", "mlines", ")", ":", "spec", "=", "spec", ".", "strip", "(", ")", ".", "replace", "(", "\" \"", ",", "\"\"", ")", "regexp", "=", "re", ".", "compile", "(", "r\".*[^0123456789\\-,]+.*\"", ")", "tokens", "=", "spec"...
dd2bb32e59eee872f1ef2db2d9921a396ab9f50b
train
incfile
r""" Return a Python source file formatted in reStructuredText. .. role:: bash(code) :language: bash :param fname: File name, relative to environment variable :bash:`PKG_DOC_DIR` :type fname: string :param fpointer: Output function pointer. Normally is :code:`cog.out` b...
pmisc/rst.py
def incfile(fname, fpointer, lrange=None, sdir=None): r""" Return a Python source file formatted in reStructuredText. .. role:: bash(code) :language: bash :param fname: File name, relative to environment variable :bash:`PKG_DOC_DIR` :type fname: string :param fpoint...
def incfile(fname, fpointer, lrange=None, sdir=None): r""" Return a Python source file formatted in reStructuredText. .. role:: bash(code) :language: bash :param fname: File name, relative to environment variable :bash:`PKG_DOC_DIR` :type fname: string :param fpoint...
[ "r", "Return", "a", "Python", "source", "file", "formatted", "in", "reStructuredText", "." ]
pmacosta/pmisc
python
https://github.com/pmacosta/pmisc/blob/dd2bb32e59eee872f1ef2db2d9921a396ab9f50b/pmisc/rst.py#L59-L133
[ "def", "incfile", "(", "fname", ",", "fpointer", ",", "lrange", "=", "None", ",", "sdir", "=", "None", ")", ":", "# pylint: disable=R0914", "# Read file", "file_dir", "=", "(", "sdir", "if", "sdir", "else", "os", ".", "environ", ".", "get", "(", "\"PKG_D...
dd2bb32e59eee872f1ef2db2d9921a396ab9f50b
train
ste
Print STDOUT of a shell command formatted in reStructuredText. This is a simplified version of :py:func:`pmisc.term_echo`. :param command: Shell command (relative to **mdir** if **env** is not given) :type command: string :param nindent: Indentation level :type nindent: integer :param mdir...
pmisc/rst.py
def ste(command, nindent, mdir, fpointer, env=None): """ Print STDOUT of a shell command formatted in reStructuredText. This is a simplified version of :py:func:`pmisc.term_echo`. :param command: Shell command (relative to **mdir** if **env** is not given) :type command: string :param ninden...
def ste(command, nindent, mdir, fpointer, env=None): """ Print STDOUT of a shell command formatted in reStructuredText. This is a simplified version of :py:func:`pmisc.term_echo`. :param command: Shell command (relative to **mdir** if **env** is not given) :type command: string :param ninden...
[ "Print", "STDOUT", "of", "a", "shell", "command", "formatted", "in", "reStructuredText", "." ]
pmacosta/pmisc
python
https://github.com/pmacosta/pmisc/blob/dd2bb32e59eee872f1ef2db2d9921a396ab9f50b/pmisc/rst.py#L136-L192
[ "def", "ste", "(", "command", ",", "nindent", ",", "mdir", ",", "fpointer", ",", "env", "=", "None", ")", ":", "sdir", "=", "LDELIM", "+", "\"PKG_BIN_DIR\"", "+", "RDELIM", "command", "=", "(", "sdir", "+", "(", "\"{sep}{cmd}\"", ".", "format", "(", ...
dd2bb32e59eee872f1ef2db2d9921a396ab9f50b
train
term_echo
Print STDOUT of a shell command formatted in reStructuredText. .. role:: bash(code) :language: bash :param command: Shell command :type command: string :param nindent: Indentation level :type nindent: integer :param env: Environment variable replacement dictionary. The ...
pmisc/rst.py
def term_echo(command, nindent=0, env=None, fpointer=None, cols=60): """ Print STDOUT of a shell command formatted in reStructuredText. .. role:: bash(code) :language: bash :param command: Shell command :type command: string :param nindent: Indentation level :type nindent: integ...
def term_echo(command, nindent=0, env=None, fpointer=None, cols=60): """ Print STDOUT of a shell command formatted in reStructuredText. .. role:: bash(code) :language: bash :param command: Shell command :type command: string :param nindent: Indentation level :type nindent: integ...
[ "Print", "STDOUT", "of", "a", "shell", "command", "formatted", "in", "reStructuredText", "." ]
pmacosta/pmisc
python
https://github.com/pmacosta/pmisc/blob/dd2bb32e59eee872f1ef2db2d9921a396ab9f50b/pmisc/rst.py#L195-L258
[ "def", "term_echo", "(", "command", ",", "nindent", "=", "0", ",", "env", "=", "None", ",", "fpointer", "=", "None", ",", "cols", "=", "60", ")", ":", "# pylint: disable=R0204", "# Set argparse width so that output does not need horizontal scroll", "# bar in narrow wi...
dd2bb32e59eee872f1ef2db2d9921a396ab9f50b
train
flo
Return the string given by param formatted with the callers locals.
fabfile.py
def flo(string): '''Return the string given by param formatted with the callers locals.''' callers_locals = {} frame = inspect.currentframe() try: outerframe = frame.f_back callers_locals = outerframe.f_locals finally: del frame return string.format(**callers_locals)
def flo(string): '''Return the string given by param formatted with the callers locals.''' callers_locals = {} frame = inspect.currentframe() try: outerframe = frame.f_back callers_locals = outerframe.f_locals finally: del frame return string.format(**callers_locals)
[ "Return", "the", "string", "given", "by", "param", "formatted", "with", "the", "callers", "locals", "." ]
theno/utlz
python
https://github.com/theno/utlz/blob/bf7d2b53f3e0d35c6f8ded81f3f774a74fcd3389/fabfile.py#L10-L19
[ "def", "flo", "(", "string", ")", ":", "callers_locals", "=", "{", "}", "frame", "=", "inspect", ".", "currentframe", "(", ")", "try", ":", "outerframe", "=", "frame", ".", "f_back", "callers_locals", "=", "outerframe", ".", "f_locals", "finally", ":", "...
bf7d2b53f3e0d35c6f8ded81f3f774a74fcd3389
train
_wrap_with
Color wrapper. Example: >>> blue = _wrap_with('34') >>> print(blue('text')) \033[34mtext\033[0m
fabfile.py
def _wrap_with(color_code): '''Color wrapper. Example: >>> blue = _wrap_with('34') >>> print(blue('text')) \033[34mtext\033[0m ''' def inner(text, bold=False): '''Inner color function.''' code = color_code if bold: code = flo("1;{code}") ...
def _wrap_with(color_code): '''Color wrapper. Example: >>> blue = _wrap_with('34') >>> print(blue('text')) \033[34mtext\033[0m ''' def inner(text, bold=False): '''Inner color function.''' code = color_code if bold: code = flo("1;{code}") ...
[ "Color", "wrapper", "." ]
theno/utlz
python
https://github.com/theno/utlz/blob/bf7d2b53f3e0d35c6f8ded81f3f774a74fcd3389/fabfile.py#L22-L36
[ "def", "_wrap_with", "(", "color_code", ")", ":", "def", "inner", "(", "text", ",", "bold", "=", "False", ")", ":", "'''Inner color function.'''", "code", "=", "color_code", "if", "bold", ":", "code", "=", "flo", "(", "\"1;{code}\"", ")", "return", "flo", ...
bf7d2b53f3e0d35c6f8ded81f3f774a74fcd3389
train
clean
Delete temporary files not under version control. Args: deltox: If True, delete virtual environments used by tox
fabfile.py
def clean(deltox=False): '''Delete temporary files not under version control. Args: deltox: If True, delete virtual environments used by tox ''' basedir = dirname(__file__) print(cyan('delete temp files and dirs for packaging')) local(flo( 'rm -rf ' '{basedir}/.eggs/ ...
def clean(deltox=False): '''Delete temporary files not under version control. Args: deltox: If True, delete virtual environments used by tox ''' basedir = dirname(__file__) print(cyan('delete temp files and dirs for packaging')) local(flo( 'rm -rf ' '{basedir}/.eggs/ ...
[ "Delete", "temporary", "files", "not", "under", "version", "control", "." ]
theno/utlz
python
https://github.com/theno/utlz/blob/bf7d2b53f3e0d35c6f8ded81f3f774a74fcd3389/fabfile.py#L76-L112
[ "def", "clean", "(", "deltox", "=", "False", ")", ":", "basedir", "=", "dirname", "(", "__file__", ")", "print", "(", "cyan", "(", "'delete temp files and dirs for packaging'", ")", ")", "local", "(", "flo", "(", "'rm -rf '", "'{basedir}/.eggs/ '", "'{basedir}...
bf7d2b53f3e0d35c6f8ded81f3f774a74fcd3389
train
pythons
Install latest pythons with pyenv. The python version will be activated in the projects base dir. Will skip already installed latest python versions.
fabfile.py
def pythons(): '''Install latest pythons with pyenv. The python version will be activated in the projects base dir. Will skip already installed latest python versions. ''' if not _pyenv_exists(): print('\npyenv is not installed. You can install it with fabsetup ' '(https://gi...
def pythons(): '''Install latest pythons with pyenv. The python version will be activated in the projects base dir. Will skip already installed latest python versions. ''' if not _pyenv_exists(): print('\npyenv is not installed. You can install it with fabsetup ' '(https://gi...
[ "Install", "latest", "pythons", "with", "pyenv", "." ]
theno/utlz
python
https://github.com/theno/utlz/blob/bf7d2b53f3e0d35c6f8ded81f3f774a74fcd3389/fabfile.py#L135-L167
[ "def", "pythons", "(", ")", ":", "if", "not", "_pyenv_exists", "(", ")", ":", "print", "(", "'\\npyenv is not installed. You can install it with fabsetup '", "'(https://github.com/theno/fabsetup):\\n\\n '", "+", "cyan", "(", "'mkdir ~/repos && cd ~/repos\\n '", "'git clon...
bf7d2b53f3e0d35c6f8ded81f3f774a74fcd3389
train
tox
Run tox. Build package and run unit tests against several pythons. Args: args: Optional arguments passed to tox. Example: fab tox:'-e py36 -r'
fabfile.py
def tox(args=''): '''Run tox. Build package and run unit tests against several pythons. Args: args: Optional arguments passed to tox. Example: fab tox:'-e py36 -r' ''' basedir = dirname(__file__) latest_pythons = _determine_latest_pythons() # e.g. highest_mino...
def tox(args=''): '''Run tox. Build package and run unit tests against several pythons. Args: args: Optional arguments passed to tox. Example: fab tox:'-e py36 -r' ''' basedir = dirname(__file__) latest_pythons = _determine_latest_pythons() # e.g. highest_mino...
[ "Run", "tox", "." ]
theno/utlz
python
https://github.com/theno/utlz/blob/bf7d2b53f3e0d35c6f8ded81f3f774a74fcd3389/fabfile.py#L182-L200
[ "def", "tox", "(", "args", "=", "''", ")", ":", "basedir", "=", "dirname", "(", "__file__", ")", "latest_pythons", "=", "_determine_latest_pythons", "(", ")", "# e.g. highest_minor_python: '3.6'", "highest_minor_python", "=", "_highest_minor", "(", "latest_pythons", ...
bf7d2b53f3e0d35c6f8ded81f3f774a74fcd3389
train
pypi
Build package and upload to pypi.
fabfile.py
def pypi(): '''Build package and upload to pypi.''' if query_yes_no('version updated in setup.py?'): print(cyan('\n## clean-up\n')) execute(clean) basedir = dirname(__file__) latest_pythons = _determine_latest_pythons() # e.g. highest_minor: '3.6' highest_minor...
def pypi(): '''Build package and upload to pypi.''' if query_yes_no('version updated in setup.py?'): print(cyan('\n## clean-up\n')) execute(clean) basedir = dirname(__file__) latest_pythons = _determine_latest_pythons() # e.g. highest_minor: '3.6' highest_minor...
[ "Build", "package", "and", "upload", "to", "pypi", "." ]
theno/utlz
python
https://github.com/theno/utlz/blob/bf7d2b53f3e0d35c6f8ded81f3f774a74fcd3389/fabfile.py#L235-L253
[ "def", "pypi", "(", ")", ":", "if", "query_yes_no", "(", "'version updated in setup.py?'", ")", ":", "print", "(", "cyan", "(", "'\\n## clean-up\\n'", ")", ")", "execute", "(", "clean", ")", "basedir", "=", "dirname", "(", "__file__", ")", "latest_pythons", ...
bf7d2b53f3e0d35c6f8ded81f3f774a74fcd3389
train
chk_col_numbers
Check that none of the input column numbers is out of range. (Instead of defining this function, we could depend on Python's built-in IndexError exception for this issue, but the IndexError exception wouldn't include line number information, which is helpful for users to find exactly which line is the c...
genes/management/commands/genes_load_gene_history.py
def chk_col_numbers(line_num, num_cols, tax_id_col, id_col, symbol_col): """ Check that none of the input column numbers is out of range. (Instead of defining this function, we could depend on Python's built-in IndexError exception for this issue, but the IndexError exception wouldn't include line n...
def chk_col_numbers(line_num, num_cols, tax_id_col, id_col, symbol_col): """ Check that none of the input column numbers is out of range. (Instead of defining this function, we could depend on Python's built-in IndexError exception for this issue, but the IndexError exception wouldn't include line n...
[ "Check", "that", "none", "of", "the", "input", "column", "numbers", "is", "out", "of", "range", ".", "(", "Instead", "of", "defining", "this", "function", "we", "could", "depend", "on", "Python", "s", "built", "-", "in", "IndexError", "exception", "for", ...
greenelab/django-genes
python
https://github.com/greenelab/django-genes/blob/298939adcb115031acfc11cfcef60ea0b596fae5/genes/management/commands/genes_load_gene_history.py#L104-L124
[ "def", "chk_col_numbers", "(", "line_num", ",", "num_cols", ",", "tax_id_col", ",", "id_col", ",", "symbol_col", ")", ":", "bad_col", "=", "''", "if", "tax_id_col", ">=", "num_cols", ":", "bad_col", "=", "'tax_id_col'", "elif", "id_col", ">=", "num_cols", ":...
298939adcb115031acfc11cfcef60ea0b596fae5
train
import_gene_history
Read input gene history file into the database. Note that the arguments tax_id_col, id_col and symbol_col have been converted into 0-based column indexes.
genes/management/commands/genes_load_gene_history.py
def import_gene_history(file_handle, tax_id, tax_id_col, id_col, symbol_col): """ Read input gene history file into the database. Note that the arguments tax_id_col, id_col and symbol_col have been converted into 0-based column indexes. """ # Make sure that tax_id is not "" or " " if not t...
def import_gene_history(file_handle, tax_id, tax_id_col, id_col, symbol_col): """ Read input gene history file into the database. Note that the arguments tax_id_col, id_col and symbol_col have been converted into 0-based column indexes. """ # Make sure that tax_id is not "" or " " if not t...
[ "Read", "input", "gene", "history", "file", "into", "the", "database", ".", "Note", "that", "the", "arguments", "tax_id_col", "id_col", "and", "symbol_col", "have", "been", "converted", "into", "0", "-", "based", "column", "indexes", "." ]
greenelab/django-genes
python
https://github.com/greenelab/django-genes/blob/298939adcb115031acfc11cfcef60ea0b596fae5/genes/management/commands/genes_load_gene_history.py#L127-L173
[ "def", "import_gene_history", "(", "file_handle", ",", "tax_id", ",", "tax_id_col", ",", "id_col", ",", "symbol_col", ")", ":", "# Make sure that tax_id is not \"\" or \" \"", "if", "not", "tax_id", "or", "tax_id", ".", "isspace", "(", ")", ":", "raise", "Excepti...
298939adcb115031acfc11cfcef60ea0b596fae5
train
MastodonSkeleton.cred_init
Initialize what requires credentials/secret files.
botskeleton/outputs/output_mastodon.py
def cred_init( self, *, secrets_dir: str, log: Logger, bot_name: str="", ) -> None: """Initialize what requires credentials/secret files.""" super().__init__(secrets_dir=secrets_dir, log=log, bot_name=bot_name) self.ldebug("Retriev...
def cred_init( self, *, secrets_dir: str, log: Logger, bot_name: str="", ) -> None: """Initialize what requires credentials/secret files.""" super().__init__(secrets_dir=secrets_dir, log=log, bot_name=bot_name) self.ldebug("Retriev...
[ "Initialize", "what", "requires", "credentials", "/", "secret", "files", "." ]
alixnovosi/botskeleton
python
https://github.com/alixnovosi/botskeleton/blob/55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9/botskeleton/outputs/output_mastodon.py#L18-L44
[ "def", "cred_init", "(", "self", ",", "*", ",", "secrets_dir", ":", "str", ",", "log", ":", "Logger", ",", "bot_name", ":", "str", "=", "\"\"", ",", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "secrets_dir", "=", "secrets_dir", ...
55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9
train
MastodonSkeleton.send
Send mastodon message. :param text: text to send in post. :returns: list of output records, each corresponding to either a single post, or an error.
botskeleton/outputs/output_mastodon.py
def send( self, *, text: str, ) -> List[OutputRecord]: """ Send mastodon message. :param text: text to send in post. :returns: list of output records, each corresponding to either a single post, or an error. """ ...
def send( self, *, text: str, ) -> List[OutputRecord]: """ Send mastodon message. :param text: text to send in post. :returns: list of output records, each corresponding to either a single post, or an error. """ ...
[ "Send", "mastodon", "message", "." ]
alixnovosi/botskeleton
python
https://github.com/alixnovosi/botskeleton/blob/55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9/botskeleton/outputs/output_mastodon.py#L46-L70
[ "def", "send", "(", "self", ",", "*", ",", "text", ":", "str", ",", ")", "->", "List", "[", "OutputRecord", "]", ":", "try", ":", "status", "=", "self", ".", "api", ".", "status_post", "(", "status", "=", "text", ")", "return", "[", "TootRecord", ...
55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9
train
MastodonSkeleton.send_with_media
Upload media to mastodon, and send status and media, and captions if present. :param text: post text. :param files: list of files to upload with post. :param captions: list of captions to include as alt-text with files. :returns: list of output records, each ...
botskeleton/outputs/output_mastodon.py
def send_with_media( self, *, text: str, files: List[str], captions: List[str]=[], ) -> List[OutputRecord]: """ Upload media to mastodon, and send status and media, and captions if present. :param text: post text. ...
def send_with_media( self, *, text: str, files: List[str], captions: List[str]=[], ) -> List[OutputRecord]: """ Upload media to mastodon, and send status and media, and captions if present. :param text: post text. ...
[ "Upload", "media", "to", "mastodon", "and", "send", "status", "and", "media", "and", "captions", "if", "present", "." ]
alixnovosi/botskeleton
python
https://github.com/alixnovosi/botskeleton/blob/55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9/botskeleton/outputs/output_mastodon.py#L72-L125
[ "def", "send_with_media", "(", "self", ",", "*", ",", "text", ":", "str", ",", "files", ":", "List", "[", "str", "]", ",", "captions", ":", "List", "[", "str", "]", "=", "[", "]", ",", ")", "->", "List", "[", "OutputRecord", "]", ":", "try", ":...
55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9
train
MastodonSkeleton.perform_batch_reply
Performs batch reply on target account. Looks up the recent messages of the target user, applies the callback, and replies with what the callback generates. :param callback: a callback taking a message id, message contents, and optional extra keys, ...
botskeleton/outputs/output_mastodon.py
def perform_batch_reply( self, *, callback: Callable[..., str], lookback_limit: int, target_handle: str, ) -> List[OutputRecord]: """ Performs batch reply on target account. Looks up the recent messages of the target user, a...
def perform_batch_reply( self, *, callback: Callable[..., str], lookback_limit: int, target_handle: str, ) -> List[OutputRecord]: """ Performs batch reply on target account. Looks up the recent messages of the target user, a...
[ "Performs", "batch", "reply", "on", "target", "account", ".", "Looks", "up", "the", "recent", "messages", "of", "the", "target", "user", "applies", "the", "callback", "and", "replies", "with", "what", "the", "callback", "generates", "." ]
alixnovosi/botskeleton
python
https://github.com/alixnovosi/botskeleton/blob/55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9/botskeleton/outputs/output_mastodon.py#L127-L208
[ "def", "perform_batch_reply", "(", "self", ",", "*", ",", "callback", ":", "Callable", "[", "...", ",", "str", "]", ",", "lookback_limit", ":", "int", ",", "target_handle", ":", "str", ",", ")", "->", "List", "[", "OutputRecord", "]", ":", "self", ".",...
55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9
train
MastodonSkeleton.handle_error
Handle error while trying to do something.
botskeleton/outputs/output_mastodon.py
def handle_error(self, message: str, e: mastodon.MastodonError) -> OutputRecord: """Handle error while trying to do something.""" self.lerror(f"Got an error! {e}") # Handle errors if we know how. try: code = e[0]["code"] if code in self.handled_errors: ...
def handle_error(self, message: str, e: mastodon.MastodonError) -> OutputRecord: """Handle error while trying to do something.""" self.lerror(f"Got an error! {e}") # Handle errors if we know how. try: code = e[0]["code"] if code in self.handled_errors: ...
[ "Handle", "error", "while", "trying", "to", "do", "something", "." ]
alixnovosi/botskeleton
python
https://github.com/alixnovosi/botskeleton/blob/55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9/botskeleton/outputs/output_mastodon.py#L214-L229
[ "def", "handle_error", "(", "self", ",", "message", ":", "str", ",", "e", ":", "mastodon", ".", "MastodonError", ")", "->", "OutputRecord", ":", "self", ".", "lerror", "(", "f\"Got an error! {e}\"", ")", "# Handle errors if we know how.", "try", ":", "code", "...
55bfc1b8a3623c10437e4ab2cd0b0ec8d35907a9
train
SpectrogramFile._read_header
Little-endian |... 4 bytes unsigned int ...|... 4 bytes unsigned int ...| | frames count | dimensions count |
dear/spectrum/_base.py
def _read_header(self): ''' Little-endian |... 4 bytes unsigned int ...|... 4 bytes unsigned int ...| | frames count | dimensions count | ''' self._fh.seek(0) buf = self._fh.read(4*2) fc, dc = struct.unpack("<II", buf) retur...
def _read_header(self): ''' Little-endian |... 4 bytes unsigned int ...|... 4 bytes unsigned int ...| | frames count | dimensions count | ''' self._fh.seek(0) buf = self._fh.read(4*2) fc, dc = struct.unpack("<II", buf) retur...
[ "Little", "-", "endian", "|", "...", "4", "bytes", "unsigned", "int", "...", "|", "...", "4", "bytes", "unsigned", "int", "...", "|", "|", "frames", "count", "|", "dimensions", "count", "|" ]
dongying/dear
python
https://github.com/dongying/dear/blob/6f9a4f63bf3ee197dc03d7d2bd0451a83906d2ba/dear/spectrum/_base.py#L33-L42
[ "def", "_read_header", "(", "self", ")", ":", "self", ".", "_fh", ".", "seek", "(", "0", ")", "buf", "=", "self", ".", "_fh", ".", "read", "(", "4", "*", "2", ")", "fc", ",", "dc", "=", "struct", ".", "unpack", "(", "\"<II\"", ",", "buf", ")"...
6f9a4f63bf3ee197dc03d7d2bd0451a83906d2ba
train
Scalar.listen
Request a callback for value modification. Parameters ---------- you : object An instance having ``__call__`` attribute.
optimix/_types.py
def listen(self, you): """ Request a callback for value modification. Parameters ---------- you : object An instance having ``__call__`` attribute. """ self._listeners.append(you) self.raw.talk_to(you)
def listen(self, you): """ Request a callback for value modification. Parameters ---------- you : object An instance having ``__call__`` attribute. """ self._listeners.append(you) self.raw.talk_to(you)
[ "Request", "a", "callback", "for", "value", "modification", "." ]
limix/optimix
python
https://github.com/limix/optimix/blob/d7b1356df259c9f6ee0d658258fb47d0074fc416/optimix/_types.py#L96-L106
[ "def", "listen", "(", "self", ",", "you", ")", ":", "self", ".", "_listeners", ".", "append", "(", "you", ")", "self", ".", "raw", ".", "talk_to", "(", "you", ")" ]
d7b1356df259c9f6ee0d658258fb47d0074fc416
train
OnroerendErfgoedProvider._get_term_by_id
Simple utility function to load a term.
skosprovider_oe/providers.py
def _get_term_by_id(self, id): '''Simple utility function to load a term. ''' url = (self.url + '/%s.json') % id r = self.session.get(url) return r.json()
def _get_term_by_id(self, id): '''Simple utility function to load a term. ''' url = (self.url + '/%s.json') % id r = self.session.get(url) return r.json()
[ "Simple", "utility", "function", "to", "load", "a", "term", "." ]
koenedaele/skosprovider_oe
python
https://github.com/koenedaele/skosprovider_oe/blob/099b23cccd3884b06354102955dbc71f59d8fdb0/skosprovider_oe/providers.py#L167-L172
[ "def", "_get_term_by_id", "(", "self", ",", "id", ")", ":", "url", "=", "(", "self", ".", "url", "+", "'/%s.json'", ")", "%", "id", "r", "=", "self", ".", "session", ".", "get", "(", "url", ")", "return", "r", ".", "json", "(", ")" ]
099b23cccd3884b06354102955dbc71f59d8fdb0
train
OnroerendErfgoedProvider.get_top_display
Returns all concepts or collections that form the top-level of a display hierarchy. As opposed to the :meth:`get_top_concepts`, this method can possibly return both concepts and collections. :rtype: Returns a list of concepts and collections. For each an id is present and a...
skosprovider_oe/providers.py
def get_top_display(self, **kwargs): ''' Returns all concepts or collections that form the top-level of a display hierarchy. As opposed to the :meth:`get_top_concepts`, this method can possibly return both concepts and collections. :rtype: Returns a list of concepts and...
def get_top_display(self, **kwargs): ''' Returns all concepts or collections that form the top-level of a display hierarchy. As opposed to the :meth:`get_top_concepts`, this method can possibly return both concepts and collections. :rtype: Returns a list of concepts and...
[ "Returns", "all", "concepts", "or", "collections", "that", "form", "the", "top", "-", "level", "of", "a", "display", "hierarchy", "." ]
koenedaele/skosprovider_oe
python
https://github.com/koenedaele/skosprovider_oe/blob/099b23cccd3884b06354102955dbc71f59d8fdb0/skosprovider_oe/providers.py#L246-L275
[ "def", "get_top_display", "(", "self", ",", "*", "*", "kwargs", ")", ":", "language", "=", "self", ".", "_get_language", "(", "*", "*", "kwargs", ")", "url", "=", "self", ".", "url", "+", "'/lijst.json'", "args", "=", "{", "'type[]'", ":", "[", "'HR'...
099b23cccd3884b06354102955dbc71f59d8fdb0
train
OnroerendErfgoedProvider.get_children_display
Return a list of concepts or collections that should be displayed under this concept or collection. :param id: A concept or collection id. :rtype: A list of concepts and collections. For each an id is present and a label. The label is determined by looking at the `**kwar...
skosprovider_oe/providers.py
def get_children_display(self, id, **kwargs): ''' Return a list of concepts or collections that should be displayed under this concept or collection. :param id: A concept or collection id. :rtype: A list of concepts and collections. For each an id is present and a la...
def get_children_display(self, id, **kwargs): ''' Return a list of concepts or collections that should be displayed under this concept or collection. :param id: A concept or collection id. :rtype: A list of concepts and collections. For each an id is present and a la...
[ "Return", "a", "list", "of", "concepts", "or", "collections", "that", "should", "be", "displayed", "under", "this", "concept", "or", "collection", "." ]
koenedaele/skosprovider_oe
python
https://github.com/koenedaele/skosprovider_oe/blob/099b23cccd3884b06354102955dbc71f59d8fdb0/skosprovider_oe/providers.py#L277-L306
[ "def", "get_children_display", "(", "self", ",", "id", ",", "*", "*", "kwargs", ")", ":", "language", "=", "self", ".", "_get_language", "(", "*", "*", "kwargs", ")", "item", "=", "self", ".", "get_by_id", "(", "id", ")", "res", "=", "[", "]", "if"...
099b23cccd3884b06354102955dbc71f59d8fdb0
train
translate_genes
Pass a list of identifiers (id_list), the name of the database ('Entrez', 'Symbol', 'Standard name', 'Systematic name' or a loaded crossreference database) that you wish to translate from, and the name of the database that you wish to translate to.
genes/utils.py
def translate_genes(id_list=None, from_id=None, to_id=None, organism=None): """ Pass a list of identifiers (id_list), the name of the database ('Entrez', 'Symbol', 'Standard name', 'Systematic name' or a loaded crossreference database) that you wish to translate from, and the name of the database th...
def translate_genes(id_list=None, from_id=None, to_id=None, organism=None): """ Pass a list of identifiers (id_list), the name of the database ('Entrez', 'Symbol', 'Standard name', 'Systematic name' or a loaded crossreference database) that you wish to translate from, and the name of the database th...
[ "Pass", "a", "list", "of", "identifiers", "(", "id_list", ")", "the", "name", "of", "the", "database", "(", "Entrez", "Symbol", "Standard", "name", "Systematic", "name", "or", "a", "loaded", "crossreference", "database", ")", "that", "you", "wish", "to", "...
greenelab/django-genes
python
https://github.com/greenelab/django-genes/blob/298939adcb115031acfc11cfcef60ea0b596fae5/genes/utils.py#L5-L99
[ "def", "translate_genes", "(", "id_list", "=", "None", ",", "from_id", "=", "None", ",", "to_id", "=", "None", ",", "organism", "=", "None", ")", ":", "ids", "=", "set", "(", "id_list", ")", "# Initialize set of identifiers not found by this translate_genes method...
298939adcb115031acfc11cfcef60ea0b596fae5
train
_inner_func_anot
must be applied to all inner functions that return contexts. Wraps all instances of pygame.Surface in the input in Surface
pyparadigm/surface_composition.py
def _inner_func_anot(func): """must be applied to all inner functions that return contexts. Wraps all instances of pygame.Surface in the input in Surface""" @wraps(func) def new_func(*args): return func(*_lmap(_wrap_surface, args)) return new_func
def _inner_func_anot(func): """must be applied to all inner functions that return contexts. Wraps all instances of pygame.Surface in the input in Surface""" @wraps(func) def new_func(*args): return func(*_lmap(_wrap_surface, args)) return new_func
[ "must", "be", "applied", "to", "all", "inner", "functions", "that", "return", "contexts", ".", "Wraps", "all", "instances", "of", "pygame", ".", "Surface", "in", "the", "input", "in", "Surface" ]
KnorrFG/pyparadigm
python
https://github.com/KnorrFG/pyparadigm/blob/69944cdf3ce2f6414ae1aa1d27a0d8c6e5fb3fd3/pyparadigm/surface_composition.py#L23-L30
[ "def", "_inner_func_anot", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "new_func", "(", "*", "args", ")", ":", "return", "func", "(", "*", "_lmap", "(", "_wrap_surface", ",", "args", ")", ")", "return", "new_func" ]
69944cdf3ce2f6414ae1aa1d27a0d8c6e5fb3fd3
train
Cross
Draws a cross centered in the target area :param width: width of the lines of the cross in pixels :type width: int :param color: color of the lines of the cross :type color: pygame.Color
pyparadigm/surface_composition.py
def Cross(width=3, color=0): """Draws a cross centered in the target area :param width: width of the lines of the cross in pixels :type width: int :param color: color of the lines of the cross :type color: pygame.Color """ return Overlay(Line("h", width, color), Line("v", width, color))
def Cross(width=3, color=0): """Draws a cross centered in the target area :param width: width of the lines of the cross in pixels :type width: int :param color: color of the lines of the cross :type color: pygame.Color """ return Overlay(Line("h", width, color), Line("v", width, color))
[ "Draws", "a", "cross", "centered", "in", "the", "target", "area" ]
KnorrFG/pyparadigm
python
https://github.com/KnorrFG/pyparadigm/blob/69944cdf3ce2f6414ae1aa1d27a0d8c6e5fb3fd3/pyparadigm/surface_composition.py#L381-L389
[ "def", "Cross", "(", "width", "=", "3", ",", "color", "=", "0", ")", ":", "return", "Overlay", "(", "Line", "(", "\"h\"", ",", "width", ",", "color", ")", ",", "Line", "(", "\"v\"", ",", "width", ",", "color", ")", ")" ]
69944cdf3ce2f6414ae1aa1d27a0d8c6e5fb3fd3
train
compose
Top level function to create a surface. :param target: the pygame.Surface to blit on. Or a (width, height) tuple in which case a new surface will be created :type target: -
pyparadigm/surface_composition.py
def compose(target, root=None): """Top level function to create a surface. :param target: the pygame.Surface to blit on. Or a (width, height) tuple in which case a new surface will be created :type target: - """ if type(root) == Surface: raise ValueError("A Surface may not be u...
def compose(target, root=None): """Top level function to create a surface. :param target: the pygame.Surface to blit on. Or a (width, height) tuple in which case a new surface will be created :type target: - """ if type(root) == Surface: raise ValueError("A Surface may not be u...
[ "Top", "level", "function", "to", "create", "a", "surface", ".", ":", "param", "target", ":", "the", "pygame", ".", "Surface", "to", "blit", "on", ".", "Or", "a", "(", "width", "height", ")", "tuple", "in", "which", "case", "a", "new", "surface", "wi...
KnorrFG/pyparadigm
python
https://github.com/KnorrFG/pyparadigm/blob/69944cdf3ce2f6414ae1aa1d27a0d8c6e5fb3fd3/pyparadigm/surface_composition.py#L483-L511
[ "def", "compose", "(", "target", ",", "root", "=", "None", ")", ":", "if", "type", "(", "root", ")", "==", "Surface", ":", "raise", "ValueError", "(", "\"A Surface may not be used as root, please add \"", "+", "\"it as a single child i.e. compose(...)(Surface(...))\"", ...
69944cdf3ce2f6414ae1aa1d27a0d8c6e5fb3fd3
train
Font
Unifies loading of fonts. :param name: name of system-font or filepath, if None is passed the default system-font is loaded :type name: str :param source: "sys" for system font, or "file" to load a file :type source: str
pyparadigm/surface_composition.py
def Font(name=None, source="sys", italic=False, bold=False, size=20): """Unifies loading of fonts. :param name: name of system-font or filepath, if None is passed the default system-font is loaded :type name: str :param source: "sys" for system font, or "file" to load a file :type source: ...
def Font(name=None, source="sys", italic=False, bold=False, size=20): """Unifies loading of fonts. :param name: name of system-font or filepath, if None is passed the default system-font is loaded :type name: str :param source: "sys" for system font, or "file" to load a file :type source: ...
[ "Unifies", "loading", "of", "fonts", "." ]
KnorrFG/pyparadigm
python
https://github.com/KnorrFG/pyparadigm/blob/69944cdf3ce2f6414ae1aa1d27a0d8c6e5fb3fd3/pyparadigm/surface_composition.py#L515-L536
[ "def", "Font", "(", "name", "=", "None", ",", "source", "=", "\"sys\"", ",", "italic", "=", "False", ",", "bold", "=", "False", ",", "size", "=", "20", ")", ":", "assert", "source", "in", "[", "\"sys\"", ",", "\"file\"", "]", "if", "not", "name", ...
69944cdf3ce2f6414ae1aa1d27a0d8c6e5fb3fd3
train
Text
Renders a text. Supports multiline text, the background will be transparent. :param align: text-alignment must be "center", "left", or "righ" :type align: str :return: the input text :rtype: pygame.Surface
pyparadigm/surface_composition.py
def Text(text, font, color=pygame.Color(0, 0, 0), antialias=False, align="center"): """Renders a text. Supports multiline text, the background will be transparent. :param align: text-alignment must be "center", "left", or "righ" :type align: str :return: the input text :rtype: pygame.Surface ...
def Text(text, font, color=pygame.Color(0, 0, 0), antialias=False, align="center"): """Renders a text. Supports multiline text, the background will be transparent. :param align: text-alignment must be "center", "left", or "righ" :type align: str :return: the input text :rtype: pygame.Surface ...
[ "Renders", "a", "text", ".", "Supports", "multiline", "text", "the", "background", "will", "be", "transparent", ".", ":", "param", "align", ":", "text", "-", "alignment", "must", "be", "center", "left", "or", "righ", ":", "type", "align", ":", "str", ":"...
KnorrFG/pyparadigm
python
https://github.com/KnorrFG/pyparadigm/blob/69944cdf3ce2f6414ae1aa1d27a0d8c6e5fb3fd3/pyparadigm/surface_composition.py#L543-L566
[ "def", "Text", "(", "text", ",", "font", ",", "color", "=", "pygame", ".", "Color", "(", "0", ",", "0", ",", "0", ")", ",", "antialias", "=", "False", ",", "align", "=", "\"center\"", ")", ":", "assert", "align", "in", "[", "\"center\"", ",", "\"...
69944cdf3ce2f6414ae1aa1d27a0d8c6e5fb3fd3
train
Padding.from_scale
Creates a padding by the remaining space after scaling the content. E.g. Padding.from_scale(0.5) would produce Padding(0.25, 0.25, 0.25, 0.25) and Padding.from_scale(0.5, 1) would produce Padding(0.25, 0.25, 0, 0) because the content would not be scaled (since scale_h=1) and therefore t...
pyparadigm/surface_composition.py
def from_scale(scale_w, scale_h=None): """Creates a padding by the remaining space after scaling the content. E.g. Padding.from_scale(0.5) would produce Padding(0.25, 0.25, 0.25, 0.25) and Padding.from_scale(0.5, 1) would produce Padding(0.25, 0.25, 0, 0) because the content would not b...
def from_scale(scale_w, scale_h=None): """Creates a padding by the remaining space after scaling the content. E.g. Padding.from_scale(0.5) would produce Padding(0.25, 0.25, 0.25, 0.25) and Padding.from_scale(0.5, 1) would produce Padding(0.25, 0.25, 0, 0) because the content would not b...
[ "Creates", "a", "padding", "by", "the", "remaining", "space", "after", "scaling", "the", "content", "." ]
KnorrFG/pyparadigm
python
https://github.com/KnorrFG/pyparadigm/blob/69944cdf3ce2f6414ae1aa1d27a0d8c6e5fb3fd3/pyparadigm/surface_composition.py#L264-L282
[ "def", "from_scale", "(", "scale_w", ",", "scale_h", "=", "None", ")", ":", "if", "not", "scale_h", ":", "scale_h", "=", "scale_w", "w_padding", "=", "[", "(", "1", "-", "scale_w", ")", "*", "0.5", "]", "*", "2", "h_padding", "=", "[", "(", "1", ...
69944cdf3ce2f6414ae1aa1d27a0d8c6e5fb3fd3
train
WaniKani.radicals
:param levels string: An optional argument of declaring a single or comma-delimited list of levels is available, as seen in the example as 1. An example of a comma-delimited list of levels is 1,2,5,9. http://www.wanikani.com/api/v1.2#radicals-list
wanikani/core.py
def radicals(self, levels=None): """ :param levels string: An optional argument of declaring a single or comma-delimited list of levels is available, as seen in the example as 1. An example of a comma-delimited list of levels is 1,2,5,9. http://www.wanikani.com/api/v1.2#...
def radicals(self, levels=None): """ :param levels string: An optional argument of declaring a single or comma-delimited list of levels is available, as seen in the example as 1. An example of a comma-delimited list of levels is 1,2,5,9. http://www.wanikani.com/api/v1.2#...
[ ":", "param", "levels", "string", ":", "An", "optional", "argument", "of", "declaring", "a", "single", "or", "comma", "-", "delimited", "list", "of", "levels", "is", "available", "as", "seen", "in", "the", "example", "as", "1", ".", "An", "example", "of"...
kfdm/wanikani
python
https://github.com/kfdm/wanikani/blob/209f9b34b2832c2b9c9b12077f4a4382c047f710/wanikani/core.py#L168-L182
[ "def", "radicals", "(", "self", ",", "levels", "=", "None", ")", ":", "url", "=", "WANIKANI_BASE", ".", "format", "(", "self", ".", "api_key", ",", "'radicals'", ")", "if", "levels", ":", "url", "+=", "'/{0}'", ".", "format", "(", "levels", ")", "dat...
209f9b34b2832c2b9c9b12077f4a4382c047f710
train
WaniKani.kanji
:param levels: An optional argument of declaring a single or comma-delimited list of levels is available, as seen in the example as 1. An example of a comma-delimited list of levels is 1,2,5,9. :type levels: str or None http://www.wanikani.com/api/v1.2#kanji-list
wanikani/core.py
def kanji(self, levels=None): """ :param levels: An optional argument of declaring a single or comma-delimited list of levels is available, as seen in the example as 1. An example of a comma-delimited list of levels is 1,2,5,9. :type levels: str or None http://ww...
def kanji(self, levels=None): """ :param levels: An optional argument of declaring a single or comma-delimited list of levels is available, as seen in the example as 1. An example of a comma-delimited list of levels is 1,2,5,9. :type levels: str or None http://ww...
[ ":", "param", "levels", ":", "An", "optional", "argument", "of", "declaring", "a", "single", "or", "comma", "-", "delimited", "list", "of", "levels", "is", "available", "as", "seen", "in", "the", "example", "as", "1", ".", "An", "example", "of", "a", "...
kfdm/wanikani
python
https://github.com/kfdm/wanikani/blob/209f9b34b2832c2b9c9b12077f4a4382c047f710/wanikani/core.py#L184-L199
[ "def", "kanji", "(", "self", ",", "levels", "=", "None", ")", ":", "url", "=", "WANIKANI_BASE", ".", "format", "(", "self", ".", "api_key", ",", "'kanji'", ")", "if", "levels", ":", "url", "+=", "'/{0}'", ".", "format", "(", "levels", ")", "data", ...
209f9b34b2832c2b9c9b12077f4a4382c047f710
train
WaniKani.vocabulary
:param levels: An optional argument of declaring a single or comma-delimited list of levels is available, as seen in the example as 1. An example of a comma-delimited list of levels is 1,2,5,9. :type levels: str or None http://www.wanikani.com/api/v1.2#vocabulary-list
wanikani/core.py
def vocabulary(self, levels=None): """ :param levels: An optional argument of declaring a single or comma-delimited list of levels is available, as seen in the example as 1. An example of a comma-delimited list of levels is 1,2,5,9. :type levels: str or None http...
def vocabulary(self, levels=None): """ :param levels: An optional argument of declaring a single or comma-delimited list of levels is available, as seen in the example as 1. An example of a comma-delimited list of levels is 1,2,5,9. :type levels: str or None http...
[ ":", "param", "levels", ":", "An", "optional", "argument", "of", "declaring", "a", "single", "or", "comma", "-", "delimited", "list", "of", "levels", "is", "available", "as", "seen", "in", "the", "example", "as", "1", ".", "An", "example", "of", "a", "...
kfdm/wanikani
python
https://github.com/kfdm/wanikani/blob/209f9b34b2832c2b9c9b12077f4a4382c047f710/wanikani/core.py#L202-L222
[ "def", "vocabulary", "(", "self", ",", "levels", "=", "None", ")", ":", "url", "=", "WANIKANI_BASE", ".", "format", "(", "self", ".", "api_key", ",", "'vocabulary'", ")", "if", "levels", ":", "url", "+=", "'/{0}'", ".", "format", "(", "levels", ")", ...
209f9b34b2832c2b9c9b12077f4a4382c047f710
train
ishex
Test if the argument is a string representing a valid hexadecimal digit. :param obj: Object :type obj: any :rtype: boolean
pmisc/member.py
def ishex(obj): """ Test if the argument is a string representing a valid hexadecimal digit. :param obj: Object :type obj: any :rtype: boolean """ return isinstance(obj, str) and (len(obj) == 1) and (obj in string.hexdigits)
def ishex(obj): """ Test if the argument is a string representing a valid hexadecimal digit. :param obj: Object :type obj: any :rtype: boolean """ return isinstance(obj, str) and (len(obj) == 1) and (obj in string.hexdigits)
[ "Test", "if", "the", "argument", "is", "a", "string", "representing", "a", "valid", "hexadecimal", "digit", "." ]
pmacosta/pmisc
python
https://github.com/pmacosta/pmisc/blob/dd2bb32e59eee872f1ef2db2d9921a396ab9f50b/pmisc/member.py#L40-L49
[ "def", "ishex", "(", "obj", ")", ":", "return", "isinstance", "(", "obj", ",", "str", ")", "and", "(", "len", "(", "obj", ")", "==", "1", ")", "and", "(", "obj", "in", "string", ".", "hexdigits", ")" ]
dd2bb32e59eee872f1ef2db2d9921a396ab9f50b
train
isnumber
Test if the argument is a number (complex, float or integer). :param obj: Object :type obj: any :rtype: boolean
pmisc/member.py
def isnumber(obj): """ Test if the argument is a number (complex, float or integer). :param obj: Object :type obj: any :rtype: boolean """ return ( (obj is not None) and (not isinstance(obj, bool)) and isinstance(obj, (int, float, complex)) )
def isnumber(obj): """ Test if the argument is a number (complex, float or integer). :param obj: Object :type obj: any :rtype: boolean """ return ( (obj is not None) and (not isinstance(obj, bool)) and isinstance(obj, (int, float, complex)) )
[ "Test", "if", "the", "argument", "is", "a", "number", "(", "complex", "float", "or", "integer", ")", "." ]
pmacosta/pmisc
python
https://github.com/pmacosta/pmisc/blob/dd2bb32e59eee872f1ef2db2d9921a396ab9f50b/pmisc/member.py#L68-L81
[ "def", "isnumber", "(", "obj", ")", ":", "return", "(", "(", "obj", "is", "not", "None", ")", "and", "(", "not", "isinstance", "(", "obj", ",", "bool", ")", ")", "and", "isinstance", "(", "obj", ",", "(", "int", ",", "float", ",", "complex", ")",...
dd2bb32e59eee872f1ef2db2d9921a396ab9f50b
train
isreal
Test if the argument is a real number (float or integer). :param obj: Object :type obj: any :rtype: boolean
pmisc/member.py
def isreal(obj): """ Test if the argument is a real number (float or integer). :param obj: Object :type obj: any :rtype: boolean """ return ( (obj is not None) and (not isinstance(obj, bool)) and isinstance(obj, (int, float)) )
def isreal(obj): """ Test if the argument is a real number (float or integer). :param obj: Object :type obj: any :rtype: boolean """ return ( (obj is not None) and (not isinstance(obj, bool)) and isinstance(obj, (int, float)) )
[ "Test", "if", "the", "argument", "is", "a", "real", "number", "(", "float", "or", "integer", ")", "." ]
pmacosta/pmisc
python
https://github.com/pmacosta/pmisc/blob/dd2bb32e59eee872f1ef2db2d9921a396ab9f50b/pmisc/member.py#L84-L97
[ "def", "isreal", "(", "obj", ")", ":", "return", "(", "(", "obj", "is", "not", "None", ")", "and", "(", "not", "isinstance", "(", "obj", ",", "bool", ")", ")", "and", "isinstance", "(", "obj", ",", "(", "int", ",", "float", ")", ")", ")" ]
dd2bb32e59eee872f1ef2db2d9921a396ab9f50b
train
AppBuilder.create_api_context
Create and return an API context
bors/app/builder.py
def create_api_context(self, cls): """Create and return an API context""" return self.api_context_schema().load({ "name": cls.name, "cls": cls, "inst": [], "conf": self.conf.get_api_service(cls.name), "calls": self.conf.get_api_calls(), ...
def create_api_context(self, cls): """Create and return an API context""" return self.api_context_schema().load({ "name": cls.name, "cls": cls, "inst": [], "conf": self.conf.get_api_service(cls.name), "calls": self.conf.get_api_calls(), ...
[ "Create", "and", "return", "an", "API", "context" ]
RobotStudio/bors
python
https://github.com/RobotStudio/bors/blob/38bf338fc6905d90819faa56bd832140116720f0/bors/app/builder.py#L38-L49
[ "def", "create_api_context", "(", "self", ",", "cls", ")", ":", "return", "self", ".", "api_context_schema", "(", ")", ".", "load", "(", "{", "\"name\"", ":", "cls", ".", "name", ",", "\"cls\"", ":", "cls", ",", "\"inst\"", ":", "[", "]", ",", "\"con...
38bf338fc6905d90819faa56bd832140116720f0
train
AppBuilder.receive
Pass an API result down the pipeline
bors/app/builder.py
def receive(self, data, api_context): """Pass an API result down the pipeline""" self.log.debug(f"Putting data on the pipeline: {data}") result = { "api_contexts": self.api_contexts, "api_context": api_context, "strategy": dict(), # Shared strategy data ...
def receive(self, data, api_context): """Pass an API result down the pipeline""" self.log.debug(f"Putting data on the pipeline: {data}") result = { "api_contexts": self.api_contexts, "api_context": api_context, "strategy": dict(), # Shared strategy data ...
[ "Pass", "an", "API", "result", "down", "the", "pipeline" ]
RobotStudio/bors
python
https://github.com/RobotStudio/bors/blob/38bf338fc6905d90819faa56bd832140116720f0/bors/app/builder.py#L56-L66
[ "def", "receive", "(", "self", ",", "data", ",", "api_context", ")", ":", "self", ".", "log", ".", "debug", "(", "f\"Putting data on the pipeline: {data}\"", ")", "result", "=", "{", "\"api_contexts\"", ":", "self", ".", "api_contexts", ",", "\"api_context\"", ...
38bf338fc6905d90819faa56bd832140116720f0
train
AppBuilder.shutdown
Shut it down
bors/app/builder.py
def shutdown(self, signum, frame): # pylint: disable=unused-argument """Shut it down""" if not self.exit: self.exit = True self.log.debug(f"SIGTRAP!{signum};{frame}") self.api.shutdown() self.strat.shutdown()
def shutdown(self, signum, frame): # pylint: disable=unused-argument """Shut it down""" if not self.exit: self.exit = True self.log.debug(f"SIGTRAP!{signum};{frame}") self.api.shutdown() self.strat.shutdown()
[ "Shut", "it", "down" ]
RobotStudio/bors
python
https://github.com/RobotStudio/bors/blob/38bf338fc6905d90819faa56bd832140116720f0/bors/app/builder.py#L68-L74
[ "def", "shutdown", "(", "self", ",", "signum", ",", "frame", ")", ":", "# pylint: disable=unused-argument", "if", "not", "self", ".", "exit", ":", "self", ".", "exit", "=", "True", "self", ".", "log", ".", "debug", "(", "f\"SIGTRAP!{signum};{frame}\"", ")", ...
38bf338fc6905d90819faa56bd832140116720f0
train
BaseNode.course
Course this node belongs to
studdp/model.py
def course(self): """ Course this node belongs to """ course = self.parent while course.parent: course = course.parent return course
def course(self): """ Course this node belongs to """ course = self.parent while course.parent: course = course.parent return course
[ "Course", "this", "node", "belongs", "to" ]
CogSciUOS/StudDP
python
https://github.com/CogSciUOS/StudDP/blob/e953aea51766438f2901c9e87f5b7b9e5bb892f5/studdp/model.py#L45-L52
[ "def", "course", "(", "self", ")", ":", "course", "=", "self", ".", "parent", "while", "course", ".", "parent", ":", "course", "=", "course", ".", "parent", "return", "course" ]
e953aea51766438f2901c9e87f5b7b9e5bb892f5
train
BaseNode.path
Path of this node on Studip. Looks like Coures/folder/folder/document. Respects the renaming policies defined in the namemap
studdp/model.py
def path(self): """ Path of this node on Studip. Looks like Coures/folder/folder/document. Respects the renaming policies defined in the namemap """ if self.parent is None: return self.title return join(self.parent.path, self.title)
def path(self): """ Path of this node on Studip. Looks like Coures/folder/folder/document. Respects the renaming policies defined in the namemap """ if self.parent is None: return self.title return join(self.parent.path, self.title)
[ "Path", "of", "this", "node", "on", "Studip", ".", "Looks", "like", "Coures", "/", "folder", "/", "folder", "/", "document", ".", "Respects", "the", "renaming", "policies", "defined", "in", "the", "namemap" ]
CogSciUOS/StudDP
python
https://github.com/CogSciUOS/StudDP/blob/e953aea51766438f2901c9e87f5b7b9e5bb892f5/studdp/model.py#L55-L61
[ "def", "path", "(", "self", ")", ":", "if", "self", ".", "parent", "is", "None", ":", "return", "self", ".", "title", "return", "join", "(", "self", ".", "parent", ".", "path", ",", "self", ".", "title", ")" ]
e953aea51766438f2901c9e87f5b7b9e5bb892f5
train
BaseNode.title
get title of this node. If an entry for this course is found in the configuration namemap it is used, otherwise the default value from stud.ip is used.
studdp/model.py
def title(self): """ get title of this node. If an entry for this course is found in the configuration namemap it is used, otherwise the default value from stud.ip is used. """ tmp = c.namemap_lookup(self.id) if c.namemap_lookup(self.id) is not None else self._title retur...
def title(self): """ get title of this node. If an entry for this course is found in the configuration namemap it is used, otherwise the default value from stud.ip is used. """ tmp = c.namemap_lookup(self.id) if c.namemap_lookup(self.id) is not None else self._title retur...
[ "get", "title", "of", "this", "node", ".", "If", "an", "entry", "for", "this", "course", "is", "found", "in", "the", "configuration", "namemap", "it", "is", "used", "otherwise", "the", "default", "value", "from", "stud", ".", "ip", "is", "used", "." ]
CogSciUOS/StudDP
python
https://github.com/CogSciUOS/StudDP/blob/e953aea51766438f2901c9e87f5b7b9e5bb892f5/studdp/model.py#L64-L70
[ "def", "title", "(", "self", ")", ":", "tmp", "=", "c", ".", "namemap_lookup", "(", "self", ".", "id", ")", "if", "c", ".", "namemap_lookup", "(", "self", ".", "id", ")", "is", "not", "None", "else", "self", ".", "_title", "return", "secure_filename"...
e953aea51766438f2901c9e87f5b7b9e5bb892f5
train
Folder.deep_documents
list of all documents find in subtrees of this node
studdp/model.py
def deep_documents(self): """ list of all documents find in subtrees of this node """ tree = [] for entry in self.contents: if isinstance(entry, Document): tree.append(entry) else: tree += entry.deep_documents return...
def deep_documents(self): """ list of all documents find in subtrees of this node """ tree = [] for entry in self.contents: if isinstance(entry, Document): tree.append(entry) else: tree += entry.deep_documents return...
[ "list", "of", "all", "documents", "find", "in", "subtrees", "of", "this", "node" ]
CogSciUOS/StudDP
python
https://github.com/CogSciUOS/StudDP/blob/e953aea51766438f2901c9e87f5b7b9e5bb892f5/studdp/model.py#L90-L100
[ "def", "deep_documents", "(", "self", ")", ":", "tree", "=", "[", "]", "for", "entry", "in", "self", ".", "contents", ":", "if", "isinstance", "(", "entry", ",", "Document", ")", ":", "tree", ".", "append", "(", "entry", ")", "else", ":", "tree", "...
e953aea51766438f2901c9e87f5b7b9e5bb892f5
train
Course.title
The title of the course. If no entry in the namemap of the configuration is found a new entry is created with name=$STUD.IP_NAME + $SEMESTER_NAME
studdp/model.py
def title(self): """ The title of the course. If no entry in the namemap of the configuration is found a new entry is created with name=$STUD.IP_NAME + $SEMESTER_NAME """ name = c.namemap_lookup(self.id) if name is None: name = self._title + " " + client.get_semester_...
def title(self): """ The title of the course. If no entry in the namemap of the configuration is found a new entry is created with name=$STUD.IP_NAME + $SEMESTER_NAME """ name = c.namemap_lookup(self.id) if name is None: name = self._title + " " + client.get_semester_...
[ "The", "title", "of", "the", "course", ".", "If", "no", "entry", "in", "the", "namemap", "of", "the", "configuration", "is", "found", "a", "new", "entry", "is", "created", "with", "name", "=", "$STUD", ".", "IP_NAME", "+", "$SEMESTER_NAME" ]
CogSciUOS/StudDP
python
https://github.com/CogSciUOS/StudDP/blob/e953aea51766438f2901c9e87f5b7b9e5bb892f5/studdp/model.py#L114-L122
[ "def", "title", "(", "self", ")", ":", "name", "=", "c", ".", "namemap_lookup", "(", "self", ".", "id", ")", "if", "name", "is", "None", ":", "name", "=", "self", ".", "_title", "+", "\" \"", "+", "client", ".", "get_semester_title", "(", "self", "...
e953aea51766438f2901c9e87f5b7b9e5bb892f5
train
_APIClient._get
run a get request against an url. Returns the response which can optionally be streamed
studdp/model.py
def _get(self, route, stream=False): """ run a get request against an url. Returns the response which can optionally be streamed """ log.debug("Running GET request against %s" % route) return r.get(self._url(route), auth=c.auth, stream=stream)
def _get(self, route, stream=False): """ run a get request against an url. Returns the response which can optionally be streamed """ log.debug("Running GET request against %s" % route) return r.get(self._url(route), auth=c.auth, stream=stream)
[ "run", "a", "get", "request", "against", "an", "url", ".", "Returns", "the", "response", "which", "can", "optionally", "be", "streamed" ]
CogSciUOS/StudDP
python
https://github.com/CogSciUOS/StudDP/blob/e953aea51766438f2901c9e87f5b7b9e5bb892f5/studdp/model.py#L168-L173
[ "def", "_get", "(", "self", ",", "route", ",", "stream", "=", "False", ")", ":", "log", ".", "debug", "(", "\"Running GET request against %s\"", "%", "route", ")", "return", "r", ".", "get", "(", "self", ".", "_url", "(", "route", ")", ",", "auth", "...
e953aea51766438f2901c9e87f5b7b9e5bb892f5
train
_APIClient.get_contents
List all contents of a folder. Returns a list of all Documents and Folders (in this order) in the folder.
studdp/model.py
def get_contents(self, folder: Folder): """ List all contents of a folder. Returns a list of all Documents and Folders (in this order) in the folder. """ log.debug("Listing Contents of %s/%s" % (folder.course.id, folder.id)) if isinstance(folder, Course): response = j...
def get_contents(self, folder: Folder): """ List all contents of a folder. Returns a list of all Documents and Folders (in this order) in the folder. """ log.debug("Listing Contents of %s/%s" % (folder.course.id, folder.id)) if isinstance(folder, Course): response = j...
[ "List", "all", "contents", "of", "a", "folder", ".", "Returns", "a", "list", "of", "all", "Documents", "and", "Folders", "(", "in", "this", "order", ")", "in", "the", "folder", "." ]
CogSciUOS/StudDP
python
https://github.com/CogSciUOS/StudDP/blob/e953aea51766438f2901c9e87f5b7b9e5bb892f5/studdp/model.py#L175-L190
[ "def", "get_contents", "(", "self", ",", "folder", ":", "Folder", ")", ":", "log", ".", "debug", "(", "\"Listing Contents of %s/%s\"", "%", "(", "folder", ".", "course", ".", "id", ",", "folder", ".", "id", ")", ")", "if", "isinstance", "(", "folder", ...
e953aea51766438f2901c9e87f5b7b9e5bb892f5
train
_APIClient.download_document
Download a document to the given path. if no path is provided the path is constructed frome the base_url + stud.ip path + filename. If overwrite is set the local version will be overwritten if the file was changed on studip since the last check
studdp/model.py
def download_document(self, document: Document, overwrite=True, path=None): """ Download a document to the given path. if no path is provided the path is constructed frome the base_url + stud.ip path + filename. If overwrite is set the local version will be overwritten if the file was changed on...
def download_document(self, document: Document, overwrite=True, path=None): """ Download a document to the given path. if no path is provided the path is constructed frome the base_url + stud.ip path + filename. If overwrite is set the local version will be overwritten if the file was changed on...
[ "Download", "a", "document", "to", "the", "given", "path", ".", "if", "no", "path", "is", "provided", "the", "path", "is", "constructed", "frome", "the", "base_url", "+", "stud", ".", "ip", "path", "+", "filename", ".", "If", "overwrite", "is", "set", ...
CogSciUOS/StudDP
python
https://github.com/CogSciUOS/StudDP/blob/e953aea51766438f2901c9e87f5b7b9e5bb892f5/studdp/model.py#L196-L208
[ "def", "download_document", "(", "self", ",", "document", ":", "Document", ",", "overwrite", "=", "True", ",", "path", "=", "None", ")", ":", "if", "not", "path", ":", "path", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "expan...
e953aea51766438f2901c9e87f5b7b9e5bb892f5
train
_APIClient.get_semester_title
get the semester of a node
studdp/model.py
def get_semester_title(self, node: BaseNode): """ get the semester of a node """ log.debug("Getting Semester Title for %s" % node.course.id) return self._get_semester_from_id(node.course.semester)
def get_semester_title(self, node: BaseNode): """ get the semester of a node """ log.debug("Getting Semester Title for %s" % node.course.id) return self._get_semester_from_id(node.course.semester)
[ "get", "the", "semester", "of", "a", "node" ]
CogSciUOS/StudDP
python
https://github.com/CogSciUOS/StudDP/blob/e953aea51766438f2901c9e87f5b7b9e5bb892f5/studdp/model.py#L210-L215
[ "def", "get_semester_title", "(", "self", ",", "node", ":", "BaseNode", ")", ":", "log", ".", "debug", "(", "\"Getting Semester Title for %s\"", "%", "node", ".", "course", ".", "id", ")", "return", "self", ".", "_get_semester_from_id", "(", "node", ".", "co...
e953aea51766438f2901c9e87f5b7b9e5bb892f5
train
_APIClient.get_courses
use the base_url and auth data from the configuration to list all courses the user is subscribed to
studdp/model.py
def get_courses(self): """ use the base_url and auth data from the configuration to list all courses the user is subscribed to """ log.info("Listing Courses...") courses = json.loads(self._get('/api/courses').text)["courses"] courses = [Course.from_response(course) for co...
def get_courses(self): """ use the base_url and auth data from the configuration to list all courses the user is subscribed to """ log.info("Listing Courses...") courses = json.loads(self._get('/api/courses').text)["courses"] courses = [Course.from_response(course) for co...
[ "use", "the", "base_url", "and", "auth", "data", "from", "the", "configuration", "to", "list", "all", "courses", "the", "user", "is", "subscribed", "to" ]
CogSciUOS/StudDP
python
https://github.com/CogSciUOS/StudDP/blob/e953aea51766438f2901c9e87f5b7b9e5bb892f5/studdp/model.py#L221-L229
[ "def", "get_courses", "(", "self", ")", ":", "log", ".", "info", "(", "\"Listing Courses...\"", ")", "courses", "=", "json", ".", "loads", "(", "self", ".", "_get", "(", "'/api/courses'", ")", ".", "text", ")", "[", "\"courses\"", "]", "courses", "=", ...
e953aea51766438f2901c9e87f5b7b9e5bb892f5
train
FuncOpt._minimize_scalar
Minimize a scalar function using Brent's method. Parameters ---------- verbose : bool ``True`` for verbose output; ``False`` otherwise.
optimix/_function.py
def _minimize_scalar( self, desc="Progress", rtol=1.4902e-08, atol=1.4902e-08, verbose=True ): """ Minimize a scalar function using Brent's method. Parameters ---------- verbose : bool ``True`` for verbose output; ``False`` otherwise. """ ...
def _minimize_scalar( self, desc="Progress", rtol=1.4902e-08, atol=1.4902e-08, verbose=True ): """ Minimize a scalar function using Brent's method. Parameters ---------- verbose : bool ``True`` for verbose output; ``False`` otherwise. """ ...
[ "Minimize", "a", "scalar", "function", "using", "Brent", "s", "method", "." ]
limix/optimix
python
https://github.com/limix/optimix/blob/d7b1356df259c9f6ee0d658258fb47d0074fc416/optimix/_function.py#L16-L47
[ "def", "_minimize_scalar", "(", "self", ",", "desc", "=", "\"Progress\"", ",", "rtol", "=", "1.4902e-08", ",", "atol", "=", "1.4902e-08", ",", "verbose", "=", "True", ")", ":", "from", "tqdm", "import", "tqdm", "from", "numpy", "import", "asarray", "from",...
d7b1356df259c9f6ee0d658258fb47d0074fc416
train
String.digest
return a url-safe hash of the string, optionally (and by default) base64-encoded alg='sha256' = the hash algorithm, must be in hashlib b64=True = whether to base64-encode the output strip=True = whether to strip trailing '=' from the base64 output Using the...
bl/string.py
def digest(self, alg='sha256', b64=True, strip=True): """return a url-safe hash of the string, optionally (and by default) base64-encoded alg='sha256' = the hash algorithm, must be in hashlib b64=True = whether to base64-encode the output strip=True = wheth...
def digest(self, alg='sha256', b64=True, strip=True): """return a url-safe hash of the string, optionally (and by default) base64-encoded alg='sha256' = the hash algorithm, must be in hashlib b64=True = whether to base64-encode the output strip=True = wheth...
[ "return", "a", "url", "-", "safe", "hash", "of", "the", "string", "optionally", "(", "and", "by", "default", ")", "base64", "-", "encoded", "alg", "=", "sha256", "=", "the", "hash", "algorithm", "must", "be", "in", "hashlib", "b64", "=", "True", "=", ...
BlackEarth/bl
python
https://github.com/BlackEarth/bl/blob/edf6f37dac718987260b90ad0e7f7fe084a7c1a3/bl/string.py#L31-L54
[ "def", "digest", "(", "self", ",", "alg", "=", "'sha256'", ",", "b64", "=", "True", ",", "strip", "=", "True", ")", ":", "import", "base64", ",", "hashlib", "h", "=", "hashlib", ".", "new", "(", "alg", ")", "h", ".", "update", "(", "str", "(", ...
edf6f37dac718987260b90ad0e7f7fe084a7c1a3
train
String.camelify
turn a string to CamelCase, omitting non-word characters
bl/string.py
def camelify(self): """turn a string to CamelCase, omitting non-word characters""" outstring = self.titleify(allwords=True) outstring = re.sub(r"&[^;]+;", " ", outstring) outstring = re.sub(r"\W+", "", outstring) return String(outstring)
def camelify(self): """turn a string to CamelCase, omitting non-word characters""" outstring = self.titleify(allwords=True) outstring = re.sub(r"&[^;]+;", " ", outstring) outstring = re.sub(r"\W+", "", outstring) return String(outstring)
[ "turn", "a", "string", "to", "CamelCase", "omitting", "non", "-", "word", "characters" ]
BlackEarth/bl
python
https://github.com/BlackEarth/bl/blob/edf6f37dac718987260b90ad0e7f7fe084a7c1a3/bl/string.py#L61-L66
[ "def", "camelify", "(", "self", ")", ":", "outstring", "=", "self", ".", "titleify", "(", "allwords", "=", "True", ")", "outstring", "=", "re", ".", "sub", "(", "r\"&[^;]+;\"", ",", "\" \"", ",", "outstring", ")", "outstring", "=", "re", ".", "sub", ...
edf6f37dac718987260b90ad0e7f7fe084a7c1a3
train
String.titleify
takes a string and makes a title from it
bl/string.py
def titleify(self, lang='en', allwords=False, lastword=True): """takes a string and makes a title from it""" if lang in LOWERCASE_WORDS: lc_words = LOWERCASE_WORDS[lang] else: lc_words = [] s = str(self).strip() l = re.split(r"([_\W]+)", s) ...
def titleify(self, lang='en', allwords=False, lastword=True): """takes a string and makes a title from it""" if lang in LOWERCASE_WORDS: lc_words = LOWERCASE_WORDS[lang] else: lc_words = [] s = str(self).strip() l = re.split(r"([_\W]+)", s) ...
[ "takes", "a", "string", "and", "makes", "a", "title", "from", "it" ]
BlackEarth/bl
python
https://github.com/BlackEarth/bl/blob/edf6f37dac718987260b90ad0e7f7fe084a7c1a3/bl/string.py#L68-L91
[ "def", "titleify", "(", "self", ",", "lang", "=", "'en'", ",", "allwords", "=", "False", ",", "lastword", "=", "True", ")", ":", "if", "lang", "in", "LOWERCASE_WORDS", ":", "lc_words", "=", "LOWERCASE_WORDS", "[", "lang", "]", "else", ":", "lc_words", ...
edf6f37dac718987260b90ad0e7f7fe084a7c1a3
train
String.identifier
return a python identifier from the string (underscore separators)
bl/string.py
def identifier(self, camelsplit=False, ascii=True): """return a python identifier from the string (underscore separators)""" return self.nameify(camelsplit=camelsplit, ascii=ascii, sep='_')
def identifier(self, camelsplit=False, ascii=True): """return a python identifier from the string (underscore separators)""" return self.nameify(camelsplit=camelsplit, ascii=ascii, sep='_')
[ "return", "a", "python", "identifier", "from", "the", "string", "(", "underscore", "separators", ")" ]
BlackEarth/bl
python
https://github.com/BlackEarth/bl/blob/edf6f37dac718987260b90ad0e7f7fe084a7c1a3/bl/string.py#L93-L95
[ "def", "identifier", "(", "self", ",", "camelsplit", "=", "False", ",", "ascii", "=", "True", ")", ":", "return", "self", ".", "nameify", "(", "camelsplit", "=", "camelsplit", ",", "ascii", "=", "ascii", ",", "sep", "=", "'_'", ")" ]
edf6f37dac718987260b90ad0e7f7fe084a7c1a3
train
String.nameify
return an XML name (hyphen-separated by default, initial underscore if non-letter)
bl/string.py
def nameify(self, camelsplit=False, ascii=True, sep='-'): """return an XML name (hyphen-separated by default, initial underscore if non-letter)""" s = String(str(self)) # immutable if camelsplit == True: s = s.camelsplit() s = s.hyphenify(ascii=ascii).replace('-', sep) ...
def nameify(self, camelsplit=False, ascii=True, sep='-'): """return an XML name (hyphen-separated by default, initial underscore if non-letter)""" s = String(str(self)) # immutable if camelsplit == True: s = s.camelsplit() s = s.hyphenify(ascii=ascii).replace('-', sep) ...
[ "return", "an", "XML", "name", "(", "hyphen", "-", "separated", "by", "default", "initial", "underscore", "if", "non", "-", "letter", ")" ]
BlackEarth/bl
python
https://github.com/BlackEarth/bl/blob/edf6f37dac718987260b90ad0e7f7fe084a7c1a3/bl/string.py#L101-L109
[ "def", "nameify", "(", "self", ",", "camelsplit", "=", "False", ",", "ascii", "=", "True", ",", "sep", "=", "'-'", ")", ":", "s", "=", "String", "(", "str", "(", "self", ")", ")", "# immutable\r", "if", "camelsplit", "==", "True", ":", "s", "=", ...
edf6f37dac718987260b90ad0e7f7fe084a7c1a3
train
String.hyphenify
Turn non-word characters (incl. underscore) into single hyphens. If ascii=True, return ASCII-only. If also lossless=True, use the UTF-8 codes for the non-ASCII characters.
bl/string.py
def hyphenify(self, ascii=False): """Turn non-word characters (incl. underscore) into single hyphens. If ascii=True, return ASCII-only. If also lossless=True, use the UTF-8 codes for the non-ASCII characters. """ s = str(self) s = re.sub("""['"\u2018\u2019\u201c\u20...
def hyphenify(self, ascii=False): """Turn non-word characters (incl. underscore) into single hyphens. If ascii=True, return ASCII-only. If also lossless=True, use the UTF-8 codes for the non-ASCII characters. """ s = str(self) s = re.sub("""['"\u2018\u2019\u201c\u20...
[ "Turn", "non", "-", "word", "characters", "(", "incl", ".", "underscore", ")", "into", "single", "hyphens", ".", "If", "ascii", "=", "True", "return", "ASCII", "-", "only", ".", "If", "also", "lossless", "=", "True", "use", "the", "UTF", "-", "8", "c...
BlackEarth/bl
python
https://github.com/BlackEarth/bl/blob/edf6f37dac718987260b90ad0e7f7fe084a7c1a3/bl/string.py#L111-L124
[ "def", "hyphenify", "(", "self", ",", "ascii", "=", "False", ")", ":", "s", "=", "str", "(", "self", ")", "s", "=", "re", ".", "sub", "(", "\"\"\"['\"\\u2018\\u2019\\u201c\\u201d]\"\"\"", ",", "''", ",", "s", ")", "# quotes\r", "s", "=", "re", ".", "...
edf6f37dac718987260b90ad0e7f7fe084a7c1a3
train
String.camelsplit
Turn a CamelCase string into a string with spaces
bl/string.py
def camelsplit(self): """Turn a CamelCase string into a string with spaces""" s = str(self) for i in range(len(s) - 1, -1, -1): if i != 0 and ( (s[i].isupper() and s[i - 1].isalnum() and not s[i - 1].isupper()) or (s[i].isnumeric() and s[i - 1].i...
def camelsplit(self): """Turn a CamelCase string into a string with spaces""" s = str(self) for i in range(len(s) - 1, -1, -1): if i != 0 and ( (s[i].isupper() and s[i - 1].isalnum() and not s[i - 1].isupper()) or (s[i].isnumeric() and s[i - 1].i...
[ "Turn", "a", "CamelCase", "string", "into", "a", "string", "with", "spaces" ]
BlackEarth/bl
python
https://github.com/BlackEarth/bl/blob/edf6f37dac718987260b90ad0e7f7fe084a7c1a3/bl/string.py#L126-L135
[ "def", "camelsplit", "(", "self", ")", ":", "s", "=", "str", "(", "self", ")", "for", "i", "in", "range", "(", "len", "(", "s", ")", "-", "1", ",", "-", "1", ",", "-", "1", ")", ":", "if", "i", "!=", "0", "and", "(", "(", "s", "[", "i",...
edf6f37dac718987260b90ad0e7f7fe084a7c1a3
train
includeme
Pyramid pluggable and discoverable function.
pyramid_sawing/main.py
def includeme(config): """Pyramid pluggable and discoverable function.""" global_settings = config.registry.settings settings = local_settings(global_settings, PREFIX) try: file = settings['file'] except KeyError: raise KeyError("Must supply '{}.file' configuration value " ...
def includeme(config): """Pyramid pluggable and discoverable function.""" global_settings = config.registry.settings settings = local_settings(global_settings, PREFIX) try: file = settings['file'] except KeyError: raise KeyError("Must supply '{}.file' configuration value " ...
[ "Pyramid", "pluggable", "and", "discoverable", "function", "." ]
openstax/pyramid_sawing
python
https://github.com/openstax/pyramid_sawing/blob/d2ac7faf30c1517ed4621b8e62b7848e926078b9/pyramid_sawing/main.py#L44-L63
[ "def", "includeme", "(", "config", ")", ":", "global_settings", "=", "config", ".", "registry", ".", "settings", "settings", "=", "local_settings", "(", "global_settings", ",", "PREFIX", ")", "try", ":", "file", "=", "settings", "[", "'file'", "]", "except",...
d2ac7faf30c1517ed4621b8e62b7848e926078b9
train
ApiAdapter.run
Executed on startup of application
bors/api/adapter/api.py
def run(self): """Executed on startup of application""" self.api = self.context.get("cls")(self.context) self.context["inst"].append(self) # Adapters used by strategies for call, calldata in self.context.get("calls", {}).items(): def loop(): """Loop on event...
def run(self): """Executed on startup of application""" self.api = self.context.get("cls")(self.context) self.context["inst"].append(self) # Adapters used by strategies for call, calldata in self.context.get("calls", {}).items(): def loop(): """Loop on event...
[ "Executed", "on", "startup", "of", "application" ]
RobotStudio/bors
python
https://github.com/RobotStudio/bors/blob/38bf338fc6905d90819faa56bd832140116720f0/bors/api/adapter/api.py#L20-L32
[ "def", "run", "(", "self", ")", ":", "self", ".", "api", "=", "self", ".", "context", ".", "get", "(", "\"cls\"", ")", "(", "self", ".", "context", ")", "self", ".", "context", "[", "\"inst\"", "]", ".", "append", "(", "self", ")", "# Adapters used...
38bf338fc6905d90819faa56bd832140116720f0
train
ApiAdapter.call
Executed on each scheduled iteration
bors/api/adapter/api.py
def call(self, callname, arguments=None): """Executed on each scheduled iteration""" # See if a method override exists action = getattr(self.api, callname, None) if action is None: try: action = self.api.ENDPOINT_OVERRIDES.get(callname, None) excep...
def call(self, callname, arguments=None): """Executed on each scheduled iteration""" # See if a method override exists action = getattr(self.api, callname, None) if action is None: try: action = self.api.ENDPOINT_OVERRIDES.get(callname, None) excep...
[ "Executed", "on", "each", "scheduled", "iteration" ]
RobotStudio/bors
python
https://github.com/RobotStudio/bors/blob/38bf338fc6905d90819faa56bd832140116720f0/bors/api/adapter/api.py#L34-L53
[ "def", "call", "(", "self", ",", "callname", ",", "arguments", "=", "None", ")", ":", "# See if a method override exists", "action", "=", "getattr", "(", "self", ".", "api", ",", "callname", ",", "None", ")", "if", "action", "is", "None", ":", "try", ":"...
38bf338fc6905d90819faa56bd832140116720f0
train
ApiAdapter._generate_request
Generate a request object for delivery to the API
bors/api/adapter/api.py
def _generate_request(self, callname, request): """Generate a request object for delivery to the API""" # Retrieve path from API class schema = self.api.request_schema() schema.context['callname'] = callname return schema.dump(request).data.get("payload")
def _generate_request(self, callname, request): """Generate a request object for delivery to the API""" # Retrieve path from API class schema = self.api.request_schema() schema.context['callname'] = callname return schema.dump(request).data.get("payload")
[ "Generate", "a", "request", "object", "for", "delivery", "to", "the", "API" ]
RobotStudio/bors
python
https://github.com/RobotStudio/bors/blob/38bf338fc6905d90819faa56bd832140116720f0/bors/api/adapter/api.py#L55-L60
[ "def", "_generate_request", "(", "self", ",", "callname", ",", "request", ")", ":", "# Retrieve path from API class", "schema", "=", "self", ".", "api", ".", "request_schema", "(", ")", "schema", ".", "context", "[", "'callname'", "]", "=", "callname", "return...
38bf338fc6905d90819faa56bd832140116720f0
train
ApiAdapter._generate_result
Generate a results object for delivery to the context object
bors/api/adapter/api.py
def _generate_result(self, callname, result): """Generate a results object for delivery to the context object""" # Retrieve path from API class schema = self.api.result_schema() schema.context['callname'] = callname self.callback(schema.load(result), self.context)
def _generate_result(self, callname, result): """Generate a results object for delivery to the context object""" # Retrieve path from API class schema = self.api.result_schema() schema.context['callname'] = callname self.callback(schema.load(result), self.context)
[ "Generate", "a", "results", "object", "for", "delivery", "to", "the", "context", "object" ]
RobotStudio/bors
python
https://github.com/RobotStudio/bors/blob/38bf338fc6905d90819faa56bd832140116720f0/bors/api/adapter/api.py#L62-L67
[ "def", "_generate_result", "(", "self", ",", "callname", ",", "result", ")", ":", "# Retrieve path from API class", "schema", "=", "self", ".", "api", ".", "result_schema", "(", ")", "schema", ".", "context", "[", "'callname'", "]", "=", "callname", "self", ...
38bf338fc6905d90819faa56bd832140116720f0
train
excel_key
create a key for index by converting index into a base-26 number, using A-Z as the characters.
bl/csv.py
def excel_key(index): """create a key for index by converting index into a base-26 number, using A-Z as the characters.""" X = lambda n: ~n and X((n // 26)-1) + chr(65 + (n % 26)) or '' return X(int(index))
def excel_key(index): """create a key for index by converting index into a base-26 number, using A-Z as the characters.""" X = lambda n: ~n and X((n // 26)-1) + chr(65 + (n % 26)) or '' return X(int(index))
[ "create", "a", "key", "for", "index", "by", "converting", "index", "into", "a", "base", "-", "26", "number", "using", "A", "-", "Z", "as", "the", "characters", "." ]
BlackEarth/bl
python
https://github.com/BlackEarth/bl/blob/edf6f37dac718987260b90ad0e7f7fe084a7c1a3/bl/csv.py#L29-L32
[ "def", "excel_key", "(", "index", ")", ":", "X", "=", "lambda", "n", ":", "~", "n", "and", "X", "(", "(", "n", "//", "26", ")", "-", "1", ")", "+", "chr", "(", "65", "+", "(", "n", "%", "26", ")", ")", "or", "''", "return", "X", "(", "i...
edf6f37dac718987260b90ad0e7f7fe084a7c1a3
train
convert_to_crash_data
Takes a raw crash and a processed crash (these are Socorro-centric data structures) and converts them to a crash data structure used by signature generation. :arg raw_crash: raw crash data from Socorro :arg processed_crash: processed crash data from Socorro :returns: crash data structure that conf...
siggen/utils.py
def convert_to_crash_data(raw_crash, processed_crash): """ Takes a raw crash and a processed crash (these are Socorro-centric data structures) and converts them to a crash data structure used by signature generation. :arg raw_crash: raw crash data from Socorro :arg processed_crash: processed cr...
def convert_to_crash_data(raw_crash, processed_crash): """ Takes a raw crash and a processed crash (these are Socorro-centric data structures) and converts them to a crash data structure used by signature generation. :arg raw_crash: raw crash data from Socorro :arg processed_crash: processed cr...
[ "Takes", "a", "raw", "crash", "and", "a", "processed", "crash", "(", "these", "are", "Socorro", "-", "centric", "data", "structures", ")", "and", "converts", "them", "to", "a", "crash", "data", "structure", "used", "by", "signature", "generation", "." ]
willkg/socorro-siggen
python
https://github.com/willkg/socorro-siggen/blob/db7e3233e665a458a961c48da22e93a69b1d08d6/siggen/utils.py#L16-L84
[ "def", "convert_to_crash_data", "(", "raw_crash", ",", "processed_crash", ")", ":", "# We want to generate fresh signatures, so we remove the \"normalized\" field", "# from stack frames from the processed crash because this is essentially", "# cached data from previous processing", "for", "t...
db7e3233e665a458a961c48da22e93a69b1d08d6
train
drop_bad_characters
Takes a text and drops all non-printable and non-ascii characters and also any whitespace characters that aren't space. :arg str text: the text to fix :returns: text with all bad characters dropped
siggen/utils.py
def drop_bad_characters(text): """Takes a text and drops all non-printable and non-ascii characters and also any whitespace characters that aren't space. :arg str text: the text to fix :returns: text with all bad characters dropped """ # Strip all non-ascii and non-printable characters te...
def drop_bad_characters(text): """Takes a text and drops all non-printable and non-ascii characters and also any whitespace characters that aren't space. :arg str text: the text to fix :returns: text with all bad characters dropped """ # Strip all non-ascii and non-printable characters te...
[ "Takes", "a", "text", "and", "drops", "all", "non", "-", "printable", "and", "non", "-", "ascii", "characters", "and", "also", "any", "whitespace", "characters", "that", "aren", "t", "space", "." ]
willkg/socorro-siggen
python
https://github.com/willkg/socorro-siggen/blob/db7e3233e665a458a961c48da22e93a69b1d08d6/siggen/utils.py#L91-L102
[ "def", "drop_bad_characters", "(", "text", ")", ":", "# Strip all non-ascii and non-printable characters", "text", "=", "''", ".", "join", "(", "[", "c", "for", "c", "in", "text", "if", "c", "in", "ALLOWED_CHARS", "]", ")", "return", "text" ]
db7e3233e665a458a961c48da22e93a69b1d08d6
train
parse_source_file
Parses a source file thing and returns the file name Example: >>> parse_file('hg:hg.mozilla.org/releases/mozilla-esr52:js/src/jit/MIR.h:755067c14b06') 'js/src/jit/MIR.h' :arg str source_file: the source file ("file") from a stack frame :returns: the filename or ``None`` if it couldn't determine ...
siggen/utils.py
def parse_source_file(source_file): """Parses a source file thing and returns the file name Example: >>> parse_file('hg:hg.mozilla.org/releases/mozilla-esr52:js/src/jit/MIR.h:755067c14b06') 'js/src/jit/MIR.h' :arg str source_file: the source file ("file") from a stack frame :returns: the fil...
def parse_source_file(source_file): """Parses a source file thing and returns the file name Example: >>> parse_file('hg:hg.mozilla.org/releases/mozilla-esr52:js/src/jit/MIR.h:755067c14b06') 'js/src/jit/MIR.h' :arg str source_file: the source file ("file") from a stack frame :returns: the fil...
[ "Parses", "a", "source", "file", "thing", "and", "returns", "the", "file", "name" ]
willkg/socorro-siggen
python
https://github.com/willkg/socorro-siggen/blob/db7e3233e665a458a961c48da22e93a69b1d08d6/siggen/utils.py#L105-L138
[ "def", "parse_source_file", "(", "source_file", ")", ":", "if", "not", "source_file", ":", "return", "None", "vcsinfo", "=", "source_file", ".", "split", "(", "':'", ")", "if", "len", "(", "vcsinfo", ")", "==", "4", ":", "# These are repositories or cloud file...
db7e3233e665a458a961c48da22e93a69b1d08d6
train
_is_exception
Predicate for whether the open token is in an exception context :arg exceptions: list of strings or None :arg before_token: the text of the function up to the token delimiter :arg after_token: the text of the function after the token delimiter :arg token: the token (only if we're looking at a close del...
siggen/utils.py
def _is_exception(exceptions, before_token, after_token, token): """Predicate for whether the open token is in an exception context :arg exceptions: list of strings or None :arg before_token: the text of the function up to the token delimiter :arg after_token: the text of the function after the token d...
def _is_exception(exceptions, before_token, after_token, token): """Predicate for whether the open token is in an exception context :arg exceptions: list of strings or None :arg before_token: the text of the function up to the token delimiter :arg after_token: the text of the function after the token d...
[ "Predicate", "for", "whether", "the", "open", "token", "is", "in", "an", "exception", "context" ]
willkg/socorro-siggen
python
https://github.com/willkg/socorro-siggen/blob/db7e3233e665a458a961c48da22e93a69b1d08d6/siggen/utils.py#L141-L159
[ "def", "_is_exception", "(", "exceptions", ",", "before_token", ",", "after_token", ",", "token", ")", ":", "if", "not", "exceptions", ":", "return", "False", "for", "s", "in", "exceptions", ":", "if", "before_token", ".", "endswith", "(", "s", ")", ":", ...
db7e3233e665a458a961c48da22e93a69b1d08d6
train
collapse
Collapses the text between two delimiters in a frame function value This collapses the text between two delimiters and either removes the text altogether or replaces it with a replacement string. There are certain contexts in which we might not want to collapse the text between two delimiters. These a...
siggen/utils.py
def collapse( function, open_string, close_string, replacement='', exceptions=None, ): """Collapses the text between two delimiters in a frame function value This collapses the text between two delimiters and either removes the text altogether or replaces it with a replacement string. ...
def collapse( function, open_string, close_string, replacement='', exceptions=None, ): """Collapses the text between two delimiters in a frame function value This collapses the text between two delimiters and either removes the text altogether or replaces it with a replacement string. ...
[ "Collapses", "the", "text", "between", "two", "delimiters", "in", "a", "frame", "function", "value" ]
willkg/socorro-siggen
python
https://github.com/willkg/socorro-siggen/blob/db7e3233e665a458a961c48da22e93a69b1d08d6/siggen/utils.py#L162-L239
[ "def", "collapse", "(", "function", ",", "open_string", ",", "close_string", ",", "replacement", "=", "''", ",", "exceptions", "=", "None", ",", ")", ":", "collapsed", "=", "[", "]", "open_count", "=", "0", "open_token", "=", "[", "]", "for", "i", ",",...
db7e3233e665a458a961c48da22e93a69b1d08d6
train
drop_prefix_and_return_type
Takes the function value from a frame and drops prefix and return type For example:: static void * Allocator<MozJemallocBase>::malloc(unsigned __int64) ^ ^^^^^^ return type prefix This gets changes to this:: Allocator<MozJemallocBase>::malloc(unsigned __int64) This ...
siggen/utils.py
def drop_prefix_and_return_type(function): """Takes the function value from a frame and drops prefix and return type For example:: static void * Allocator<MozJemallocBase>::malloc(unsigned __int64) ^ ^^^^^^ return type prefix This gets changes to this:: Allocator<Moz...
def drop_prefix_and_return_type(function): """Takes the function value from a frame and drops prefix and return type For example:: static void * Allocator<MozJemallocBase>::malloc(unsigned __int64) ^ ^^^^^^ return type prefix This gets changes to this:: Allocator<Moz...
[ "Takes", "the", "function", "value", "from", "a", "frame", "and", "drops", "prefix", "and", "return", "type" ]
willkg/socorro-siggen
python
https://github.com/willkg/socorro-siggen/blob/db7e3233e665a458a961c48da22e93a69b1d08d6/siggen/utils.py#L242-L324
[ "def", "drop_prefix_and_return_type", "(", "function", ")", ":", "DELIMITERS", "=", "{", "'('", ":", "')'", ",", "'{'", ":", "'}'", ",", "'['", ":", "']'", ",", "'<'", ":", "'>'", ",", "'`'", ":", "\"'\"", "}", "OPEN", "=", "DELIMITERS", ".", "keys",...
db7e3233e665a458a961c48da22e93a69b1d08d6
train
Hub.wait_connected
Wait for connections to be made and their handshakes to finish :param conns: a single or list of (host, port) tuples with the connections that must be finished before the method will return. defaults to all the peers the :class:`Hub` was instantiated with. :param tim...
junction/hub.py
def wait_connected(self, conns=None, timeout=None): '''Wait for connections to be made and their handshakes to finish :param conns: a single or list of (host, port) tuples with the connections that must be finished before the method will return. defaults to all the p...
def wait_connected(self, conns=None, timeout=None): '''Wait for connections to be made and their handshakes to finish :param conns: a single or list of (host, port) tuples with the connections that must be finished before the method will return. defaults to all the p...
[ "Wait", "for", "connections", "to", "be", "made", "and", "their", "handshakes", "to", "finish" ]
teepark/junction
python
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L38-L66
[ "def", "wait_connected", "(", "self", ",", "conns", "=", "None", ",", "timeout", "=", "None", ")", ":", "if", "timeout", ":", "deadline", "=", "time", ".", "time", "(", ")", "+", "timeout", "conns", "=", "conns", "or", "self", ".", "_started_peers", ...
481d135d9e53acb55c72686e2eb4483432f35fa6
train
Hub.shutdown
Close all peer connections and stop listening for new ones
junction/hub.py
def shutdown(self): 'Close all peer connections and stop listening for new ones' log.info("shutting down") for peer in self._dispatcher.peers.values(): peer.go_down(reconnect=False) if self._listener_coro: backend.schedule_exception( errors._...
def shutdown(self): 'Close all peer connections and stop listening for new ones' log.info("shutting down") for peer in self._dispatcher.peers.values(): peer.go_down(reconnect=False) if self._listener_coro: backend.schedule_exception( errors._...
[ "Close", "all", "peer", "connections", "and", "stop", "listening", "for", "new", "ones" ]
teepark/junction
python
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L68-L80
[ "def", "shutdown", "(", "self", ")", ":", "log", ".", "info", "(", "\"shutting down\"", ")", "for", "peer", "in", "self", ".", "_dispatcher", ".", "peers", ".", "values", "(", ")", ":", "peer", ".", "go_down", "(", "reconnect", "=", "False", ")", "if...
481d135d9e53acb55c72686e2eb4483432f35fa6
train
Hub.accept_publish
Set a handler for incoming publish messages :param service: the incoming message must have this service :type service: anything hash-able :param mask: value to be bitwise-and'ed against the incoming id, the result of which must mask the 'value' param :type mask: ...
junction/hub.py
def accept_publish( self, service, mask, value, method, handler=None, schedule=False): '''Set a handler for incoming publish messages :param service: the incoming message must have this service :type service: anything hash-able :param mask: value to be bitwise-an...
def accept_publish( self, service, mask, value, method, handler=None, schedule=False): '''Set a handler for incoming publish messages :param service: the incoming message must have this service :type service: anything hash-able :param mask: value to be bitwise-an...
[ "Set", "a", "handler", "for", "incoming", "publish", "messages" ]
teepark/junction
python
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L82-L128
[ "def", "accept_publish", "(", "self", ",", "service", ",", "mask", ",", "value", ",", "method", ",", "handler", "=", "None", ",", "schedule", "=", "False", ")", ":", "# support @hub.accept_publish(serv, mask, val, meth) decorator usage", "if", "handler", "is", "No...
481d135d9e53acb55c72686e2eb4483432f35fa6
train
Hub.unsubscribe_publish
Remove a publish subscription :param service: the service of the subscription to remove :type service: anything hash-able :param mask: the mask of the subscription to remove :type mask: int :param value: the value in the subscription to remove :type value: int :...
junction/hub.py
def unsubscribe_publish(self, service, mask, value): '''Remove a publish subscription :param service: the service of the subscription to remove :type service: anything hash-able :param mask: the mask of the subscription to remove :type mask: int :param value: the value i...
def unsubscribe_publish(self, service, mask, value): '''Remove a publish subscription :param service: the service of the subscription to remove :type service: anything hash-able :param mask: the mask of the subscription to remove :type mask: int :param value: the value i...
[ "Remove", "a", "publish", "subscription" ]
teepark/junction
python
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L130-L147
[ "def", "unsubscribe_publish", "(", "self", ",", "service", ",", "mask", ",", "value", ")", ":", "log", ".", "info", "(", "\"unsubscribing from publish %r\"", "%", "(", "(", "service", ",", "(", "mask", ",", "value", ")", ")", ",", ")", ")", "return", "...
481d135d9e53acb55c72686e2eb4483432f35fa6
train
Hub.publish
Send a 1-way message :param service: the service name (the routing top level) :type service: anything hash-able :param int routing_id: the id used for routing within the registered handlers of the service :param string method: the method name to call :par...
junction/hub.py
def publish(self, service, routing_id, method, args=None, kwargs=None, broadcast=False, udp=False): '''Send a 1-way message :param service: the service name (the routing top level) :type service: anything hash-able :param int routing_id: the id used for routing w...
def publish(self, service, routing_id, method, args=None, kwargs=None, broadcast=False, udp=False): '''Send a 1-way message :param service: the service name (the routing top level) :type service: anything hash-able :param int routing_id: the id used for routing w...
[ "Send", "a", "1", "-", "way", "message" ]
teepark/junction
python
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L149-L180
[ "def", "publish", "(", "self", ",", "service", ",", "routing_id", ",", "method", ",", "args", "=", "None", ",", "kwargs", "=", "None", ",", "broadcast", "=", "False", ",", "udp", "=", "False", ")", ":", "if", "udp", ":", "func", "=", "self", ".", ...
481d135d9e53acb55c72686e2eb4483432f35fa6
train
Hub.publish_receiver_count
Get the number of peers that would handle a particular publish :param service: the service name :type service: anything hash-able :param routing_id: the id used for limiting the service handlers :type routing_id: int
junction/hub.py
def publish_receiver_count(self, service, routing_id): '''Get the number of peers that would handle a particular publish :param service: the service name :type service: anything hash-able :param routing_id: the id used for limiting the service handlers :type routing_id: int ...
def publish_receiver_count(self, service, routing_id): '''Get the number of peers that would handle a particular publish :param service: the service name :type service: anything hash-able :param routing_id: the id used for limiting the service handlers :type routing_id: int ...
[ "Get", "the", "number", "of", "peers", "that", "would", "handle", "a", "particular", "publish" ]
teepark/junction
python
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L182-L195
[ "def", "publish_receiver_count", "(", "self", ",", "service", ",", "routing_id", ")", ":", "peers", "=", "len", "(", "list", "(", "self", ".", "_dispatcher", ".", "find_peer_routes", "(", "const", ".", "MSG_TYPE_PUBLISH", ",", "service", ",", "routing_id", "...
481d135d9e53acb55c72686e2eb4483432f35fa6
train
Hub.accept_rpc
Set a handler for incoming RPCs :param service: the incoming RPC must have this service :type service: anything hash-able :param mask: value to be bitwise-and'ed against the incoming id, the result of which must mask the 'value' param :type mask: int :par...
junction/hub.py
def accept_rpc(self, service, mask, value, method, handler=None, schedule=True): '''Set a handler for incoming RPCs :param service: the incoming RPC must have this service :type service: anything hash-able :param mask: value to be bitwise-and'ed against the incom...
def accept_rpc(self, service, mask, value, method, handler=None, schedule=True): '''Set a handler for incoming RPCs :param service: the incoming RPC must have this service :type service: anything hash-able :param mask: value to be bitwise-and'ed against the incom...
[ "Set", "a", "handler", "for", "incoming", "RPCs" ]
teepark/junction
python
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L197-L243
[ "def", "accept_rpc", "(", "self", ",", "service", ",", "mask", ",", "value", ",", "method", ",", "handler", "=", "None", ",", "schedule", "=", "True", ")", ":", "# support @hub.accept_rpc(serv, mask, val, meth) decorator usage", "if", "handler", "is", "None", ":...
481d135d9e53acb55c72686e2eb4483432f35fa6
train
Hub.unsubscribe_rpc
Remove a rpc subscription :param service: the service of the subscription to remove :type service: anything hash-able :param mask: the mask of the subscription to remove :type mask: int :param value: the value in the subscription to remove :type value: int :param...
junction/hub.py
def unsubscribe_rpc(self, service, mask, value): '''Remove a rpc subscription :param service: the service of the subscription to remove :type service: anything hash-able :param mask: the mask of the subscription to remove :type mask: int :param value: the value in the su...
def unsubscribe_rpc(self, service, mask, value): '''Remove a rpc subscription :param service: the service of the subscription to remove :type service: anything hash-able :param mask: the mask of the subscription to remove :type mask: int :param value: the value in the su...
[ "Remove", "a", "rpc", "subscription" ]
teepark/junction
python
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L245-L263
[ "def", "unsubscribe_rpc", "(", "self", ",", "service", ",", "mask", ",", "value", ")", ":", "log", ".", "info", "(", "\"unsubscribing from RPC %r\"", "%", "(", "(", "service", ",", "(", "mask", ",", "value", ")", ")", ",", ")", ")", "return", "self", ...
481d135d9e53acb55c72686e2eb4483432f35fa6
train
Hub.send_rpc
Send out an RPC request :param service: the service name (the routing top level) :type service: anything hash-able :param routing_id: The id used for routing within the registered handlers of the service. :type routing_id: int :param method: the method na...
junction/hub.py
def send_rpc(self, service, routing_id, method, args=None, kwargs=None, broadcast=False): '''Send out an RPC request :param service: the service name (the routing top level) :type service: anything hash-able :param routing_id: The id used for routing within the r...
def send_rpc(self, service, routing_id, method, args=None, kwargs=None, broadcast=False): '''Send out an RPC request :param service: the service name (the routing top level) :type service: anything hash-able :param routing_id: The id used for routing within the r...
[ "Send", "out", "an", "RPC", "request" ]
teepark/junction
python
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L265-L302
[ "def", "send_rpc", "(", "self", ",", "service", ",", "routing_id", ",", "method", ",", "args", "=", "None", ",", "kwargs", "=", "None", ",", "broadcast", "=", "False", ")", ":", "rpc", "=", "self", ".", "_dispatcher", ".", "send_rpc", "(", "service", ...
481d135d9e53acb55c72686e2eb4483432f35fa6
train
Hub.rpc
Send an RPC request and return the corresponding response This will block waiting until the response has been received. :param service: the service name (the routing top level) :type service: anything hash-able :param routing_id: The id used for routing within the registere...
junction/hub.py
def rpc(self, service, routing_id, method, args=None, kwargs=None, timeout=None, broadcast=False): '''Send an RPC request and return the corresponding response This will block waiting until the response has been received. :param service: the service name (the routing top level) ...
def rpc(self, service, routing_id, method, args=None, kwargs=None, timeout=None, broadcast=False): '''Send an RPC request and return the corresponding response This will block waiting until the response has been received. :param service: the service name (the routing top level) ...
[ "Send", "an", "RPC", "request", "and", "return", "the", "corresponding", "response" ]
teepark/junction
python
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L304-L345
[ "def", "rpc", "(", "self", ",", "service", ",", "routing_id", ",", "method", ",", "args", "=", "None", ",", "kwargs", "=", "None", ",", "timeout", "=", "None", ",", "broadcast", "=", "False", ")", ":", "rpc", "=", "self", ".", "send_rpc", "(", "ser...
481d135d9e53acb55c72686e2eb4483432f35fa6
train
Hub.rpc_receiver_count
Get the number of peers that would handle a particular RPC :param service: the service name :type service: anything hash-able :param routing_id: the id used for narrowing within the service handlers :type routing_id: int :returns: the integer number of p...
junction/hub.py
def rpc_receiver_count(self, service, routing_id): '''Get the number of peers that would handle a particular RPC :param service: the service name :type service: anything hash-able :param routing_id: the id used for narrowing within the service handlers :type routing_...
def rpc_receiver_count(self, service, routing_id): '''Get the number of peers that would handle a particular RPC :param service: the service name :type service: anything hash-able :param routing_id: the id used for narrowing within the service handlers :type routing_...
[ "Get", "the", "number", "of", "peers", "that", "would", "handle", "a", "particular", "RPC" ]
teepark/junction
python
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L347-L364
[ "def", "rpc_receiver_count", "(", "self", ",", "service", ",", "routing_id", ")", ":", "peers", "=", "len", "(", "list", "(", "self", ".", "_dispatcher", ".", "find_peer_routes", "(", "const", ".", "MSG_TYPE_RPC_REQUEST", ",", "service", ",", "routing_id", "...
481d135d9e53acb55c72686e2eb4483432f35fa6
train
Hub.start
Start up the hub's server, and have it start initiating connections
junction/hub.py
def start(self): "Start up the hub's server, and have it start initiating connections" log.info("starting") self._listener_coro = backend.greenlet(self._listener) self._udp_listener_coro = backend.greenlet(self._udp_listener) backend.schedule(self._listener_coro) backend...
def start(self): "Start up the hub's server, and have it start initiating connections" log.info("starting") self._listener_coro = backend.greenlet(self._listener) self._udp_listener_coro = backend.greenlet(self._udp_listener) backend.schedule(self._listener_coro) backend...
[ "Start", "up", "the", "hub", "s", "server", "and", "have", "it", "start", "initiating", "connections" ]
teepark/junction
python
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L366-L376
[ "def", "start", "(", "self", ")", ":", "log", ".", "info", "(", "\"starting\"", ")", "self", ".", "_listener_coro", "=", "backend", ".", "greenlet", "(", "self", ".", "_listener", ")", "self", ".", "_udp_listener_coro", "=", "backend", ".", "greenlet", "...
481d135d9e53acb55c72686e2eb4483432f35fa6
train
Hub.add_peer
Build a connection to the Hub at a given ``(host, port)`` address
junction/hub.py
def add_peer(self, peer_addr): "Build a connection to the Hub at a given ``(host, port)`` address" peer = connection.Peer( self._ident, self._dispatcher, peer_addr, backend.Socket()) peer.start() self._started_peers[peer_addr] = peer
def add_peer(self, peer_addr): "Build a connection to the Hub at a given ``(host, port)`` address" peer = connection.Peer( self._ident, self._dispatcher, peer_addr, backend.Socket()) peer.start() self._started_peers[peer_addr] = peer
[ "Build", "a", "connection", "to", "the", "Hub", "at", "a", "given", "(", "host", "port", ")", "address" ]
teepark/junction
python
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L378-L383
[ "def", "add_peer", "(", "self", ",", "peer_addr", ")", ":", "peer", "=", "connection", ".", "Peer", "(", "self", ".", "_ident", ",", "self", ".", "_dispatcher", ",", "peer_addr", ",", "backend", ".", "Socket", "(", ")", ")", "peer", ".", "start", "("...
481d135d9e53acb55c72686e2eb4483432f35fa6
train
Hub.peers
list of the (host, port) pairs of all connected peer Hubs
junction/hub.py
def peers(self): "list of the (host, port) pairs of all connected peer Hubs" return [addr for (addr, peer) in self._dispatcher.peers.items() if peer.up]
def peers(self): "list of the (host, port) pairs of all connected peer Hubs" return [addr for (addr, peer) in self._dispatcher.peers.items() if peer.up]
[ "list", "of", "the", "(", "host", "port", ")", "pairs", "of", "all", "connected", "peer", "Hubs" ]
teepark/junction
python
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L386-L389
[ "def", "peers", "(", "self", ")", ":", "return", "[", "addr", "for", "(", "addr", ",", "peer", ")", "in", "self", ".", "_dispatcher", ".", "peers", ".", "items", "(", ")", "if", "peer", ".", "up", "]" ]
481d135d9e53acb55c72686e2eb4483432f35fa6
train
main
Takes crash data via args and generates a Socorro signature
siggen/cmd_signature.py
def main(argv=None): """Takes crash data via args and generates a Socorro signature """ parser = argparse.ArgumentParser(description=DESCRIPTION, epilog=EPILOG) parser.add_argument( '-v', '--verbose', help='increase output verbosity', action='store_true' ) parser.add_argument( '...
def main(argv=None): """Takes crash data via args and generates a Socorro signature """ parser = argparse.ArgumentParser(description=DESCRIPTION, epilog=EPILOG) parser.add_argument( '-v', '--verbose', help='increase output verbosity', action='store_true' ) parser.add_argument( '...
[ "Takes", "crash", "data", "via", "args", "and", "generates", "a", "Socorro", "signature" ]
willkg/socorro-siggen
python
https://github.com/willkg/socorro-siggen/blob/db7e3233e665a458a961c48da22e93a69b1d08d6/siggen/cmd_signature.py#L111-L209
[ "def", "main", "(", "argv", "=", "None", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "DESCRIPTION", ",", "epilog", "=", "EPILOG", ")", "parser", ".", "add_argument", "(", "'-v'", ",", "'--verbose'", ",", "help", "...
db7e3233e665a458a961c48da22e93a69b1d08d6
train
WsShinken.send_result
Send result to the Skinken WS
monitoring_agent/outputs/ws_shinken.py
def send_result(self, return_code, output, service_description='', time_stamp=0, specific_servers=None): ''' Send result to the Skinken WS ''' if time_stamp == 0: time_stamp = int(time.time()) if specific_servers == None: specific_servers = self.servers ...
def send_result(self, return_code, output, service_description='', time_stamp=0, specific_servers=None): ''' Send result to the Skinken WS ''' if time_stamp == 0: time_stamp = int(time.time()) if specific_servers == None: specific_servers = self.servers ...
[ "Send", "result", "to", "the", "Skinken", "WS" ]
Eyepea/tanto
python
https://github.com/Eyepea/tanto/blob/ad8fd32e0fd3b7bc3dee5dabb984a2567ae46fe9/monitoring_agent/outputs/ws_shinken.py#L85-L143
[ "def", "send_result", "(", "self", ",", "return_code", ",", "output", ",", "service_description", "=", "''", ",", "time_stamp", "=", "0", ",", "specific_servers", "=", "None", ")", ":", "if", "time_stamp", "==", "0", ":", "time_stamp", "=", "int", "(", "...
ad8fd32e0fd3b7bc3dee5dabb984a2567ae46fe9
train
WsShinken.close_cache
Close cache of WS Shinken
monitoring_agent/outputs/ws_shinken.py
def close_cache(self): ''' Close cache of WS Shinken ''' # Close all WS_Shinken cache files for server in self.servers: if self.servers[server]['cache'] == True: self.servers[server]['file'].close()
def close_cache(self): ''' Close cache of WS Shinken ''' # Close all WS_Shinken cache files for server in self.servers: if self.servers[server]['cache'] == True: self.servers[server]['file'].close()
[ "Close", "cache", "of", "WS", "Shinken" ]
Eyepea/tanto
python
https://github.com/Eyepea/tanto/blob/ad8fd32e0fd3b7bc3dee5dabb984a2567ae46fe9/monitoring_agent/outputs/ws_shinken.py#L146-L153
[ "def", "close_cache", "(", "self", ")", ":", "# Close all WS_Shinken cache files", "for", "server", "in", "self", ".", "servers", ":", "if", "self", ".", "servers", "[", "server", "]", "[", "'cache'", "]", "==", "True", ":", "self", ".", "servers", "[", ...
ad8fd32e0fd3b7bc3dee5dabb984a2567ae46fe9
train
prepare_dir
Create apidoc dir, delete contents if delete is True. :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param directory: the apidoc directory. you can use relative paths here :type directory: str :param delete: if True, deletes the contents of apidoc. This acts like an overr...
src/jinjaapidoc/gendoc.py
def prepare_dir(app, directory, delete=False): """Create apidoc dir, delete contents if delete is True. :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param directory: the apidoc directory. you can use relative paths here :type directory: str :param delete: if True, d...
def prepare_dir(app, directory, delete=False): """Create apidoc dir, delete contents if delete is True. :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param directory: the apidoc directory. you can use relative paths here :type directory: str :param delete: if True, d...
[ "Create", "apidoc", "dir", "delete", "contents", "if", "delete", "is", "True", "." ]
storax/jinjaapidoc
python
https://github.com/storax/jinjaapidoc/blob/f1eeb6ab5bd1a96c4130306718c6423f37c76856/src/jinjaapidoc/gendoc.py#L38-L60
[ "def", "prepare_dir", "(", "app", ",", "directory", ",", "delete", "=", "False", ")", ":", "logger", ".", "info", "(", "\"Preparing output directories for jinjaapidoc.\"", ")", "if", "os", ".", "path", ".", "exists", "(", "directory", ")", ":", "if", "delete...
f1eeb6ab5bd1a96c4130306718c6423f37c76856
train
makename
Join package and module with a dot. Package or Module can be empty. :param package: the package name :type package: :class:`str` :param module: the module name :type module: :class:`str` :returns: the joined name :rtype: :class:`str` :raises: :class:`AssertionError`, if both package an...
src/jinjaapidoc/gendoc.py
def makename(package, module): """Join package and module with a dot. Package or Module can be empty. :param package: the package name :type package: :class:`str` :param module: the module name :type module: :class:`str` :returns: the joined name :rtype: :class:`str` :raises: :clas...
def makename(package, module): """Join package and module with a dot. Package or Module can be empty. :param package: the package name :type package: :class:`str` :param module: the module name :type module: :class:`str` :returns: the joined name :rtype: :class:`str` :raises: :clas...
[ "Join", "package", "and", "module", "with", "a", "dot", "." ]
storax/jinjaapidoc
python
https://github.com/storax/jinjaapidoc/blob/f1eeb6ab5bd1a96c4130306718c6423f37c76856/src/jinjaapidoc/gendoc.py#L87-L108
[ "def", "makename", "(", "package", ",", "module", ")", ":", "# Both package and module can be None/empty.", "assert", "package", "or", "module", ",", "\"Specify either package or module\"", "if", "package", ":", "name", "=", "package", "if", "module", ":", "name", "...
f1eeb6ab5bd1a96c4130306718c6423f37c76856
train
write_file
Write the output file for module/package <name>. :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param name: the file name without file extension :type name: :class:`str` :param text: the content of the file :type text: :class:`str` :param dest: the output director...
src/jinjaapidoc/gendoc.py
def write_file(app, name, text, dest, suffix, dryrun, force): """Write the output file for module/package <name>. :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param name: the file name without file extension :type name: :class:`str` :param text: the content of the f...
def write_file(app, name, text, dest, suffix, dryrun, force): """Write the output file for module/package <name>. :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param name: the file name without file extension :type name: :class:`str` :param text: the content of the f...
[ "Write", "the", "output", "file", "for", "module", "/", "package", "<name", ">", "." ]
storax/jinjaapidoc
python
https://github.com/storax/jinjaapidoc/blob/f1eeb6ab5bd1a96c4130306718c6423f37c76856/src/jinjaapidoc/gendoc.py#L111-L149
[ "def", "write_file", "(", "app", ",", "name", ",", "text", ",", "dest", ",", "suffix", ",", "dryrun", ",", "force", ")", ":", "fname", "=", "os", ".", "path", ".", "join", "(", "dest", ",", "'%s.%s'", "%", "(", "name", ",", "suffix", ")", ")", ...
f1eeb6ab5bd1a96c4130306718c6423f37c76856
train
import_name
Import the given name and return name, obj, parent, mod_name :param name: name to import :type name: str :returns: the imported object or None :rtype: object | None :raises: None
src/jinjaapidoc/gendoc.py
def import_name(app, name): """Import the given name and return name, obj, parent, mod_name :param name: name to import :type name: str :returns: the imported object or None :rtype: object | None :raises: None """ try: logger.debug('Importing %r', name) name, obj = autos...
def import_name(app, name): """Import the given name and return name, obj, parent, mod_name :param name: name to import :type name: str :returns: the imported object or None :rtype: object | None :raises: None """ try: logger.debug('Importing %r', name) name, obj = autos...
[ "Import", "the", "given", "name", "and", "return", "name", "obj", "parent", "mod_name" ]
storax/jinjaapidoc
python
https://github.com/storax/jinjaapidoc/blob/f1eeb6ab5bd1a96c4130306718c6423f37c76856/src/jinjaapidoc/gendoc.py#L152-L167
[ "def", "import_name", "(", "app", ",", "name", ")", ":", "try", ":", "logger", ".", "debug", "(", "'Importing %r'", ",", "name", ")", "name", ",", "obj", "=", "autosummary", ".", "import_by_name", "(", "name", ")", "[", ":", "2", "]", "logger", ".", ...
f1eeb6ab5bd1a96c4130306718c6423f37c76856