Skip to content

Commit a3a8702

Browse files
committed
Blacken support files
1 parent a389051 commit a3a8702

File tree

3 files changed

+455
-311
lines changed

3 files changed

+455
-311
lines changed

bench.py

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@
1515

1616
# fetch some images from NASA to bag up
1717

18-
if not os.path.isdir('bench-data'):
18+
if not os.path.isdir("bench-data"):
1919
print("fetching some images to bag up from nasa")
20-
os.mkdir('bench-data')
21-
ftp = ftplib.FTP('nssdcftp.gsfc.nasa.gov')
20+
os.mkdir("bench-data")
21+
ftp = ftplib.FTP("nssdcftp.gsfc.nasa.gov")
2222
ftp.login()
2323

24-
ftp.cwd('/pub/misc/photo_gallery/hi-res/planetary/mars/')
24+
ftp.cwd("/pub/misc/photo_gallery/hi-res/planetary/mars/")
2525
files = []
26-
ftp.retrlines('NLST', files.append)
26+
ftp.retrlines("NLST", files.append)
2727

2828
for file in files:
2929
print(("fetching %s" % file))
30-
fh = open(os.path.join('bench-data', file), 'wb')
31-
ftp.retrbinary('RETR %s' % file, fh.write)
30+
fh = open(os.path.join("bench-data", file), "wb")
31+
ftp.retrbinary("RETR %s" % file, fh.write)
3232
fh.close()
3333

3434

@@ -48,13 +48,15 @@
4848

4949
for p in range(1, 9):
5050
t = timeit.Timer(statement % p)
51-
print(("create w/ %s processes: %.2f seconds " % (p, (10 * t.timeit(number=10) / 10))))
51+
print(
52+
("create w/ %s processes: %.2f seconds " % (p, (10 * t.timeit(number=10) / 10)))
53+
)
5254

5355

5456
# validate a bag with 1-8 processes
5557

56-
shutil.copytree('bench-data', 'bench-data-bag')
57-
bagit.make_bag('bench-data-bag')
58+
shutil.copytree("bench-data", "bench-data-bag")
59+
bagit.make_bag("bench-data-bag")
5860

5961
# validate bench-data using n processes
6062
statement = """
@@ -68,6 +70,11 @@
6870
# try 1-8 parallel processes
6971
for p in range(1, 9):
7072
t = timeit.Timer(statement % p)
71-
print(("validate w/ %s processes: %.2f seconds " % (p, (10 * t.timeit(number=10) / 10))))
72-
73-
shutil.rmtree('bench-data-bag')
73+
print(
74+
(
75+
"validate w/ %s processes: %.2f seconds "
76+
% (p, (10 * t.timeit(number=10) / 10))
77+
)
78+
)
79+
80+
shutil.rmtree("bench-data-bag")

setup.py

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,68 +7,74 @@
77
import os
88
import subprocess
99
import sys
10-
from setuptools import setup
1110
from codecs import open
1211

12+
from setuptools import setup
13+
1314
if sys.version_info < (2, 7):
1415
print("Python 2.7 or higher is required")
1516
sys.exit(1)
1617

17-
description = 'Create and validate BagIt packages'
18+
description = "Create and validate BagIt packages"
1819

1920
with open("README.rst", encoding="utf-8") as readme:
2021
long_description = readme.read()
2122

22-
tests_require = ['mock', 'coverage']
23+
tests_require = ["mock", "coverage"]
2324

2425

2526
def get_message_catalogs():
2627
message_catalogs = []
2728

28-
for po_file in glob.glob('locale/*/LC_MESSAGES/bagit-python.po'):
29-
mo_file = po_file.replace('.po', '.mo')
29+
for po_file in glob.glob("locale/*/LC_MESSAGES/bagit-python.po"):
30+
mo_file = po_file.replace(".po", ".mo")
3031

31-
if not os.path.exists(mo_file) or os.path.getmtime(mo_file) < os.path.getmtime(po_file):
32+
if not os.path.exists(mo_file) or os.path.getmtime(mo_file) < os.path.getmtime(
33+
po_file
34+
):
3235
try:
33-
subprocess.check_call(['msgfmt', '-o', mo_file, po_file])
36+
subprocess.check_call(["msgfmt", "-o", mo_file, po_file])
3437
except (OSError, subprocess.CalledProcessError) as exc:
35-
print("Translation catalog %s could not be compiled (is gettext installed?) "
36-
" — translations will not be available for this language: %s" % (po_file, exc),
37-
file=sys.stderr)
38+
print(
39+
"Translation catalog %s could not be compiled (is gettext installed?) "
40+
" — translations will not be available for this language: %s"
41+
% (po_file, exc),
42+
file=sys.stderr,
43+
)
3844
continue
3945

40-
message_catalogs.append((os.path.dirname(mo_file), (mo_file, )))
46+
message_catalogs.append((os.path.dirname(mo_file), (mo_file,)))
4147

4248
return message_catalogs
4349

4450

4551
setup(
46-
name='bagit',
52+
name="bagit",
4753
use_scm_version=True,
48-
url='https://libraryofcongress.github.io/bagit-python/',
49-
author='Ed Summers',
50-
author_email='[email protected]',
51-
py_modules=['bagit', ],
52-
scripts=['bagit.py'],
54+
url="https://libraryofcongress.github.io/bagit-python/",
55+
author="Ed Summers",
56+
author_email="[email protected]",
57+
py_modules=["bagit"],
58+
scripts=["bagit.py"],
5359
data_files=get_message_catalogs(),
5460
description=description,
5561
long_description=long_description,
56-
platforms=['POSIX'],
57-
test_suite='test',
58-
setup_requires=['setuptools_scm'],
62+
platforms=["POSIX"],
63+
test_suite="test",
64+
setup_requires=["setuptools_scm"],
5965
tests_require=tests_require,
6066
classifiers=[
61-
'License :: Public Domain',
62-
'Intended Audience :: Developers',
63-
'Topic :: Communications :: File Sharing',
64-
'Topic :: Software Development :: Libraries :: Python Modules',
65-
'Topic :: System :: Filesystems',
66-
'Programming Language :: Python :: 2.7',
67-
'Programming Language :: Python :: 3.1',
68-
'Programming Language :: Python :: 3.2',
69-
'Programming Language :: Python :: 3.3',
70-
'Programming Language :: Python :: 3.4',
71-
'Programming Language :: Python :: 3.5',
72-
'Programming Language :: Python :: 3.6',
67+
"License :: Public Domain",
68+
"Intended Audience :: Developers",
69+
"Topic :: Communications :: File Sharing",
70+
"Topic :: Software Development :: Libraries :: Python Modules",
71+
"Topic :: System :: Filesystems",
72+
"Programming Language :: Python :: 2.7",
73+
"Programming Language :: Python :: 3.1",
74+
"Programming Language :: Python :: 3.2",
75+
"Programming Language :: Python :: 3.3",
76+
"Programming Language :: Python :: 3.4",
77+
"Programming Language :: Python :: 3.5",
78+
"Programming Language :: Python :: 3.6",
7379
],
7480
)

0 commit comments

Comments
 (0)