kkpyutil 1.43.0__tar.gz → 1.44.0__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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kkpyutil
3
- Version: 1.43.0
3
+ Version: 1.44.0
4
4
  Summary: Building blocks for sysadmin and DevOps
5
5
  Home-page: https://github.com/kakyoism/kkpyutil/
6
6
  License: MIT
@@ -74,18 +74,6 @@ if PLATFORM == 'Windows':
74
74
 
75
75
  # region classes
76
76
 
77
- # class ClassicSingleton:
78
- # _instances = {}
79
- #
80
- # def __new__(cls, *args, **kwargs):
81
- # if cls not in cls._instances:
82
- # print(f"Creating new instance for {cls}")
83
- # cls._instances[cls] = super(ClassicSingleton, cls).__new__(cls, *args, **kwargs)
84
- # else:
85
- # print(f"Reusing instance for {cls}")
86
- # return cls._instances[cls]
87
-
88
-
89
77
  class ClassicSingleton:
90
78
  _instances = {}
91
79
 
@@ -148,6 +136,24 @@ class SingletonDecorator:
148
136
  return self.instance
149
137
 
150
138
 
139
+ class ExceptableThread(threading.Thread):
140
+ def __init__(self, *args, **kwargs):
141
+ super().__init__(*args, **kwargs)
142
+ self.exception = None
143
+
144
+ def run(self):
145
+ try:
146
+ if self._target:
147
+ self._target(*self._args, **self._kwargs)
148
+ except Exception as e:
149
+ self.exception = e
150
+
151
+ def join(self, *args, **kwargs):
152
+ super().join(*args, **kwargs)
153
+ if self.exception:
154
+ raise self.exception
155
+
156
+
151
157
  class LowPassLogFilter(object):
152
158
  """
153
159
  Logging filter: Show log messages below input level.
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "kkpyutil"
3
- version = "1.43.0"
3
+ version = "1.44.0"
4
4
  description = "Building blocks for sysadmin and DevOps"
5
5
  authors = ["Beinan Li <li.beinan@gmail.com>"]
6
6
  maintainers = ["Beinan Li <li.beinan@gmail.com>"]
File without changes
File without changes