libjam 0.0.13__tar.gz → 0.0.15__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {libjam-0.0.13 → libjam-0.0.15}/PKG-INFO +1 -1
- {libjam-0.0.13 → libjam-0.0.15}/libjam/notebook.py +2 -5
- {libjam-0.0.13 → libjam-0.0.15}/libjam/typewriter.py +15 -10
- {libjam-0.0.13 → libjam-0.0.15}/pyproject.toml +1 -1
- {libjam-0.0.13 → libjam-0.0.15}/.gitignore +0 -0
- {libjam-0.0.13 → libjam-0.0.15}/LICENSE +0 -0
- {libjam-0.0.13 → libjam-0.0.15}/README.md +0 -0
- {libjam-0.0.13 → libjam-0.0.15}/build.sh +0 -0
- {libjam-0.0.13 → libjam-0.0.15}/libjam/__init__.py +0 -0
- {libjam-0.0.13 → libjam-0.0.15}/libjam/captain.py +0 -0
- {libjam-0.0.13 → libjam-0.0.15}/libjam/clipboard.py +0 -0
- {libjam-0.0.13 → libjam-0.0.15}/libjam/drawer.py +0 -0
- {libjam-0.0.13 → libjam-0.0.15}/libjam/flashcard.py +0 -0
@@ -43,14 +43,11 @@ class Notebook:
|
|
43
43
|
# Reads ini file and returns its contents in the form of a dict.
|
44
44
|
# allow_duplicates is only to be used as a last resort due to the performance
|
45
45
|
# impact and inaccuracy in results.
|
46
|
-
def read_ini(self, ini_file: str,
|
46
|
+
def read_ini(self, ini_file: str, allow_duplicates=False):
|
47
47
|
if drawer.is_file(ini_file) is False:
|
48
48
|
return None
|
49
49
|
ini_file = drawer.absolute_path(ini_file)
|
50
|
-
|
51
|
-
parser = configparser.ConfigParser(inline_comment_prefixes=('#', ';'))
|
52
|
-
else:
|
53
|
-
parser = configparser.ConfigParser()
|
50
|
+
parser = configparser.ConfigParser(inline_comment_prefixes=('#', ';'))
|
54
51
|
try:
|
55
52
|
parser.read(ini_file)
|
56
53
|
except configparser.DuplicateSectionError:
|
@@ -3,26 +3,31 @@ import shutil
|
|
3
3
|
|
4
4
|
# Responsible for formatting, modification and printing of strings
|
5
5
|
class Typewriter:
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
self.CURSOR_UP = '\033[1A'
|
6
|
+
# Shorthand vars
|
7
|
+
BOLD = '\033[1m'
|
8
|
+
NORMAL = '\033[0m'
|
9
|
+
CLEAR = '\x1b[2K'
|
10
|
+
CURSOR_UP = '\033[1A'
|
12
11
|
|
13
12
|
# Gets a string, makes it bold, returns the string
|
14
13
|
def bolden(self, text: str):
|
15
14
|
text = f'{self.BOLD}{text}{self.NORMAL}'
|
16
15
|
return text
|
17
16
|
|
18
|
-
#
|
19
|
-
|
17
|
+
# Returns current terminal width and height (columns and lines) as a tuple.
|
18
|
+
def get_terminal_size(self):
|
19
|
+
size = shutil.get_terminal_size()
|
20
|
+
x, y = size[0], size[1]
|
21
|
+
return (x, y)
|
22
|
+
|
23
|
+
# Clears a given number of lines in the terminal.
|
24
|
+
# If the specified number of lines is 0 then the current line will be erased.
|
20
25
|
def clear_lines(self, lines: int):
|
21
26
|
if lines == 0:
|
22
27
|
print("\r" + self.CLEAR, end='')
|
23
28
|
return
|
24
29
|
for line in range(lines):
|
25
|
-
print(self.
|
30
|
+
print(self.CLEAR, end=self.CURSOR_UP)
|
26
31
|
|
27
32
|
# Clears current line to print a new one.
|
28
33
|
# Usecase: after typewriter.print_status()
|
@@ -38,7 +43,7 @@ class Typewriter:
|
|
38
43
|
# Prints on the same line
|
39
44
|
def print_progress(self, status: str, current: int, total: int):
|
40
45
|
width = 25
|
41
|
-
progress_float= (current / total)
|
46
|
+
progress_float = (current / total)
|
42
47
|
percent = int(round((progress_float* 100), 0))
|
43
48
|
percent_string = str(percent)
|
44
49
|
if percent < 100:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|