python-misc-utils 0.2__py3-none-any.whl → 0.22__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.
py_misc_utils/np_utils.py CHANGED
@@ -115,16 +115,6 @@ def is_numpy(v):
115
115
  return type(v).__module__ == np.__name__
116
116
 
117
117
 
118
- def is_sorted(data, descending=False):
119
- if not isinstance(data, np.ndarray):
120
- data = np.array(data)
121
-
122
- if descending:
123
- return np.all(data[:-1] >= data[1:])
124
-
125
- return np.all(data[:-1] <= data[1:])
126
-
127
-
128
118
  def astype(data, col, dtype):
129
119
  if cu.isdict(dtype):
130
120
  cdtype = dtype.get(col)
@@ -180,6 +170,10 @@ def normalize(data, axis=None):
180
170
  return (data - mean) / std
181
171
 
182
172
 
173
+ def hasher(value):
174
+ return hash((value.dtype, tuple(value.shape), value.tobytes()))
175
+
176
+
183
177
  def moving_average(data, window, include_current=True):
184
178
  weights = np.ones(window, dtype=data.dtype) / window
185
179
  pdata = np.pad(data, (window, window), mode='edge')
@@ -41,6 +41,12 @@ def sign_extend(value, nbits):
41
41
  return (value & (sign - 1)) - (value & sign)
42
42
 
43
43
 
44
+ def ffs(n):
45
+ nnorm = n & (-n)
46
+
47
+ return nnorm.bit_length() - 1
48
+
49
+
44
50
  def round_up(v, step):
45
51
  return ((v + step - 1) // step) * step
46
52
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python_misc_utils
3
- Version: 0.2
3
+ Version: 0.22
4
4
  Summary: A collection of Python utility APIs
5
5
  Author: Davide Libenzi
6
6
  License-Expression: Apache-2.0
@@ -34,3 +34,17 @@ Dynamic: summary
34
34
  I keep writing the same stuff in different projects, so I finally decided
35
35
  to throw stuff into a common boilerplate and stop the cut&paste jobs.
36
36
 
37
+ ## Install
38
+
39
+ The library can be installed using *PyPi*:
40
+
41
+ ```Shell
42
+ $ pip install python-misc-utils
43
+ ```
44
+
45
+ Or directly from the *Github* repository:
46
+
47
+ ```Shell
48
+ $ pip install git+https://github.com/davidel/py_misc_utils.git
49
+ ```
50
+
@@ -59,9 +59,9 @@ py_misc_utils/named_array.py,sha256=U_QnvediPoW4DIurAYc1Z5EDPcZEjKU3ABnjUM2S3Hc,
59
59
  py_misc_utils/no_break.py,sha256=Yh6k469xV7eEjDTmaEqoY6o1IZUX8zVk2BNUfly2QUU,960
60
60
  py_misc_utils/no_except.py,sha256=DjY88OtR6Y6lVlSY8SDhM1QkiK0dnZkYDTMk8WRTwMg,755
61
61
  py_misc_utils/np_ml_framework.py,sha256=WZfNP5cEBQqbm4yaXIKatsshR4UmR-cOMTAW4ADbFdw,4433
62
- py_misc_utils/np_utils.py,sha256=P8YEHu71jKrTGKOVT3R1yqnkw3EEe4vT4J2JsUcszx8,7799
62
+ py_misc_utils/np_utils.py,sha256=lHzSEgYag8jx0SmX_fSGmQY3RCzbqf0oHTJ3EYWK9SU,7681
63
63
  py_misc_utils/ntuple_utils.py,sha256=a_kdVknrsdtK9PYSkgNcecMsdWcW9SF0T7NtQZr8bNc,1227
64
- py_misc_utils/num_utils.py,sha256=bOkWZOFwdLwmv8yf5NNpokrFqOKuA1bDF9sMeCvqZdE,798
64
+ py_misc_utils/num_utils.py,sha256=cGAFme_IXTAnP0NwdOrrAYQDCnss3XwqtZS1hFxN-Tw,864
65
65
  py_misc_utils/obj.py,sha256=udKD7gPDT-SosCuuQA5l5CCJsuYlrF60-TN1VRVlCg4,1430
66
66
  py_misc_utils/object_cache.py,sha256=P5ZUg2QomouLEyfAx2mbhYcMi92CqQemVpMaFqSvpwY,2373
67
67
  py_misc_utils/object_tracker.py,sha256=RLG6ob5FBHpXGB2PLW7IpfB4ZWehA7uX1YAjaRoD184,2208
@@ -110,8 +110,8 @@ py_misc_utils/fs/ftp_fs.py,sha256=qOLYQEg_6pqKC5YzICgEdOH9maomJtMv8c3exEY8BLE,63
110
110
  py_misc_utils/fs/gcs_fs.py,sha256=4dfWa_4nqy9Q-HqEnuhMgkmk8z1NLiymY1WkP-90WCo,5100
111
111
  py_misc_utils/fs/http_fs.py,sha256=6mQifdI50OQFd2d8yIfU0J3YYXC4yUVk-Wcz7uA0vvk,7040
112
112
  py_misc_utils/fs/s3_fs.py,sha256=RAhUQf1tjLyTeeu1NqsLHn_HXPouCqbOd3-tYsjkec4,11492
113
- python_misc_utils-0.2.dist-info/licenses/LICENSE,sha256=djKp2doA3Fnx8LziguL9FWzCoGczXLbj_87qtbywYQI,555
114
- python_misc_utils-0.2.dist-info/METADATA,sha256=qUdmyDV8u3oCTxJTDFvfZRX6qJr0V_aOTZ7wge3xdw0,1160
115
- python_misc_utils-0.2.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
116
- python_misc_utils-0.2.dist-info/top_level.txt,sha256=Hqg8W5M7VvZLd-TlUDZLkZyaKat_Tf6OSx8IKAQC7t0,14
117
- python_misc_utils-0.2.dist-info/RECORD,,
113
+ python_misc_utils-0.22.dist-info/licenses/LICENSE,sha256=djKp2doA3Fnx8LziguL9FWzCoGczXLbj_87qtbywYQI,555
114
+ python_misc_utils-0.22.dist-info/METADATA,sha256=nw5iH71eXG79oN6WgTcNcNenhD2-K3vaOVlQ1Kl8pdk,1383
115
+ python_misc_utils-0.22.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
116
+ python_misc_utils-0.22.dist-info/top_level.txt,sha256=Hqg8W5M7VvZLd-TlUDZLkZyaKat_Tf6OSx8IKAQC7t0,14
117
+ python_misc_utils-0.22.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (82.0.0)
2
+ Generator: setuptools (82.0.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5