# 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
    def open_file_chunk_reader_from_fileobj(
        self,
        fileobj,
        chunk_size,
        full_file_size,
        callbacks,
        close_callbacks=None,
    ):
        return ReadFileChunk(
            fileobj,
            chunk_size,
            full_file_size,
            callbacks=callbacks,
            enable_callbacks=False,
            close_callbacks=close_callbacks,
        )

    def open(self, filename, mode):
        return open(filename, mode)

    def remove_file(self, filename):
        """Remove a file, noop if file does not exist."""
        # Unlike os.remove, if the file does not exist,
        # then this method does nothing.
        try:
            os.remove(filename)
        except OSError:
            pass

    def rename_file(self, current_filename, new_filename):

# 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

    def open_file_chunk_reader_from_fileobj(
        self,
        fileobj,
        chunk_size,
        full_file_size,
        callbacks,
        close_callbacks=None,
    ):
        return ReadFileChunk(
            fileobj,
            chunk_size,
            full_file_size,
            callbacks=callbacks,
            enable_callbacks=False,
            close_callbacks=close_callbacks,
        )

    def open(self, filename, mode):
        return open(filename, mode)

    def remove_file(self, filename):
        """Remove a file, noop if file does not exist."""
        # Unlike os.remove, if the file does not exist,
        # then this method does nothing.
        try:
            os.remove(filename)
        except OSError:
            pass

    def rename_file(self, current_filename, new_filename):

        rename_file(current_filename, new_filename)