pypipr 1.0.84__py3-none-any.whl → 1.0.85__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pypipr
3
- Version: 1.0.84
3
+ Version: 1.0.85
4
4
  Summary: The Python Package Index Project
5
5
  Author: ufiapjj
6
6
  Author-email: ufiapjj@gmail.com
@@ -45,27 +45,16 @@ import pypipr
45
45
 
46
46
  `WINDOWS`
47
47
 
48
- # FUNCTION
49
-
50
- ## auto_reload
51
-
52
- `auto_reload(filename)`
53
-
54
- Menjalankan file python secara berulang.
55
- Dengan tujuan untuk melihat perubahan secara langsung.
56
- Pastikan kode aman untuk dijalankan.
57
- Jalankan kode ini di terminal console.
48
+ `PintUreg`
58
49
 
59
- ```py
60
- python -m pypipr.iflow.auto_reload file_name.py
61
- ```
50
+ # FUNCTION
62
51
 
63
52
  ## avg
64
53
 
65
54
  `avg(i)`
66
55
 
67
56
  Simple Average Function karena tidak disediakan oleh python
68
-
57
+
69
58
  ```python
70
59
  n = [1, 22, 2, 3, 13, 2, 123, 12, 31, 2, 2, 12, 2, 1]
71
60
  print(avg(n))
@@ -81,7 +70,7 @@ Output:
81
70
  `basename(path)`
82
71
 
83
72
  Mengembalikan nama file dari path
84
-
73
+
85
74
  ```python
86
75
  print(basename("/ini/nama/folder/ke/file.py"))
87
76
  ```
@@ -91,115 +80,12 @@ Output:
91
80
  file.py
92
81
  ```
93
82
 
94
- ## batch_calculate
95
-
96
- `batch_calculate(pattern)`
97
-
98
- Analisa perhitungan massal.
99
- Bisa digunakan untuk mencari alternatif terendah/tertinggi/dsb.
100
-
101
-
102
- ```python
103
- print(batch_calculate("{1 10} m ** {1 3}"))
104
- print(list(batch_calculate("{1 10} m ** {1 3}")))
105
- ```
106
-
107
- Output:
108
- ```py
109
- <generator object batch_calculate at 0x7eda8d53f0>
110
- [('1 m ** 1', <Quantity(1, 'meter')>), ('1 m ** 2', <Quantity(1, 'meter ** 2')>), ('1 m ** 3', <Quantity(1, 'meter ** 3')>), ('2 m ** 1', <Quantity(2, 'meter')>), ('2 m ** 2', <Quantity(2, 'meter ** 2')>), ('2 m ** 3', <Quantity(2, 'meter ** 3')>), ('3 m ** 1', <Quantity(3, 'meter')>), ('3 m ** 2', <Quantity(3, 'meter ** 2')>), ('3 m ** 3', <Quantity(3, 'meter ** 3')>), ('4 m ** 1', <Quantity(4, 'meter')>), ('4 m ** 2', <Quantity(4, 'meter ** 2')>), ('4 m ** 3', <Quantity(4, 'meter ** 3')>), ('5 m ** 1', <Quantity(5, 'meter')>), ('5 m ** 2', <Quantity(5, 'meter ** 2')>), ('5 m ** 3', <Quantity(5, 'meter ** 3')>), ('6 m ** 1', <Quantity(6, 'meter')>), ('6 m ** 2', <Quantity(6, 'meter ** 2')>), ('6 m ** 3', <Quantity(6, 'meter ** 3')>), ('7 m ** 1', <Quantity(7, 'meter')>), ('7 m ** 2', <Quantity(7, 'meter ** 2')>), ('7 m ** 3', <Quantity(7, 'meter ** 3')>), ('8 m ** 1', <Quantity(8, 'meter')>), ('8 m ** 2', <Quantity(8, 'meter ** 2')>), ('8 m ** 3', <Quantity(8, 'meter ** 3')>), ('9 m ** 1', <Quantity(9, 'meter')>), ('9 m ** 2', <Quantity(9, 'meter ** 2')>), ('9 m ** 3', <Quantity(9, 'meter ** 3')>), ('10 m ** 1', <Quantity(10, 'meter')>), ('10 m ** 2', <Quantity(10, 'meter ** 2')>), ('10 m ** 3', <Quantity(10, 'meter ** 3')>)]
111
- ```
112
-
113
- ## batchmaker
114
-
115
- `batchmaker(pattern: str)`
116
-
117
- Alat Bantu untuk membuat teks yang berulang.
118
- Gunakan `{[start][separator][finish]([separator][step])}`.
119
- ```
120
- [start] dan [finish] -> bisa berupa huruf maupun angka
121
- ([separator][step]) -> bersifat optional
122
- [separator] -> selain huruf dan angka
123
- [step] -> berupa angka positif
124
- ```
125
-
126
- ```python
127
- s = "Urutan {1/6/3} dan {10:9} dan {j k} dan {Z - A - 15} saja."
128
- print(batchmaker(s))
129
- print(list(batchmaker(s)))
130
- ```
131
-
132
- Output:
133
- ```py
134
- <generator object batchmaker at 0x7edaa2fd00>
135
- ['Urutan 1 dan 10 dan j dan Z saja.', 'Urutan 1 dan 10 dan j dan K saja.', 'Urutan 1 dan 10 dan k dan Z saja.', 'Urutan 1 dan 10 dan k dan K saja.', 'Urutan 1 dan 9 dan j dan Z saja.', 'Urutan 1 dan 9 dan j dan K saja.', 'Urutan 1 dan 9 dan k dan Z saja.', 'Urutan 1 dan 9 dan k dan K saja.', 'Urutan 4 dan 10 dan j dan Z saja.', 'Urutan 4 dan 10 dan j dan K saja.', 'Urutan 4 dan 10 dan k dan Z saja.', 'Urutan 4 dan 10 dan k dan K saja.', 'Urutan 4 dan 9 dan j dan Z saja.', 'Urutan 4 dan 9 dan j dan K saja.', 'Urutan 4 dan 9 dan k dan Z saja.', 'Urutan 4 dan 9 dan k dan K saja.']
136
- ```
137
-
138
- ## calculate
139
-
140
- `calculate(teks)`
141
-
142
- Mengembalikan hasil dari perhitungan teks menggunakan modul pint.
143
- Mendukung perhitungan matematika dasar dengan satuan.
144
-
145
- Return value:
146
- - Berupa class Quantity dari modul pint
147
-
148
- Format:
149
- - f"{result:~P}" -> pretty
150
- - f"{result:~H}" -> html
151
- - result.to_base_units() -> SI
152
- - result.to_compact() -> human readable
153
-
154
- ```python
155
- fx = "3 meter * 10 cm * 3 km"
156
- res = calculate(fx)
157
- print(res)
158
- print(res.to_base_units())
159
- print(res.to_compact())
160
- print(f"{res:~P}")
161
- print(f"{res:~H}")
162
- ```
163
-
164
- Output:
165
- ```py
166
- 90 centimeter * kilometer * meter
167
- 900.0 meter ** 3
168
- 900.0 meter ** 3
169
- 90 cm·km·m
170
- 90 cm km m
171
- ```
172
-
173
- ## choices
174
-
175
- `choices(iterator, title=None, prompt='', default=None)`
176
-
177
- Memudahkan dalam membuat pilihan untuk user dalam tampilan console
178
-
179
- ```py
180
- a = choices("ini hanya satu pilihan")
181
- b = choices(
182
- {
183
- "sedan": "audi",
184
- "suv": "volvo",
185
- "truck": "tesla",
186
- },
187
- title="Car Model",
188
- prompt="Pilih Mobil : ",
189
- )
190
- c = choices(
191
- iscandir(recursive=False),
192
- title="List File dan Folder",
193
- prompt="Pilih File atau Folder : ",
194
- )
195
- ```
196
-
197
83
  ## chunk_array
198
84
 
199
85
  `chunk_array(array, size, start=0)`
200
86
 
201
87
  Membagi array menjadi potongan-potongan dengan besaran yg diinginkan
202
-
88
+
203
89
  ```python
204
90
  arr = [2, 3, 12, 3, 3, 42, 42, 1, 43, 2, 42, 41, 4, 24, 32, 42, 3, 12, 32, 42, 42]
205
91
  print(chunk_array(arr, 5))
@@ -208,28 +94,17 @@ print(list(chunk_array(arr, 5)))
208
94
 
209
95
  Output:
210
96
  ```py
211
- <generator object chunk_array at 0x7eda954440>
97
+ <generator object chunk_array at 0x79670d4440>
212
98
  [[2, 3, 12, 3, 3], [42, 42, 1, 43, 2], [42, 41, 4, 24, 32], [42, 3, 12, 32, 42], [42]]
213
99
  ```
214
100
 
215
- ## console_run
216
-
217
- `console_run(info, command=None, print_info=True, capture_output=False)`
218
-
219
- Menjalankan command seperti menjalankan command di Command Terminal
220
-
221
- ```py
222
- console_run('dir')
223
- console_run('ls')
224
- ```
225
-
226
101
  ## create_folder
227
102
 
228
103
  `create_folder(folder_name)`
229
104
 
230
105
  Membuat folder.
231
106
  Membuat folder secara recursive dengan permission.
232
-
107
+
233
108
  ```py
234
109
  create_folder("contoh_membuat_folder")
235
110
  create_folder("contoh/membuat/folder/recursive")
@@ -241,7 +116,7 @@ create_folder("./contoh_membuat_folder/secara/recursive")
241
116
  `datetime_from_string(iso_string, timezone='UTC')`
242
117
 
243
118
  Parse iso_string menjadi datetime object
244
-
119
+
245
120
  ```python
246
121
  print(datetime_from_string("2022-12-12 15:40:13").isoformat())
247
122
  print(datetime_from_string(
@@ -261,7 +136,7 @@ Output:
261
136
  `datetime_now(timezone=None)`
262
137
 
263
138
  Memudahkan dalam membuat Datetime untuk suatu timezone tertentu
264
-
139
+
265
140
  ```python
266
141
  print(datetime_now("Asia/Jakarta"))
267
142
  print(datetime_now("GMT"))
@@ -270,9 +145,9 @@ print(datetime_now("Etc/GMT+7"))
270
145
 
271
146
  Output:
272
147
  ```py
273
- 2024-04-23 15:40:26.808897+07:00
274
- 2024-04-23 08:40:26.809249+00:00
275
- 2024-04-23 01:40:26.809861-07:00
148
+ 2024-04-23 18:02:50.654905+07:00
149
+ 2024-04-23 11:02:50.655231+00:00
150
+ 2024-04-23 04:02:50.655801-07:00
276
151
  ```
277
152
 
278
153
  ## dict_first
@@ -280,7 +155,7 @@ Output:
280
155
  `dict_first(d: dict, remove=False)`
281
156
 
282
157
  Mengambil nilai (key, value) pertama dari dictionary dalam bentuk tuple.
283
-
158
+
284
159
  ```python
285
160
  d = {
286
161
  "key2": "value2",
@@ -303,7 +178,7 @@ Output:
303
178
 
304
179
  Mengembalikan nama folder dari path.
305
180
  Tanpa trailing slash di akhir.
306
-
181
+
307
182
  ```python
308
183
  print(dirname("/ini/nama/folder/ke/file.py"))
309
184
  ```
@@ -319,7 +194,7 @@ Output:
319
194
 
320
195
  Keluar dari program apabila seluruh variabel
321
196
  setara dengan empty
322
-
197
+
323
198
  ```py
324
199
  var1 = None
325
200
  var2 = '0'
@@ -331,7 +206,7 @@ exit_if_empty(var1, var2)
331
206
  `filter_empty(iterable, zero_is_empty=True, str_strip=True)`
332
207
 
333
208
  Mengembalikan iterabel yang hanya memiliki nilai
334
-
209
+
335
210
  ```python
336
211
  var = [1, None, False, 0, "0", True, {}, ['eee']]
337
212
  print(filter_empty(var))
@@ -339,7 +214,7 @@ print(filter_empty(var))
339
214
 
340
215
  Output:
341
216
  ```py
342
- <generator object filter_empty at 0x7eda8d53f0>
217
+ <generator object filter_empty at 0x7967056e30>
343
218
  ```
344
219
 
345
220
  ## get_class_method
@@ -347,29 +222,29 @@ Output:
347
222
  `get_class_method(cls)`
348
223
 
349
224
  Mengembalikan berupa tuple yg berisi list dari method dalam class
350
-
225
+
351
226
  ```python
352
227
  class ExampleGetClassMethod:
353
228
  def a():
354
229
  return [x for x in range(10)]
355
-
230
+
356
231
  def b():
357
232
  return [x for x in range(10)]
358
-
233
+
359
234
  def c():
360
235
  return [x for x in range(10)]
361
-
236
+
362
237
  def d():
363
238
  return [x for x in range(10)]
364
-
239
+
365
240
  print(get_class_method(ExampleGetClassMethod))
366
241
  print(list(get_class_method(ExampleGetClassMethod)))
367
242
  ```
368
243
 
369
244
  Output:
370
245
  ```py
371
- <generator object get_class_method at 0x7eda8d7100>
372
- [<function ExampleGetClassMethod.a at 0x7eda970fe0>, <function ExampleGetClassMethod.b at 0x7eda971260>, <function ExampleGetClassMethod.c at 0x7eda9711c0>, <function ExampleGetClassMethod.d at 0x7eda971120>]
246
+ <generator object get_class_method at 0x7967057100>
247
+ [<function ExampleGetClassMethod.a at 0x79670313a0>, <function ExampleGetClassMethod.b at 0x79779b6c00>, <function ExampleGetClassMethod.c at 0x79670f1580>, <function ExampleGetClassMethod.d at 0x79670f1620>]
373
248
  ```
374
249
 
375
250
  ## get_filemtime
@@ -377,7 +252,7 @@ Output:
377
252
  `get_filemtime(filename)`
378
253
 
379
254
  Mengambil informasi last modification time file dalam nano seconds
380
-
255
+
381
256
  ```python
382
257
  print(get_filemtime(__file__))
383
258
  ```
@@ -392,7 +267,7 @@ Output:
392
267
  `get_filesize(filename)`
393
268
 
394
269
  Mengambil informasi file size dalam bytes
395
-
270
+
396
271
  ```python
397
272
  print(get_filesize(__file__))
398
273
  ```
@@ -408,7 +283,7 @@ Output:
408
283
 
409
284
  Mendapatkan value dari object berdasarkan indexnya.
410
285
  Jika error out of range maka akan mengembalikan on_error.
411
-
286
+
412
287
  ```python
413
288
  l = [1, 3, 5]
414
289
  print(get_from_index(l, 7))
@@ -419,509 +294,343 @@ Output:
419
294
  None
420
295
  ```
421
296
 
422
- ## github_pull
423
-
424
- `github_pull()`
297
+ ## is_empty
425
298
 
426
- Menjalankan command `git pull`
299
+ `is_empty(variable, empty=[None, False, 0, 0, '0', '', '-0', '\n', '\t', set(), {}, [], ()])`
427
300
 
428
- ```py
429
- github_pull()
301
+ Mengecek apakah variable setara dengan nilai kosong pada empty.
302
+
303
+ Pengecekan nilai yang setara menggunakan simbol '==', sedangkan untuk
304
+ pengecekan lokasi memory yang sama menggunakan keyword 'is'
305
+
306
+ ```python
307
+ print(is_empty("teks"))
308
+ print(is_empty(True))
309
+ print(is_empty(False))
310
+ print(is_empty(None))
311
+ print(is_empty(0))
312
+ print(is_empty([]))
430
313
  ```
431
314
 
432
- ## github_push
433
-
434
- `github_push(commit_msg=None)`
435
-
436
- Menjalankan command status, add, commit dan push
437
-
438
- ```py
439
- github_push('Commit Message')
315
+ Output:
316
+ ```py
317
+ False
318
+ False
319
+ True
320
+ True
321
+ True
322
+ True
440
323
  ```
441
324
 
442
- ## github_user
443
-
444
- `github_user(email=None, name=None)`
325
+ ## is_iterable
445
326
 
446
- Menyimpan email dan nama user secara global sehingga tidak perlu
447
- menginput nya setiap saat.
327
+ `is_iterable(var, str_is_iterable=False)`
448
328
 
449
- ```py
450
- github_user('my@emil.com', 'MyName')
329
+ Mengecek apakah suatu variabel bisa dilakukan forloop atau tidak
330
+
331
+ ```python
332
+ s = 'ini string'
333
+ print(is_iterable(s))
334
+
335
+ l = [12,21,2,1]
336
+ print(is_iterable(l))
337
+
338
+ r = range(100)
339
+ print(is_iterable(r))
340
+
341
+ d = {'a':1, 'b':2}
342
+ print(is_iterable(d.values()))
451
343
  ```
452
344
 
453
- ## iargv
454
-
455
- `iargv(key: int, cast=None, on_error=None)`
456
-
457
- ## idumps
345
+ Output:
346
+ ```py
347
+ False
348
+ True
349
+ True
350
+ True
351
+ ```
458
352
 
459
- `idumps(data, syntax='yaml', indent=4)`
353
+ ## is_valid_url
460
354
 
461
- Mengubah variabel data menjadi string untuk yang dapat dibaca untuk disimpan.
462
- String yang dihasilkan berbentuk syntax YAML/JSON/HTML.
355
+ `is_valid_url(path)`
463
356
 
357
+ Mengecek apakah path merupakan URL yang valid atau tidak.
358
+ Cara ini merupakan cara yang paling efektif.
359
+
464
360
  ```python
465
- data = {
466
- 'a': 123,
467
- 't': ['disini', 'senang', 'disana', 'senang'],
468
- 'l': (12, 23, [12, 42]),
469
- }
470
- print(idumps(data))
471
- print(idumps(data, syntax='html'))
361
+ print(is_valid_url("https://chat.openai.com/?model=text-davinci-002-render-sha"))
362
+ print(is_valid_url("https://chat.openai.com/?model/=text-dav/inci-002-render-sha"))
472
363
  ```
473
364
 
474
365
  Output:
475
366
  ```py
476
- a: 123
477
- l: !!python/tuple
478
- - 12
479
- - 23
480
- - - 12
481
- - 42
482
- t:
483
- - disini
484
- - senang
485
- - disana
486
- - senang
367
+ True
368
+ True
369
+ ```
487
370
 
488
- <table>
489
- <tbody>
490
- <tr>
491
- <th>a</th>
492
- <td>
493
- <span>123</span>
494
- </td>
495
- </tr>
496
- <tr>
497
- <th>t</th>
498
- <td>
499
- <ul>
500
- <li>
501
- <span>disini</span>
502
- </li>
503
- <li>
504
- <span>senang</span>
505
- </li>
506
- <li>
507
- <span>disana</span>
508
- </li>
509
- <li>
510
- <span>senang</span>
511
- </li>
512
- </ul>
513
- </td>
514
- </tr>
515
- <tr>
516
- <th>l</th>
517
- <td>
518
- <ul>
519
- <li>
520
- <span>12</span>
521
- </li>
522
- <li>
523
- <span>23</span>
524
- </li>
525
- <li>
526
- <ul>
527
- <li>
528
- <span>12</span>
529
- </li>
530
- <li>
531
- <span>42</span>
532
- </li>
533
- </ul>
534
- </li>
535
- </ul>
536
- </td>
537
- </tr>
538
- </tbody>
539
- </table>
371
+ ## ivars
372
+
373
+ `ivars(obj, skip_underscore=True)`
540
374
 
375
+ Membuat dictionary berdasarkan kategori untuk setiap
376
+ member dari object.
377
+
378
+ ```python
379
+ iprint(ivars(__import__('pypipr')))
541
380
  ```
542
381
 
543
- ## idumps_html
382
+ Output:
383
+ ```py
384
+ {'module': {'ibuiltins': <module 'pypipr.ibuiltins' from '/data/data/com.termux/files/home/pypipr/pypipr/ibuiltins/__init__.py'>,
385
+ 'iconsole': <module 'pypipr.iconsole' from '/data/data/com.termux/files/home/pypipr/pypipr/iconsole/__init__.py'>,
386
+ 'idjango': <module 'pypipr.idjango' from '/data/data/com.termux/files/home/pypipr/pypipr/idjango/__init__.py'>,
387
+ 'iengineering': <module 'pypipr.iengineering' from '/data/data/com.termux/files/home/pypipr/pypipr/iengineering/__init__.py'>,
388
+ 'ifunctions': <module 'pypipr.ifunctions' from '/data/data/com.termux/files/home/pypipr/pypipr/ifunctions/__init__.py'>,
389
+ 'iflow': <module 'pypipr.iflow' (<_frozen_importlib_external.NamespaceLoader object at 0x7974167690>)>,
390
+ 'asyncio': <module 'asyncio' from '/data/data/com.termux/files/usr/lib/python3.11/asyncio/__init__.py'>,
391
+ 'colorama': <module 'colorama' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/colorama/__init__.py'>,
392
+ 'datetime': <module 'datetime' from '/data/data/com.termux/files/usr/lib/python3.11/datetime.py'>,
393
+ 'functools': <module 'functools' from '/data/data/com.termux/files/usr/lib/python3.11/functools.py'>,
394
+ 'inspect': <module 'inspect' from '/data/data/com.termux/files/usr/lib/python3.11/inspect.py'>,
395
+ 'io': <module 'io' (frozen)>,
396
+ 'json': <module 'json' from '/data/data/com.termux/files/usr/lib/python3.11/json/__init__.py'>,
397
+ 'lxml': <module 'lxml' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/lxml/__init__.py'>,
398
+ 'math': <module 'math' from '/data/data/com.termux/files/usr/lib/python3.11/lib-dynload/math.cpython-311.so'>,
399
+ 'multiprocessing': <module 'multiprocessing' from '/data/data/com.termux/files/usr/lib/python3.11/multiprocessing/__init__.py'>,
400
+ 'operator': <module 'operator' from '/data/data/com.termux/files/usr/lib/python3.11/operator.py'>,
401
+ 'os': <module 'os' (frozen)>,
402
+ 'pathlib': <module 'pathlib' from '/data/data/com.termux/files/usr/lib/python3.11/pathlib.py'>,
403
+ 'pint': <module 'pint' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/pint/__init__.py'>,
404
+ 'pprint': <module 'pprint' from '/data/data/com.termux/files/usr/lib/python3.11/pprint.py'>,
405
+ 'queue': <module 'queue' from '/data/data/com.termux/files/usr/lib/python3.11/queue.py'>,
406
+ 'random': <module 'random' from '/data/data/com.termux/files/usr/lib/python3.11/random.py'>,
407
+ 're': <module 're' from '/data/data/com.termux/files/usr/lib/python3.11/re/__init__.py'>,
408
+ 'requests': <module 'requests' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/requests/__init__.py'>,
409
+ 'string': <module 'string' from '/data/data/com.termux/files/usr/lib/python3.11/string.py'>,
410
+ 'subprocess': <module 'subprocess' from '/data/data/com.termux/files/usr/lib/python3.11/subprocess.py'>,
411
+ 'sys': <module 'sys' (built-in)>,
412
+ 'textwrap': <module 'textwrap' from '/data/data/com.termux/files/usr/lib/python3.11/textwrap.py'>,
413
+ 'threading': <module 'threading' from '/data/data/com.termux/files/usr/lib/python3.11/threading.py'>,
414
+ 'time': <module 'time' (built-in)>,
415
+ 'tzdata': <module 'tzdata' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/tzdata/__init__.py'>,
416
+ 'uuid': <module 'uuid' from '/data/data/com.termux/files/usr/lib/python3.11/uuid.py'>,
417
+ 'webbrowser': <module 'webbrowser' from '/data/data/com.termux/files/usr/lib/python3.11/webbrowser.py'>,
418
+ 'yaml': <module 'yaml' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/yaml/__init__.py'>,
419
+ 'zoneinfo': <module 'zoneinfo' from '/data/data/com.termux/files/usr/lib/python3.11/zoneinfo/__init__.py'>},
420
+ 'class': {'ComparePerformance': <class 'pypipr.ibuiltins.ComparePerformance.ComparePerformance'>,
421
+ 'RunParallel': <class 'pypipr.ibuiltins.RunParallel.RunParallel'>,
422
+ 'APIMixinView': <class 'pypipr.idjango.APIMixinView.APIMixinView'>,
423
+ 'PintUregQuantity': <class 'pint.Quantity'>},
424
+ 'variable': {'LINUX': True,
425
+ 'WINDOWS': False,
426
+ 'PintUreg': <pint.registry.UnitRegistry object at 0x7974d973d0>},
427
+ 'function': {'avg': <function avg at 0x79779b6d40>,
428
+ 'basename': <function basename at 0x7977986a20>,
429
+ 'chunk_array': <function chunk_array at 0x7974cd1120>,
430
+ 'create_folder': <function create_folder at 0x7974cd1300>,
431
+ 'datetime_from_string': <function datetime_from_string at 0x7974cd14e0>,
432
+ 'datetime_now': <function datetime_now at 0x7974d7a160>,
433
+ 'dict_first': <function dict_first at 0x7974d7a0c0>,
434
+ 'dirname': <function dirname at 0x7974d7a020>,
435
+ 'exit_if_empty': <function exit_if_empty at 0x7974d534c0>,
436
+ 'filter_empty': <function filter_empty at 0x7974d79d00>,
437
+ 'get_class_method': <function get_class_method at 0x7974d798a0>,
438
+ 'get_filemtime': <function get_filemtime at 0x7974d79800>,
439
+ 'get_filesize': <function get_filesize at 0x7974d79620>,
440
+ 'get_from_index': <function get_from_index at 0x7974d794e0>,
441
+ 'is_empty': <function is_empty at 0x7974d79da0>,
442
+ 'is_iterable': <function is_iterable at 0x7974d7a200>,
443
+ 'is_valid_url': <function is_valid_url at 0x7974d793a0>,
444
+ 'ivars': <function ivars at 0x7974d79300>,
445
+ 'password_generator': <function password_generator at 0x7974d791c0>,
446
+ 'random_bool': <function random_bool at 0x7974d78d60>,
447
+ 'set_timeout': <function set_timeout at 0x7974d7b7e0>,
448
+ 'sets_ordered': <function sets_ordered at 0x7974d7b920>,
449
+ 'str_cmp': <function str_cmp at 0x7974d7b9c0>,
450
+ 'to_str': <function to_str at 0x7974d79bc0>,
451
+ 'choices': <function choices at 0x7974d7ba60>,
452
+ 'console_run': <function console_run at 0x7974d7bce0>,
453
+ 'input_char': <function input_char at 0x7974d7be20>,
454
+ 'log': <function log at 0x7974d9c040>,
455
+ 'print_colorize': <function print_colorize at 0x7974d9c0e0>,
456
+ 'print_dir': <function print_dir at 0x7974d9c220>,
457
+ 'print_log': <function print_log at 0x7974d7bec0>,
458
+ 'print_to_last_line': <function print_to_last_line at 0x7974d7bc40>,
459
+ 'text_colorize': <function text_colorize at 0x7974d7bd80>,
460
+ 'batch_calculate': <function batch_calculate at 0x796af39580>,
461
+ 'batchmaker': <function batchmaker at 0x796af1e980>,
462
+ 'calculate': <function calculate at 0x796af3a2a0>,
463
+ 'auto_reload': <function auto_reload at 0x796af3a480>,
464
+ 'github_pull': <function github_pull at 0x796af3a020>,
465
+ 'github_push': <function github_push at 0x796af3a700>,
466
+ 'github_user': <function github_user at 0x796af3aa20>,
467
+ 'pip_freeze_without_version': <function pip_freeze_without_version at 0x796ac71f80>,
468
+ 'poetry_publish': <function poetry_publish at 0x796ac72160>,
469
+ 'poetry_update_version': <function poetry_update_version at 0x796ac96980>,
470
+ 'iargv': <function iargv at 0x79672bc0e0>,
471
+ 'idumps': <function idumps at 0x79672bc220>,
472
+ 'idumps_html': <function idumps_html at 0x7967320c20>,
473
+ 'ienv': <function ienv at 0x79672bc360>,
474
+ 'iexec': <function iexec at 0x7967320ea0>,
475
+ 'ijoin': <function ijoin at 0x796ac71ee0>,
476
+ 'iloads': <function iloads at 0x7967320f40>,
477
+ 'iloads_html': <function iloads_html at 0x79673211c0>,
478
+ 'iopen': <function iopen at 0x796ac72200>,
479
+ 'iprint': <function iprint at 0x79672bc180>,
480
+ 'irange': <function irange at 0x796af3a3e0>,
481
+ 'ireplace': <function ireplace at 0x7967321080>,
482
+ 'iscandir': <function iscandir at 0x7967322e80>,
483
+ 'isplit': <function isplit at 0x7967322f20>}}
484
+ ```
544
485
 
545
- `idumps_html(data, indent=None)`
486
+ ## password_generator
546
487
 
547
- Serialisasi python variabel menjadi HTML.
548
- ```
549
- List -> <ul>...</ul>
550
- Dict -> <table>...</table>
551
- ```
488
+ `password_generator(length=8, characters='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~')`
552
489
 
490
+ Membuat pssword secara acak
491
+
553
492
  ```python
554
- data = {
555
- 'abc': 123,
556
- 'list': [1, 2, 3, 4, 5],
557
- 'dict': {'a': 1, 'b':2, 'c':3},
558
- }
559
- print(idumps_html(data))
493
+ print(password_generator())
560
494
  ```
561
495
 
562
496
  Output:
563
497
  ```py
564
- <table>
565
- <tbody>
566
- <tr>
567
- <th>abc</th>
568
- <td>
569
- <span>123</span>
570
- </td>
571
- </tr>
572
- <tr>
573
- <th>list</th>
574
- <td>
575
- <ul>
576
- <li>
577
- <span>1</span>
578
- </li>
579
- <li>
580
- <span>2</span>
581
- </li>
582
- <li>
583
- <span>3</span>
584
- </li>
585
- <li>
586
- <span>4</span>
587
- </li>
588
- <li>
589
- <span>5</span>
590
- </li>
591
- </ul>
592
- </td>
593
- </tr>
594
- <tr>
595
- <th>dict</th>
596
- <td>
597
- <table>
598
- <tbody>
599
- <tr>
600
- <th>a</th>
601
- <td>
602
- <span>1</span>
603
- </td>
604
- </tr>
605
- <tr>
606
- <th>b</th>
607
- <td>
608
- <span>2</span>
609
- </td>
610
- </tr>
611
- <tr>
612
- <th>c</th>
613
- <td>
614
- <span>3</span>
615
- </td>
616
- </tr>
617
- </tbody>
618
- </table>
619
- </td>
620
- </tr>
621
- </tbody>
622
- </table>
623
-
498
+ f]@vt^%Z
624
499
  ```
625
500
 
626
- ## ienv
501
+ ## random_bool
627
502
 
628
- `ienv(on_windows=None, on_linux=None)`
503
+ `random_bool()`
629
504
 
630
- Mengambalikan hasil berdasarkan environment dimana program dijalankan
505
+ Menghasilkan nilai random True atau False.
506
+ Fungsi ini merupakan fungsi tercepat untuk mendapatkan random bool.
507
+ Fungsi ini sangat cepat, tetapi pemanggilan fungsi ini membutuhkan
508
+ overhead yg besar.
509
+
510
+ ```python
511
+ print(random_bool())
512
+ ```
631
513
 
632
- ```py
633
- getch = __import__(ienv(on_windows="msvcrt", on_linux="getch"))
514
+ Output:
515
+ ```py
516
+ False
517
+ ```
634
518
 
635
- inherit = ienv(
636
- on_windows=[BaseForWindows, BaseEnv, object],
637
- on_linux=[SpecialForLinux, BaseForLinux, BaseEnv, object]
638
- )
519
+ ## set_timeout
639
520
 
640
- class ExampleIEnv(*inherit):
641
- pass
521
+ `set_timeout(interval, func, args=None, kwargs=None)`
522
+
523
+ Menjalankan fungsi ketika sudah sekian detik.
524
+ Apabila timeout masih berjalan tapi kode sudah selesai dieksekusi semua, maka
525
+ program tidak akan berhenti sampai timeout selesai, kemudian fungsi dijalankan,
526
+ kemudian program dihentikan.
527
+
528
+ ```python
529
+ set_timeout(3, lambda: print("Timeout 3"))
530
+ x = set_timeout(7, print, args=["Timeout 7"])
531
+ print(x)
532
+ print("menghentikan timeout 7")
533
+ x.cancel()
642
534
  ```
643
535
 
644
- ## iexec
536
+ Output:
537
+ ```py
538
+ <Timer(Thread-2, started 521401433328)>
539
+ menghentikan timeout 7
540
+ ```
645
541
 
646
- `iexec(python_syntax, import_pypipr=True)`
542
+ ## sets_ordered
647
543
 
648
- improve exec() python function untuk mendapatkan outputnya
544
+ `sets_ordered(iterator)`
649
545
 
546
+ Hanya mengambil nilai unik dari suatu list
547
+
650
548
  ```python
651
- print(iexec('print(9*9)'))
549
+ array = [2, 3, 12, 3, 3, 42, 42, 1, 43, 2, 42, 41, 4, 24, 32, 42, 3, 12, 32, 42, 42]
550
+ print(sets_ordered(array))
551
+ print(list(sets_ordered(array)))
652
552
  ```
653
553
 
654
554
  Output:
655
555
  ```py
656
- 81
657
-
556
+ <generator object sets_ordered at 0x79670f8110>
557
+ [2, 3, 12, 42, 1, 43, 41, 4, 24, 32]
658
558
  ```
659
559
 
660
- ## ijoin
661
-
662
- `ijoin(iterable, separator='', start='', end='', remove_empty=False, recursive=True, recursive_flat=False, str_strip=False)`
560
+ ## str_cmp
663
561
 
664
- Simplify Python join functions like PHP function.
665
- Iterable bisa berupa sets, tuple, list, dictionary.
562
+ `str_cmp(t1, t2)`
666
563
 
564
+ Membandingakan string secara incase-sensitive menggunakan lower().
565
+ Lebih cepat dibandingkan upper(), casefold(), re.fullmatch(), len().
566
+ perbandingan ini sangat cepat, tetapi pemanggilan fungsi ini membutuhkan
567
+ overhead yg besar.
568
+
667
569
  ```python
668
- arr = {'asd','dfs','weq','qweqw'}
669
- print(ijoin(arr, ', '))
670
-
671
- arr = '/ini/path/seperti/url/'.split('/')
672
- print(ijoin(arr, ','))
673
- print(ijoin(arr, ',', remove_empty=True))
674
-
675
- arr = {'a':'satu', 'b':(12, 34, 56), 'c':'tiga', 'd':'empat'}
676
- print(ijoin(arr, separator='</li>\n<li>', start='<li>', end='</li>',
677
- recursive_flat=True))
678
- print(ijoin(arr, separator='</div>\n<div>', start='<div>', end='</div>'))
679
- print(ijoin(10, ' '))
570
+ print(str_cmp('teks1', 'Teks1'))
680
571
  ```
681
572
 
682
573
  Output:
683
574
  ```py
684
- asd, dfs, qweqw, weq
685
- ,ini,path,seperti,url,
686
- ini,path,seperti,url
687
- <li>satu</li>
688
- <li>12</li>
689
- <li>34</li>
690
- <li>56</li>
691
- <li>tiga</li>
692
- <li>empat</li>
693
- <div>satu</div>
694
- <div><div>12</div>
695
- <div>34</div>
696
- <div>56</div></div>
697
- <div>tiga</div>
698
- <div>empat</div>
699
- 10
575
+ True
700
576
  ```
701
577
 
702
- ## iloads
703
-
704
- `iloads(data, syntax='yaml')`
578
+ ## to_str
705
579
 
706
- Mengubah string data hasil dari idumps menjadi variabel.
707
- String data adalah berupa syntax YAML.
580
+ `to_str(value)`
708
581
 
582
+ Mengubah value menjadi string literal
583
+
709
584
  ```python
710
- data = {
711
- 'a': 123,
712
- 't': ['disini', 'senang', 'disana', 'senang'],
713
- 'l': (12, 23, [12, 42]),
714
- }
715
- s = idumps(data)
716
- print(iloads(s))
585
+ print(to_str(5))
586
+ print(to_str([]))
587
+ print(to_str(False))
588
+ print(to_str(True))
589
+ print(to_str(None))
717
590
  ```
718
591
 
719
592
  Output:
720
593
  ```py
721
- {'a': 123, 'l': (12, 23, [12, 42]), 't': ['disini', 'senang', 'disana', 'senang']}
722
- ```
594
+ 5
723
595
 
724
- ## iloads_html
596
+ False
597
+ True
725
598
 
726
- `iloads_html(html)`
599
+ ```
727
600
 
728
- Mengambil data yang berupa list `<ul>`, dan table `<table>` dari html
729
- dan menjadikannya data python berupa list.
730
- setiap data yang ditemukan akan dibungkus dengan tuple sebagai separator.
731
- ```
732
- list (<ul>) -> list -> list satu dimensi
733
- table (<table>) -> list[list] -> list satu dimensi didalam list
734
- ```
735
- apabila data berupa ul maka dapat dicek type(data) -> html_ul
736
- apabila data berupa ol maka dapat dicek type(data) -> html_ol
737
- apabila data berupa dl maka dapat dicek type(data) -> html_dl
738
- apabila data berupa table maka dapat dicek type(data) -> html_table
601
+ ## choices
739
602
 
740
- ```python
741
- import pprint
742
- pprint.pprint(iloads_html(iopen("https://harga-emas.org/")), depth=10)
743
- pprint.pprint(iloads_html(iopen("https://harga-emas.org/1-gram/")), depth=10)
603
+ `choices(iterator, title=None, prompt='', default=None)`
604
+
605
+ Memudahkan dalam membuat pilihan untuk user dalam tampilan console
606
+
607
+ ```py
608
+ a = choices("ini hanya satu pilihan")
609
+ b = choices(
610
+ {
611
+ "sedan": "audi",
612
+ "suv": "volvo",
613
+ "truck": "tesla",
614
+ },
615
+ title="Car Model",
616
+ prompt="Pilih Mobil : ",
617
+ )
618
+ c = choices(
619
+ iscandir(recursive=False),
620
+ title="List File dan Folder",
621
+ prompt="Pilih File atau Folder : ",
622
+ )
744
623
  ```
745
624
 
746
- Output:
747
- ```py
748
- (['Home', 'Emas 1 Gram', 'History', 'Trend', 'Perak 1 Gram', 'Pluang'],
749
- [['Harga Emas Hari Ini - Selasa, 23 April 2024'],
750
- ['Spot Emas USD↓2.305,35 (-24,78) / oz',
751
- 'Kurs IDR↓16.224,00 (-56,00) / USD',
752
- 'Emas IDR↓1.202.502 (-17.121) / gr'],
753
- ['LM Antam (Jual)↓1.325.000 (-18.000) / gr',
754
- 'LM Antam (Beli)↓1.223.000 (-15.000) / gr']],
755
- [['Harga Emas Hari Ini'],
756
- ['Gram', 'Gedung Antam Jakarta', 'Pegadaian'],
757
- ['per Gram (Rp)', 'per Batangan (Rp)', 'per Gram (Rp)', 'per Batangan (Rp)'],
758
- ['1000',
759
- '1.266 (-18)',
760
- '1.265.600 (-18.000)',
761
- '1.043.040 (+8.200)',
762
- '1.043.040.000 (+8.200.000)'],
763
- ['500',
764
- '2.531 (-36)',
765
- '1.265.640 (-18.000)',
766
- '1.043.082 (+8.200)',
767
- '521.541.000 (+4.100.000)'],
768
- ['250',
769
- '5.064 (-72)',
770
- '1.266.060 (-18.000)',
771
- '1.043.512 (+8.200)',
772
- '260.878.000 (+2.050.000)'],
773
- ['100',
774
- '12.671 (-180)',
775
- '1.267.120 (-18.000)',
776
- '1.044.600 (+8.200)',
777
- '104.460.000 (+820.000)'],
778
- ['50',
779
- '25.358 (-360)',
780
- '1.267.900 (-18.000)',
781
- '1.045.400 (+8.200)',
782
- '52.270.000 (+410.000)'],
783
- ['25',
784
- '50.779 (-720)',
785
- '1.269.480 (-18.000)',
786
- '1.047.040 (+8.200)',
787
- '26.176.000 (+205.000)'],
788
- ['10',
789
- '127.450 (-1.800)',
790
- '1.274.500 (-18.000)',
791
- '1.052.200 (+8.200)',
792
- '10.522.000 (+82.000)'],
793
- ['5',
794
- '256.000 (-3.600)',
795
- '1.280.000 (-18.000)',
796
- '1.057.800 (+8.200)',
797
- '5.289.000 (+41.000)'],
798
- ['3',
799
- '428.889 (-6.000)',
800
- '1.286.667 (-18.000)',
801
- '1.064.667 (+8.000)',
802
- '3.194.000 (+24.000)'],
803
- ['2',
804
- '647.500 (-9.000)',
805
- '1.295.000 (-18.000)',
806
- '1.073.500 (+8.500)',
807
- '2.147.000 (+17.000)'],
808
- ['1',
809
- '1.325.000 (-18.000)',
810
- '1.325.000 (-18.000)',
811
- '1.104.000 (+8.000)',
812
- '1.104.000 (+8.000)'],
813
- ['0.5',
814
- '2.850.000 (-36.000)',
815
- '1.425.000 (-18.000)',
816
- '1.208.000 (+8.000)',
817
- '604.000 (+4.000)'],
818
- ['Update harga LM Antam :23 April 2024, pukul 07:56Harga pembelian kembali '
819
- ':Rp. 1.223.000/gram (-15.000)',
820
- 'Update harga LM Pegadaian :31 Agustus 2023']],
821
- [['Spot Harga Emas Hari Ini (Market Open)'],
822
- ['Satuan', 'USD', 'Kurs\xa0Dollar', 'IDR'],
823
- ['Ounce\xa0(oz)', '2.305,35 (-24,78)', '16.224,00 (-56,00)', '37.401.998'],
824
- ['Gram\xa0(gr)', '74,12', '16.224,00', '1.202.502 (-17.121)'],
825
- ['Kilogram\xa0(kg)', '74.118,72', '16.224,00', '1.202.502.173'],
826
- ['Update harga emas :23 April 2024, pukul 15:39Update kurs :23 April 2024, '
827
- 'pukul 13:10']],
828
- [['Gram', 'UBS Gold 99.99%'],
829
- ['Jual', 'Beli'],
830
- ['/ Batang', '/ Gram', '/ Batang', '/ Gram'],
831
- ['100',
832
- '126.712.000 (-1.488.000)',
833
- '1.267.120 (-14.880)',
834
- '123.735.000 (-3.350.000)',
835
- '1.237.350 (-33.500)'],
836
- ['50',
837
- '63.395.000 (-855.000)',
838
- '1.267.900 (-17.100)',
839
- '61.920.000 (-1.675.000)',
840
- '1.238.400 (-33.500)'],
841
- ['25',
842
- '31.737.000 (-413.000)',
843
- '1.269.480 (-16.520)',
844
- '31.062.500 (-837.500)',
845
- '1.242.500 (-33.500)'],
846
- ['10',
847
- '12.745.000 (-165.000)',
848
- '1.274.500 (-16.500)',
849
- '12.475.000 (-335.000)',
850
- '1.247.500 (-33.500)'],
851
- ['5',
852
- '6.400.000 (-80.000)',
853
- '1.280.000 (-16.000)',
854
- '6.289.500 (-167.500)',
855
- '1.257.900 (-33.500)'],
856
- ['1',
857
- '1.325.000 (-15.000)',
858
- '1.325.000 (-15.000)',
859
- '1.290.500 (-33.500)',
860
- '1.290.500 (-33.500)'],
861
- ['', 'Update :23 April 2024, pukul 11:31']],
862
- [['Konversi Satuan'],
863
- ['Satuan', 'Ounce (oz)', 'Gram (gr)', 'Kilogram (kg)'],
864
- ['Ounce\xa0(oz)', '1', '31,1034767696', '0,0311034768'],
865
- ['Gram\xa0(gr)', '0,0321507466', '1', '0.001'],
866
- ['Kilogram\xa0(kg)', '32,1507466000', '1.000', '1']],
867
- [['Pergerakan Harga Emas Dunia'],
868
- ['Waktu', 'Emas'],
869
- ['Unit', 'USD', 'IDR'],
870
- ['Angka', '+/-', 'Angka', '+/-'],
871
- ['Hari Ini', 'Kurs', '', '', '16.280', '-56-0,34%'],
872
- ['oz', '2.330,13', '-24,78-1,06%', '37.934.516', '-532.518-1,40%'],
873
- ['gr', '74,92', '-0,80-1,06%', '1.219.623', '-17.121-1,40%'],
874
- ['30 Hari', 'Kurs', '', '', '15.662', '+562+3,59%'],
875
- ['oz', '2.165,64', '+139,71+6,45%', '33.918.254', '+3.483.745+10,27%'],
876
- ['gr', '69,63', '+4,49+6,45%', '1.090.497', '+112.005+10,27%'],
877
- ['2 Bulan', 'Kurs', '', '', '15.630', '+594+3,80%'],
878
- ['oz', '2.038,19', '+267,16+13,11%', '31.856.910', '+5.545.089+17,41%'],
879
- ['gr', '65,53', '+8,59+13,11', '1.024.223', '+178.279+17,41%'],
880
- ['6 Bulan', 'Kurs', '', '', '15.871', '+353+2,22%'],
881
- ['oz', '1.984,00', '+321,35+16,20%', '31.488.064', '+5.913.934+18,78%'],
882
- ['gr', '63,79', '+10,33+16,20%', '1.012.365', '+190.137+18,78%'],
883
- ['1 Tahun', 'Kurs', '', '', '15.731', '+493+3,13%'],
884
- ['oz', '1.823,86', '+481,49+26,40%', '28.691.142', '+8.710.857+30,36%'],
885
- ['gr', '58,64', '+15,48+26,40%', '922.442', '+280.061+30,36%'],
886
- ['2 Tahun', 'Kurs', '', '', '14.348', '+1.876+13,07%'],
887
- ['oz', '1.931,96', '+373,39+19,33%', '27.719.762', '+9.682.236+34,93%'],
888
- ['gr', '62,11', '+12,00+19,33%', '891.211', '+311.291+34,93%'],
889
- ['3 Tahun', 'Kurs', '', '', '14.530', '+1.694+11,66%'],
890
- ['oz', '1.777,11', '+528,24+29,72%', '25.821.408', '+11.580.590+44,85%'],
891
- ['gr', '57,14', '+16,98+29,72%', '830.178', '+372.325+44,85%'],
892
- ['5 Tahun', 'Kurs', '', '', '14.154', '+2.070+14,62%'],
893
- ['oz', '1.277,64', '+1.027,71+80,44%', '18.083.717', '+19.318.282+106,83%'],
894
- ['gr', '41,08', '+33,04+80,44%', '581.405', '+621.097+106,83%']])
895
- (['Home', 'Emas 1 Gram', 'History', 'Trend', 'Perak 1 Gram', 'Pluang'],
896
- [[''],
897
- ['Emas 24 KaratHarga Emas 1 Gram', ''],
898
- ['USD', '74,10↓', '-0,82-1,09%'],
899
- ['KURS', '16.223,45↓', '-22,90-0,14%'],
900
- ['IDR', '1.202.216,26↓', '-14.885,86-1,22%'],
901
- ['Selasa, 23 April 2024 15:40']],
902
- [[''],
903
- ['Emas 1 Gram (IDR)Emas 1 Gram (USD)Kurs USD-IDR',
904
- 'Hari Ini',
905
- '1 Bulan',
906
- '1 Tahun',
907
- '5 Tahun',
908
- 'Max',
909
- '']],
910
- [['Pergerakkan Harga Emas 1 Gram'],
911
- ['', 'Penutupan Kemarin', 'Pergerakkan Hari Ini', 'Rata-rata'],
912
- ['USD', '74,92', '74,10 - 74,92', '74,51'],
913
- ['KURS', '16.246,35', '16.223,45 - 16.246,35', '16.234,90'],
914
- ['IDR', '1.217.102,12', '1.202.216,26 - 1.217.102,12', '1.209.659,19'],
915
- [''],
916
- ['', 'Awal Tahun', 'Pergerakkan YTD', '+/- YTD'],
917
- ['USD', '66,32', '64,07 - 77,14', '+7,78 (11,73%)'],
918
- ['KURS', '15.390,10', '15.390,00 - 16.307,80', '+833,35 (5,41%)'],
919
- ['IDR', '1.020.729,53', '997.660,12 - 1.256.829,06', '+181.486,73 (17,78%)'],
920
- [''],
921
- ['', 'Tahun Lalu / 52 Minggu', 'Pergerakkan 52 Minggu', '+/- 52 Minggu'],
922
- ['USD', '63,76', '58,43 - 77,14', '+10,34 (16,22%)'],
923
- ['KURS', '14.936,00', '14.669,40 - 16.307,80', '+1.287,45 (8,62%)'],
924
- ['IDR', '952.339,68', '912.925,68 - 1.256.829,06', '+249.876,58 (26,24%)']])
625
+ ## console_run
626
+
627
+ `console_run(info, command=None, print_info=True, capture_output=False)`
628
+
629
+ Menjalankan command seperti menjalankan command di Command Terminal
630
+
631
+ ```py
632
+ console_run('dir')
633
+ console_run('ls')
925
634
  ```
926
635
 
927
636
  ## input_char
@@ -929,383 +638,289 @@ Output:
929
638
  `input_char(prompt=None, prompt_ending='', newline_after_input=True, echo_char=True, default=None)`
930
639
 
931
640
  Meminta masukan satu huruf tanpa menekan Enter.
932
-
641
+
933
642
  ```py
934
643
  input_char("Input char : ")
935
644
  input_char("Input char : ", default='Y')
936
645
  input_char("Input Char without print : ", echo_char=False)
937
646
  ```
938
647
 
939
- ## iopen
940
-
941
- `iopen(path, data=None, regex=None, css_select=None, xpath=None, file_append=False)`
648
+ ## log
942
649
 
943
- Membaca atau Tulis pada path yang bisa merupakan FILE maupun URL.
650
+ `log(text=None)`
944
651
 
945
- Baca File :
946
- - Membaca seluruh file.
947
- - Jika berhasil content dapat diparse dengan regex.
948
- - Apabila File berupa html, dapat diparse dengan css atau xpath.
652
+ Decorator untuk mempermudah pembuatan log karena tidak perlu mengubah
653
+ fungsi yg sudah ada.
654
+ Melakukan print ke console untuk menginformasikan proses yg sedang
655
+ berjalan didalam program.
656
+
657
+ ```py
658
+ @log
659
+ def some_function():
660
+ pass
661
+
662
+ @log()
663
+ def some_function_again():
664
+ pass
665
+
666
+ @log("Calling some function")
667
+ def some_function_more():
668
+ pass
669
+
670
+ some_function()
671
+ some_function_again()
672
+ some_function_more()
673
+ ```
949
674
 
950
- Tulis File :
951
- - Menulis pada file.
952
- - Jika file tidak ada maka akan dibuat.
953
- - Jika file memiliki content maka akan di overwrite.
675
+ ## print_colorize
954
676
 
955
- Membaca URL :
956
- - Mengakses URL dan mengembalikan isi html nya berupa teks.
957
- - Content dapat diparse dengan regex, css atau xpath.
677
+ `print_colorize(text, color='\x1b[32m', bright='\x1b[1m', color_end='\x1b[0m', text_start='', text_end='\n')`
958
678
 
959
- Tulis URL :
960
- - Mengirimkan data dengan metode POST ke url.
961
- - Jika berhasil dan response memiliki content, maka dapat diparse
962
- dengan regex, css atau xpath.
679
+ Print text dengan warna untuk menunjukan text penting
680
+
681
+ ```py
682
+ print_colorize("Print some text")
683
+ print_colorize("Print some text", color=colorama.Fore.RED)
684
+ ```
963
685
 
686
+ ## print_dir
687
+
688
+ `print_dir(var, colorize=True)`
964
689
 
690
+ Print property dan method yang tersedia pada variabel
691
+
965
692
  ```python
966
- # FILE
967
- print(iopen("__iopen.txt", "mana aja"))
968
- print(iopen("__iopen.txt", regex="(\w+)"))
969
- # URL
970
- print(iopen("https://www.google.com/", css_select="a"))
971
- print(iopen("https://www.google.com/", dict(coba="dulu"), xpath="//a"))
693
+ import pathlib
694
+ p = pathlib.Path("https://www.google.com/")
695
+ print_dir(p, colorize=False)
972
696
  ```
973
697
 
974
698
  Output:
975
699
  ```py
976
- 8
977
- ['mana', 'aja']
978
- [<Element a at 0x7eda9db570>, <Element a at 0x7ef27bdbd0>, <Element a at 0x7eda9b19a0>, <Element a at 0x7eda9b1a40>, <Element a at 0x7eda9b1a90>, <Element a at 0x7eda9b1ae0>, <Element a at 0x7eda9b1b30>, <Element a at 0x7eda9b1b80>, <Element a at 0x7eda9b1bd0>, <Element a at 0x7eda9b1c20>, <Element a at 0x7eda9b1c70>, <Element a at 0x7eda9b1cc0>, <Element a at 0x7eda9b1d10>, <Element a at 0x7eda9b1d60>, <Element a at 0x7eda9b1db0>, <Element a at 0x7eda9b1e00>, <Element a at 0x7eda9b1e50>, <Element a at 0x7eda9b1ea0>]
979
- False
980
- ```
700
+ __bytes__ : b'https:/www.google.com'
701
+ __class__ : .
702
+ __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']
703
+ __doc__ : Path subclass for non-Windows systems.
981
704
 
982
- ## iprint
705
+ On a POSIX system, instantiating a Path should return this object.
706
+
707
+ __enter__ : https:/www.google.com
708
+ __fspath__ : https:/www.google.com
709
+ __getstate__ : (None, {'_drv': '', '_root': '', '_parts': ['https:', 'www.google.com'], '_str': 'https:/www.google.com'})
710
+ __hash__ : 4247590312272611726
711
+ __init__ : None
712
+ __init_subclass__ : None
713
+ __module__ : pathlib
714
+ __reduce__ : (<class 'pathlib.PosixPath'>, ('https:', 'www.google.com'))
715
+ __repr__ : PosixPath('https:/www.google.com')
716
+ __sizeof__ : 72
717
+ __slots__ : ()
718
+ __str__ : https:/www.google.com
719
+ __subclasshook__ : NotImplemented
720
+ _cached_cparts : ['https:', 'www.google.com']
721
+ _cparts : ['https:', 'www.google.com']
722
+ _drv :
723
+ _flavour : <pathlib._PosixFlavour object at 0x7974d4c250>
724
+ _hash : 4247590312272611726
725
+ _parts : ['https:', 'www.google.com']
726
+ _root :
727
+ _str : https:/www.google.com
728
+ absolute : /data/data/com.termux/files/home/pypipr/https:/www.google.com
729
+ anchor :
730
+ as_posix : https:/www.google.com
731
+ cwd : /data/data/com.termux/files/home/pypipr
732
+ drive :
733
+ exists : False
734
+ expanduser : https:/www.google.com
735
+ home : /data/data/com.termux/files/home
736
+ is_absolute : False
737
+ is_block_device : False
738
+ is_char_device : False
739
+ is_dir : False
740
+ is_fifo : False
741
+ is_file : False
742
+ is_mount : False
743
+ is_reserved : False
744
+ is_socket : False
745
+ is_symlink : False
746
+ iterdir : <generator object Path.iterdir at 0x79670dcc80>
747
+ joinpath : https:/www.google.com
748
+ name : www.google.com
749
+ parent : https:
750
+ parents : <PosixPath.parents>
751
+ parts : ('https:', 'www.google.com')
752
+ resolve : /data/data/com.termux/files/home/pypipr/https:/www.google.com
753
+ root :
754
+ stem : www.google
755
+ suffix : .com
756
+ suffixes : ['.google', '.com']
757
+ ```
983
758
 
984
- `iprint(*args, color=None, sort_dicts=False, **kwargs)`
759
+ ## print_log
985
760
 
986
- Improve print function dengan menambahkan color dan pretty print
987
- Color menggunakan colorama Fore + Back + Style
761
+ `print_log(text)`
988
762
 
763
+ Akan melakukan print ke console.
764
+ Berguna untuk memberikan informasi proses program yg sedang berjalan.
765
+
989
766
  ```python
990
- import colorama
991
- iprint(
992
- 'yang ini',
993
- {'12':12,'sdsd':{'12':21,'as':[88]}},
994
- color=colorama.Fore.BLUE + colorama.Style.BRIGHT
995
- )
767
+ print_log("Standalone Log")
996
768
  ```
997
769
 
998
770
  Output:
999
771
  ```py
1000
- yang ini {'12': 12, 'sdsd': {'12': 21, 'as': [88]}}
772
+ >>> Standalone Log
1001
773
  ```
1002
774
 
1003
- ## irange
1004
-
1005
- `irange(start, finish, step=1)`
775
+ ## print_to_last_line
1006
776
 
1007
- Meningkatkan fungsi range() dari python untuk pengulangan menggunakan huruf
777
+ `print_to_last_line(text: str)`
1008
778
 
779
+ Melakukan print ke konsol tetapi akan menimpa baris terakhir.
780
+ Berguna untuk memberikan progress secara interaktif.
781
+
1009
782
  ```python
1010
- print(irange('a', 'c'))
1011
- print(irange('z', 'a', 10))
1012
- print(list(irange('a', 'z', 10)))
1013
- print(list(irange(1, '7')))
1014
- print(list(irange(10, 5)))
783
+ c = input("masukkan apa saja : ")
784
+ print_to_last_line(f"masukkan apa saja : {c} [ok]")
1015
785
  ```
1016
786
 
1017
787
  Output:
1018
788
  ```py
1019
- <generator object irange at 0x7eda92e8a0>
1020
- <generator object irange at 0x7eda92e8a0>
1021
- ['a', 'k', 'u']
1022
- [1, 2, 3, 4, 5, 6, 7]
1023
- [10, 9, 8, 7, 6, 5]
789
+ masukkan apa saja : masukkan apa saja : [ok]
1024
790
  ```
1025
791
 
1026
- ## ireplace
792
+ ## text_colorize
1027
793
 
1028
- `ireplace(string: str, replacements: dict, flags=re.IGNORECASE|re.MULTILINE|re.DOTALL)`
794
+ `text_colorize(text, color='\x1b[32m', bright='\x1b[1m', color_end='\x1b[0m')`
1029
795
 
1030
- STRing TRanslate mengubah string menggunakan kamus dari dict.
1031
- Replacement dapat berupa text biasa ataupun regex pattern.
1032
- Apabila replacement berupa regex, gunakan raw string `r"..."`
1033
- Untuk regex capturing gunakan `(...)`, dan untuk mengaksesnya
1034
- gunakan `\1`, `\2`, .., dst.
796
+ return text dengan warna untuk menunjukan text penting
797
+
798
+ ```py
799
+ text_colorize("Print some text")
800
+ text_colorize("Print some text", color=colorama.Fore.RED)
801
+ ```
1035
802
 
803
+ ## batch_calculate
804
+
805
+ `batch_calculate(pattern)`
806
+
807
+ Analisa perhitungan massal.
808
+ Bisa digunakan untuk mencari alternatif terendah/tertinggi/dsb.
809
+
810
+
1036
811
  ```python
1037
- text = 'aku ini mau ke sini'
1038
- replacements = {
1039
- "sini": "situ",
1040
- r"(ini)": r"itu dan \1",
1041
- }
1042
- print(ireplace(text, replacements))
812
+ print(batch_calculate("{1 10} m ** {1 3}"))
813
+ print(list(batch_calculate("{1 10} m ** {1 3}")))
1043
814
  ```
1044
815
 
1045
816
  Output:
1046
817
  ```py
1047
- aku itu dan ini mau ke situ
818
+ <generator object batch_calculate at 0x7967057c40>
819
+ [('1 m ** 1', <Quantity(1, 'meter')>), ('1 m ** 2', <Quantity(1, 'meter ** 2')>), ('1 m ** 3', <Quantity(1, 'meter ** 3')>), ('2 m ** 1', <Quantity(2, 'meter')>), ('2 m ** 2', <Quantity(2, 'meter ** 2')>), ('2 m ** 3', <Quantity(2, 'meter ** 3')>), ('3 m ** 1', <Quantity(3, 'meter')>), ('3 m ** 2', <Quantity(3, 'meter ** 2')>), ('3 m ** 3', <Quantity(3, 'meter ** 3')>), ('4 m ** 1', <Quantity(4, 'meter')>), ('4 m ** 2', <Quantity(4, 'meter ** 2')>), ('4 m ** 3', <Quantity(4, 'meter ** 3')>), ('5 m ** 1', <Quantity(5, 'meter')>), ('5 m ** 2', <Quantity(5, 'meter ** 2')>), ('5 m ** 3', <Quantity(5, 'meter ** 3')>), ('6 m ** 1', <Quantity(6, 'meter')>), ('6 m ** 2', <Quantity(6, 'meter ** 2')>), ('6 m ** 3', <Quantity(6, 'meter ** 3')>), ('7 m ** 1', <Quantity(7, 'meter')>), ('7 m ** 2', <Quantity(7, 'meter ** 2')>), ('7 m ** 3', <Quantity(7, 'meter ** 3')>), ('8 m ** 1', <Quantity(8, 'meter')>), ('8 m ** 2', <Quantity(8, 'meter ** 2')>), ('8 m ** 3', <Quantity(8, 'meter ** 3')>), ('9 m ** 1', <Quantity(9, 'meter')>), ('9 m ** 2', <Quantity(9, 'meter ** 2')>), ('9 m ** 3', <Quantity(9, 'meter ** 3')>), ('10 m ** 1', <Quantity(10, 'meter')>), ('10 m ** 2', <Quantity(10, 'meter ** 2')>), ('10 m ** 3', <Quantity(10, 'meter ** 3')>)]
1048
820
  ```
1049
821
 
1050
- ## is_empty
1051
-
1052
- `is_empty(variable, empty=[None, False, 0, 0, '0', '', '-0', '\n', '\t', set(), {}, [], ()])`
1053
-
1054
- Mengecek apakah variable setara dengan nilai kosong pada empty.
822
+ ## batchmaker
1055
823
 
1056
- Pengecekan nilai yang setara menggunakan simbol '==', sedangkan untuk
1057
- pengecekan lokasi memory yang sama menggunakan keyword 'is'
824
+ `batchmaker(pattern: str)`
1058
825
 
826
+ Alat Bantu untuk membuat teks yang berulang.
827
+ Gunakan `{[start][separator][finish]([separator][step])}`.
828
+ ```
829
+ [start] dan [finish] -> bisa berupa huruf maupun angka
830
+ ([separator][step]) -> bersifat optional
831
+ [separator] -> selain huruf dan angka
832
+ [step] -> berupa angka positif
833
+ ```
834
+
1059
835
  ```python
1060
- print(is_empty("teks"))
1061
- print(is_empty(True))
1062
- print(is_empty(False))
1063
- print(is_empty(None))
1064
- print(is_empty(0))
1065
- print(is_empty([]))
836
+ s = "Urutan {1/6/3} dan {10:9} dan {j k} dan {Z - A - 15} saja."
837
+ print(batchmaker(s))
838
+ print(list(batchmaker(s)))
1066
839
  ```
1067
840
 
1068
841
  Output:
1069
842
  ```py
1070
- False
1071
- False
1072
- True
1073
- True
1074
- True
1075
- True
843
+ <generator object batchmaker at 0x79670ec160>
844
+ ['Urutan 1 dan 10 dan j dan Z saja.', 'Urutan 1 dan 10 dan j dan K saja.', 'Urutan 1 dan 10 dan k dan Z saja.', 'Urutan 1 dan 10 dan k dan K saja.', 'Urutan 1 dan 9 dan j dan Z saja.', 'Urutan 1 dan 9 dan j dan K saja.', 'Urutan 1 dan 9 dan k dan Z saja.', 'Urutan 1 dan 9 dan k dan K saja.', 'Urutan 4 dan 10 dan j dan Z saja.', 'Urutan 4 dan 10 dan j dan K saja.', 'Urutan 4 dan 10 dan k dan Z saja.', 'Urutan 4 dan 10 dan k dan K saja.', 'Urutan 4 dan 9 dan j dan Z saja.', 'Urutan 4 dan 9 dan j dan K saja.', 'Urutan 4 dan 9 dan k dan Z saja.', 'Urutan 4 dan 9 dan k dan K saja.']
1076
845
  ```
1077
846
 
1078
- ## is_iterable
1079
-
1080
- `is_iterable(var, str_is_iterable=False)`
847
+ ## calculate
1081
848
 
1082
- Mengecek apakah suatu variabel bisa dilakukan forloop atau tidak
849
+ `calculate(teks)`
1083
850
 
851
+ Mengembalikan hasil dari perhitungan teks menggunakan modul pint.
852
+ Mendukung perhitungan matematika dasar dengan satuan.
853
+
854
+ Return value:
855
+ - Berupa class Quantity dari modul pint
856
+
857
+ Format:
858
+ - f"{result:~P}" -> pretty
859
+ - f"{result:~H}" -> html
860
+ - result.to_base_units() -> SI
861
+ - result.to_compact() -> human readable
862
+
1084
863
  ```python
1085
- s = 'ini string'
1086
- print(is_iterable(s))
1087
-
1088
- l = [12,21,2,1]
1089
- print(is_iterable(l))
1090
-
1091
- r = range(100)
1092
- print(is_iterable(r))
1093
-
1094
- d = {'a':1, 'b':2}
1095
- print(is_iterable(d.values()))
864
+ fx = "3 meter * 10 cm * 3 km"
865
+ res = calculate(fx)
866
+ print(res)
867
+ print(res.to_base_units())
868
+ print(res.to_compact())
869
+ print(f"{res:~P}")
870
+ print(f"{res:~H}")
1096
871
  ```
1097
872
 
1098
873
  Output:
1099
874
  ```py
1100
- False
1101
- True
1102
- True
1103
- True
1104
- ```
1105
-
1106
- ## is_valid_url
1107
-
1108
- `is_valid_url(path)`
1109
-
1110
- Mengecek apakah path merupakan URL yang valid atau tidak.
1111
- Cara ini merupakan cara yang paling efektif.
1112
-
1113
- ```python
1114
- print(is_valid_url("https://chat.openai.com/?model=text-davinci-002-render-sha"))
1115
- print(is_valid_url("https://chat.openai.com/?model/=text-dav/inci-002-render-sha"))
1116
- ```
1117
-
1118
- Output:
1119
- ```py
1120
- True
1121
- True
1122
- ```
1123
-
1124
- ## iscandir
1125
-
1126
- `iscandir(folder_name='.', glob_pattern='*', recursive=True, scan_file=True, scan_folder=True)`
1127
-
1128
- Mempermudah scandir untuk mengumpulkan folder dan file.
1129
-
1130
- ```python
1131
- print(iscandir())
1132
- print(list(iscandir("./", recursive=False, scan_file=False)))
1133
- ```
1134
-
1135
- Output:
1136
- ```py
1137
- <generator object iscandir at 0x7eda954840>
1138
- [PosixPath('.git'), PosixPath('.vscode'), PosixPath('pypipr'), PosixPath('__pycache__'), PosixPath('dist')]
875
+ 90 centimeter * kilometer * meter
876
+ 900.0 meter ** 3
877
+ 900.0 meter ** 3
878
+ 90 cm·km·m
879
+ 90 cm km m
1139
880
  ```
1140
881
 
1141
- ## isplit
1142
-
1143
- `isplit(text, separator='', include_separator=False)`
1144
-
1145
- Memecah text menjadi list berdasarkan separator.
882
+ ## auto_reload
1146
883
 
1147
- ```python
1148
- t = '/ini/contoh/path/'
1149
- print(isplit(t, separator='/'))
1150
- ```
884
+ `auto_reload(filename)`
1151
885
 
1152
- Output:
1153
- ```py
1154
- ['', 'ini', 'contoh', 'path', '']
886
+ Menjalankan file python secara berulang.
887
+ Dengan tujuan untuk melihat perubahan secara langsung.
888
+ Pastikan kode aman untuk dijalankan.
889
+ Jalankan kode ini di terminal console.
890
+
891
+ ```py
892
+ python -m pypipr.iflow.auto_reload file_name.py
1155
893
  ```
1156
894
 
1157
- ## ivars
1158
-
1159
- `ivars(obj, skip_underscore=True)`
1160
-
1161
- Membuat dictionary berdasarkan kategori untuk setiap
1162
- member dari object.
895
+ ## github_pull
1163
896
 
1164
- ```python
1165
- iprint(ivars(__import__('pypipr')))
1166
- ```
897
+ `github_pull()`
1167
898
 
1168
- Output:
1169
- ```py
1170
- {'module': {'ibuiltins': <module 'pypipr.ibuiltins' from '/data/data/com.termux/files/home/pypipr/pypipr/ibuiltins/__init__.py'>,
1171
- 'iconsole': <module 'pypipr.iconsole' from '/data/data/com.termux/files/home/pypipr/pypipr/iconsole/__init__.py'>,
1172
- 'idjango': <module 'pypipr.idjango' from '/data/data/com.termux/files/home/pypipr/pypipr/idjango/__init__.py'>,
1173
- 'iengineering': <module 'pypipr.iengineering' from '/data/data/com.termux/files/home/pypipr/pypipr/iengineering/__init__.py'>,
1174
- 'ifunctions': <module 'pypipr.ifunctions' from '/data/data/com.termux/files/home/pypipr/pypipr/ifunctions/__init__.py'>,
1175
- 'iflow': <module 'pypipr.iflow' (<_frozen_importlib_external.NamespaceLoader object at 0x7ee2552090>)>,
1176
- 'colorama': <module 'colorama' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/colorama/__init__.py'>,
1177
- 'datetime': <module 'datetime' from '/data/data/com.termux/files/usr/lib/python3.11/datetime.py'>,
1178
- 'functools': <module 'functools' from '/data/data/com.termux/files/usr/lib/python3.11/functools.py'>,
1179
- 'inspect': <module 'inspect' from '/data/data/com.termux/files/usr/lib/python3.11/inspect.py'>,
1180
- 'io': <module 'io' (frozen)>,
1181
- 'json': <module 'json' from '/data/data/com.termux/files/usr/lib/python3.11/json/__init__.py'>,
1182
- 'lxml': <module 'lxml' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/lxml/__init__.py'>,
1183
- 'math': <module 'math' from '/data/data/com.termux/files/usr/lib/python3.11/lib-dynload/math.cpython-311.so'>,
1184
- 'operator': <module 'operator' from '/data/data/com.termux/files/usr/lib/python3.11/operator.py'>,
1185
- 'os': <module 'os' (frozen)>,
1186
- 'pathlib': <module 'pathlib' from '/data/data/com.termux/files/usr/lib/python3.11/pathlib.py'>,
1187
- 'pint': <module 'pint' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/pint/__init__.py'>,
1188
- 'pprint': <module 'pprint' from '/data/data/com.termux/files/usr/lib/python3.11/pprint.py'>,
1189
- 'queue': <module 'queue' from '/data/data/com.termux/files/usr/lib/python3.11/queue.py'>,
1190
- 'random': <module 'random' from '/data/data/com.termux/files/usr/lib/python3.11/random.py'>,
1191
- 're': <module 're' from '/data/data/com.termux/files/usr/lib/python3.11/re/__init__.py'>,
1192
- 'requests': <module 'requests' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/requests/__init__.py'>,
1193
- 'string': <module 'string' from '/data/data/com.termux/files/usr/lib/python3.11/string.py'>,
1194
- 'subprocess': <module 'subprocess' from '/data/data/com.termux/files/usr/lib/python3.11/subprocess.py'>,
1195
- 'sys': <module 'sys' (built-in)>,
1196
- 'textwrap': <module 'textwrap' from '/data/data/com.termux/files/usr/lib/python3.11/textwrap.py'>,
1197
- 'time': <module 'time' (built-in)>,
1198
- 'tzdata': <module 'tzdata' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/tzdata/__init__.py'>,
1199
- 'uuid': <module 'uuid' from '/data/data/com.termux/files/usr/lib/python3.11/uuid.py'>,
1200
- 'webbrowser': <module 'webbrowser' from '/data/data/com.termux/files/usr/lib/python3.11/webbrowser.py'>,
1201
- 'yaml': <module 'yaml' from '/data/data/com.termux/files/usr/lib/python3.11/site-packages/yaml/__init__.py'>,
1202
- 'zoneinfo': <module 'zoneinfo' from '/data/data/com.termux/files/usr/lib/python3.11/zoneinfo/__init__.py'>},
1203
- 'class': {'ComparePerformance': <class 'pypipr.ibuiltins.ComparePerformance.ComparePerformance'>,
1204
- 'RunParallel': <class 'pypipr.ibuiltins.RunParallel.RunParallel'>,
1205
- 'APIMixinView': <class 'pypipr.idjango.APIMixinView.APIMixinView'>,
1206
- 'PintUregQuantity': <class 'pint.Quantity'>},
1207
- 'variable': {'LINUX': True,
1208
- 'WINDOWS': False,
1209
- 'PintUreg': <pint.registry.UnitRegistry object at 0x7ee978b750>},
1210
- 'function': {'avg': <function avg at 0x7ef27b2d40>,
1211
- 'basename': <function basename at 0x7ef277ea20>,
1212
- 'chunk_array': <function chunk_array at 0x7eee5b0ae0>,
1213
- 'create_folder': <function create_folder at 0x7eee5b0cc0>,
1214
- 'datetime_from_string': <function datetime_from_string at 0x7eee5b0ea0>,
1215
- 'datetime_now': <function datetime_now at 0x7eee633ba0>,
1216
- 'dict_first': <function dict_first at 0x7eee633b00>,
1217
- 'dirname': <function dirname at 0x7eee633a60>,
1218
- 'exit_if_empty': <function exit_if_empty at 0x7eee633920>,
1219
- 'filter_empty': <function filter_empty at 0x7eee6567a0>,
1220
- 'get_class_method': <function get_class_method at 0x7eee655b20>,
1221
- 'get_filemtime': <function get_filemtime at 0x7eee6559e0>,
1222
- 'get_filesize': <function get_filesize at 0x7eee655800>,
1223
- 'get_from_index': <function get_from_index at 0x7eee655620>,
1224
- 'is_empty': <function is_empty at 0x7eee6568e0>,
1225
- 'is_iterable': <function is_iterable at 0x7eee655c60>,
1226
- 'is_valid_url': <function is_valid_url at 0x7eee6556c0>,
1227
- 'ivars': <function ivars at 0x7eee6553a0>,
1228
- 'password_generator': <function password_generator at 0x7eee655300>,
1229
- 'random_bool': <function random_bool at 0x7eee654f40>,
1230
- 'set_timeout': <function set_timeout at 0x7eee6572e0>,
1231
- 'sets_ordered': <function sets_ordered at 0x7eee657420>,
1232
- 'str_cmp': <function str_cmp at 0x7eee6574c0>,
1233
- 'to_str': <function to_str at 0x7eee655bc0>,
1234
- 'choices': <function choices at 0x7eee657560>,
1235
- 'console_run': <function console_run at 0x7eee6577e0>,
1236
- 'input_char': <function input_char at 0x7eee657920>,
1237
- 'log': <function log at 0x7eee657b00>,
1238
- 'print_colorize': <function print_colorize at 0x7eee657ba0>,
1239
- 'print_dir': <function print_dir at 0x7eee657ce0>,
1240
- 'print_log': <function print_log at 0x7eee6579c0>,
1241
- 'print_to_last_line': <function print_to_last_line at 0x7eee657740>,
1242
- 'text_colorize': <function text_colorize at 0x7eee657880>,
1243
- 'batch_calculate': <function batch_calculate at 0x7ee2605080>,
1244
- 'batchmaker': <function batchmaker at 0x7ee25e2480>,
1245
- 'calculate': <function calculate at 0x7ee2605da0>,
1246
- 'auto_reload': <function auto_reload at 0x7ee2605f80>,
1247
- 'github_pull': <function github_pull at 0x7ee2605b20>,
1248
- 'github_push': <function github_push at 0x7ee2606200>,
1249
- 'github_user': <function github_user at 0x7ee2606520>,
1250
- 'pip_freeze_without_version': <function pip_freeze_without_version at 0x7ee2339a80>,
1251
- 'poetry_publish': <function poetry_publish at 0x7ee2339c60>,
1252
- 'poetry_update_version': <function poetry_update_version at 0x7ee235e480>,
1253
- 'iargv': <function iargv at 0x7eddc8bba0>,
1254
- 'idumps': <function idumps at 0x7eddc90360>,
1255
- 'idumps_html': <function idumps_html at 0x7eddcf0720>,
1256
- 'ienv': <function ienv at 0x7eddc8be20>,
1257
- 'iexec': <function iexec at 0x7eddcf09a0>,
1258
- 'ijoin': <function ijoin at 0x7ee23399e0>,
1259
- 'iloads': <function iloads at 0x7eddcf0a40>,
1260
- 'iloads_html': <function iloads_html at 0x7eddcf0cc0>,
1261
- 'iopen': <function iopen at 0x7ee2339d00>,
1262
- 'iprint': <function iprint at 0x7eddc8bc40>,
1263
- 'irange': <function irange at 0x7ee2605ee0>,
1264
- 'ireplace': <function ireplace at 0x7eddcf0b80>,
1265
- 'iscandir': <function iscandir at 0x7eddcf2980>,
1266
- 'isplit': <function isplit at 0x7eddcf2a20>}}
899
+ Menjalankan command `git pull`
900
+
901
+ ```py
902
+ github_pull()
1267
903
  ```
1268
904
 
1269
- ## log
1270
-
1271
- `log(text=None)`
905
+ ## github_push
1272
906
 
1273
- Decorator untuk mempermudah pembuatan log karena tidak perlu mengubah
1274
- fungsi yg sudah ada.
1275
- Melakukan print ke console untuk menginformasikan proses yg sedang
1276
- berjalan didalam program.
907
+ `github_push(commit_msg=None)`
1277
908
 
909
+ Menjalankan command status, add, commit dan push
910
+
1278
911
  ```py
1279
- @log
1280
- def some_function():
1281
- pass
1282
-
1283
- @log()
1284
- def some_function_again():
1285
- pass
1286
-
1287
- @log("Calling some function")
1288
- def some_function_more():
1289
- pass
1290
-
1291
- some_function()
1292
- some_function_again()
1293
- some_function_more()
912
+ github_push('Commit Message')
1294
913
  ```
1295
914
 
1296
- ## password_generator
1297
-
1298
- `password_generator(length=8, characters='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~')`
1299
-
1300
- Membuat pssword secara acak
915
+ ## github_user
1301
916
 
1302
- ```python
1303
- print(password_generator())
1304
- ```
917
+ `github_user(email=None, name=None)`
1305
918
 
1306
- Output:
1307
- ```py
1308
- Lu;'|[qm
919
+ Menyimpan email dan nama user secara global sehingga tidak perlu
920
+ menginput nya setiap saat.
921
+
922
+ ```py
923
+ github_user('my@emil.com', 'MyName')
1309
924
  ```
1310
925
 
1311
926
  ## pip_freeze_without_version
@@ -1314,7 +929,7 @@ Lu;'|[qm
1314
929
 
1315
930
  Memberikan list dari dependencies yang terinstall tanpa version.
1316
931
  Bertujuan untuk menggunakan Batteries Included Python.
1317
-
932
+
1318
933
  ```py
1319
934
  print(pip_freeze_without_version())
1320
935
  ```
@@ -1324,7 +939,7 @@ print(pip_freeze_without_version())
1324
939
  `poetry_publish(token=None)`
1325
940
 
1326
941
  Publish project to pypi,org
1327
-
942
+
1328
943
  ```py
1329
944
  poetry_publish()
1330
945
  ```
@@ -1334,260 +949,635 @@ poetry_publish()
1334
949
  `poetry_update_version(mayor=False, minor=False, patch=False)`
1335
950
 
1336
951
  Update versi pada pyproject.toml menggunakan poetry
1337
-
952
+
1338
953
  ```py
1339
954
  poetry_update_version()
1340
955
  ```
1341
956
 
1342
- ## print_colorize
1343
-
1344
- `print_colorize(text, color='\x1b[32m', bright='\x1b[1m', color_end='\x1b[0m', text_start='', text_end='\n')`
1345
-
1346
- Print text dengan warna untuk menunjukan text penting
1347
-
1348
- ```py
1349
- print_colorize("Print some text")
1350
- print_colorize("Print some text", color=colorama.Fore.RED)
1351
- ```
957
+ ## iargv
1352
958
 
1353
- ## print_dir
959
+ `iargv(key: int, cast=None, on_error=None)`
1354
960
 
1355
- `print_dir(var, colorize=True)`
961
+ ## idumps
1356
962
 
1357
- Print property dan method yang tersedia pada variabel
963
+ `idumps(data, syntax='yaml', indent=4)`
1358
964
 
965
+ Mengubah variabel data menjadi string untuk yang dapat dibaca untuk disimpan.
966
+ String yang dihasilkan berbentuk syntax YAML/JSON/HTML.
967
+
1359
968
  ```python
1360
- import pathlib
1361
- p = pathlib.Path("https://www.google.com/")
1362
- print_dir(p, colorize=False)
969
+ data = {
970
+ 'a': 123,
971
+ 't': ['disini', 'senang', 'disana', 'senang'],
972
+ 'l': (12, 23, [12, 42]),
973
+ }
974
+ print(idumps(data))
975
+ print(idumps(data, syntax='html'))
1363
976
  ```
1364
977
 
1365
978
  Output:
1366
979
  ```py
1367
- __bytes__ : b'https:/www.google.com'
1368
- __class__ : .
1369
- __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']
1370
- __doc__ : Path subclass for non-Windows systems.
980
+ a: 123
981
+ l: !!python/tuple
982
+ - 12
983
+ - 23
984
+ - - 12
985
+ - 42
986
+ t:
987
+ - disini
988
+ - senang
989
+ - disana
990
+ - senang
991
+
992
+ <table>
993
+ <tbody>
994
+ <tr>
995
+ <th>a</th>
996
+ <td>
997
+ <span>123</span>
998
+ </td>
999
+ </tr>
1000
+ <tr>
1001
+ <th>t</th>
1002
+ <td>
1003
+ <ul>
1004
+ <li>
1005
+ <span>disini</span>
1006
+ </li>
1007
+ <li>
1008
+ <span>senang</span>
1009
+ </li>
1010
+ <li>
1011
+ <span>disana</span>
1012
+ </li>
1013
+ <li>
1014
+ <span>senang</span>
1015
+ </li>
1016
+ </ul>
1017
+ </td>
1018
+ </tr>
1019
+ <tr>
1020
+ <th>l</th>
1021
+ <td>
1022
+ <ul>
1023
+ <li>
1024
+ <span>12</span>
1025
+ </li>
1026
+ <li>
1027
+ <span>23</span>
1028
+ </li>
1029
+ <li>
1030
+ <ul>
1031
+ <li>
1032
+ <span>12</span>
1033
+ </li>
1034
+ <li>
1035
+ <span>42</span>
1036
+ </li>
1037
+ </ul>
1038
+ </li>
1039
+ </ul>
1040
+ </td>
1041
+ </tr>
1042
+ </tbody>
1043
+ </table>
1371
1044
 
1372
- On a POSIX system, instantiating a Path should return this object.
1373
-
1374
- __enter__ : https:/www.google.com
1375
- __fspath__ : https:/www.google.com
1376
- __getstate__ : (None, {'_drv': '', '_root': '', '_parts': ['https:', 'www.google.com'], '_str': 'https:/www.google.com'})
1377
- __hash__ : -326134857128647195
1378
- __init__ : None
1379
- __init_subclass__ : None
1380
- __module__ : pathlib
1381
- __reduce__ : (<class 'pathlib.PosixPath'>, ('https:', 'www.google.com'))
1382
- __repr__ : PosixPath('https:/www.google.com')
1383
- __sizeof__ : 72
1384
- __slots__ : ()
1385
- __str__ : https:/www.google.com
1386
- __subclasshook__ : NotImplemented
1387
- _cached_cparts : ['https:', 'www.google.com']
1388
- _cparts : ['https:', 'www.google.com']
1389
- _drv :
1390
- _flavour : <pathlib._PosixFlavour object at 0x7eee61fa90>
1391
- _hash : -326134857128647195
1392
- _parts : ['https:', 'www.google.com']
1393
- _root :
1394
- _str : https:/www.google.com
1395
- absolute : /data/data/com.termux/files/home/pypipr/https:/www.google.com
1396
- anchor :
1397
- as_posix : https:/www.google.com
1398
- cwd : /data/data/com.termux/files/home/pypipr
1399
- drive :
1400
- exists : False
1401
- expanduser : https:/www.google.com
1402
- home : /data/data/com.termux/files/home
1403
- is_absolute : False
1404
- is_block_device : False
1405
- is_char_device : False
1406
- is_dir : False
1407
- is_fifo : False
1408
- is_file : False
1409
- is_mount : False
1410
- is_reserved : False
1411
- is_socket : False
1412
- is_symlink : False
1413
- iterdir : <generator object Path.iterdir at 0x7eda95e6c0>
1414
- joinpath : https:/www.google.com
1415
- name : www.google.com
1416
- parent : https:
1417
- parents : <PosixPath.parents>
1418
- parts : ('https:', 'www.google.com')
1419
- resolve : /data/data/com.termux/files/home/pypipr/https:/www.google.com
1420
- root :
1421
- stem : www.google
1422
- suffix : .com
1423
- suffixes : ['.google', '.com']
1424
1045
  ```
1425
1046
 
1426
- ## print_log
1047
+ ## idumps_html
1427
1048
 
1428
- `print_log(text)`
1049
+ `idumps_html(data, indent=None)`
1429
1050
 
1430
- Akan melakukan print ke console.
1431
- Berguna untuk memberikan informasi proses program yg sedang berjalan.
1051
+ Serialisasi python variabel menjadi HTML.
1052
+ ```
1053
+ List -> <ul>...</ul>
1054
+ Dict -> <table>...</table>
1055
+ ```
1056
+
1057
+ ```python
1058
+ data = {
1059
+ 'abc': 123,
1060
+ 'list': [1, 2, 3, 4, 5],
1061
+ 'dict': {'a': 1, 'b':2, 'c':3},
1062
+ }
1063
+ print(idumps_html(data))
1064
+ ```
1065
+
1066
+ Output:
1067
+ ```py
1068
+ <table>
1069
+ <tbody>
1070
+ <tr>
1071
+ <th>abc</th>
1072
+ <td>
1073
+ <span>123</span>
1074
+ </td>
1075
+ </tr>
1076
+ <tr>
1077
+ <th>list</th>
1078
+ <td>
1079
+ <ul>
1080
+ <li>
1081
+ <span>1</span>
1082
+ </li>
1083
+ <li>
1084
+ <span>2</span>
1085
+ </li>
1086
+ <li>
1087
+ <span>3</span>
1088
+ </li>
1089
+ <li>
1090
+ <span>4</span>
1091
+ </li>
1092
+ <li>
1093
+ <span>5</span>
1094
+ </li>
1095
+ </ul>
1096
+ </td>
1097
+ </tr>
1098
+ <tr>
1099
+ <th>dict</th>
1100
+ <td>
1101
+ <table>
1102
+ <tbody>
1103
+ <tr>
1104
+ <th>a</th>
1105
+ <td>
1106
+ <span>1</span>
1107
+ </td>
1108
+ </tr>
1109
+ <tr>
1110
+ <th>b</th>
1111
+ <td>
1112
+ <span>2</span>
1113
+ </td>
1114
+ </tr>
1115
+ <tr>
1116
+ <th>c</th>
1117
+ <td>
1118
+ <span>3</span>
1119
+ </td>
1120
+ </tr>
1121
+ </tbody>
1122
+ </table>
1123
+ </td>
1124
+ </tr>
1125
+ </tbody>
1126
+ </table>
1127
+
1128
+ ```
1432
1129
 
1130
+ ## ienv
1131
+
1132
+ `ienv(on_windows=None, on_linux=None)`
1133
+
1134
+ Mengambalikan hasil berdasarkan environment dimana program dijalankan
1135
+
1136
+ ```py
1137
+ getch = __import__(ienv(on_windows="msvcrt", on_linux="getch"))
1138
+
1139
+ inherit = ienv(
1140
+ on_windows=[BaseForWindows, BaseEnv, object],
1141
+ on_linux=[SpecialForLinux, BaseForLinux, BaseEnv, object]
1142
+ )
1143
+
1144
+ class ExampleIEnv(*inherit):
1145
+ pass
1146
+ ```
1147
+
1148
+ ## iexec
1149
+
1150
+ `iexec(python_syntax, import_pypipr=True)`
1151
+
1152
+ improve exec() python function untuk mendapatkan outputnya
1153
+
1433
1154
  ```python
1434
- print_log("Standalone Log")
1155
+ print(iexec('print(9*9)'))
1435
1156
  ```
1436
1157
 
1437
1158
  Output:
1438
1159
  ```py
1439
- >>> Standalone Log
1160
+ 81
1161
+
1162
+ ```
1163
+
1164
+ ## ijoin
1165
+
1166
+ `ijoin(iterable, separator='', start='', end='', remove_empty=False, recursive=True, recursive_flat=False, str_strip=False)`
1167
+
1168
+ Simplify Python join functions like PHP function.
1169
+ Iterable bisa berupa sets, tuple, list, dictionary.
1170
+
1171
+ ```python
1172
+ arr = {'asd','dfs','weq','qweqw'}
1173
+ print(ijoin(arr, ', '))
1174
+
1175
+ arr = '/ini/path/seperti/url/'.split('/')
1176
+ print(ijoin(arr, ','))
1177
+ print(ijoin(arr, ',', remove_empty=True))
1178
+
1179
+ arr = {'a':'satu', 'b':(12, 34, 56), 'c':'tiga', 'd':'empat'}
1180
+ print(ijoin(arr, separator='</li>\n<li>', start='<li>', end='</li>',
1181
+ recursive_flat=True))
1182
+ print(ijoin(arr, separator='</div>\n<div>', start='<div>', end='</div>'))
1183
+ print(ijoin(10, ' '))
1184
+ ```
1185
+
1186
+ Output:
1187
+ ```py
1188
+ weq, asd, dfs, qweqw
1189
+ ,ini,path,seperti,url,
1190
+ ini,path,seperti,url
1191
+ <li>satu</li>
1192
+ <li>12</li>
1193
+ <li>34</li>
1194
+ <li>56</li>
1195
+ <li>tiga</li>
1196
+ <li>empat</li>
1197
+ <div>satu</div>
1198
+ <div><div>12</div>
1199
+ <div>34</div>
1200
+ <div>56</div></div>
1201
+ <div>tiga</div>
1202
+ <div>empat</div>
1203
+ 10
1204
+ ```
1205
+
1206
+ ## iloads
1207
+
1208
+ `iloads(data, syntax='yaml')`
1209
+
1210
+ Mengubah string data hasil dari idumps menjadi variabel.
1211
+ String data adalah berupa syntax YAML.
1212
+
1213
+ ```python
1214
+ data = {
1215
+ 'a': 123,
1216
+ 't': ['disini', 'senang', 'disana', 'senang'],
1217
+ 'l': (12, 23, [12, 42]),
1218
+ }
1219
+ s = idumps(data)
1220
+ print(iloads(s))
1221
+ ```
1222
+
1223
+ Output:
1224
+ ```py
1225
+ {'a': 123, 'l': (12, 23, [12, 42]), 't': ['disini', 'senang', 'disana', 'senang']}
1226
+ ```
1227
+
1228
+ ## iloads_html
1229
+
1230
+ `iloads_html(html)`
1231
+
1232
+ Mengambil data yang berupa list `<ul>`, dan table `<table>` dari html
1233
+ dan menjadikannya data python berupa list.
1234
+ setiap data yang ditemukan akan dibungkus dengan tuple sebagai separator.
1235
+ ```
1236
+ list (<ul>) -> list -> list satu dimensi
1237
+ table (<table>) -> list[list] -> list satu dimensi didalam list
1238
+ ```
1239
+ apabila data berupa ul maka dapat dicek type(data) -> html_ul
1240
+ apabila data berupa ol maka dapat dicek type(data) -> html_ol
1241
+ apabila data berupa dl maka dapat dicek type(data) -> html_dl
1242
+ apabila data berupa table maka dapat dicek type(data) -> html_table
1243
+
1244
+ ```python
1245
+ import pprint
1246
+ pprint.pprint(iloads_html(iopen("https://harga-emas.org/")), depth=10)
1247
+ pprint.pprint(iloads_html(iopen("https://harga-emas.org/1-gram/")), depth=10)
1248
+ ```
1249
+
1250
+ Output:
1251
+ ```py
1252
+ Timeout 3
1253
+ (['Home', 'Emas 1 Gram', 'History', 'Trend', 'Perak 1 Gram', 'Pluang'],
1254
+ [['Harga Emas Hari Ini - Selasa, 23 April 2024'],
1255
+ ['Spot Emas USD↓2.303,92 (-26,21) / oz',
1256
+ 'Kurs IDR↓16.224,00 (-56,00) / USD',
1257
+ 'Emas IDR↓1.201.756 (-17.867) / gr'],
1258
+ ['LM Antam (Jual)↓1.325.000 (-18.000) / gr',
1259
+ 'LM Antam (Beli)↓1.223.000 (-15.000) / gr']],
1260
+ [['Harga Emas Hari Ini'],
1261
+ ['Gram', 'Gedung Antam Jakarta', 'Pegadaian'],
1262
+ ['per Gram (Rp)', 'per Batangan (Rp)', 'per Gram (Rp)', 'per Batangan (Rp)'],
1263
+ ['1000',
1264
+ '1.266 (-18)',
1265
+ '1.265.600 (-18.000)',
1266
+ '1.043.040 (+8.200)',
1267
+ '1.043.040.000 (+8.200.000)'],
1268
+ ['500',
1269
+ '2.531 (-36)',
1270
+ '1.265.640 (-18.000)',
1271
+ '1.043.082 (+8.200)',
1272
+ '521.541.000 (+4.100.000)'],
1273
+ ['250',
1274
+ '5.064 (-72)',
1275
+ '1.266.060 (-18.000)',
1276
+ '1.043.512 (+8.200)',
1277
+ '260.878.000 (+2.050.000)'],
1278
+ ['100',
1279
+ '12.671 (-180)',
1280
+ '1.267.120 (-18.000)',
1281
+ '1.044.600 (+8.200)',
1282
+ '104.460.000 (+820.000)'],
1283
+ ['50',
1284
+ '25.358 (-360)',
1285
+ '1.267.900 (-18.000)',
1286
+ '1.045.400 (+8.200)',
1287
+ '52.270.000 (+410.000)'],
1288
+ ['25',
1289
+ '50.779 (-720)',
1290
+ '1.269.480 (-18.000)',
1291
+ '1.047.040 (+8.200)',
1292
+ '26.176.000 (+205.000)'],
1293
+ ['10',
1294
+ '127.450 (-1.800)',
1295
+ '1.274.500 (-18.000)',
1296
+ '1.052.200 (+8.200)',
1297
+ '10.522.000 (+82.000)'],
1298
+ ['5',
1299
+ '256.000 (-3.600)',
1300
+ '1.280.000 (-18.000)',
1301
+ '1.057.800 (+8.200)',
1302
+ '5.289.000 (+41.000)'],
1303
+ ['3',
1304
+ '428.889 (-6.000)',
1305
+ '1.286.667 (-18.000)',
1306
+ '1.064.667 (+8.000)',
1307
+ '3.194.000 (+24.000)'],
1308
+ ['2',
1309
+ '647.500 (-9.000)',
1310
+ '1.295.000 (-18.000)',
1311
+ '1.073.500 (+8.500)',
1312
+ '2.147.000 (+17.000)'],
1313
+ ['1',
1314
+ '1.325.000 (-18.000)',
1315
+ '1.325.000 (-18.000)',
1316
+ '1.104.000 (+8.000)',
1317
+ '1.104.000 (+8.000)'],
1318
+ ['0.5',
1319
+ '2.850.000 (-36.000)',
1320
+ '1.425.000 (-18.000)',
1321
+ '1.208.000 (+8.000)',
1322
+ '604.000 (+4.000)'],
1323
+ ['Update harga LM Antam :23 April 2024, pukul 07:56Harga pembelian kembali '
1324
+ ':Rp. 1.223.000/gram (-15.000)',
1325
+ 'Update harga LM Pegadaian :31 Agustus 2023']],
1326
+ [['Spot Harga Emas Hari Ini (Market Open)'],
1327
+ ['Satuan', 'USD', 'Kurs\xa0Dollar', 'IDR'],
1328
+ ['Ounce\xa0(oz)', '2.303,92 (-26,21)', '16.224,00 (-56,00)', '37.378.798'],
1329
+ ['Gram\xa0(gr)', '74,07', '16.224,00', '1.201.756 (-17.867)'],
1330
+ ['Kilogram\xa0(kg)', '74.072,75', '16.224,00', '1.201.756.265'],
1331
+ ['Update harga emas :23 April 2024, pukul 18:02Update kurs :23 April 2024, '
1332
+ 'pukul 13:10']],
1333
+ [['Gram', 'UBS Gold 99.99%'],
1334
+ ['Jual', 'Beli'],
1335
+ ['/ Batang', '/ Gram', '/ Batang', '/ Gram'],
1336
+ ['100',
1337
+ '126.712.000 (-1.488.000)',
1338
+ '1.267.120 (-14.880)',
1339
+ '123.735.000 (-3.350.000)',
1340
+ '1.237.350 (-33.500)'],
1341
+ ['50',
1342
+ '63.395.000 (-855.000)',
1343
+ '1.267.900 (-17.100)',
1344
+ '61.920.000 (-1.675.000)',
1345
+ '1.238.400 (-33.500)'],
1346
+ ['25',
1347
+ '31.737.000 (-413.000)',
1348
+ '1.269.480 (-16.520)',
1349
+ '31.062.500 (-837.500)',
1350
+ '1.242.500 (-33.500)'],
1351
+ ['10',
1352
+ '12.745.000 (-165.000)',
1353
+ '1.274.500 (-16.500)',
1354
+ '12.475.000 (-335.000)',
1355
+ '1.247.500 (-33.500)'],
1356
+ ['5',
1357
+ '6.400.000 (-80.000)',
1358
+ '1.280.000 (-16.000)',
1359
+ '6.289.500 (-167.500)',
1360
+ '1.257.900 (-33.500)'],
1361
+ ['1',
1362
+ '1.325.000 (-15.000)',
1363
+ '1.325.000 (-15.000)',
1364
+ '1.290.500 (-33.500)',
1365
+ '1.290.500 (-33.500)'],
1366
+ ['', 'Update :23 April 2024, pukul 11:31']],
1367
+ [['Konversi Satuan'],
1368
+ ['Satuan', 'Ounce (oz)', 'Gram (gr)', 'Kilogram (kg)'],
1369
+ ['Ounce\xa0(oz)', '1', '31,1034767696', '0,0311034768'],
1370
+ ['Gram\xa0(gr)', '0,0321507466', '1', '0.001'],
1371
+ ['Kilogram\xa0(kg)', '32,1507466000', '1.000', '1']],
1372
+ [['Pergerakan Harga Emas Dunia'],
1373
+ ['Waktu', 'Emas'],
1374
+ ['Unit', 'USD', 'IDR'],
1375
+ ['Angka', '+/-', 'Angka', '+/-'],
1376
+ ['Hari Ini', 'Kurs', '', '', '16.280', '-56-0,34%'],
1377
+ ['oz', '2.330,13', '-26,21-1,12%', '37.934.516', '-555.718-1,46%'],
1378
+ ['gr', '74,92', '-0,84-1,12%', '1.219.623', '-17.867-1,46%'],
1379
+ ['30 Hari', 'Kurs', '', '', '15.662', '+562+3,59%'],
1380
+ ['oz', '2.165,64', '+138,28+6,39%', '33.918.254', '+3.460.544+10,20%'],
1381
+ ['gr', '69,63', '+4,45+6,39%', '1.090.497', '+111.259+10,20%'],
1382
+ ['2 Bulan', 'Kurs', '', '', '15.630', '+594+3,80%'],
1383
+ ['oz', '2.038,19', '+265,73+13,04%', '31.856.910', '+5.521.888+17,33%'],
1384
+ ['gr', '65,53', '+8,54+13,04', '1.024.223', '+177.533+17,33%'],
1385
+ ['6 Bulan', 'Kurs', '', '', '15.871', '+353+2,22%'],
1386
+ ['oz', '1.984,00', '+319,92+16,13%', '31.488.064', '+5.890.734+18,71%'],
1387
+ ['gr', '63,79', '+10,29+16,13%', '1.012.365', '+189.391+18,71%'],
1388
+ ['1 Tahun', 'Kurs', '', '', '15.731', '+493+3,13%'],
1389
+ ['oz', '1.823,86', '+480,06+26,32%', '28.691.142', '+8.687.656+30,28%'],
1390
+ ['gr', '58,64', '+15,43+26,32%', '922.442', '+279.315+30,28%'],
1391
+ ['2 Tahun', 'Kurs', '', '', '14.348', '+1.876+13,07%'],
1392
+ ['oz', '1.931,96', '+371,96+19,25%', '27.719.762', '+9.659.036+34,85%'],
1393
+ ['gr', '62,11', '+11,96+19,25%', '891.211', '+310.545+34,85%'],
1394
+ ['3 Tahun', 'Kurs', '', '', '14.530', '+1.694+11,66%'],
1395
+ ['oz', '1.777,11', '+526,81+29,64%', '25.821.408', '+11.557.390+44,76%'],
1396
+ ['gr', '57,14', '+16,94+29,64%', '830.178', '+371.579+44,76%'],
1397
+ ['5 Tahun', 'Kurs', '', '', '14.154', '+2.070+14,62%'],
1398
+ ['oz', '1.277,64', '+1.026,28+80,33%', '18.083.717', '+19.295.082+106,70%'],
1399
+ ['gr', '41,08', '+33,00+80,33%', '581.405', '+620.351+106,70%']])
1400
+ (['Home', 'Emas 1 Gram', 'History', 'Trend', 'Perak 1 Gram', 'Pluang'],
1401
+ [[''],
1402
+ ['Emas 24 KaratHarga Emas 1 Gram', ''],
1403
+ ['USD', '74,07↓', '-0,85-1,13%'],
1404
+ ['KURS', '16.210,30↓', '-36,05-0,22%'],
1405
+ ['IDR', '1.200.741,47↓', '-16.360,65-1,34%'],
1406
+ ['Selasa, 23 April 2024 18:02']],
1407
+ [[''],
1408
+ ['Emas 1 Gram (IDR)Emas 1 Gram (USD)Kurs USD-IDR',
1409
+ 'Hari Ini',
1410
+ '1 Bulan',
1411
+ '1 Tahun',
1412
+ '5 Tahun',
1413
+ 'Max',
1414
+ '']],
1415
+ [['Pergerakkan Harga Emas 1 Gram'],
1416
+ ['', 'Penutupan Kemarin', 'Pergerakkan Hari Ini', 'Rata-rata'],
1417
+ ['USD', '74,92', '74,07 - 74,92', '74,50'],
1418
+ ['KURS', '16.246,35', '16.210,30 - 16.246,35', '16.228,33'],
1419
+ ['IDR', '1.217.102,12', '1.200.741,47 - 1.217.102,12', '1.208.921,80'],
1420
+ [''],
1421
+ ['', 'Awal Tahun', 'Pergerakkan YTD', '+/- YTD'],
1422
+ ['USD', '66,32', '64,07 - 77,14', '+7,75 (11,69%)'],
1423
+ ['KURS', '15.390,10', '15.390,00 - 16.307,80', '+820,20 (5,33%)'],
1424
+ ['IDR', '1.020.729,53', '997.660,12 - 1.256.829,06', '+180.011,94 (17,64%)'],
1425
+ [''],
1426
+ ['', 'Tahun Lalu / 52 Minggu', 'Pergerakkan 52 Minggu', '+/- 52 Minggu'],
1427
+ ['USD', '63,76', '58,43 - 77,14', '+10,31 (16,17%)'],
1428
+ ['KURS', '14.936,00', '14.669,40 - 16.307,80', '+1.274,30 (8,53%)'],
1429
+ ['IDR', '952.339,68', '912.925,68 - 1.256.829,06', '+248.401,79 (26,08%)']])
1440
1430
  ```
1441
1431
 
1442
- ## print_to_last_line
1443
-
1444
- `print_to_last_line(text: str)`
1432
+ ## iopen
1445
1433
 
1446
- Melakukan print ke konsol tetapi akan menimpa baris terakhir.
1447
- Berguna untuk memberikan progress secara interaktif.
1434
+ `iopen(path, data=None, regex=None, css_select=None, xpath=None, file_append=False)`
1448
1435
 
1436
+ Membaca atau Tulis pada path yang bisa merupakan FILE maupun URL.
1437
+
1438
+ Baca File :
1439
+ - Membaca seluruh file.
1440
+ - Jika berhasil content dapat diparse dengan regex.
1441
+ - Apabila File berupa html, dapat diparse dengan css atau xpath.
1442
+
1443
+ Tulis File :
1444
+ - Menulis pada file.
1445
+ - Jika file tidak ada maka akan dibuat.
1446
+ - Jika file memiliki content maka akan di overwrite.
1447
+
1448
+ Membaca URL :
1449
+ - Mengakses URL dan mengembalikan isi html nya berupa teks.
1450
+ - Content dapat diparse dengan regex, css atau xpath.
1451
+
1452
+ Tulis URL :
1453
+ - Mengirimkan data dengan metode POST ke url.
1454
+ - Jika berhasil dan response memiliki content, maka dapat diparse
1455
+ dengan regex, css atau xpath.
1456
+
1457
+
1449
1458
  ```python
1450
- c = input("masukkan apa saja : ")
1451
- print_to_last_line(f"masukkan apa saja : {c} [ok]")
1459
+ # FILE
1460
+ print(iopen("__iopen.txt", "mana aja"))
1461
+ print(iopen("__iopen.txt", regex="(\w+)"))
1462
+ # URL
1463
+ print(iopen("https://www.google.com/", css_select="a"))
1464
+ print(iopen("https://www.google.com/", dict(coba="dulu"), xpath="//a"))
1452
1465
  ```
1453
1466
 
1454
1467
  Output:
1455
1468
  ```py
1456
- masukkan apa saja : masukkan apa saja : [ok]
1469
+ 8
1470
+ ['mana', 'aja']
1471
+ [<Element a at 0x79670e3520>, <Element a at 0x7966f324e0>, <Element a at 0x7966f32580>, <Element a at 0x7966f325d0>, <Element a at 0x7966f32620>, <Element a at 0x7966f32670>, <Element a at 0x7966f326c0>, <Element a at 0x7966f32710>, <Element a at 0x7966f32760>, <Element a at 0x7966f327b0>, <Element a at 0x7966f32800>, <Element a at 0x7966f32850>, <Element a at 0x7966f328a0>, <Element a at 0x7966f328f0>, <Element a at 0x7966f32940>, <Element a at 0x7966f32990>, <Element a at 0x7966f329e0>, <Element a at 0x7966f32a30>]
1472
+ False
1457
1473
  ```
1458
1474
 
1459
- ## random_bool
1460
-
1461
- `random_bool()`
1475
+ ## iprint
1462
1476
 
1463
- Menghasilkan nilai random True atau False.
1464
- Fungsi ini merupakan fungsi tercepat untuk mendapatkan random bool.
1465
- Fungsi ini sangat cepat, tetapi pemanggilan fungsi ini membutuhkan
1466
- overhead yg besar.
1477
+ `iprint(*args, color=None, sort_dicts=False, **kwargs)`
1467
1478
 
1479
+ Improve print function dengan menambahkan color dan pretty print
1480
+ Color menggunakan colorama Fore + Back + Style
1481
+
1468
1482
  ```python
1469
- print(random_bool())
1483
+ import colorama
1484
+ iprint(
1485
+ 'yang ini',
1486
+ {'12':12,'sdsd':{'12':21,'as':[88]}},
1487
+ color=colorama.Fore.BLUE + colorama.Style.BRIGHT
1488
+ )
1470
1489
  ```
1471
1490
 
1472
1491
  Output:
1473
1492
  ```py
1474
- True
1493
+ yang ini {'12': 12, 'sdsd': {'12': 21, 'as': [88]}}
1475
1494
  ```
1476
1495
 
1477
- ## set_timeout
1478
-
1479
- `set_timeout(interval, func, args=None, kwargs=None)`
1496
+ ## irange
1480
1497
 
1481
- Menjalankan fungsi ketika sudah sekian detik.
1482
- Apabila timeout masih berjalan tapi kode sudah selesai dieksekusi semua, maka
1483
- program tidak akan berhenti sampai timeout selesai, kemudian fungsi dijalankan,
1484
- kemudian program dihentikan.
1498
+ `irange(start, finish, step=1)`
1485
1499
 
1500
+ Meningkatkan fungsi range() dari python untuk pengulangan menggunakan huruf
1501
+
1486
1502
  ```python
1487
- set_timeout(3, lambda: print("Timeout 3"))
1488
- x = set_timeout(7, print, args=["Timeout 7"])
1489
- print(x)
1490
- print("menghentikan timeout 7")
1491
- x.cancel()
1503
+ print(irange('a', 'c'))
1504
+ print(irange('z', 'a', 10))
1505
+ print(list(irange('a', 'z', 10)))
1506
+ print(list(irange(1, '7')))
1507
+ print(list(irange(10, 5)))
1492
1508
  ```
1493
1509
 
1494
1510
  Output:
1495
1511
  ```py
1496
- <Timer(Thread-2, started 544808324336)>
1497
- menghentikan timeout 7
1512
+ <generator object irange at 0x79670ae9b0>
1513
+ <generator object irange at 0x79670ae9b0>
1514
+ ['a', 'k', 'u']
1515
+ [1, 2, 3, 4, 5, 6, 7]
1516
+ [10, 9, 8, 7, 6, 5]
1498
1517
  ```
1499
1518
 
1500
- ## sets_ordered
1501
-
1502
- `sets_ordered(iterator)`
1519
+ ## ireplace
1503
1520
 
1504
- Hanya mengambil nilai unik dari suatu list
1521
+ `ireplace(string: str, replacements: dict, flags=re.IGNORECASE|re.MULTILINE|re.DOTALL)`
1505
1522
 
1523
+ STRing TRanslate mengubah string menggunakan kamus dari dict.
1524
+ Replacement dapat berupa text biasa ataupun regex pattern.
1525
+ Apabila replacement berupa regex, gunakan raw string `r"..."`
1526
+ Untuk regex capturing gunakan `(...)`, dan untuk mengaksesnya
1527
+ gunakan `\1`, `\2`, .., dst.
1528
+
1506
1529
  ```python
1507
- array = [2, 3, 12, 3, 3, 42, 42, 1, 43, 2, 42, 41, 4, 24, 32, 42, 3, 12, 32, 42, 42]
1508
- print(sets_ordered(array))
1509
- print(list(sets_ordered(array)))
1530
+ text = 'aku ini mau ke sini'
1531
+ replacements = {
1532
+ "sini": "situ",
1533
+ r"(ini)": r"itu dan \1",
1534
+ }
1535
+ print(ireplace(text, replacements))
1510
1536
  ```
1511
1537
 
1512
1538
  Output:
1513
1539
  ```py
1514
- <generator object sets_ordered at 0x7eda9846c0>
1515
- [2, 3, 12, 42, 1, 43, 41, 4, 24, 32]
1540
+ aku itu dan ini mau ke situ
1516
1541
  ```
1517
1542
 
1518
- ## str_cmp
1519
-
1520
- `str_cmp(t1, t2)`
1543
+ ## iscandir
1521
1544
 
1522
- Membandingakan string secara incase-sensitive menggunakan lower().
1523
- Lebih cepat dibandingkan upper(), casefold(), re.fullmatch(), len().
1524
- perbandingan ini sangat cepat, tetapi pemanggilan fungsi ini membutuhkan
1525
- overhead yg besar.
1545
+ `iscandir(folder_name='.', glob_pattern='*', recursive=True, scan_file=True, scan_folder=True)`
1526
1546
 
1547
+ Mempermudah scandir untuk mengumpulkan folder dan file.
1548
+
1527
1549
  ```python
1528
- print(str_cmp('teks1', 'Teks1'))
1550
+ print(iscandir())
1551
+ print(list(iscandir("./", recursive=False, scan_file=False)))
1529
1552
  ```
1530
1553
 
1531
1554
  Output:
1532
1555
  ```py
1533
- True
1534
- ```
1535
-
1536
- ## text_colorize
1537
-
1538
- `text_colorize(text, color='\x1b[32m', bright='\x1b[1m', color_end='\x1b[0m')`
1539
-
1540
- return text dengan warna untuk menunjukan text penting
1541
-
1542
- ```py
1543
- text_colorize("Print some text")
1544
- text_colorize("Print some text", color=colorama.Fore.RED)
1556
+ <generator object iscandir at 0x79670d4a40>
1557
+ [PosixPath('.git'), PosixPath('.vscode'), PosixPath('pypipr'), PosixPath('__pycache__'), PosixPath('dist')]
1545
1558
  ```
1546
1559
 
1547
- ## to_str
1548
-
1549
- `to_str(value)`
1560
+ ## isplit
1550
1561
 
1551
- Mengubah value menjadi string literal
1562
+ `isplit(text, separator='', include_separator=False)`
1552
1563
 
1564
+ Memecah text menjadi list berdasarkan separator.
1565
+
1553
1566
  ```python
1554
- print(to_str(5))
1555
- print(to_str([]))
1556
- print(to_str(False))
1557
- print(to_str(True))
1558
- print(to_str(None))
1567
+ t = '/ini/contoh/path/'
1568
+ print(isplit(t, separator='/'))
1559
1569
  ```
1560
1570
 
1561
1571
  Output:
1562
1572
  ```py
1563
- 5
1564
-
1565
- False
1566
- True
1567
-
1573
+ ['', 'ini', 'contoh', 'path', '']
1568
1574
  ```
1569
1575
 
1570
1576
  # CLASS
1571
1577
 
1572
- ## APIMixinView
1573
-
1574
- `APIMixinView`
1575
-
1576
- APIView adalah class view untuk membuat Website API
1577
- Cara kerjanya adalah dengan menggunakan variabel GET untuk menerima data.
1578
-
1579
- Class ini tidak bisa digunakan sendiri.
1580
- Class ini harus menjadi mixin Class View karena perlu trigger untuk
1581
- memanggil method get().
1582
-
1583
- ```py
1584
- class ExampleAPIView(APIMixinView, View):
1585
- pass
1586
- ```
1587
-
1588
1578
  ## ComparePerformance
1589
1579
 
1590
- `ComparePerformance`
1580
+ `ComparePerformance()`
1591
1581
 
1592
1582
  Menjalankan seluruh method dalam class,
1593
1583
  Kemudian membandingkan waktu yg diperlukan.
@@ -1620,7 +1610,7 @@ print(ExampleComparePerformance().compare_performance())
1620
1610
 
1621
1611
  Output:
1622
1612
  ```py
1623
- {'a': <generator object ExampleComparePerformance.a.<locals>.<genexpr> at 0x7eda9842b0>,
1613
+ {'a': <generator object ExampleComparePerformance.a.<locals>.<genexpr> at 0x79670fc450>,
1624
1614
  'b': (0, 1, 2, 3, 4, 5, 6, 7, 8, 9),
1625
1615
  'c': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
1626
1616
  'd': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]}
@@ -1631,13 +1621,9 @@ Output:
1631
1621
  {'a': 0, 'b': 0, 'c': 0, 'd': 0}
1632
1622
  ```
1633
1623
 
1634
- ## PintUregQuantity
1635
-
1636
- `PintUregQuantity`
1637
-
1638
1624
  ## RunParallel
1639
1625
 
1640
- `RunParallel`
1626
+ `RunParallel()`
1641
1627
 
1642
1628
  Menjalankan program secara bersamaan.
1643
1629
 
@@ -1680,7 +1666,7 @@ Menjalankan program secara bersamaan.
1680
1666
  Akses resource menggunakan parameter yang sudah disediakan yaitu
1681
1667
  `result: dict` dan `q: queue.Queue`.
1682
1668
 
1683
- ```python
1669
+ ```py
1684
1670
  class ExampleRunParallel(RunParallel):
1685
1671
  z = "ini"
1686
1672
 
@@ -1737,3 +1723,23 @@ if __name__ == "__main__":
1737
1723
  print(ExampleRunParallel().run_multi_processing())
1738
1724
  ```
1739
1725
 
1726
+ ## APIMixinView
1727
+
1728
+ `APIMixinView()`
1729
+
1730
+ APIView adalah class view untuk membuat Website API
1731
+ Cara kerjanya adalah dengan menggunakan variabel GET untuk menerima data.
1732
+
1733
+ Class ini tidak bisa digunakan sendiri.
1734
+ Class ini harus menjadi mixin Class View karena perlu trigger untuk
1735
+ memanggil method get().
1736
+
1737
+ ```py
1738
+ class ExampleAPIView(APIMixinView, View):
1739
+ pass
1740
+ ```
1741
+
1742
+ ## PintUregQuantity
1743
+
1744
+ `PintUregQuantity(value, units=None)`
1745
+