libjam 0.0.13__py3-none-any.whl → 0.0.14__py3-none-any.whl

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/notebook.py CHANGED
@@ -43,16 +43,16 @@ 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, inline_comments=False, allow_duplicates=False):
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
- if inline_comments is True:
51
- parser = configparser.ConfigParser(inline_comment_prefixes=('#', ';'))
52
- else:
53
- parser = configparser.ConfigParser()
50
+ parser = configparser.ConfigParser()
54
51
  try:
55
52
  parser.read(ini_file)
53
+ except configparser.InterpolationSyntaxError:
54
+ parser = configparser.ConfigParser(inline_comment_prefixes=('#', ';'))
55
+ parser.read(ini_file)
56
56
  except configparser.DuplicateSectionError:
57
57
  if allow_duplicates is True:
58
58
  ini_string = open(ini_file, 'r').read()
libjam/typewriter.py CHANGED
@@ -3,26 +3,31 @@ import shutil
3
3
 
4
4
  # Responsible for formatting, modification and printing of strings
5
5
  class Typewriter:
6
- def __init__(self):
7
- # Shorthand vars
8
- self.BOLD = '\033[1m'
9
- self.NORMAL = '\033[0m'
10
- self.CLEAR = '\x1b[2K'
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
- # Clears a given number of lines in the terminal
19
- # if given 0 the current line will be erased
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.CURSOR_UP + self.CLEAR, end='')
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:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: libjam
3
- Version: 0.0.13
3
+ Version: 0.0.14
4
4
  Summary: A library jam for Python.
5
5
  Project-URL: Homepage, https://github.com/philippkosarev/libjam
6
6
  Project-URL: Issues, https://github.com/philippkosarev/libjam/issues
@@ -3,9 +3,9 @@ libjam/captain.py,sha256=igx-ecKJBI_vBN-pW7KmSEnmYMIHQEb9tFzpy5qHmI8,5636
3
3
  libjam/clipboard.py,sha256=5HxlO8ztLJPlnSCq4PncGvY4JGc9C4J2uHcepjC6zmg,3496
4
4
  libjam/drawer.py,sha256=vKL1iN8chHjXZRsTdmhE8qpDaZAgh7Orx5KtrvgplcE,12100
5
5
  libjam/flashcard.py,sha256=ulV4KPC3BRWLxwkQ87vsY0aM38nYpzOjUOISxTIRVDg,437
6
- libjam/notebook.py,sha256=UFgTEXESVYUWlghMEXhzgHFmGgnrsB7sWUcr5UvjC7k,4534
7
- libjam/typewriter.py,sha256=waKY1sDxGzI2ZT5dSzFmLGbaNTIpEM5Zhg_OlPFUAng,3730
8
- libjam-0.0.13.dist-info/METADATA,sha256=2C-lbT2WVaYap5l7HiH6Zs2ZYTWrOXMCr8_PM4VbmiE,2141
9
- libjam-0.0.13.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
- libjam-0.0.13.dist-info/licenses/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
11
- libjam-0.0.13.dist-info/RECORD,,
6
+ libjam/notebook.py,sha256=3Loo76CGAWK5LmyBKB8UwZhs_STH-U93aqqSav93oJI,4545
7
+ libjam/typewriter.py,sha256=_fdXGGn2fpSwfco0bwR8LPm-DVRJgvwiX7n4HllUHuY,3902
8
+ libjam-0.0.14.dist-info/METADATA,sha256=8aPT0aG-SPlPtGZgabG6kpU5ijEhX8DwikBVR11yq8o,2141
9
+ libjam-0.0.14.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
+ libjam-0.0.14.dist-info/licenses/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
11
+ libjam-0.0.14.dist-info/RECORD,,