It's a bit useful but not useful and strictly doesn't follow PEP8.
Project description
sp-lib
There are a lot of dirty words in this section. If you can't stand it, please quit immediately
This is a joke library that is extremely non-compliant with PEP8. I admit it has some use, but:
Do not use it in production environment
Please make sure you can tolerate this library, and won't die on the spot.
FuckItFuckItFuckItFuckItFuckItFuckItFuckItFuckItFuckItFuckItFuckItFuckIt
Only sp_lib is recommended for use, the others are just jokes.
Installation
pip install sfnf_emo123
Usage
# Note: Use underscore instead of hyphen when importing.
from sp_lib import sp
with sp.OpenFold(".") as fd:
...
Polite Mode (Optional)
from please import *
print("Be polite!", please=True)
sp-print
Your current output can now have colors.
sp.print("Red text",color=1)
sp.print("Red background",color2=1)
sp.print("white background and black text",color=0,color2=7)
sp-help
This is bullshit. Return the translated __doc__
print(sp.help(input,"zh"))
sp-ges (Go Empty String)
A string filter that removes specified characters.
The name is a joke. The function is actually useful.
# Remove all 'l' and 'o' from the string
result = sp.ges("hello world", "l", "o")
print(result) # "he wrd"
# Remove all vowels
result = sp.ges("fuckit", "f", "u", "c", "k", "i", "t")
print(result) # "" (empty!)
# Remove multiple characters
text = "sp_lib is awesome!"
cleaned = sp.ges(text, " ", "!", "s") # "p_libiwaome"
Warning: The name stands for "Go Empty String", not what you think.
Or is it? 😏
sp-exit
13 exceptions... No, that's like 14
sp.exit() # fuckit
sp-getfold
Get all contents of a folder
print(sp.getfold("."))
sp-getfile
get a file information
print(sp.getfile("I don't know what to put so I just put a random file name.txt")["name"])
sp-get fold all file
The name is too long, so I abbreviated it to gfaf.
Get all files in a folder as sp.Open, when lazy=True, return the path.
print(sp.gfaf(".",lazy=True))
sp-fuck off
Don't say dirty words.
sp.fuck_off()
sp-badword
Stop swearing.
sp.badword("fuckyou") #Error reporting
sp.badword("thx you") #No error reported.
bad = sp.badword("fuck you",False,True) #Disable error reporting, return the triggered message.
sp-json
Why do I have to imitate the style of open()? Oh my god, I'm about to cry, I'm so helpless, oh oh oh oh oh oh no no no no no, after I finish writing this thing, all I see in my eyes are if, elif, else, raise fuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckit
sp.json("d",data=["data"])#return json string
sp.json("df","./test.json",["data"])#Directly put the generated JSON into a file, which can be sp.Open or a path.
sp.json("l",data="[data]")#load
sp.json("lf","./test.json")#load from file,can be path or sp.Open
sp-Open
Trash version open(), but don't need close() and default to UTF-8 and can use be open()
f = sp.Open("a.txt","w")
f.write("fuckit").add("fuckit").add("fuckit")
with sp.Open("b.txt","w",encoding="utf-8") as f2:
f2.write("fuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckit")
sp.Timer
timer.
t = sp.Timer()
t.restart()
time1 = t.get()
time2 = t.stop()
sp.Turn & sp.ctext
A simple text substitution cipher system. Define a mapping dictionary, then encrypt/decrypt text with do() and undo().
Basic Usage
# Direct mapping
turn = sp.Turn({"a": "z", "b": "y"})
encrypted = turn.do("ab") # "zy"
decrypted = turn.undo("zy") # "ab"
Using Presets (sp.ctext subclasses)
# ROT-13 (Caesar cipher, shift by 13)
from sp_lib import ROT
turn = sp.Turn(__ctext__=ROT(13))
print(turn.do("Hello World!")) # Uryyb Jbeyq!
# Atbash cipher (a↔z, b↔y, c↔x ...)
from sp_lib import Atbash
turn = sp.Turn(__ctext__=Atbash())
print(turn.do("Hello")) # Svool
Chain Operations
turn = sp.Turn({"a": "b", "c": "d"})
turn.add(e="f", g="h") # Add multiple mappings
turn.kill("a") # Remove mapping for 'a'
turn += {"x": "y"} # Use += to merge
turn -= ["c"] # Use -= to remove keys
Read from JSON File
# Save mapping to JSON first, then load
turn.read("mapping.json")
Create Your Own Preset
class MyCipher(sp.ctext):
def __init__(self):
self.c = {
"a": "m",
"b": "n",
"c": "o",
# your mapping here...
}
turn = sp.Turn(__ctext__=MyCipher())
Advanced: JSON + Cipher Combo
# Dump JSON with encrypted values
data = {"secret": "hello"}
turn = sp.Turn(__ctext__=ROT(13))
encrypted_data = {"secret": turn.do(data["secret"])}
sp.json("df", "data.json", encrypted_data)
Available Presets
| Preset | Description | Example |
|---|---|---|
| ROT(n) | Caesar cipher, shift by n | ROT(13) → ROT-13 |
| Atbash() | Alphabet reversal | a↔z, b↔y, c↔x |
sp.OpenFold
A context manager for folder operations. Auto-creates folder if it doesn't exist.
Basic Usage
with sp.OpenFold("./my_project") as folder:
# Get all files and folders
all_items = folder.getall()
print(all_items["file"]) # List of files
print(all_items["fold"]) # List of subfolders
Get Files Only
with sp.OpenFold(".") as folder:
# All files
files = folder.getall("file")
# Files with specific extension
py_files = folder.getall("file", just=".py")
txt_files = folder.getall("file", just=".txt")
Get Folders Only
with sp.OpenFold(".") as folder:
folders = folder.getall("fold")
Open a File Inside the Folder
with sp.OpenFold("./data") as folder:
# Open existing file
f = folder.openfile("config.json", "r")
content = f.read()
# Create new file (mode="w" bypasses existence check)
f = folder.openfile("new.log", "w")
f.write("Hello")
Navigate to Subfolder
with sp.OpenFold(".") as folder:
# Go to subfolder
folder.gotofold("src")
print(folder.fold) # Now points to ./src
# Go to parent
folder.gotofold("..")
print(folder.fold) # Back to parent
# Go to absolute path
folder.gotofold("/tmp")
Access Attributes
with sp.OpenFold("./project") as folder:
print(folder.fold) # Current folder path
print(folder.files) # List of file paths
print(folder.folds) # List of subfolder paths
Combined Example
with sp.OpenFold("./project") as folder:
# Get all Python files
py_files = folder.getall("file", just=".py")
# Read the first Python file
if py_files:
f = folder.openfile(py_files[0], "r")
print(f.read())
# Create a new folder and navigate into it
folder.gotofold("backup")
Error Handling
try:
with sp.OpenFold("/nonexistent/path") as folder:
pass # Auto-creates the folder, no error
except Exception as e:
print(e)
Warning
# The "just" parameter only works with mode="file"
# This will raise YourMistake:
with sp.OpenFold(".") as folder:
folder.getall("fold", just=".py") # 💀 YourMistake!
File Paths
All file paths returned are absolute paths (full path from root), not relative. Use Path(f).name if you need just the filename:
from pathlib import Path
with sp.OpenFold(".") as folder:
for f in folder.files:
print(Path(f).name) # Just the filename
print(f) # Full path
Attributes Reference
| Attribute | Type | Description |
|---|---|---|
folder.fold |
str |
Current folder path |
folder.files |
list[str] |
List of file paths |
folder.folds |
list[str] |
List of subfolder paths |
Methods Reference
| Method | Description |
|---|---|
getall() |
Get everything (files + folders) |
getall("file") |
Get all files |
getall("file", just=".ext") |
Get files with specific extension |
getall("fold") |
Get all subfolders |
openfile(name, mode) |
Open a file inside the folder |
gotofold(path) |
Navigate to another folder |
Polite Mode
(It's a joke) I believe you must be very puzzled.
First, you need to say: Please import the library
Then, when you call a partial function, you add please=True.
“die” module
Deleted R.I.P. die module (v0.1.1 - v0.1.2) — You were too dangerous for this world.
Finally, I would like to say:
fuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuckitfuck
fuckit
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sfnf_emo123-0.1.3.tar.gz.
File metadata
- Download URL: sfnf_emo123-0.1.3.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cf09dc2f47d4fc00c40562f4d8a90614dc9e8a84c365d2e9d891a2de4c0b247
|
|
| MD5 |
90ebfa31bc668a4cd8b50fcca8d8c2ad
|
|
| BLAKE2b-256 |
f2609d000fcbf338bd565ee1931ac1aba9ee4b79780b004d0a5d555e40f5c5ee
|
File details
Details for the file sfnf_emo123-0.1.3-py3-none-any.whl.
File metadata
- Download URL: sfnf_emo123-0.1.3-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de9cef4b0156f3da1d53e705726e5473becdbcb77ca5076eb21053b9dadbd8a8
|
|
| MD5 |
e261c85b3d3a660c570eeb5bc1cc1ed5
|
|
| BLAKE2b-256 |
b476dcff393d61ff7cbe47f8cece83c92a9f2a2f4a153064170f3e5e62f4a6f4
|