← Back
Editing: nlspec.cpython-312.pyc
� }j�P � �. � d dl Z d dlZd dlZd dlZda G d� d� Z G d� de� Z G d� de� Z G d� d e� Z G d � de� Z G d� d e� Z G d� de� Z G d� de� Z G d� de� Z G d� de� Z G d� de� Z G d� de� Zy)� Nc �6 � e Zd ZdZd� Zd� Zd� Zd d�Zd� Zd� Z y) �SpecElementa" Netlink spec element. Abstract element of the Netlink spec. Implements the dictionary interface for access to the raw spec. Supports iterative resolution of dependencies across elements and class inheritance levels. The elements of the spec may refer to each other, and although loops should be very rare, having to maintain correct ordering of instantiation is painful, so the resolve() method should be used to perform parts of init which require access to other parts of the spec. Attributes: yaml raw spec as loaded from the spec file family back reference to the full family name name of the entity as listed in the spec (optional) ident_name name which can be safely used as identifier in code (optional) c �� � || _ || _ d| j v r5| j d | _ | j j dd� | _ d| _ |j | � y )N�name�-�_F)�yaml�familyr �replace� ident_name�_super_resolved�add_unresolved)�selfr r s �5/usr/lib/python3.12/site-packages/pyynl/lib/nlspec.py�__init__zSpecElement.__init__ sZ � ��� �����T�Y�Y��� � �&�)�D�I�"�i�i�/�/��S�9�D�O�$������d�#� c � � | j | S �N�r �r �keys r �__getitem__zSpecElement.__getitem__* s � ��y�y��~�r c � � || j v S r r r s r �__contains__zSpecElement.__contains__- s � ��d�i�i��r Nc �: � | j j ||� S r )r �get)r r �defaults r r zSpecElement.get0 s � ��y�y�}�}�S�'�*�*r c �L � | j s|j � d| _ y y )NT)r �resolve)r �ups r � resolve_upzSpecElement.resolve_up3 s! � ��#�#��J�J�L�#'�D� � $r c � � y r � �r s r r zSpecElement.resolve8 s � �r r ) �__name__� __module__�__qualname__�__doc__r r r r r! r r# r r r r s% � ��" $�� �+�(� r r c �6 � � e Zd ZdZ� fd�Zd� Zd� Zdd�Z� xZS )� SpecEnumEntrya� Entry within an enum declared in the Netlink spec. Attributes: doc documentation string enum_set back reference to the enum value numerical value of this enum (use accessors in most situations!) Methods: raw_value raw value, i.e. the id in the enum, unlike user value which is a mask for flags user_value user value, same as raw value for enums, for flags it's the mask c � �� t |t � rd|i}t �| � |j |� |j dd� | _ || _ d|v r|d | _ y |r|j dz | _ y || _ y )Nr �doc� �value� ) � isinstance�str�superr r r r, �enum_setr. )r r3 r �prev�value_start� __class__s �r r zSpecEnumEntry.__init__H so �� ��d�C� ��D�>�D� ������$�/��4�8�8�E�2�&��� �� ��d�?��g��D�J� ����a��D�J�$�D�Jr c �, � t | j � S r )�boolr, r$ s r �has_doczSpecEnumEntry.has_docW s � ��D�H�H�~�r c � � | j S r )r. r$ s r � raw_valuezSpecEnumEntry.raw_valueZ s � ��z�z�r c �` � | j d dk( s|rd| j z S | j S )N�type�flagsr/ )r3 r. )r �as_flagss r � user_valuezSpecEnumEntry.user_value] s- � ��=�=�� �G�+�x��� � �?�"��:�:�r r ) r% r&