danielutils 0.9.70__tar.gz → 0.9.72__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.
Files changed (118) hide show
  1. {danielutils-0.9.70 → danielutils-0.9.72}/PKG-INFO +3 -2
  2. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/__init__.py +27 -14
  3. danielutils-0.9.72/danielutils/classes/frange.py +125 -0
  4. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/colors.py +1 -1
  5. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/data_structures/__init__.py +2 -1
  6. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/decorators/memo.py +2 -1
  7. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/decorators/timeout.py +9 -0
  8. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/functions/isoftype.py +5 -3
  9. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/reflection/__init__.py +1 -0
  10. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/reflection/class_reflection.py +1 -1
  11. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/reflection/function_reflections.py +1 -1
  12. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/reflection/get_traceback.py +1 -1
  13. danielutils-0.9.72/danielutils/reflection/system_reflections.py +34 -0
  14. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/threads/worker.py +1 -1
  15. danielutils-0.9.72/danielutils/university/__init__.py +2 -0
  16. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils.egg-info/PKG-INFO +3 -2
  17. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils.egg-info/SOURCES.txt +4 -3
  18. {danielutils-0.9.70 → danielutils-0.9.72}/pyproject.toml +4 -4
  19. danielutils-0.9.70/danielutils/classes/frange.py +0 -61
  20. danielutils-0.9.70/danielutils/io.py +0 -436
  21. danielutils-0.9.70/danielutils/reflection/system_reflections.py +0 -55
  22. danielutils-0.9.70/danielutils/university/__init__.py +0 -1
  23. /danielutils-0.9.70/LISENCE → /danielutils-0.9.72/LICENSE +0 -0
  24. {danielutils-0.9.70 → danielutils-0.9.72}/README.md +0 -0
  25. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/aliases.py +0 -0
  26. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/classes/Convenience.py +0 -0
  27. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/classes/Counter.py +0 -0
  28. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/classes/Tree.py +0 -0
  29. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/classes/__init__.py +0 -0
  30. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/classes/repl.py +0 -0
  31. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/classes/sorted_builtins/__init__.py +0 -0
  32. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/classes/sorted_builtins/sset.py +0 -0
  33. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/classes/typed_builtins/__init__.py +0 -0
  34. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/classes/typed_builtins/factory.py +0 -0
  35. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/classes/typed_builtins/tdict.py +0 -0
  36. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/classes/typed_builtins/tlist.py +0 -0
  37. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/classes/typed_builtins/tset.py +0 -0
  38. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/classes/typed_builtins/ttuple.py +0 -0
  39. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/conversions/__init__.py +0 -0
  40. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/conversions/main_conversions.py +0 -0
  41. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/conversions/specialized_conversions/__init__.py +0 -0
  42. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/conversions/specialized_conversions/to_hex.py +0 -0
  43. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/conversions/specialized_conversions/to_int.py +0 -0
  44. /danielutils-0.9.70/danielutils/print.py → /danielutils-0.9.72/danielutils/d_print.py +0 -0
  45. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/data_structures/Comparer.py +0 -0
  46. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/data_structures/Stack.py +0 -0
  47. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/data_structures/default_dict.py +0 -0
  48. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/data_structures/functions.py +0 -0
  49. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/date.py +0 -0
  50. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/date_time.py +0 -0
  51. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/decorators/__init__.py +0 -0
  52. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/decorators/atomic.py +0 -0
  53. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/decorators/attach.py +0 -0
  54. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/decorators/chain_decorators.py +0 -0
  55. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/decorators/decorate_conditionally.py +0 -0
  56. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/decorators/delay_call.py +0 -0
  57. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/decorators/deprecate.py +0 -0
  58. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/decorators/limit_recursion.py +0 -0
  59. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/decorators/overload.py +0 -0
  60. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/decorators/partially_implemented.py +0 -0
  61. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/decorators/processify.py +0 -0
  62. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/decorators/property.py +0 -0
  63. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/decorators/threadify.py +0 -0
  64. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/decorators/validate.py +0 -0
  65. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/exceptions.py +0 -0
  66. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/files_and_folders.py +0 -0
  67. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/functions/__init__.py +0 -0
  68. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/functions/areoneof.py +0 -0
  69. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/functions/check_foreach.py +0 -0
  70. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/functions/isoneof.py +0 -0
  71. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/functions/powerset.py +0 -0
  72. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/functions/types_subseteq.py +0 -0
  73. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/generators/__init__.py +0 -0
  74. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/generators/conditional_generator.py +0 -0
  75. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/generators/generator_from_stream.py +0 -0
  76. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/generators/join_generators.py +0 -0
  77. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/internet.py +0 -0
  78. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/loops.py +0 -0
  79. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/math/__init__.py +0 -0
  80. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/math/constants.py +0 -0
  81. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/math/functions.py +0 -0
  82. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/math/math_print.py +0 -0
  83. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/math/math_symbols.py +0 -0
  84. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/metaclasses/Interface.py +0 -0
  85. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/metaclasses/__init__.py +0 -0
  86. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/metaclasses/atomic_class_meta.py +0 -0
  87. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/metaclasses/implicit_data_deleter_meta.py +0 -0
  88. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/metaclasses/instance_cache_meta.py +0 -0
  89. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/metaclasses/overload_meta.py +0 -0
  90. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/multi_x.py +0 -0
  91. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/my_tqdm.py +0 -0
  92. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/path.py +0 -0
  93. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/py.typed +0 -0
  94. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/reflection/file_reflection.py +0 -0
  95. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/reflection/get_prev_frame.py +0 -0
  96. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/reflection/module_reflections.py +0 -0
  97. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/relations.py +0 -0
  98. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/signals.py +0 -0
  99. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/snippets/__init__.py +0 -0
  100. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/snippets/try_get.py +0 -0
  101. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/system/__init__.py +0 -0
  102. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/system/independent.py +0 -0
  103. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/system/windows/__init__.py +0 -0
  104. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/system/windows/utils/__init__.py +0 -0
  105. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/system/windows/utils/filetime.py +0 -0
  106. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/system/windows/win32_ctime.py +0 -0
  107. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/system/windows/windows.py +0 -0
  108. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/text.py +0 -0
  109. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/threads/__init__.py +0 -0
  110. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/threads/worker_pool.py +0 -0
  111. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/time.py +0 -0
  112. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/university/databases/__init__.py +0 -0
  113. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils/university/databases/all.py +0 -0
  114. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils.egg-info/dependency_links.txt +0 -0
  115. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils.egg-info/requires.txt +0 -0
  116. {danielutils-0.9.70 → danielutils-0.9.72}/danielutils.egg-info/top_level.txt +0 -0
  117. {danielutils-0.9.70 → danielutils-0.9.72}/setup.cfg +0 -0
  118. {danielutils-0.9.70 → danielutils-0.9.72}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: danielutils
3
- Version: 0.9.70
3
+ Version: 0.9.72
4
4
  Summary: A python utils library for things I find useful
5
5
  Author-email: danielnachumdev <danielnachumdev@gmail.com>
6
6
  License: MIT License
@@ -31,8 +31,9 @@ Classifier: Development Status :: 3 - Alpha
31
31
  Classifier: Intended Audience :: Developers
32
32
  Classifier: Programming Language :: Python :: 3
33
33
  Classifier: Operating System :: Microsoft :: Windows
34
- Requires-Python: >=3.8.17
34
+ Requires-Python: >=3.8.0
35
35
  Description-Content-Type: text/markdown
36
+ License-File: LICENSE
36
37
  Requires-Dist: tqdm
37
38
 
38
39
 
@@ -1,32 +1,45 @@
1
1
  """danielutils is a convenience library of functions decorators
2
2
  data-structures and more that make my development workflow faster
3
3
  """
4
- from .functions import *
4
+ # =================================================================
5
+ # ============================= LEAFS =============================
6
+ # =================================================================
7
+ from .path import *
8
+ from .date_time import *
9
+ from .multi_x import *
10
+ from .loops import *
11
+ from .signals import *
12
+ from .aliases import *
13
+ from .exceptions import PrintCatchOne
14
+ from .snippets import *
15
+
16
+ # =================================================================
17
+ # ========================= ORDER MATTERS =========================
18
+ # =================================================================
19
+
20
+ from .reflection import *
5
21
  from .decorators import *
22
+
23
+ # ========== NEEDS REFLECTION ==========
24
+ from .threads import *
25
+ from .my_tqdm import *
26
+ # ========== NEEDS DECORATORS ==========
27
+ from .colors import *
28
+ # ========== NEEDS BOTH ==========
29
+
30
+ from .functions import *
6
31
  from .files_and_folders import *
7
32
  from .system import *
8
33
  from .text import *
9
34
  from .conversions import *
10
35
  from .classes import *
11
36
  from .time import *
12
- from .colors import *
13
37
  from .date import *
14
38
  from .data_structures import *
15
39
  from .math import *
16
- from .path import *
17
40
  from .system import *
18
- from .print import *
19
- from .exceptions import PrintCatchOne
20
- from .reflection import *
41
+ from .d_print import *
21
42
  from .metaclasses import *
22
- from .date_time import *
23
43
  from .generators import *
24
- from .snippets import *
25
- from .aliases import *
26
- from .signals import *
27
44
  from .university import *
28
- from .my_tqdm import *
29
- from .threads import *
30
- from .loops import *
31
- from .multi_x import *
32
45
  from .package_utils import *
@@ -0,0 +1,125 @@
1
+ from typing import Iterable, Callable, Optional, Iterator
2
+
3
+
4
+ class frange(Iterable[float]):
5
+ """this class is the same like builtin range but with float values
6
+ """
7
+
8
+ def __init__(self, start: float, stop: Optional[float] = None,
9
+ step: float = 1, round_method: Callable[[float], float] = lambda f: round(f, 3)):
10
+ if stop is None:
11
+ stop = start
12
+ start = 0
13
+ self.start = start
14
+ self.stop = stop
15
+ self.step = step
16
+ self.method = round_method
17
+
18
+ def __eq__(self, other):
19
+ if not isinstance(other, frange):
20
+ raise NotImplementedError
21
+ return self.start == other.start and self.stop == other.stop and self.step == other.step
22
+
23
+ def __iter__(self) -> Iterable:
24
+ if self.stop < self.start:
25
+ return
26
+ if self.start > self.stop:
27
+ return
28
+ if abs(self.stop - self.start) < abs(self.step):
29
+ return
30
+ if self.stop > 0 and self.step < 0:
31
+ return
32
+ if self.stop < 0 and self.step > 0:
33
+ return
34
+
35
+ cur = self.start
36
+ while cur < self.stop:
37
+ yield self.method(cur)
38
+ cur += self.step
39
+
40
+ def __len__(self) -> int:
41
+ return int((self.stop - self.start) // self.step)
42
+
43
+ def __str__(self) -> str:
44
+ return repr(self)
45
+
46
+ def __repr__(self):
47
+ return f"{self.__class__.__name__}({self.start}, {self.stop}, {self.step})"
48
+
49
+ @property
50
+ def _is_whole_step(self) -> bool:
51
+ return self.step - int(self.step) == 0
52
+
53
+ def __contains__(self, item):
54
+ if item < self.start:
55
+ return False
56
+ if item >= self.stop:
57
+ return False
58
+
59
+ if self._is_whole_step:
60
+ if not item - int(item) == 0:
61
+ return False
62
+
63
+ return item / self.step - item // self.step == 0
64
+
65
+ def normalize(self) -> 'frange':
66
+ return frange(self.start / self.step, self.stop / self.step, 1)
67
+
68
+ def intersect(self, other: 'frange') -> 'frange':
69
+ a, b = self.normalize(), other.normalize()
70
+ start1, stop1 = a.start, a.stop
71
+ start2, stop2 = b.start, b.stop
72
+ remainder1, remainder2 = start1 - int(start1), start2 - int(start2)
73
+ if remainder1 == remainder2:
74
+ if stop1 == float("inf") or stop2 == float("inf"):
75
+ return frange(max(start1, start2), float("inf"))
76
+ return frange(max(start1, start2), min(stop1, stop2))
77
+ raise NotImplementedError("this part is not implemented yet")
78
+ if remainder1 != 0 and remainder2 / remainder1 - remainder2 // remainder1 == 0:
79
+ pass
80
+
81
+ pass
82
+
83
+
84
+ class frange_iterator(Iterator[float]):
85
+ def __init__(self, obj: frange):
86
+ self.r = obj
87
+
88
+ def __next__(self):
89
+ if self.r.stop < self.r.start:
90
+ return
91
+ if self.r.start > self.r.stop:
92
+ return
93
+ if abs(self.r.stop - self.r.start) < abs(self.r.step):
94
+ return
95
+ if self.r.stop > 0 and self.r.step < 0:
96
+ return
97
+ if self.r.stop < 0 and self.r.step > 0:
98
+ return
99
+
100
+ cur = self.r.start
101
+ while cur < self.r.stop:
102
+ yield self.r.method(cur)
103
+ cur += self.r.step
104
+
105
+ def __iter__(self):
106
+ return self
107
+
108
+
109
+ class brange(frange):
110
+ """like frange but with tqdm
111
+ """
112
+
113
+ def __iter__(self):
114
+ itr = super().__iter__()
115
+ try:
116
+ from my_tqdm import tqdm # type:ignore # pylint: disable=import-error
117
+ return iter(tqdm(itr, desc=f"{self}", total=len(self)))
118
+ except:
119
+ return itr
120
+
121
+
122
+ __all__ = [
123
+ "frange",
124
+ "brange"
125
+ ]
@@ -1,5 +1,5 @@
1
1
  from typing import Optional, IO
2
- from .decorators.validate import validate
2
+ from .decorators import validate
3
3
 
4
4
 
5
5
  RESET = "\033[0m"
@@ -3,4 +3,5 @@ from .heap import *
3
3
  from .comparer import *
4
4
  from .graph import *
5
5
  from .stack import *
6
- from .default_dict import *
6
+ from .default_dict import *
7
+ from .trees import *
@@ -9,6 +9,7 @@ if get_python_version() < (3, 9):
9
9
  else:
10
10
  from builtins import dict as t_dict
11
11
  from typing import ParamSpec # type:ignore # pylint: disable=ungrouped-imports
12
+ from copy import deepcopy
12
13
  T = TypeVar("T")
13
14
  P = ParamSpec("P")
14
15
  FuncT = Callable[P, T] # type:ignore
@@ -27,7 +28,7 @@ def memo(func: FuncT) -> FuncT:
27
28
  def wrapper(*args, **kwargs):
28
29
  if (args, *kwargs.items()) not in cache:
29
30
  cache[(args, *kwargs.items())] = func(*args, **kwargs)
30
- return cache[(args, *kwargs.items())]
31
+ return deepcopy(cache[(args, *kwargs.items())])
31
32
  return wrapper
32
33
 
33
34
 
@@ -4,6 +4,7 @@ import platform
4
4
  from typing import Callable, TypeVar, Union
5
5
  from .validate import validate
6
6
  from ..reflection import get_python_version
7
+
7
8
  if get_python_version() < (3, 9):
8
9
  from typing_extensions import ParamSpec
9
10
  else:
@@ -29,6 +30,7 @@ def timeout(duration: Union[int, float], silent: bool = False) -> Callable[[Func
29
30
  Returns:
30
31
  Callable: the result decorated function
31
32
  """
33
+
32
34
  # https://stackoverflow.com/a/21861599/6416556
33
35
  def timeout_deco(func: FuncT) -> FuncT:
34
36
  if not callable(func):
@@ -56,5 +58,12 @@ def timeout(duration: Union[int, float], silent: bool = False) -> Callable[[Func
56
58
  raise res[0]
57
59
  return None
58
60
  return res[0]
61
+
59
62
  return wrapper
63
+
60
64
  return timeout_deco
65
+
66
+
67
+ __all__ = [
68
+ "timeout"
69
+ ]
@@ -1,12 +1,13 @@
1
- from typing import get_args, get_origin, get_type_hints, Any, Union, TypeVar,\
1
+ from typing import get_args, get_origin, get_type_hints, Any, Union, TypeVar, \
2
2
  ForwardRef, Literal, Optional, Tuple as t_tuple
3
3
  from collections.abc import Callable, Generator, Iterable
4
4
  from ..reflection import get_python_version
5
+
5
6
  if get_python_version() < (3, 9):
6
7
  from typing_extensions import ParamSpec, Concatenate
7
8
  else:
8
9
 
9
- # pylint: disable=ungrouped-imports
10
+ # pylint: disable=ungrouped-imports
10
11
  from typing import ParamSpec, Concatenate # type:ignore
11
12
  from builtins import tuple as t_tuple # type:ignore
12
13
  # implicit_union_type = type(int | str)
@@ -168,6 +169,8 @@ def __handle_callable(params: tuple) -> bool:
168
169
  print("Using lambda function with isoftype is ambiguous.")
169
170
  return not strict
170
171
 
172
+ if t_args is None:
173
+ return True
171
174
  if len(t_args) == 0:
172
175
  return True
173
176
 
@@ -305,7 +308,6 @@ __all__ = [
305
308
  "isoftype"
306
309
  ]
307
310
 
308
-
309
311
  __all__ = [
310
312
  "isoftype"
311
313
  ]
@@ -5,6 +5,7 @@ from .get_traceback import *
5
5
  from .module_reflections import *
6
6
  from .class_reflection import *
7
7
  from .get_prev_frame import *
8
+ from .interpreter import *
8
9
  # def get_class(module_name: str, class_name: str) -> type:
9
10
  # """dynammically loads the module and returns the class from this file
10
11
 
@@ -1,5 +1,5 @@
1
1
  import inspect
2
- from ..reflection import get_python_version
2
+ from .interpreter import get_python_version
3
3
  if get_python_version() >= (3, 9):
4
4
  from builtins import list as t_list # type:ignore
5
5
  else:
@@ -2,7 +2,7 @@ import inspect
2
2
  from typing import cast, Optional, Callable, Any
3
3
  from types import FrameType
4
4
  from .get_prev_frame import get_prev_frame_from, get_n_prev_frame
5
- from ..reflection import get_python_version
5
+ from .interpreter import get_python_version
6
6
 
7
7
  if get_python_version() < (3, 9):
8
8
  from typing import List as t_list, Set as t_set # pylint: disable=ungrouped-imports
@@ -1,5 +1,5 @@
1
1
  import traceback
2
- from ..reflection import get_python_version
2
+ from .interpreter import get_python_version
3
3
  if get_python_version() < (3, 9):
4
4
  from typing import List as t_list
5
5
  else:
@@ -0,0 +1,34 @@
1
+ import sys
2
+ import platform
3
+ from enum import Enum
4
+
5
+
6
+ class OSType(Enum):
7
+ """enum result for possible results of get_os()
8
+ """
9
+ LINUX = "Linux"
10
+ WINDOWS = "Windows"
11
+ OSX = "OS X"
12
+ UNKNOWN = "Unknown"
13
+
14
+
15
+ def get_os() -> OSType:
16
+ """returns the type of operation system running this code
17
+
18
+ Returns:
19
+ OSType: enum result
20
+ """
21
+ p = sys.platform
22
+ if p in {"linux", "linux2"}:
23
+ return OSType.LINUX
24
+ if p == "darwin":
25
+ return OSType.OSX
26
+ if p == "win32":
27
+ return OSType.WINDOWS
28
+ return OSType.UNKNOWN
29
+
30
+
31
+ __all__ = [
32
+ "OSType",
33
+ "get_os",
34
+ ]
@@ -2,7 +2,7 @@ from threading import Thread
2
2
  from abc import ABC, abstractmethod
3
3
  from typing import Optional, Any
4
4
  from logging import error
5
- import danielutils
5
+ import danielutils # this is explicitly this way to prevent circular import
6
6
  from ..reflection import get_python_version
7
7
  if get_python_version() >= (3, 9):
8
8
  from builtins import tuple as t_tuple # type:ignore
@@ -0,0 +1,2 @@
1
+ from .databases import *
2
+ from .probability import *
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: danielutils
3
- Version: 0.9.70
3
+ Version: 0.9.72
4
4
  Summary: A python utils library for things I find useful
5
5
  Author-email: danielnachumdev <danielnachumdev@gmail.com>
6
6
  License: MIT License
@@ -31,8 +31,9 @@ Classifier: Development Status :: 3 - Alpha
31
31
  Classifier: Intended Audience :: Developers
32
32
  Classifier: Programming Language :: Python :: 3
33
33
  Classifier: Operating System :: Microsoft :: Windows
34
- Requires-Python: >=3.8.17
34
+ Requires-Python: >=3.8.0
35
35
  Description-Content-Type: text/markdown
36
+ License-File: LICENSE
36
37
  Requires-Dist: tqdm
37
38
 
38
39
 
@@ -1,21 +1,22 @@
1
- LISENCE
1
+ LICENSE
2
2
  README.md
3
3
  pyproject.toml
4
4
  setup.py
5
+ ./LICENSE
6
+ ./README.md
5
7
  danielutils/__init__.py
6
8
  danielutils/aliases.py
7
9
  danielutils/colors.py
10
+ danielutils/d_print.py
8
11
  danielutils/date.py
9
12
  danielutils/date_time.py
10
13
  danielutils/exceptions.py
11
14
  danielutils/files_and_folders.py
12
15
  danielutils/internet.py
13
- danielutils/io.py
14
16
  danielutils/loops.py
15
17
  danielutils/multi_x.py
16
18
  danielutils/my_tqdm.py
17
19
  danielutils/path.py
18
- danielutils/print.py
19
20
  danielutils/py.typed
20
21
  danielutils/relations.py
21
22
  danielutils/signals.py
@@ -4,16 +4,16 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "danielutils"
7
- version = "0.9.70"
7
+ version = "0.9.72"
8
8
  authors = [
9
9
  { name = "danielnachumdev", email = "danielnachumdev@gmail.com" },
10
10
  ]
11
11
  dependencies = ['tqdm']
12
12
  keywords = ['functions', 'decorators', 'methods', 'classes', 'metaclasses']
13
- license = { "file" = "LISENCE" }
13
+ license = { "file" = "./LICENSE" }
14
14
  description = "A python utils library for things I find useful"
15
- readme = "README.md"
16
- requires-python = ">=3.8.17"
15
+ readme = "./README.md"
16
+ requires-python = ">=3.8.0"
17
17
  classifiers = [
18
18
  "Development Status :: 3 - Alpha",
19
19
  "Intended Audience :: Developers",
@@ -1,61 +0,0 @@
1
- from typing import Iterable, Callable, Optional
2
-
3
-
4
- class frange:
5
- """this class is the same like builtin range but with float values
6
- """
7
-
8
- def __init__(self, start: float, stop: Optional[float] = None,
9
- step: float = 1, round_method: Callable[[float], float] = lambda f: round(f, 3)):
10
- if stop is None:
11
- stop = start
12
- start = 0
13
- self.start = start
14
- self.stop = stop
15
- self.step = step
16
- self.method = round_method
17
-
18
- def __iter__(self) -> Iterable:
19
- if self.stop < self.start:
20
- return
21
- if self.start > self.stop:
22
- return
23
- if abs(self.stop-self.start) < abs(self.step):
24
- return
25
- if self.stop > 0 and self.step < 0:
26
- return
27
- if self.stop < 0 and self.step > 0:
28
- return
29
-
30
- cur = self.start
31
- while cur < self.stop:
32
- yield self.method(cur)
33
- cur += self.step
34
-
35
- def __len__(self) -> int:
36
- return int((self.stop-self.start)//self.step)
37
-
38
- def __str__(self) -> str:
39
- return repr(self)
40
-
41
- def __repr__(self):
42
- return f"{self.__class__.__name__}({self.start}, {self.stop}, {self.step})"
43
-
44
-
45
- class brange(frange):
46
- """like frange but with tqdm
47
- """
48
-
49
- def __iter__(self):
50
- itr = super().__iter__()
51
- try:
52
- from my_tqdm import tqdm # type:ignore # pylint: disable=import-error
53
- return iter(tqdm(itr, desc=f"{self}", total=len(self)))
54
- except:
55
- return itr
56
-
57
-
58
- __all__ = [
59
- "frange",
60
- "brange"
61
- ]