6 个仓库
Use of Python descriptor protocols to manage attribute access and modification.
Distinguishing note: Existing candidates refer to GPU, OS file, or platform descriptors, not Python language descriptors.
Explore 6 awesome GitHub repositories matching software engineering & architecture · Python Descriptors. Refine with filters or upvote what's useful.
Pydantic 是一个 Python 数据验证库和解析框架。它作为一个基于类型的模式验证器,使用标准的 Python 类型注解来确保输入数据符合预定义的结构模式。 该项目提供了通过自动类型转换和验证将原始数据解析为类型化对象的功能。这包括数据的序列化和数据结构的验证,以强制执行正确性。 该框架涵盖了多个应用领域,包括 API 请求的验证和应用程序配置的管理。它允许将 JSON 等原始格式转换为结构化的 Python 对象。
Uses Python descriptors to intercept attribute access for real-time validation and casting.
This project is a Chinese translation of a technical reference and educational resource focused on the Python interpreter. It serves as a collection of case studies and examples designed to explain unintuitive execution patterns, obscure language behaviors, and the internal mechanics of the Python language specification. The resource translates complex technical explanations from English to Chinese to improve accessibility. It focuses on mapping specific code patterns to internal execution logic, linking observed results to language rules to resolve confusing behaviors. The content covers se
Illustrates how Python descriptor protocols are used to manage attribute access and generate bound methods.
attrs is a Python library that automatically generates initialization, representation, equality, hashing, and ordering methods from declarative class attribute definitions. At its core, it provides a class decorator metaprogramming framework that intercepts class creation to rewrite the class body, producing dunder methods without manual boilerplate. The library includes a comprehensive attribute validation toolkit with built-in validators for type checks, range constraints, regex matching, length limits, and logical composition of validation rules. The library distinguishes itself through it
Implements Python descriptor protocol to control attribute access, initialization, and validation.
该项目是一系列实用脚本和参考指南,展示了高级 Python 语言特性和惯用法。它提供了用于掌握并发、元编程和数据结构设计等概念的代码实现。 该存储库包括 Python 对象模型的示例,涵盖自定义属性访问、描述符协议和特殊方法重写。它还具有利用一等函数和装饰器来减少面向对象样板代码的设计模式实现。 该代码库涵盖了广泛的功能,包括使用事件循环和 Future 的异步编程、自定义序列和生成器的创建,以及使用抽象基类进行接口强制执行。它进一步展示了通过上下文管理器进行的资源管理以及对文本和字节序列的处理。
Code demonstrating custom attribute access, descriptor protocols, and special method overrides for Python objects.
CPython-Internals 是一个针对 CPython 解释器的技术实现指南和参考资料。它提供了对内部 C 源代码和架构的详细分析,重点关注控制解释器行为的逻辑。 该项目记录了 Python 对象模型和编译流水线,追踪从原始语法和抽象语法树(AST)到可执行字节码的过程。它还作为 C 扩展开发的参考,解释了如何与内部数据结构交互以及使用 C API。 该材料涵盖了内存管理,包括引用计数和分代垃圾回收,以及全局解释器锁(GIL)的功能。
Examines the low-level C implementation of the Python object model and internal data structures.
python-miio 是一个 Miio 协议的 Python 库和硬件驱动程序实现,旨在控制和管理小米智能家电。它提供了必要的软件接口,将高级命令转换为网络数据包以进行设备通信。 该项目包括一个专门的网络设备模拟器,用于模拟硬件响应,以便在没有物理设备的情况下测试协议实现。它还具有一个命令行界面,用于发送命令、查询设备状态以及执行用于安全身份验证的令牌检索。 功能领域涵盖用于识别设备型号和 IP 地址的 IoT 网络发现,以及通过解析网络数据包捕获进行的协议分析。该库支持设备功能内省,以检索有关可用传感器和可配置设置的元数据。
Uses Python descriptors to define sensor schemas and settings for automatic interface generation.