k3thread 0.1.7__tar.gz → 0.1.8__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,22 +1,21 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: k3thread
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: Thread utilities for daemon threads and exception sending
5
5
  Author-email: Zhang Yanpo <drdr.xp@gmail.com>
6
- License: MIT
6
+ License-Expression: MIT
7
7
  Project-URL: Homepage, https://github.com/pykit3/k3thread
8
8
  Project-URL: Documentation, https://k3thread.readthedocs.io
9
9
  Keywords: thread,daemon,concurrent,exception
10
10
  Classifier: Development Status :: 4 - Beta
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: Topic :: Software Development :: Libraries
13
- Classifier: License :: OSI Approved :: MIT License
14
13
  Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.9
16
14
  Classifier: Programming Language :: Python :: 3.10
17
15
  Classifier: Programming Language :: Python :: 3.11
18
16
  Classifier: Programming Language :: Python :: 3.12
19
- Requires-Python: >=3.9
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Requires-Python: >=3.10
20
19
  Description-Content-Type: text/markdown
21
20
  License-File: LICENSE
22
21
  Provides-Extra: dev
@@ -22,11 +22,7 @@ from importlib.metadata import version
22
22
 
23
23
  __version__ = version("k3thread")
24
24
 
25
- from .thd import InvalidThreadIdError
26
- from .thd import SendRaiseError
27
- from .thd import daemon
28
- from .thd import send_exception
29
- from .thd import start
25
+ from .thd import InvalidThreadIdError, SendRaiseError, daemon, send_exception, start
30
26
 
31
27
  __all__ = [
32
28
  "InvalidThreadIdError",
@@ -1,22 +1,21 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: k3thread
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: Thread utilities for daemon threads and exception sending
5
5
  Author-email: Zhang Yanpo <drdr.xp@gmail.com>
6
- License: MIT
6
+ License-Expression: MIT
7
7
  Project-URL: Homepage, https://github.com/pykit3/k3thread
8
8
  Project-URL: Documentation, https://k3thread.readthedocs.io
9
9
  Keywords: thread,daemon,concurrent,exception
10
10
  Classifier: Development Status :: 4 - Beta
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: Topic :: Software Development :: Libraries
13
- Classifier: License :: OSI Approved :: MIT License
14
13
  Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.9
16
14
  Classifier: Programming Language :: Python :: 3.10
17
15
  Classifier: Programming Language :: Python :: 3.11
18
16
  Classifier: Programming Language :: Python :: 3.12
19
- Requires-Python: >=3.9
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Requires-Python: >=3.10
20
19
  Description-Content-Type: text/markdown
21
20
  License-File: LICENSE
22
21
  Provides-Extra: dev
@@ -1,14 +1,14 @@
1
1
  [build-system]
2
- requires = ["setuptools>=61.0"]
2
+ requires = ["setuptools>=77.0"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "k3thread"
7
- version = "0.1.7"
7
+ version = "0.1.8"
8
8
  description = "Thread utilities for daemon threads and exception sending"
9
9
  readme = "README.md"
10
- license = {text = "MIT"}
11
- requires-python = ">=3.9"
10
+ license = "MIT"
11
+ requires-python = ">=3.10"
12
12
  authors = [
13
13
  { name = "Zhang Yanpo", email = "drdr.xp@gmail.com" }
14
14
  ]
@@ -17,12 +17,11 @@ classifiers = [
17
17
  "Development Status :: 4 - Beta",
18
18
  "Intended Audience :: Developers",
19
19
  "Topic :: Software Development :: Libraries",
20
- "License :: OSI Approved :: MIT License",
21
20
  "Programming Language :: Python :: 3",
22
- "Programming Language :: Python :: 3.9",
23
21
  "Programming Language :: Python :: 3.10",
24
22
  "Programming Language :: Python :: 3.11",
25
23
  "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
26
25
  ]
27
26
  dependencies = []
28
27
 
@@ -2,9 +2,10 @@ import sys
2
2
  import time
3
3
  import unittest
4
4
 
5
- import k3thread
6
5
  import k3ut
7
6
 
7
+ import k3thread
8
+
8
9
  dd = k3ut.dd
9
10
 
10
11
 
@@ -48,7 +49,7 @@ class TestThread(unittest.TestCase):
48
49
  with self.assertRaises(TypeError):
49
50
  k3thread.send_exception(t, SystemExit())
50
51
 
51
- class SomeClass(object):
52
+ class SomeClass:
52
53
  pass
53
54
 
54
55
  with self.assertRaises(ValueError):
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env python
2
- # coding: utf-8
3
2
 
4
3
  import ctypes
5
4
  import inspect
@@ -27,10 +26,10 @@ def start(target, name=None, args=None, kwargs=None, daemon=False, after=None):
27
26
  target(callable):
28
27
  The callable object to run.
29
28
 
30
- name:
29
+ name(str):
31
30
  The thread name. By default, a unique name is constructed of the form "Thread-N" where N is a small decimal number.
32
31
 
33
- args:
32
+ args(tuple):
34
33
  The argument tuple for the target invocation. Defaults to `()`.
35
34
 
36
35
  kwargs(dict):
@@ -43,14 +42,14 @@ def start(target, name=None, args=None, kwargs=None, daemon=False, after=None):
43
42
  A non-daemon thread keeps running after main thread quits.
44
43
  A process does not quit if there are any non-daemon threads running.
45
44
 
46
- after(bool):
45
+ after(float):
47
46
  If `after` is not `None`, it sleeps for `after` seconds before calling
48
47
  `target`.
49
48
 
50
49
  By default it is `None`.
51
50
 
52
51
  Returns:
53
- threading.Thread: the thread started.
52
+ (threading.Thread): the thread started.
54
53
 
55
54
  """
56
55
  args = args or ()
@@ -103,11 +102,10 @@ def send_exception(thread, exctype):
103
102
  interrupted and shut down when it is called.
104
103
 
105
104
  Args:
106
-
107
105
  thread(threading.Thread):
108
106
  the thread in which to raise the exception.
109
107
 
110
- exctype:
108
+ exctype(type):
111
109
  A exception class that will be raised in the thread.
112
110
 
113
111
  Raises:
@@ -117,7 +115,7 @@ def send_exception(thread, exctype):
117
115
  SendRaiseError: for other unexpected errors.
118
116
  """
119
117
  if not isinstance(thread, threading.Thread):
120
- raise TypeError("Only Thread is allowed, got {t}".format(t=thread))
118
+ raise TypeError(f"Only Thread is allowed, got {thread}")
121
119
 
122
120
  _async_raise(thread.ident, exctype)
123
121
 
@@ -128,7 +126,8 @@ def _async_raise(tid, exctype):
128
126
  raise TypeError("Only types can be raised (not instances)")
129
127
 
130
128
  if not issubclass(exctype, BaseException):
131
- raise ValueError("Only sub classes of BaseException can be raised")
129
+ # `send_exception()` documents ValueError for this case.
130
+ raise ValueError("Only sub classes of BaseException can be raised") # noqa: TRY004
132
131
 
133
132
  # PyThreadState_SetAsyncExc requires GIL to be held
134
133
  gil_state = ctypes.pythonapi.PyGILState_Ensure()
File without changes
File without changes
File without changes
File without changes