Skip to content

Commit 8678f84

Browse files
authored
Merge pull request #190 from Kilo59/format
apply black/isort formatting/sorting
2 parents e4a1f9b + b884ffd commit 8678f84

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1154
-378
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ install:
77
- "pip install pipenv"
88
- "pipenv install --dev --skip-lock"
99
script:
10-
- "make test lint"
10+
- "make test lint check-fmt"

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,11 @@ test:
1919

2020
lint:
2121
pylint $(APP) || true
22+
23+
fmt:
24+
isort --apply --atomic
25+
black . -l 120
26+
27+
check-fmt:
28+
isort -rc --check
29+
black . --check --diff

Pipfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ verify_ssl = true
55

66
[dev-packages]
77
bandit = "*"
8+
black = "==19.10b0"
9+
isort = "*"
810
pytest = "*"
911
pylint = "*"
1012

@@ -25,3 +27,5 @@ python_version = "3.8"
2527
[scripts]
2628
dev = "uvicorn app.main:APP --reload"
2729
start = "uvicorn app.main:APP"
30+
fmt = "black . -l 120"
31+
sort = "isort --apply --atomic"

Pipfile.lock

Lines changed: 90 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Support multiple data-sources.
1313
[![GitHub last commit](https://img.shields.io/github/last-commit/ExpDev07/coronavirus-tracker-api)](https://github.com/ExpDev07/coronavirus-tracker-api/commits/master)
1414
[![GitHub pull requests](https://img.shields.io/github/issues-pr/ExpDev07/coronavirus-tracker-api)](https://github.com/ExpDev07/coronavirus-tracker-api/pulls)
1515
[![GitHub issues](https://img.shields.io/github/issues/ExpDev07/coronavirus-tracker-api)](https://github.com/ExpDev07/coronavirus-tracker-api/issues)
16+
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
1617
[![Tweet](https://img.shields.io/twitter/url?url=https%3A%2F%2Fgithub.com%2FExpDev07%2Fcoronavirus-tracker-api)](https://twitter.com/intent/tweet?text=COVID19%20Live%20Tracking%20API:%20&url=https%3A%2F%2Fgithub.com%2FExpDev07%2Fcoronavirus-tracker-api)
1718

1819
**Live global stats (provided by [fight-covid19/bagdes](https://github.com/fight-covid19/bagdes)) from this API:**

app/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# See PEP396.
2-
__version__ = '2.0'
2+
__version__ = "2.0"
33

44
from .core import create_app

app/config/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
# Load enviroment variables from .env file.
44
from dotenv import load_dotenv
5+
56
load_dotenv()
67

78
"""
89
The port to serve the app application on.
910
"""
10-
PORT = int(os.getenv('PORT', 5000))
11+
PORT = int(os.getenv("PORT", 5000))

app/coordinates.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ def serialize(self):
1414
:returns: The serialized coordinates.
1515
:rtype: dict
1616
"""
17-
return {
18-
'latitude' : self.latitude,
19-
'longitude': self.longitude
20-
}
17+
return {"latitude": self.latitude, "longitude": self.longitude}
2118

2219
def __str__(self):
23-
return 'lat: %s, long: %s' % (self.latitude, self.longitude)
20+
return "lat: %s, long: %s" % (self.latitude, self.longitude)

app/core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from flask import Flask
22
from flask_cors import CORS
33

4+
45
def create_app():
56
"""
67
Construct the core application.
@@ -10,7 +11,7 @@ def create_app():
1011
CORS(app)
1112

1213
# Set app config from settings.
13-
app.config.from_pyfile('config/settings.py');
14+
app.config.from_pyfile("config/settings.py")
1415

1516
with app.app_context():
1617
# Import routes.

app/data/__init__.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
from ..services.location.jhu import JhuLocationService
21
from ..services.location.csbs import CSBSLocationService
2+
from ..services.location.jhu import JhuLocationService
33

44
# Mapping of services to data-sources.
5-
data_sources = {
6-
'jhu': JhuLocationService(),
7-
'csbs': CSBSLocationService()
8-
}
5+
data_sources = {"jhu": JhuLocationService(), "csbs": CSBSLocationService()}
6+
97

108
def data_source(source):
119
"""
@@ -14,4 +12,4 @@ def data_source(source):
1412
:returns: The service.
1513
:rtype: LocationService
1614
"""
17-
return data_sources.get(source.lower())
15+
return data_sources.get(source.lower())

0 commit comments

Comments
 (0)