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/surface/storage/__pycache__/du.cpython-312.pyc
�

�������dZddlmZddlmZddlmZddlZddlZddlmZddl	m
Z
ddlmZdd	lm
Z
dd
lmZddlmZddlmZdd
lmZdZdZdZe
j,e
j.e
j0j2�Gd�de
j4���Ze
j,e
j.e
j0j8�Gd�de���Zy)zCImplementation of Unix-like du command for cloud storage providers.�)�absolute_import)�division)�unicode_literalsN)�	cloud_api)�base)�du_command_util)�errors)�flags)�
regex_util)�storage_url)�filesa�
Displays the amount of space in bytes used by the objects in a bucket,
subdirectory, or project. This command calculates the current space usage
by making a series of object listing requests, which can take a long time
for large buckets. If your bucket contains hundreds of thousands of
objects, or if you want to monitor your bucket size over time, use
Monitoring instead, as described in [Get bucket size](https://cloud.google.com/storage/docs/getting-bucket-size)
aM
To list the size of each object in a bucket:

  $ {command} gs://bucketname

To list the size of each object in the prefix subdirectory:

  $ {command} gs://bucketname/prefix/*

To print the total number of bytes in a bucket in human-readable form:

  $ {command} -c gs://bucketname

To see a summary of the total number of bytes in two given buckets:

  $ {command} -s gs://bucket1 gs://bucket2

To list the size of each object in a bucket with Object Versioning
enabled, including noncurrent objects:

  $ {command} -a gs://bucketname

To list the size of each object in a bucket, except objects that end in
".bak", with each object printed ending in a null byte:

  $ {command} -e "*.bak" -0 gs://bucketname

To list the size of each bucket in a project and the total size of the
project:

  $ {command} --summarize --readable-sizes --total
z�
The following command summarizes the size of objects that match the specified
filter.

  $ {command} gs://my-bucket --metadata-filter='contexts."foo"="bar"' --summarize

c�0�eZdZdZeed�Zed��Zd�Z	y)�Du�@Displays the amount of space in bytes used by storage resources.��DESCRIPTION�EXAMPLESc��|jddd��|jdddd�	�|jd
ddd�	�|jd
ddd�	�|jdddgd��|jdddd�	�|jdddd�	�|jddd��tj|�|j�tjj
k(rtj|�yy)N�url�*zThe url of objects to list.)�nargs�helpz-0z--zero-terminator�
store_truezpEnds each output line with a 0 byte rather than a newline. You can use this to make the output machine-readable.)�actionrz-az--all-versionsz�Includes noncurrent object versions for a bucket with Object Versioning enabled. Also prints the generation and metageneration number for each listed object.z-cz--totalz+Includes a total size of all input sources.z-ez--exclude-name-pattern�appendz~Exclude a pattern from the report. Example: `-e "*.o"` excludes any object that ends in ".o". Can be specified multiple times.)r�defaultrz-rz--readable-sizeszSPrints object sizes in human-readable format. For example, 1 KiB, 234 MiB, or 2GiB.z-sz--summarizez,Displays only the summary for each argument.z-Xz--exclude-name-pattern-filezpSimilar to -e, but excludes patterns from the given file. The patterns to exclude should be listed one per line.)r)�add_argumentr
�add_additional_headers_flag�ReleaseTrackr�ALPHA�add_metadata_filter_flag)�cls�parsers  �lib/surface/storage/du.py�ArgszDu.Args\sJ��
����S�/L��M�
������
A���������*�	�+�������
:�	������ ���
N�
�	�������
!���������
;�	������%�
F�	��
�%�%�f�-�
����T�.�.�4�4�4��$�$�V�,�5�c���tj|�}t|dd�}|jr�g}|jD]�}t	j
|�}t
|tj�s.tjdj|j���|�2|jtjk7rtjd��|j!|���n$t	jtj�g}|j"}|j$r�|j$dk(r<|j't(j*D�cgc]}|j-���c}�nUt/j0|j$�5}	|j'|	D�cgc]}|j-���c}�ddd�|D�
cgc]}
t3j4|
���}}
t7j8|t;j<|�tj>|�|j@|jB|jD||jF|��	jI�ycc}wcc}w#1swY��xYwcc}
w)N�metadata_filterz?Du only works for valid cloud URLs. {} is an invalid cloud URL.z/Metadata filter is only supported for GCS URLs.�-)	�
cloud_urls�exclude_patterns�object_state�readable_sizes�	summarize�total�use_gsutil_style�zero_terminator�list_filter)%r
�check_if_use_gsutil_style�getattrrr�storage_url_from_string�
isinstance�CloudUrlr	�InvalidUrlError�format�
url_string�schemer�DEFAULT_PROVIDER�Errorr�exclude_name_pattern�exclude_name_pattern_file�extend�sys�stdin�stripr
�
FileReader�fnmatch�	translater�
DuExecutorr�Patterns�get_object_state_from_flagsr-r.r/r1�	list_urls)�self�argsr0r(�storage_urlsr:�
url_object�exclude_fnmatch_strings�line�file�pattern�exclude_regex_stringss            r$�RunzDu.Run�s���6�6�t�<���d�$5�t�<�O��x�x��l����*� �8�8��D�
��*�k�&:�&:�;��&�&�-�-3�V�J�4I�4I�-J���

�'��!�!�Y�%?�%?�?����N�O�
O����J�'�!�"�*�*�9�+E�+E�F�G�l�"�7�7���%�%�	
�	'�	'�3�	.��&�&����'K����
�
���'K�L�
�
�
�d�<�<�
=��
!�
(�
(�4�)H�4�4�$�*�*�,�4�)H�
I�>�3J��2I�w����'�"�2I�������#�,�,�-B�C��6�6�t�<��*�*��.�.��j�j�)��,�,�#�
��i�k��%(L��*I�>�
=��s*�
I�I(�I#
�2I(�I4�#I(�(I1N)
�__name__�
__module__�__qualname__�__doc__�_COMMAND_DESCRIPTION�_GA_EXAMPLES�
detailed_help�classmethodr%rT�r&r$rrRs1��I�*���-�
�=-��=-�~,r&rc� �eZdZdZeeezd�Zy)�DuAlpharrN)rUrVrWrXrYrZ�_ALPHA_EXAMPLESr[r]r&r$r_r_�s��I�*���0��-r&r_)rX�
__future__rrrrErA�googlecloudsdk.api_lib.storager�googlecloudsdk.callioper�"googlecloudsdk.command_lib.storagerr	r
rr�googlecloudsdk.core.utilr
rYrZr`�UniverseCompatible�
ReleaseTracksr�GA�Commandrr r_r]r&r$�<module>rjs���J�&��'��
�4�(�>�5�4�9�:�*�����@���������D�%�%�(�(�)�t����t�*��t�n�������D�%�%�+�+�,��b��-��r&