%PDF- %PDF-
Direktori : /lib/python3/dist-packages/twisted/python/__pycache__/ |
Current File : //lib/python3/dist-packages/twisted/python/__pycache__/modules.cpython-312.pyc |
� Ϫ�f�h � �6 � d Z ddlmZ ddlZddlZddlZddlZddlmZm Z ddlmZm Z ddlmZ ddlmZ ddlmZmZ dd lmZ dd lmZ e� ZdgZe du Zerej; d� nej; d � d� Zd� Z G d� d� Z G d� d� Z! G d� de � Z" G d� de � Z# G d� de� Z$ e e$� G d� d� � Z% e%� Z& e e$� G d� d� � Z' ee'ejP e$� d� Z) G d� d � Z* e*� Z+d$d!�Z,d"� Z-d#� Z.y)%a_ This module aims to provide a unified, object-oriented view of Python's runtime hierarchy. Python is a very dynamic language with wide variety of introspection utilities. However, these utilities can be hard to use, because there is no consistent API. The introspection API in python is made up of attributes (__name__, __module__, func_name, etc) on instances, modules, classes and functions which vary between those four types, utility modules such as 'inspect' which provide some functionality, the 'imp' module, the "compiler" module, the semantics of PEP 302 support, and setuptools, among other things. At the top, you have "PythonPath", an abstract representation of sys.path which includes methods to locate top-level modules, with or without loading them. The top-level exposed functions in this module for accessing the system path are "walkModules", "iterModules", and "getModule". From most to least specific, here are the objects provided:: PythonPath # sys.path | v PathEntry # one entry on sys.path: an importer | v PythonModule # a module or package that can be loaded | v PythonAttribute # an attribute of a module (function or class) | v PythonAttribute # an attribute of a function or class | v ... Here's an example of idiomatic usage: this is what you would do to list all of the modules outside the standard library's python-files directory:: import os stdlibdir = os.path.dirname(os.__file__) from twisted.python.modules import iterModules for modinfo in iterModules(): if (modinfo.pathEntry.filePath.path != stdlibdir and not modinfo.isPackage()): print('unpackaged: %s: %s' % ( modinfo.name, modinfo.filePath.path)) @var theSystemPath: The very top of the Python object space. @type theSystemPath: L{PythonPath} � )�annotationsN)�dirname�split)� Interface�implementer��nativeString)�registerAdapter)�FilePath�UnlistableError)�namedAny)� ZipArchivez.pyz.pyoz.pycc �8 � t | � }d|vxr d|vxr d|vS )z� cheezy fake test for proper identifier-ness. @param string: a L{str} which might or might not be a valid python identifier. @return: True or False � �.�-r )�string� textStrings �8/usr/lib/python3/dist-packages/twisted/python/modules.py�_isPythonIdentifierr W s- � � �f�%�J��j� �T�S� �%:�T�s�*�?T�T� c �N � | j � d }t |� d }|dk( S )Nr � �__init__)�splitext� splitpath)�fpath�extless�basends r �_isPackagePathr c s/ � � �n�n��q�!�G� �w� �� "�F��Z��r c �<