shadowshell 0.0.38__tar.gz → 0.0.40__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.
Files changed (37) hide show
  1. {shadowshell-0.0.38 → shadowshell-0.0.40}/PKG-INFO +1 -1
  2. {shadowshell-0.0.38 → shadowshell-0.0.40}/pyproject.toml +2 -2
  3. shadowshell-0.0.40/src/shadowshell/file/__init__.py +10 -0
  4. shadowshell-0.0.40/src/shadowshell/file/file_util.py +19 -0
  5. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell/logging/__init__.py +7 -1
  6. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell/logging/console_logger.py +5 -3
  7. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell/logging/logger_factory.py +5 -4
  8. shadowshell-0.0.40/src/shadowshell/logging/logging_constants.py +12 -0
  9. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell/monitor/monitor.py +5 -2
  10. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell.egg-info/PKG-INFO +1 -1
  11. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell.egg-info/SOURCES.txt +3 -0
  12. {shadowshell-0.0.38 → shadowshell-0.0.40}/README.md +0 -0
  13. {shadowshell-0.0.38 → shadowshell-0.0.40}/setup.cfg +0 -0
  14. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell/__init__.py +0 -0
  15. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell/boot/__init__.py +0 -0
  16. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell/boot/starter.py +0 -0
  17. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell/bootstrap.py +0 -0
  18. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell/config/__init__.py +0 -0
  19. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell/config/configurator.py +0 -0
  20. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell/configurator.py +0 -0
  21. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell/console_logger.py +0 -0
  22. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell/git_shell.py +0 -0
  23. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell/logger.py +0 -0
  24. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell/logger_factory.py +0 -0
  25. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell/logging/logger.py +0 -0
  26. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell/monitor/__init__.py +0 -0
  27. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell/serialize/__init__.py +0 -0
  28. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell/serialize/serializer.py +0 -0
  29. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell/serialize/serializer_factory.py +0 -0
  30. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell/serialize/serializer_json.py +0 -0
  31. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell/stock_trader.py +0 -0
  32. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell/test/__init__.py +0 -0
  33. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell/test/test.py +0 -0
  34. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell.egg-info/dependency_links.txt +0 -0
  35. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell.egg-info/requires.txt +0 -0
  36. {shadowshell-0.0.38 → shadowshell-0.0.40}/src/shadowshell.egg-info/top_level.txt +0 -0
  37. {shadowshell-0.0.38 → shadowshell-0.0.40}/tests/tests.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shadowshell
3
- Version: 0.0.38
3
+ Version: 0.0.40
4
4
  Summary: www.shadowshell.xyz
5
5
  Author-email: shadowshell <shadowshellxyz@foxmail.com>
6
6
  License: MIT
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "shadowshell" # 全局唯一名称(检查PyPI是否被占用)
7
- version = "0.0.38" # 版本号(每次更新需递增)
8
- #version = "0.0.61" # 版本号(每次更新需递增)
7
+ version = "0.0.40" # 版本号(每次更新需递增)
8
+ #version = "0.0.71" # 版本号(每次更新需递增)
9
9
  authors = [{ name = "shadowshell", email = "shadowshellxyz@foxmail.com" }]
10
10
  description = "www.shadowshell.xyz"
11
11
  readme = "README.md"
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+
4
+ """
5
+ @author: shadowshell
6
+ """
7
+
8
+ from shadowshell.file.file_util import FileUtil
9
+
10
+ __all__ = ['FileUtil']
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+
4
+ """
5
+ @author: shadowshell
6
+ """
7
+
8
+ from shadowshell.logging import LoggerFactory
9
+
10
+ class FileUtil:
11
+
12
+ __logger = LoggerFactory.get_logger()
13
+
14
+ @staticmethod
15
+ def get_all(file_path, mode="r", encoding="utf-8"):
16
+ with open(file_path, mode, encoding = encoding) as f:
17
+ content = f.read()
18
+ FileUtil.__logger.debug(f"[{file_path}][All content]{content}")
19
+ return content
@@ -5,8 +5,14 @@
5
5
  @author: shadowshell
6
6
  """
7
7
 
8
+ from shadowshell.logging.logging_constants import LoggingConstants
8
9
  from shadowshell.logging.logger import Logger
9
10
  from shadowshell.logging.logger_factory import LoggerFactory
10
11
  from shadowshell.logging.console_logger import ConsoleLogger
11
12
 
12
- __all__ = ['Logger', 'LoggerFactory', 'ConsoleLogger']
13
+ __all__ = [
14
+ 'LoggingConstants',
15
+ 'Logger',
16
+ 'LoggerFactory',
17
+ 'ConsoleLogger'
18
+ ]
@@ -8,14 +8,16 @@ author: shadow shell
8
8
  """
9
9
 
10
10
  from shadowshell.logging.logger import Logger
11
+ from shadowshell.logging.logging_constants import LoggingConstants
11
12
 
12
13
  class ConsoleLogger(Logger):
13
14
 
14
15
  def debug(self, content):
15
- self.__log(content)
16
-
16
+ if LoggingConstants.LEVEL_DEBUG is True:
17
+ self.__log(content)
17
18
  def info(self, content):
18
- self.__log(content)
19
+ if LoggingConstants.LEVEL_INFO is True:
20
+ self.__log(content)
19
21
 
20
22
  def warn(self, content):
21
23
  self.__log(content)
@@ -10,13 +10,14 @@ from shadowshell.logging.console_logger import ConsoleLogger
10
10
 
11
11
  class LoggerFactory:
12
12
 
13
- logger = None
13
+ __logger = ConsoleLogger()
14
14
 
15
15
  def __init__(self):
16
- self.logger = ConsoleLogger()
16
+ pass
17
17
 
18
- def get_logger(self, name = "default"):
19
- return self.logger
18
+ @staticmethod
19
+ def get_logger(name = "default"):
20
+ return LoggerFactory.__logger
20
21
 
21
22
  if __name__ == "__main__":
22
23
  LoggerFactory().get_logger().info("test")
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+
4
+ """
5
+ logging_constants
6
+ author: shadow shell
7
+ """
8
+
9
+ class LoggingConstants:
10
+
11
+ LEVEL_DEBUG = False
12
+ LEVEL_INFO = True
@@ -33,21 +33,24 @@ def function_monitor(class_name=None, callback=None):
33
33
  def wrapper(*args, **kwargs):
34
34
  start = time.perf_counter()
35
35
  result = None
36
+ is_success = True
36
37
  try:
37
38
  result = func(*args, **kwargs)
38
39
  except Exception as e:
39
40
  logger.error(e)
41
+ is_success = False
40
42
  raise
41
43
  except:
42
44
  logger.error(sys.exc_info()[0])
45
+ is_success = False
43
46
  raise
44
47
  finally:
45
48
  elapsed = time.perf_counter() - start
46
49
  # log
47
50
  if (class_name is not None):
48
- logger.info(f"[FUNCTION_MONITOR][{class_name}.{func.__name__}] has ran, time elapsed:{elapsed:.6f}s.")
51
+ logger.info(f"[FUNCTION_MONITOR][{class_name}.{func.__name__}] has ran, is_success={is_success}, time elapsed:{elapsed:.6f}s.")
49
52
  else:
50
- logger.info(f"[FUNCTION_MONITOR][{func.__name__}] has ran, time elapsed:{elapsed:.6f}s.")
53
+ logger.info(f"[FUNCTION_MONITOR][{func.__name__}] has ran, is_success={is_success}, time elapsed:{elapsed:.6f}s.")
51
54
 
52
55
  # callback
53
56
  if callback is not None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shadowshell
3
- Version: 0.0.38
3
+ Version: 0.0.40
4
4
  Summary: www.shadowshell.xyz
5
5
  Author-email: shadowshell <shadowshellxyz@foxmail.com>
6
6
  License: MIT
@@ -17,10 +17,13 @@ src/shadowshell/boot/__init__.py
17
17
  src/shadowshell/boot/starter.py
18
18
  src/shadowshell/config/__init__.py
19
19
  src/shadowshell/config/configurator.py
20
+ src/shadowshell/file/__init__.py
21
+ src/shadowshell/file/file_util.py
20
22
  src/shadowshell/logging/__init__.py
21
23
  src/shadowshell/logging/console_logger.py
22
24
  src/shadowshell/logging/logger.py
23
25
  src/shadowshell/logging/logger_factory.py
26
+ src/shadowshell/logging/logging_constants.py
24
27
  src/shadowshell/monitor/__init__.py
25
28
  src/shadowshell/monitor/monitor.py
26
29
  src/shadowshell/serialize/__init__.py
File without changes
File without changes