pipu-cli 0.1.dev0__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.
- pipu_cli/__init__.py +49 -0
- pipu_cli/cli.py +861 -0
- pipu_cli/common.py +4 -0
- pipu_cli/config.py +95 -0
- pipu_cli/internals.py +750 -0
- pipu_cli/package_constraints.py +2273 -0
- pipu_cli/thread_safe.py +243 -0
- pipu_cli/ui/__init__.py +51 -0
- pipu_cli/ui/apps.py +1460 -0
- pipu_cli/ui/constants.py +19 -0
- pipu_cli/ui/modal_dialogs.py +1340 -0
- pipu_cli/ui/table_widgets.py +345 -0
- pipu_cli/utils.py +169 -0
- pipu_cli-0.1.dev0.dist-info/METADATA +517 -0
- pipu_cli-0.1.dev0.dist-info/RECORD +19 -0
- pipu_cli-0.1.dev0.dist-info/WHEEL +5 -0
- pipu_cli-0.1.dev0.dist-info/entry_points.txt +2 -0
- pipu_cli-0.1.dev0.dist-info/licenses/LICENSE +21 -0
- pipu_cli-0.1.dev0.dist-info/top_level.txt +1 -0
pipu_cli/__init__.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from .config import LOG_LEVEL
|
|
3
|
+
|
|
4
|
+
__version__ = '0.1.dev0'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
# Configure logging
|
|
8
|
+
log = logging.getLogger("pipu")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class LevelSpecificFormatter(logging.Formatter):
|
|
12
|
+
"""
|
|
13
|
+
A logging formatter that prefexes every level but INFO
|
|
14
|
+
"""
|
|
15
|
+
NORMAL_FORMAT = "%(message)s"
|
|
16
|
+
LEVEL_SPECIFIC_FORMAT = "%(levelname)s: %(message)s"
|
|
17
|
+
|
|
18
|
+
def __init__(self):
|
|
19
|
+
super().__init__(fmt=self.NORMAL_FORMAT, datefmt=None, style='%')
|
|
20
|
+
|
|
21
|
+
def format(self, record: logging.LogRecord) -> str:
|
|
22
|
+
"""
|
|
23
|
+
Format a log record based on the log level.
|
|
24
|
+
|
|
25
|
+
:param record: Record to format
|
|
26
|
+
:returns: Formatted record string
|
|
27
|
+
"""
|
|
28
|
+
if record.levelno == logging.INFO:
|
|
29
|
+
self._style._fmt = self.NORMAL_FORMAT
|
|
30
|
+
else:
|
|
31
|
+
self._style._fmt = self.LEVEL_SPECIFIC_FORMAT
|
|
32
|
+
|
|
33
|
+
# Call the original formatter class to do the grunt work
|
|
34
|
+
result = logging.Formatter.format(self, record)
|
|
35
|
+
|
|
36
|
+
return result
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
############################
|
|
40
|
+
# Configure the logger
|
|
41
|
+
############################
|
|
42
|
+
|
|
43
|
+
ch = logging.StreamHandler()
|
|
44
|
+
ch.setLevel(LOG_LEVEL)
|
|
45
|
+
|
|
46
|
+
ch.setFormatter(LevelSpecificFormatter())
|
|
47
|
+
log.addHandler(ch)
|
|
48
|
+
|
|
49
|
+
log.setLevel(LOG_LEVEL)
|