shadowshell 0.0.24__tar.gz → 0.0.29__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.
@@ -1,20 +1,18 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: shadowshell
3
- Version: 0.0.24
4
- Summary: shadowshell.xyz
5
- Author-email: shadowshell <shadowshell@foxmail.com>
3
+ Version: 0.0.29
4
+ Summary: www.shadowshell.xyz
5
+ Author-email: shadowshell <shadowshellxyz@foxmail.com>
6
6
  License: MIT
7
7
  Classifier: Programming Language :: Python :: 3
8
8
  Classifier: Operating System :: OS Independent
9
9
  Requires-Python: >=3.6
10
10
  Description-Content-Type: text/markdown
11
- Requires-Dist: requests
12
-
13
-
11
+ Requires-Dist: configparser
14
12
 
15
13
  # Install
16
14
 
17
- ``` BASH
15
+ ``` shell
18
16
 
19
17
  > pip3 install shadowshell --upgrade
20
18
 
@@ -1,8 +1,6 @@
1
-
2
-
3
1
  # Install
4
2
 
5
- ``` BASH
3
+ ``` shell
6
4
 
7
5
  > pip3 install shadowshell --upgrade
8
6
 
@@ -4,10 +4,10 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "shadowshell" # 全局唯一名称(检查PyPI是否被占用)
7
- version = "0.0.24" # 版本号(每次更新需递增)
8
- #version = "0.0.25" # 版本号(每次更新需递增)
9
- authors = [{ name = "shadowshell", email = "shadowshell@foxmail.com" }]
10
- description = "shadowshell.xyz"
7
+ #version = "0.0.24" # 版本号(每次更新需递增)
8
+ version = "0.0.29" # 版本号(每次更新需递增)
9
+ authors = [{ name = "shadowshell", email = "shadowshellxyz@foxmail.com" }]
10
+ description = "www.shadowshell.xyz"
11
11
  readme = "README.md"
12
12
  requires-python = ">=3.6" # 支持的Python版本
13
13
  license = { text = "MIT" } # 协议类型
@@ -15,7 +15,9 @@ classifiers = [ # 分类标签(可选)
15
15
  "Programming Language :: Python :: 3",
16
16
  "Operating System :: OS Independent",
17
17
  ]
18
- dependencies = ["requests"] # 依赖库(如 ["requests>=2.25"])
18
+ dependencies = [
19
+ "configparser"
20
+ ] # 依赖库(如 ["requests>=2.25"])
19
21
 
20
22
  # 关键配置:指定包路径和自动发现规则
21
23
  [tool.setuptools]
@@ -9,5 +9,6 @@ from shadowshell.logger import Logger
9
9
  from shadowshell.logger_factory import LoggerFactory
10
10
  from shadowshell.bootstrap import ShadowShell, hello, shadowshell, invoke_with_tmpl, TestTemplate, testserver, cnnserver
11
11
  from shadowshell.git_shell import GitShell
12
+ from shadowshell.configurator import Configurator
12
13
 
13
- __all__ = ['ShadowShell', 'hello', 'shadowshell', 'invoke_with_tmpl', 'TestTemplate', 'Logger', 'LoggerFactory', 'GitShell', 'testserver', 'cnnserver']
14
+ __all__ = ['ShadowShell', 'hello', 'shadowshell', 'Configurator', 'invoke_with_tmpl', 'TestTemplate', 'Logger', 'LoggerFactory', 'GitShell', 'testserver', 'cnnserver']
@@ -14,6 +14,7 @@ ShadowShell
14
14
  class ShadowShell:
15
15
 
16
16
  def __init__(self):
17
+ self.logger = LoggerFactory().get_logger()
17
18
  pass
18
19
 
19
20
  def hello(self):
@@ -22,42 +23,52 @@ class ShadowShell:
22
23
  formatted_current_time = current_time.strftime("%Y-%m-%d %H:%M:%S")
23
24
  print("Now is " + formatted_current_time)
24
25
 
25
- def test(self):
26
- self.hello()
26
+ def test(self, func, **args):
27
+ try:
28
+ self.logger.debug('-->> Ready')
29
+ func(**args)
30
+ self. logger.debug('-->> Do something')
31
+ except Exception as e:
32
+ self.logger.error(e)
33
+ except:
34
+ self.logger.error(sys.exc_info()[0])
35
+ finally:
36
+ self.logger.debug('-->> Done')
37
+ return
27
38
 
28
39
  # def request(self):
29
40
  # print(requests.get("https://wwww.baidu.com"))
30
41
 
42
+ from shadowshell.logger_factory import LoggerFactory
43
+ import sys
31
44
 
32
45
  class TestTemplate:
33
46
 
34
47
  def __init__(self):
48
+ self.logger = LoggerFactory().get_logger()
35
49
  return
36
50
 
37
51
  def test(self):
38
52
 
39
53
  try:
40
- self.console('-->> Ready')
54
+ self.logger.debug('-->> Ready')
41
55
 
42
56
  self.test0()
43
57
 
44
- self.console('-->> Do something')
58
+ self.logger.debug('-->> Do something')
45
59
 
46
60
  except Exception as e:
47
- self.console(e)
61
+ self.logger.error(e)
48
62
  except:
49
- self.console(sys.exc_info()[0])
63
+ self.logger.error(sys.exc_info()[0])
50
64
  finally:
51
- self.console('-->> Done')
65
+ self.logger.debug('-->> Done')
52
66
  return
53
67
 
54
68
  def test0(self):
55
- self.console('Nothing')
69
+ self.logger.debug('Nothing')
56
70
  return
57
71
 
58
- def console(self, content):
59
- print('[CONSOLE] %s' % (content))
60
-
61
72
  logger = LoggerFactory().get_logger()
62
73
 
63
74
  def testserver():
@@ -74,15 +85,17 @@ def shadowshell(**args):
74
85
 
75
86
  def invoke_with_tmpl(func, **args):
76
87
  try:
77
- logger.info('-->> Ready')
88
+ logger.debug('-->> Ready')
89
+
78
90
  func(**args)
79
- logger.info('-->> Do something')
91
+
92
+ logger.debug('-->> Do something')
80
93
  except Exception as e:
81
94
  logger.error(e)
82
95
  except:
83
96
  logger.error(sys.exc_info()[0])
84
97
  finally:
85
- logger.info('-->> Done')
98
+ logger.debug('-->> Done')
86
99
  return
87
100
 
88
101
  if __name__ == "__main__":
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+
4
+ """
5
+ Configurator
6
+ @author: shadow walker
7
+ """
8
+
9
+ import configparser
10
+
11
+ from shadowshell import LoggerFactory
12
+
13
+ class Configurator:
14
+
15
+ config = None;
16
+
17
+ def __init__(self, config_file):
18
+
19
+ self.logger = LoggerFactory().get_logger()
20
+
21
+ # 加载配置文件
22
+ self.config = configparser.ConfigParser()
23
+ self.config.read(config_file)
24
+ self.logger.debug("load and read config file : %s." % (config_file))
25
+
26
+ def get(self, group, key):
27
+ value = self.config.get(group, key)
28
+ self.logger.debug("group -> %s, key -> %s, value -> %s" % (group, key, value))
29
+ return value
30
+
31
+
@@ -1,20 +1,18 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: shadowshell
3
- Version: 0.0.24
4
- Summary: shadowshell.xyz
5
- Author-email: shadowshell <shadowshell@foxmail.com>
3
+ Version: 0.0.29
4
+ Summary: www.shadowshell.xyz
5
+ Author-email: shadowshell <shadowshellxyz@foxmail.com>
6
6
  License: MIT
7
7
  Classifier: Programming Language :: Python :: 3
8
8
  Classifier: Operating System :: OS Independent
9
9
  Requires-Python: >=3.6
10
10
  Description-Content-Type: text/markdown
11
- Requires-Dist: requests
12
-
13
-
11
+ Requires-Dist: configparser
14
12
 
15
13
  # Install
16
14
 
17
- ``` BASH
15
+ ``` shell
18
16
 
19
17
  > pip3 install shadowshell --upgrade
20
18
 
@@ -2,6 +2,7 @@ README.md
2
2
  pyproject.toml
3
3
  src/shadowshell/__init__.py
4
4
  src/shadowshell/bootstrap.py
5
+ src/shadowshell/configurator.py
5
6
  src/shadowshell/console_logger.py
6
7
  src/shadowshell/git_shell.py
7
8
  src/shadowshell/logger.py
@@ -0,0 +1 @@
1
+ configparser
@@ -1 +0,0 @@
1
- requests
File without changes