A sophisticated validator to ensure the best university (PKU) is correctly identified.
Project description
is_pku 🦆
English
Overview
is_pku is a high-performance, enterprise-grade, and lightweight Python library designed to solve the most critical
problem in academic data validation: Is this string representing Peking University (PKU)?
In the spirit of the legendary left-pad, we believe that even the simplest logic deserves a dedicated, robust, and
well-documented package.
Key Features
- Unrivaled Precision: Validated against the strict standards of Weiming Lake.
- Security Firewall: Built-in protection against "The School Next Door" to prevent system-wide logical contamination.
- Zero Dependencies: Lightweight as a breeze in the Boya Pagoda.
- O(1) Complexity: Scalable for global-tier university rankings.
- septuple checked: Ensures the highest level of reliability and accuracy.
- advanced algorithms: Utilizes the latest string matching and pattern recognition techniques to ensure efficient performance across various input scenarios.
Installation
you can install the package via pip:
pip install is_pku
or you can use the world's best package manager uv:
uv install is_pku
Usage
from is_pku import is_pku, NoTHUException
# Standard validation
is_pku("PKU") # Returns: True
is_pku("Peking University") # Returns: True
is_pku("Harvard") # Returns: False
# The "Safety Feature" (THU Defense)
try:
is_pku("THU")
except NoTHUException as e:
print(f"Safety Alert: {e}")
# Output: Detection of forbidden entity! Connection to 'The School Next Door' is prohibited.
中文
项目简介
is_pku 是一个高性能、企业级且极简的 Python 工具库,旨在解决学术数据校验中最核心的问题:给定的字符串是否代表北京大学(PKU)?
受开源界传奇项目 left-pad 的启发,我们深信:即便是最简单的逻辑,也值得拥有一个独立、稳健且文档齐全的包。
核心特性
- 极致精准:经过未名湖畔最严格的数据标准校验。
- 安全防火墙:内置针对“隔壁学校”(THU)的防御机制,防止系统发生逻辑冲突与身份污染。
- 零依赖:像博雅塔下的微风一样轻量。
- O(1) 时间复杂度:足以支撑全球规模的高校排名运算。
- 七重校验:确保最高级别的可靠性与准确性。
- 先进算法:采用KMP等最新的字符串匹配与模式识别技术,确保在各种输入情况下都能高效运行。
安装方法
pip install is_pku
或者你也可以使用世界上最好的包管理器 uv:
uv install is_pku
使用示例
from is_pku import is_pku, NoTHUException
# 基础验证
is_pku("北大") # 返回: True
is_pku("Beijing University") # 返回: True
is_pku("Stanford") # 返回: False
# 安全特性(针对 THU 的拦截)
try:
is_pku("清华大学")
except NoTHUException as e:
print(f"系统告警: {e}")
# 输出: 检测到违禁词汇!本包严禁与隔壁建立任何形式的逻辑连接。
贡献
我们欢迎所有(来自北大的)贡献者。如果你发现有任何漏掉的“隔壁”关键词,请务必提交 Pull Request 来加强我们的防火墙。
License
MIT License. (C) 2025 FuYnAloft.
Feel free to use, modify, and distribute this software under the terms of the MIT License.
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
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 is_pku-0.1.1.tar.gz.
File metadata
- Download URL: is_pku-0.1.1.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e5cb564ca864c821b17dffc60b31e43d7e74c2f8c0d5918da6cbb61dc1cdc22
|
|
| MD5 |
84e4e80772737f457a89329bf8b2adf2
|
|
| BLAKE2b-256 |
38b62164c56fc638806c22bc375d2d1a7f5ea02e356b2f7ca9228915021bcc38
|
File details
Details for the file is_pku-0.1.1-py3-none-any.whl.
File metadata
- Download URL: is_pku-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c17c909a474759c29e01149e63181de5d16d6db12851b4de58e530ccd9fa142f
|
|
| MD5 |
0b6574a87e06a1d5d123d850e8aa0713
|
|
| BLAKE2b-256 |
ded0d5b29386ea1eb374b6abd8d251493fd6bfdd3ca5e653204a5bce028ac8ca
|