pypipr 1.0.107__py3-none-any.whl → 1.0.109__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.
Files changed (82) hide show
  1. pypipr/__init__.py +67 -67
  2. pypipr/{iflow/auto_reload.py → auto_reload.py} +10 -4
  3. pypipr/{iengineering/batchmaker.py → batchmaker.py} +2 -9
  4. pypipr/{iconsole/choices.py → choices.py} +2 -2
  5. pypipr/{ibuiltins/chr_to_int.py → chr_to_int.py} +2 -2
  6. pypipr/{ibuiltins/create_folder.py → create_folder.py} +0 -6
  7. pypipr/{ibuiltins/datetime_now.py → datetime_now.py} +0 -5
  8. pypipr/{iflow/github_pull.py → github_pull.py} +1 -5
  9. pypipr/{iflow/github_push.py → github_push.py} +3 -3
  10. pypipr/{iflow/github_user.py → github_user.py} +1 -1
  11. pypipr/{ifunctions/ienv.py → ienv.py} +2 -2
  12. pypipr/{ifunctions/ijoin.py → ijoin.py} +3 -3
  13. pypipr/{iconsole/input_char.py → input_char.py} +2 -2
  14. pypipr/{ifunctions/iopen.py → iopen.py} +2 -2
  15. pypipr/{ifunctions/iprint.py → iprint.py} +1 -1
  16. pypipr/irange.py +58 -0
  17. pypipr/{iflow/pip_freeze_without_version.py → pip_freeze_without_version.py} +4 -4
  18. pypipr/{iflow/poetry_publish.py → poetry_publish.py} +1 -1
  19. pypipr/{iflow/poetry_update_version.py → poetry_update_version.py} +1 -1
  20. pypipr/{iconsole/print_dir.py → print_dir.py} +1 -1
  21. {pypipr-1.0.107.dist-info → pypipr-1.0.109.dist-info}/METADATA +902 -964
  22. pypipr-1.0.109.dist-info/RECORD +73 -0
  23. pypipr/ibuiltins/__init__.py +0 -0
  24. pypipr/iconsole/__init__.py +0 -0
  25. pypipr/idjango/__init__.py +0 -0
  26. pypipr/iengineering/__init__.py +0 -0
  27. pypipr/ifunctions/__init__.py +0 -0
  28. pypipr/ifunctions/irange.py +0 -39
  29. pypipr/ifunctions/irange.py.bak +0 -81
  30. pypipr/pypipr.py.bak +0 -37
  31. pypipr-1.0.107.dist-info/RECORD +0 -80
  32. /pypipr/{idjango/APIMixinView.py → APIMixinView.py} +0 -0
  33. /pypipr/{ibuiltins/ComparePerformance.py → ComparePerformance.py} +0 -0
  34. /pypipr/{ibuiltins/LINUX.py → LINUX.py} +0 -0
  35. /pypipr/{iengineering/PintUreg.py → PintUreg.py} +0 -0
  36. /pypipr/{iengineering/PintUregQuantity.py → PintUregQuantity.py} +0 -0
  37. /pypipr/{ibuiltins/RunParallel.py → RunParallel.py} +0 -0
  38. /pypipr/{ibuiltins/WINDOWS.py → WINDOWS.py} +0 -0
  39. /pypipr/{terminal.py → __terminal__.py} +0 -0
  40. /pypipr/{ibuiltins/avg.py → avg.py} +0 -0
  41. /pypipr/{ibuiltins/basename.py → basename.py} +0 -0
  42. /pypipr/{iengineering/batch_calculate.py → batch_calculate.py} +0 -0
  43. /pypipr/{iengineering/calculate.py → calculate.py} +0 -0
  44. /pypipr/{ibuiltins/chunk_array.py → chunk_array.py} +0 -0
  45. /pypipr/{iconsole/console_run.py → console_run.py} +0 -0
  46. /pypipr/{ibuiltins/datetime_from_string.py → datetime_from_string.py} +0 -0
  47. /pypipr/{ibuiltins/dict_first.py → dict_first.py} +0 -0
  48. /pypipr/{ibuiltins/dirname.py → dirname.py} +0 -0
  49. /pypipr/{ibuiltins/exit_if_empty.py → exit_if_empty.py} +0 -0
  50. /pypipr/{ibuiltins/filter_empty.py → filter_empty.py} +0 -0
  51. /pypipr/{ibuiltins/get_by_index.py → get_by_index.py} +0 -0
  52. /pypipr/{ibuiltins/get_class_method.py → get_class_method.py} +0 -0
  53. /pypipr/{ibuiltins/get_filemtime.py → get_filemtime.py} +0 -0
  54. /pypipr/{ibuiltins/get_filesize.py → get_filesize.py} +0 -0
  55. /pypipr/{ifunctions/iargv.py → iargv.py} +0 -0
  56. /pypipr/{ifunctions/idumps.py → idumps.py} +0 -0
  57. /pypipr/{ifunctions/idumps_html.py → idumps_html.py} +0 -0
  58. /pypipr/{ifunctions/iexec.py → iexec.py} +0 -0
  59. /pypipr/{ifunctions/iloads.py → iloads.py} +0 -0
  60. /pypipr/{ifunctions/iloads_html.py → iloads_html.py} +0 -0
  61. /pypipr/{ibuiltins/int_to_chr.py → int_to_chr.py} +0 -0
  62. /pypipr/{ifunctions/ireplace.py → ireplace.py} +0 -0
  63. /pypipr/{ibuiltins/is_empty.py → is_empty.py} +0 -0
  64. /pypipr/{ibuiltins/is_iterable.py → is_iterable.py} +0 -0
  65. /pypipr/{ibuiltins/is_valid_url.py → is_valid_url.py} +0 -0
  66. /pypipr/{ifunctions/iscandir.py → iscandir.py} +0 -0
  67. /pypipr/{ifunctions/isplit.py → isplit.py} +0 -0
  68. /pypipr/{ifunctions/ivars.py → ivars.py} +0 -0
  69. /pypipr/{iconsole/log.py → log.py} +0 -0
  70. /pypipr/{ibuiltins/password_generator.py → password_generator.py} +0 -0
  71. /pypipr/{iconsole/print_colorize.py → print_colorize.py} +0 -0
  72. /pypipr/{iconsole/print_log.py → print_log.py} +0 -0
  73. /pypipr/{iconsole/print_to_last_line.py → print_to_last_line.py} +0 -0
  74. /pypipr/{ibuiltins/random_bool.py → random_bool.py} +0 -0
  75. /pypipr/{ibuiltins/restart.py → restart.py} +0 -0
  76. /pypipr/{ibuiltins/set_timeout.py → set_timeout.py} +0 -0
  77. /pypipr/{ibuiltins/sets_ordered.py → sets_ordered.py} +0 -0
  78. /pypipr/{ibuiltins/str_cmp.py → str_cmp.py} +0 -0
  79. /pypipr/{iconsole/text_colorize.py → text_colorize.py} +0 -0
  80. /pypipr/{ibuiltins/to_str.py → to_str.py} +0 -0
  81. {pypipr-1.0.107.dist-info → pypipr-1.0.109.dist-info}/WHEEL +0 -0
  82. {pypipr-1.0.107.dist-info → pypipr-1.0.109.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.107
3
+ Version: 1.0.109
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,112 @@ Output:
72
72
  16.285714285714285
73
73
  ```
74
74
 
75
- ## basename
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
- `chunk_array(array, size, start=0)`
77
+ `get_filemtime(filename)`
112
78
 
113
- Membagi array menjadi potongan-potongan dengan besaran yg diinginkan
79
+ Mengambil informasi last modification time file dalam nano seconds
114
80
 
115
81
  ```python
116
- arr = [2, 3, 12, 3, 3, 42, 42, 1, 43, 2, 42, 41, 4, 24, 32, 42, 3, 12, 32, 42, 42]
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
- <generator object chunk_array at 0x7d509d4040>
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
- ## create_folder
90
+ ## print_colorize
128
91
 
129
- `create_folder(folder_name)`
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
- Membuat folder.
132
- Membuat folder secara recursive dengan permission.
94
+ Print text dengan warna untuk menunjukan text penting
133
95
 
134
96
  ```py
135
- create_folder("contoh_membuat_folder")
136
- create_folder("contoh/membuat/folder/recursive")
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
- ## dirname
101
+ ## print_log
202
102
 
203
- `dirname(path)`
103
+ `print_log(text)`
204
104
 
205
- Mengembalikan nama folder dari path.
206
- Tanpa trailing slash di akhir.
105
+ Akan melakukan print ke console.
106
+ Berguna untuk memberikan informasi proses program yg sedang berjalan.
207
107
 
208
108
  ```python
209
- print(dirname("/ini/nama/folder/ke/file.py"))
109
+ print_log("Standalone Log")
210
110
  ```
211
111
 
212
112
  Output:
213
113
  ```py
214
- /ini/nama/folder/ke
114
+ >>> Standalone Log
215
115
  ```
216
116
 
217
- ## exit_if_empty
117
+ ## console_run
218
118
 
219
- `exit_if_empty(*args)`
119
+ `console_run(info, command=None, print_info=True, capture_output=False)`
220
120
 
221
- Keluar dari program apabila seluruh variabel
222
- setara dengan empty
121
+ Menjalankan command seperti menjalankan command di Command Terminal
223
122
 
224
123
  ```py
225
- var1 = None
226
- var2 = '0'
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
- ## get_class_method
128
+ ## auto_reload
264
129
 
265
- `get_class_method(cls)`
130
+ `auto_reload(filename)`
266
131
 
267
- Mengembalikan berupa tuple yg berisi list dari method dalam class
268
-
269
- ```python
270
- class ExampleGetClassMethod:
271
- def a():
272
- 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.
273
136
 
274
- def b():
275
- return [x for x in range(10)]
137
+ ```py
138
+ if __name__ == "__main__":
139
+ auto_reload("file_name.py")
276
140
 
277
- def c():
278
- return [x for x in range(10)]
141
+ ```
279
142
 
280
- def d():
281
- return [x for x in range(10)]
143
+ or run in terminal
282
144
 
283
- print(get_class_method(ExampleGetClassMethod))
284
- print(list(get_class_method(ExampleGetClassMethod)))
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>]
145
+ ```
146
+ pypipr auto_reload
291
147
  ```
292
148
 
293
- ## get_filemtime
149
+ ## basename
294
150
 
295
- `get_filemtime(filename)`
151
+ `basename(path)`
296
152
 
297
- Mengambil informasi last modification time file dalam nano seconds
153
+ Mengembalikan nama file dari path
298
154
 
299
155
  ```python
300
- print(get_filemtime(__file__))
156
+ print(basename("/ini/nama/folder/ke/file.py"))
301
157
  ```
302
158
 
303
159
  Output:
304
160
  ```py
305
- 1710697117516083632
161
+ file.py
306
162
  ```
307
163
 
308
- ## get_filesize
164
+ ## chr_to_int
309
165
 
310
- `get_filesize(filename)`
166
+ `chr_to_int(s, start=1, numbers='abcdefghijklmnopqrstuvwxyz')`
311
167
 
312
- Mengambil informasi file size dalam bytes
168
+ Fungsi ini berguna untuk mengubah urutan huruf menjadi angka.
313
169
 
314
170
  ```python
315
- print(get_filesize(__file__))
171
+ print(chr_to_int('z')) # Output: 26
172
+ print(chr_to_int('aa')) # Output: 27
173
+ print(chr_to_int('abc', numbers="abc")) # Output: 18
316
174
  ```
317
175
 
318
176
  Output:
319
177
  ```py
320
- 465
178
+ 26
179
+ 27
180
+ 18
321
181
  ```
322
182
 
323
183
  ## int_to_chr
@@ -369,197 +229,151 @@ Output:
369
229
  kmc
370
230
  ```
371
231
 
372
- ## is_empty
232
+ ## irange
373
233
 
374
- `is_empty(variable, empty=[None, False, 0, 0, '0', '', '-0', '\n', '\t', set(), {}, [], ()])`
234
+ `irange(start, stop=None, step=None, index=0, numbers='abcdefghijklmnopqrstuvwxyz')`
375
235
 
376
- Mengecek apakah variable setara dengan nilai kosong pada empty.
377
-
378
- Pengecekan nilai yang setara menggunakan simbol '==', sedangkan untuk
379
- pengecekan lokasi memory yang sama menggunakan keyword 'is'
236
+ Meningkatkan fungsi range() dari python untuk pengulangan menggunakan huruf
380
237
 
381
238
  ```python
382
- print(is_empty("teks"))
383
- print(is_empty(True))
384
- print(is_empty(False))
385
- print(is_empty(None))
386
- print(is_empty(0))
387
- print(is_empty([]))
239
+ print(irange('a', 'c'))
240
+ print(irange('z', 'a', 10))
241
+ print(list(irange('a', 'z', 10)))
242
+ print(list(irange(1, '7')))
243
+ print(list(irange(10, 5)))
388
244
  ```
389
245
 
390
246
  Output:
391
247
  ```py
392
- False
393
- False
394
- True
395
- True
396
- True
397
- True
248
+ <generator object str_range at 0x7253023cd0>
249
+ <generator object str_range at 0x7253023cd0>
250
+ ['a', 'k', 'u']
251
+ [1, 2, 3, 4, 5, 6]
252
+ [10, 9, 8, 7, 6]
398
253
  ```
399
254
 
400
- ## is_iterable
255
+ ## batchmaker
401
256
 
402
- `is_iterable(var, str_is_iterable=False)`
257
+ `batchmaker(pattern: str)`
403
258
 
404
- Mengecek apakah suatu variabel bisa dilakukan forloop atau tidak
259
+ Alat Bantu untuk membuat teks yang berulang.
260
+ Gunakan `{[start][separator][finish]([separator][step])}`.
261
+ ```
262
+ [start] dan [finish] -> bisa berupa huruf maupun angka
263
+ ([separator][step]) -> bersifat optional
264
+ [separator] -> selain huruf dan angka
265
+ [step] -> berupa angka positif
266
+ ```
405
267
 
406
268
  ```python
407
- s = 'ini string'
408
- print(is_iterable(s))
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()))
418
- ```
419
-
420
- Output:
421
- ```py
422
- False
423
- True
424
- True
425
- True
269
+ s = "Urutan {1/6/3} dan {10:9} dan {j k} dan {Z - A - 15} saja."
270
+ print(batchmaker(s))
271
+ print(list(batchmaker(s)))
426
272
  ```
427
273
 
428
- ## is_valid_url
274
+ ## calculate
429
275
 
430
- `is_valid_url(path)`
276
+ `calculate(teks)`
431
277
 
432
- Mengecek apakah path merupakan URL yang valid atau tidak.
433
- Cara ini merupakan cara yang paling efektif.
278
+ Mengembalikan hasil dari perhitungan teks menggunakan modul pint.
279
+ Mendukung perhitungan matematika dasar dengan satuan.
434
280
 
435
- ```python
436
- print(is_valid_url("https://chat.openai.com/?model=text-davinci-002-render-sha"))
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
281
+ Return value:
282
+ - Berupa class Quantity dari modul pint
451
283
 
452
- ```python
453
- print(password_generator())
454
- ```
455
-
456
- Output:
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.
284
+ Format:
285
+ - f"{result:~P}" -> pretty
286
+ - f"{result:~H}" -> html
287
+ - result.to_base_units() -> SI
288
+ - result.to_compact() -> human readable
469
289
 
470
290
  ```python
471
- print(random_bool())
291
+ fx = "3 meter * 10 cm * 3 km"
292
+ res = calculate(fx)
293
+ print(res)
294
+ print(res.to_base_units())
295
+ print(res.to_compact())
296
+ print(f"{res:~P}")
297
+ print(f"{res:~H}")
472
298
  ```
473
299
 
474
300
  Output:
475
301
  ```py
476
- True
302
+ 90 centimeter * kilometer * meter
303
+ 900.0 meter ** 3
304
+ 900.0 meter ** 3
305
+ 90 cm·km·m
306
+ 90 cm km m
477
307
  ```
478
308
 
479
- ## restart
480
-
481
- `restart(*argv)`
482
-
483
- ## set_timeout
309
+ ## batch_calculate
484
310
 
485
- `set_timeout(interval, func, args=None, kwargs=None)`
311
+ `batch_calculate(pattern)`
486
312
 
487
- Menjalankan fungsi ketika sudah sekian detik.
488
- Apabila timeout masih berjalan tapi kode sudah selesai dieksekusi semua, maka
489
- program tidak akan berhenti sampai timeout selesai, kemudian fungsi dijalankan,
490
- kemudian program dihentikan.
313
+ Analisa perhitungan massal.
314
+ Bisa digunakan untuk mencari alternatif terendah/tertinggi/dsb.
491
315
 
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
316
 
512
317
  ```python
513
- array = [2, 3, 12, 3, 3, 42, 42, 1, 43, 2, 42, 41, 4, 24, 32, 42, 3, 12, 32, 42, 42]
514
- print(sets_ordered(array))
515
- print(list(sets_ordered(array)))
318
+ print(batch_calculate("{1 10} m ** {1 3}"))
319
+ print(list(batch_calculate("{1 10} m ** {1 3}")))
516
320
  ```
517
321
 
518
322
  Output:
519
323
  ```py
520
- <generator object sets_ordered at 0x7d509e8110>
521
- [2, 3, 12, 42, 1, 43, 41, 4, 24, 32]
324
+ <generator object batch_calculate at 0x7252eeed40>
325
+ [('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
326
  ```
523
327
 
524
- ## str_cmp
328
+ ## is_iterable
525
329
 
526
- `str_cmp(t1, t2)`
330
+ `is_iterable(var, str_is_iterable=False)`
527
331
 
528
- Membandingakan string secara incase-sensitive menggunakan lower().
529
- Lebih cepat dibandingkan upper(), casefold(), re.fullmatch(), len().
530
- perbandingan ini sangat cepat, tetapi pemanggilan fungsi ini membutuhkan
531
- overhead yg besar.
332
+ Mengecek apakah suatu variabel bisa dilakukan forloop atau tidak
532
333
 
533
334
  ```python
534
- print(str_cmp('teks1', 'Teks1'))
335
+ s = 'ini string'
336
+ print(is_iterable(s))
337
+
338
+ l = [12,21,2,1]
339
+ print(is_iterable(l))
340
+
341
+ r = range(100)
342
+ print(is_iterable(r))
343
+
344
+ d = {'a':1, 'b':2}
345
+ print(is_iterable(d.values()))
535
346
  ```
536
347
 
537
348
  Output:
538
349
  ```py
350
+ False
351
+ True
352
+ True
539
353
  True
540
354
  ```
541
355
 
542
- ## to_str
356
+ ## print_to_last_line
543
357
 
544
- `to_str(value)`
358
+ `print_to_last_line(text: str, latest=1, clear=True)`
545
359
 
546
- Mengubah value menjadi string literal
360
+ Melakukan print ke konsol tetapi akan menimpa baris terakhir.
361
+ Berguna untuk memberikan progress secara interaktif.
547
362
 
548
- ```python
549
- print(to_str(5))
550
- print(to_str([]))
551
- print(to_str(False))
552
- print(to_str(True))
553
- print(to_str(None))
363
+ ```py
364
+ c = input("masukkan apa saja : ")
365
+ print_to_last_line(f"masukkan apa saja : {c} [ok]")
554
366
  ```
555
367
 
556
- Output:
557
- ```py
558
- 5
368
+ ## text_colorize
559
369
 
560
- False
561
- True
370
+ `text_colorize(text, color='\x1b[32m', bright='\x1b[1m', color_end='\x1b[0m')`
562
371
 
372
+ return text dengan warna untuk menunjukan text penting
373
+
374
+ ```py
375
+ text_colorize("Print some text")
376
+ text_colorize("Print some text", color=colorama.Fore.RED)
563
377
  ```
564
378
 
565
379
  ## choices
@@ -586,270 +400,254 @@ c = choices(
586
400
  )
587
401
  ```
588
402
 
589
- ## console_run
403
+ ## chunk_array
590
404
 
591
- `console_run(info, command=None, print_info=True, capture_output=False)`
405
+ `chunk_array(array, size, start=0)`
592
406
 
593
- Menjalankan command seperti menjalankan command di Command Terminal
407
+ Membagi array menjadi potongan-potongan dengan besaran yg diinginkan
594
408
 
595
- ```py
596
- console_run('dir')
597
- console_run('ls')
409
+ ```python
410
+ arr = [2, 3, 12, 3, 3, 42, 42, 1, 43, 2, 42, 41, 4, 24, 32, 42, 3, 12, 32, 42, 42]
411
+ print(chunk_array(arr, 5))
412
+ print(list(chunk_array(arr, 5)))
598
413
  ```
599
414
 
600
- ## input_char
415
+ Output:
416
+ ```py
417
+ <generator object chunk_array at 0x7252f50440>
418
+ [[2, 3, 12, 3, 3], [42, 42, 1, 43, 2], [42, 41, 4, 24, 32], [42, 3, 12, 32, 42], [42]]
419
+ ```
601
420
 
602
- `input_char(prompt=None, prompt_ending='', newline_after_input=True, echo_char=True, default=None)`
421
+ ## create_folder
603
422
 
604
- Meminta masukan satu huruf tanpa menekan Enter.
423
+ `create_folder(folder_name)`
424
+
425
+ Membuat folder.
426
+ Membuat folder secara recursive dengan permission.
605
427
 
606
428
  ```py
607
- input_char("Input char : ")
608
- input_char("Input char : ", default='Y')
609
- input_char("Input Char without print : ", echo_char=False)
429
+ create_folder("contoh_membuat_folder")
430
+ create_folder("contoh/membuat/folder/recursive")
431
+ create_folder("./contoh_membuat_folder/secara/recursive")
610
432
  ```
611
433
 
612
- ## log
434
+ ## datetime_from_string
613
435
 
614
- `log(text=None)`
436
+ `datetime_from_string(iso_string, timezone='UTC')`
615
437
 
616
- Decorator untuk mempermudah pembuatan log karena tidak perlu mengubah
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
438
+ Parse iso_string menjadi datetime object
633
439
 
634
- some_function()
635
- some_function_again()
636
- some_function_more()
440
+ ```python
441
+ print(datetime_from_string("2022-12-12 15:40:13").isoformat())
442
+ print(datetime_from_string(
443
+ "2022-12-12 15:40:13",
444
+ timezone="Asia/Jakarta"
445
+ ).isoformat())
637
446
  ```
638
447
 
639
- ## print_colorize
448
+ Output:
449
+ ```py
450
+ 2022-12-12T15:40:13+00:00
451
+ 2022-12-12T15:40:13+07:00
452
+ ```
640
453
 
641
- `print_colorize(text, color='\x1b[32m', bright='\x1b[1m', color_end='\x1b[0m', text_start='', text_end='\n', delay=0.05)`
454
+ ## datetime_now
642
455
 
643
- Print text dengan warna untuk menunjukan text penting
456
+ `datetime_now(timezone=None)`
457
+
458
+ Memudahkan dalam membuat Datetime untuk suatu timezone tertentu
644
459
 
645
- ```py
646
- print_colorize("Print some text")
647
- print_colorize("Print some text", color=colorama.Fore.RED)
460
+ ```python
461
+ print(datetime_now("Asia/Jakarta"))
462
+ print(datetime_now("GMT"))
463
+ print(datetime_now("Etc/GMT+7"))
648
464
  ```
649
465
 
650
- ## print_dir
466
+ Output:
467
+ ```py
468
+ 2024-04-30 12:59:48.069039+07:00
469
+ 2024-04-30 05:59:48.075135+00:00
470
+ 2024-04-29 22:59:48.089036-07:00
471
+ ```
651
472
 
652
- `print_dir(var, colorize=True)`
473
+ ## dict_first
653
474
 
654
- Print property dan method yang tersedia pada variabel
475
+ `dict_first(d: dict, remove=False)`
476
+
477
+ Mengambil nilai (key, value) pertama dari dictionary dalam bentuk tuple.
655
478
 
656
479
  ```python
657
- import pathlib
658
- p = pathlib.Path("https://www.google.com/")
659
- print_dir(p, colorize=False)
480
+ d = {
481
+ "key2": "value2",
482
+ "key3": "value3",
483
+ "key1": "value1",
484
+ }
485
+ print(dict_first(d, remove=True))
486
+ print(dict_first(d))
660
487
  ```
661
488
 
662
489
  Output:
663
490
  ```py
664
- __bytes__ : b'https:/www.google.com'
665
- __class__ : .
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']
491
+ ('key2', 'value2')
492
+ ('key3', 'value3')
721
493
  ```
722
494
 
723
- ## print_log
495
+ ## dirname
724
496
 
725
- `print_log(text)`
497
+ `dirname(path)`
726
498
 
727
- Akan melakukan print ke console.
728
- Berguna untuk memberikan informasi proses program yg sedang berjalan.
499
+ Mengembalikan nama folder dari path.
500
+ Tanpa trailing slash di akhir.
729
501
 
730
502
  ```python
731
- print_log("Standalone Log")
503
+ print(dirname("/ini/nama/folder/ke/file.py"))
732
504
  ```
733
505
 
734
506
  Output:
735
507
  ```py
736
- >>> Standalone Log
508
+ /ini/nama/folder/ke
737
509
  ```
738
510
 
739
- ## print_to_last_line
511
+ ## is_empty
740
512
 
741
- `print_to_last_line(text: str, latest=1, clear=True)`
513
+ `is_empty(variable, empty=[None, False, 0, 0, '0', '', '-0', '\n', '\t', set(), {}, [], ()])`
742
514
 
743
- Melakukan print ke konsol tetapi akan menimpa baris terakhir.
744
- Berguna untuk memberikan progress secara interaktif.
515
+ Mengecek apakah variable setara dengan nilai kosong pada empty.
745
516
 
746
- ```py
747
- c = input("masukkan apa saja : ")
748
- print_to_last_line(f"masukkan apa saja : {c} [ok]")
517
+ Pengecekan nilai yang setara menggunakan simbol '==', sedangkan untuk
518
+ pengecekan lokasi memory yang sama menggunakan keyword 'is'
519
+
520
+ ```python
521
+ print(is_empty("teks"))
522
+ print(is_empty(True))
523
+ print(is_empty(False))
524
+ print(is_empty(None))
525
+ print(is_empty(0))
526
+ print(is_empty([]))
749
527
  ```
750
528
 
751
- ## text_colorize
529
+ Output:
530
+ ```py
531
+ False
532
+ False
533
+ True
534
+ True
535
+ True
536
+ True
537
+ ```
752
538
 
753
- `text_colorize(text, color='\x1b[32m', bright='\x1b[1m', color_end='\x1b[0m')`
539
+ ## exit_if_empty
754
540
 
755
- return text dengan warna untuk menunjukan text penting
541
+ `exit_if_empty(*args)`
542
+
543
+ Keluar dari program apabila seluruh variabel
544
+ setara dengan empty
756
545
 
757
546
  ```py
758
- text_colorize("Print some text")
759
- text_colorize("Print some text", color=colorama.Fore.RED)
547
+ var1 = None
548
+ var2 = '0'
549
+ exit_if_empty(var1, var2)
760
550
  ```
761
551
 
762
- ## batch_calculate
552
+ ## to_str
763
553
 
764
- `batch_calculate(pattern)`
554
+ `to_str(value)`
765
555
 
766
- Analisa perhitungan massal.
767
- Bisa digunakan untuk mencari alternatif terendah/tertinggi/dsb.
556
+ Mengubah value menjadi string literal
768
557
 
558
+ ```python
559
+ print(to_str(5))
560
+ print(to_str([]))
561
+ print(to_str(False))
562
+ print(to_str(True))
563
+ print(to_str(None))
564
+ ```
565
+
566
+ Output:
567
+ ```py
568
+ 5
569
+
570
+ False
571
+ True
572
+
573
+ ```
574
+
575
+ ## filter_empty
576
+
577
+ `filter_empty(iterable, zero_is_empty=True, str_strip=True)`
578
+
579
+ Mengembalikan iterabel yang hanya memiliki nilai
769
580
 
770
581
  ```python
771
- print(batch_calculate("{1 10} m ** {1 3}"))
772
- print(list(batch_calculate("{1 10} m ** {1 3}")))
582
+ var = [1, None, False, 0, "0", True, {}, ['eee']]
583
+ print(filter_empty(var))
773
584
  ```
774
585
 
775
586
  Output:
776
587
  ```py
777
- <generator object batch_calculate at 0x7d50947c40>
778
- [('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')>)]
588
+ <generator object filter_empty at 0x7252eed300>
779
589
  ```
780
590
 
781
- ## batchmaker
591
+ ## get_by_index
782
592
 
783
- `batchmaker(pattern: str)`
593
+ `get_by_index(obj, index, on_error=None)`
784
594
 
785
- Alat Bantu untuk membuat teks yang berulang.
786
- Gunakan `{[start][separator][finish]([separator][step])}`.
787
- ```
788
- [start] dan [finish] -> bisa berupa huruf maupun angka
789
- ([separator][step]) -> bersifat optional
790
- [separator] -> selain huruf dan angka
791
- [step] -> berupa angka positif
792
- ```
595
+ Mendapatkan value dari object berdasarkan indexnya.
596
+ Jika error out of range maka akan mengembalikan on_error.
793
597
 
794
598
  ```python
795
- s = "Urutan {1/6/3} dan {10:9} dan {j k} dan {Z - A - 15} saja."
796
- print(batchmaker(s))
797
- print(list(batchmaker(s)))
599
+ l = [1, 3, 5]
600
+ print(get_by_index(l, 7))
798
601
  ```
799
602
 
800
603
  Output:
801
604
  ```py
802
- <generator object batchmaker at 0x7d509d8280>
803
- []
605
+ None
804
606
  ```
805
607
 
806
- ## calculate
608
+ ## get_class_method
807
609
 
808
- `calculate(teks)`
610
+ `get_class_method(cls)`
809
611
 
810
- Mengembalikan hasil dari perhitungan teks menggunakan modul pint.
811
- Mendukung perhitungan matematika dasar dengan satuan.
612
+ Mengembalikan berupa tuple yg berisi list dari method dalam class
812
613
 
813
- Return value:
814
- - Berupa class Quantity dari modul pint
614
+ ```python
615
+ class ExampleGetClassMethod:
616
+ def a():
617
+ return [x for x in range(10)]
815
618
 
816
- Format:
817
- - f"{result:~P}" -> pretty
818
- - f"{result:~H}" -> html
819
- - result.to_base_units() -> SI
820
- - result.to_compact() -> human readable
619
+ def b():
620
+ return [x for x in range(10)]
821
621
 
822
- ```python
823
- fx = "3 meter * 10 cm * 3 km"
824
- res = calculate(fx)
825
- print(res)
826
- print(res.to_base_units())
827
- print(res.to_compact())
828
- print(f"{res:~P}")
829
- print(f"{res:~H}")
622
+ def c():
623
+ return [x for x in range(10)]
624
+
625
+ def d():
626
+ return [x for x in range(10)]
627
+
628
+ print(get_class_method(ExampleGetClassMethod))
629
+ print(list(get_class_method(ExampleGetClassMethod)))
830
630
  ```
831
631
 
832
632
  Output:
833
633
  ```py
834
- 90 centimeter * kilometer * meter
835
- 900.0 meter ** 3
836
- 900.0 meter ** 3
837
- 90 cm·km·m
838
- 90 cm km m
634
+ <generator object get_class_method at 0x7252eef010>
635
+ [<function ExampleGetClassMethod.a at 0x7252f605e0>, <function ExampleGetClassMethod.b at 0x7252f60860>, <function ExampleGetClassMethod.c at 0x7252f60900>, <function ExampleGetClassMethod.d at 0x7252f609a0>]
839
636
  ```
840
637
 
841
- ## auto_reload
638
+ ## get_filesize
842
639
 
843
- `auto_reload(filename)`
640
+ `get_filesize(filename)`
844
641
 
845
- Menjalankan file python secara berulang.
846
- Dengan tujuan untuk melihat perubahan secara langsung.
847
- Pastikan kode aman untuk dijalankan.
848
- Jalankan kode ini di terminal console.
642
+ Mengambil informasi file size dalam bytes
849
643
 
850
- ```py
851
- if __name__ == "__main__":
852
- auto_reload("file_name.py")
644
+ ```python
645
+ print(get_filesize(__file__))
646
+ ```
647
+
648
+ Output:
649
+ ```py
650
+ 465
853
651
  ```
854
652
 
855
653
  ## github_pull
@@ -883,37 +681,6 @@ menginput nya setiap saat.
883
681
  github_user('my@emil.com', 'MyName')
884
682
  ```
885
683
 
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
684
  ## iargv
918
685
 
919
686
  `iargv(key: int, cast=None, on_error=None)`
@@ -931,92 +698,6 @@ Output:
931
698
  ```py
932
699
  ```
933
700
 
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
701
  ## idumps_html
1021
702
 
1022
703
  `idumps_html(data, indent=None)`
@@ -1100,6 +781,92 @@ Output:
1100
781
 
1101
782
  ```
1102
783
 
784
+ ## idumps
785
+
786
+ `idumps(data, syntax='yaml', indent=4)`
787
+
788
+ Mengubah variabel data menjadi string untuk yang dapat dibaca untuk disimpan.
789
+ String yang dihasilkan berbentuk syntax YAML/JSON/HTML.
790
+
791
+ ```python
792
+ data = {
793
+ 'a': 123,
794
+ 't': ['disini', 'senang', 'disana', 'senang'],
795
+ 'l': (12, 23, [12, 42]),
796
+ }
797
+ print(idumps(data))
798
+ print(idumps(data, syntax='html'))
799
+ ```
800
+
801
+ Output:
802
+ ```py
803
+ a: 123
804
+ l: !!python/tuple
805
+ - 12
806
+ - 23
807
+ - - 12
808
+ - 42
809
+ t:
810
+ - disini
811
+ - senang
812
+ - disana
813
+ - senang
814
+
815
+ <table>
816
+ <tbody>
817
+ <tr>
818
+ <th>a</th>
819
+ <td>
820
+ <span>123</span>
821
+ </td>
822
+ </tr>
823
+ <tr>
824
+ <th>t</th>
825
+ <td>
826
+ <ul>
827
+ <li>
828
+ <span>disini</span>
829
+ </li>
830
+ <li>
831
+ <span>senang</span>
832
+ </li>
833
+ <li>
834
+ <span>disana</span>
835
+ </li>
836
+ <li>
837
+ <span>senang</span>
838
+ </li>
839
+ </ul>
840
+ </td>
841
+ </tr>
842
+ <tr>
843
+ <th>l</th>
844
+ <td>
845
+ <ul>
846
+ <li>
847
+ <span>12</span>
848
+ </li>
849
+ <li>
850
+ <span>23</span>
851
+ </li>
852
+ <li>
853
+ <ul>
854
+ <li>
855
+ <span>12</span>
856
+ </li>
857
+ <li>
858
+ <span>42</span>
859
+ </li>
860
+ </ul>
861
+ </li>
862
+ </ul>
863
+ </td>
864
+ </tr>
865
+ </tbody>
866
+ </table>
867
+
868
+ ```
869
+
1103
870
  ## ienv
1104
871
 
1105
872
  `ienv(on_windows=None, on_linux=None)`
@@ -1163,7 +930,7 @@ print(ijoin(10, ' '))
1163
930
 
1164
931
  Output:
1165
932
  ```py
1166
- asd, weq, dfs, qweqw
933
+ weq, asd, qweqw, dfs
1167
934
  ,ini,path,seperti,url,
1168
935
  ini,path,seperti,url
1169
936
  <li>satu</li>
@@ -1181,28 +948,6 @@ ini,path,seperti,url
1181
948
  10
1182
949
  ```
1183
950
 
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
951
  ## iloads_html
1207
952
 
1208
953
  `iloads_html(html)`
@@ -1228,118 +973,61 @@ pprint.pprint(iloads_html(iopen("https://harga-emas.org/1-gram/")), depth=10)
1228
973
  Output:
1229
974
  ```py
1230
975
  (['Home', 'Emas 1 Gram', 'History', 'Trend', 'Perak 1 Gram', 'Pluang'],
1231
- [['Harga Emas Hari Ini - Senin, 29 April 2024'],
1232
- ['Spot Emas USD↓2.334,33 (-3,61) / oz',
1233
- 'Kurs IDR↑16.222,00 (+14,00) / USD',
1234
- 'Emas IDR↓1.217.468 (-830) / gr'],
1235
- ['LM Antam (Jual)1.325.000 (-1.000) / gr',
1236
- 'LM Antam (Beli)↓1.221.000 (-1.000) / gr']],
976
+ [['Harga Emas Hari Ini - Selasa, 30 April 2024'],
977
+ ['Spot Emas USD↓2.323,14 (-21,40) / oz',
978
+ 'Kurs IDR↑16.249,00 (+27,00) / USD',
979
+ 'Emas IDR↓1.213.649 (-9.145) / gr'],
980
+ ['LM Antam (Jual)1.325.000 / gr', 'LM Antam (Beli)1.221.000 / gr']],
1237
981
  [['Harga Emas Hari Ini'],
1238
982
  ['Gram', 'Gedung Antam Jakarta', 'Pegadaian'],
1239
983
  ['per Gram (Rp)', 'per Batangan (Rp)', 'per Gram (Rp)', 'per Batangan (Rp)'],
1240
984
  ['1000',
1241
- '1.266 (-1)',
1242
- '1.265.600 (-1.000)',
985
+ '1.266',
986
+ '1.265.600',
1243
987
  '1.043.040 (+8.200)',
1244
988
  '1.043.040.000 (+8.200.000)'],
1245
989
  ['500',
1246
- '2.531 (-2)',
1247
- '1.265.640 (-1.000)',
990
+ '2.531',
991
+ '1.265.640',
1248
992
  '1.043.082 (+8.200)',
1249
993
  '521.541.000 (+4.100.000)'],
1250
994
  ['250',
1251
- '5.064 (-4)',
1252
- '1.266.060 (-1.000)',
995
+ '5.064',
996
+ '1.266.060',
1253
997
  '1.043.512 (+8.200)',
1254
998
  '260.878.000 (+2.050.000)'],
1255
999
  ['100',
1256
- '12.671 (-10)',
1257
- '1.267.120 (-1.000)',
1000
+ '12.671',
1001
+ '1.267.120',
1258
1002
  '1.044.600 (+8.200)',
1259
1003
  '104.460.000 (+820.000)'],
1260
- ['50',
1261
- '25.358 (-20)',
1262
- '1.267.900 (-1.000)',
1263
- '1.045.400 (+8.200)',
1264
- '52.270.000 (+410.000)'],
1265
- ['25',
1266
- '50.779 (-40)',
1267
- '1.269.480 (-1.000)',
1268
- '1.047.040 (+8.200)',
1269
- '26.176.000 (+205.000)'],
1270
- ['10',
1271
- '127.450 (-100)',
1272
- '1.274.500 (-1.000)',
1273
- '1.052.200 (+8.200)',
1274
- '10.522.000 (+82.000)'],
1275
- ['5',
1276
- '256.000 (-200)',
1277
- '1.280.000 (-1.000)',
1278
- '1.057.800 (+8.200)',
1279
- '5.289.000 (+41.000)'],
1280
- ['3',
1281
- '428.889 (-333)',
1282
- '1.286.667 (-1.000)',
1283
- '1.064.667 (+8.000)',
1284
- '3.194.000 (+24.000)'],
1285
- ['2',
1286
- '647.500 (-500)',
1287
- '1.295.000 (-1.000)',
1288
- '1.073.500 (+8.500)',
1289
- '2.147.000 (+17.000)'],
1290
- ['1',
1291
- '1.325.000 (-1.000)',
1292
- '1.325.000 (-1.000)',
1293
- '1.104.000 (+8.000)',
1294
- '1.104.000 (+8.000)'],
1295
- ['0.5',
1296
- '2.850.000 (-2.000)',
1297
- '1.425.000 (-1.000)',
1298
- '1.208.000 (+8.000)',
1299
- '604.000 (+4.000)'],
1300
- ['Update harga LM Antam :29 April 2024, pukul 07:56Harga pembelian kembali '
1301
- ':Rp. 1.221.000/gram (-1.000)',
1004
+ ['50', '25.358', '1.267.900', '1.045.400 (+8.200)', '52.270.000 (+410.000)'],
1005
+ ['25', '50.779', '1.269.480', '1.047.040 (+8.200)', '26.176.000 (+205.000)'],
1006
+ ['10', '127.450', '1.274.500', '1.052.200 (+8.200)', '10.522.000 (+82.000)'],
1007
+ ['5', '256.000', '1.280.000', '1.057.800 (+8.200)', '5.289.000 (+41.000)'],
1008
+ ['3', '428.889', '1.286.667', '1.064.667 (+8.000)', '3.194.000 (+24.000)'],
1009
+ ['2', '647.500', '1.295.000', '1.073.500 (+8.500)', '2.147.000 (+17.000)'],
1010
+ ['1', '1.325.000', '1.325.000', '1.104.000 (+8.000)', '1.104.000 (+8.000)'],
1011
+ ['0.5', '2.850.000', '1.425.000', '1.208.000 (+8.000)', '604.000 (+4.000)'],
1012
+ ['Update harga LM Antam :30 April 2024, pukul 08:19Harga pembelian kembali '
1013
+ ':Rp. 1.221.000/gram',
1302
1014
  'Update harga LM Pegadaian :31 Agustus 2023']],
1303
1015
  [['Spot Harga Emas Hari Ini (Market Open)'],
1304
1016
  ['Satuan', 'USD', 'Kurs\xa0Dollar', 'IDR'],
1305
- ['Ounce\xa0(oz)', '2.334,33 (-3,61)', '16.222,00 (+14,00)', '37.867.501'],
1306
- ['Gram\xa0(gr)', '75,05', '16.222,00', '1.217.468 (-830)'],
1307
- ['Kilogram\xa0(kg)', '75.050,45', '16.222,00', '1.217.468.437'],
1308
- ['Update harga emas :29 April 2024, pukul 20:39Update kurs :29 April 2024, '
1309
- 'pukul 13:10']],
1017
+ ['Ounce\xa0(oz)', '2.323,14 (-21,40)', '16.249,00 (+27,00)', '37.748.702'],
1018
+ ['Gram\xa0(gr)', '74,69', '16.249,00', '1.213.649 (-9.145)'],
1019
+ ['Kilogram\xa0(kg)', '74.690,69', '16.249,00', '1.213.648.948'],
1020
+ ['Update harga emas :30 April 2024, pukul 12:59Update kurs :30 April 2024, '
1021
+ 'pukul 09:10']],
1310
1022
  [['Gram', 'UBS Gold 99.99%'],
1311
1023
  ['Jual', 'Beli'],
1312
1024
  ['/ Batang', '/ Gram', '/ Batang', '/ Gram'],
1313
- ['100',
1314
- '126.300.000 (-512.000)',
1315
- '1.263.000 (-5.120)',
1316
- '125.185.000 (+200.000)',
1317
- '1.251.850 (+2.000)'],
1318
- ['50',
1319
- '63.300.000 (-145.000)',
1320
- '1.266.000 (-2.900)',
1321
- '62.645.000 (+100.000)',
1322
- '1.252.900 (+2.000)'],
1323
- ['25',
1324
- '31.700.000 (-62.000)',
1325
- '1.268.000 (-2.480)',
1326
- '31.425.000 (+50.000)',
1327
- '1.257.000 (+2.000)'],
1328
- ['10',
1329
- '12.720.000 (-35.000)',
1330
- '1.272.000 (-3.500)',
1331
- '12.620.000 (+20.000)',
1332
- '1.262.000 (+2.000)'],
1333
- ['5',
1334
- '6.385.000 (-20.000)',
1335
- '1.277.000 (-4.000)',
1336
- '6.362.000 (+10.000)',
1337
- '1.272.400 (+2.000)'],
1338
- ['1',
1339
- '1.325.000 (-1.000)',
1340
- '1.325.000 (-1.000)',
1341
- '1.305.000 (+2.000)',
1342
- '1.305.000 (+2.000)'],
1025
+ ['100', '126.300.000', '1.263.000', '125.185.000', '1.251.850'],
1026
+ ['50', '63.300.000', '1.266.000', '62.645.000', '1.252.900'],
1027
+ ['25', '31.700.000', '1.268.000', '31.425.000', '1.257.000'],
1028
+ ['10', '12.720.000', '1.272.000', '12.620.000', '1.262.000'],
1029
+ ['5', '6.385.000', '1.277.000', '6.362.000', '1.272.400'],
1030
+ ['1', '1.325.000', '1.325.000', '1.305.000', '1.305.000'],
1343
1031
  ['', 'Update :29 April 2024, pukul 16:06']],
1344
1032
  [['Konversi Satuan'],
1345
1033
  ['Satuan', 'Ounce (oz)', 'Gram (gr)', 'Kilogram (kg)'],
@@ -1350,37 +1038,37 @@ Output:
1350
1038
  ['Waktu', 'Emas'],
1351
1039
  ['Unit', 'USD', 'IDR'],
1352
1040
  ['Angka', '+/-', 'Angka', '+/-'],
1353
- ['Hari Ini', 'Kurs', '', '', '16.208', '+14+0,09%'],
1354
- ['oz', '2.337,94', '-3,61-0,15%', '37.893.332', '-25.830-0,07%'],
1355
- ['gr', '75,17', '-0,12-0,15%', '1.218.299', '-830-0,07%'],
1356
- ['30 Hari', 'Kurs', '', '', '15.853', '+369+2,33%'],
1357
- ['oz', '2.232,75', '+101,58+4,55%', '35.395.786', '+2.471.716+6,98%'],
1358
- ['gr', '71,78', '+3,27+4,55%', '1.138.001', '+79.467+6,98%'],
1359
- ['2 Bulan', 'Kurs', '', '', '15.673', '+549+3,50%'],
1360
- ['oz', '2.045,83', '+288,50+14,10%', '32.064.294', '+5.803.208+18,10%'],
1361
- ['gr', '65,77', '+9,28+14,10', '1.030.891', '+186.577+18,10%'],
1362
- ['6 Bulan', 'Kurs', '', '', '15.897', '+325+2,04%'],
1363
- ['oz', '1.977,80', '+356,53+18,03%', '31.441.087', '+6.426.415+20,44%'],
1364
- ['gr', '63,59', '+11,46+18,03%', '1.010.854', '+206.614+20,44%'],
1365
- ['1 Tahun', 'Kurs', '', '', '15.731', '+491+3,12%'],
1366
- ['oz', '1.823,86', '+510,47+27,99%', '28.691.142', '+9.176.360+31,98%'],
1367
- ['gr', '58,64', '+16,41+27,99%', '922.442', '+295.027+31,98%'],
1368
- ['2 Tahun', 'Kurs', '', '', '14.418', '+1.804+12,51%'],
1369
- ['oz', '1.896,95', '+437,38+23,06%', '27.350.225', '+10.517.276+38,45%'],
1370
- ['gr', '60,99', '+14,06+23,06%', '879.330', '+338.138+38,45%'],
1371
- ['3 Tahun', 'Kurs', '', '', '14.468', '+1.754+12,12%'],
1372
- ['oz', '1.767,08', '+567,25+32,10%', '25.566.113', '+12.301.388+48,12%'],
1373
- ['gr', '56,81', '+18,24+32,10%', '821.970', '+395.499+48,12%'],
1374
- ['5 Tahun', 'Kurs', '', '', '14.215', '+2.007+14,12%'],
1375
- ['oz', '1.280,61', '+1.053,72+82,28%', '18.203.871', '+19.663.630+108,02%'],
1376
- ['gr', '41,17', '+33,88+82,28%', '585.268', '+632.200+108,02%']])
1041
+ ['Hari Ini', 'Kurs', '', '', '16.222', '+27+0,17%'],
1042
+ ['oz', '2.344,54', '-21,40-0,91%', '38.033.128', '-284.426-0,75%'],
1043
+ ['gr', '75,38', '-0,69-0,91%', '1.222.793', '-9.145-0,75%'],
1044
+ ['30 Hari', 'Kurs', '', '', '15.853', '+396+2,50%'],
1045
+ ['oz', '2.232,75', '+90,39+4,05%', '35.395.786', '+2.352.916+6,65%'],
1046
+ ['gr', '71,78', '+2,91+4,05%', '1.138.001', '+75.648+6,65%'],
1047
+ ['2 Bulan', 'Kurs', '', '', '15.715', '+534+3,40%'],
1048
+ ['oz', '2.081,20', '+241,94+11,63%', '32.706.058', '+5.042.644+15,42%'],
1049
+ ['gr', '66,91', '+7,78+11,63', '1.051.524', '+162.125+15,42%'],
1050
+ ['6 Bulan', 'Kurs', '', '', '15.946', '+303+1,90%'],
1051
+ ['oz', '1.981,84', '+341,30+17,22%', '31.602.421', '+6.146.281+19,45%'],
1052
+ ['gr', '63,72', '+10,97+17,22%', '1.016.041', '+197.608+19,45%'],
1053
+ ['1 Tahun', 'Kurs', '', '', '15.731', '+518+3,29%'],
1054
+ ['oz', '1.823,86', '+499,28+27,37%', '28.691.142', '+9.057.560+31,57%'],
1055
+ ['gr', '58,64', '+16,05+27,37%', '922.442', '+291.207+31,57%'],
1056
+ ['2 Tahun', 'Kurs', '', '', '14.418', '+1.831+12,70%'],
1057
+ ['oz', '1.896,95', '+426,19+22,47%', '27.350.225', '+10.398.477+38,02%'],
1058
+ ['gr', '60,99', '+13,70+22,47%', '879.330', '+334.319+38,02%'],
1059
+ ['3 Tahun', 'Kurs', '', '', '14.468', '+1.781+12,31%'],
1060
+ ['oz', '1.768,91', '+554,23+31,33%', '25.592.590', '+12.156.112+47,50%'],
1061
+ ['gr', '56,87', '+17,82+31,33%', '822.821', '+390.828+47,50%'],
1062
+ ['5 Tahun', 'Kurs', '', '', '14.245', '+2.004+14,07%'],
1063
+ ['oz', '1.270,94', '+1.052,20+82,79%', '18.104.540', '+19.644.162+108,50%'],
1064
+ ['gr', '40,86', '+33,83+82,79%', '582.074', '+631.574+108,50%']])
1377
1065
  (['Home', 'Emas 1 Gram', 'History', 'Trend', 'Perak 1 Gram', 'Pluang'],
1378
1066
  [[''],
1379
1067
  ['Emas 24 KaratHarga Emas 1 Gram', ''],
1380
- ['USD', '75,04↓', '-0,13-0,17%'],
1381
- ['KURS', '16.226,00', '-15,30-0,09%'],
1382
- ['IDR', '1.217.549,53↓', '-3.252,41-0,27%'],
1383
- ['Senin, 29 April 2024 20:40']],
1068
+ ['USD', '74,69↓', '-0,69-0,92%'],
1069
+ ['KURS', '16.269,00', '+55,50+0,34%'],
1070
+ ['IDR', '1.215.142,76↓', '-7.009,98-0,57%'],
1071
+ ['Selasa, 30 April 2024 12:59']],
1384
1072
  [[''],
1385
1073
  ['Emas 1 Gram (IDR)Emas 1 Gram (USD)Kurs USD-IDR',
1386
1074
  'Hari Ini',
@@ -1391,19 +1079,71 @@ Output:
1391
1079
  '']],
1392
1080
  [['Pergerakkan Harga Emas 1 Gram'],
1393
1081
  ['', 'Penutupan Kemarin', 'Pergerakkan Hari Ini', 'Rata-rata'],
1394
- ['USD', '75,17', '75,04 - 75,17', '75,11'],
1395
- ['KURS', '16.241,30', '16.226,00 - 16.241,30', '16.233,65'],
1396
- ['IDR', '1.220.801,94', '1.217.549,53 - 1.220.801,94', '1.219.175,74'],
1082
+ ['USD', '75,38', '74,69 - 75,38', '75,04'],
1083
+ ['KURS', '16.213,50', '16.213,50 - 16.269,00', '16.241,25'],
1084
+ ['IDR', '1.222.152,74', '1.215.142,76 - 1.222.152,74', '1.218.647,75'],
1397
1085
  [''],
1398
1086
  ['', 'Awal Tahun', 'Pergerakkan YTD', '+/- YTD'],
1399
- ['USD', '66,32', '64,07 - 77,14', '+8,72 (13,15%)'],
1400
- ['KURS', '15.390,10', '15.390,00 - 16.307,80', '+835,90 (5,43%)'],
1401
- ['IDR', '1.020.729,53', '997.660,12 - 1.256.829,06', '+196.820,00 (19,28%)'],
1087
+ ['USD', '66,32', '64,07 - 77,14', '+8,37 (12,62%)'],
1088
+ ['KURS', '15.390,10', '15.390,00 - 16.307,80', '+878,90 (5,71%)'],
1089
+ ['IDR', '1.020.729,53', '997.660,12 - 1.256.829,06', '+194.413,23 (19,05%)'],
1402
1090
  [''],
1403
1091
  ['', 'Tahun Lalu / 52 Minggu', 'Pergerakkan 52 Minggu', '+/- 52 Minggu'],
1404
- ['USD', '64,04', '58,43 - 77,14', '+11,00 (17,18%)'],
1405
- ['KURS', '14.671,35', '14.669,40 - 16.307,80', '+1.554,65 (10,60%)'],
1406
- ['IDR', '939.568,98', '912.925,68 - 1.256.829,06', '+277.980,55 (29,59%)']])
1092
+ ['USD', '63,97', '58,43 - 77,14', '+10,72 (16,76%)'],
1093
+ ['KURS', '14.673,55', '14.669,40 - 16.307,80', '+1.595,45 (10,87%)'],
1094
+ ['IDR', '938.709,73', '912.925,68 - 1.256.829,06', '+276.433,03 (29,45%)']])
1095
+ ```
1096
+
1097
+ ## iloads
1098
+
1099
+ `iloads(data, syntax='yaml')`
1100
+
1101
+ Mengubah string data hasil dari idumps menjadi variabel.
1102
+ String data adalah berupa syntax YAML.
1103
+
1104
+ ```python
1105
+ data = {
1106
+ 'a': 123,
1107
+ 't': ['disini', 'senang', 'disana', 'senang'],
1108
+ 'l': (12, 23, [12, 42]),
1109
+ }
1110
+ s = idumps(data)
1111
+ print(iloads(s))
1112
+ ```
1113
+
1114
+ Output:
1115
+ ```py
1116
+ {'a': 123, 'l': (12, 23, [12, 42]), 't': ['disini', 'senang', 'disana', 'senang']}
1117
+ ```
1118
+
1119
+ ## input_char
1120
+
1121
+ `input_char(prompt=None, prompt_ending='', newline_after_input=True, echo_char=True, default=None)`
1122
+
1123
+ Meminta masukan satu huruf tanpa menekan Enter.
1124
+
1125
+ ```py
1126
+ input_char("Input char : ")
1127
+ input_char("Input char : ", default='Y')
1128
+ input_char("Input Char without print : ", echo_char=False)
1129
+ ```
1130
+
1131
+ ## is_valid_url
1132
+
1133
+ `is_valid_url(path)`
1134
+
1135
+ Mengecek apakah path merupakan URL yang valid atau tidak.
1136
+ Cara ini merupakan cara yang paling efektif.
1137
+
1138
+ ```python
1139
+ print(is_valid_url("https://chat.openai.com/?model=text-davinci-002-render-sha"))
1140
+ print(is_valid_url("https://chat.openai.com/?model/=text-dav/inci-002-render-sha"))
1141
+ ```
1142
+
1143
+ Output:
1144
+ ```py
1145
+ True
1146
+ True
1407
1147
  ```
1408
1148
 
1409
1149
  ## iopen
@@ -1433,244 +1173,458 @@ Tulis URL :
1433
1173
 
1434
1174
 
1435
1175
  ```python
1436
- # FILE
1437
- print(iopen("__iopen.txt", "mana aja"))
1438
- print(iopen("__iopen.txt", regex="(\w+)"))
1439
- # URL
1440
- print(iopen("https://www.google.com/", css_select="a"))
1441
- print(iopen("https://www.google.com/", dict(coba="dulu"), xpath="//a"))
1176
+ # FILE
1177
+ print(iopen("__iopen.txt", "mana aja"))
1178
+ print(iopen("__iopen.txt", regex="(\w+)"))
1179
+ # URL
1180
+ print(iopen("https://www.google.com/", css_select="a"))
1181
+ print(iopen("https://www.google.com/", dict(coba="dulu"), xpath="//a"))
1182
+ ```
1183
+
1184
+ Output:
1185
+ ```py
1186
+ 8
1187
+ ['mana', 'aja']
1188
+ [<Element a at 0x7252f5df90>, <Element a at 0x7252f9cf00>, <Element a at 0x7252f9cfa0>, <Element a at 0x7252f9cff0>, <Element a at 0x7252f9d040>, <Element a at 0x7252f9d090>, <Element a at 0x7252f9d0e0>, <Element a at 0x7252f9d130>, <Element a at 0x7252f9d180>, <Element a at 0x7252f9d1d0>, <Element a at 0x7252f9d220>, <Element a at 0x7252f9d270>, <Element a at 0x7252f9d2c0>, <Element a at 0x7252f9d310>, <Element a at 0x7252f9d360>, <Element a at 0x7252f9d3b0>, <Element a at 0x7252f9d400>, <Element a at 0x7252f9d450>]
1189
+ False
1190
+ ```
1191
+
1192
+ ## iprint
1193
+
1194
+ `iprint(*args, color=None, sort_dicts=False, **kwargs)`
1195
+
1196
+ Improve print function dengan menambahkan color dan pretty print
1197
+ Color menggunakan colorama Fore + Back + Style
1198
+
1199
+ ```python
1200
+ import colorama
1201
+ iprint(
1202
+ 'yang ini',
1203
+ {'12':12,'sdsd':{'12':21,'as':[88]}},
1204
+ color=colorama.Fore.BLUE + colorama.Style.BRIGHT
1205
+ )
1206
+ ```
1207
+
1208
+ Output:
1209
+ ```py
1210
+ yang ini {'12': 12, 'sdsd': {'12': 21, 'as': [88]}}
1211
+ ```
1212
+
1213
+ ## ireplace
1214
+
1215
+ `ireplace(string: str, replacements: dict, flags=re.IGNORECASE|re.MULTILINE|re.DOTALL)`
1216
+
1217
+ STRing TRanslate mengubah string menggunakan kamus dari dict.
1218
+ Replacement dapat berupa text biasa ataupun regex pattern.
1219
+ Apabila replacement berupa regex, gunakan raw string `r"..."`
1220
+ Untuk regex capturing gunakan `(...)`, dan untuk mengaksesnya
1221
+ gunakan `\1`, `\2`, .., dst.
1222
+
1223
+ ```python
1224
+ text = 'aku ini mau ke sini'
1225
+ replacements = {
1226
+ "sini": "situ",
1227
+ r"(ini)": r"itu dan \1",
1228
+ }
1229
+ print(ireplace(text, replacements))
1230
+ ```
1231
+
1232
+ Output:
1233
+ ```py
1234
+ aku itu dan ini mau ke situ
1235
+ ```
1236
+
1237
+ ## iscandir
1238
+
1239
+ `iscandir(folder_name='.', glob_pattern='*', recursive=True, scan_file=True, scan_folder=True)`
1240
+
1241
+ Mempermudah scandir untuk mengumpulkan folder dan file.
1242
+
1243
+ ```python
1244
+ print(iscandir())
1245
+ print(list(iscandir("./", recursive=False, scan_file=False)))
1246
+ ```
1247
+
1248
+ Output:
1249
+ ```py
1250
+ <generator object iscandir at 0x7252f50740>
1251
+ [PosixPath('.git'), PosixPath('.vscode'), PosixPath('pypipr'), PosixPath('__pycache__'), PosixPath('dist')]
1252
+ ```
1253
+
1254
+ ## isplit
1255
+
1256
+ `isplit(text, separator='', include_separator=False)`
1257
+
1258
+ Memecah text menjadi list berdasarkan separator.
1259
+
1260
+ ```python
1261
+ t = '/ini/contoh/path/'
1262
+ print(isplit(t, separator='/'))
1263
+ ```
1264
+
1265
+ Output:
1266
+ ```py
1267
+ ['', 'ini', 'contoh', 'path', '']
1268
+ ```
1269
+
1270
+ ## ivars
1271
+
1272
+ `ivars(obj, skip_underscore=True)`
1273
+
1274
+ Membuat dictionary berdasarkan kategori untuk setiap
1275
+ member dari object.
1276
+
1277
+ ```python
1278
+ iprint(ivars(__import__('pypipr')))
1279
+ ```
1280
+
1281
+ Output:
1282
+ ```py
1283
+ {'class': {'APIMixinView': <class 'pypipr.APIMixinView.APIMixinView'>,
1284
+ 'ComparePerformance': <class 'pypipr.ComparePerformance.ComparePerformance'>,
1285
+ 'PintUregQuantity': <class 'pint.Quantity'>,
1286
+ 'RunParallel': <class 'pypipr.RunParallel.RunParallel'>},
1287
+ 'function': {'avg': <function avg at 0x725d0a2700>,
1288
+ 'get_filemtime': <function get_filemtime at 0x725830b2e0>,
1289
+ 'print_colorize': <function print_colorize at 0x725830b4c0>,
1290
+ 'print_log': <function print_log at 0x725859ab60>,
1291
+ 'console_run': <function console_run at 0x725830b380>,
1292
+ 'auto_reload': <function auto_reload at 0x72584c3ec0>,
1293
+ 'basename': <function basename at 0x725830b240>,
1294
+ 'chr_to_int': <function chr_to_int at 0x725830b9c0>,
1295
+ 'int_to_chr': <function int_to_chr at 0x725830ba60>,
1296
+ 'irange': <function irange at 0x725830b880>,
1297
+ 'batchmaker': <function batchmaker at 0x725830b740>,
1298
+ 'calculate': <function calculate at 0x725830bce0>,
1299
+ 'batch_calculate': <function batch_calculate at 0x725830b600>,
1300
+ 'is_iterable': <function is_iterable at 0x725830bd80>,
1301
+ 'print_to_last_line': <function print_to_last_line at 0x725830be20>,
1302
+ 'text_colorize': <function text_colorize at 0x725830bec0>,
1303
+ 'choices': <function choices at 0x725830b6a0>,
1304
+ 'chunk_array': <function chunk_array at 0x725830b7e0>,
1305
+ 'create_folder': <function create_folder at 0x725830bf60>,
1306
+ 'datetime_from_string': <function datetime_from_string at 0x72582fc040>,
1307
+ 'datetime_now': <function datetime_now at 0x72582fc0e0>,
1308
+ 'dict_first': <function dict_first at 0x72582fc180>,
1309
+ 'dirname': <function dirname at 0x72582fc220>,
1310
+ 'is_empty': <function is_empty at 0x72582fc400>,
1311
+ 'exit_if_empty': <function exit_if_empty at 0x725830b560>,
1312
+ 'to_str': <function to_str at 0x72582fc540>,
1313
+ 'filter_empty': <function filter_empty at 0x72582fc2c0>,
1314
+ 'get_by_index': <function get_by_index at 0x72582fc4a0>,
1315
+ 'get_class_method': <function get_class_method at 0x72582fc5e0>,
1316
+ 'get_filesize': <function get_filesize at 0x72582fc720>,
1317
+ 'github_pull': <function github_pull at 0x72582fc7c0>,
1318
+ 'github_push': <function github_push at 0x72582fc9a0>,
1319
+ 'github_user': <function github_user at 0x72582fca40>,
1320
+ 'iargv': <function iargv at 0x72582fc860>,
1321
+ 'idumps_html': <function idumps_html at 0x72582fccc0>,
1322
+ 'idumps': <function idumps at 0x72582fcb80>,
1323
+ 'ienv': <function ienv at 0x72582fd1c0>,
1324
+ 'iexec': <function iexec at 0x72583d94e0>,
1325
+ 'ijoin': <function ijoin at 0x72583d96c0>,
1326
+ 'iloads_html': <function iloads_html at 0x72583d98a0>,
1327
+ 'iloads': <function iloads at 0x72583d9620>,
1328
+ 'input_char': <function input_char at 0x72583d9800>,
1329
+ 'is_valid_url': <function is_valid_url at 0x72583d9a80>,
1330
+ 'iopen': <function iopen at 0x72581f1ee0>,
1331
+ 'iprint': <function iprint at 0x72583d99e0>,
1332
+ 'ireplace': <function ireplace at 0x72583d9da0>,
1333
+ 'iscandir': <function iscandir at 0x72582ad620>,
1334
+ 'isplit': <function isplit at 0x72582ad6c0>,
1335
+ 'ivars': <function ivars at 0x72582ad760>,
1336
+ 'log': <function log at 0x72582ad800>,
1337
+ 'password_generator': <function password_generator at 0x72582ad8a0>,
1338
+ 'pip_freeze_without_version': <function pip_freeze_without_version at 0x72582ad9e0>,
1339
+ 'poetry_publish': <function poetry_publish at 0x72582ada80>,
1340
+ 'poetry_update_version': <function poetry_update_version at 0x72582adbc0>,
1341
+ 'print_dir': <function print_dir at 0x72582adda0>,
1342
+ 'random_bool': <function random_bool at 0x72582ade40>,
1343
+ 'restart': <function restart at 0x72582adee0>,
1344
+ 'set_timeout': <function set_timeout at 0x72582adf80>,
1345
+ 'sets_ordered': <function sets_ordered at 0x72582ae020>,
1346
+ 'str_cmp': <function str_cmp at 0x72582ae0c0>},
1347
+ 'variable': {'LINUX': True,
1348
+ 'PintUreg': <pint.registry.UnitRegistry object at 0x725d0a8450>,
1349
+ 'WINDOWS': False},
1350
+ 'module': {'asyncio': <module 'asyncio' from '/data/data/com.termux/files/usr/lib/python3.11/asyncio/__init__.py'>,
1351
+ 'colorama': <module 'colorama' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/colorama/__init__.py'>,
1352
+ 'csv': <module 'csv' from '/data/data/com.termux/files/usr/lib/python3.11/csv.py'>,
1353
+ 'datetime': <module 'datetime' from '/data/data/com.termux/files/usr/lib/python3.11/datetime.py'>,
1354
+ 'functools': <module 'functools' from '/data/data/com.termux/files/usr/lib/python3.11/functools.py'>,
1355
+ 'inspect': <module 'inspect' from '/data/data/com.termux/files/usr/lib/python3.11/inspect.py'>,
1356
+ 'io': <module 'io' (frozen)>,
1357
+ 'json': <module 'json' from '/data/data/com.termux/files/usr/lib/python3.11/json/__init__.py'>,
1358
+ 'lxml': <module 'lxml' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/lxml/__init__.py'>,
1359
+ 'math': <module 'math' from '/data/data/com.termux/files/usr/lib/python3.11/lib-dynload/math.cpython-311.so'>,
1360
+ 'multiprocessing': <module 'multiprocessing' from '/data/data/com.termux/files/usr/lib/python3.11/multiprocessing/__init__.py'>,
1361
+ 'operator': <module 'operator' from '/data/data/com.termux/files/usr/lib/python3.11/operator.py'>,
1362
+ 'os': <module 'os' (frozen)>,
1363
+ 'pathlib': <module 'pathlib' from '/data/data/com.termux/files/usr/lib/python3.11/pathlib.py'>,
1364
+ 'pint': <module 'pint' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/pint/__init__.py'>,
1365
+ 'pprint': <module 'pprint' from '/data/data/com.termux/files/usr/lib/python3.11/pprint.py'>,
1366
+ 'queue': <module 'queue' from '/data/data/com.termux/files/usr/lib/python3.11/queue.py'>,
1367
+ 'random': <module 'random' from '/data/data/com.termux/files/usr/lib/python3.11/random.py'>,
1368
+ 're': <module 're' from '/data/data/com.termux/files/usr/lib/python3.11/re/__init__.py'>,
1369
+ 'requests': <module 'requests' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/requests/__init__.py'>,
1370
+ 'string': <module 'string' from '/data/data/com.termux/files/usr/lib/python3.11/string.py'>,
1371
+ 'subprocess': <module 'subprocess' from '/data/data/com.termux/files/usr/lib/python3.11/subprocess.py'>,
1372
+ 'sys': <module 'sys' (built-in)>,
1373
+ 'textwrap': <module 'textwrap' from '/data/data/com.termux/files/usr/lib/python3.11/textwrap.py'>,
1374
+ 'threading': <module 'threading' from '/data/data/com.termux/files/usr/lib/python3.11/threading.py'>,
1375
+ 'time': <module 'time' (built-in)>,
1376
+ 'tzdata': <module 'tzdata' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/tzdata/__init__.py'>,
1377
+ 'uuid': <module 'uuid' from '/data/data/com.termux/files/usr/lib/python3.11/uuid.py'>,
1378
+ 'webbrowser': <module 'webbrowser' from '/data/data/com.termux/files/usr/lib/python3.11/webbrowser.py'>,
1379
+ 'yaml': <module 'yaml' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/yaml/__init__.py'>,
1380
+ 'zoneinfo': <module 'zoneinfo' from '/data/data/com.termux/files/usr/lib/python3.11/zoneinfo/__init__.py'>}}
1381
+ ```
1382
+
1383
+ ## log
1384
+
1385
+ `log(text=None)`
1386
+
1387
+ Decorator untuk mempermudah pembuatan log karena tidak perlu mengubah
1388
+ fungsi yg sudah ada.
1389
+ Melakukan print ke console untuk menginformasikan proses yg sedang
1390
+ berjalan didalam program.
1391
+
1392
+ ```py
1393
+ @log
1394
+ def some_function():
1395
+ pass
1396
+
1397
+ @log()
1398
+ def some_function_again():
1399
+ pass
1400
+
1401
+ @log("Calling some function")
1402
+ def some_function_more():
1403
+ pass
1404
+
1405
+ some_function()
1406
+ some_function_again()
1407
+ some_function_more()
1408
+ ```
1409
+
1410
+ ## password_generator
1411
+
1412
+ `password_generator(length=8, characters='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~')`
1413
+
1414
+ Membuat pssword secara acak
1415
+
1416
+ ```python
1417
+ print(password_generator())
1442
1418
  ```
1443
1419
 
1444
1420
  Output:
1445
1421
  ```py
1446
- 8
1447
- ['mana', 'aja']
1448
- [<Element a at 0x7d509ca170>, <Element a at 0x7d50a16940>, <Element a at 0x7d50a169e0>, <Element a at 0x7d50a16a30>, <Element a at 0x7d50a16a80>, <Element a at 0x7d50a16ad0>, <Element a at 0x7d50a16b20>, <Element a at 0x7d50a16b70>, <Element a at 0x7d50a16bc0>, <Element a at 0x7d50a16c10>, <Element a at 0x7d50a16c60>, <Element a at 0x7d50a16cb0>, <Element a at 0x7d50a16d00>, <Element a at 0x7d50a16d50>, <Element a at 0x7d50a16da0>, <Element a at 0x7d50a16df0>, <Element a at 0x7d50a16e40>, <Element a at 0x7d50a16e90>, <Element a at 0x7d50a16ee0>, <Element a at 0x7d50a16f30>]
1449
- False
1422
+ Ym}9H"{5
1450
1423
  ```
1451
1424
 
1452
- ## iprint
1425
+ ## pip_freeze_without_version
1453
1426
 
1454
- `iprint(*args, color=None, sort_dicts=False, **kwargs)`
1427
+ `pip_freeze_without_version(filename=None)`
1455
1428
 
1456
- Improve print function dengan menambahkan color dan pretty print
1457
- Color menggunakan colorama Fore + Back + Style
1429
+ Memberikan list dari dependencies yang terinstall tanpa version.
1430
+ Bertujuan untuk menggunakan Batteries Included Python.
1458
1431
 
1459
- ```python
1460
- import colorama
1461
- iprint(
1462
- 'yang ini',
1463
- {'12':12,'sdsd':{'12':21,'as':[88]}},
1464
- color=colorama.Fore.BLUE + colorama.Style.BRIGHT
1465
- )
1432
+ ```py
1433
+ print(pip_freeze_without_version())
1466
1434
  ```
1467
1435
 
1468
- Output:
1469
- ```py
1470
- yang ini {'12': 12, 'sdsd': {'12': 21, 'as': [88]}}
1436
+ ## poetry_publish
1437
+
1438
+ `poetry_publish(token=None)`
1439
+
1440
+ Publish project to pypi,org
1441
+
1442
+ ```py
1443
+ poetry_publish()
1471
1444
  ```
1472
1445
 
1473
- ## irange
1446
+ ## poetry_update_version
1474
1447
 
1475
- `irange(start, stop=None, step=1, index=0, numbers='abcdefghijklmnopqrstuvwxyz')`
1448
+ `poetry_update_version(mayor=False, minor=False, patch=False)`
1476
1449
 
1477
- Meningkatkan fungsi range() dari python untuk pengulangan menggunakan huruf
1450
+ Update versi pada pyproject.toml menggunakan poetry
1451
+
1452
+ ```py
1453
+ poetry_update_version()
1454
+ ```
1455
+
1456
+ ## print_dir
1457
+
1458
+ `print_dir(var, colorize=True)`
1459
+
1460
+ Print property dan method yang tersedia pada variabel
1478
1461
 
1479
1462
  ```python
1480
- print(irange('a', 'c'))
1481
- print(irange('z', 'a', 10))
1482
- print(list(irange('a', 'z', 10)))
1483
- print(list(irange(1, '7')))
1484
- print(list(irange(10, 5)))
1463
+ import pathlib
1464
+ p = pathlib.Path("https://www.google.com/")
1465
+ print_dir(p, colorize=False)
1485
1466
  ```
1486
1467
 
1487
1468
  Output:
1488
1469
  ```py
1489
- <generator object char_range at 0x7d5099ebd0>
1490
- <generator object char_range at 0x7d5099ebd0>
1491
- ['a', 'k', 'u']
1492
- [1, 2, 3, 4, 5, 6]
1493
- []
1470
+ __bytes__ : b'https:/www.google.com'
1471
+ __class__ : .
1472
+ __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']
1473
+ __doc__ : Path subclass for non-Windows systems.
1474
+
1475
+ On a POSIX system, instantiating a Path should return this object.
1476
+
1477
+ __enter__ : https:/www.google.com
1478
+ __fspath__ : https:/www.google.com
1479
+ __getstate__ : (None, {'_drv': '', '_root': '', '_parts': ['https:', 'www.google.com'], '_str': 'https:/www.google.com'})
1480
+ __hash__ : 3977985606964424013
1481
+ __init__ : None
1482
+ __init_subclass__ : None
1483
+ __module__ : pathlib
1484
+ __reduce__ : (<class 'pathlib.PosixPath'>, ('https:', 'www.google.com'))
1485
+ __repr__ : PosixPath('https:/www.google.com')
1486
+ __sizeof__ : 72
1487
+ __slots__ : ()
1488
+ __str__ : https:/www.google.com
1489
+ __subclasshook__ : NotImplemented
1490
+ _cached_cparts : ['https:', 'www.google.com']
1491
+ _cparts : ['https:', 'www.google.com']
1492
+ _drv :
1493
+ _flavour : <pathlib._PosixFlavour object at 0x7262454610>
1494
+ _hash : 3977985606964424013
1495
+ _parts : ['https:', 'www.google.com']
1496
+ _root :
1497
+ _str : https:/www.google.com
1498
+ absolute : /data/data/com.termux/files/home/pypipr/https:/www.google.com
1499
+ anchor :
1500
+ as_posix : https:/www.google.com
1501
+ cwd : /data/data/com.termux/files/home/pypipr
1502
+ drive :
1503
+ exists : False
1504
+ expanduser : https:/www.google.com
1505
+ home : /data/data/com.termux/files/home
1506
+ is_absolute : False
1507
+ is_block_device : False
1508
+ is_char_device : False
1509
+ is_dir : False
1510
+ is_fifo : False
1511
+ is_file : False
1512
+ is_mount : False
1513
+ is_reserved : False
1514
+ is_socket : False
1515
+ is_symlink : False
1516
+ iterdir : <generator object Path.iterdir at 0x7252f59fc0>
1517
+ joinpath : https:/www.google.com
1518
+ name : www.google.com
1519
+ parent : https:
1520
+ parents : <PosixPath.parents>
1521
+ parts : ('https:', 'www.google.com')
1522
+ resolve : /data/data/com.termux/files/home/pypipr/https:/www.google.com
1523
+ root :
1524
+ stem : www.google
1525
+ suffix : .com
1526
+ suffixes : ['.google', '.com']
1494
1527
  ```
1495
1528
 
1496
- ## ireplace
1529
+ ## random_bool
1497
1530
 
1498
- `ireplace(string: str, replacements: dict, flags=re.IGNORECASE|re.MULTILINE|re.DOTALL)`
1531
+ `random_bool()`
1499
1532
 
1500
- STRing TRanslate mengubah string menggunakan kamus dari dict.
1501
- Replacement dapat berupa text biasa ataupun regex pattern.
1502
- Apabila replacement berupa regex, gunakan raw string `r"..."`
1503
- Untuk regex capturing gunakan `(...)`, dan untuk mengaksesnya
1504
- gunakan `\1`, `\2`, .., dst.
1533
+ Menghasilkan nilai random True atau False.
1534
+ Fungsi ini merupakan fungsi tercepat untuk mendapatkan random bool.
1535
+ Fungsi ini sangat cepat, tetapi pemanggilan fungsi ini membutuhkan
1536
+ overhead yg besar.
1505
1537
 
1506
1538
  ```python
1507
- text = 'aku ini mau ke sini'
1508
- replacements = {
1509
- "sini": "situ",
1510
- r"(ini)": r"itu dan \1",
1511
- }
1512
- print(ireplace(text, replacements))
1539
+ print(random_bool())
1513
1540
  ```
1514
1541
 
1515
1542
  Output:
1516
1543
  ```py
1517
- aku itu dan ini mau ke situ
1544
+ True
1518
1545
  ```
1519
1546
 
1520
- ## iscandir
1547
+ ## restart
1521
1548
 
1522
- `iscandir(folder_name='.', glob_pattern='*', recursive=True, scan_file=True, scan_folder=True)`
1549
+ `restart(*argv)`
1523
1550
 
1524
- Mempermudah scandir untuk mengumpulkan folder dan file.
1551
+ ## set_timeout
1552
+
1553
+ `set_timeout(interval, func, args=None, kwargs=None)`
1554
+
1555
+ Menjalankan fungsi ketika sudah sekian detik.
1556
+ Apabila timeout masih berjalan tapi kode sudah selesai dieksekusi semua, maka
1557
+ program tidak akan berhenti sampai timeout selesai, kemudian fungsi dijalankan,
1558
+ kemudian program dihentikan.
1525
1559
 
1526
1560
  ```python
1527
- print(iscandir())
1528
- print(list(iscandir("./", recursive=False, scan_file=False)))
1561
+ set_timeout(3, lambda: print("Timeout 3"))
1562
+ x = set_timeout(7, print, args=["Timeout 7"])
1563
+ print(x)
1564
+ print("menghentikan timeout 7")
1565
+ x.cancel()
1529
1566
  ```
1530
1567
 
1531
1568
  Output:
1532
1569
  ```py
1533
- <generator object iscandir at 0x7d509d4640>
1534
- [PosixPath('.git'), PosixPath('.vscode'), PosixPath('pypipr'), PosixPath('__pycache__'), PosixPath('dist')]
1570
+ <Timer(Thread-2, started 490989403376)>
1571
+ menghentikan timeout 7
1535
1572
  ```
1536
1573
 
1537
- ## isplit
1574
+ ## sets_ordered
1538
1575
 
1539
- `isplit(text, separator='', include_separator=False)`
1576
+ `sets_ordered(iterator)`
1540
1577
 
1541
- Memecah text menjadi list berdasarkan separator.
1578
+ Hanya mengambil nilai unik dari suatu list
1542
1579
 
1543
1580
  ```python
1544
- t = '/ini/contoh/path/'
1545
- print(isplit(t, separator='/'))
1581
+ array = [2, 3, 12, 3, 3, 42, 42, 1, 43, 2, 42, 41, 4, 24, 32, 42, 3, 12, 32, 42, 42]
1582
+ print(sets_ordered(array))
1583
+ print(list(sets_ordered(array)))
1546
1584
  ```
1547
1585
 
1548
1586
  Output:
1549
1587
  ```py
1550
- ['', 'ini', 'contoh', 'path', '']
1588
+ <generator object sets_ordered at 0x7252f78ad0>
1589
+ [2, 3, 12, 42, 1, 43, 41, 4, 24, 32]
1551
1590
  ```
1552
1591
 
1553
- ## ivars
1592
+ ## str_cmp
1554
1593
 
1555
- `ivars(obj, skip_underscore=True)`
1594
+ `str_cmp(t1, t2)`
1556
1595
 
1557
- Membuat dictionary berdasarkan kategori untuk setiap
1558
- member dari object.
1596
+ Membandingakan string secara incase-sensitive menggunakan lower().
1597
+ Lebih cepat dibandingkan upper(), casefold(), re.fullmatch(), len().
1598
+ perbandingan ini sangat cepat, tetapi pemanggilan fungsi ini membutuhkan
1599
+ overhead yg besar.
1559
1600
 
1560
1601
  ```python
1561
- iprint(ivars(__import__('pypipr')))
1602
+ print(str_cmp('teks1', 'Teks1'))
1562
1603
  ```
1563
1604
 
1564
1605
  Output:
1565
1606
  ```py
1566
- {'module': {'ibuiltins': <module 'pypipr.ibuiltins' from '/data/data/com.termux/files/home/pypipr/pypipr/ibuiltins/__init__.py'>,
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>}}
1607
+ True
1670
1608
  ```
1671
1609
 
1672
1610
  # CLASS
1673
1611
 
1612
+ ## APIMixinView
1613
+
1614
+ `APIMixinView()`
1615
+
1616
+ APIView adalah class view untuk membuat Website API
1617
+ Cara kerjanya adalah dengan menggunakan variabel GET untuk menerima data.
1618
+
1619
+ Class ini tidak bisa digunakan sendiri.
1620
+ Class ini harus menjadi mixin Class View karena perlu trigger untuk
1621
+ memanggil method get().
1622
+
1623
+ ```py
1624
+ class ExampleAPIView(APIMixinView, View):
1625
+ pass
1626
+ ```
1627
+
1674
1628
  ## ComparePerformance
1675
1629
 
1676
1630
  `ComparePerformance()`
@@ -1706,7 +1660,7 @@ print(ExampleComparePerformance().compare_performance())
1706
1660
 
1707
1661
  Output:
1708
1662
  ```py
1709
- {'a': <generator object ExampleComparePerformance.a.<locals>.<genexpr> at 0x7d509ec2b0>,
1663
+ {'a': <generator object ExampleComparePerformance.a.<locals>.<genexpr> at 0x7252f78520>,
1710
1664
  'b': (0, 1, 2, 3, 4, 5, 6, 7, 8, 9),
1711
1665
  'c': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
1712
1666
  'd': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]}
@@ -1717,6 +1671,10 @@ Output:
1717
1671
  {'a': 0, 'b': 0, 'c': 0, 'd': 0}
1718
1672
  ```
1719
1673
 
1674
+ ## PintUregQuantity
1675
+
1676
+ `PintUregQuantity(value, units=None)`
1677
+
1720
1678
  ## RunParallel
1721
1679
 
1722
1680
  `RunParallel()`
@@ -1819,23 +1777,3 @@ if __name__ == "__main__":
1819
1777
  print(ExampleRunParallel().run_multi_processing())
1820
1778
  ```
1821
1779
 
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
-