Skip to content

Commit 589e0a4

Browse files
authored
Add files via upload
1 parent 6a6897c commit 589e0a4

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
4646

4747
IN NO EVENT WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY, BE LIABLE TO YOU FOR ANY DAMAGES, EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
4848

49-
Again, see the included LICENSE file for specific legal details.
49+
Again, see the included LICENSE file for specific legal details.

fsSignal/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.0.2"
1+
__version__ = "0.0.3"
22
__doc__ = """
33
Signal capturer v{}
44
Copyright (C) 2021 Fusion Solutions KFT <contact@fusionsolutions.io>

fsSignal/fsSignal.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,26 @@ def __next__(self) -> Any:
2828
class BaseSignal:
2929
_force:bool
3030
@classmethod
31-
def get(self) -> bool:
31+
def check(self) -> bool:
3232
if not isinstance(Signal._handler, Signal):
3333
return False
34-
return Signal._handler._get(self._force)
34+
return Signal._handler._check(self._force)
35+
@classmethod
36+
def checkSoft(self) -> bool:
37+
if not isinstance(Signal._handler, Signal):
38+
return False
39+
return Signal._handler._check(False)
40+
@classmethod
41+
def checkHard(self) -> bool:
42+
if not isinstance(Signal._handler, Signal):
43+
return False
44+
return Signal._handler._check(True)
3545
@classmethod
3646
def sleep(self, seconds:Union[int, float], raiseOnKill:bool=False) -> None:
3747
if not isinstance(Signal._handler, Signal):
3848
return sleep(seconds)
3949
return Signal._handler._sleep(seconds, raiseOnKill, self._force)
4050
@classmethod
41-
def check(self) -> None:
42-
if self.get():
43-
raise KillSignal
44-
@classmethod
4551
def signalSoftKill(self, *args, **kwargs) -> None:
4652
if isinstance(Signal._handler, Signal):
4753
return Signal._handler._signalSoftKill(*args, **kwargs)
@@ -72,6 +78,9 @@ def getSoftSignal(self) -> Any:
7278
@classmethod
7379
def getHardSignal(self) -> Any:
7480
return HardSignal
81+
@classmethod
82+
def isActivated(self) -> bool:
83+
return isinstance(Signal._handler, Signal)
7584

7685
class SoftSignal(BaseSignal):
7786
_force:bool = False
@@ -114,7 +123,7 @@ def __setstate__(self, states:Dict[str, Any]) -> None:
114123
def _activate(self) -> None:
115124
_signal.signal(_signal.SIGINT, Signal.signalSoftKill)
116125
_signal.signal(_signal.SIGTERM, Signal.signalHardKill)
117-
def _get(self, force:bool=True) -> bool:
126+
def _check(self, force:bool=True) -> bool:
118127
if force:
119128
return self.eHard.is_set()
120129
return self.eSoft.is_set()

0 commit comments

Comments
 (0)