Skip to main content

The Python Package Index Project

Project description

About

The Python Package Index Project (pypipr)

Setup

Install with pip

python -m pip install pypipr

Test with

from pypipr.pypipr import Pypipr
Pypipr.test_print()

Pypipr Class

test_print() memastikan module sudah terinstal dan dapat dijalankan

from pypipr.pypipr import Pypipr
Pypipr.test_print()

pypipr

sets_ordered() Hanya mengambil nilai unik dari suatu list

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()

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

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

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.

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.

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

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

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

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

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

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

from pypipr.iconstant import WINDOWS
print(WINDOWS)

LINUX True apabila berjalan di platform Linux

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.

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

file_get_contents() membaca contents file ke memory.

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

create_folder() membuat folder secara recursive.

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

scan_folder() scan folder dan subfolder

from pypipr.ifile import scan_folder
for i in scan_folder():
    print(i)

scan_file() scan file dalam folder dan subfolder

from pypipr.ifile import scan_file
for i in scan_file():
    print(i)

iregex

regex_multiple_replace() Melakukan multiple replacement untuk setiap list regex.

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

from pypipr.igithub import github_push
github_push()

github_pull() simple github pull

from pypipr.igithub import github_pull
github_pull()

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pypipr-0.1.20.tar.gz (5.4 kB view hashes)

Uploaded Source

Built Distribution

pypipr-0.1.20-py3-none-any.whl (6.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page