imio.pyutils 1.1.1__py2.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.
- imio/pyutils/__init__.py +0 -0
- imio/pyutils/batching.py +41 -0
- imio/pyutils/bs.py +118 -0
- imio/pyutils/postgres.py +173 -0
- imio/pyutils/system.py +503 -0
- imio/pyutils/tests.py +258 -0
- imio/pyutils/utils.py +361 -0
- imio.pyutils-1.1.1-py3.11-nspkg.pth +1 -0
- imio.pyutils-1.1.1.dist-info/METADATA +376 -0
- imio.pyutils-1.1.1.dist-info/RECORD +13 -0
- imio.pyutils-1.1.1.dist-info/WHEEL +6 -0
- imio.pyutils-1.1.1.dist-info/namespace_packages.txt +1 -0
- imio.pyutils-1.1.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: imio.pyutils
|
|
3
|
+
Version: 1.1.1
|
|
4
|
+
Summary: Some python useful methods
|
|
5
|
+
Home-page: https://github.com/imio/imio.pyutils/
|
|
6
|
+
Author: IMIO
|
|
7
|
+
Author-email: support@imio.be
|
|
8
|
+
License: GPL
|
|
9
|
+
Project-URL: PyPI, https://pypi.python.org/pypi/imio.pyutils
|
|
10
|
+
Project-URL: Source, https://github.com/imio/imio.pyutils
|
|
11
|
+
Keywords: Python IMIO
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: License :: OSI Approved :: GNU General Public License (GPL)
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Programming Language :: Python :: 2.7
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Requires-Dist: setuptools
|
|
19
|
+
Requires-Dist: future
|
|
20
|
+
Requires-Dist: requests
|
|
21
|
+
Requires-Dist: six >=1.16.0
|
|
22
|
+
|
|
23
|
+
.. image:: https://github.com/IMIO/imio.pyutils/actions/workflows/main.yml/badge.svg?branch=master
|
|
24
|
+
:target: https://github.com/IMIO/imio.pyutils/actions/workflows/main.yml
|
|
25
|
+
|
|
26
|
+
.. image:: https://coveralls.io/repos/github/IMIO/imio.pyutils/badge.svg
|
|
27
|
+
:target: https://coveralls.io/github/IMIO/imio.pyutils
|
|
28
|
+
|
|
29
|
+
.. image:: http://img.shields.io/pypi/v/imio.pyutils.svg
|
|
30
|
+
:alt: PyPI badge
|
|
31
|
+
:target: https://pypi.org/project/imio.pyutils
|
|
32
|
+
|
|
33
|
+
.. contents::
|
|
34
|
+
|
|
35
|
+
Introduction
|
|
36
|
+
============
|
|
37
|
+
|
|
38
|
+
This package provides python useful methods.
|
|
39
|
+
|
|
40
|
+
It relates to following kinds of operations:
|
|
41
|
+
|
|
42
|
+
1) System level operations (system.py)
|
|
43
|
+
|
|
44
|
+
It provides helper methods to:
|
|
45
|
+
|
|
46
|
+
* read and write files,
|
|
47
|
+
* read directories,
|
|
48
|
+
* execute commands,
|
|
49
|
+
* store and load list and dict,
|
|
50
|
+
* trace printing,
|
|
51
|
+
* creating temporary files,
|
|
52
|
+
* etc.
|
|
53
|
+
|
|
54
|
+
2) Various python helpers (utils.py)
|
|
55
|
+
|
|
56
|
+
About:
|
|
57
|
+
|
|
58
|
+
* ordereddict and dict manipulations
|
|
59
|
+
* list manipulations
|
|
60
|
+
* duration recording
|
|
61
|
+
|
|
62
|
+
3) BeautifulSoup methods (bs.py)
|
|
63
|
+
|
|
64
|
+
* remove elements
|
|
65
|
+
* remove attributes
|
|
66
|
+
* remove comments
|
|
67
|
+
* replace entire strings
|
|
68
|
+
* unwrap tags
|
|
69
|
+
|
|
70
|
+
4) Postgres level operations (postgres.py). It requires psycopg2 egg !
|
|
71
|
+
|
|
72
|
+
It provides helper methods to:
|
|
73
|
+
|
|
74
|
+
* single or multiple select,
|
|
75
|
+
* insert, update, delete rows,
|
|
76
|
+
* etc.
|
|
77
|
+
|
|
78
|
+
Tests
|
|
79
|
+
=====
|
|
80
|
+
|
|
81
|
+
Can be run with: `bin/python -m unittest discover`
|
|
82
|
+
|
|
83
|
+
Changelog
|
|
84
|
+
=========
|
|
85
|
+
|
|
86
|
+
1.1.1 (2024-09-18)
|
|
87
|
+
------------------
|
|
88
|
+
|
|
89
|
+
- Generated universal wheel version.
|
|
90
|
+
[sgeulette]
|
|
91
|
+
|
|
92
|
+
1.1.0 (2024-09-17)
|
|
93
|
+
------------------
|
|
94
|
+
|
|
95
|
+
- Added `utils.add_key_if_value` to add a key in a dic only if value or is not None.
|
|
96
|
+
[sgeulette]
|
|
97
|
+
- Moved `batching.batch_delete_files` from imio.helpers to be used commonly.
|
|
98
|
+
[sgeulette]
|
|
99
|
+
|
|
100
|
+
1.0.4 (2024-06-11)
|
|
101
|
+
------------------
|
|
102
|
+
|
|
103
|
+
- Blacked files.
|
|
104
|
+
[sgeulette]
|
|
105
|
+
- Added `system.post_request` to send a POST request.
|
|
106
|
+
[sgeulette]
|
|
107
|
+
|
|
108
|
+
1.0.3 (2024-05-24)
|
|
109
|
+
------------------
|
|
110
|
+
|
|
111
|
+
- Fix bad release for python2.
|
|
112
|
+
[aduchene]
|
|
113
|
+
|
|
114
|
+
1.0.2 (2024-05-15)
|
|
115
|
+
------------------
|
|
116
|
+
|
|
117
|
+
- Added a new helper `utils.get_ordinal_clusters` to cluster ordinal numbers based on an offset.
|
|
118
|
+
[aduchene]
|
|
119
|
+
|
|
120
|
+
1.0.1 (2024-04-08)
|
|
121
|
+
------------------
|
|
122
|
+
|
|
123
|
+
- Added patterns parameter in `system.read_dir_filter`.
|
|
124
|
+
[sgeulette]
|
|
125
|
+
- Returned original filename in `system.hashed_filename` if string to hash is empty.
|
|
126
|
+
[sgeulette]
|
|
127
|
+
|
|
128
|
+
1.0.0 (2024-03-05)
|
|
129
|
+
------------------
|
|
130
|
+
|
|
131
|
+
- Require `six>=1.16.0`.
|
|
132
|
+
[sgeulette]
|
|
133
|
+
- Added `system.hashed_filename` to get a new filename differentiated by a hashed string.
|
|
134
|
+
[sgeulette]
|
|
135
|
+
|
|
136
|
+
1.0.0a1 (2024-02-08)
|
|
137
|
+
--------------------
|
|
138
|
+
|
|
139
|
+
- Handled set in `load_var`.
|
|
140
|
+
[sgeulette]
|
|
141
|
+
- Added `load_pickle` and `dump_pickle`
|
|
142
|
+
[sgeulette]
|
|
143
|
+
- Improved `bs.is_empty`
|
|
144
|
+
[sgeulette]
|
|
145
|
+
|
|
146
|
+
1.0.0a (2023-11-28)
|
|
147
|
+
-------------------
|
|
148
|
+
|
|
149
|
+
- Made py2 and py3 compliant
|
|
150
|
+
[sgeulette]
|
|
151
|
+
- Improved `utils_safe_encode`
|
|
152
|
+
[sgeulette]
|
|
153
|
+
- Added `bs.is_empty` function.
|
|
154
|
+
[sgeulette]
|
|
155
|
+
- Added `bs.remove_some_childrens` function.
|
|
156
|
+
[sgeulette]
|
|
157
|
+
- Added `bs.replace_strings_by_pattern` function
|
|
158
|
+
[sgeulette]
|
|
159
|
+
- Added `exclude_patterns` parameter in `system.read_recursive_dir`
|
|
160
|
+
[sgeulette]
|
|
161
|
+
|
|
162
|
+
0.31 (2023-09-26)
|
|
163
|
+
-----------------
|
|
164
|
+
|
|
165
|
+
- Added `utils.listify` that will make sure a given value
|
|
166
|
+
is always returned as list-like iterable.
|
|
167
|
+
[gbastien]
|
|
168
|
+
- Improved `system.get_git_tag` with new parameter to get last tag from all branches
|
|
169
|
+
[sgeulette]
|
|
170
|
+
- Added `utils.radix_like_starting_1` to get list of positional numbers following a given base but starting with 1
|
|
171
|
+
[sgeulette]
|
|
172
|
+
- Added `utils.letters_sequence` to get a letters string corresponding to nth position
|
|
173
|
+
[sgeulette]
|
|
174
|
+
|
|
175
|
+
0.30 (2023-07-24)
|
|
176
|
+
-----------------
|
|
177
|
+
|
|
178
|
+
- Added `system.read_recursive_dir` to get files recursively (with relative or full name).
|
|
179
|
+
[sgeulette]
|
|
180
|
+
|
|
181
|
+
0.29 (2023-05-12)
|
|
182
|
+
-----------------
|
|
183
|
+
|
|
184
|
+
- Improved `utils.all_of_dict_values` to include optionally a label.
|
|
185
|
+
[sgeulette]
|
|
186
|
+
- Added `setup_logger` to modify a given logger independently
|
|
187
|
+
[sgeulette]
|
|
188
|
+
- Added `full_path` to prefix filename with path if necessary
|
|
189
|
+
[sgeulette]
|
|
190
|
+
|
|
191
|
+
0.28 (2023-03-29)
|
|
192
|
+
-----------------
|
|
193
|
+
|
|
194
|
+
- Added `utils.one_of_dict_values` that gives the first non empty value of a list of keys.
|
|
195
|
+
[sgeulette]
|
|
196
|
+
- Added `utils.all_of_dict_values` that returns a not empty values list from a dict following a keys list
|
|
197
|
+
[sgeulette]
|
|
198
|
+
|
|
199
|
+
0.27 (2023-02-27)
|
|
200
|
+
-----------------
|
|
201
|
+
|
|
202
|
+
- Added `utils.sort_by_indexes` that will sort a list of values
|
|
203
|
+
depending on a list of indexes.
|
|
204
|
+
[gbastien]
|
|
205
|
+
|
|
206
|
+
0.26 (2022-12-12)
|
|
207
|
+
-----------------
|
|
208
|
+
|
|
209
|
+
- Added `stop` to print error and exit.
|
|
210
|
+
[sgeulette]
|
|
211
|
+
|
|
212
|
+
0.25 (2022-09-16)
|
|
213
|
+
-----------------
|
|
214
|
+
|
|
215
|
+
- Added `get_git_tag`.
|
|
216
|
+
[sgeulette]
|
|
217
|
+
|
|
218
|
+
0.24 (2022-08-19)
|
|
219
|
+
-----------------
|
|
220
|
+
|
|
221
|
+
- Added `utils.time_start` and `utils.time_elapsed` to print elapsed time from start.
|
|
222
|
+
Intended to be easily used when debugging...
|
|
223
|
+
[sgeulette]
|
|
224
|
+
|
|
225
|
+
0.23 (2022-07-01)
|
|
226
|
+
-----------------
|
|
227
|
+
|
|
228
|
+
- Added `utils.append` to append a value and return it.
|
|
229
|
+
[sgeulette]
|
|
230
|
+
|
|
231
|
+
0.22 (2022-04-28)
|
|
232
|
+
-----------------
|
|
233
|
+
|
|
234
|
+
- Added `utils.get_clusters` to display a list of number grouped by clusters.
|
|
235
|
+
[gbastien]
|
|
236
|
+
|
|
237
|
+
0.21 (2022-04-26)
|
|
238
|
+
-----------------
|
|
239
|
+
|
|
240
|
+
- Added `utils.merge_dicts` to be able to merge several dicts for which values
|
|
241
|
+
are list, list are extended in final result.
|
|
242
|
+
[gbastien]
|
|
243
|
+
|
|
244
|
+
0.20 (2022-02-10)
|
|
245
|
+
-----------------
|
|
246
|
+
|
|
247
|
+
- Modified `memory` to return more useful information.
|
|
248
|
+
[sgeulette]
|
|
249
|
+
|
|
250
|
+
0.19 (2022-01-21)
|
|
251
|
+
-----------------
|
|
252
|
+
|
|
253
|
+
- Added `process_memory` to return current process memory.
|
|
254
|
+
[sgeulette]
|
|
255
|
+
- Added `memory` to return RAM information.
|
|
256
|
+
[sgeulette]
|
|
257
|
+
|
|
258
|
+
0.18 (2022-01-12)
|
|
259
|
+
-----------------
|
|
260
|
+
|
|
261
|
+
- Made `insert_in_ordereddict` python3 compatible.
|
|
262
|
+
[sgeulette]
|
|
263
|
+
- Added `odict_pos_key` to get key at position in ordereddict.
|
|
264
|
+
[sgeulette]
|
|
265
|
+
|
|
266
|
+
0.17 (2022-01-04)
|
|
267
|
+
-----------------
|
|
268
|
+
|
|
269
|
+
- Added `timed` and `ftimed` functions.
|
|
270
|
+
[sgeulette]
|
|
271
|
+
- Added OrderedDict for load_var function
|
|
272
|
+
[sgeulette]
|
|
273
|
+
|
|
274
|
+
0.16 (2021-10-27)
|
|
275
|
+
-----------------
|
|
276
|
+
|
|
277
|
+
- Added `iterable_as_list_of_list` function.
|
|
278
|
+
[sgeulette]
|
|
279
|
+
- Added date in runCommand output
|
|
280
|
+
[sgeulette]
|
|
281
|
+
|
|
282
|
+
0.15 (2021-04-27)
|
|
283
|
+
-----------------
|
|
284
|
+
|
|
285
|
+
- Added `ln_key` parameter in `read_dictcsv` method.
|
|
286
|
+
[sgeulette]
|
|
287
|
+
|
|
288
|
+
0.14 (2021-04-21)
|
|
289
|
+
-----------------
|
|
290
|
+
|
|
291
|
+
- Added `read_dictcsv` function.
|
|
292
|
+
[sgeulette]
|
|
293
|
+
- Added `utils.replace_in_list` function to ease replacement of values in a list.
|
|
294
|
+
[gbastien]
|
|
295
|
+
- Added `safe_encode` function.
|
|
296
|
+
[sgeulette]
|
|
297
|
+
|
|
298
|
+
0.13 (2020-10-07)
|
|
299
|
+
-----------------
|
|
300
|
+
|
|
301
|
+
- Added `insert_in_ordereddict` function to easier insert a new key at needed position.
|
|
302
|
+
[sgeulette]
|
|
303
|
+
|
|
304
|
+
0.12 (2020-05-19)
|
|
305
|
+
-----------------
|
|
306
|
+
|
|
307
|
+
- Update syntax for py 3.
|
|
308
|
+
[odelaere]
|
|
309
|
+
|
|
310
|
+
0.11 (2018-10-12)
|
|
311
|
+
-----------------
|
|
312
|
+
|
|
313
|
+
- Added warning log level function
|
|
314
|
+
[odelaere]
|
|
315
|
+
|
|
316
|
+
0.10 (2018-07-23)
|
|
317
|
+
-----------------
|
|
318
|
+
|
|
319
|
+
- Added to_skip parameter in read_dir functions.
|
|
320
|
+
[sgeulette]
|
|
321
|
+
|
|
322
|
+
0.9 (2017-07-28)
|
|
323
|
+
----------------
|
|
324
|
+
|
|
325
|
+
- Added read_csv function.
|
|
326
|
+
[sgeulette]
|
|
327
|
+
|
|
328
|
+
0.8 (2017-07-19)
|
|
329
|
+
----------------
|
|
330
|
+
|
|
331
|
+
- runCommand can append to file.
|
|
332
|
+
[sgeulette]
|
|
333
|
+
|
|
334
|
+
0.7 (2017-06-26)
|
|
335
|
+
----------------
|
|
336
|
+
|
|
337
|
+
- Just release on pypi for collective.documentgenerator.
|
|
338
|
+
[sgeulette]
|
|
339
|
+
|
|
340
|
+
0.6 (2017-02-08)
|
|
341
|
+
----------------
|
|
342
|
+
|
|
343
|
+
- runCommand: return as third value the return code of the command.
|
|
344
|
+
[sgeulette]
|
|
345
|
+
|
|
346
|
+
0.5 (2017-02-08)
|
|
347
|
+
----------------
|
|
348
|
+
|
|
349
|
+
- Added outfile parameter to runCommand.
|
|
350
|
+
[sgeulette]
|
|
351
|
+
|
|
352
|
+
0.4 (2016-12-07)
|
|
353
|
+
----------------
|
|
354
|
+
|
|
355
|
+
- Added param to get only files in dir.
|
|
356
|
+
[sgeulette]
|
|
357
|
+
- Added methods for bs4 (beautifulsoup)
|
|
358
|
+
[sgeulette]
|
|
359
|
+
|
|
360
|
+
0.3 (2016-09-21)
|
|
361
|
+
----------------
|
|
362
|
+
|
|
363
|
+
- Return empty list when file doesn't exist.
|
|
364
|
+
[sgeulette]
|
|
365
|
+
|
|
366
|
+
0.2 (2016-04-15)
|
|
367
|
+
----------------
|
|
368
|
+
|
|
369
|
+
- Added options on read_file.
|
|
370
|
+
[sgeulette]
|
|
371
|
+
|
|
372
|
+
0.1 (2015-06-03)
|
|
373
|
+
----------------
|
|
374
|
+
|
|
375
|
+
- Initial release.
|
|
376
|
+
[sgeulette]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
imio.pyutils-1.1.1-py3.11-nspkg.pth,sha256=XTPlQ7ZZOJ9eevOTxBxBdF9Aj2jiqvd7Y7Vv5Sy8VA4,457
|
|
2
|
+
imio/pyutils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
imio/pyutils/batching.py,sha256=o3snckmwugfYLFezj9uPMuJGQeL9W_7TPUxQtA7XQYo,1462
|
|
4
|
+
imio/pyutils/bs.py,sha256=Ans2_udSbate7jUyyM6imIe9wAnfgtHyjBVv6ySc1oo,3505
|
|
5
|
+
imio/pyutils/postgres.py,sha256=5yjfj_r0flMIE61xo7MMNNQGe9JVvij3o3vCiHNT3bE,4738
|
|
6
|
+
imio/pyutils/system.py,sha256=imFH4clwQz0vr7gDrtA88vvbADvnqhWVDII6G4OV2U0,14492
|
|
7
|
+
imio/pyutils/tests.py,sha256=Uh5x6ZuNRnwurVngnB10EmPzesrUUctLnNeBocDOEE0,12225
|
|
8
|
+
imio/pyutils/utils.py,sha256=4Wow3QYW863-Av2MPoBpmKAvvYhAvtCXGjU1aLJI8bo,11389
|
|
9
|
+
imio.pyutils-1.1.1.dist-info/METADATA,sha256=LcySTZIMmEEMNnAcXBclIlxM2W9jB_5fOR7EeckPUPM,8135
|
|
10
|
+
imio.pyutils-1.1.1.dist-info/WHEEL,sha256=pOwdCRdxkCaq8tWTvnGIC-q_meWYHwmqvvQPkeaM2I4,109
|
|
11
|
+
imio.pyutils-1.1.1.dist-info/namespace_packages.txt,sha256=ZktC0EGzThvMTAin9_q_41rzvvfMT2FYbP8pbhSLMSA,5
|
|
12
|
+
imio.pyutils-1.1.1.dist-info/top_level.txt,sha256=ZktC0EGzThvMTAin9_q_41rzvvfMT2FYbP8pbhSLMSA,5
|
|
13
|
+
imio.pyutils-1.1.1.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
imio
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
imio
|