pypipr 1.0.107__py3-none-any.whl → 1.0.108__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.
- pypipr/__init__.py +67 -67
- pypipr/{iflow/auto_reload.py → auto_reload.py} +3 -3
- pypipr/{iengineering/batchmaker.py → batchmaker.py} +1 -1
- pypipr/{iconsole/choices.py → choices.py} +2 -2
- pypipr/{ibuiltins/create_folder.py → create_folder.py} +0 -6
- pypipr/{ibuiltins/datetime_now.py → datetime_now.py} +0 -5
- pypipr/{iflow/github_pull.py → github_pull.py} +1 -5
- pypipr/{iflow/github_push.py → github_push.py} +3 -3
- pypipr/{iflow/github_user.py → github_user.py} +1 -1
- pypipr/{ifunctions/ienv.py → ienv.py} +2 -2
- pypipr/{ifunctions/ijoin.py → ijoin.py} +3 -3
- pypipr/{iconsole/input_char.py → input_char.py} +2 -2
- pypipr/{ifunctions/iopen.py → iopen.py} +2 -2
- pypipr/{ifunctions/iprint.py → iprint.py} +1 -1
- pypipr/{ifunctions/irange.py → irange.py} +2 -2
- pypipr/{iflow/pip_freeze_without_version.py → pip_freeze_without_version.py} +4 -4
- pypipr/{iflow/poetry_publish.py → poetry_publish.py} +1 -1
- pypipr/{iflow/poetry_update_version.py → poetry_update_version.py} +1 -1
- pypipr/{iconsole/print_dir.py → print_dir.py} +1 -1
- {pypipr-1.0.107.dist-info → pypipr-1.0.108.dist-info}/METADATA +859 -865
- pypipr-1.0.108.dist-info/RECORD +73 -0
- pypipr/ibuiltins/__init__.py +0 -0
- pypipr/iconsole/__init__.py +0 -0
- pypipr/idjango/__init__.py +0 -0
- pypipr/iengineering/__init__.py +0 -0
- pypipr/ifunctions/__init__.py +0 -0
- pypipr/ifunctions/irange.py.bak +0 -81
- pypipr/pypipr.py.bak +0 -37
- pypipr-1.0.107.dist-info/RECORD +0 -80
- /pypipr/{idjango/APIMixinView.py → APIMixinView.py} +0 -0
- /pypipr/{ibuiltins/ComparePerformance.py → ComparePerformance.py} +0 -0
- /pypipr/{ibuiltins/LINUX.py → LINUX.py} +0 -0
- /pypipr/{iengineering/PintUreg.py → PintUreg.py} +0 -0
- /pypipr/{iengineering/PintUregQuantity.py → PintUregQuantity.py} +0 -0
- /pypipr/{ibuiltins/RunParallel.py → RunParallel.py} +0 -0
- /pypipr/{ibuiltins/WINDOWS.py → WINDOWS.py} +0 -0
- /pypipr/{terminal.py → __terminal__.py} +0 -0
- /pypipr/{ibuiltins/avg.py → avg.py} +0 -0
- /pypipr/{ibuiltins/basename.py → basename.py} +0 -0
- /pypipr/{iengineering/batch_calculate.py → batch_calculate.py} +0 -0
- /pypipr/{iengineering/calculate.py → calculate.py} +0 -0
- /pypipr/{ibuiltins/chr_to_int.py → chr_to_int.py} +0 -0
- /pypipr/{ibuiltins/chunk_array.py → chunk_array.py} +0 -0
- /pypipr/{iconsole/console_run.py → console_run.py} +0 -0
- /pypipr/{ibuiltins/datetime_from_string.py → datetime_from_string.py} +0 -0
- /pypipr/{ibuiltins/dict_first.py → dict_first.py} +0 -0
- /pypipr/{ibuiltins/dirname.py → dirname.py} +0 -0
- /pypipr/{ibuiltins/exit_if_empty.py → exit_if_empty.py} +0 -0
- /pypipr/{ibuiltins/filter_empty.py → filter_empty.py} +0 -0
- /pypipr/{ibuiltins/get_by_index.py → get_by_index.py} +0 -0
- /pypipr/{ibuiltins/get_class_method.py → get_class_method.py} +0 -0
- /pypipr/{ibuiltins/get_filemtime.py → get_filemtime.py} +0 -0
- /pypipr/{ibuiltins/get_filesize.py → get_filesize.py} +0 -0
- /pypipr/{ifunctions/iargv.py → iargv.py} +0 -0
- /pypipr/{ifunctions/idumps.py → idumps.py} +0 -0
- /pypipr/{ifunctions/idumps_html.py → idumps_html.py} +0 -0
- /pypipr/{ifunctions/iexec.py → iexec.py} +0 -0
- /pypipr/{ifunctions/iloads.py → iloads.py} +0 -0
- /pypipr/{ifunctions/iloads_html.py → iloads_html.py} +0 -0
- /pypipr/{ibuiltins/int_to_chr.py → int_to_chr.py} +0 -0
- /pypipr/{ifunctions/ireplace.py → ireplace.py} +0 -0
- /pypipr/{ibuiltins/is_empty.py → is_empty.py} +0 -0
- /pypipr/{ibuiltins/is_iterable.py → is_iterable.py} +0 -0
- /pypipr/{ibuiltins/is_valid_url.py → is_valid_url.py} +0 -0
- /pypipr/{ifunctions/iscandir.py → iscandir.py} +0 -0
- /pypipr/{ifunctions/isplit.py → isplit.py} +0 -0
- /pypipr/{ifunctions/ivars.py → ivars.py} +0 -0
- /pypipr/{iconsole/log.py → log.py} +0 -0
- /pypipr/{ibuiltins/password_generator.py → password_generator.py} +0 -0
- /pypipr/{iconsole/print_colorize.py → print_colorize.py} +0 -0
- /pypipr/{iconsole/print_log.py → print_log.py} +0 -0
- /pypipr/{iconsole/print_to_last_line.py → print_to_last_line.py} +0 -0
- /pypipr/{ibuiltins/random_bool.py → random_bool.py} +0 -0
- /pypipr/{ibuiltins/restart.py → restart.py} +0 -0
- /pypipr/{ibuiltins/set_timeout.py → set_timeout.py} +0 -0
- /pypipr/{ibuiltins/sets_ordered.py → sets_ordered.py} +0 -0
- /pypipr/{ibuiltins/str_cmp.py → str_cmp.py} +0 -0
- /pypipr/{iconsole/text_colorize.py → text_colorize.py} +0 -0
- /pypipr/{ibuiltins/to_str.py → to_str.py} +0 -0
- {pypipr-1.0.107.dist-info → pypipr-1.0.108.dist-info}/WHEEL +0 -0
- {pypipr-1.0.107.dist-info → pypipr-1.0.108.dist-info}/entry_points.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pypipr
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.108
|
4
4
|
Summary: The Python Package Index Project
|
5
5
|
Author: ufiapjj
|
6
6
|
Author-email: ufiapjj@gmail.com
|
@@ -50,10 +50,10 @@ pypipr
|
|
50
50
|
|
51
51
|
`LINUX`
|
52
52
|
|
53
|
-
`WINDOWS`
|
54
|
-
|
55
53
|
`PintUreg`
|
56
54
|
|
55
|
+
`WINDOWS`
|
56
|
+
|
57
57
|
# FUNCTION
|
58
58
|
|
59
59
|
## avg
|
@@ -72,252 +72,105 @@ Output:
|
|
72
72
|
16.285714285714285
|
73
73
|
```
|
74
74
|
|
75
|
-
##
|
76
|
-
|
77
|
-
`basename(path)`
|
78
|
-
|
79
|
-
Mengembalikan nama file dari path
|
80
|
-
|
81
|
-
```python
|
82
|
-
print(basename("/ini/nama/folder/ke/file.py"))
|
83
|
-
```
|
84
|
-
|
85
|
-
Output:
|
86
|
-
```py
|
87
|
-
file.py
|
88
|
-
```
|
89
|
-
|
90
|
-
## chr_to_int
|
91
|
-
|
92
|
-
`chr_to_int(s, start=1, numbers='abcdefghijklmnopqrstuvwxyz')`
|
93
|
-
|
94
|
-
Fungsi ini berguna untuk mengubah urutan huruf menjadi angka.
|
95
|
-
|
96
|
-
```python
|
97
|
-
print(chr_to_int('z')) # Output: 26
|
98
|
-
print(chr_to_int('aa')) # Output: 27
|
99
|
-
print(chr_to_int('abc', numbers="abc")) # Output: 10
|
100
|
-
```
|
101
|
-
|
102
|
-
Output:
|
103
|
-
```py
|
104
|
-
26
|
105
|
-
27
|
106
|
-
18
|
107
|
-
```
|
108
|
-
|
109
|
-
## chunk_array
|
75
|
+
## get_filemtime
|
110
76
|
|
111
|
-
`
|
77
|
+
`get_filemtime(filename)`
|
112
78
|
|
113
|
-
|
79
|
+
Mengambil informasi last modification time file dalam nano seconds
|
114
80
|
|
115
81
|
```python
|
116
|
-
|
117
|
-
print(chunk_array(arr, 5))
|
118
|
-
print(list(chunk_array(arr, 5)))
|
82
|
+
print(get_filemtime(__file__))
|
119
83
|
```
|
120
84
|
|
121
85
|
Output:
|
122
86
|
```py
|
123
|
-
|
124
|
-
[[2, 3, 12, 3, 3], [42, 42, 1, 43, 2], [42, 41, 4, 24, 32], [42, 3, 12, 32, 42], [42]]
|
87
|
+
1714399678112897487
|
125
88
|
```
|
126
89
|
|
127
|
-
##
|
90
|
+
## print_colorize
|
128
91
|
|
129
|
-
`
|
92
|
+
`print_colorize(text, color='\x1b[32m', bright='\x1b[1m', color_end='\x1b[0m', text_start='', text_end='\n', delay=0.05)`
|
130
93
|
|
131
|
-
|
132
|
-
Membuat folder secara recursive dengan permission.
|
94
|
+
Print text dengan warna untuk menunjukan text penting
|
133
95
|
|
134
96
|
```py
|
135
|
-
|
136
|
-
|
137
|
-
create_folder("./contoh_membuat_folder/secara/recursive")
|
138
|
-
```
|
139
|
-
|
140
|
-
## datetime_from_string
|
141
|
-
|
142
|
-
`datetime_from_string(iso_string, timezone='UTC')`
|
143
|
-
|
144
|
-
Parse iso_string menjadi datetime object
|
145
|
-
|
146
|
-
```python
|
147
|
-
print(datetime_from_string("2022-12-12 15:40:13").isoformat())
|
148
|
-
print(datetime_from_string(
|
149
|
-
"2022-12-12 15:40:13",
|
150
|
-
timezone="Asia/Jakarta"
|
151
|
-
).isoformat())
|
152
|
-
```
|
153
|
-
|
154
|
-
Output:
|
155
|
-
```py
|
156
|
-
2022-12-12T15:40:13+00:00
|
157
|
-
2022-12-12T15:40:13+07:00
|
158
|
-
```
|
159
|
-
|
160
|
-
## datetime_now
|
161
|
-
|
162
|
-
`datetime_now(timezone=None)`
|
163
|
-
|
164
|
-
Memudahkan dalam membuat Datetime untuk suatu timezone tertentu
|
165
|
-
|
166
|
-
```python
|
167
|
-
print(datetime_now("Asia/Jakarta"))
|
168
|
-
print(datetime_now("GMT"))
|
169
|
-
print(datetime_now("Etc/GMT+7"))
|
170
|
-
```
|
171
|
-
|
172
|
-
Output:
|
173
|
-
```py
|
174
|
-
2024-04-29 20:40:57.605554+07:00
|
175
|
-
2024-04-29 13:40:57.606252+00:00
|
176
|
-
2024-04-29 06:40:57.607525-07:00
|
177
|
-
```
|
178
|
-
|
179
|
-
## dict_first
|
180
|
-
|
181
|
-
`dict_first(d: dict, remove=False)`
|
182
|
-
|
183
|
-
Mengambil nilai (key, value) pertama dari dictionary dalam bentuk tuple.
|
184
|
-
|
185
|
-
```python
|
186
|
-
d = {
|
187
|
-
"key2": "value2",
|
188
|
-
"key3": "value3",
|
189
|
-
"key1": "value1",
|
190
|
-
}
|
191
|
-
print(dict_first(d, remove=True))
|
192
|
-
print(dict_first(d))
|
193
|
-
```
|
194
|
-
|
195
|
-
Output:
|
196
|
-
```py
|
197
|
-
('key2', 'value2')
|
198
|
-
('key3', 'value3')
|
97
|
+
print_colorize("Print some text")
|
98
|
+
print_colorize("Print some text", color=colorama.Fore.RED)
|
199
99
|
```
|
200
100
|
|
201
|
-
##
|
101
|
+
## print_log
|
202
102
|
|
203
|
-
`
|
103
|
+
`print_log(text)`
|
204
104
|
|
205
|
-
|
206
|
-
|
105
|
+
Akan melakukan print ke console.
|
106
|
+
Berguna untuk memberikan informasi proses program yg sedang berjalan.
|
207
107
|
|
208
108
|
```python
|
209
|
-
|
109
|
+
print_log("Standalone Log")
|
210
110
|
```
|
211
111
|
|
212
112
|
Output:
|
213
113
|
```py
|
214
|
-
|
114
|
+
[32m[1m>>> Standalone Log[0m
|
215
115
|
```
|
216
116
|
|
217
|
-
##
|
117
|
+
## console_run
|
218
118
|
|
219
|
-
`
|
119
|
+
`console_run(info, command=None, print_info=True, capture_output=False)`
|
220
120
|
|
221
|
-
|
222
|
-
setara dengan empty
|
121
|
+
Menjalankan command seperti menjalankan command di Command Terminal
|
223
122
|
|
224
123
|
```py
|
225
|
-
|
226
|
-
|
227
|
-
exit_if_empty(var1, var2)
|
228
|
-
```
|
229
|
-
|
230
|
-
## filter_empty
|
231
|
-
|
232
|
-
`filter_empty(iterable, zero_is_empty=True, str_strip=True)`
|
233
|
-
|
234
|
-
Mengembalikan iterabel yang hanya memiliki nilai
|
235
|
-
|
236
|
-
```python
|
237
|
-
var = [1, None, False, 0, "0", True, {}, ['eee']]
|
238
|
-
print(filter_empty(var))
|
239
|
-
```
|
240
|
-
|
241
|
-
Output:
|
242
|
-
```py
|
243
|
-
<generator object filter_empty at 0x7d50946e30>
|
244
|
-
```
|
245
|
-
|
246
|
-
## get_by_index
|
247
|
-
|
248
|
-
`get_by_index(obj, index, on_error=None)`
|
249
|
-
|
250
|
-
Mendapatkan value dari object berdasarkan indexnya.
|
251
|
-
Jika error out of range maka akan mengembalikan on_error.
|
252
|
-
|
253
|
-
```python
|
254
|
-
l = [1, 3, 5]
|
255
|
-
print(get_by_index(l, 7))
|
256
|
-
```
|
257
|
-
|
258
|
-
Output:
|
259
|
-
```py
|
260
|
-
None
|
124
|
+
console_run('dir')
|
125
|
+
console_run('ls')
|
261
126
|
```
|
262
127
|
|
263
|
-
##
|
128
|
+
## auto_reload
|
264
129
|
|
265
|
-
`
|
130
|
+
`auto_reload(filename)`
|
266
131
|
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
def a():
|
272
|
-
return [x for x in range(10)]
|
273
|
-
|
274
|
-
def b():
|
275
|
-
return [x for x in range(10)]
|
276
|
-
|
277
|
-
def c():
|
278
|
-
return [x for x in range(10)]
|
279
|
-
|
280
|
-
def d():
|
281
|
-
return [x for x in range(10)]
|
132
|
+
Menjalankan file python secara berulang.
|
133
|
+
Dengan tujuan untuk melihat perubahan secara langsung.
|
134
|
+
Pastikan kode aman untuk dijalankan.
|
135
|
+
Jalankan kode ini di terminal console.
|
282
136
|
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
Output:
|
288
|
-
```py
|
289
|
-
<generator object get_class_method at 0x7d50947100>
|
290
|
-
[<function ExampleGetClassMethod.a at 0x7d509dd800>, <function ExampleGetClassMethod.b at 0x7d509dd6c0>, <function ExampleGetClassMethod.c at 0x7d509dd8a0>, <function ExampleGetClassMethod.d at 0x7d509dd940>]
|
137
|
+
```py
|
138
|
+
if __name__ == "__main__":
|
139
|
+
auto_reload("file_name.py")
|
291
140
|
```
|
292
141
|
|
293
|
-
##
|
142
|
+
## basename
|
294
143
|
|
295
|
-
`
|
144
|
+
`basename(path)`
|
296
145
|
|
297
|
-
|
146
|
+
Mengembalikan nama file dari path
|
298
147
|
|
299
148
|
```python
|
300
|
-
print(
|
149
|
+
print(basename("/ini/nama/folder/ke/file.py"))
|
301
150
|
```
|
302
151
|
|
303
152
|
Output:
|
304
153
|
```py
|
305
|
-
|
154
|
+
file.py
|
306
155
|
```
|
307
156
|
|
308
|
-
##
|
157
|
+
## chr_to_int
|
309
158
|
|
310
|
-
`
|
159
|
+
`chr_to_int(s, start=1, numbers='abcdefghijklmnopqrstuvwxyz')`
|
311
160
|
|
312
|
-
|
161
|
+
Fungsi ini berguna untuk mengubah urutan huruf menjadi angka.
|
313
162
|
|
314
163
|
```python
|
315
|
-
print(
|
164
|
+
print(chr_to_int('z')) # Output: 26
|
165
|
+
print(chr_to_int('aa')) # Output: 27
|
166
|
+
print(chr_to_int('abc', numbers="abc")) # Output: 10
|
316
167
|
```
|
317
168
|
|
318
169
|
Output:
|
319
170
|
```py
|
320
|
-
|
171
|
+
26
|
172
|
+
27
|
173
|
+
18
|
321
174
|
```
|
322
175
|
|
323
176
|
## int_to_chr
|
@@ -369,197 +222,157 @@ Output:
|
|
369
222
|
kmc
|
370
223
|
```
|
371
224
|
|
372
|
-
##
|
225
|
+
## irange
|
373
226
|
|
374
|
-
`
|
227
|
+
`irange(start, stop=None, step=1, index=0, numbers='abcdefghijklmnopqrstuvwxyz')`
|
375
228
|
|
376
|
-
|
377
|
-
|
378
|
-
Pengecekan nilai yang setara menggunakan simbol '==', sedangkan untuk
|
379
|
-
pengecekan lokasi memory yang sama menggunakan keyword 'is'
|
229
|
+
Meningkatkan fungsi range() dari python untuk pengulangan menggunakan huruf
|
380
230
|
|
381
231
|
```python
|
382
|
-
print(
|
383
|
-
print(
|
384
|
-
print(
|
385
|
-
print(
|
386
|
-
print(
|
387
|
-
print(is_empty([]))
|
232
|
+
print(irange('a', 'c'))
|
233
|
+
print(irange('z', 'a', 10))
|
234
|
+
print(list(irange('a', 'z', 10)))
|
235
|
+
print(list(irange(1, '7')))
|
236
|
+
print(list(irange(10, 5)))
|
388
237
|
```
|
389
238
|
|
390
239
|
Output:
|
391
240
|
```py
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
True
|
241
|
+
<generator object char_range at 0x7384c3fcd0>
|
242
|
+
<generator object char_range at 0x7384c3fcd0>
|
243
|
+
['a', 'k', 'u']
|
244
|
+
[1, 2, 3, 4, 5, 6]
|
245
|
+
[]
|
398
246
|
```
|
399
247
|
|
400
|
-
##
|
248
|
+
## batchmaker
|
401
249
|
|
402
|
-
`
|
250
|
+
`batchmaker(pattern: str)`
|
403
251
|
|
404
|
-
|
252
|
+
Alat Bantu untuk membuat teks yang berulang.
|
253
|
+
Gunakan `{[start][separator][finish]([separator][step])}`.
|
254
|
+
```
|
255
|
+
[start] dan [finish] -> bisa berupa huruf maupun angka
|
256
|
+
([separator][step]) -> bersifat optional
|
257
|
+
[separator] -> selain huruf dan angka
|
258
|
+
[step] -> berupa angka positif
|
259
|
+
```
|
405
260
|
|
406
261
|
```python
|
407
|
-
s =
|
408
|
-
print(
|
409
|
-
|
410
|
-
l = [12,21,2,1]
|
411
|
-
print(is_iterable(l))
|
412
|
-
|
413
|
-
r = range(100)
|
414
|
-
print(is_iterable(r))
|
415
|
-
|
416
|
-
d = {'a':1, 'b':2}
|
417
|
-
print(is_iterable(d.values()))
|
262
|
+
s = "Urutan {1/6/3} dan {10:9} dan {j k} dan {Z - A - 15} saja."
|
263
|
+
print(batchmaker(s))
|
264
|
+
print(list(batchmaker(s)))
|
418
265
|
```
|
419
266
|
|
420
267
|
Output:
|
421
268
|
```py
|
422
|
-
|
423
|
-
|
424
|
-
True
|
425
|
-
True
|
269
|
+
<generator object batchmaker at 0x7384b4c160>
|
270
|
+
[]
|
426
271
|
```
|
427
272
|
|
428
|
-
##
|
273
|
+
## calculate
|
429
274
|
|
430
|
-
`
|
275
|
+
`calculate(teks)`
|
431
276
|
|
432
|
-
|
433
|
-
|
277
|
+
Mengembalikan hasil dari perhitungan teks menggunakan modul pint.
|
278
|
+
Mendukung perhitungan matematika dasar dengan satuan.
|
434
279
|
|
435
|
-
|
436
|
-
|
437
|
-
print(is_valid_url("https://chat.openai.com/?model/=text-dav/inci-002-render-sha"))
|
438
|
-
```
|
439
|
-
|
440
|
-
Output:
|
441
|
-
```py
|
442
|
-
True
|
443
|
-
True
|
444
|
-
```
|
445
|
-
|
446
|
-
## password_generator
|
447
|
-
|
448
|
-
`password_generator(length=8, characters='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~')`
|
449
|
-
|
450
|
-
Membuat pssword secara acak
|
280
|
+
Return value:
|
281
|
+
- Berupa class Quantity dari modul pint
|
451
282
|
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
```py
|
458
|
-
qWYWxMl,
|
459
|
-
```
|
460
|
-
|
461
|
-
## random_bool
|
462
|
-
|
463
|
-
`random_bool()`
|
464
|
-
|
465
|
-
Menghasilkan nilai random True atau False.
|
466
|
-
Fungsi ini merupakan fungsi tercepat untuk mendapatkan random bool.
|
467
|
-
Fungsi ini sangat cepat, tetapi pemanggilan fungsi ini membutuhkan
|
468
|
-
overhead yg besar.
|
283
|
+
Format:
|
284
|
+
- f"{result:~P}" -> pretty
|
285
|
+
- f"{result:~H}" -> html
|
286
|
+
- result.to_base_units() -> SI
|
287
|
+
- result.to_compact() -> human readable
|
469
288
|
|
470
289
|
```python
|
471
|
-
|
290
|
+
fx = "3 meter * 10 cm * 3 km"
|
291
|
+
res = calculate(fx)
|
292
|
+
print(res)
|
293
|
+
print(res.to_base_units())
|
294
|
+
print(res.to_compact())
|
295
|
+
print(f"{res:~P}")
|
296
|
+
print(f"{res:~H}")
|
472
297
|
```
|
473
298
|
|
474
299
|
Output:
|
475
300
|
```py
|
476
|
-
|
301
|
+
90 centimeter * kilometer * meter
|
302
|
+
900.0 meter ** 3
|
303
|
+
900.0 meter ** 3
|
304
|
+
90 cm·km·m
|
305
|
+
90 cm km m
|
477
306
|
```
|
478
307
|
|
479
|
-
##
|
480
|
-
|
481
|
-
`restart(*argv)`
|
482
|
-
|
483
|
-
## set_timeout
|
308
|
+
## batch_calculate
|
484
309
|
|
485
|
-
`
|
310
|
+
`batch_calculate(pattern)`
|
486
311
|
|
487
|
-
|
488
|
-
|
489
|
-
program tidak akan berhenti sampai timeout selesai, kemudian fungsi dijalankan,
|
490
|
-
kemudian program dihentikan.
|
312
|
+
Analisa perhitungan massal.
|
313
|
+
Bisa digunakan untuk mencari alternatif terendah/tertinggi/dsb.
|
491
314
|
|
492
|
-
```python
|
493
|
-
set_timeout(3, lambda: print("Timeout 3"))
|
494
|
-
x = set_timeout(7, print, args=["Timeout 7"])
|
495
|
-
print(x)
|
496
|
-
print("menghentikan timeout 7")
|
497
|
-
x.cancel()
|
498
|
-
```
|
499
|
-
|
500
|
-
Output:
|
501
|
-
```py
|
502
|
-
<Timer(Thread-2, started 538199633136)>
|
503
|
-
menghentikan timeout 7
|
504
|
-
```
|
505
|
-
|
506
|
-
## sets_ordered
|
507
|
-
|
508
|
-
`sets_ordered(iterator)`
|
509
|
-
|
510
|
-
Hanya mengambil nilai unik dari suatu list
|
511
315
|
|
512
316
|
```python
|
513
|
-
|
514
|
-
print(
|
515
|
-
print(list(sets_ordered(array)))
|
317
|
+
print(batch_calculate("{1 10} m ** {1 3}"))
|
318
|
+
print(list(batch_calculate("{1 10} m ** {1 3}")))
|
516
319
|
```
|
517
320
|
|
518
321
|
Output:
|
519
322
|
```py
|
520
|
-
<generator object
|
521
|
-
[2, 3,
|
323
|
+
<generator object batch_calculate at 0x7384ac2e30>
|
324
|
+
[('1 m ** 1', <Quantity(1, 'meter')>), ('1 m ** 2', <Quantity(1, 'meter ** 2')>), ('2 m ** 1', <Quantity(2, 'meter')>), ('2 m ** 2', <Quantity(2, 'meter ** 2')>), ('3 m ** 1', <Quantity(3, 'meter')>), ('3 m ** 2', <Quantity(3, 'meter ** 2')>), ('4 m ** 1', <Quantity(4, 'meter')>), ('4 m ** 2', <Quantity(4, 'meter ** 2')>), ('5 m ** 1', <Quantity(5, 'meter')>), ('5 m ** 2', <Quantity(5, 'meter ** 2')>), ('6 m ** 1', <Quantity(6, 'meter')>), ('6 m ** 2', <Quantity(6, 'meter ** 2')>), ('7 m ** 1', <Quantity(7, 'meter')>), ('7 m ** 2', <Quantity(7, 'meter ** 2')>), ('8 m ** 1', <Quantity(8, 'meter')>), ('8 m ** 2', <Quantity(8, 'meter ** 2')>), ('9 m ** 1', <Quantity(9, 'meter')>), ('9 m ** 2', <Quantity(9, 'meter ** 2')>)]
|
522
325
|
```
|
523
326
|
|
524
|
-
##
|
327
|
+
## is_iterable
|
525
328
|
|
526
|
-
`
|
329
|
+
`is_iterable(var, str_is_iterable=False)`
|
527
330
|
|
528
|
-
|
529
|
-
Lebih cepat dibandingkan upper(), casefold(), re.fullmatch(), len().
|
530
|
-
perbandingan ini sangat cepat, tetapi pemanggilan fungsi ini membutuhkan
|
531
|
-
overhead yg besar.
|
331
|
+
Mengecek apakah suatu variabel bisa dilakukan forloop atau tidak
|
532
332
|
|
533
333
|
```python
|
534
|
-
|
334
|
+
s = 'ini string'
|
335
|
+
print(is_iterable(s))
|
336
|
+
|
337
|
+
l = [12,21,2,1]
|
338
|
+
print(is_iterable(l))
|
339
|
+
|
340
|
+
r = range(100)
|
341
|
+
print(is_iterable(r))
|
342
|
+
|
343
|
+
d = {'a':1, 'b':2}
|
344
|
+
print(is_iterable(d.values()))
|
535
345
|
```
|
536
346
|
|
537
347
|
Output:
|
538
348
|
```py
|
349
|
+
False
|
350
|
+
True
|
351
|
+
True
|
539
352
|
True
|
540
353
|
```
|
541
354
|
|
542
|
-
##
|
355
|
+
## print_to_last_line
|
543
356
|
|
544
|
-
`
|
357
|
+
`print_to_last_line(text: str, latest=1, clear=True)`
|
545
358
|
|
546
|
-
|
359
|
+
Melakukan print ke konsol tetapi akan menimpa baris terakhir.
|
360
|
+
Berguna untuk memberikan progress secara interaktif.
|
547
361
|
|
548
|
-
```
|
549
|
-
|
550
|
-
|
551
|
-
print(to_str(False))
|
552
|
-
print(to_str(True))
|
553
|
-
print(to_str(None))
|
362
|
+
```py
|
363
|
+
c = input("masukkan apa saja : ")
|
364
|
+
print_to_last_line(f"masukkan apa saja : {c} [ok]")
|
554
365
|
```
|
555
366
|
|
556
|
-
|
557
|
-
```py
|
558
|
-
5
|
367
|
+
## text_colorize
|
559
368
|
|
560
|
-
|
561
|
-
True
|
369
|
+
`text_colorize(text, color='\x1b[32m', bright='\x1b[1m', color_end='\x1b[0m')`
|
562
370
|
|
371
|
+
return text dengan warna untuk menunjukan text penting
|
372
|
+
|
373
|
+
```py
|
374
|
+
text_colorize("Print some text")
|
375
|
+
text_colorize("Print some text", color=colorama.Fore.RED)
|
563
376
|
```
|
564
377
|
|
565
378
|
## choices
|
@@ -586,270 +399,254 @@ c = choices(
|
|
586
399
|
)
|
587
400
|
```
|
588
401
|
|
589
|
-
##
|
402
|
+
## chunk_array
|
590
403
|
|
591
|
-
`
|
404
|
+
`chunk_array(array, size, start=0)`
|
592
405
|
|
593
|
-
|
406
|
+
Membagi array menjadi potongan-potongan dengan besaran yg diinginkan
|
594
407
|
|
595
|
-
```
|
596
|
-
|
597
|
-
|
408
|
+
```python
|
409
|
+
arr = [2, 3, 12, 3, 3, 42, 42, 1, 43, 2, 42, 41, 4, 24, 32, 42, 3, 12, 32, 42, 42]
|
410
|
+
print(chunk_array(arr, 5))
|
411
|
+
print(list(chunk_array(arr, 5)))
|
598
412
|
```
|
599
413
|
|
600
|
-
|
414
|
+
Output:
|
415
|
+
```py
|
416
|
+
<generator object chunk_array at 0x7384b48240>
|
417
|
+
[[2, 3, 12, 3, 3], [42, 42, 1, 43, 2], [42, 41, 4, 24, 32], [42, 3, 12, 32, 42], [42]]
|
418
|
+
```
|
601
419
|
|
602
|
-
|
420
|
+
## create_folder
|
603
421
|
|
604
|
-
|
422
|
+
`create_folder(folder_name)`
|
423
|
+
|
424
|
+
Membuat folder.
|
425
|
+
Membuat folder secara recursive dengan permission.
|
605
426
|
|
606
427
|
```py
|
607
|
-
|
608
|
-
|
609
|
-
|
428
|
+
create_folder("contoh_membuat_folder")
|
429
|
+
create_folder("contoh/membuat/folder/recursive")
|
430
|
+
create_folder("./contoh_membuat_folder/secara/recursive")
|
610
431
|
```
|
611
432
|
|
612
|
-
##
|
433
|
+
## datetime_from_string
|
613
434
|
|
614
|
-
`
|
435
|
+
`datetime_from_string(iso_string, timezone='UTC')`
|
615
436
|
|
616
|
-
|
617
|
-
fungsi yg sudah ada.
|
618
|
-
Melakukan print ke console untuk menginformasikan proses yg sedang
|
619
|
-
berjalan didalam program.
|
620
|
-
|
621
|
-
```py
|
622
|
-
@log
|
623
|
-
def some_function():
|
624
|
-
pass
|
625
|
-
|
626
|
-
@log()
|
627
|
-
def some_function_again():
|
628
|
-
pass
|
629
|
-
|
630
|
-
@log("Calling some function")
|
631
|
-
def some_function_more():
|
632
|
-
pass
|
437
|
+
Parse iso_string menjadi datetime object
|
633
438
|
|
634
|
-
|
635
|
-
|
636
|
-
|
439
|
+
```python
|
440
|
+
print(datetime_from_string("2022-12-12 15:40:13").isoformat())
|
441
|
+
print(datetime_from_string(
|
442
|
+
"2022-12-12 15:40:13",
|
443
|
+
timezone="Asia/Jakarta"
|
444
|
+
).isoformat())
|
637
445
|
```
|
638
446
|
|
639
|
-
|
447
|
+
Output:
|
448
|
+
```py
|
449
|
+
2022-12-12T15:40:13+00:00
|
450
|
+
2022-12-12T15:40:13+07:00
|
451
|
+
```
|
640
452
|
|
641
|
-
|
453
|
+
## datetime_now
|
642
454
|
|
643
|
-
|
455
|
+
`datetime_now(timezone=None)`
|
456
|
+
|
457
|
+
Memudahkan dalam membuat Datetime untuk suatu timezone tertentu
|
644
458
|
|
645
|
-
```
|
646
|
-
|
647
|
-
|
459
|
+
```python
|
460
|
+
print(datetime_now("Asia/Jakarta"))
|
461
|
+
print(datetime_now("GMT"))
|
462
|
+
print(datetime_now("Etc/GMT+7"))
|
648
463
|
```
|
649
464
|
|
650
|
-
|
465
|
+
Output:
|
466
|
+
```py
|
467
|
+
2024-04-29 21:55:16.569628+07:00
|
468
|
+
2024-04-29 14:55:16.570325+00:00
|
469
|
+
2024-04-29 07:55:16.571597-07:00
|
470
|
+
```
|
651
471
|
|
652
|
-
|
472
|
+
## dict_first
|
653
473
|
|
654
|
-
|
474
|
+
`dict_first(d: dict, remove=False)`
|
475
|
+
|
476
|
+
Mengambil nilai (key, value) pertama dari dictionary dalam bentuk tuple.
|
655
477
|
|
656
478
|
```python
|
657
|
-
|
658
|
-
|
659
|
-
|
479
|
+
d = {
|
480
|
+
"key2": "value2",
|
481
|
+
"key3": "value3",
|
482
|
+
"key1": "value1",
|
483
|
+
}
|
484
|
+
print(dict_first(d, remove=True))
|
485
|
+
print(dict_first(d))
|
660
486
|
```
|
661
487
|
|
662
488
|
Output:
|
663
489
|
```py
|
664
|
-
|
665
|
-
|
666
|
-
__dir__ : ['__module__', '__doc__', '__slots__', '__new__', '_make_child_relpath', '__enter__', '__exit__', 'cwd', 'home', 'samefile', 'iterdir', '_scandir', 'glob', 'rglob', 'absolute', 'resolve', 'stat', 'owner', 'group', 'open', 'read_bytes', 'read_text', 'write_bytes', 'write_text', 'readlink', 'touch', 'mkdir', 'chmod', 'lchmod', 'unlink', 'rmdir', 'lstat', 'rename', 'replace', 'symlink_to', 'hardlink_to', 'link_to', 'exists', 'is_dir', 'is_file', 'is_mount', 'is_symlink', 'is_block_device', 'is_char_device', 'is_fifo', 'is_socket', 'expanduser', '__reduce__', '_parse_args', '_from_parts', '_from_parsed_parts', '_format_parsed_parts', '_make_child', '__str__', '__fspath__', 'as_posix', '__bytes__', '__repr__', 'as_uri', '_cparts', '__eq__', '__hash__', '__lt__', '__le__', '__gt__', '__ge__', 'drive', 'root', 'anchor', 'name', 'suffix', 'suffixes', 'stem', 'with_name', 'with_stem', 'with_suffix', 'relative_to', 'is_relative_to', 'parts', 'joinpath', '__truediv__', '__rtruediv__', 'parent', 'parents', 'is_absolute', 'is_reserved', 'match', '_cached_cparts', '_drv', '_hash', '_parts', '_pparts', '_root', '_str', '__getattribute__', '__setattr__', '__delattr__', '__ne__', '__init__', '__reduce_ex__', '__getstate__', '__subclasshook__', '__init_subclass__', '__format__', '__sizeof__', '__dir__', '__class__', '_flavour']
|
667
|
-
__doc__ : Path subclass for non-Windows systems.
|
668
|
-
|
669
|
-
On a POSIX system, instantiating a Path should return this object.
|
670
|
-
|
671
|
-
__enter__ : https:/www.google.com
|
672
|
-
__fspath__ : https:/www.google.com
|
673
|
-
__getstate__ : (None, {'_drv': '', '_root': '', '_parts': ['https:', 'www.google.com'], '_str': 'https:/www.google.com'})
|
674
|
-
__hash__ : 7236578027364881221
|
675
|
-
__init__ : None
|
676
|
-
__init_subclass__ : None
|
677
|
-
__module__ : pathlib
|
678
|
-
__reduce__ : (<class 'pathlib.PosixPath'>, ('https:', 'www.google.com'))
|
679
|
-
__repr__ : PosixPath('https:/www.google.com')
|
680
|
-
__sizeof__ : 72
|
681
|
-
__slots__ : ()
|
682
|
-
__str__ : https:/www.google.com
|
683
|
-
__subclasshook__ : NotImplemented
|
684
|
-
_cached_cparts : ['https:', 'www.google.com']
|
685
|
-
_cparts : ['https:', 'www.google.com']
|
686
|
-
_drv :
|
687
|
-
_flavour : <pathlib._PosixFlavour object at 0x7d604005d0>
|
688
|
-
_hash : 7236578027364881221
|
689
|
-
_parts : ['https:', 'www.google.com']
|
690
|
-
_root :
|
691
|
-
_str : https:/www.google.com
|
692
|
-
absolute : /data/data/com.termux/files/home/pypipr/https:/www.google.com
|
693
|
-
anchor :
|
694
|
-
as_posix : https:/www.google.com
|
695
|
-
cwd : /data/data/com.termux/files/home/pypipr
|
696
|
-
drive :
|
697
|
-
exists : False
|
698
|
-
expanduser : https:/www.google.com
|
699
|
-
home : /data/data/com.termux/files/home
|
700
|
-
is_absolute : False
|
701
|
-
is_block_device : False
|
702
|
-
is_char_device : False
|
703
|
-
is_dir : False
|
704
|
-
is_fifo : False
|
705
|
-
is_file : False
|
706
|
-
is_mount : False
|
707
|
-
is_reserved : False
|
708
|
-
is_socket : False
|
709
|
-
is_symlink : False
|
710
|
-
iterdir : <generator object Path.iterdir at 0x7d509c0c80>
|
711
|
-
joinpath : https:/www.google.com
|
712
|
-
name : www.google.com
|
713
|
-
parent : https:
|
714
|
-
parents : <PosixPath.parents>
|
715
|
-
parts : ('https:', 'www.google.com')
|
716
|
-
resolve : /data/data/com.termux/files/home/pypipr/https:/www.google.com
|
717
|
-
root :
|
718
|
-
stem : www.google
|
719
|
-
suffix : .com
|
720
|
-
suffixes : ['.google', '.com']
|
490
|
+
('key2', 'value2')
|
491
|
+
('key3', 'value3')
|
721
492
|
```
|
722
493
|
|
723
|
-
##
|
494
|
+
## dirname
|
724
495
|
|
725
|
-
`
|
496
|
+
`dirname(path)`
|
726
497
|
|
727
|
-
|
728
|
-
|
498
|
+
Mengembalikan nama folder dari path.
|
499
|
+
Tanpa trailing slash di akhir.
|
729
500
|
|
730
501
|
```python
|
731
|
-
|
502
|
+
print(dirname("/ini/nama/folder/ke/file.py"))
|
732
503
|
```
|
733
504
|
|
734
505
|
Output:
|
735
506
|
```py
|
736
|
-
|
507
|
+
/ini/nama/folder/ke
|
737
508
|
```
|
738
509
|
|
739
|
-
##
|
510
|
+
## is_empty
|
740
511
|
|
741
|
-
`
|
512
|
+
`is_empty(variable, empty=[None, False, 0, 0, '0', '', '-0', '\n', '\t', set(), {}, [], ()])`
|
742
513
|
|
743
|
-
|
744
|
-
Berguna untuk memberikan progress secara interaktif.
|
514
|
+
Mengecek apakah variable setara dengan nilai kosong pada empty.
|
745
515
|
|
746
|
-
|
747
|
-
|
748
|
-
|
516
|
+
Pengecekan nilai yang setara menggunakan simbol '==', sedangkan untuk
|
517
|
+
pengecekan lokasi memory yang sama menggunakan keyword 'is'
|
518
|
+
|
519
|
+
```python
|
520
|
+
print(is_empty("teks"))
|
521
|
+
print(is_empty(True))
|
522
|
+
print(is_empty(False))
|
523
|
+
print(is_empty(None))
|
524
|
+
print(is_empty(0))
|
525
|
+
print(is_empty([]))
|
749
526
|
```
|
750
527
|
|
751
|
-
|
528
|
+
Output:
|
529
|
+
```py
|
530
|
+
False
|
531
|
+
False
|
532
|
+
True
|
533
|
+
True
|
534
|
+
True
|
535
|
+
True
|
536
|
+
```
|
752
537
|
|
753
|
-
|
538
|
+
## exit_if_empty
|
754
539
|
|
755
|
-
|
540
|
+
`exit_if_empty(*args)`
|
541
|
+
|
542
|
+
Keluar dari program apabila seluruh variabel
|
543
|
+
setara dengan empty
|
756
544
|
|
757
545
|
```py
|
758
|
-
|
759
|
-
|
546
|
+
var1 = None
|
547
|
+
var2 = '0'
|
548
|
+
exit_if_empty(var1, var2)
|
760
549
|
```
|
761
550
|
|
762
|
-
##
|
551
|
+
## to_str
|
763
552
|
|
764
|
-
`
|
553
|
+
`to_str(value)`
|
765
554
|
|
766
|
-
|
767
|
-
Bisa digunakan untuk mencari alternatif terendah/tertinggi/dsb.
|
768
|
-
|
555
|
+
Mengubah value menjadi string literal
|
769
556
|
|
770
557
|
```python
|
771
|
-
print(
|
772
|
-
print(
|
558
|
+
print(to_str(5))
|
559
|
+
print(to_str([]))
|
560
|
+
print(to_str(False))
|
561
|
+
print(to_str(True))
|
562
|
+
print(to_str(None))
|
773
563
|
```
|
774
564
|
|
775
565
|
Output:
|
776
566
|
```py
|
777
|
-
|
778
|
-
|
567
|
+
5
|
568
|
+
|
569
|
+
False
|
570
|
+
True
|
571
|
+
|
779
572
|
```
|
780
573
|
|
781
|
-
##
|
574
|
+
## filter_empty
|
782
575
|
|
783
|
-
`
|
576
|
+
`filter_empty(iterable, zero_is_empty=True, str_strip=True)`
|
784
577
|
|
785
|
-
|
786
|
-
|
787
|
-
```
|
788
|
-
|
789
|
-
(
|
790
|
-
|
791
|
-
|
792
|
-
|
578
|
+
Mengembalikan iterabel yang hanya memiliki nilai
|
579
|
+
|
580
|
+
```python
|
581
|
+
var = [1, None, False, 0, "0", True, {}, ['eee']]
|
582
|
+
print(filter_empty(var))
|
583
|
+
```
|
584
|
+
|
585
|
+
Output:
|
586
|
+
```py
|
587
|
+
<generator object filter_empty at 0x7384ac13f0>
|
588
|
+
```
|
589
|
+
|
590
|
+
## get_by_index
|
591
|
+
|
592
|
+
`get_by_index(obj, index, on_error=None)`
|
593
|
+
|
594
|
+
Mendapatkan value dari object berdasarkan indexnya.
|
595
|
+
Jika error out of range maka akan mengembalikan on_error.
|
793
596
|
|
794
597
|
```python
|
795
|
-
|
796
|
-
print(
|
797
|
-
print(list(batchmaker(s)))
|
598
|
+
l = [1, 3, 5]
|
599
|
+
print(get_by_index(l, 7))
|
798
600
|
```
|
799
601
|
|
800
602
|
Output:
|
801
603
|
```py
|
802
|
-
|
803
|
-
[]
|
604
|
+
None
|
804
605
|
```
|
805
606
|
|
806
|
-
##
|
607
|
+
## get_class_method
|
807
608
|
|
808
|
-
`
|
609
|
+
`get_class_method(cls)`
|
809
610
|
|
810
|
-
Mengembalikan
|
811
|
-
Mendukung perhitungan matematika dasar dengan satuan.
|
611
|
+
Mengembalikan berupa tuple yg berisi list dari method dalam class
|
812
612
|
|
813
|
-
|
814
|
-
|
613
|
+
```python
|
614
|
+
class ExampleGetClassMethod:
|
615
|
+
def a():
|
616
|
+
return [x for x in range(10)]
|
815
617
|
|
816
|
-
|
817
|
-
|
818
|
-
- f"{result:~H}" -> html
|
819
|
-
- result.to_base_units() -> SI
|
820
|
-
- result.to_compact() -> human readable
|
618
|
+
def b():
|
619
|
+
return [x for x in range(10)]
|
821
620
|
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
print(
|
829
|
-
print(
|
621
|
+
def c():
|
622
|
+
return [x for x in range(10)]
|
623
|
+
|
624
|
+
def d():
|
625
|
+
return [x for x in range(10)]
|
626
|
+
|
627
|
+
print(get_class_method(ExampleGetClassMethod))
|
628
|
+
print(list(get_class_method(ExampleGetClassMethod)))
|
830
629
|
```
|
831
630
|
|
832
631
|
Output:
|
833
632
|
```py
|
834
|
-
|
835
|
-
|
836
|
-
900.0 meter ** 3
|
837
|
-
90 cm·km·m
|
838
|
-
90 cm km m
|
633
|
+
<generator object get_class_method at 0x7384ac3100>
|
634
|
+
[<function ExampleGetClassMethod.a at 0x7384b544a0>, <function ExampleGetClassMethod.b at 0x7384b54720>, <function ExampleGetClassMethod.c at 0x7384b547c0>, <function ExampleGetClassMethod.d at 0x7384b54860>]
|
839
635
|
```
|
840
636
|
|
841
|
-
##
|
637
|
+
## get_filesize
|
842
638
|
|
843
|
-
`
|
639
|
+
`get_filesize(filename)`
|
844
640
|
|
845
|
-
|
846
|
-
Dengan tujuan untuk melihat perubahan secara langsung.
|
847
|
-
Pastikan kode aman untuk dijalankan.
|
848
|
-
Jalankan kode ini di terminal console.
|
641
|
+
Mengambil informasi file size dalam bytes
|
849
642
|
|
850
|
-
```
|
851
|
-
|
852
|
-
|
643
|
+
```python
|
644
|
+
print(get_filesize(__file__))
|
645
|
+
```
|
646
|
+
|
647
|
+
Output:
|
648
|
+
```py
|
649
|
+
465
|
853
650
|
```
|
854
651
|
|
855
652
|
## github_pull
|
@@ -883,37 +680,6 @@ menginput nya setiap saat.
|
|
883
680
|
github_user('my@emil.com', 'MyName')
|
884
681
|
```
|
885
682
|
|
886
|
-
## pip_freeze_without_version
|
887
|
-
|
888
|
-
`pip_freeze_without_version(filename=None)`
|
889
|
-
|
890
|
-
Memberikan list dari dependencies yang terinstall tanpa version.
|
891
|
-
Bertujuan untuk menggunakan Batteries Included Python.
|
892
|
-
|
893
|
-
```py
|
894
|
-
print(pip_freeze_without_version())
|
895
|
-
```
|
896
|
-
|
897
|
-
## poetry_publish
|
898
|
-
|
899
|
-
`poetry_publish(token=None)`
|
900
|
-
|
901
|
-
Publish project to pypi,org
|
902
|
-
|
903
|
-
```py
|
904
|
-
poetry_publish()
|
905
|
-
```
|
906
|
-
|
907
|
-
## poetry_update_version
|
908
|
-
|
909
|
-
`poetry_update_version(mayor=False, minor=False, patch=False)`
|
910
|
-
|
911
|
-
Update versi pada pyproject.toml menggunakan poetry
|
912
|
-
|
913
|
-
```py
|
914
|
-
poetry_update_version()
|
915
|
-
```
|
916
|
-
|
917
683
|
## iargv
|
918
684
|
|
919
685
|
`iargv(key: int, cast=None, on_error=None)`
|
@@ -931,92 +697,6 @@ Output:
|
|
931
697
|
```py
|
932
698
|
```
|
933
699
|
|
934
|
-
## idumps
|
935
|
-
|
936
|
-
`idumps(data, syntax='yaml', indent=4)`
|
937
|
-
|
938
|
-
Mengubah variabel data menjadi string untuk yang dapat dibaca untuk disimpan.
|
939
|
-
String yang dihasilkan berbentuk syntax YAML/JSON/HTML.
|
940
|
-
|
941
|
-
```python
|
942
|
-
data = {
|
943
|
-
'a': 123,
|
944
|
-
't': ['disini', 'senang', 'disana', 'senang'],
|
945
|
-
'l': (12, 23, [12, 42]),
|
946
|
-
}
|
947
|
-
print(idumps(data))
|
948
|
-
print(idumps(data, syntax='html'))
|
949
|
-
```
|
950
|
-
|
951
|
-
Output:
|
952
|
-
```py
|
953
|
-
a: 123
|
954
|
-
l: !!python/tuple
|
955
|
-
- 12
|
956
|
-
- 23
|
957
|
-
- - 12
|
958
|
-
- 42
|
959
|
-
t:
|
960
|
-
- disini
|
961
|
-
- senang
|
962
|
-
- disana
|
963
|
-
- senang
|
964
|
-
|
965
|
-
<table>
|
966
|
-
<tbody>
|
967
|
-
<tr>
|
968
|
-
<th>a</th>
|
969
|
-
<td>
|
970
|
-
<span>123</span>
|
971
|
-
</td>
|
972
|
-
</tr>
|
973
|
-
<tr>
|
974
|
-
<th>t</th>
|
975
|
-
<td>
|
976
|
-
<ul>
|
977
|
-
<li>
|
978
|
-
<span>disini</span>
|
979
|
-
</li>
|
980
|
-
<li>
|
981
|
-
<span>senang</span>
|
982
|
-
</li>
|
983
|
-
<li>
|
984
|
-
<span>disana</span>
|
985
|
-
</li>
|
986
|
-
<li>
|
987
|
-
<span>senang</span>
|
988
|
-
</li>
|
989
|
-
</ul>
|
990
|
-
</td>
|
991
|
-
</tr>
|
992
|
-
<tr>
|
993
|
-
<th>l</th>
|
994
|
-
<td>
|
995
|
-
<ul>
|
996
|
-
<li>
|
997
|
-
<span>12</span>
|
998
|
-
</li>
|
999
|
-
<li>
|
1000
|
-
<span>23</span>
|
1001
|
-
</li>
|
1002
|
-
<li>
|
1003
|
-
<ul>
|
1004
|
-
<li>
|
1005
|
-
<span>12</span>
|
1006
|
-
</li>
|
1007
|
-
<li>
|
1008
|
-
<span>42</span>
|
1009
|
-
</li>
|
1010
|
-
</ul>
|
1011
|
-
</li>
|
1012
|
-
</ul>
|
1013
|
-
</td>
|
1014
|
-
</tr>
|
1015
|
-
</tbody>
|
1016
|
-
</table>
|
1017
|
-
|
1018
|
-
```
|
1019
|
-
|
1020
700
|
## idumps_html
|
1021
701
|
|
1022
702
|
`idumps_html(data, indent=None)`
|
@@ -1100,6 +780,92 @@ Output:
|
|
1100
780
|
|
1101
781
|
```
|
1102
782
|
|
783
|
+
## idumps
|
784
|
+
|
785
|
+
`idumps(data, syntax='yaml', indent=4)`
|
786
|
+
|
787
|
+
Mengubah variabel data menjadi string untuk yang dapat dibaca untuk disimpan.
|
788
|
+
String yang dihasilkan berbentuk syntax YAML/JSON/HTML.
|
789
|
+
|
790
|
+
```python
|
791
|
+
data = {
|
792
|
+
'a': 123,
|
793
|
+
't': ['disini', 'senang', 'disana', 'senang'],
|
794
|
+
'l': (12, 23, [12, 42]),
|
795
|
+
}
|
796
|
+
print(idumps(data))
|
797
|
+
print(idumps(data, syntax='html'))
|
798
|
+
```
|
799
|
+
|
800
|
+
Output:
|
801
|
+
```py
|
802
|
+
a: 123
|
803
|
+
l: !!python/tuple
|
804
|
+
- 12
|
805
|
+
- 23
|
806
|
+
- - 12
|
807
|
+
- 42
|
808
|
+
t:
|
809
|
+
- disini
|
810
|
+
- senang
|
811
|
+
- disana
|
812
|
+
- senang
|
813
|
+
|
814
|
+
<table>
|
815
|
+
<tbody>
|
816
|
+
<tr>
|
817
|
+
<th>a</th>
|
818
|
+
<td>
|
819
|
+
<span>123</span>
|
820
|
+
</td>
|
821
|
+
</tr>
|
822
|
+
<tr>
|
823
|
+
<th>t</th>
|
824
|
+
<td>
|
825
|
+
<ul>
|
826
|
+
<li>
|
827
|
+
<span>disini</span>
|
828
|
+
</li>
|
829
|
+
<li>
|
830
|
+
<span>senang</span>
|
831
|
+
</li>
|
832
|
+
<li>
|
833
|
+
<span>disana</span>
|
834
|
+
</li>
|
835
|
+
<li>
|
836
|
+
<span>senang</span>
|
837
|
+
</li>
|
838
|
+
</ul>
|
839
|
+
</td>
|
840
|
+
</tr>
|
841
|
+
<tr>
|
842
|
+
<th>l</th>
|
843
|
+
<td>
|
844
|
+
<ul>
|
845
|
+
<li>
|
846
|
+
<span>12</span>
|
847
|
+
</li>
|
848
|
+
<li>
|
849
|
+
<span>23</span>
|
850
|
+
</li>
|
851
|
+
<li>
|
852
|
+
<ul>
|
853
|
+
<li>
|
854
|
+
<span>12</span>
|
855
|
+
</li>
|
856
|
+
<li>
|
857
|
+
<span>42</span>
|
858
|
+
</li>
|
859
|
+
</ul>
|
860
|
+
</li>
|
861
|
+
</ul>
|
862
|
+
</td>
|
863
|
+
</tr>
|
864
|
+
</tbody>
|
865
|
+
</table>
|
866
|
+
|
867
|
+
```
|
868
|
+
|
1103
869
|
## ienv
|
1104
870
|
|
1105
871
|
`ienv(on_windows=None, on_linux=None)`
|
@@ -1163,7 +929,7 @@ print(ijoin(10, ' '))
|
|
1163
929
|
|
1164
930
|
Output:
|
1165
931
|
```py
|
1166
|
-
|
932
|
+
qweqw, weq, dfs, asd
|
1167
933
|
,ini,path,seperti,url,
|
1168
934
|
ini,path,seperti,url
|
1169
935
|
<li>satu</li>
|
@@ -1181,28 +947,6 @@ ini,path,seperti,url
|
|
1181
947
|
10
|
1182
948
|
```
|
1183
949
|
|
1184
|
-
## iloads
|
1185
|
-
|
1186
|
-
`iloads(data, syntax='yaml')`
|
1187
|
-
|
1188
|
-
Mengubah string data hasil dari idumps menjadi variabel.
|
1189
|
-
String data adalah berupa syntax YAML.
|
1190
|
-
|
1191
|
-
```python
|
1192
|
-
data = {
|
1193
|
-
'a': 123,
|
1194
|
-
't': ['disini', 'senang', 'disana', 'senang'],
|
1195
|
-
'l': (12, 23, [12, 42]),
|
1196
|
-
}
|
1197
|
-
s = idumps(data)
|
1198
|
-
print(iloads(s))
|
1199
|
-
```
|
1200
|
-
|
1201
|
-
Output:
|
1202
|
-
```py
|
1203
|
-
{'a': 123, 'l': (12, 23, [12, 42]), 't': ['disini', 'senang', 'disana', 'senang']}
|
1204
|
-
```
|
1205
|
-
|
1206
950
|
## iloads_html
|
1207
951
|
|
1208
952
|
`iloads_html(html)`
|
@@ -1229,9 +973,9 @@ Output:
|
|
1229
973
|
```py
|
1230
974
|
(['Home', 'Emas 1 Gram', 'History', 'Trend', 'Perak 1 Gram', 'Pluang'],
|
1231
975
|
[['Harga Emas Hari Ini - Senin, 29 April 2024'],
|
1232
|
-
['Spot Emas USD↓2.
|
976
|
+
['Spot Emas USD↓2.336,06 (-1,88) / oz',
|
1233
977
|
'Kurs IDR↑16.222,00 (+14,00) / USD',
|
1234
|
-
'Emas IDR
|
978
|
+
'Emas IDR↑1.218.371 (+72) / gr'],
|
1235
979
|
['LM Antam (Jual)↓1.325.000 (-1.000) / gr',
|
1236
980
|
'LM Antam (Beli)↓1.221.000 (-1.000) / gr']],
|
1237
981
|
[['Harga Emas Hari Ini'],
|
@@ -1302,10 +1046,10 @@ Output:
|
|
1302
1046
|
'Update harga LM Pegadaian :31 Agustus 2023']],
|
1303
1047
|
[['Spot Harga Emas Hari Ini (Market Open)'],
|
1304
1048
|
['Satuan', 'USD', 'Kurs\xa0Dollar', 'IDR'],
|
1305
|
-
['Ounce\xa0(oz)', '2.
|
1306
|
-
['Gram\xa0(gr)', '75,
|
1307
|
-
['Kilogram\xa0(kg)', '75.
|
1308
|
-
['Update harga emas :29 April 2024, pukul
|
1049
|
+
['Ounce\xa0(oz)', '2.336,06 (-1,88)', '16.222,00 (+14,00)', '37.895.565'],
|
1050
|
+
['Gram\xa0(gr)', '75,11', '16.222,00', '1.218.371 (+72)'],
|
1051
|
+
['Kilogram\xa0(kg)', '75.106,07', '16.222,00', '1.218.370.718'],
|
1052
|
+
['Update harga emas :29 April 2024, pukul 21:54Update kurs :29 April 2024, '
|
1309
1053
|
'pukul 13:10']],
|
1310
1054
|
[['Gram', 'UBS Gold 99.99%'],
|
1311
1055
|
['Jual', 'Beli'],
|
@@ -1351,36 +1095,36 @@ Output:
|
|
1351
1095
|
['Unit', 'USD', 'IDR'],
|
1352
1096
|
['Angka', '+/-', 'Angka', '+/-'],
|
1353
1097
|
['Hari Ini', 'Kurs', '', '', '16.208', '+14+0,09%'],
|
1354
|
-
['oz', '2.337,94', '-
|
1355
|
-
['gr', '75,17', '-0,
|
1098
|
+
['oz', '2.337,94', '-1,88-0,08%', '37.893.332', '+2.234+0,01%'],
|
1099
|
+
['gr', '75,17', '-0,06-0,08%', '1.218.299', '+72+0,01%'],
|
1356
1100
|
['30 Hari', 'Kurs', '', '', '15.853', '+369+2,33%'],
|
1357
|
-
['oz', '2.232,75', '+
|
1358
|
-
['gr', '71,78', '+3,
|
1101
|
+
['oz', '2.232,75', '+103,31+4,63%', '35.395.786', '+2.499.780+7,06%'],
|
1102
|
+
['gr', '71,78', '+3,32+4,63%', '1.138.001', '+80.370+7,06%'],
|
1359
1103
|
['2 Bulan', 'Kurs', '', '', '15.673', '+549+3,50%'],
|
1360
|
-
['oz', '2.045,83', '+
|
1361
|
-
['gr', '65,77', '+9,
|
1104
|
+
['oz', '2.045,83', '+290,23+14,19%', '32.064.294', '+5.831.272+18,19%'],
|
1105
|
+
['gr', '65,77', '+9,33+14,19', '1.030.891', '+187.480+18,19%'],
|
1362
1106
|
['6 Bulan', 'Kurs', '', '', '15.897', '+325+2,04%'],
|
1363
|
-
['oz', '1.977,80', '+
|
1364
|
-
['gr', '63,59', '+11,
|
1107
|
+
['oz', '1.977,80', '+358,26+18,11%', '31.441.087', '+6.454.479+20,53%'],
|
1108
|
+
['gr', '63,59', '+11,52+18,11%', '1.010.854', '+207.516+20,53%'],
|
1365
1109
|
['1 Tahun', 'Kurs', '', '', '15.731', '+491+3,12%'],
|
1366
|
-
['oz', '1.823,86', '+
|
1367
|
-
['gr', '58,64', '+16,
|
1110
|
+
['oz', '1.823,86', '+512,20+28,08%', '28.691.142', '+9.204.424+32,08%'],
|
1111
|
+
['gr', '58,64', '+16,47+28,08%', '922.442', '+295.929+32,08%'],
|
1368
1112
|
['2 Tahun', 'Kurs', '', '', '14.418', '+1.804+12,51%'],
|
1369
|
-
['oz', '1.896,95', '+
|
1370
|
-
['gr', '60,99', '+14,
|
1113
|
+
['oz', '1.896,95', '+439,11+23,15%', '27.350.225', '+10.545.340+38,56%'],
|
1114
|
+
['gr', '60,99', '+14,12+23,15%', '879.330', '+339.041+38,56%'],
|
1371
1115
|
['3 Tahun', 'Kurs', '', '', '14.468', '+1.754+12,12%'],
|
1372
|
-
['oz', '1.767,08', '+
|
1373
|
-
['gr', '56,81', '+18,
|
1116
|
+
['oz', '1.767,08', '+568,98+32,20%', '25.566.113', '+12.329.452+48,23%'],
|
1117
|
+
['gr', '56,81', '+18,29+32,20%', '821.970', '+396.401+48,23%'],
|
1374
1118
|
['5 Tahun', 'Kurs', '', '', '14.215', '+2.007+14,12%'],
|
1375
|
-
['oz', '1.280,61', '+1.
|
1376
|
-
['gr', '41,17', '+33,
|
1119
|
+
['oz', '1.280,61', '+1.055,45+82,42%', '18.203.871', '+19.691.694+108,17%'],
|
1120
|
+
['gr', '41,17', '+33,93+82,42%', '585.268', '+633.103+108,17%']])
|
1377
1121
|
(['Home', 'Emas 1 Gram', 'History', 'Trend', 'Perak 1 Gram', 'Pluang'],
|
1378
1122
|
[[''],
|
1379
1123
|
['Emas 24 KaratHarga Emas 1 Gram', ''],
|
1380
|
-
['USD', '75,
|
1381
|
-
['KURS', '16.
|
1382
|
-
['IDR', '1.
|
1383
|
-
['Senin, 29 April 2024
|
1124
|
+
['USD', '75,11↓', '-0,06-0,08%'],
|
1125
|
+
['KURS', '16.230,40↓', '-10,90-0,07%'],
|
1126
|
+
['IDR', '1.219.048,57↓', '-1.753,37-0,14%'],
|
1127
|
+
['Senin, 29 April 2024 21:55']],
|
1384
1128
|
[[''],
|
1385
1129
|
['Emas 1 Gram (IDR)Emas 1 Gram (USD)Kurs USD-IDR',
|
1386
1130
|
'Hari Ini',
|
@@ -1391,19 +1135,71 @@ Output:
|
|
1391
1135
|
'']],
|
1392
1136
|
[['Pergerakkan Harga Emas 1 Gram'],
|
1393
1137
|
['', 'Penutupan Kemarin', 'Pergerakkan Hari Ini', 'Rata-rata'],
|
1394
|
-
['USD', '75,17', '75,
|
1395
|
-
['KURS', '16.241,30', '16.
|
1396
|
-
['IDR', '1.220.801,94', '1.
|
1138
|
+
['USD', '75,17', '75,11 - 75,17', '75,14'],
|
1139
|
+
['KURS', '16.241,30', '16.230,40 - 16.241,30', '16.235,85'],
|
1140
|
+
['IDR', '1.220.801,94', '1.219.048,57 - 1.220.801,94', '1.219.925,26'],
|
1397
1141
|
[''],
|
1398
1142
|
['', 'Awal Tahun', 'Pergerakkan YTD', '+/- YTD'],
|
1399
|
-
['USD', '66,32', '64,07 - 77,14', '+8,
|
1400
|
-
['KURS', '15.390,10', '15.390,00 - 16.307,80', '+
|
1401
|
-
['IDR', '1.020.729,53', '997.660,12 - 1.256.829,06', '+
|
1143
|
+
['USD', '66,32', '64,07 - 77,14', '+8,79 (13,25%)'],
|
1144
|
+
['KURS', '15.390,10', '15.390,00 - 16.307,80', '+840,30 (5,46%)'],
|
1145
|
+
['IDR', '1.020.729,53', '997.660,12 - 1.256.829,06', '+198.319,04 (19,43%)'],
|
1402
1146
|
[''],
|
1403
1147
|
['', 'Tahun Lalu / 52 Minggu', 'Pergerakkan 52 Minggu', '+/- 52 Minggu'],
|
1404
|
-
['USD', '64,04', '58,43 - 77,14', '+11,
|
1405
|
-
['KURS', '14.671,35', '14.669,40 - 16.307,80', '+1.
|
1406
|
-
['IDR', '939.568,98', '912.925,68 - 1.256.829,06', '+
|
1148
|
+
['USD', '64,04', '58,43 - 77,14', '+11,07 (17,29%)'],
|
1149
|
+
['KURS', '14.671,35', '14.669,40 - 16.307,80', '+1.559,05 (10,63%)'],
|
1150
|
+
['IDR', '939.568,98', '912.925,68 - 1.256.829,06', '+279.479,59 (29,75%)']])
|
1151
|
+
```
|
1152
|
+
|
1153
|
+
## iloads
|
1154
|
+
|
1155
|
+
`iloads(data, syntax='yaml')`
|
1156
|
+
|
1157
|
+
Mengubah string data hasil dari idumps menjadi variabel.
|
1158
|
+
String data adalah berupa syntax YAML.
|
1159
|
+
|
1160
|
+
```python
|
1161
|
+
data = {
|
1162
|
+
'a': 123,
|
1163
|
+
't': ['disini', 'senang', 'disana', 'senang'],
|
1164
|
+
'l': (12, 23, [12, 42]),
|
1165
|
+
}
|
1166
|
+
s = idumps(data)
|
1167
|
+
print(iloads(s))
|
1168
|
+
```
|
1169
|
+
|
1170
|
+
Output:
|
1171
|
+
```py
|
1172
|
+
{'a': 123, 'l': (12, 23, [12, 42]), 't': ['disini', 'senang', 'disana', 'senang']}
|
1173
|
+
```
|
1174
|
+
|
1175
|
+
## input_char
|
1176
|
+
|
1177
|
+
`input_char(prompt=None, prompt_ending='', newline_after_input=True, echo_char=True, default=None)`
|
1178
|
+
|
1179
|
+
Meminta masukan satu huruf tanpa menekan Enter.
|
1180
|
+
|
1181
|
+
```py
|
1182
|
+
input_char("Input char : ")
|
1183
|
+
input_char("Input char : ", default='Y')
|
1184
|
+
input_char("Input Char without print : ", echo_char=False)
|
1185
|
+
```
|
1186
|
+
|
1187
|
+
## is_valid_url
|
1188
|
+
|
1189
|
+
`is_valid_url(path)`
|
1190
|
+
|
1191
|
+
Mengecek apakah path merupakan URL yang valid atau tidak.
|
1192
|
+
Cara ini merupakan cara yang paling efektif.
|
1193
|
+
|
1194
|
+
```python
|
1195
|
+
print(is_valid_url("https://chat.openai.com/?model=text-davinci-002-render-sha"))
|
1196
|
+
print(is_valid_url("https://chat.openai.com/?model/=text-dav/inci-002-render-sha"))
|
1197
|
+
```
|
1198
|
+
|
1199
|
+
Output:
|
1200
|
+
```py
|
1201
|
+
True
|
1202
|
+
True
|
1407
1203
|
```
|
1408
1204
|
|
1409
1205
|
## iopen
|
@@ -1443,234 +1239,448 @@ print(iopen("https://www.google.com/", dict(coba="dulu"), xpath="//a"))
|
|
1443
1239
|
|
1444
1240
|
Output:
|
1445
1241
|
```py
|
1446
|
-
8
|
1447
|
-
['mana', 'aja']
|
1448
|
-
[<Element a at
|
1449
|
-
False
|
1242
|
+
8
|
1243
|
+
['mana', 'aja']
|
1244
|
+
[<Element a at 0x7384b59090>, <Element a at 0x7384b94910>, <Element a at 0x7384b949b0>, <Element a at 0x7384b94a00>, <Element a at 0x7384b94a50>, <Element a at 0x7384b94aa0>, <Element a at 0x7384b94af0>, <Element a at 0x7384b94b40>, <Element a at 0x7384b94b90>, <Element a at 0x7384b94be0>, <Element a at 0x7384b94c30>, <Element a at 0x7384b94c80>, <Element a at 0x7384b94cd0>, <Element a at 0x7384b94d20>, <Element a at 0x7384b94d70>, <Element a at 0x7384b94dc0>, <Element a at 0x7384b94e10>, <Element a at 0x7384b94e60>, <Element a at 0x7384b94eb0>, <Element a at 0x7384b94f00>]
|
1245
|
+
False
|
1246
|
+
```
|
1247
|
+
|
1248
|
+
## iprint
|
1249
|
+
|
1250
|
+
`iprint(*args, color=None, sort_dicts=False, **kwargs)`
|
1251
|
+
|
1252
|
+
Improve print function dengan menambahkan color dan pretty print
|
1253
|
+
Color menggunakan colorama Fore + Back + Style
|
1254
|
+
|
1255
|
+
```python
|
1256
|
+
import colorama
|
1257
|
+
iprint(
|
1258
|
+
'yang ini',
|
1259
|
+
{'12':12,'sdsd':{'12':21,'as':[88]}},
|
1260
|
+
color=colorama.Fore.BLUE + colorama.Style.BRIGHT
|
1261
|
+
)
|
1262
|
+
```
|
1263
|
+
|
1264
|
+
Output:
|
1265
|
+
```py
|
1266
|
+
[34m[1myang ini[0m [34m[1m{'12': 12, 'sdsd': {'12': 21, 'as': [88]}}[0m
|
1267
|
+
```
|
1268
|
+
|
1269
|
+
## ireplace
|
1270
|
+
|
1271
|
+
`ireplace(string: str, replacements: dict, flags=re.IGNORECASE|re.MULTILINE|re.DOTALL)`
|
1272
|
+
|
1273
|
+
STRing TRanslate mengubah string menggunakan kamus dari dict.
|
1274
|
+
Replacement dapat berupa text biasa ataupun regex pattern.
|
1275
|
+
Apabila replacement berupa regex, gunakan raw string `r"..."`
|
1276
|
+
Untuk regex capturing gunakan `(...)`, dan untuk mengaksesnya
|
1277
|
+
gunakan `\1`, `\2`, .., dst.
|
1278
|
+
|
1279
|
+
```python
|
1280
|
+
text = 'aku ini mau ke sini'
|
1281
|
+
replacements = {
|
1282
|
+
"sini": "situ",
|
1283
|
+
r"(ini)": r"itu dan \1",
|
1284
|
+
}
|
1285
|
+
print(ireplace(text, replacements))
|
1286
|
+
```
|
1287
|
+
|
1288
|
+
Output:
|
1289
|
+
```py
|
1290
|
+
aku itu dan ini mau ke situ
|
1291
|
+
```
|
1292
|
+
|
1293
|
+
## iscandir
|
1294
|
+
|
1295
|
+
`iscandir(folder_name='.', glob_pattern='*', recursive=True, scan_file=True, scan_folder=True)`
|
1296
|
+
|
1297
|
+
Mempermudah scandir untuk mengumpulkan folder dan file.
|
1298
|
+
|
1299
|
+
```python
|
1300
|
+
print(iscandir())
|
1301
|
+
print(list(iscandir("./", recursive=False, scan_file=False)))
|
1302
|
+
```
|
1303
|
+
|
1304
|
+
Output:
|
1305
|
+
```py
|
1306
|
+
<generator object iscandir at 0x7384b48540>
|
1307
|
+
[PosixPath('.git'), PosixPath('.vscode'), PosixPath('pypipr'), PosixPath('__pycache__'), PosixPath('dist')]
|
1308
|
+
```
|
1309
|
+
|
1310
|
+
## isplit
|
1311
|
+
|
1312
|
+
`isplit(text, separator='', include_separator=False)`
|
1313
|
+
|
1314
|
+
Memecah text menjadi list berdasarkan separator.
|
1315
|
+
|
1316
|
+
```python
|
1317
|
+
t = '/ini/contoh/path/'
|
1318
|
+
print(isplit(t, separator='/'))
|
1319
|
+
```
|
1320
|
+
|
1321
|
+
Output:
|
1322
|
+
```py
|
1323
|
+
['', 'ini', 'contoh', 'path', '']
|
1324
|
+
```
|
1325
|
+
|
1326
|
+
## ivars
|
1327
|
+
|
1328
|
+
`ivars(obj, skip_underscore=True)`
|
1329
|
+
|
1330
|
+
Membuat dictionary berdasarkan kategori untuk setiap
|
1331
|
+
member dari object.
|
1332
|
+
|
1333
|
+
```python
|
1334
|
+
iprint(ivars(__import__('pypipr')))
|
1335
|
+
```
|
1336
|
+
|
1337
|
+
Output:
|
1338
|
+
```py
|
1339
|
+
{'class': {'APIMixinView': <class 'pypipr.APIMixinView.APIMixinView'>,
|
1340
|
+
'ComparePerformance': <class 'pypipr.ComparePerformance.ComparePerformance'>,
|
1341
|
+
'PintUregQuantity': <class 'pint.Quantity'>,
|
1342
|
+
'RunParallel': <class 'pypipr.RunParallel.RunParallel'>},
|
1343
|
+
'function': {'avg': <function avg at 0x7393816700>,
|
1344
|
+
'get_filemtime': <function get_filemtime at 0x738aecf2e0>,
|
1345
|
+
'print_colorize': <function print_colorize at 0x738aecf4c0>,
|
1346
|
+
'print_log': <function print_log at 0x738af92b60>,
|
1347
|
+
'console_run': <function console_run at 0x738aecf380>,
|
1348
|
+
'auto_reload': <function auto_reload at 0x738aebbec0>,
|
1349
|
+
'basename': <function basename at 0x738aecf240>,
|
1350
|
+
'chr_to_int': <function chr_to_int at 0x738aecfa60>,
|
1351
|
+
'int_to_chr': <function int_to_chr at 0x738aecfb00>,
|
1352
|
+
'irange': <function irange at 0x738aecf920>,
|
1353
|
+
'batchmaker': <function batchmaker at 0x738aecf740>,
|
1354
|
+
'calculate': <function calculate at 0x738aecfba0>,
|
1355
|
+
'batch_calculate': <function batch_calculate at 0x738aecf600>,
|
1356
|
+
'is_iterable': <function is_iterable at 0x738aecfc40>,
|
1357
|
+
'print_to_last_line': <function print_to_last_line at 0x738aecfce0>,
|
1358
|
+
'text_colorize': <function text_colorize at 0x738aecfd80>,
|
1359
|
+
'choices': <function choices at 0x738aecf6a0>,
|
1360
|
+
'chunk_array': <function chunk_array at 0x738aecf7e0>,
|
1361
|
+
'create_folder': <function create_folder at 0x738aecfe20>,
|
1362
|
+
'datetime_from_string': <function datetime_from_string at 0x738aecfec0>,
|
1363
|
+
'datetime_now': <function datetime_now at 0x738aecff60>,
|
1364
|
+
'dict_first': <function dict_first at 0x738acf8040>,
|
1365
|
+
'dirname': <function dirname at 0x738acf80e0>,
|
1366
|
+
'is_empty': <function is_empty at 0x738acf82c0>,
|
1367
|
+
'exit_if_empty': <function exit_if_empty at 0x738aecf560>,
|
1368
|
+
'to_str': <function to_str at 0x738acf8400>,
|
1369
|
+
'filter_empty': <function filter_empty at 0x738acf8180>,
|
1370
|
+
'get_by_index': <function get_by_index at 0x738acf8360>,
|
1371
|
+
'get_class_method': <function get_class_method at 0x738acf84a0>,
|
1372
|
+
'get_filesize': <function get_filesize at 0x738acf85e0>,
|
1373
|
+
'github_pull': <function github_pull at 0x738acf8680>,
|
1374
|
+
'github_push': <function github_push at 0x738acf8860>,
|
1375
|
+
'github_user': <function github_user at 0x738acf8900>,
|
1376
|
+
'iargv': <function iargv at 0x738acf8720>,
|
1377
|
+
'idumps_html': <function idumps_html at 0x738acf8b80>,
|
1378
|
+
'idumps': <function idumps at 0x738acf8a40>,
|
1379
|
+
'ienv': <function ienv at 0x738acf9080>,
|
1380
|
+
'iexec': <function iexec at 0x738add13a0>,
|
1381
|
+
'ijoin': <function ijoin at 0x738add1580>,
|
1382
|
+
'iloads_html': <function iloads_html at 0x738add1760>,
|
1383
|
+
'iloads': <function iloads at 0x738add14e0>,
|
1384
|
+
'input_char': <function input_char at 0x738add16c0>,
|
1385
|
+
'is_valid_url': <function is_valid_url at 0x738add1940>,
|
1386
|
+
'iopen': <function iopen at 0x738abd9da0>,
|
1387
|
+
'iprint': <function iprint at 0x738add18a0>,
|
1388
|
+
'ireplace': <function ireplace at 0x738add1c60>,
|
1389
|
+
'iscandir': <function iscandir at 0x738ac9d4e0>,
|
1390
|
+
'isplit': <function isplit at 0x738ac9d580>,
|
1391
|
+
'ivars': <function ivars at 0x738ac9d620>,
|
1392
|
+
'log': <function log at 0x738ac9d6c0>,
|
1393
|
+
'password_generator': <function password_generator at 0x738ac9d760>,
|
1394
|
+
'pip_freeze_without_version': <function pip_freeze_without_version at 0x738ac9d8a0>,
|
1395
|
+
'poetry_publish': <function poetry_publish at 0x738ac9d940>,
|
1396
|
+
'poetry_update_version': <function poetry_update_version at 0x738ac9da80>,
|
1397
|
+
'print_dir': <function print_dir at 0x738ac9dc60>,
|
1398
|
+
'random_bool': <function random_bool at 0x738ac9dd00>,
|
1399
|
+
'restart': <function restart at 0x738ac9dda0>,
|
1400
|
+
'set_timeout': <function set_timeout at 0x738ac9de40>,
|
1401
|
+
'sets_ordered': <function sets_ordered at 0x738ac9dee0>,
|
1402
|
+
'str_cmp': <function str_cmp at 0x738ac9df80>},
|
1403
|
+
'variable': {'LINUX': True,
|
1404
|
+
'PintUreg': <pint.registry.UnitRegistry object at 0x73939fbf50>,
|
1405
|
+
'WINDOWS': False},
|
1406
|
+
'module': {'asyncio': <module 'asyncio' from '/data/data/com.termux/files/usr/lib/python3.11/asyncio/__init__.py'>,
|
1407
|
+
'colorama': <module 'colorama' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/colorama/__init__.py'>,
|
1408
|
+
'csv': <module 'csv' from '/data/data/com.termux/files/usr/lib/python3.11/csv.py'>,
|
1409
|
+
'datetime': <module 'datetime' from '/data/data/com.termux/files/usr/lib/python3.11/datetime.py'>,
|
1410
|
+
'functools': <module 'functools' from '/data/data/com.termux/files/usr/lib/python3.11/functools.py'>,
|
1411
|
+
'inspect': <module 'inspect' from '/data/data/com.termux/files/usr/lib/python3.11/inspect.py'>,
|
1412
|
+
'io': <module 'io' (frozen)>,
|
1413
|
+
'json': <module 'json' from '/data/data/com.termux/files/usr/lib/python3.11/json/__init__.py'>,
|
1414
|
+
'lxml': <module 'lxml' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/lxml/__init__.py'>,
|
1415
|
+
'math': <module 'math' from '/data/data/com.termux/files/usr/lib/python3.11/lib-dynload/math.cpython-311.so'>,
|
1416
|
+
'multiprocessing': <module 'multiprocessing' from '/data/data/com.termux/files/usr/lib/python3.11/multiprocessing/__init__.py'>,
|
1417
|
+
'operator': <module 'operator' from '/data/data/com.termux/files/usr/lib/python3.11/operator.py'>,
|
1418
|
+
'os': <module 'os' (frozen)>,
|
1419
|
+
'pathlib': <module 'pathlib' from '/data/data/com.termux/files/usr/lib/python3.11/pathlib.py'>,
|
1420
|
+
'pint': <module 'pint' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/pint/__init__.py'>,
|
1421
|
+
'pprint': <module 'pprint' from '/data/data/com.termux/files/usr/lib/python3.11/pprint.py'>,
|
1422
|
+
'queue': <module 'queue' from '/data/data/com.termux/files/usr/lib/python3.11/queue.py'>,
|
1423
|
+
'random': <module 'random' from '/data/data/com.termux/files/usr/lib/python3.11/random.py'>,
|
1424
|
+
're': <module 're' from '/data/data/com.termux/files/usr/lib/python3.11/re/__init__.py'>,
|
1425
|
+
'requests': <module 'requests' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/requests/__init__.py'>,
|
1426
|
+
'string': <module 'string' from '/data/data/com.termux/files/usr/lib/python3.11/string.py'>,
|
1427
|
+
'subprocess': <module 'subprocess' from '/data/data/com.termux/files/usr/lib/python3.11/subprocess.py'>,
|
1428
|
+
'sys': <module 'sys' (built-in)>,
|
1429
|
+
'textwrap': <module 'textwrap' from '/data/data/com.termux/files/usr/lib/python3.11/textwrap.py'>,
|
1430
|
+
'threading': <module 'threading' from '/data/data/com.termux/files/usr/lib/python3.11/threading.py'>,
|
1431
|
+
'time': <module 'time' (built-in)>,
|
1432
|
+
'tzdata': <module 'tzdata' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/tzdata/__init__.py'>,
|
1433
|
+
'uuid': <module 'uuid' from '/data/data/com.termux/files/usr/lib/python3.11/uuid.py'>,
|
1434
|
+
'webbrowser': <module 'webbrowser' from '/data/data/com.termux/files/usr/lib/python3.11/webbrowser.py'>,
|
1435
|
+
'yaml': <module 'yaml' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/yaml/__init__.py'>,
|
1436
|
+
'zoneinfo': <module 'zoneinfo' from '/data/data/com.termux/files/usr/lib/python3.11/zoneinfo/__init__.py'>}}
|
1437
|
+
```
|
1438
|
+
|
1439
|
+
## log
|
1440
|
+
|
1441
|
+
`log(text=None)`
|
1442
|
+
|
1443
|
+
Decorator untuk mempermudah pembuatan log karena tidak perlu mengubah
|
1444
|
+
fungsi yg sudah ada.
|
1445
|
+
Melakukan print ke console untuk menginformasikan proses yg sedang
|
1446
|
+
berjalan didalam program.
|
1447
|
+
|
1448
|
+
```py
|
1449
|
+
@log
|
1450
|
+
def some_function():
|
1451
|
+
pass
|
1452
|
+
|
1453
|
+
@log()
|
1454
|
+
def some_function_again():
|
1455
|
+
pass
|
1456
|
+
|
1457
|
+
@log("Calling some function")
|
1458
|
+
def some_function_more():
|
1459
|
+
pass
|
1460
|
+
|
1461
|
+
some_function()
|
1462
|
+
some_function_again()
|
1463
|
+
some_function_more()
|
1464
|
+
```
|
1465
|
+
|
1466
|
+
## password_generator
|
1467
|
+
|
1468
|
+
`password_generator(length=8, characters='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~')`
|
1469
|
+
|
1470
|
+
Membuat pssword secara acak
|
1471
|
+
|
1472
|
+
```python
|
1473
|
+
print(password_generator())
|
1474
|
+
```
|
1475
|
+
|
1476
|
+
Output:
|
1477
|
+
```py
|
1478
|
+
br3+8mbt
|
1450
1479
|
```
|
1451
1480
|
|
1452
|
-
##
|
1481
|
+
## pip_freeze_without_version
|
1453
1482
|
|
1454
|
-
`
|
1483
|
+
`pip_freeze_without_version(filename=None)`
|
1455
1484
|
|
1456
|
-
|
1457
|
-
|
1485
|
+
Memberikan list dari dependencies yang terinstall tanpa version.
|
1486
|
+
Bertujuan untuk menggunakan Batteries Included Python.
|
1458
1487
|
|
1459
|
-
```
|
1460
|
-
|
1461
|
-
iprint(
|
1462
|
-
'yang ini',
|
1463
|
-
{'12':12,'sdsd':{'12':21,'as':[88]}},
|
1464
|
-
color=colorama.Fore.BLUE + colorama.Style.BRIGHT
|
1465
|
-
)
|
1488
|
+
```py
|
1489
|
+
print(pip_freeze_without_version())
|
1466
1490
|
```
|
1467
1491
|
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1492
|
+
## poetry_publish
|
1493
|
+
|
1494
|
+
`poetry_publish(token=None)`
|
1495
|
+
|
1496
|
+
Publish project to pypi,org
|
1497
|
+
|
1498
|
+
```py
|
1499
|
+
poetry_publish()
|
1471
1500
|
```
|
1472
1501
|
|
1473
|
-
##
|
1502
|
+
## poetry_update_version
|
1474
1503
|
|
1475
|
-
`
|
1504
|
+
`poetry_update_version(mayor=False, minor=False, patch=False)`
|
1476
1505
|
|
1477
|
-
|
1506
|
+
Update versi pada pyproject.toml menggunakan poetry
|
1507
|
+
|
1508
|
+
```py
|
1509
|
+
poetry_update_version()
|
1510
|
+
```
|
1511
|
+
|
1512
|
+
## print_dir
|
1513
|
+
|
1514
|
+
`print_dir(var, colorize=True)`
|
1515
|
+
|
1516
|
+
Print property dan method yang tersedia pada variabel
|
1478
1517
|
|
1479
1518
|
```python
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
print(list(irange(1, '7')))
|
1484
|
-
print(list(irange(10, 5)))
|
1519
|
+
import pathlib
|
1520
|
+
p = pathlib.Path("https://www.google.com/")
|
1521
|
+
print_dir(p, colorize=False)
|
1485
1522
|
```
|
1486
1523
|
|
1487
1524
|
Output:
|
1488
1525
|
```py
|
1489
|
-
|
1490
|
-
|
1491
|
-
['
|
1492
|
-
|
1493
|
-
|
1526
|
+
__bytes__ : b'https:/www.google.com'
|
1527
|
+
__class__ : .
|
1528
|
+
__dir__ : ['__module__', '__doc__', '__slots__', '__new__', '_make_child_relpath', '__enter__', '__exit__', 'cwd', 'home', 'samefile', 'iterdir', '_scandir', 'glob', 'rglob', 'absolute', 'resolve', 'stat', 'owner', 'group', 'open', 'read_bytes', 'read_text', 'write_bytes', 'write_text', 'readlink', 'touch', 'mkdir', 'chmod', 'lchmod', 'unlink', 'rmdir', 'lstat', 'rename', 'replace', 'symlink_to', 'hardlink_to', 'link_to', 'exists', 'is_dir', 'is_file', 'is_mount', 'is_symlink', 'is_block_device', 'is_char_device', 'is_fifo', 'is_socket', 'expanduser', '__reduce__', '_parse_args', '_from_parts', '_from_parsed_parts', '_format_parsed_parts', '_make_child', '__str__', '__fspath__', 'as_posix', '__bytes__', '__repr__', 'as_uri', '_cparts', '__eq__', '__hash__', '__lt__', '__le__', '__gt__', '__ge__', 'drive', 'root', 'anchor', 'name', 'suffix', 'suffixes', 'stem', 'with_name', 'with_stem', 'with_suffix', 'relative_to', 'is_relative_to', 'parts', 'joinpath', '__truediv__', '__rtruediv__', 'parent', 'parents', 'is_absolute', 'is_reserved', 'match', '_cached_cparts', '_drv', '_hash', '_parts', '_pparts', '_root', '_str', '__getattribute__', '__setattr__', '__delattr__', '__ne__', '__init__', '__reduce_ex__', '__getstate__', '__subclasshook__', '__init_subclass__', '__format__', '__sizeof__', '__dir__', '__class__', '_flavour']
|
1529
|
+
__doc__ : Path subclass for non-Windows systems.
|
1530
|
+
|
1531
|
+
On a POSIX system, instantiating a Path should return this object.
|
1532
|
+
|
1533
|
+
__enter__ : https:/www.google.com
|
1534
|
+
__fspath__ : https:/www.google.com
|
1535
|
+
__getstate__ : (None, {'_drv': '', '_root': '', '_parts': ['https:', 'www.google.com'], '_str': 'https:/www.google.com'})
|
1536
|
+
__hash__ : 9538007634898831
|
1537
|
+
__init__ : None
|
1538
|
+
__init_subclass__ : None
|
1539
|
+
__module__ : pathlib
|
1540
|
+
__reduce__ : (<class 'pathlib.PosixPath'>, ('https:', 'www.google.com'))
|
1541
|
+
__repr__ : PosixPath('https:/www.google.com')
|
1542
|
+
__sizeof__ : 72
|
1543
|
+
__slots__ : ()
|
1544
|
+
__str__ : https:/www.google.com
|
1545
|
+
__subclasshook__ : NotImplemented
|
1546
|
+
_cached_cparts : ['https:', 'www.google.com']
|
1547
|
+
_cparts : ['https:', 'www.google.com']
|
1548
|
+
_drv :
|
1549
|
+
_flavour : <pathlib._PosixFlavour object at 0x73966307d0>
|
1550
|
+
_hash : 9538007634898831
|
1551
|
+
_parts : ['https:', 'www.google.com']
|
1552
|
+
_root :
|
1553
|
+
_str : https:/www.google.com
|
1554
|
+
absolute : /data/data/com.termux/files/home/pypipr/https:/www.google.com
|
1555
|
+
anchor :
|
1556
|
+
as_posix : https:/www.google.com
|
1557
|
+
cwd : /data/data/com.termux/files/home/pypipr
|
1558
|
+
drive :
|
1559
|
+
exists : False
|
1560
|
+
expanduser : https:/www.google.com
|
1561
|
+
home : /data/data/com.termux/files/home
|
1562
|
+
is_absolute : False
|
1563
|
+
is_block_device : False
|
1564
|
+
is_char_device : False
|
1565
|
+
is_dir : False
|
1566
|
+
is_fifo : False
|
1567
|
+
is_file : False
|
1568
|
+
is_mount : False
|
1569
|
+
is_reserved : False
|
1570
|
+
is_socket : False
|
1571
|
+
is_symlink : False
|
1572
|
+
iterdir : <generator object Path.iterdir at 0x7384b51fc0>
|
1573
|
+
joinpath : https:/www.google.com
|
1574
|
+
name : www.google.com
|
1575
|
+
parent : https:
|
1576
|
+
parents : <PosixPath.parents>
|
1577
|
+
parts : ('https:', 'www.google.com')
|
1578
|
+
resolve : /data/data/com.termux/files/home/pypipr/https:/www.google.com
|
1579
|
+
root :
|
1580
|
+
stem : www.google
|
1581
|
+
suffix : .com
|
1582
|
+
suffixes : ['.google', '.com']
|
1494
1583
|
```
|
1495
1584
|
|
1496
|
-
##
|
1585
|
+
## random_bool
|
1497
1586
|
|
1498
|
-
`
|
1587
|
+
`random_bool()`
|
1499
1588
|
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
gunakan `\1`, `\2`, .., dst.
|
1589
|
+
Menghasilkan nilai random True atau False.
|
1590
|
+
Fungsi ini merupakan fungsi tercepat untuk mendapatkan random bool.
|
1591
|
+
Fungsi ini sangat cepat, tetapi pemanggilan fungsi ini membutuhkan
|
1592
|
+
overhead yg besar.
|
1505
1593
|
|
1506
1594
|
```python
|
1507
|
-
|
1508
|
-
replacements = {
|
1509
|
-
"sini": "situ",
|
1510
|
-
r"(ini)": r"itu dan \1",
|
1511
|
-
}
|
1512
|
-
print(ireplace(text, replacements))
|
1595
|
+
print(random_bool())
|
1513
1596
|
```
|
1514
1597
|
|
1515
1598
|
Output:
|
1516
1599
|
```py
|
1517
|
-
|
1600
|
+
False
|
1518
1601
|
```
|
1519
1602
|
|
1520
|
-
##
|
1603
|
+
## restart
|
1521
1604
|
|
1522
|
-
`
|
1605
|
+
`restart(*argv)`
|
1523
1606
|
|
1524
|
-
|
1607
|
+
## set_timeout
|
1608
|
+
|
1609
|
+
`set_timeout(interval, func, args=None, kwargs=None)`
|
1610
|
+
|
1611
|
+
Menjalankan fungsi ketika sudah sekian detik.
|
1612
|
+
Apabila timeout masih berjalan tapi kode sudah selesai dieksekusi semua, maka
|
1613
|
+
program tidak akan berhenti sampai timeout selesai, kemudian fungsi dijalankan,
|
1614
|
+
kemudian program dihentikan.
|
1525
1615
|
|
1526
1616
|
```python
|
1527
|
-
print(
|
1528
|
-
|
1617
|
+
set_timeout(3, lambda: print("Timeout 3"))
|
1618
|
+
x = set_timeout(7, print, args=["Timeout 7"])
|
1619
|
+
print(x)
|
1620
|
+
print("menghentikan timeout 7")
|
1621
|
+
x.cancel()
|
1529
1622
|
```
|
1530
1623
|
|
1531
1624
|
Output:
|
1532
1625
|
```py
|
1533
|
-
<
|
1534
|
-
|
1626
|
+
<Timer(Thread-2, started 496119037168)>
|
1627
|
+
menghentikan timeout 7
|
1535
1628
|
```
|
1536
1629
|
|
1537
|
-
##
|
1630
|
+
## sets_ordered
|
1538
1631
|
|
1539
|
-
`
|
1632
|
+
`sets_ordered(iterator)`
|
1540
1633
|
|
1541
|
-
|
1634
|
+
Hanya mengambil nilai unik dari suatu list
|
1542
1635
|
|
1543
1636
|
```python
|
1544
|
-
|
1545
|
-
print(
|
1637
|
+
array = [2, 3, 12, 3, 3, 42, 42, 1, 43, 2, 42, 41, 4, 24, 32, 42, 3, 12, 32, 42, 42]
|
1638
|
+
print(sets_ordered(array))
|
1639
|
+
print(list(sets_ordered(array)))
|
1546
1640
|
```
|
1547
1641
|
|
1548
1642
|
Output:
|
1549
1643
|
```py
|
1550
|
-
|
1644
|
+
<generator object sets_ordered at 0x7384b70a00>
|
1645
|
+
[2, 3, 12, 42, 1, 43, 41, 4, 24, 32]
|
1551
1646
|
```
|
1552
1647
|
|
1553
|
-
##
|
1648
|
+
## str_cmp
|
1554
1649
|
|
1555
|
-
`
|
1650
|
+
`str_cmp(t1, t2)`
|
1556
1651
|
|
1557
|
-
|
1558
|
-
|
1652
|
+
Membandingakan string secara incase-sensitive menggunakan lower().
|
1653
|
+
Lebih cepat dibandingkan upper(), casefold(), re.fullmatch(), len().
|
1654
|
+
perbandingan ini sangat cepat, tetapi pemanggilan fungsi ini membutuhkan
|
1655
|
+
overhead yg besar.
|
1559
1656
|
|
1560
1657
|
```python
|
1561
|
-
|
1658
|
+
print(str_cmp('teks1', 'Teks1'))
|
1562
1659
|
```
|
1563
1660
|
|
1564
1661
|
Output:
|
1565
1662
|
```py
|
1566
|
-
|
1567
|
-
'iconsole': <module 'pypipr.iconsole' from '/data/data/com.termux/files/home/pypipr/pypipr/iconsole/__init__.py'>,
|
1568
|
-
'idjango': <module 'pypipr.idjango' from '/data/data/com.termux/files/home/pypipr/pypipr/idjango/__init__.py'>,
|
1569
|
-
'iengineering': <module 'pypipr.iengineering' from '/data/data/com.termux/files/home/pypipr/pypipr/iengineering/__init__.py'>,
|
1570
|
-
'ifunctions': <module 'pypipr.ifunctions' from '/data/data/com.termux/files/home/pypipr/pypipr/ifunctions/__init__.py'>,
|
1571
|
-
'iflow': <module 'pypipr.iflow' (<_frozen_importlib_external.NamespaceLoader object at 0x7d54e4bcd0>)>,
|
1572
|
-
'asyncio': <module 'asyncio' from '/data/data/com.termux/files/usr/lib/python3.11/asyncio/__init__.py'>,
|
1573
|
-
'colorama': <module 'colorama' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/colorama/__init__.py'>,
|
1574
|
-
'csv': <module 'csv' from '/data/data/com.termux/files/usr/lib/python3.11/csv.py'>,
|
1575
|
-
'datetime': <module 'datetime' from '/data/data/com.termux/files/usr/lib/python3.11/datetime.py'>,
|
1576
|
-
'functools': <module 'functools' from '/data/data/com.termux/files/usr/lib/python3.11/functools.py'>,
|
1577
|
-
'inspect': <module 'inspect' from '/data/data/com.termux/files/usr/lib/python3.11/inspect.py'>,
|
1578
|
-
'io': <module 'io' (frozen)>,
|
1579
|
-
'json': <module 'json' from '/data/data/com.termux/files/usr/lib/python3.11/json/__init__.py'>,
|
1580
|
-
'lxml': <module 'lxml' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/lxml/__init__.py'>,
|
1581
|
-
'math': <module 'math' from '/data/data/com.termux/files/usr/lib/python3.11/lib-dynload/math.cpython-311.so'>,
|
1582
|
-
'multiprocessing': <module 'multiprocessing' from '/data/data/com.termux/files/usr/lib/python3.11/multiprocessing/__init__.py'>,
|
1583
|
-
'operator': <module 'operator' from '/data/data/com.termux/files/usr/lib/python3.11/operator.py'>,
|
1584
|
-
'os': <module 'os' (frozen)>,
|
1585
|
-
'pathlib': <module 'pathlib' from '/data/data/com.termux/files/usr/lib/python3.11/pathlib.py'>,
|
1586
|
-
'pint': <module 'pint' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/pint/__init__.py'>,
|
1587
|
-
'pprint': <module 'pprint' from '/data/data/com.termux/files/usr/lib/python3.11/pprint.py'>,
|
1588
|
-
'queue': <module 'queue' from '/data/data/com.termux/files/usr/lib/python3.11/queue.py'>,
|
1589
|
-
'random': <module 'random' from '/data/data/com.termux/files/usr/lib/python3.11/random.py'>,
|
1590
|
-
're': <module 're' from '/data/data/com.termux/files/usr/lib/python3.11/re/__init__.py'>,
|
1591
|
-
'requests': <module 'requests' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/requests/__init__.py'>,
|
1592
|
-
'string': <module 'string' from '/data/data/com.termux/files/usr/lib/python3.11/string.py'>,
|
1593
|
-
'subprocess': <module 'subprocess' from '/data/data/com.termux/files/usr/lib/python3.11/subprocess.py'>,
|
1594
|
-
'sys': <module 'sys' (built-in)>,
|
1595
|
-
'textwrap': <module 'textwrap' from '/data/data/com.termux/files/usr/lib/python3.11/textwrap.py'>,
|
1596
|
-
'threading': <module 'threading' from '/data/data/com.termux/files/usr/lib/python3.11/threading.py'>,
|
1597
|
-
'time': <module 'time' (built-in)>,
|
1598
|
-
'tzdata': <module 'tzdata' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/tzdata/__init__.py'>,
|
1599
|
-
'uuid': <module 'uuid' from '/data/data/com.termux/files/usr/lib/python3.11/uuid.py'>,
|
1600
|
-
'webbrowser': <module 'webbrowser' from '/data/data/com.termux/files/usr/lib/python3.11/webbrowser.py'>,
|
1601
|
-
'yaml': <module 'yaml' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/yaml/__init__.py'>,
|
1602
|
-
'zoneinfo': <module 'zoneinfo' from '/data/data/com.termux/files/usr/lib/python3.11/zoneinfo/__init__.py'>},
|
1603
|
-
'class': {'ComparePerformance': <class 'pypipr.ibuiltins.ComparePerformance.ComparePerformance'>,
|
1604
|
-
'RunParallel': <class 'pypipr.ibuiltins.RunParallel.RunParallel'>,
|
1605
|
-
'APIMixinView': <class 'pypipr.idjango.APIMixinView.APIMixinView'>,
|
1606
|
-
'PintUregQuantity': <class 'pint.Quantity'>},
|
1607
|
-
'variable': {'LINUX': True,
|
1608
|
-
'WINDOWS': False,
|
1609
|
-
'PintUreg': <pint.registry.UnitRegistry object at 0x7d5af1b750>},
|
1610
|
-
'function': {'avg': <function avg at 0x7d645b6d40>,
|
1611
|
-
'basename': <function basename at 0x7d6457e8e0>,
|
1612
|
-
'chr_to_int': <function chr_to_int at 0x7d60385080>,
|
1613
|
-
'chunk_array': <function chunk_array at 0x7d603851c0>,
|
1614
|
-
'create_folder': <function create_folder at 0x7d603853a0>,
|
1615
|
-
'datetime_from_string': <function datetime_from_string at 0x7d60385580>,
|
1616
|
-
'datetime_now': <function datetime_now at 0x7d6042d620>,
|
1617
|
-
'dict_first': <function dict_first at 0x7d6042d580>,
|
1618
|
-
'dirname': <function dirname at 0x7d6042d4e0>,
|
1619
|
-
'exit_if_empty': <function exit_if_empty at 0x7d6042d3a0>,
|
1620
|
-
'filter_empty': <function filter_empty at 0x7d6042d1c0>,
|
1621
|
-
'get_by_index': <function get_by_index at 0x7d6042ce00>,
|
1622
|
-
'get_class_method': <function get_class_method at 0x7d6042ccc0>,
|
1623
|
-
'get_filemtime': <function get_filemtime at 0x7d6042cb80>,
|
1624
|
-
'get_filesize': <function get_filesize at 0x7d6042c9a0>,
|
1625
|
-
'int_to_chr': <function int_to_chr at 0x7d6042c900>,
|
1626
|
-
'is_empty': <function is_empty at 0x7d6042d260>,
|
1627
|
-
'is_iterable': <function is_iterable at 0x7d6042cfe0>,
|
1628
|
-
'is_valid_url': <function is_valid_url at 0x7d6042c7c0>,
|
1629
|
-
'password_generator': <function password_generator at 0x7d6042c680>,
|
1630
|
-
'random_bool': <function random_bool at 0x7d6042c4a0>,
|
1631
|
-
'restart': <function restart at 0x7d6042f7e0>,
|
1632
|
-
'set_timeout': <function set_timeout at 0x7d6042f920>,
|
1633
|
-
'sets_ordered': <function sets_ordered at 0x7d6042fa60>,
|
1634
|
-
'str_cmp': <function str_cmp at 0x7d6042fb00>,
|
1635
|
-
'to_str': <function to_str at 0x7d6042cf40>,
|
1636
|
-
'choices': <function choices at 0x7d6042fba0>,
|
1637
|
-
'console_run': <function console_run at 0x7d6042fe20>,
|
1638
|
-
'input_char': <function input_char at 0x7d6042ff60>,
|
1639
|
-
'log': <function log at 0x7d60450180>,
|
1640
|
-
'print_colorize': <function print_colorize at 0x7d60450220>,
|
1641
|
-
'print_dir': <function print_dir at 0x7d60450360>,
|
1642
|
-
'print_log': <function print_log at 0x7d60450040>,
|
1643
|
-
'print_to_last_line': <function print_to_last_line at 0x7d6042fd80>,
|
1644
|
-
'text_colorize': <function text_colorize at 0x7d6042fec0>,
|
1645
|
-
'batch_calculate': <function batch_calculate at 0x7d54e516c0>,
|
1646
|
-
'batchmaker': <function batchmaker at 0x7d54e52340>,
|
1647
|
-
'calculate': <function calculate at 0x7d54e52700>,
|
1648
|
-
'auto_reload': <function auto_reload at 0x7d54e523e0>,
|
1649
|
-
'github_pull': <function github_pull at 0x7d54e525c0>,
|
1650
|
-
'github_push': <function github_push at 0x7d54e52b60>,
|
1651
|
-
'github_user': <function github_user at 0x7d54b7a0c0>,
|
1652
|
-
'pip_freeze_without_version': <function pip_freeze_without_version at 0x7d54b7a160>,
|
1653
|
-
'poetry_publish': <function poetry_publish at 0x7d54b7a020>,
|
1654
|
-
'poetry_update_version': <function poetry_update_version at 0x7d54b9eb60>,
|
1655
|
-
'iargv': <function iargv at 0x7d50bfc2c0>,
|
1656
|
-
'idumps': <function idumps at 0x7d50bfc400>,
|
1657
|
-
'idumps_html': <function idumps_html at 0x7d50c68e00>,
|
1658
|
-
'ienv': <function ienv at 0x7d50bfc540>,
|
1659
|
-
'iexec': <function iexec at 0x7d50c69080>,
|
1660
|
-
'ijoin': <function ijoin at 0x7d54b7a340>,
|
1661
|
-
'iloads': <function iloads at 0x7d50c69120>,
|
1662
|
-
'iloads_html': <function iloads_html at 0x7d50c693a0>,
|
1663
|
-
'iopen': <function iopen at 0x7d54b7a3e0>,
|
1664
|
-
'iprint': <function iprint at 0x7d50c69260>,
|
1665
|
-
'irange': <function irange at 0x7d54e52520>,
|
1666
|
-
'ireplace': <function ireplace at 0x7d50c69440>,
|
1667
|
-
'iscandir': <function iscandir at 0x7d50c6b060>,
|
1668
|
-
'isplit': <function isplit at 0x7d50c6b100>,
|
1669
|
-
'ivars': <function ivars at 0x7d50c6b1a0>}}
|
1663
|
+
True
|
1670
1664
|
```
|
1671
1665
|
|
1672
1666
|
# CLASS
|
1673
1667
|
|
1668
|
+
## APIMixinView
|
1669
|
+
|
1670
|
+
`APIMixinView()`
|
1671
|
+
|
1672
|
+
APIView adalah class view untuk membuat Website API
|
1673
|
+
Cara kerjanya adalah dengan menggunakan variabel GET untuk menerima data.
|
1674
|
+
|
1675
|
+
Class ini tidak bisa digunakan sendiri.
|
1676
|
+
Class ini harus menjadi mixin Class View karena perlu trigger untuk
|
1677
|
+
memanggil method get().
|
1678
|
+
|
1679
|
+
```py
|
1680
|
+
class ExampleAPIView(APIMixinView, View):
|
1681
|
+
pass
|
1682
|
+
```
|
1683
|
+
|
1674
1684
|
## ComparePerformance
|
1675
1685
|
|
1676
1686
|
`ComparePerformance()`
|
@@ -1706,7 +1716,7 @@ print(ExampleComparePerformance().compare_performance())
|
|
1706
1716
|
|
1707
1717
|
Output:
|
1708
1718
|
```py
|
1709
|
-
{'a': <generator object ExampleComparePerformance.a.<locals>.<genexpr> at
|
1719
|
+
{'a': <generator object ExampleComparePerformance.a.<locals>.<genexpr> at 0x7384b70450>,
|
1710
1720
|
'b': (0, 1, 2, 3, 4, 5, 6, 7, 8, 9),
|
1711
1721
|
'c': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
|
1712
1722
|
'd': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]}
|
@@ -1717,6 +1727,10 @@ Output:
|
|
1717
1727
|
{'a': 0, 'b': 0, 'c': 0, 'd': 0}
|
1718
1728
|
```
|
1719
1729
|
|
1730
|
+
## PintUregQuantity
|
1731
|
+
|
1732
|
+
`PintUregQuantity(value, units=None)`
|
1733
|
+
|
1720
1734
|
## RunParallel
|
1721
1735
|
|
1722
1736
|
`RunParallel()`
|
@@ -1819,23 +1833,3 @@ if __name__ == "__main__":
|
|
1819
1833
|
print(ExampleRunParallel().run_multi_processing())
|
1820
1834
|
```
|
1821
1835
|
|
1822
|
-
## APIMixinView
|
1823
|
-
|
1824
|
-
`APIMixinView()`
|
1825
|
-
|
1826
|
-
APIView adalah class view untuk membuat Website API
|
1827
|
-
Cara kerjanya adalah dengan menggunakan variabel GET untuk menerima data.
|
1828
|
-
|
1829
|
-
Class ini tidak bisa digunakan sendiri.
|
1830
|
-
Class ini harus menjadi mixin Class View karena perlu trigger untuk
|
1831
|
-
memanggil method get().
|
1832
|
-
|
1833
|
-
```py
|
1834
|
-
class ExampleAPIView(APIMixinView, View):
|
1835
|
-
pass
|
1836
|
-
```
|
1837
|
-
|
1838
|
-
## PintUregQuantity
|
1839
|
-
|
1840
|
-
`PintUregQuantity(value, units=None)`
|
1841
|
-
|