File: //usr/lib/python3/dist-packages/gi/__pycache__/_option.cpython-311.pyc
�
f�_T3 � �< � d Z ddlZddlZddlmZmZmZmZmZ ddlm Z ddl
mZ ddlm
Z
e d� � Ze� e� � � � � Zg d �Z G d
� dej � � Z G d� d
ej � � Z G d� dej � � ZeZdS )a, GOption command line parser
Extends optparse to use the GOptionGroup, GOptionEntry and GOptionContext
objects. So it is possible to use the gtk, gnome_program and gstreamer command
line groups and contexts.
Use this interface instead of the raw wrappers of GOptionContext and
GOptionGroup in glib.
� N)�
OptParseError�OptionError�OptionValueError�BadOptionError�OptionConflictError� )�get_introspection_module)�_gi)�GError�GLib) r r r r r �Option�OptionGroup�OptionParser�make_optionc �x � e Zd ZdZej j dz Zej j g d�z Zdej z Z
d� Zd� Zd� Z
dS ) r
a� Represents a command line option
To use the extended possibilities of the GOption API Option
(and make_option) are extended with new types and attributes.
Types:
filename The supplied arguments are read as filename, GOption
parses this type in with the GLib filename encoding.
:ivar optional_arg:
This does not need a arguement, but it can be supplied.
:ivar hidden:
The help list does not show this option
:ivar in_main:
This option apears in the main group, this should only
be used for backwards compatibility.
Use Option.REMAINING as option name to get all positional arguments.
.. NOTE::
Every argument to an option is passed as utf-8 coded string, the only
exception are options which use the 'filename' type, its arguments
are passed as strings in the GLib filename encoding.
For further help, see optparse.Option.
)�filename)�hidden�in_main�optional_arg�--c � � t j j | g|�R i |�� | j st d� � �t | j � � t | j � � k rt d� � �| j st d| j d � � �d S )Nz!%s at least one long option name.z;%s at least more long option names than short option names.z%s needs a help message.r )�optparser
�__init__�
_long_opts�
ValueError�len�_short_opts�help��self�args�kwargss �,/usr/lib/python3/dist-packages/gi/_option.pyr zOption.__init__^ s� � ��� ��7��7�7�7��7�7�7��� B��@�A�A�A��t����#�d�&6�"7�"7�7�7��M�O� O�
O� �y� M��7����9K�L�L�L� M� M� c � � | j |v r| j � | j � � t j � | |� � t
| j � � t
| j � � k rt d� � �d S )NzCgoption.Option needs more long option names than short option names) � REMAININGr �appendr r
�_set_opt_stringr r r )r �optss r# r( zOption._set_opt_stringj s~ � ��>�T�!�!��O�"�"�4�>�2�2�2���'�'��d�3�3�3��t�� � �3�t��#7�#7�7�7�� 8� 9� 9�
9� 8�7r$ c # � K � d}| j r|t j j z }| j r|t j j z }| � � � r| j r|t j j z }n|t j j z }| j
dk r|t j j z }t | j
| j � � D ]R\ }}|d }t |t � � s|� d� � }|dd � ||| j | j fV � �S| j
t) | j � � d � D ]}|dd � d|| j | j fV � �d S )Nr r r zutf-8� � )r r �OptionFlags�HIDDENr �IN_MAIN�takes_valuer �OPTIONAL_ARG�NO_ARG�type�FILENAME�zipr r �
isinstance�bytes�encoder �metavarr )r �flags� long_name�
short_name�short_bytess r# �_to_goptionentrieszOption._to_goptionentriesr sp � � � ����;� -��T�%�,�,�E��<� .��T�%�-�-�E������ -�� �
7���)�6�6����T�%�,�,�E��9�
�"�"��T�%�.�.�E�'*�4�?�D�<L�'M�'M� O� O�#�Y�
�$�Q�-�K��k�5�1�1�
:�)�0�0��9�9���Q�R�R�=�+�u�d�i���N�N�N�N�N����T�-=�)>�)>�)?�)?�@� I� I�I��Q�R�R�=�%��� �4�<�H�H�H�H�H� I� Ir$ N)�__name__�
__module__�__qualname__�__doc__r r
�TYPES�ATTRSr �OPTION_REMAININGr&