scalableDivisors 1.0.0__py3-none-any.whl

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.
File without changes
@@ -0,0 +1,46 @@
1
+ import multiprocessing
2
+ from mpire import WorkerPool
3
+ from pprint import pprint
4
+
5
+ def get_list_of_divisors(number):
6
+ n = int(pow(number,0.5))
7
+ rv = []
8
+ for i in range(1,n+1):
9
+ if number%i==0:
10
+ rv.append(i)
11
+ rv.append(number//i)
12
+ rv = sorted(list(set(rv)))
13
+ l = len(rv)
14
+ return {
15
+ "list_of_divisors":rv,
16
+ "number_of_divisors":l,
17
+ "number":number
18
+ }
19
+
20
+ def get_list_of_divisors_for_range(start,end):
21
+ results = []
22
+ for i in range(start,end):
23
+ my_dict = {"number":i}
24
+ results.append(my_dict)
25
+ num_cores = max(multiprocessing.cpu_count()//2,1)
26
+ with WorkerPool(n_jobs=num_cores,daemon=False) as pool:
27
+ results = pool.map(get_list_of_divisors,results,progress_bar=True)
28
+ return results
29
+
30
+ def get_list_of_divisors_upto_number(number):
31
+ chunk_size = int(pow(10,5))
32
+ results = []
33
+ for i in range(1,number+1,chunk_size):
34
+ my_dict = {
35
+ "start":i,
36
+ "end":min(i+chunk_size, number+1)
37
+ }
38
+ results.append(my_dict)
39
+ num_cores = max(multiprocessing.cpu_count()//2,1)
40
+ with WorkerPool(n_jobs=num_cores,daemon=False) as pool:
41
+ results = pool.map(get_list_of_divisors_for_range,results,progress_bar=True)
42
+ results2 = []
43
+ for result in results:
44
+ results2+=result
45
+ results = results2
46
+ return results
@@ -0,0 +1,37 @@
1
+ Metadata-Version: 2.4
2
+ Name: scalableDivisors
3
+ Version: 1.0.0
4
+ Summary: My Python package related to scaling metadata related to getting divisors using this package
5
+ Author-email: Prakhar Gandhi <gprakhar0@gmail.com>
6
+ License: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.9
11
+ Description-Content-Type: text/markdown
12
+ Requires-Dist: mpire
13
+
14
+ # scalableDivisors
15
+
16
+
17
+ My Python package related to scaling metadata related to getting divisors using this package
18
+
19
+ ```python
20
+ import scalableDivisors
21
+ from scalableDivisors import getDivisors
22
+ from pprint import pprint
23
+
24
+
25
+ if __name__ == "__main__":
26
+
27
+ number = pow(10,1)
28
+ results = getDivisors.get_list_of_divisors_upto_number(number)
29
+ pprint(results)
30
+
31
+ number = pow(10,6)
32
+ results = getDivisors.get_list_of_divisors_upto_number(number)
33
+ pprint(len(results))
34
+ pprint(results[-1])
35
+
36
+ ```
37
+
@@ -0,0 +1,6 @@
1
+ scalableDivisors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ scalableDivisors/getDivisors.py,sha256=nxuJggH-7PSb5Y2eplZTx0tXB305R-AFbWsacSi9ZQI,1414
3
+ scalabledivisors-1.0.0.dist-info/METADATA,sha256=zC5q8rdQLA34IFDddOjPC53hDT6Df97pB1kMi9-UkYU,1004
4
+ scalabledivisors-1.0.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
5
+ scalabledivisors-1.0.0.dist-info/top_level.txt,sha256=SJcuwSDGn-4Z4zJr6QX0ZM1H0m1C2wOMzDkE2W4LQz4,17
6
+ scalabledivisors-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ scalableDivisors