Skip to main content

This is wzk's personal python library~

How to install?

simply run pip install wzk. That's it! (make sure your python version >= 3.7)

What can you do?

Entertainment

play games

Each with an interesting console game

import wzk
wzk.flight_game()
wzk.game2048()
wzk.mine_sweep()
wzk.texas_poker()
wzk.pokemon()
wzk.mahjong()

鬼畜

What happens if you translate one sentence 20 times with Baidu translation?

import wzk
wzk.funny_translate("二臣贼子,你枉活七十有六,一生未立寸功,只会摇唇鼓舌,助曹为虐!")

Academic

look up english words in dictionary

Off-line Chinese-English dictionary with more than 100k words;

Translate with baidu or off-line dictionary

import wzk
wzk.lookup("good", verbose=True, non_alpha=False)
#translate with baidu
wzk.translate("I love you")
#translate with dictionary
wzk.direct_translate("I love you")

check your OO homework

Generate data, judge your results, and beatmatch with peers

Note: made in 2020, may not be applicable in later years

from wzk.oo2020 import *

check_files(["test1.txt","test2.txt","test3.txt"])
print(hw3_generator(10))
print(hw7_generator(10,3,10))
print(hw11_generator(10,5))
print(hw13_generator())
print(derivative_judge("3*x**2","x**3"))
print(hw5_judge(open("out.txt").read(), open("data.txt").read()))

NLP metric

Calculate BLEU score

from wzk.nlp import bleu
print(bleu("they are good", "they are not good", k=2))

Useful Tools

Luna: simple version control system

"luna" can mean anything, depending on your mood.

  • the goddess of the moon in Roman mythology: isn't it great?
  • "light unix-like navigating assistant": you're in a good mood, and it actually works for you. Angels sing, and a light suddenly fills the room.
  • "loony unsteady nerd as**ole": when it breaks
  • Luna Lovegood in HP: correct!

(1) installation

  • method 1: python -- recommended
import wzk.luna
wzk.luna.install()
  • method 2: shell
#change PATH to the absolute path of wzk/luna.py
#change .bashrc if using another shell. e.g. ~/.zshrc
echo "alias luna='python PATH/luna.py' " >> ~/.bashrc
source ~/.bashrc
#for single trial, "alias luna='python PATH/luna.py'" is enough

(2) Use in shell (command line) -- recommended

Note: support Linux and Mac OS (try git bash if using Windows)

mkdir test
cd test
luna init
touch 666.txt
luna commit "first commit"
touch hahaha
echo "hello world" >> 666.txt
luna diff
luna commit "second commit"
luna log
luna diff 1 2
luna diff 1 666.txt
luna reset 1
luna reset 2
luna history
luna delete 1
luna info
luna discard

(3) Use in python

from wzk.luna import *
p = "~/Desktop/"
init(p)
makefile(p, "1")
commit(p, "commit 1")
makefile(p, "2")
commit(p, "commit 2")
revise(p, 2, "commit 3 new message")
reset(p, 1)
reset(p, 2)
history(p)

send email

Send email with SMTP

import wzk
mail_host = ...
mail_user = ...
mail_pass = ...
sender = wzk.parser.MailSender(mail_host, mail_user, mail_pass)
sender.send_mail(title="hi~", content="nothing~", receiver=None)

check web page update

Automatically check web page and send notification email upon update

import wzk
mail_host = ...
mail_user = ...
mail_pass = ...
checker = wzk.parser.WebPageUpdateChecker(mail_host, mail_user, mail_pass, cookies=None)
checker.check("www.baidu.com", interval=10)

check system information

see information on your system and python

from wzk.os import *
show_os_all_info()
show_python_all_info()

For Developers

improved data structure

Dictionary supporting inverse-mapping and attribute-indexing

Number type supporting setting bound and loop

from wzk import DD, N

a = DD({"good": "kk"})
a.bad = "nyima"
print(a.good)
print(a["bad"])
print(a.inv())
print(a.inv().inv())

b = N(4, upper_bound=8, lower_bound=3)
b += 5
c = N(4, upper_bound=8, lower_bound=3, loop=True)
print(c+5)

interestring utensils

Several interesing utensils

import time
from wzk import ErrorFucker, Separate, Clock

with ErrorFucker(raises=False) as ef1:
    d1 = int("f")

with Separate("separate zone", count=True) as s:
    print("ohhh")

with s:
    with Clock("test") as c:
        time.sleep(2)
    print(c)

with ErrorFucker(raises=True) as ef2:
    d2 = int("d")

simplified pytorch(?)

Scalar autograd mechanism

from wzk.autograd.thing import *

a = thing(2)
b = thing(3)
c = a + leaky_relu(b)
d = thing(5) 
e = tanh(d) 
f = relu(e)
g = log(f)

g.backward()
print(a, b, c, d, e, f, g)

Metadata

Release files for wzk 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for wzk 0.1.5
File Interpreter ABI Platform Actions
wzk-0.1.5-py3-none-any.whl Python 3 none any Details for wzk-0.1.5-py3-none-any.whl

Release files / wzk-0.1.5-py3-none-any.whl

Download URL wzk-0.1.5-py3-none-any.whl
Size 4.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
760e54f2b1e62afa57653979f448de25af4b58a53298cff01104f9d0cb3a6b96
BLAKE2b-256 checksum
How to use checksums
5bfe0b74209274e789081deeb1a90ba8802713634ddc403db7c2c1c6567eaea2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

Security for wzk 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page