HEX
Server: Apache/2.4.68 (Debian)
System: Linux as-cs-widget-demo-us-central1 6.1.0-44-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.164-1 (2026-03-09) x86_64
User: root (0)
PHP: 8.2.32
Disabled: NONE
Upload Files
File: //lib/google-cloud-sdk/lib/googlecloudsdk/calliope/__pycache__/backend.cpython-312.pyc
�

������T�dZddlmZddlmZddlmZddlZddlZddlZddlZddl	m
Z
ddl	mZddl	mZdd	l	m
Z
dd
l	mZddl	mZddl	mZdd
l	mZddl	mZddl	mZddlmZddlmZddlmZddlmZddlZGd�de�ZGd�de�ZGd�de�ZGd�de�Z y)zGBackend stuff for the calliope.cli module.

Not to be used by mortals.
�)�absolute_import)�division)�unicode_literalsN)�actions)�arg_parsers)�base)�command_loading)�display)�
exceptions)�parser_arguments)�
parser_errors)�parser_extensions)�
usage_text)�handlers)�log)�metrics)�textc�$�eZdZdZdd�Zd�Zd�Zy)�_Notesz$Auto-generated NOTES section helper.Nc��g|_|r1|jj|j��d|_yd|_y)NTF)�_notes�append�rstrip�
_paragraph)�self�explicit_notess  �&lib/googlecloudsdk/calliope/backend.py�__init__z_Notes.__init__2s5���D�K��
�k�k����.�.�0�1��d�o��d�o�c��|s|�/y|jr"d|_|jjd�|jj|j��y)z7Adds a note line with preceding separator if not empty.NF�)rrrr)r�lines  r�AddLinez_Notes.AddLine:sE���	
���	
����d�o�
�k�k������K�K���t�{�{�}�%rc�T�|jrdj|j�SdS)z.Returns the notes contents as a single string.�
N)r�join�rs r�GetContentsz_Notes.GetContentsDs ��%)�[�[�4�9�9�T�[�[�!�:�d�:r�N)�__name__�
__module__�__qualname__�__doc__rr#r(�rrrr/s��,��&�;rrc��eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zdd�Zd�Zd�Zd�Zdd�Z	dd�Zd�Zd�Zd�Zd�Zd�Zd�Zd d�Zd!d�Zdd�Zy
)"�
CommandCommonz�A base class for CommandGroup and Command.

  It is responsible for extracting arguments from the modules and does argument
  validation, since this is always the same for groups and commands.
  c��|j|_||_|d|_|jjdd�|_tjd|�|j|d<||_dj|�|_	||_
||_||j_
||j_t|jD�cgc]}|tj k(��c}�|_|�r	|j%�rd|j_|j)�r'|jj*�d|j_|j-�r|jj.�d|j_|j1�rd|j_|j5�rIt7j8|j5��D]#\}	}
|jj;|	|
d�	��%t=|jd
i�|_|jA|jjB�|jE||��ycc}w)a�Create a new CommandCommon.

    Args:
      common_type: base._Common, The actual loaded user written command or group
        class.
      path: [str], A list of group names that got us down to this command group
        with respect to the CLI itself.  This path should be used for things
        like error reporting when a specific element in the tree needs to be
        referenced.
      release_track: base.ReleaseTrack, The release track (ga, beta, alpha,
        preview) that this command group is in.  This will apply to all commands
        under it.
      cli_generator: cli.CLILoader, The builder used to generate this CLI.
      parser_group: argparse.Parser, The parser that this command or group will
        live in.
      allow_positional_args: bool, True if this command can have positional
        arguments.
      parent_group: CommandGroup, The parent of this command or group. None if
        at the root.
    ����_�-zLoaded Command Group: %s�.TNF)�preserve_existing�
detailed_help)�parser_group�allow_positional_args)#�category�
_parent_group�name�replace�cli_namer�debug�_pathr&�dotted_name�_cli_generator�_common_type�_release_track�any�__mro__r�Group�is_group�IsHidden�
_is_hidden�IsUniverseCompatible�_universe_compatible�IsDefaultUniverseCompatible�_default_universe_compatible�IsUnicodeSupported�_is_unicode_supported�Notices�six�	iteritems�	AddNotice�getattrr7�_ExtractHelpStringsr-�
_AssignParser)r�common_type�path�
release_track�
cli_generatorr8r9�parent_group�t�tag�msgs           rrzCommandCommon.__init__Ps���< �(�(�D�M�%�D���R��D�I��I�I�%�%�c�3�/�D�M��I�I�(�$�/��}�}�D��H��D�J��x�x��~�D��'�D��$�D��'4�D���$�'4�D���$��+�2E�2E�F�2E�Q��d�j�j��2E�F�G�D�M��	�	�	�	 �'+����$��
+�
+�
-����4�4�<�15����.��6�6�8�
�
�
�
;�
;�
C�9>����6�	�	(�	(�	*�26����/�	�	�	�	��
�
�l�&:�&:�&<�=�H�C��
�
�
�
%�
%�c�3�$�
%�
G�>�!��!2�!2�O�R�H�D�����T�.�.�6�6�7����!�9N����9Gs�	Ic�6�|jj�S)z*Gets the notices of this command or group.)rCrQr's rrQzCommandCommon.Notices�s�����$�$�&�&rc�6�|jj�S)z0Gets the release track of this command or group.)rC�ReleaseTrackr's rrbzCommandCommon.ReleaseTrack�s�����)�)�+�+rc�6�|jj�S)z0Gets the hidden status of this command or group.)rCrIr's rrIzCommandCommon.IsHidden�s�����%�%�'�'rc�6�|jj�S)z8Gets the auto generated status of this command or group.)rC�IsAutoGeneratedr's rrezCommandCommon.IsAutoGenerated�s�����,�,�.�.rc�6�|jj�S)z=Gets the universe compatible status of this command or group.)rCrKr's rrKz"CommandCommon.IsUniverseCompatible�s�����1�1�3�3rc�6�|jj�S)zEGets the default universe compatible status of this command or group.)rCrMr's rrMz)CommandCommon.IsDefaultUniverseCompatible�s�����8�8�:�:rc�6�|jj�S)z;Gets the unicode supported status of this command or group.)rCrOr's rrOz CommandCommon.IsUnicodeSupported�s�����/�/�1�1rc��|jS)z9Returns True if this is the root element in the CLI tree.)r;r's r�IsRootzCommandCommon.IsRoot�s���!�!�!�!rc�Z�|j�r|S|jj�S)zGets the top group of this CLI.)rjr;�_TopCLIElementr's rrlzCommandCommon._TopCLIElement�s%���{�{�}�
�k����,�,�.�.rc�T��tj|�\|_|_d|jvr7tjdd|jd�j�|_|jr0|jjd�s|xjdz
c_|j�r�ddjt|j�j���zdz}|jjd�}|r?t|j�|_|tj |�z|jd<|j|jk(r|xj|z
c_n!|j|z|jz|_|j|_t%|j"�dkDr�|j"dj'�rO|j"dj'�s2|j"dj)�|j"dd	z|_|j"d
dk(r|j"d	d
|_g}|j+�j,��r|j/��|j�r6|j1t|j�j3���|r�dj|�dz��fd�}||j�|_|jj5d�s||j�|_|jjd�}|rZtj6d
|�sCt|j�|_|tj |��|jd<y	y	y	y	)a
Extracts short help, long help and man page index from a docstring.

    Sets self.short_help, self.long_help and self.index_help and adds release
    track tags if needed.

    Args:
      docstring: The docstring from which short and long help are to be taken
    �briefz\s� r5z

�DESCRIPTION�rNr2c�8��tjdd�z|�S)Nz^(\s*)z\1)�re�sub)�txtr^s �r�
_InsertTagz5CommandCommon._ExtractHelpStrings.<locals>._InsertTag�s����v�v�i����c�2�2r�#z^[ \n]*\{(description|index)\})r�ExtractHelpStrings�
short_help�	long_helpr7rsrt�strip�endswithrQr&�sorted�values�get�dict�textwrap�dedent�
index_help�len�isupper�lowerrb�help_tagr�extend�keys�
startswith�match)r�	docstring�all_notices�description�tagsrvr^s      @rrVz!CommandCommon._ExtractHelpStrings�s����'1�&C�&C�I�&N�#�D�O�T�^��$�$�$�$����u�c�4�+=�+=�g�+F�G�M�M�O�d�o����t���7�7��<�
�o�o���o��|�|�~�
�6�;�;�v�d�l�l�n�&;�&;�&=�>�?�
?�&�
H���&�&�*�*�=�9�k�	�!�$�"4�"4�5���,7�(�/�/��;
�-
����=�)�
���D�N�N�	*����+�%�����;�6����G����o�o�D�O�
�4�?�?��a��	
����	�	#�	#�	%�d�o�o�a�.@�.H�.H�.J��/�/�!�,�2�2�4�t���q�r�7J�J���	
����	��	#��/�/�#�2�.���
�D�
�
�
�
�
&�
&�C�
�
�k�k�#���|�|�~�
�k�k�&�����,�,�.�/�0���H�H�T�N�S� �c�3�#�4�?�?�3�d�o��^�^�
&�
&�s�
+�#�D�N�N�3����&�&�*�*�=�9�k�	�R�X�X�
+�[��"�$�"4�"4�5���,6��O�O�K�(�-
����=�)�	��rNc	� �|s|jjd�}t|�}|j�r|j	d�|j	|j�j�|j�}|r{|j	djtjt|�dd���|j	d�|D]'}|j	d|z�|j	d��)|j�S)z;Returns the NOTES section with explicit and generated help.�NOTESz]This command is an internal implementation detail and may change or disappear without notice.z{} also available:zThis variant iszThese variants arer!z  $ )
r7rrrIr#rb�	help_note�#GetExistingAlternativeReleaseTracks�formatr�	Pluralizer�r()r�contents�notes�
alternates�	alternates     r�GetNotesHelpSectionz!CommandCommon.GetNotesHelpSection
s�����#�#�'�'��0�h��8��E��}�}���m�m�0��
�M�M�$�#�#�%�/�/�0��9�9�;�J���m�m�
�
%�
%��n�n��j�/�#4�6J�����m�m�B��!�)�
�
�
�f�y�(�)�
�
�
�b��"�����rc
� �|s3tj|jd|j|��|_nD|j|j|j|jd|j|��|_d|_tj|j||j|��|_|jjdtj|�dt j"d�	�|jjd
tj$|d
�dt j"d�	�|jjdtj$|�dd
dt'j(�dd��|j+�y)a!Assign a parser group to model this Command or CommandGroup.

    Args:
      parser_group: argparse._ArgumentGroup, the group that will model this
        command or group's arguments.
      allow_positional_args: bool, Whether to allow positional args for this
        group or not.
    F)r��add_help�prog�calliope_command)�helpr�r�r�r�N)�parser�	is_globalr[�allow_positionalz-hTzPrint a summary help and exit.)�action�
is_replicatedr:r�z--helpzDisplay detailed help.z
--documentrq�
ATTRIBUTESzTHIS TEXT SHOULD BE HIDDEN)r�r��nargs�metavar�type�hiddenr�)r�ArgumentParserrzrA�_parser�
add_parserr>ry�_sub_parserr�ArgumentInterceptorrB�ai�add_argumentr�ShortHelpActionr�COMMONLY_USED_FLAGS�RenderDocumentActionr�ArgDict�_AcquireArgs)rr8r9s   rrWzCommandCommon._AssignParser$sh���&�5�5��n�n������	�d�l�"�,�,�
�-�-�����n�n������
-��d�l��D���2�2��|�|�"�"��)�)�.�	�D�G�	�G�G�����&�&�t�,���)�)�
-���	�G�G�����+�+�D�(�;���)�)�
%���	�G�G�����+�+�D�1����
�
 �
 �
"��
)��	�	���rc�@�|}|D]}|j|�}|r�yy)a.Determines if the given sub command path is valid from this node.

    Args:
      command_path: [str], The pieces of the command path.

    Returns:
      True, if the given path parts exist under this command or group node.
      False, if the sub path does not lead to a valid command or group.
    FT��LoadSubElement)r�command_path�current�parts    r�IsValidSubPathzCommandCommon.IsValidSubPathes.���G����&�&�t�,�g�
���rc��gS�z�Gets all the sub elements of this group.

    Returns:
      set(str), The names of all sub groups or commands under this group.
    r.r's r�AllSubElementszCommandCommon.AllSubElementsvs	���Irc��y)��Load all the sub groups and commands of this group.

    Args:
      recursive: bool, True to continue loading all sub groups, False, to just
        load the elements under the group.
      ignore_load_errors: bool, True to ignore command load failures. This
        should only be used when it is not critical that all data is returned,
        like for optimizations like static tab completion.

    Returns:
      int, The total number of elements loaded.
    rr.)r�	recursive�ignore_load_errorss   r�LoadAllSubElementsz CommandCommon.LoadAllSubElementss��
rc��y)�Load a specific sub group or command.

    Args:
      name: str, The name of the element to load.
      allow_empty: bool, True to allow creating this group as empty to start
        with.
      release_track_override: base.ReleaseTrack, Load the given sub-element
        under the given track instead of that of the parent. This should only be
        used when specifically creating the top level release track groups.

    Returns:
      _CommandCommon, The loaded sub element, or None if it did not exist.
    Nr.)rr<�allow_empty�release_track_overrides    rr�zCommandCommon.LoadSubElement�s�� 	rc�B�|}|D]}|j|�}|��y|S)aLoad a specific sub group or command by path.

    If path is empty, returns the current element.

    Args:
      path: list of str, The names of the elements to load down the hierarchy.

    Returns:
      _CommandCommon, The loaded sub element, or None if it did not exist.
    Nr�)rrY�currr�s    r�LoadSubElementByPathz"CommandCommon.LoadSubElementByPath�s2���D���
�
 �
 ��
&�d�	
�����Krc��|jSr))r@r's r�GetPathzCommandCommon.GetPath�s���:�:�rc�B�tj||j�Sr))r�GetUsager�r's rr�zCommandCommon.GetUsage�s�����t�T�W�W�-�-rc��iSr)r.r's r�GetSubCommandHelpsz CommandCommon.GetSubCommandHelps����
�Irc��iSr)r.r's r�GetSubGroupHelpszCommandCommon.GetSubGroupHelps�r�rc	�:�|jj|j�|jj|j�|j�r�|jjj
D]'}|jj
j
|��)|jjjr�|jjs-|jjtj��|jjjjD])}	|jjjdi|���+|jj%�D]E}|j&r�|j(r�|j*r�*	|jj-|��G|jj4j7|jjj4�yy#tj$r4tjdj!|j"|d����wxYw#t.j0$r;tjdj!|j"|j2����wxYw)z>Calls the functions to register the arguments for this module.z-repeated concept in {command}: {concept_name}r<)�command�concept_namez"repeated flag in {command}: {flag})r��flagNr.)rC�_Flagsr��Argsr;�	argumentsr�concept_handler�add_conceptsr�RuntimeHandler�
_all_concepts�
AddConcept�RepeatedConceptNamer
�ArgumentExceptionr�rA�GetAllAvailableFlagsr��do_not_propagate�is_required�AddFlagActionFromAncestors�argparse�
ArgumentError�option_strings�display_info�AddLowerDisplayInfo)r�arg�concept_detailsr�s    rr�zCommandCommon._AcquireArgs�s%��	�����T�W�W�%������4�7�7�#�����#�#�&�&�0�0�#������ � ��%�1�
�	�	�	�	�	.�	.��w�w�&�&�
�'�'�
�
�x�6�6�8�
9��
�
�
"�
"�
2�
2�
@�
@�
��.�D�G�G�#�#�.�.�A��A�A��$�$�9�9�;�$����
�� � ������	�
�'�'�
,�
,�T�
2�<�,�g�g���.�.�
�
�
�
�
�
,�
,��Y���-�-���1�1�?�F�F� �,�,�!0��!8�G���
���.�%�%�	��/�/�2�9�9��*�*��1D�1D�:����	�s�3&H� I�AI	�AJc���|jj|jjz}|r|r|S|D�cgc] }|s|js|s|js|��"c}Scc}wr))r��	flag_args�ancestor_flag_argsr��	is_hidden)r�include_global�include_hidden�flags�fs     rr�z"CommandCommon.GetAllAvailableFlags�se���G�G������ :� :�:�E��.�
�l����A��!�+�+�
�1�;�;�	
�����s�%A c�z�|jj}|r|S|D�cgc]}|jr�|��c}Scc}wr))r�r�r�)rr�r�r�s    r�GetSpecificFlagszCommandCommon.GetSpecificFlagss7���G�G���E��
�l��0�u�!�A�K�K�A�u�0�0��0s�8�8c��g}|j�}|r|j|�|jj|�}|r�|j	�}tt
j|�d���D]M\}}|j|dd�}|s�|j�r�.|jdj|���O|S)z�Gets the names for the command in other release tracks.

    Args:
      value: str, Optional value being parsed after the command.

    Returns:
      [str]: The names for the command in other release tracks.
    c�(�|djxsdS)Nrr!)�prefix)�xs r�<lambda>zCCommandCommon.GetExistingAlternativeReleaseTracks.<locals>.<lambda>s��1�Q�4�;�;�3D�"�3Dr)�keyrqNro)r�rrB�%ReplicateCommandPathForAllOtherTracksrlr}rRrSr�rIr&)	r�value�existing_alternativesrYr��top_elementr3r��alternative_cmds	         rr�z1CommandCommon.GetExistingAlternativeReleaseTrackss������<�<�>�D��
�k�k�%���$�$�J�J�4�P�J���'�'�)�k�#�

�-�-�
�
#�)D��/�!�\�&�:�:�<���;K�L���?�#;�#;�#=�
�
&�
&�s�x�x��'=�
>��!� rr)�FF�FN)TT)T)r*r+r,r-rrQrbrIrerKrMrOrjrlrVr�rWr�r�r�r�r�r�r�r�r�r�r�r�r�r.rrr0r0Is����M�^'�,�(�/�4�;�2�"�/�B
�H�4?�B�"�

� =A�	�$�$�.���5�n� 1�!rr0c���eZdZdZ		d�fd�	Zd�Zd�Zd�Zd�Zd�Z	dd�Z
	dd	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Z�xZS)�CommandGroupz+A class to encapsulate a group of commands.c		�Z��tj||||d��}	tt|�|	|||d||��||_i|_i|_i|_i|_	t�|_tj||�\}
}|j|�|jj|
�|jj|�dj|j �}|j"j%�j'|g�}
|
D])\}}}|r|g|j|<�|g|j|<�+|s_|jsS|jsGt)|j+��s.tj,dj/|j0���|j3�y)a�Create a new command group.

    Args:
      impl_paths: [str], A list of file paths to the command implementation for
        this group.
      path: [str], A list of group names that got us down to this command group
        with respect to the CLI itself.  This path should be used for things
        like error reporting when a specific element in the tree needs to be
        referenced.
      release_track: base.ReleaseTrack, The release track (ga, beta, alpha,
        preview) that this command group is in.  This will apply to all commands
        under it.
      construction_id: str, A unique identifier for the CLILoader that is being
        constructed.
      cli_generator: cli.CLILoader, The builder used to generate this CLI.
      parser_group: the current argparse parser, or None if this is the root
        command group.  The root command group will allocate the initial top
        level argparse parser.
      parent_group: CommandGroup, The parent of this group. None if at the root.
      allow_empty: bool, True to allow creating this group as empty to start
        with.

    Raises:
      LayoutException: if the module has no sub groups or commands
    F)�
is_command�rYrZr[r9r8r\r5z&Group {0} has no subgroups or commandsN)r	�LoadCommonType�superrr�_construction_id�groups�commands�_groups_to_load�_commands_to_load�set�_unloadable_elements�FindSubElements�!_RemoveInitExtensionsFileIfNeeded�updater&r@rB�GetModulesByParentrrE�_GetMappedSubmodules�LayoutExceptionr�rA�	SubParser)r�
impl_pathsrYrZ�construction_idr[r8r\r�rX�group_infos�
command_infos�
group_name�
added_modules�module_name�module_is_command�module_impl_path�	__class__s                 �rrzCommandGroup.__init__*s����H"�0�0��D�-��U��K�
�,��&��
�#�#�#�!�!�'��,�D���D�K��D�M��D���D�� #��D��!0�!@�!@��D�"��K��	�*�*�=�9�������,����!�!�-�0����$�*�*�%�J��'�'�:�:�<�@�@��B��M�<I�8��&�(8�	�/?�.@����{�+�-=�,>����[�)�	=J�
��$�$��&�&��D�-�-�/�0��+�+�
2�
9�
9�$�:J�:J�
K�
��	�N�N�rc#�&K�dj|jdt|j�j�zd�jdd�}|jj�D]}|dj|dz�s�|��� y�w)z<Yields registered modules (if any) under this command group.r5rqNr4r3r)	r&r@�boolrbr�r=rB�
GetModulesr�)r�module_path�ms   rrz!CommandGroup._GetMappedSubmodules�s������(�(��
�
�1�t�D�-�-�/�6�6�7�7�8�9���g�c�3����
 �
 �
+�
+�
-��	
�1�����s�*�	+���.�s�BB�
Bc�\�|jjtj|j�D��cic]\}}||vr||��c}}�|jjtj|j�D��cic]\}}||vr||��c}}�ycc}}wcc}}w)z�Copies all the sub groups and commands from this group to the other.

    Args:
      other_group: CommandGroup, The other group to populate.
      ignore: set(str), Names of elements not to copy.
    N)rrrRrSr)r�other_group�ignorer<rs     r�CopyAllSubElementsToz!CommandGroup.CopyAllSubElementsTo�s������&�&� #�
�
�d�.B�.B� C�(� C��D�*��v��	
�j�� C�(��
�!�!�(�(� #�
�
�d�.D�.D� E�*� E��D�*��v��	
�j�� E�*���(��
*s�B"
�B(
c��|js0|jjtj|��|_|jS)z�Gets or creates the argparse sub parser for this group.

    Returns:
      The argparse subparser that children of this group should register with.
          If a sub parser has not been allocated, it is created now.
    )r�r�)r�r��add_subparsersr�CommandGroupActionr's rrzCommandGroup.SubParser�sB��������4�4�"�5�5��5��d�����rc��t|jj��t|jj��zSr�)rrr�rr's rr�zCommandGroup.AllSubElements�s7���t�#�#�(�(�*�+�c�$�2H�2H�2M�2M�2O�.P�P�Prc�6�t|j|��S)z�Determines if the given name is a valid sub group or command.

    Args:
      name: str, The name of the possible sub element.

    Returns:
      bool, True if the name is a valid sub element of this group.
    )r%r�)rr<s  r�IsValidSubElementzCommandGroup.IsValidSubElement�s����#�#�D�)�*�*rc���d}|j�D]5}	|j|�}|dz
}|s�|s� ||j	||��z
}�7|S#d}|stjd|��Y�?xYw)r�rrqNzError loading element %s)r�r�)r�r�r�warningr�)rr�r��totalr<�elements      rr�zCommandGroup.LoadAllSubElements�s���
�E��#�#�%��	��%�%�d�+��
��
��
�Y�
��+�+��4F�,�
�	
��&��L�����!�

�+�+�0�$�
7�
�"�s�A
�
A,c
��|jdd�}|jj|d�}|s|jj|d�}|r|S||jvryd}	||j
vr}t
|j
||j|gz|xs|j�|j|j|j�||��}||j|j<|S||jvrzt|j||j|gz|xs|j�|j|j|j�|��}||j|j<|S#tj $r;}|jj#|�t%j&|�Yd}~|Sd}~wwxYw)r�r4r3N)r\r�)r\)r=r
rrrrrr@rbrrBrr<r�Commandr	�#ReleaseTrackNotImplementedException�addrr?)rr<r�r��existingr6�es       rr�zCommandGroup.LoadSubElement�s��� �<�<��S�!�D��{�{���t�T�*�H�����"�"�4��.�h��
�o��t�(�(�(�
��G��	
��%�%�	%��� � ��&��J�J�$���"�9�d�&7�&7�&9��!�!�����N�N���#�	
��%,����G�L�L�!��N��4�)�)�)���"�"�4�(��J�J�$���"�9�d�&7�&7�&9��!�!�����N�N���
��'.��
�
�g�l�l�#��N���>�>��
���#�#�D�)�	�i�i��l�l��N���s �#B	E8�.BE8�8G�0G�Gc�V�td�|jj�D��S)Nc3�K�|]J}|jtj|j|j	�|j
��f���Ly�w�)�	help_textr�rZN�r>r�HelpInforyrIrb��.0�items  r�	<genexpr>z2CommandGroup.GetSubCommandHelps.<locals>.<genexpr>sL����
�+�D�
�M�M�����/�/��-�-�/�"�/�/�
�	
�+�s�AA)r�rr~r's rr�zCommandGroup.GetSubCommandHelpss+���
��M�M�(�(�*�
�
�
rc�V�td�|jj�D��S)Nc3�K�|]N}|jtj|j|j	�|j���f���Py�wr?rArCs  rrFz0CommandGroup.GetSubGroupHelps.<locals>.<genexpr>$sO����
�)�D�
�M�M�����/�/��-�-�/�"�/�/�1�
�	
�)�s�AA)r�r
r~r's rr�zCommandGroup.GetSubGroupHelps#s+���
��K�K�&�&�(�
�
�
rc��|jr|jj||�|j�j||�y)a,Constructs and runs the Filter() method of all parent groups.

    This recurses up to the root group and then constructs each group and runs
    its Filter() method down the tree.

    Args:
      context: {}, The context dictionary that Filter() can modify.
      args: The argparse namespace.
    N)r;�RunGroupFilterrC�Filter)r�context�argss   rrJzCommandGroup.RunGroupFilter0s<�����
���'�'���6�������w��-rc�J�tj||j��Sr))r�GetCategoricalUsage�_GroupSubElementsByCategoryr's rrOz CommandGroup.GetCategoricalUsage>s#���)�)��d�.�.�0��rc�,�tj|�Sr))r�GetUncategorizedUsager's rrRz"CommandGroup.GetUncategorizedUsageCs���+�+�D�1�1rc�,�tj|�Sr))r�GetHelpHintr's rrTzCommandGroup.GetHelpHintFs���!�!�$�'�'rc��d�}|j�i}||j�|d<||j�|d<|S)zCReturns dictionary mapping each category to its set of subelements.c��tjt�}|j�D]`}|j	�r�|j
r||j
j
|��?|tjj
|��b|S)z4Returns dictionary mapping specific to element type.)	�collections�defaultdictrr~rIr:r:r�UNCATEGORIZED_CATEGORY)�elements�categorized_dictr6s   r�%_GroupSubElementsOfSameTypeByCategoryzWCommandGroup._GroupSubElementsByCategory.<locals>._GroupSubElementsOfSameTypeByCategoryLss��$�0�0��5���_�_�&�'����!�
�
�
��W�-�-�.�2�2�7�;��T�8�8�9�=�=�g�F�'��rr��
command_group)r�rr
)rr\�
categoriess   rrPz(CommandGroup._GroupSubElementsByCategoryIsK��	�	�����J�A�$�-�-�P�J�y��"G����#�J����rc�4�d}||vr|j|�yy)a�Removes _init_extensions.py file from command_infos dict if present.

    It prevents loading _init_extensions.py as a command file.
    This additional file is used by CLI Autogen to extend the functionality of
    an __init__.py file by allowing to add no-auto-generated custom code.

    Args:
      command_infos: dict, A dictionary of command names to a list of file paths
        that implement that command.
    �_init_extensionsN)�pop)rr�init_extensions_files   rrz.CommandGroup._RemoveInitExtensionsFileIfNeeded`s&��.���}�,����,�-�-r)NFrr)r*r+r,r-rrr,rr�r2r�r�r�r�rJrOrRrTrPr�
__classcell__�r#s@rrr'si���3���T�l��&�Q�	+��@=A�7�r��.��
2�(��.
.rrc�,��eZdZdZ	d�fd�	Zd�Z�xZS)r8zAA class that encapsulates the configuration for a single command.c	����tj||||d|j��}tt|�||||d||��|jj||j��y)amCreate a new command.

    Args:
      impl_paths: [str], A list of file paths to the command implementation for
        this command.
      path: [str], A list of group names that got us down to this command with
        respect to the CLI itself.  This path should be used for things like
        error reporting when a specific element in the tree needs to be
        referenced.
      release_track: base.ReleaseTrack, The release track (ga, beta, alpha,
        preview) that this command group is in.  This will apply to all commands
        under it.
      construction_id: str, A unique identifier for the CLILoader that is being
        constructed.
      cli_generator: cli.CLILoader, The builder used to generate this CLI.
      parser_group: argparse.Parser, The parser to be used for this command.
      parent_group: CommandGroup, The parent of this command.
    T)r�yaml_command_translatorr	)r�r�N)	r	r
rgrr8rr��set_defaultsr@)
rrrYrZrr[r8r\rXr#s
         �rrzCommand.__init__ssu���8"�0�0������ -� E� E�
�K�
�'�4�!��
�#�#�"�!�!�"��	�L�L���t�$�*�*��Mrc��tj�i}|jr|jj||�|j	||��}tj|j|�|j|�}tj||||jj��j�}tj�|jdk7r t!j"|j���|S)a�Run this command with the given arguments.

    Args:
      cli: The cli.CLI object for this command line tool.
      args: The arguments for this command as a namespace.

    Returns:
      The object returned by the module's Run() function.

    Raises:
      exceptions.Error: if thrown by the Run() function.
      exceptions.ExitCodeNoError: if the command is returning with a non-zero
        exit code.
    )�clirL)r�r)�	exit_code)r�Loadedr;rJrCr�
LogCommandrA�Runr
�	Displayerr�r��Display�Ranrkr�ExitCodeNoError)rrjrM�tool_context�command_instance�	resourcess      rrnzCommand.Run�s����N�N���L����
���'�'��d�;��(�(�S�,�(�G���O�O�D�$�$�d�+� �$�$�T�*�I��!�!��$�	����8L�8L��
�g�i���K�K�M��!�!�Q�&��&�&�1A�1K�1K�L�L��rr))r*r+r,r-rrnrcrds@rr8r8ps���I��.N�`!rr8)!r-�
__future__rrrr�rWrsr��googlecloudsdk.callioperrrr	r
rrr
rr� googlecloudsdk.calliope.conceptsr�googlecloudsdk.corerr�googlecloudsdk.core.utilrrR�objectrr0rr8r.rr�<module>r|s��� �
'��'���	��+�/�(�3�+�.�4�1�5�.�5�#�'�)�
�;�V�;�4[!�F�[!�|F.�=�F.�R
T�m�Tr