MCPcopy Create free account
hub / github.com/aws/aws-cli / __init__

Method __init__

awscli/s3transfer/bandwidth.py:100–133  ·  view source on GitHub ↗

Limits bandwidth for reads on a wrapped stream :type fileobj: file-like object :param fileobj: The file like object to wrap :type leaky_bucket: LeakyBucket :param leaky_bucket: The leaky bucket to use to throttle reads on the stream :type transf

(
        self,
        fileobj,
        leaky_bucket,
        transfer_coordinator,
        time_utils=None,
        bytes_threshold=256 * 1024,
    )

Source from the content-addressed store, hash-verified

98
99class BandwidthLimitedStream:
100 def __init__(
101 self,
102 fileobj,
103 leaky_bucket,
104 transfer_coordinator,
105 time_utils=None,
106 bytes_threshold=256 * 1024,
107 ):
108 """Limits bandwidth for reads on a wrapped stream
109
110 :type fileobj: file-like object
111 :param fileobj: The file like object to wrap
112
113 :type leaky_bucket: LeakyBucket
114 :param leaky_bucket: The leaky bucket to use to throttle reads on
115 the stream
116
117 :type transfer_coordinator: s3transfer.futures.TransferCoordinator
118 param transfer_coordinator: The coordinator for the general transfer
119 that the wrapped stream is a part of
120
121 :type time_utils: TimeUtils
122 :param time_utils: The time utility to use for interacting with time
123 """
124 self._fileobj = fileobj
125 self._leaky_bucket = leaky_bucket
126 self._transfer_coordinator = transfer_coordinator
127 self._time_utils = time_utils
128 if time_utils is None:
129 self._time_utils = TimeUtils()
130 self._bandwidth_limiting_enabled = True
131 self._request_token = RequestToken()
132 self._bytes_seen = 0
133 self._bytes_threshold = bytes_threshold
134
135 def enable_bandwidth_limiting(self):
136 """Enable bandwidth limiting on reads to the stream"""

Callers

nothing calls this directly

Calls 2

TimeUtilsClass · 0.85
RequestTokenClass · 0.85

Tested by

no test coverage detected