Skip to content

Commit 6ba8cbc

Browse files
authored
Merge pull request codecov#260 from codecov/black-linting
Black code formatting
2 parents 5302d5f + 098c82b commit 6ba8cbc

File tree

8 files changed

+47
-33
lines changed

8 files changed

+47
-33
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ matrix:
2626
- python-mock
2727
- python: 3.7
2828
dist: xenial
29+
script: make format
2930

3031
install:
3132
- pip install -r tests/requirements.txt

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ reinstall:
1111
test:
1212
py.test tests/test.py
1313

14+
format:
15+
black . --check
16+
1417
compare:
1518
hub compare $(shell git tag --sort=refname | tail -1)...master
1619

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Codecov Global Python Uploader ![PyPI](https://img.shields.io/pypi/v/codecov) [![codecov.io](https://codecov.io/github/codecov/codecov-python/coverage.svg?branch=master)](https://codecov.io/github/codecov/codecov-python)
1+
Codecov Global Python Uploader ![PyPI](https://img.shields.io/pypi/v/codecov) [![codecov.io](https://codecov.io/github/codecov/codecov-python/coverage.svg?branch=master)](https://codecov.io/github/codecov/codecov-python) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
22
=======
33
| [https://codecov.io/][1] | [@codecov][2] | [hello@codecov.io][3] |
44
| ------------------------ | ------------- | --------------------- |

codecov/__init__.py

+21-14
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
logging.captureWarnings(True)
4141

4242

43-
version=__version__
43+
version = __version__
4444

4545
COLOR = True
4646

@@ -902,17 +902,24 @@ def main(*argv, **kwargs):
902902
write("XX> Skip processing gcov")
903903

904904
else:
905-
dont_search_here = [
906-
"bower_components"
907-
"node_modules"
908-
"vendor"
909-
]
905+
dont_search_here = ["bower_components" "node_modules" "vendor"]
910906
if codecov.gcov_glob:
911907
dont_search_here.append(codecov.gcov_glob)
912908

913909
write("==> Processing gcov (disable by -X gcov)")
914-
for path in find_files(sanitize_arg("", codecov.gcov_root or root), "*.gcno", True, dont_search_here):
915-
cmd = sanitize_arg("", codecov.gcov_exec or "") + " -pb " + sanitize_arg("", codecov.gcov_args or "") + " " + path
910+
for path in find_files(
911+
sanitize_arg("", codecov.gcov_root or root),
912+
"*.gcno",
913+
True,
914+
dont_search_here,
915+
):
916+
cmd = (
917+
sanitize_arg("", codecov.gcov_exec or "")
918+
+ " -pb "
919+
+ sanitize_arg("", codecov.gcov_args or "")
920+
+ " "
921+
+ path
922+
)
916923
write(" Executing gcov (%s)" % cmd)
917924
write(try_to_run(cmd))
918925

@@ -1056,8 +1063,8 @@ def main(*argv, **kwargs):
10561063
headers={
10571064
"Accept": "text/plain",
10581065
"X-Reduced-Redundancy": "false",
1059-
"X-Content-Type": "application/x-gzip"
1060-
}
1066+
"X-Content-Type": "application/x-gzip",
1067+
},
10611068
)
10621069
if res.status_code in (400, 406):
10631070
raise Exception(res.text)
@@ -1073,8 +1080,8 @@ def main(*argv, **kwargs):
10731080
data=reports_gzip,
10741081
headers={
10751082
"Content-Type": "application/x-gzip",
1076-
"Content-Encoding": "gzip"
1077-
}
1083+
"Content-Encoding": "gzip",
1084+
},
10781085
)
10791086
s3.raise_for_status()
10801087
assert s3.status_code == 200
@@ -1096,8 +1103,8 @@ def main(*argv, **kwargs):
10961103
headers={
10971104
"Accept": "text/plain",
10981105
"Content-Type": "application/x-gzip",
1099-
"Content-Encoding": "gzip"
1100-
}
1106+
"Content-Encoding": "gzip",
1107+
},
11011108
)
11021109
if res.status_code < 500:
11031110
write(" " + res.text)

codecov/__version__.py

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
__author__ = 'Codecov'
2-
__author_email__ = 'support@codecov.io'
3-
__copyright__ = 'Copyright 2020 Codecov'
4-
__description__ = 'Hosted coverage reports for GitHub, Bitbucket and Gitlab'
5-
__license__ = 'Apache 2.0'
6-
__title__ = 'codecov'
7-
__url__ = 'https://github.com/codecov/codecov-python'
8-
__version__ = '2.1.3'
9-
1+
__author__ = "Codecov"
2+
__author_email__ = "support@codecov.io"
3+
__copyright__ = "Copyright 2020 Codecov"
4+
__description__ = "Hosted coverage reports for GitHub, Bitbucket and Gitlab"
5+
__license__ = "Apache 2.0"
6+
__title__ = "codecov"
7+
__url__ = "https://github.com/codecov/codecov-python"
8+
__version__ = "2.1.3"

setup.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,20 @@
2323
filepath = os.path.abspath(os.path.dirname(__file__))
2424

2525
about = {}
26-
with open(os.path.join(filepath, 'codecov', '__version__.py'), 'r', 'utf-8') as f:
26+
with open(os.path.join(filepath, "codecov", "__version__.py"), "r", "utf-8") as f:
2727
exec(f.read(), about)
2828

2929
setup(
30-
name=about['__title__'],
31-
version=about['__version__'],
32-
description=about['__description__'],
30+
name=about["__title__"],
31+
version=about["__version__"],
32+
description=about["__description__"],
3333
long_description=None,
3434
classifiers=classifiers,
3535
keywords="coverage codecov code python java scala php",
36-
author=about['__author__'],
37-
author_email=about['__author_email__'],
38-
url=about['__url__'],
39-
license=about['__license__'],
36+
author=about["__author__"],
37+
author_email=about["__author_email__"],
38+
url=about["__url__"],
39+
license=about["__license__"],
4040
packages=["codecov"],
4141
include_package_data=True,
4242
zip_safe=True,

tests/requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ pytest>=3.6.0
55
pytest-cov
66
funcsigs
77
requests
8+
black ; python_version >= '3.7'

tests/test.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,10 @@ def test_send(self):
269269
assert "token=%3Ctoken%3E" in post.call_args[0][0]
270270
assert "branch=master" in post.call_args[0][0]
271271
gzip_worker = zlib.decompressobj(zlib.MAX_WBITS | 16)
272-
reports = gzip_worker.decompress(put.call_args[1]["data"]) + gzip_worker.flush()
272+
reports = (
273+
gzip_worker.decompress(put.call_args[1]["data"])
274+
+ gzip_worker.flush()
275+
)
273276
assert u"tests/test.py".encode("utf-8") in reports
274277

275278
def test_send_error(self):

0 commit comments

Comments
 (0)