__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
# Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
from functools import lru_cache
from s3transfer.compat import accepts_kwargs
from s3transfer.exceptions import InvalidSubscriberMethodError
class BaseSubscriber:
"""The base subscriber class
It is recommended that all subscriber implementations subclass and then
override the subscription methods (i.e. on_{subsribe_type}() methods).
"""
VALID_SUBSCRIBER_TYPES = ['queued', 'progress', 'done']
def __new__(cls, *args, **kwargs):
cls._validate_subscriber_methods()
return super().__new__(cls)
@classmethod
@lru_cache()
def _validate_subscriber_methods(cls):
for subscriber_type in cls.VALID_SUBSCRIBER_TYPES:
subscriber_method = getattr(cls, 'on_' + subscriber_type)
if not callable(subscriber_method):
raise InvalidSubscriberMethodError(
'Subscriber method %s must be callable.'
% subscriber_method
)
if not accepts_kwargs(subscriber_method):
raise InvalidSubscriberMethodError(
'Subscriber method %s must accept keyword '
'arguments (**kwargs)' % subscriber_method
)
def on_queued(self, future, **kwargs):
"""Callback to be invoked when transfer request gets queued
This callback can be useful for:
* Keeping track of how many transfers have been requested
* Providing the expected transfer size through
future.meta.provide_transfer_size() so a HeadObject would not
need to be made for copies and downloads.
:type future: s3transfer.futures.TransferFuture
:param future: The TransferFuture representing the requested transfer.
"""
pass
def on_progress(self, future, bytes_transferred, **kwargs):
"""Callback to be invoked when progress is made on transfer
This callback can be useful for:
* Recording and displaying progress
:type future: s3transfer.futures.TransferFuture
:param future: The TransferFuture representing the requested transfer.
:type bytes_transferred: int
:param bytes_transferred: The number of bytes transferred for that
invocation of the callback. Note that a negative amount can be
provided, which usually indicates that an in-progress request
needed to be retried and thus progress was rewound.
"""
pass
def on_done(self, future, **kwargs):
"""Callback to be invoked once a transfer is done
This callback can be useful for:
* Recording and displaying whether the transfer succeeded or
failed using future.result()
* Running some task after the transfer completed like changing
the last modified time of a downloaded file.
:type future: s3transfer.futures.TransferFuture
:param future: The TransferFuture representing the requested transfer.
"""
pass
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| __init__.py | File | 28.38 KB | 0644 |
|
| bandwidth.py | File | 15.27 KB | 0644 |
|
| compat.py | File | 2.87 KB | 0644 |
|
| constants.py | File | 910 B | 0644 |
|
| copies.py | File | 14.13 KB | 0644 |
|
| crt.py | File | 30.44 KB | 0644 |
|
| delete.py | File | 2.5 KB | 0644 |
|
| download.py | File | 27.44 KB | 0644 |
|
| exceptions.py | File | 1.04 KB | 0644 |
|
| futures.py | File | 20.66 KB | 0644 |
|
| manager.py | File | 27.84 KB | 0644 |
|
| processpool.py | File | 35.42 KB | 0644 |
|
| subscribers.py | File | 3.53 KB | 0644 |
|
| tasks.py | File | 15.81 KB | 0644 |
|
| upload.py | File | 29.79 KB | 0644 |
|
| utils.py | File | 27.13 KB | 0644 |
|