文件操作 - traitlets.cpython-311.pyc
返回文件管理
返回主菜单
删除本文件
文件: /usr/lib/python3/dist-packages/traitlets/__pycache__/traitlets.cpython-311.pyc
编辑文件内容
� �Uc�� � � � d Z ddlZddlZddlZddlZddlZddlZddlZddlZ ddl mZ ddlm Z mZ ddlmZ ddlmZmZmZmZ ddlmZ dd lmZ dd lmZ eeeefZ e!fZ"g d�Z# edd d� � Z$ edd d� � Z%e$Z& G d� de'� � Z( ej) d� � Z*d� Z+ e� � Z,d� Z-d� Z.d� Z/d� Z0d� Z1 G d� d� � Z2d�d�Z3d� Z4 G d� d� � Z5 G d � d!� � Z6e6Z7 G d"� d#� � Z8 G d$� d%e8� � Z9 G d&� d'� � Z:d(� Z; G d)� d*e!� � Z< G d+� d,e<� � Z=d-d.�d/�Z>d0� Z?d1� Z@d2� ZA G d3� d4e8� � ZB G d5� d6eB� � ZC G d7� d8eB� � ZD G d9� d:eB� � ZE G d;� d<e<�=� � ZF G d>� d?eFe=�=� � ZG G d@� dAe9� � ZH G dB� dCeH� � ZI G dD� dEeH� � ZJ G dF� dG� � ZK G dH� dIeKeI� � ZL G dJ� dKeKeJ� � ZM G dL� dMeH� � ZN G dN� dOe9� � ZO G dP� dQe9� � ZPdR� ZQ G dS� dTe9� � ZR G dU� dVeR� � ZSeReScZTZUeRZV G dW� dXe9� � ZW G dY� dZeW� � ZX G d[� d\e9� � ZY G d]� d^eY� � ZZ G d_� d`e9� � Z[ G da� dbe[� � Z\ G dc� dde9� � Z] G de� dfe]� � Z^ G dg� dhe9� � Z_ G di� dje_� � Z` G dk� dle9� � Za G dm� dnea� � Zb G do� dpe9� � Zc G dq� drec� � Zd G ds� dtec� � Ze G du� dveJ� � Zf G dw� dxef� � Zg G dy� dzeg� � Zh G d{� d|ef� � Zi G d}� d~eJ� � Zj G d� d�e9� � Zk G d�� d�e9� � Zl G d�� d�e9� � Zm G d�� d�e9� � ZndS )�a� A lightweight Traits like module. This is designed to provide a lightweight, simple, pure Python version of many of the capabilities of enthought.traits. This includes: * Validation * Type specification with defaults * Static and dynamic notification * Basic predefined types * An API that is similar to enthought.traits We don't support: * Delegation * Automatic GUI generation * A full set of trait types. Most importantly, we don't provide container traits (list, dict, tuple) that can trigger notifications if their contents change. * API compatibility with enthought.traits There are also some important difference in our design: * enthought.traits does not validate default values. We do. We choose to create this module because we need these capabilities, but we need them to be pure Python so they work in all Python implementations, including Jython and IronPython. Inheritance diagram: .. inheritance-diagram:: traitlets.traitlets :parts: 3 � N)�literal_eval)�warn� warn_explicit� )�Bunch)�add_article�class_of�describe� repr_type)� getargspec��import_item)�Sentinel);�All�Any�BaseDescriptor�Bool�Bytes�CBool�CBytes�CComplex�CFloat�CInt�CLong�CRegExp�CUnicode�Callable�CaselessStrEnum�ClassBasedTraitType�Complex� Container�DefaultHandler�Dict�DottedObjectName�Enum�EventHandler�Float�ForwardDeclaredInstance�ForwardDeclaredMixin�ForwardDeclaredType� FuzzyEnum�HasDescriptors� HasTraits�Instance�Int�Integer�List�Long�MetaHasDescriptors� MetaHasTraits� ObjectName�ObserveHandler�Set� TCPAddress�This� TraitError� TraitType�Tuple�Type�Unicode� Undefined�Union�UseEnum�ValidateHandler�default�directional_link�dlink�link�observe�observe_compat�parse_notifier_name�validater? � traitletszA Used in Traitlets to specify that no defaults are set in kwargs r zi Used in Traitlets to listen to all types of notification or to notifications from all trait attributes. c � � e Zd ZdS )r: N)�__name__� __module__�__qualname__� � �5/usr/lib/python3/dist-packages/traitlets/traitlets.pyr: r: � s � � � � � ��DrQ r: z[a-zA-Z_][a-zA-Z0-9_]*$c �* � | � � � S �N��isidentifier��ss rR rV rV � s � ��>�>���rQ c � � t j � d� � }|r|dk rdS | t vrt � | � � dS dS )zZAdd our own checks for too many deprecation warnings. Limit to once per package. �TRAITLETS_ALL_DEPRECATIONS�0TF)�os�environ�get�_deprecations_shown�add)�key�env_flags rR �_should_warnrc � sW � � �z�~�~�:�;�;�H�� �H��O�O��t� �%�%�%�����$�$�$��t��urQ c � � d� |j ||�� � }t j |� � D ]}||j v r|} n�|j � dd� � d }||f}t |� � sdS t j | � � pd}t j | � � d pd} t |t || � � dS # t t f$ r&} t |d| z z t � � Y d} ~ dS d} ~ ww xY w) z�Show deprecation warning about a magic method definition. Uses warn_explicit to bind warning to method definition instead of triggering code, which isn't relevant. z?{classname}.{method_name} is deprecated in traitlets 4.1: {msg})� classname�method_name�msg�.r r Nz <unknown>z (inspection failed) %s)�formatrM �inspect�getmro�__dict__rN �splitrc � getsourcefile�getsourcelinesr �DeprecationWarning�OSError� TypeErrorr )�method�clsrf rg �warn_msg�parent�package_namera �fname�lineno�es rR �_deprecated_methodr{ � sG � � Q�W�W��,�K�S� X� � �H� �.��%�%� � ���&�/�)�)��C��E� *� �>�'�'��Q�/�/��2�L��� �C����� ���C��%�f�-�-�<����'��/�/��2�7�a�� �h� 2�E�6�B�B�B�B�B�� �Y�� N� N� N��X�3�a�7� 8�:L�M�M�M�M�M�M�M�M�M�����N���s �92C �C;�C6�6C;c �` � t | � � S # t t t f$ r | cY S w xY w)zwSafely evaluate an expression Returns original string if eval fails. Use only where types are ambiguous. )r � NameError�SyntaxError� ValueErrorrW s rR �_safe_literal_evalr� � s>