CURRENT PATH:
/
opt
/
gsutil
/
gslib
/
__pycache__
/
[ ⬅ KEMBALI ]
|
[ HOME ]
Upload File:
Upload Ke Sini
Dir Baru
File Baru
Editing:
tracker_file.cpython-39.pyc
a +(Wg�` � @ s� d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlZddlZddlZddl Z ddl Z ddlZddlZddl mZ ddlmZ dd lmZ dd lmZ ddlmZ ddlmZ dd lmZ dZdZdZdZG dd� de�Zdd� Z dd� Z!dd� Z"d8dd�Z#dd� Z$d9dd�Z%d d!� Z&d"d#� Z'd:d$d%�Z(d&d'� Z)d(d)� Z*d;d*d+�Z+d<d,d-�Z,d.d/� Z-d0d1� Z.d2d3� Z/d=d4d5�Z0d6d7� Z1dS )>z0Helper functions for tracker file functionality.� )�absolute_import)�print_function)�division)�unicode_literalsN)�config)�CommandException)�GetGsutilStateDir)�ResumableThreshold)�UTF8)�GetMd5)�CreateDirIfNeeded�d zCouldn't write tracker file (%s): %s. This can happen if gsutil is configured to save tracker files to an unwritable directory)�encryption_key_sha256�serialization_datac @ s$ e Zd ZdZdZdZdZdZdZdS )�TrackerFileType�upload�downloadZdownload_componentZparallel_uploadZsliced_download�rewriteN) �__name__� __module__�__qualname__�UPLOAD�DOWNLOAD�DOWNLOAD_COMPONENT�PARALLEL_UPLOAD�SLICED_DOWNLOAD�REWRITE� r r �!/opt/gsutil/gslib/tracker_file.pyr 4 s r c C sP t | tj�r| �t�}| }n| }| �t�}t�|�}d|�� d |dd� S )a" Apply a hash function (SHA1) to shorten the passed file name. The spec for the hashed file name is as follows: TRACKER_<hash>_<trailing> where hash is a SHA1 hash on the original file name and trailing is the last 16 chars from the original file name. Max file name lengths vary by operating system so the goal of this function is to ensure the hashed version takes fewer than 100 characters. Args: filename: file name to be hashed. May be unicode or bytes. Returns: shorter, hashed version of passed file name ZTRACKER_�.i�N) � isinstance�six� text_type�encoder �decode�hashlib�sha1� hexdigest)�filename�filename_bytesZfilename_str�mr r r � _HashFilename= s r+ c C s&