# About
The Python Package Index Project (pypipr)


# Setup
Install with pip
```
python -m pip install pypipr
```

Test with
```python
from pypipr.pypipr import Pypipr
Pypipr.test_print()
```


# Pypipr Class
`test_print()` memastikan module sudah terinstal dan dapat dijalankan
```python
from pypipr.pypipr import Pypipr
Pypipr.test_print()
```


# pypipr
`sets_ordered()` Hanya mengambil nilai unik dari suatu list

```python
from pypipr.pypipr import sets_ordered

array = [2, 3, 12, 3, 3, 42, 42, 1, 43, 2, 42, 41, 4, 24, 32, 42, 3, 12, 32, 42, 42]
print([i for i in sets_ordered(array)])
```


`list_unique()` sama seperti `sets_ordered()`

```python
from pypipr.pypipr import list_unique

array = [2, 3, 12, 3, 3, 42, 42, 1, 43, 2, 42, 41, 4, 24, 32, 42, 3, 12, 32, 42, 42]
print([i for i in list_unique(array)])
```


`chunck_array()` membagi array menjadi potongan dengan besaran yg diinginkan

```python
from pypipr.pypipr import chunck_array

array = [2, 3, 12, 3, 3, 42, 42, 1, 43, 2, 42, 41, 4, 24, 32, 42, 3, 12, 32, 42, 42]
print([i for i in chunck_array(array, 5)])
```


# iconsole
`print_colorize()` print ke console dengan warna

```python
from pypipr.iconsole import print_colorize
print_colorize("Print some text")
```


`@Log()` / `Log decorator` akan melakukan print ke console. Mempermudah pembuatan log karena tidak perlu mengubah fungsi yg sudah ada. Berguna untuk memberikan informasi proses program yg sedang berjalan.

```python
from pypipr.iconsole import log

@log("Calling some function")
def some_function():
    ...
    return
```


`print_log` akan melakukan print ke console. Berguna untuk memberikan informasi proses program yg sedang berjalan.

```python
from pypipr.iconsole import print_log
print_log("Standalone Log")
```


`input_char()` meminta masukan satu huruf tanpa menekan enter. Char tidak ditampilkan.

```python
from pypipr.iconsole import input_char
input_char("Input Char without print : ")
```


`input_char()` meminta masukan satu huruf tanpa menekan enter. Char ditampilkan.

```python
from pypipr.iconsole import input_char_echo
input_char_echo("Input Char n : ")
```


# idatetime
`datetime_now()` memudahkan dalam membuat tanggal dan waktu untuk suatu timezone

```python
from pypipr.idatetime import datetime_now
datetime_now("Asia/Jakarta")
datetime_now("GMT")
datetime_now("Etc/GMT+7")
```


# iconstant
`WINDOWS` True apabila berjalan di platform Windows

```python
from pypipr.iconstant import WINDOWS
print(WINDOWS)
```


`LINUX` True apabila berjalan di platform Linux

```python
from pypipr.iconstant import LINUX
print(LINUX)
```


# ifile
`file_put_contents()` membuat file kemudian menuliskan contents ke file. Apabila file memiliki contents, maka contents akan di overwrite.

```python
from pypipr.ifile import file_put_contents
file_put_contents("ifile_test.txt", "Contoh menulis content")
```


`file_get_contents()` membaca contents file ke memory.

```python
from pypipr.ifile import file_get_contents
print(file_get_contents("ifile_test.txt"))
```


`create_folder()` membuat folder secara recursive.

```python
from pypipr.ifile import create_folder
create_folder("contoh_membuat_folder")
create_folder("contoh/membuat/folder/recursive")
create_folder("./contoh_membuat_folder/secara/recursive")
```


# iregex
`regex_multiple_replace()` Melakukan multiple replacement untuk setiap list regex. 

```python
from pypipr.iregex import regex_multiple_replace

regex_replacement_list = [
    {"regex": r"\{\{\s*ini\s*\}\}", "replacement": "itu"},
    {"regex": r"\{\{\s*sini\s*\}\}", "replacement": "situ"},
]
data = "{{ ini }} adalah ini. {{sini}} berarti kesini."
data = regex_multiple_replace(data, regex_replacement_list)
print(data)
```


# igithub
`github_push()` simple github push

```python
from pypipr.igithub import github_push
github_push()
```


`github_pull()` simple github pull

```python
from pypipr.igithub import github_pull
github_pull()
```
