# Path: s3transfer/compat.py
# SOCKET_ERROR = ConnectionError
# 
# def fallocate(fileobj, size):
#     if hasattr(os, 'posix_fallocate'):
#         os.posix_fallocate(fileobj.fileno(), 0, size)
#     else:
#         fileobj.truncate(size)
# 
# def rename_file(current_filename, new_filename):
#     try:
#         os.remove(new_filename)
#     except OSError as e:
#         if not e.errno == errno.ENOENT:
#             # We only want to a ignore trying to remove
#             # a file that does not exist.  If it fails
#             # for any other reason we should be propagating
#             # that exception.
#             raise
#     os.rename(current_filename, new_filename)


import functools
import logging
import math
import os
import random
import socket
import stat
import string
import threading
from collections import defaultdict
from botocore.exceptions import IncompleteReadError, ReadTimeoutError
from s3transfer.compat import SOCKET_ERROR, fallocate, rename_file
# 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.



MAX_PARTS = 10000
# The maximum file size you can upload via S3 per request.
# See: http://docs.aws.amazon.com/AmazonS3/latest/dev/UploadingObjects.html
# and: http://docs.aws.amazon.com/AmazonS3/latest/dev/qfacts.html
MAX_SINGLE_UPLOAD_SIZE = 5 * (1024 ** 3)
MIN_UPLOAD_CHUNKSIZE = 5 * (1024 ** 2)
logger = logging.getLogger(__name__)


S3_RETRYABLE_DOWNLOAD_ERRORS = (

# Path: s3transfer/compat.py
# SOCKET_ERROR = ConnectionError
# 
# def fallocate(fileobj, size):
#     if hasattr(os, 'posix_fallocate'):
#         os.posix_fallocate(fileobj.fileno(), 0, size)
#     else:
#         fileobj.truncate(size)
# 
# def rename_file(current_filename, new_filename):
#     try:
#         os.remove(new_filename)
#     except OSError as e:
#         if not e.errno == errno.ENOENT:
#             # We only want to a ignore trying to remove
#             # a file that does not exist.  If it fails
#             # for any other reason we should be propagating
#             # that exception.
#             raise
#     os.rename(current_filename, new_filename)


# Path: s3transfer/utils.py
import functools
import logging
import math
import os
import random
import socket
import stat
import string
import threading
from collections import defaultdict
from botocore.exceptions import IncompleteReadError, ReadTimeoutError
from s3transfer.compat import SOCKET_ERROR, fallocate, rename_file

# 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.



MAX_PARTS = 10000
# The maximum file size you can upload via S3 per request.
# See: http://docs.aws.amazon.com/AmazonS3/latest/dev/UploadingObjects.html
# and: http://docs.aws.amazon.com/AmazonS3/latest/dev/qfacts.html
MAX_SINGLE_UPLOAD_SIZE = 5 * (1024 ** 3)
MIN_UPLOAD_CHUNKSIZE = 5 * (1024 ** 2)
logger = logging.getLogger(__name__)


S3_RETRYABLE_DOWNLOAD_ERRORS = (

    socket.timeout,