Skip to content

Commit

Permalink
Upgrade black to stable release (22.1.0) (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
nateprewitt authored Mar 10, 2022
1 parent c5307a7 commit 93fb7d1
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repos:
hooks:
- id: isort
- repo: 'https://github.com/psf/black'
rev: 21.7b0
rev: 22.1.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
Expand Down
2 changes: 1 addition & 1 deletion s3transfer/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ def _main(
UploadId=upload_id,
PartNumber=part_number,
Body=body,
**extra_args
**extra_args,
)
etag = response['ETag']
part_metadata = {'ETag': etag, 'PartNumber': part_number}
Expand Down
4 changes: 2 additions & 2 deletions s3transfer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
# 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)
MAX_SINGLE_UPLOAD_SIZE = 5 * (1024**3)
MIN_UPLOAD_CHUNKSIZE = 5 * (1024**2)
logger = logging.getLogger(__name__)


Expand Down
12 changes: 6 additions & 6 deletions scripts/performance/benchmark-download
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ TEMP_KEY = 'temp'
KB = 1024
SIZE_SUFFIX = {
'kb': 1024,
'mb': 1024 ** 2,
'gb': 1024 ** 3,
'tb': 1024 ** 4,
'mb': 1024**2,
'gb': 1024**3,
'tb': 1024**4,
'kib': 1024,
'mib': 1024 ** 2,
'gib': 1024 ** 3,
'tib': 1024 ** 4,
'mib': 1024**2,
'gib': 1024**3,
'tib': 1024**4,
}


Expand Down
12 changes: 6 additions & 6 deletions scripts/performance/benchmark-upload
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ TEMP_KEY = 'temp'
KB = 1024
SIZE_SUFFIX = {
'kb': 1024,
'mb': 1024 ** 2,
'gb': 1024 ** 3,
'tb': 1024 ** 4,
'mb': 1024**2,
'gb': 1024**3,
'tb': 1024**4,
'kib': 1024,
'mib': 1024 ** 2,
'gib': 1024 ** 3,
'tib': 1024 ** 4,
'mib': 1024**2,
'gib': 1024**3,
'tib': 1024**4,
}


Expand Down
2 changes: 1 addition & 1 deletion scripts/performance/summarize
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class Summarizer:
def _standard_deviation_across_all_files(self, name):
mean = self._average_across_all_files(name)
differences = [total - mean for total in self._totals[name]]
sq_differences = [difference ** 2 for difference in differences]
sq_differences = [difference**2 for difference in differences]
return sqrt(sum(sq_differences) / len(self._totals[name]))

def summarize_as_table(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ def setUp(self):
self.stream = BytesIO(self.content)
self.fileobj = WriteCollector()
self.osutil = OSUtils()
self.io_chunksize = 64 * (1024 ** 2)
self.io_chunksize = 64 * (1024**2)
self.task_cls = GetObjectTask
self.download_output_manager = DownloadSeekableOutputManager(
self.osutil, self.transfer_coordinator, self.io_executor
Expand Down
12 changes: 6 additions & 6 deletions tests/unit/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1146,8 +1146,8 @@ def setUp(self):
self.adjuster = ChunksizeAdjuster()

def test_valid_chunksize(self):
chunksize = 7 * (1024 ** 2)
file_size = 8 * (1024 ** 2)
chunksize = 7 * (1024**2)
file_size = 8 * (1024**2)
new_size = self.adjuster.adjust_chunksize(chunksize, file_size)
self.assertEqual(new_size, chunksize)

Expand All @@ -1164,17 +1164,17 @@ def test_chunksize_above_maximum(self):
self.assertEqual(new_size, MAX_SINGLE_UPLOAD_SIZE)

def test_chunksize_too_small(self):
chunksize = 7 * (1024 ** 2)
file_size = 5 * (1024 ** 4)
chunksize = 7 * (1024**2)
file_size = 5 * (1024**4)
# If we try to upload a 5TB file, we'll need to use 896MB part
# sizes.
new_size = self.adjuster.adjust_chunksize(chunksize, file_size)
self.assertEqual(new_size, 896 * (1024 ** 2))
self.assertEqual(new_size, 896 * (1024**2))
num_parts = file_size / new_size
self.assertLessEqual(num_parts, MAX_PARTS)

def test_unknown_file_size_with_valid_chunksize(self):
chunksize = 7 * (1024 ** 2)
chunksize = 7 * (1024**2)
new_size = self.adjuster.adjust_chunksize(chunksize)
self.assertEqual(new_size, chunksize)

Expand Down

0 comments on commit 93fb7d1

Please sign in to comment.