Reference¶
buglog.bootstrap¶
-
buglog.bootstrap.ensure_config(*, force_update=False)¶ Create config folder and copy example config into it, if not yet.
- Parameters
force_update (
bool) – Forcefully refresh the config, even if already present (used for debug porposes).- Return type
None
-
buglog.bootstrap.ensure_fzf(*, version='0.21.1')¶ Create data folder and download fzf binary into it, if not yet.
- Parameters
version (
str) – Version of fzf to be downloaded.- Return type
None
buglog.cli¶
buglog.dump¶
buglog.fuzzy¶
buglog.parse_rst¶
-
buglog.parse_rst.bugs_to_rst(bugs_classes)¶ Convert a list of bug models to reStructuredText.
- Return type
str
buglog.prompt¶
-
buglog.prompt.date_to_filename(bug_name, date)¶ Get appropriate filename for a bug dump.
Example
>>> from datetime import datetime >>> date_to_filename('Squats', datetime(2007, 12, 6, 15, 29, 43)) '2007-12-06_15:29:43_Squats.json'
- Parameters
bug_name (
str) – The class name of the bug.date (
datetime) – Bug generation time and date.
- Return type
str- Returns
Name of .json file dump.
-
buglog.prompt.edit_filename_date(bug_name, default='')¶ Prompt user to change timedate of created file.
- Parameters
bug_name (
str) – The class name of the bug.default (
str) – Default textual time.
- Return type
Tuple[str,str]- Returns
New name of the .json dump file and the raw text entered by user.
-
buglog.prompt.user_read_character(*args)¶ Read single character.
Prompt user with the lines passed as parameters, and then wait for a valid keypress. The possible keypresses are searched in between of
[]brackets.If the letter in brackets is UPPERCASE, then it is treated as a default choice and corrsponds to pressing Enter.
Example
>>> user_read_character("Install?", "[Y]es/[n]ope")
- Parameters
args (
str) – Lines to be printed as a prompt.- Return type
str- Returns
The letter the user have chosen; lowercase.
buglog.utils¶
-
buglog.utils.import_config()¶ Import module as object.
src: https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly
- Return type
module- Returns
The
${XDG_CONFIG_HOME:-${HOME}/.config}/buglog/config.pymodule object (assuming it is present).
-
buglog.utils.split_to_types(items, *, t1, t2)¶ Split list into two lists, based on type.
- Parameters
items (
Iterable[Union[~T1, ~T2,Any]]) – Elements of two types.t1 (
Type[~T1]) – first typet2 (
Type[~T2]) – second type
- Return type
Tuple[List[~T1],List[~T2]]- Returns
Two lists, each with object of it’s own type. All objects which are not either of type t1 or t2 are dropped.
Example
>>> nums = iter([ ... 1, 2, 3, 4, 5, 6, 7, 8, 9, ... 'A', 'B', 'C', 'D', 'E', 'F', ... None, print ... ]) >>> split_to_types(nums, t1=int, t2=str) ([1, 2, 3, 4, 5, 6, 7, 8, 9], ['A', 'B', 'C', 'D', 'E', 'F'])
-
buglog.utils.str_to_bug(bug_name)¶ Convert string containing bug class name to a class itself.
- Parameters
bug_name (
str) – The name of the Bug subclass.- Return type
Type[Bug]- Returns
The bug’s subclass object.