functionalthreading 0.3.0__tar.gz → 0.4.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.4
2
2
  Name: functionalthreading
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: Functional programming with thread-based parallelism
5
5
  Author-email: Richard Tong <richytong@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/richytong/functionalthreading
@@ -1,6 +1,7 @@
1
1
  from functools import partial, Placeholder as _
2
2
  from functionalthreading.functions import chain, tap, tmap
3
+ from functionalthreading.classes import Thread
3
4
 
4
5
  __name__ = 'functionalthreading'
5
6
 
6
- __all__ = ['partial', '_' ,'chain', 'tap', 'tmap']
7
+ __all__ = ['Thread', 'partial', '_' ,'chain', 'tap', 'tmap']
@@ -0,0 +1,15 @@
1
+ from threading import Thread as _Thread
2
+
3
+ class Thread(_Thread):
4
+ def __init__(self, *args, **kwargs):
5
+ _Thread.__init__(self, *args, **kwargs)
6
+ self.value = None
7
+ self.target = kwargs['target']
8
+ self.args = kwargs['args']
9
+
10
+ def run(self):
11
+ self.value = self.target(*self.args)
12
+
13
+ __name__ = 'classes'
14
+
15
+ __all__ = ['Thread']
@@ -1,5 +1,5 @@
1
1
  from functools import partial, Placeholder as _
2
- from threading import Thread
2
+ from functionalthreading.classes import Thread
3
3
 
4
4
  def _chain(argument, funcs):
5
5
  ret = argument
@@ -61,23 +61,13 @@ def tap(func):
61
61
  return argument
62
62
  return inner_func
63
63
 
64
- class _Thread(Thread):
65
- def __init__(self, *args, **kwargs):
66
- Thread.__init__(self, *args, **kwargs)
67
- self.value = None
68
- self.target = kwargs['target']
69
- self.args = kwargs['args']
70
-
71
- def run(self):
72
- self.value = self.target(*self.args)
73
-
74
64
  def _tmap(array_or_tuple, func):
75
65
  length = len(array_or_tuple)
76
66
  threads = []
77
67
  index = 0
78
68
  args = [array_or_tuple]
79
69
  while index < length:
80
- t = _Thread(target=func, args=[array_or_tuple[index]])
70
+ t = Thread(target=func, args=[array_or_tuple[index]])
81
71
  t.start()
82
72
  threads.append(t)
83
73
  index += 1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: functionalthreading
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: Functional programming with thread-based parallelism
5
5
  Author-email: Richard Tong <richytong@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/richytong/functionalthreading
@@ -7,4 +7,5 @@ functionalthreading.egg-info/PKG-INFO
7
7
  functionalthreading.egg-info/SOURCES.txt
8
8
  functionalthreading.egg-info/dependency_links.txt
9
9
  functionalthreading.egg-info/top_level.txt
10
+ functionalthreading/classes/__init__.py
10
11
  functionalthreading/functions/__init__.py
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "functionalthreading"
3
- version = "0.3.0"
3
+ version = "0.4.0"
4
4
  authors = [
5
5
  { name="Richard Tong", email="richytong@gmail.com" },
6
6
  ]
@@ -8,5 +8,9 @@ with open('pyproject.toml', 'rb') as file:
8
8
  name='functionalthreading',
9
9
  version=pyproject['project']['version'],
10
10
  description='Functional programming with thread-based parallelism',
11
- packages=['functionalthreading', 'functionalthreading.functions'],
11
+ packages=[
12
+ 'functionalthreading',
13
+ 'functionalthreading.classes',
14
+ 'functionalthreading.functions',
15
+ ],
12
16
  )