pypipr 1.0.84__py3-none-any.whl → 1.0.86__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.86
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 0x7dc427c340>
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:59:54.152844+07:00
149
+ 2024-04-23 11:59:54.153729+00:00
150
+ 2024-04-23 04:59:54.155149-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 0x7dc41f2f20>
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 0x7dc41f31f0>
247
+ [<function ExampleGetClassMethod.a at 0x7dc43cd3a0>, <function ExampleGetClassMethod.b at 0x7dd9baec00>, <function ExampleGetClassMethod.c at 0x7dc428d580>, <function ExampleGetClassMethod.d at 0x7dc428d620>]
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
487
-
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>
540
-
367
+ True
368
+ True
541
369
  ```
542
370
 
543
- ## idumps_html
544
-
545
- `idumps_html(data, indent=None)`
371
+ ## ivars
546
372
 
547
- Serialisasi python variabel menjadi HTML.
548
- ```
549
- List -> <ul>...</ul>
550
- Dict -> <table>...</table>
551
- ```
373
+ `ivars(obj, skip_underscore=True)`
552
374
 
375
+ Membuat dictionary berdasarkan kategori untuk setiap
376
+ member dari object.
377
+
553
378
  ```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))
379
+ iprint(ivars(__import__('pypipr')))
560
380
  ```
561
381
 
562
382
  Output:
563
383
  ```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
-
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 0x7dd9b81750>)>,
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 0x7dccb96750>},
427
+ 'function': {'avg': <function avg at 0x7dd9baed40>,
428
+ 'basename': <function basename at 0x7dd9b7e8e0>,
429
+ 'chunk_array': <function chunk_array at 0x7dd4db9120>,
430
+ 'create_folder': <function create_folder at 0x7dd4db9300>,
431
+ 'datetime_from_string': <function datetime_from_string at 0x7dd4db94e0>,
432
+ 'datetime_now': <function datetime_now at 0x7dd4e61620>,
433
+ 'dict_first': <function dict_first at 0x7dd4e61580>,
434
+ 'dirname': <function dirname at 0x7dd4e614e0>,
435
+ 'exit_if_empty': <function exit_if_empty at 0x7dd4e3b4c0>,
436
+ 'filter_empty': <function filter_empty at 0x7dd4e611c0>,
437
+ 'get_class_method': <function get_class_method at 0x7dd4e60ea0>,
438
+ 'get_filemtime': <function get_filemtime at 0x7dd4e60cc0>,
439
+ 'get_filesize': <function get_filesize at 0x7dd4e60ae0>,
440
+ 'get_from_index': <function get_from_index at 0x7dd4e609a0>,
441
+ 'is_empty': <function is_empty at 0x7dd4e61260>,
442
+ 'is_iterable': <function is_iterable at 0x7dd4e60fe0>,
443
+ 'is_valid_url': <function is_valid_url at 0x7dd4e60860>,
444
+ 'ivars': <function ivars at 0x7dd4e607c0>,
445
+ 'password_generator': <function password_generator at 0x7dd4e60680>,
446
+ 'random_bool': <function random_bool at 0x7dd4e60400>,
447
+ 'set_timeout': <function set_timeout at 0x7dd4e637e0>,
448
+ 'sets_ordered': <function sets_ordered at 0x7dd4e63920>,
449
+ 'str_cmp': <function str_cmp at 0x7dd4e639c0>,
450
+ 'to_str': <function to_str at 0x7dd4e60f40>,
451
+ 'choices': <function choices at 0x7dd4e63a60>,
452
+ 'console_run': <function console_run at 0x7dd4e63ce0>,
453
+ 'input_char': <function input_char at 0x7dd4e63e20>,
454
+ 'log': <function log at 0x7dd4e84040>,
455
+ 'print_colorize': <function print_colorize at 0x7dd4e840e0>,
456
+ 'print_dir': <function print_dir at 0x7dd4e84220>,
457
+ 'print_log': <function print_log at 0x7dd4e63ec0>,
458
+ 'print_to_last_line': <function print_to_last_line at 0x7dd4e63c40>,
459
+ 'text_colorize': <function text_colorize at 0x7dd4e63d80>,
460
+ 'batch_calculate': <function batch_calculate at 0x7dcbd01580>,
461
+ 'batchmaker': <function batchmaker at 0x7dcbcde980>,
462
+ 'calculate': <function calculate at 0x7dcbd022a0>,
463
+ 'auto_reload': <function auto_reload at 0x7dcbd02480>,
464
+ 'github_pull': <function github_pull at 0x7dcbd02020>,
465
+ 'github_push': <function github_push at 0x7dcbd02700>,
466
+ 'github_user': <function github_user at 0x7dcbd02a20>,
467
+ 'pip_freeze_without_version': <function pip_freeze_without_version at 0x7dcba29f80>,
468
+ 'poetry_publish': <function poetry_publish at 0x7dcba2a160>,
469
+ 'poetry_update_version': <function poetry_update_version at 0x7dcba52980>,
470
+ 'iargv': <function iargv at 0x7dc44580e0>,
471
+ 'idumps': <function idumps at 0x7dc4458220>,
472
+ 'idumps_html': <function idumps_html at 0x7dc44bcc20>,
473
+ 'ienv': <function ienv at 0x7dc4458360>,
474
+ 'iexec': <function iexec at 0x7dc44bcea0>,
475
+ 'ijoin': <function ijoin at 0x7dcba29ee0>,
476
+ 'iloads': <function iloads at 0x7dc44bcf40>,
477
+ 'iloads_html': <function iloads_html at 0x7dc44bd1c0>,
478
+ 'iopen': <function iopen at 0x7dcba2a200>,
479
+ 'iprint': <function iprint at 0x7dc4458180>,
480
+ 'irange': <function irange at 0x7dcbd023e0>,
481
+ 'ireplace': <function ireplace at 0x7dc44bd080>,
482
+ 'iscandir': <function iscandir at 0x7dc44bee80>,
483
+ 'isplit': <function isplit at 0x7dc44bef20>}}
624
484
  ```
625
485
 
626
- ## ienv
486
+ ## password_generator
627
487
 
628
- `ienv(on_windows=None, on_linux=None)`
488
+ `password_generator(length=8, characters='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~')`
629
489
 
630
- Mengambalikan hasil berdasarkan environment dimana program dijalankan
490
+ Membuat pssword secara acak
491
+
492
+ ```python
493
+ print(password_generator())
494
+ ```
631
495
 
632
- ```py
633
- getch = __import__(ienv(on_windows="msvcrt", on_linux="getch"))
496
+ Output:
497
+ ```py
498
+ 4j>9S0-:
499
+ ```
634
500
 
635
- inherit = ienv(
636
- on_windows=[BaseForWindows, BaseEnv, object],
637
- on_linux=[SpecialForLinux, BaseForLinux, BaseEnv, object]
638
- )
501
+ ## random_bool
639
502
 
640
- class ExampleIEnv(*inherit):
641
- pass
503
+ `random_bool()`
504
+
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())
642
512
  ```
643
513
 
644
- ## iexec
514
+ Output:
515
+ ```py
516
+ True
517
+ ```
645
518
 
646
- `iexec(python_syntax, import_pypipr=True)`
519
+ ## set_timeout
647
520
 
648
- improve exec() python function untuk mendapatkan outputnya
521
+ `set_timeout(interval, func, args=None, kwargs=None)`
649
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
+
650
528
  ```python
651
- print(iexec('print(9*9)'))
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()
652
534
  ```
653
535
 
654
536
  Output:
655
537
  ```py
656
- 81
657
-
538
+ <Timer(Thread-2, started 540138257648)>
539
+ menghentikan timeout 7
658
540
  ```
659
541
 
660
- ## ijoin
661
-
662
- `ijoin(iterable, separator='', start='', end='', remove_empty=False, recursive=True, recursive_flat=False, str_strip=False)`
542
+ ## sets_ordered
663
543
 
664
- Simplify Python join functions like PHP function.
665
- Iterable bisa berupa sets, tuple, list, dictionary.
544
+ `sets_ordered(iterator)`
666
545
 
546
+ Hanya mengambil nilai unik dari suatu list
547
+
667
548
  ```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, ' '))
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)))
680
552
  ```
681
553
 
682
554
  Output:
683
555
  ```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
556
+ <generator object sets_ordered at 0x7dc429c110>
557
+ [2, 3, 12, 42, 1, 43, 41, 4, 24, 32]
700
558
  ```
701
559
 
702
- ## iloads
703
-
704
- `iloads(data, syntax='yaml')`
560
+ ## str_cmp
705
561
 
706
- Mengubah string data hasil dari idumps menjadi variabel.
707
- String data adalah berupa syntax YAML.
562
+ `str_cmp(t1, t2)`
708
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
+
709
569
  ```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))
570
+ print(str_cmp('teks1', 'Teks1'))
717
571
  ```
718
572
 
719
573
  Output:
720
574
  ```py
721
- {'a': 123, 'l': (12, 23, [12, 42]), 't': ['disini', 'senang', 'disana', 'senang']}
575
+ True
722
576
  ```
723
577
 
724
- ## iloads_html
725
-
726
- `iloads_html(html)`
578
+ ## to_str
727
579
 
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
580
+ `to_str(value)`
739
581
 
582
+ Mengubah value menjadi string literal
583
+
740
584
  ```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)
585
+ print(to_str(5))
586
+ print(to_str([]))
587
+ print(to_str(False))
588
+ print(to_str(True))
589
+ print(to_str(None))
744
590
  ```
745
591
 
746
592
  Output:
747
593
  ```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%)']])
594
+ 5
595
+
596
+ False
597
+ True
598
+
599
+ ```
600
+
601
+ ## choices
602
+
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
+ )
623
+ ```
624
+
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,291 @@ 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
+ ```
685
+
686
+ ## print_dir
963
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__ : 969759906076413030
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 0x7dd4e341d0>
724
+ _hash : 969759906076413030
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 0x7dc4274c80>
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 : Timeout 3
790
+ masukkan apa saja : [ok]
1024
791
  ```
1025
792
 
1026
- ## ireplace
793
+ ## text_colorize
1027
794
 
1028
- `ireplace(string: str, replacements: dict, flags=re.IGNORECASE|re.MULTILINE|re.DOTALL)`
795
+ `text_colorize(text, color='\x1b[32m', bright='\x1b[1m', color_end='\x1b[0m')`
1029
796
 
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.
797
+ return text dengan warna untuk menunjukan text penting
798
+
799
+ ```py
800
+ text_colorize("Print some text")
801
+ text_colorize("Print some text", color=colorama.Fore.RED)
802
+ ```
803
+
804
+ ## batch_calculate
1035
805
 
806
+ `batch_calculate(pattern)`
807
+
808
+ Analisa perhitungan massal.
809
+ Bisa digunakan untuk mencari alternatif terendah/tertinggi/dsb.
810
+
811
+
1036
812
  ```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))
813
+ print(batch_calculate("{1 10} m ** {1 3}"))
814
+ print(list(batch_calculate("{1 10} m ** {1 3}")))
1043
815
  ```
1044
816
 
1045
817
  Output:
1046
818
  ```py
1047
- aku itu dan ini mau ke situ
819
+ <generator object batch_calculate at 0x7dc41f3970>
820
+ [('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
821
  ```
1049
822
 
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.
823
+ ## batchmaker
1055
824
 
1056
- Pengecekan nilai yang setara menggunakan simbol '==', sedangkan untuk
1057
- pengecekan lokasi memory yang sama menggunakan keyword 'is'
825
+ `batchmaker(pattern: str)`
1058
826
 
827
+ Alat Bantu untuk membuat teks yang berulang.
828
+ Gunakan `{[start][separator][finish]([separator][step])}`.
829
+ ```
830
+ [start] dan [finish] -> bisa berupa huruf maupun angka
831
+ ([separator][step]) -> bersifat optional
832
+ [separator] -> selain huruf dan angka
833
+ [step] -> berupa angka positif
834
+ ```
835
+
1059
836
  ```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([]))
837
+ s = "Urutan {1/6/3} dan {10:9} dan {j k} dan {Z - A - 15} saja."
838
+ print(batchmaker(s))
839
+ print(list(batchmaker(s)))
1066
840
  ```
1067
841
 
1068
842
  Output:
1069
843
  ```py
1070
- False
1071
- False
1072
- True
1073
- True
1074
- True
1075
- True
844
+ <generator object batchmaker at 0x7dc4288160>
845
+ ['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
846
  ```
1077
847
 
1078
- ## is_iterable
1079
-
1080
- `is_iterable(var, str_is_iterable=False)`
848
+ ## calculate
1081
849
 
1082
- Mengecek apakah suatu variabel bisa dilakukan forloop atau tidak
850
+ `calculate(teks)`
1083
851
 
852
+ Mengembalikan hasil dari perhitungan teks menggunakan modul pint.
853
+ Mendukung perhitungan matematika dasar dengan satuan.
854
+
855
+ Return value:
856
+ - Berupa class Quantity dari modul pint
857
+
858
+ Format:
859
+ - f"{result:~P}" -> pretty
860
+ - f"{result:~H}" -> html
861
+ - result.to_base_units() -> SI
862
+ - result.to_compact() -> human readable
863
+
1084
864
  ```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()))
865
+ fx = "3 meter * 10 cm * 3 km"
866
+ res = calculate(fx)
867
+ print(res)
868
+ print(res.to_base_units())
869
+ print(res.to_compact())
870
+ print(f"{res:~P}")
871
+ print(f"{res:~H}")
1096
872
  ```
1097
873
 
1098
874
  Output:
1099
875
  ```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')]
876
+ 90 centimeter * kilometer * meter
877
+ 900.0 meter ** 3
878
+ 900.0 meter ** 3
879
+ 90 cm·km·m
880
+ 90 cm km m
1139
881
  ```
1140
882
 
1141
- ## isplit
1142
-
1143
- `isplit(text, separator='', include_separator=False)`
1144
-
1145
- Memecah text menjadi list berdasarkan separator.
883
+ ## auto_reload
1146
884
 
1147
- ```python
1148
- t = '/ini/contoh/path/'
1149
- print(isplit(t, separator='/'))
1150
- ```
885
+ `auto_reload(filename)`
1151
886
 
1152
- Output:
1153
- ```py
1154
- ['', 'ini', 'contoh', 'path', '']
887
+ Menjalankan file python secara berulang.
888
+ Dengan tujuan untuk melihat perubahan secara langsung.
889
+ Pastikan kode aman untuk dijalankan.
890
+ Jalankan kode ini di terminal console.
891
+
892
+ ```py
893
+ if __name__ == "__main__":
894
+ auto_reload("file_name.py")
1155
895
  ```
1156
896
 
1157
- ## ivars
1158
-
1159
- `ivars(obj, skip_underscore=True)`
1160
-
1161
- Membuat dictionary berdasarkan kategori untuk setiap
1162
- member dari object.
897
+ ## github_pull
1163
898
 
1164
- ```python
1165
- iprint(ivars(__import__('pypipr')))
1166
- ```
899
+ `github_pull()`
1167
900
 
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>}}
901
+ Menjalankan command `git pull`
902
+
903
+ ```py
904
+ github_pull()
1267
905
  ```
1268
906
 
1269
- ## log
1270
-
1271
- `log(text=None)`
907
+ ## github_push
1272
908
 
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.
909
+ `github_push(commit_msg=None)`
1277
910
 
911
+ Menjalankan command status, add, commit dan push
912
+
1278
913
  ```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()
914
+ github_push('Commit Message')
1294
915
  ```
1295
916
 
1296
- ## password_generator
1297
-
1298
- `password_generator(length=8, characters='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~')`
1299
-
1300
- Membuat pssword secara acak
917
+ ## github_user
1301
918
 
1302
- ```python
1303
- print(password_generator())
1304
- ```
919
+ `github_user(email=None, name=None)`
1305
920
 
1306
- Output:
1307
- ```py
1308
- Lu;'|[qm
921
+ Menyimpan email dan nama user secara global sehingga tidak perlu
922
+ menginput nya setiap saat.
923
+
924
+ ```py
925
+ github_user('my@emil.com', 'MyName')
1309
926
  ```
1310
927
 
1311
928
  ## pip_freeze_without_version
@@ -1314,7 +931,7 @@ Lu;'|[qm
1314
931
 
1315
932
  Memberikan list dari dependencies yang terinstall tanpa version.
1316
933
  Bertujuan untuk menggunakan Batteries Included Python.
1317
-
934
+
1318
935
  ```py
1319
936
  print(pip_freeze_without_version())
1320
937
  ```
@@ -1324,7 +941,7 @@ print(pip_freeze_without_version())
1324
941
  `poetry_publish(token=None)`
1325
942
 
1326
943
  Publish project to pypi,org
1327
-
944
+
1328
945
  ```py
1329
946
  poetry_publish()
1330
947
  ```
@@ -1334,260 +951,652 @@ poetry_publish()
1334
951
  `poetry_update_version(mayor=False, minor=False, patch=False)`
1335
952
 
1336
953
  Update versi pada pyproject.toml menggunakan poetry
1337
-
954
+
1338
955
  ```py
1339
956
  poetry_update_version()
1340
957
  ```
1341
958
 
1342
- ## print_colorize
1343
-
1344
- `print_colorize(text, color='\x1b[32m', bright='\x1b[1m', color_end='\x1b[0m', text_start='', text_end='\n')`
959
+ ## iargv
1345
960
 
1346
- Print text dengan warna untuk menunjukan text penting
961
+ `iargv(key: int, cast=None, on_error=None)`
1347
962
 
1348
- ```py
1349
- print_colorize("Print some text")
1350
- print_colorize("Print some text", color=colorama.Fore.RED)
963
+ Mengambil parameter input dari terminal tanpa menimbulkan error
964
+ apabila parameter kosong.
965
+ Parameter yg berupa string juga dapat diubah menggunakan cast.
966
+
967
+ ```python
968
+ if __name__ == "__main__":
969
+ print(iargv(1, cast=int, on_error=100))
1351
970
  ```
1352
971
 
1353
- ## print_dir
972
+ Output:
973
+ ```py
974
+ ```
1354
975
 
1355
- `print_dir(var, colorize=True)`
976
+ ## idumps
1356
977
 
1357
- Print property dan method yang tersedia pada variabel
978
+ `idumps(data, syntax='yaml', indent=4)`
1358
979
 
980
+ Mengubah variabel data menjadi string untuk yang dapat dibaca untuk disimpan.
981
+ String yang dihasilkan berbentuk syntax YAML/JSON/HTML.
982
+
1359
983
  ```python
1360
- import pathlib
1361
- p = pathlib.Path("https://www.google.com/")
1362
- print_dir(p, colorize=False)
984
+ data = {
985
+ 'a': 123,
986
+ 't': ['disini', 'senang', 'disana', 'senang'],
987
+ 'l': (12, 23, [12, 42]),
988
+ }
989
+ print(idumps(data))
990
+ print(idumps(data, syntax='html'))
1363
991
  ```
1364
992
 
1365
993
  Output:
1366
994
  ```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.
995
+ a: 123
996
+ l: !!python/tuple
997
+ - 12
998
+ - 23
999
+ - - 12
1000
+ - 42
1001
+ t:
1002
+ - disini
1003
+ - senang
1004
+ - disana
1005
+ - senang
1006
+
1007
+ <table>
1008
+ <tbody>
1009
+ <tr>
1010
+ <th>a</th>
1011
+ <td>
1012
+ <span>123</span>
1013
+ </td>
1014
+ </tr>
1015
+ <tr>
1016
+ <th>t</th>
1017
+ <td>
1018
+ <ul>
1019
+ <li>
1020
+ <span>disini</span>
1021
+ </li>
1022
+ <li>
1023
+ <span>senang</span>
1024
+ </li>
1025
+ <li>
1026
+ <span>disana</span>
1027
+ </li>
1028
+ <li>
1029
+ <span>senang</span>
1030
+ </li>
1031
+ </ul>
1032
+ </td>
1033
+ </tr>
1034
+ <tr>
1035
+ <th>l</th>
1036
+ <td>
1037
+ <ul>
1038
+ <li>
1039
+ <span>12</span>
1040
+ </li>
1041
+ <li>
1042
+ <span>23</span>
1043
+ </li>
1044
+ <li>
1045
+ <ul>
1046
+ <li>
1047
+ <span>12</span>
1048
+ </li>
1049
+ <li>
1050
+ <span>42</span>
1051
+ </li>
1052
+ </ul>
1053
+ </li>
1054
+ </ul>
1055
+ </td>
1056
+ </tr>
1057
+ </tbody>
1058
+ </table>
1371
1059
 
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
1060
  ```
1425
1061
 
1426
- ## print_log
1062
+ ## idumps_html
1427
1063
 
1428
- `print_log(text)`
1064
+ `idumps_html(data, indent=None)`
1429
1065
 
1430
- Akan melakukan print ke console.
1431
- Berguna untuk memberikan informasi proses program yg sedang berjalan.
1066
+ Serialisasi python variabel menjadi HTML.
1067
+ ```
1068
+ List -> <ul>...</ul>
1069
+ Dict -> <table>...</table>
1070
+ ```
1071
+
1072
+ ```python
1073
+ data = {
1074
+ 'abc': 123,
1075
+ 'list': [1, 2, 3, 4, 5],
1076
+ 'dict': {'a': 1, 'b':2, 'c':3},
1077
+ }
1078
+ print(idumps_html(data))
1079
+ ```
1432
1080
 
1081
+ Output:
1082
+ ```py
1083
+ <table>
1084
+ <tbody>
1085
+ <tr>
1086
+ <th>abc</th>
1087
+ <td>
1088
+ <span>123</span>
1089
+ </td>
1090
+ </tr>
1091
+ <tr>
1092
+ <th>list</th>
1093
+ <td>
1094
+ <ul>
1095
+ <li>
1096
+ <span>1</span>
1097
+ </li>
1098
+ <li>
1099
+ <span>2</span>
1100
+ </li>
1101
+ <li>
1102
+ <span>3</span>
1103
+ </li>
1104
+ <li>
1105
+ <span>4</span>
1106
+ </li>
1107
+ <li>
1108
+ <span>5</span>
1109
+ </li>
1110
+ </ul>
1111
+ </td>
1112
+ </tr>
1113
+ <tr>
1114
+ <th>dict</th>
1115
+ <td>
1116
+ <table>
1117
+ <tbody>
1118
+ <tr>
1119
+ <th>a</th>
1120
+ <td>
1121
+ <span>1</span>
1122
+ </td>
1123
+ </tr>
1124
+ <tr>
1125
+ <th>b</th>
1126
+ <td>
1127
+ <span>2</span>
1128
+ </td>
1129
+ </tr>
1130
+ <tr>
1131
+ <th>c</th>
1132
+ <td>
1133
+ <span>3</span>
1134
+ </td>
1135
+ </tr>
1136
+ </tbody>
1137
+ </table>
1138
+ </td>
1139
+ </tr>
1140
+ </tbody>
1141
+ </table>
1142
+
1143
+ ```
1144
+
1145
+ ## ienv
1146
+
1147
+ `ienv(on_windows=None, on_linux=None)`
1148
+
1149
+ Mengambalikan hasil berdasarkan environment dimana program dijalankan
1150
+
1151
+ ```py
1152
+ getch = __import__(ienv(on_windows="msvcrt", on_linux="getch"))
1153
+
1154
+
1155
+ f = ienv(on_windows=fwin, on_linux=flin)
1156
+ f()
1157
+
1158
+
1159
+ inherit = ienv(
1160
+ on_windows=[BaseForWindows, BaseEnv, object],
1161
+ on_linux=[SpecialForLinux, BaseForLinux, BaseEnv, object]
1162
+ )
1163
+
1164
+ class ExampleIEnv(*inherit):
1165
+ pass
1166
+ ```
1167
+
1168
+ ## iexec
1169
+
1170
+ `iexec(python_syntax, import_pypipr=True)`
1171
+
1172
+ improve exec() python function untuk mendapatkan outputnya
1173
+
1433
1174
  ```python
1434
- print_log("Standalone Log")
1175
+ print(iexec('print(9*9)'))
1435
1176
  ```
1436
1177
 
1437
1178
  Output:
1438
1179
  ```py
1439
- >>> Standalone Log
1180
+ 81
1181
+
1182
+ ```
1183
+
1184
+ ## ijoin
1185
+
1186
+ `ijoin(iterable, separator='', start='', end='', remove_empty=False, recursive=True, recursive_flat=False, str_strip=False)`
1187
+
1188
+ Simplify Python join functions like PHP function.
1189
+ Iterable bisa berupa sets, tuple, list, dictionary.
1190
+
1191
+ ```python
1192
+ arr = {'asd','dfs','weq','qweqw'}
1193
+ print(ijoin(arr, ', '))
1194
+
1195
+ arr = '/ini/path/seperti/url/'.split('/')
1196
+ print(ijoin(arr, ','))
1197
+ print(ijoin(arr, ',', remove_empty=True))
1198
+
1199
+ arr = {'a':'satu', 'b':(12, 34, 56), 'c':'tiga', 'd':'empat'}
1200
+ print(ijoin(arr, separator='</li>\n<li>', start='<li>', end='</li>',
1201
+ recursive_flat=True))
1202
+ print(ijoin(arr, separator='</div>\n<div>', start='<div>', end='</div>'))
1203
+ print(ijoin(10, ' '))
1204
+ ```
1205
+
1206
+ Output:
1207
+ ```py
1208
+ asd, dfs, weq, qweqw
1209
+ ,ini,path,seperti,url,
1210
+ ini,path,seperti,url
1211
+ <li>satu</li>
1212
+ <li>12</li>
1213
+ <li>34</li>
1214
+ <li>56</li>
1215
+ <li>tiga</li>
1216
+ <li>empat</li>
1217
+ <div>satu</div>
1218
+ <div><div>12</div>
1219
+ <div>34</div>
1220
+ <div>56</div></div>
1221
+ <div>tiga</div>
1222
+ <div>empat</div>
1223
+ 10
1224
+ ```
1225
+
1226
+ ## iloads
1227
+
1228
+ `iloads(data, syntax='yaml')`
1229
+
1230
+ Mengubah string data hasil dari idumps menjadi variabel.
1231
+ String data adalah berupa syntax YAML.
1232
+
1233
+ ```python
1234
+ data = {
1235
+ 'a': 123,
1236
+ 't': ['disini', 'senang', 'disana', 'senang'],
1237
+ 'l': (12, 23, [12, 42]),
1238
+ }
1239
+ s = idumps(data)
1240
+ print(iloads(s))
1241
+ ```
1242
+
1243
+ Output:
1244
+ ```py
1245
+ {'a': 123, 'l': (12, 23, [12, 42]), 't': ['disini', 'senang', 'disana', 'senang']}
1246
+ ```
1247
+
1248
+ ## iloads_html
1249
+
1250
+ `iloads_html(html)`
1251
+
1252
+ Mengambil data yang berupa list `<ul>`, dan table `<table>` dari html
1253
+ dan menjadikannya data python berupa list.
1254
+ setiap data yang ditemukan akan dibungkus dengan tuple sebagai separator.
1255
+ ```
1256
+ list (<ul>) -> list -> list satu dimensi
1257
+ table (<table>) -> list[list] -> list satu dimensi didalam list
1258
+ ```
1259
+ apabila data berupa ul maka dapat dicek type(data) -> html_ul
1260
+ apabila data berupa ol maka dapat dicek type(data) -> html_ol
1261
+ apabila data berupa dl maka dapat dicek type(data) -> html_dl
1262
+ apabila data berupa table maka dapat dicek type(data) -> html_table
1263
+
1264
+ ```python
1265
+ import pprint
1266
+ pprint.pprint(iloads_html(iopen("https://harga-emas.org/")), depth=10)
1267
+ pprint.pprint(iloads_html(iopen("https://harga-emas.org/1-gram/")), depth=10)
1268
+ ```
1269
+
1270
+ Output:
1271
+ ```py
1272
+ (['Home', 'Emas 1 Gram', 'History', 'Trend', 'Perak 1 Gram', 'Pluang'],
1273
+ [['Harga Emas Hari Ini - Selasa, 23 April 2024'],
1274
+ ['Spot Emas USD↓2.302,65 (-27,48) / oz',
1275
+ 'Kurs IDR↓16.224,00 (-56,00) / USD',
1276
+ 'Emas IDR↓1.201.094 (-18.529) / gr'],
1277
+ ['LM Antam (Jual)↓1.325.000 (-18.000) / gr',
1278
+ 'LM Antam (Beli)↓1.223.000 (-15.000) / gr']],
1279
+ [['Harga Emas Hari Ini'],
1280
+ ['Gram', 'Gedung Antam Jakarta', 'Pegadaian'],
1281
+ ['per Gram (Rp)', 'per Batangan (Rp)', 'per Gram (Rp)', 'per Batangan (Rp)'],
1282
+ ['1000',
1283
+ '1.266 (-18)',
1284
+ '1.265.600 (-18.000)',
1285
+ '1.043.040 (+8.200)',
1286
+ '1.043.040.000 (+8.200.000)'],
1287
+ ['500',
1288
+ '2.531 (-36)',
1289
+ '1.265.640 (-18.000)',
1290
+ '1.043.082 (+8.200)',
1291
+ '521.541.000 (+4.100.000)'],
1292
+ ['250',
1293
+ '5.064 (-72)',
1294
+ '1.266.060 (-18.000)',
1295
+ '1.043.512 (+8.200)',
1296
+ '260.878.000 (+2.050.000)'],
1297
+ ['100',
1298
+ '12.671 (-180)',
1299
+ '1.267.120 (-18.000)',
1300
+ '1.044.600 (+8.200)',
1301
+ '104.460.000 (+820.000)'],
1302
+ ['50',
1303
+ '25.358 (-360)',
1304
+ '1.267.900 (-18.000)',
1305
+ '1.045.400 (+8.200)',
1306
+ '52.270.000 (+410.000)'],
1307
+ ['25',
1308
+ '50.779 (-720)',
1309
+ '1.269.480 (-18.000)',
1310
+ '1.047.040 (+8.200)',
1311
+ '26.176.000 (+205.000)'],
1312
+ ['10',
1313
+ '127.450 (-1.800)',
1314
+ '1.274.500 (-18.000)',
1315
+ '1.052.200 (+8.200)',
1316
+ '10.522.000 (+82.000)'],
1317
+ ['5',
1318
+ '256.000 (-3.600)',
1319
+ '1.280.000 (-18.000)',
1320
+ '1.057.800 (+8.200)',
1321
+ '5.289.000 (+41.000)'],
1322
+ ['3',
1323
+ '428.889 (-6.000)',
1324
+ '1.286.667 (-18.000)',
1325
+ '1.064.667 (+8.000)',
1326
+ '3.194.000 (+24.000)'],
1327
+ ['2',
1328
+ '647.500 (-9.000)',
1329
+ '1.295.000 (-18.000)',
1330
+ '1.073.500 (+8.500)',
1331
+ '2.147.000 (+17.000)'],
1332
+ ['1',
1333
+ '1.325.000 (-18.000)',
1334
+ '1.325.000 (-18.000)',
1335
+ '1.104.000 (+8.000)',
1336
+ '1.104.000 (+8.000)'],
1337
+ ['0.5',
1338
+ '2.850.000 (-36.000)',
1339
+ '1.425.000 (-18.000)',
1340
+ '1.208.000 (+8.000)',
1341
+ '604.000 (+4.000)'],
1342
+ ['Update harga LM Antam :23 April 2024, pukul 07:56Harga pembelian kembali '
1343
+ ':Rp. 1.223.000/gram (-15.000)',
1344
+ 'Update harga LM Pegadaian :31 Agustus 2023']],
1345
+ [['Spot Harga Emas Hari Ini (Market Open)'],
1346
+ ['Satuan', 'USD', 'Kurs\xa0Dollar', 'IDR'],
1347
+ ['Ounce\xa0(oz)', '2.302,65 (-27,48)', '16.224,00 (-56,00)', '37.358.194'],
1348
+ ['Gram\xa0(gr)', '74,03', '16.224,00', '1.201.094 (-18.529)'],
1349
+ ['Kilogram\xa0(kg)', '74.031,92', '16.224,00', '1.201.093.816'],
1350
+ ['Update harga emas :23 April 2024, pukul 18:59Update kurs :23 April 2024, '
1351
+ 'pukul 13:10']],
1352
+ [['Gram', 'UBS Gold 99.99%'],
1353
+ ['Jual', 'Beli'],
1354
+ ['/ Batang', '/ Gram', '/ Batang', '/ Gram'],
1355
+ ['100',
1356
+ '126.712.000 (-1.488.000)',
1357
+ '1.267.120 (-14.880)',
1358
+ '123.735.000 (-3.350.000)',
1359
+ '1.237.350 (-33.500)'],
1360
+ ['50',
1361
+ '63.395.000 (-855.000)',
1362
+ '1.267.900 (-17.100)',
1363
+ '61.920.000 (-1.675.000)',
1364
+ '1.238.400 (-33.500)'],
1365
+ ['25',
1366
+ '31.737.000 (-413.000)',
1367
+ '1.269.480 (-16.520)',
1368
+ '31.062.500 (-837.500)',
1369
+ '1.242.500 (-33.500)'],
1370
+ ['10',
1371
+ '12.745.000 (-165.000)',
1372
+ '1.274.500 (-16.500)',
1373
+ '12.475.000 (-335.000)',
1374
+ '1.247.500 (-33.500)'],
1375
+ ['5',
1376
+ '6.400.000 (-80.000)',
1377
+ '1.280.000 (-16.000)',
1378
+ '6.289.500 (-167.500)',
1379
+ '1.257.900 (-33.500)'],
1380
+ ['1',
1381
+ '1.325.000 (-15.000)',
1382
+ '1.325.000 (-15.000)',
1383
+ '1.290.500 (-33.500)',
1384
+ '1.290.500 (-33.500)'],
1385
+ ['', 'Update :23 April 2024, pukul 11:31']],
1386
+ [['Konversi Satuan'],
1387
+ ['Satuan', 'Ounce (oz)', 'Gram (gr)', 'Kilogram (kg)'],
1388
+ ['Ounce\xa0(oz)', '1', '31,1034767696', '0,0311034768'],
1389
+ ['Gram\xa0(gr)', '0,0321507466', '1', '0.001'],
1390
+ ['Kilogram\xa0(kg)', '32,1507466000', '1.000', '1']],
1391
+ [['Pergerakan Harga Emas Dunia'],
1392
+ ['Waktu', 'Emas'],
1393
+ ['Unit', 'USD', 'IDR'],
1394
+ ['Angka', '+/-', 'Angka', '+/-'],
1395
+ ['Hari Ini', 'Kurs', '', '', '16.280', '-56-0,34%'],
1396
+ ['oz', '2.330,13', '-27,48-1,18%', '37.934.516', '-576.323-1,52%'],
1397
+ ['gr', '74,92', '-0,88-1,18%', '1.219.623', '-18.529-1,52%'],
1398
+ ['30 Hari', 'Kurs', '', '', '15.662', '+562+3,59%'],
1399
+ ['oz', '2.165,64', '+137,01+6,33%', '33.918.254', '+3.439.940+10,14%'],
1400
+ ['gr', '69,63', '+4,40+6,33%', '1.090.497', '+110.597+10,14%'],
1401
+ ['2 Bulan', 'Kurs', '', '', '15.630', '+594+3,80%'],
1402
+ ['oz', '2.038,19', '+264,46+12,98%', '31.856.910', '+5.501.284+17,27%'],
1403
+ ['gr', '65,53', '+8,50+12,98', '1.024.223', '+176.870+17,27%'],
1404
+ ['6 Bulan', 'Kurs', '', '', '15.871', '+353+2,22%'],
1405
+ ['oz', '1.984,00', '+318,65+16,06%', '31.488.064', '+5.870.130+18,64%'],
1406
+ ['gr', '63,79', '+10,24+16,06%', '1.012.365', '+188.729+18,64%'],
1407
+ ['1 Tahun', 'Kurs', '', '', '15.731', '+493+3,13%'],
1408
+ ['oz', '1.823,86', '+478,79+26,25%', '28.691.142', '+8.667.052+30,21%'],
1409
+ ['gr', '58,64', '+15,39+26,25%', '922.442', '+278.652+30,21%'],
1410
+ ['2 Tahun', 'Kurs', '', '', '14.348', '+1.876+13,07%'],
1411
+ ['oz', '1.931,96', '+370,69+19,19%', '27.719.762', '+9.638.432+34,77%'],
1412
+ ['gr', '62,11', '+11,92+19,19%', '891.211', '+309.883+34,77%'],
1413
+ ['3 Tahun', 'Kurs', '', '', '14.530', '+1.694+11,66%'],
1414
+ ['oz', '1.777,11', '+525,54+29,57%', '25.821.408', '+11.536.785+44,68%'],
1415
+ ['gr', '57,14', '+16,90+29,57%', '830.178', '+370.916+44,68%'],
1416
+ ['5 Tahun', 'Kurs', '', '', '14.154', '+2.070+14,62%'],
1417
+ ['oz', '1.277,64', '+1.025,01+80,23%', '18.083.717', '+19.274.477+106,58%'],
1418
+ ['gr', '41,08', '+32,95+80,23%', '581.405', '+619.689+106,58%']])
1419
+ (['Home', 'Emas 1 Gram', 'History', 'Trend', 'Perak 1 Gram', 'Pluang'],
1420
+ [[''],
1421
+ ['Emas 24 KaratHarga Emas 1 Gram', ''],
1422
+ ['USD', '74,03↓', '-0,89-1,19%'],
1423
+ ['KURS', '16.210,05↓', '-36,30-0,22%'],
1424
+ ['IDR', '1.200.061,07↓', '-17.041,05-1,40%'],
1425
+ ['Selasa, 23 April 2024 19:00']],
1426
+ [[''],
1427
+ ['Emas 1 Gram (IDR)Emas 1 Gram (USD)Kurs USD-IDR',
1428
+ 'Hari Ini',
1429
+ '1 Bulan',
1430
+ '1 Tahun',
1431
+ '5 Tahun',
1432
+ 'Max',
1433
+ '']],
1434
+ [['Pergerakkan Harga Emas 1 Gram'],
1435
+ ['', 'Penutupan Kemarin', 'Pergerakkan Hari Ini', 'Rata-rata'],
1436
+ ['USD', '74,92', '74,03 - 74,92', '74,48'],
1437
+ ['KURS', '16.246,35', '16.210,05 - 16.246,35', '16.228,20'],
1438
+ ['IDR', '1.217.102,12', '1.200.061,07 - 1.217.102,12', '1.208.581,60'],
1439
+ [''],
1440
+ ['', 'Awal Tahun', 'Pergerakkan YTD', '+/- YTD'],
1441
+ ['USD', '66,32', '64,07 - 77,14', '+7,71 (11,63%)'],
1442
+ ['KURS', '15.390,10', '15.390,00 - 16.307,80', '+819,95 (5,33%)'],
1443
+ ['IDR', '1.020.729,53', '997.660,12 - 1.256.829,06', '+179.331,54 (17,57%)'],
1444
+ [''],
1445
+ ['', 'Tahun Lalu / 52 Minggu', 'Pergerakkan 52 Minggu', '+/- 52 Minggu'],
1446
+ ['USD', '63,76', '58,43 - 77,14', '+10,27 (16,11%)'],
1447
+ ['KURS', '14.936,00', '14.669,40 - 16.307,80', '+1.274,05 (8,53%)'],
1448
+ ['IDR', '952.339,68', '912.925,68 - 1.256.829,06', '+247.721,39 (26,01%)']])
1440
1449
  ```
1441
1450
 
1442
- ## print_to_last_line
1443
-
1444
- `print_to_last_line(text: str)`
1451
+ ## iopen
1445
1452
 
1446
- Melakukan print ke konsol tetapi akan menimpa baris terakhir.
1447
- Berguna untuk memberikan progress secara interaktif.
1453
+ `iopen(path, data=None, regex=None, css_select=None, xpath=None, file_append=False)`
1448
1454
 
1455
+ Membaca atau Tulis pada path yang bisa merupakan FILE maupun URL.
1456
+
1457
+ Baca File :
1458
+ - Membaca seluruh file.
1459
+ - Jika berhasil content dapat diparse dengan regex.
1460
+ - Apabila File berupa html, dapat diparse dengan css atau xpath.
1461
+
1462
+ Tulis File :
1463
+ - Menulis pada file.
1464
+ - Jika file tidak ada maka akan dibuat.
1465
+ - Jika file memiliki content maka akan di overwrite.
1466
+
1467
+ Membaca URL :
1468
+ - Mengakses URL dan mengembalikan isi html nya berupa teks.
1469
+ - Content dapat diparse dengan regex, css atau xpath.
1470
+
1471
+ Tulis URL :
1472
+ - Mengirimkan data dengan metode POST ke url.
1473
+ - Jika berhasil dan response memiliki content, maka dapat diparse
1474
+ dengan regex, css atau xpath.
1475
+
1476
+
1449
1477
  ```python
1450
- c = input("masukkan apa saja : ")
1451
- print_to_last_line(f"masukkan apa saja : {c} [ok]")
1478
+ # FILE
1479
+ print(iopen("__iopen.txt", "mana aja"))
1480
+ print(iopen("__iopen.txt", regex="(\w+)"))
1481
+ # URL
1482
+ print(iopen("https://www.google.com/", css_select="a"))
1483
+ print(iopen("https://www.google.com/", dict(coba="dulu"), xpath="//a"))
1452
1484
  ```
1453
1485
 
1454
1486
  Output:
1455
1487
  ```py
1456
- masukkan apa saja : masukkan apa saja : [ok]
1488
+ 8
1489
+ ['mana', 'aja']
1490
+ [<Element a at 0x7dd9bb9cc0>, <Element a at 0x7dc42ca490>, <Element a at 0x7dc42ca530>, <Element a at 0x7dc42ca580>, <Element a at 0x7dc42ca5d0>, <Element a at 0x7dc42ca620>, <Element a at 0x7dc42ca670>, <Element a at 0x7dc42ca6c0>, <Element a at 0x7dc42ca710>, <Element a at 0x7dc42ca760>, <Element a at 0x7dc42ca7b0>, <Element a at 0x7dc42ca800>, <Element a at 0x7dc42ca850>, <Element a at 0x7dc42ca8a0>, <Element a at 0x7dc42ca8f0>, <Element a at 0x7dc42ca940>, <Element a at 0x7dc42ca990>, <Element a at 0x7dc42ca9e0>]
1491
+ False
1457
1492
  ```
1458
1493
 
1459
- ## random_bool
1460
-
1461
- `random_bool()`
1494
+ ## iprint
1462
1495
 
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.
1496
+ `iprint(*args, color=None, sort_dicts=False, **kwargs)`
1467
1497
 
1498
+ Improve print function dengan menambahkan color dan pretty print
1499
+ Color menggunakan colorama Fore + Back + Style
1500
+
1468
1501
  ```python
1469
- print(random_bool())
1502
+ import colorama
1503
+ iprint(
1504
+ 'yang ini',
1505
+ {'12':12,'sdsd':{'12':21,'as':[88]}},
1506
+ color=colorama.Fore.BLUE + colorama.Style.BRIGHT
1507
+ )
1470
1508
  ```
1471
1509
 
1472
1510
  Output:
1473
1511
  ```py
1474
- True
1512
+ yang ini {'12': 12, 'sdsd': {'12': 21, 'as': [88]}}
1475
1513
  ```
1476
1514
 
1477
- ## set_timeout
1478
-
1479
- `set_timeout(interval, func, args=None, kwargs=None)`
1515
+ ## irange
1480
1516
 
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.
1517
+ `irange(start, finish, step=1)`
1485
1518
 
1519
+ Meningkatkan fungsi range() dari python untuk pengulangan menggunakan huruf
1520
+
1486
1521
  ```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()
1522
+ print(irange('a', 'c'))
1523
+ print(irange('z', 'a', 10))
1524
+ print(list(irange('a', 'z', 10)))
1525
+ print(list(irange(1, '7')))
1526
+ print(list(irange(10, 5)))
1492
1527
  ```
1493
1528
 
1494
1529
  Output:
1495
1530
  ```py
1496
- <Timer(Thread-2, started 544808324336)>
1497
- menghentikan timeout 7
1531
+ <generator object irange at 0x7dc424e9b0>
1532
+ <generator object irange at 0x7dc424e9b0>
1533
+ ['a', 'k', 'u']
1534
+ [1, 2, 3, 4, 5, 6, 7]
1535
+ [10, 9, 8, 7, 6, 5]
1498
1536
  ```
1499
1537
 
1500
- ## sets_ordered
1501
-
1502
- `sets_ordered(iterator)`
1538
+ ## ireplace
1503
1539
 
1504
- Hanya mengambil nilai unik dari suatu list
1540
+ `ireplace(string: str, replacements: dict, flags=re.IGNORECASE|re.MULTILINE|re.DOTALL)`
1505
1541
 
1542
+ STRing TRanslate mengubah string menggunakan kamus dari dict.
1543
+ Replacement dapat berupa text biasa ataupun regex pattern.
1544
+ Apabila replacement berupa regex, gunakan raw string `r"..."`
1545
+ Untuk regex capturing gunakan `(...)`, dan untuk mengaksesnya
1546
+ gunakan `\1`, `\2`, .., dst.
1547
+
1506
1548
  ```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)))
1549
+ text = 'aku ini mau ke sini'
1550
+ replacements = {
1551
+ "sini": "situ",
1552
+ r"(ini)": r"itu dan \1",
1553
+ }
1554
+ print(ireplace(text, replacements))
1510
1555
  ```
1511
1556
 
1512
1557
  Output:
1513
1558
  ```py
1514
- <generator object sets_ordered at 0x7eda9846c0>
1515
- [2, 3, 12, 42, 1, 43, 41, 4, 24, 32]
1559
+ aku itu dan ini mau ke situ
1516
1560
  ```
1517
1561
 
1518
- ## str_cmp
1519
-
1520
- `str_cmp(t1, t2)`
1562
+ ## iscandir
1521
1563
 
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.
1564
+ `iscandir(folder_name='.', glob_pattern='*', recursive=True, scan_file=True, scan_folder=True)`
1526
1565
 
1566
+ Mempermudah scandir untuk mengumpulkan folder dan file.
1567
+
1527
1568
  ```python
1528
- print(str_cmp('teks1', 'Teks1'))
1569
+ print(iscandir())
1570
+ print(list(iscandir("./", recursive=False, scan_file=False)))
1529
1571
  ```
1530
1572
 
1531
1573
  Output:
1532
1574
  ```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)
1575
+ <generator object iscandir at 0x7dc427c840>
1576
+ [PosixPath('.git'), PosixPath('.vscode'), PosixPath('pypipr'), PosixPath('__pycache__'), PosixPath('dist')]
1545
1577
  ```
1546
1578
 
1547
- ## to_str
1548
-
1549
- `to_str(value)`
1579
+ ## isplit
1550
1580
 
1551
- Mengubah value menjadi string literal
1581
+ `isplit(text, separator='', include_separator=False)`
1552
1582
 
1583
+ Memecah text menjadi list berdasarkan separator.
1584
+
1553
1585
  ```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))
1586
+ t = '/ini/contoh/path/'
1587
+ print(isplit(t, separator='/'))
1559
1588
  ```
1560
1589
 
1561
1590
  Output:
1562
1591
  ```py
1563
- 5
1564
-
1565
- False
1566
- True
1567
-
1592
+ ['', 'ini', 'contoh', 'path', '']
1568
1593
  ```
1569
1594
 
1570
1595
  # CLASS
1571
1596
 
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
1597
  ## ComparePerformance
1589
1598
 
1590
- `ComparePerformance`
1599
+ `ComparePerformance()`
1591
1600
 
1592
1601
  Menjalankan seluruh method dalam class,
1593
1602
  Kemudian membandingkan waktu yg diperlukan.
@@ -1620,7 +1629,7 @@ print(ExampleComparePerformance().compare_performance())
1620
1629
 
1621
1630
  Output:
1622
1631
  ```py
1623
- {'a': <generator object ExampleComparePerformance.a.<locals>.<genexpr> at 0x7eda9842b0>,
1632
+ {'a': <generator object ExampleComparePerformance.a.<locals>.<genexpr> at 0x7dc429c450>,
1624
1633
  'b': (0, 1, 2, 3, 4, 5, 6, 7, 8, 9),
1625
1634
  'c': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
1626
1635
  'd': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]}
@@ -1631,13 +1640,9 @@ Output:
1631
1640
  {'a': 0, 'b': 0, 'c': 0, 'd': 0}
1632
1641
  ```
1633
1642
 
1634
- ## PintUregQuantity
1635
-
1636
- `PintUregQuantity`
1637
-
1638
1643
  ## RunParallel
1639
1644
 
1640
- `RunParallel`
1645
+ `RunParallel()`
1641
1646
 
1642
1647
  Menjalankan program secara bersamaan.
1643
1648
 
@@ -1680,7 +1685,7 @@ Menjalankan program secara bersamaan.
1680
1685
  Akses resource menggunakan parameter yang sudah disediakan yaitu
1681
1686
  `result: dict` dan `q: queue.Queue`.
1682
1687
 
1683
- ```python
1688
+ ```py
1684
1689
  class ExampleRunParallel(RunParallel):
1685
1690
  z = "ini"
1686
1691
 
@@ -1737,3 +1742,23 @@ if __name__ == "__main__":
1737
1742
  print(ExampleRunParallel().run_multi_processing())
1738
1743
  ```
1739
1744
 
1745
+ ## APIMixinView
1746
+
1747
+ `APIMixinView()`
1748
+
1749
+ APIView adalah class view untuk membuat Website API
1750
+ Cara kerjanya adalah dengan menggunakan variabel GET untuk menerima data.
1751
+
1752
+ Class ini tidak bisa digunakan sendiri.
1753
+ Class ini harus menjadi mixin Class View karena perlu trigger untuk
1754
+ memanggil method get().
1755
+
1756
+ ```py
1757
+ class ExampleAPIView(APIMixinView, View):
1758
+ pass
1759
+ ```
1760
+
1761
+ ## PintUregQuantity
1762
+
1763
+ `PintUregQuantity(value, units=None)`
1764
+