File manager - Edit - /home/u478019808/domains/bestandroidphones.store/public_html/static/img/logo/name_expansion.cpython-39.pyc.tar
Back
opt/gsutil/gslib/__pycache__/name_expansion.cpython-39.pyc 0000644 00000050033 15025234077 0017630 0 ustar 00 a +(Wg�w � @ s| d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlZddlZddlZddl Z ddl Z ddlmZ ddl Z ddlmZ dd lmZ dd lmZ ddlmZ ddlmZ dd lmZ ddlZ ddlmZ G dd� de�ZG dd� de�ZG dd� de�Zd)dd�ZG dd� de�Z G dd� de�Z!G dd� de�Z"G dd � d e�Z#e�$d!d"d#g�Z%e�$d$d%d&g�Z&G d'd(� d(e j'�Z(dS )*aB Name expansion iterator and result classes. Name expansion support for the various ways gsutil lets users refer to collections of data (via explicit wildcarding as well as directory, bucket, and bucket subdir implicit wildcarding). This class encapsulates the various rules for determining how these expansions are done. � )�absolute_import)�print_function)�division)�unicode_literalsN)�encoding)�CommandException)�NO_URLS_MATCHED_GENERIC)�NO_URLS_MATCHED_TARGET)�PluralityCheckableIterator)�SeekAheadResult)�storage_v1_messages)�StorageUrlFromStringc @ s e Zd ZdZdd� Zdd� ZdS )�NameExpansionResulta* Holds one fully expanded result from iterating over NameExpansionIterator. The member data in this class need to be pickleable because NameExpansionResult instances are passed through Multiprocessing.Queue. In particular, don't include any boto state like StorageUri, since that pulls in a big tree of objects, some of which aren't pickleable (and even if they were, pickling/unpickling such a large object tree would result in significant overhead). The state held in this object is needed for handling the various naming cases (e.g., copying from a single source URL to a directory generates different dest URL names than copying multiple URLs to a directory, to be consistent with naming rules used by the Unix cp command). For more details see comments in _NameExpansionIterator. c C s6 || _ || _|| _|| _|| _|r,t�|�nd| _dS )a� Instantiates a result from name expansion. Args: source_storage_url: StorageUrl that was being expanded. is_multi_source_request: bool indicator whether multiple input URLs or src_url_str expanded to more than one BucketListingRef. is_multi_top_level_source_request: same as is_multi_source_request but measured before recursion. names_container: Bool indicator whether src_url names a container. expanded_storage_url: StorageUrl that was expanded. expanded_result: cloud object metadata in MessageToJson form (for pickleability), if any was iterated; None otherwise. Consumers must call JsonToMessage to get an apitools Object. N)�source_storage_url�is_multi_source_request�!is_multi_top_level_source_request�names_container�expanded_storage_urlr � MessageToJson�expanded_result)�selfr r r r r r � r �#/opt/gsutil/gslib/name_expansion.py�__init__@ s ���zNameExpansionResult.__init__c C s d| j S )Nz%s)r �r r r r �__repr__Y s zNameExpansionResult.__repr__N)�__name__� __module__�__qualname__�__doc__r r r r r r r / s r c @ s* e Zd ZdZddd�Zdd� Zd d � ZdS )�_NameExpansionIteratorzlClass that iterates over all source URLs passed to the iterator. See details in __iter__ function doc. FTNc C st || _ || _|| _|| _|| _|| _|| _| j�� | j_|| _ | | _ | | _|| _|s^t dg�n|| _ddd�| _dS )a� Creates a NameExpansionIterator. Args: command_name: name of command being run. debug: Debug level to pass to underlying iterators (range 0..3). logger: logging.Logger object. gsutil_api: Cloud storage interface. Settable for testing/mocking. url_strs: PluralityCheckableIterator of URL strings needing expansion. recursion_requested: True if -r specified on command-line. If so, listings will be flattened so mapped-to results contain objects spanning subdirectories. all_versions: Bool indicating whether to iterate over all object versions. cmd_supports_recursion: Bool indicating whether this command supports a '-r' flag. Useful for printing helpful error messages. project_id: Project id to use for bucket retrieval. ignore_symlinks: If True, ignore symlinks during iteration. continue_on_error: If true, yield no-match exceptions encountered during iteration instead of raising them. bucket_listing_fields: Iterable fields to include in expanded results. Ex. ['name', 'acl']. Underyling iterator is responsible for converting these to list-style format ['items/name', 'items/acl']. If this is None, only the object name is included in the result. Examples of _NameExpansionIterator with recursion_requested=True: - Calling with one of the url_strs being 'gs://bucket' will enumerate all top-level objects, as will 'gs://bucket/' and 'gs://bucket/*'. - 'gs://bucket/**' will enumerate all objects in the bucket. - 'gs://bucket/abc' will enumerate either the single object abc or, if abc is a subdirectory, all objects under abc and any of its subdirectories. - 'gs://bucket/abc/**' will enumerate all objects under abc or any of its subdirectories. - 'file:///tmp' will enumerate all files under /tmp, as will 'file:///tmp/*' - 'file:///tmp/**' will enumerate all files under /tmp or any of its subdirectories. Example if recursion_requested=False: calling with gs://bucket/abc/* lists matching objects or subdirs, but not sub-subdirs or objects beneath subdirs. Note: In step-by-step comments below we give examples assuming there's a gs://bucket with object paths: abcd/o1.txt abcd/o2.txt xyz/o1.txt xyz/o2.txt and a directory file://dir with file paths: dir/a.txt dir/b.txt dir/c/ �namez**�*)TFN)�command_name�debug�logger� gsutil_api�url_strs�recursion_requested�all_versions�HasPlurality� has_plurality�cmd_supports_recursion� project_id�ignore_symlinks�continue_on_error�set�bucket_listing_fields�_flatness_wildcard) r r# r$ r% r&