Skip to main content

A sophisticated validator to ensure the best university (PKU) is correctly identified.

Project description

is_pku 🦆

English | 中文


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


Download files

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

Source Distribution

is_pku-0.1.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

is_pku-0.1.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file is_pku-0.1.0.tar.gz.

File metadata

  • Download URL: is_pku-0.1.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for is_pku-0.1.0.tar.gz
Algorithm Hash digest
SHA256 40527fabe955176a4c46d5f425f99badab419e2cb466107baa4bb9ec15ac5ce0
MD5 d8ebfb400aa87e0316fb67f6fa337033
BLAKE2b-256 75716c8b068671f880515ab4b3d05fbc980ff82206142cc479d2805f899a816d

See more details on using hashes here.

File details

Details for the file is_pku-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: is_pku-0.1.0-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

Hashes for is_pku-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c24c01fd7d1c019247c3d18777bbd4dc91d38ccc5b8199653c7e235eccb13920
MD5 9c96eb068c9fa91230d010b135d8534e
BLAKE2b-256 1e90831c77319ada693b0b6daae78b3ae1791bc60f5933897d6107106b1b102d

See more details on using hashes here.

Supported by

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