Skip to content

Commit db3b127

Browse files
author
Alvaro Farias
committed
✏️ apply Black code formatter
1 parent aef8d39 commit db3b127

File tree

3 files changed

+22
-27
lines changed

3 files changed

+22
-27
lines changed

app/__init__.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,17 @@ def create_app() -> Flask:
2222
app = Flask(__name__)
2323

2424
app.config.from_mapping(
25-
ENV=config['env'],
26-
DEBUG=config['debug'],
27-
SECRET_KEY=config['key']
25+
ENV=config["env"], DEBUG=config["debug"], SECRET_KEY=config["key"]
2826
)
2927

30-
CORS(app, origins=config['origins'])
28+
CORS(app, origins=config["origins"])
3129

3230
# Initialize Extensions
3331
api.init_app(app)
3432

3533
with app.app_context():
3634
# Register resources
37-
api.add_resource(PredictionController, '/prediction')
35+
api.add_resource(PredictionController, "/prediction")
3836

3937
return app
4038

config/application.py

+15-16
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22
from pathlib import Path
33
from dotenv import load_dotenv
44

5-
base_path = Path('.') # Fully qualified path to the project root
6-
env_path = base_path / '.env' # Fully qualified path to the enviroment file
7-
app_path = base_path.joinpath('app') # The fully qualified path to the app folder
8-
public_path = base_path.joinpath('public') # The fully qualified path to the public folder
9-
storage_path = base_path.joinpath('storage') # The fully qualified path to the storage folder
5+
base_path = Path(".") # Fully qualified path to the project root
6+
env_path = base_path / ".env" # Fully qualified path to the enviroment file
7+
app_path = base_path.joinpath("app") # The fully qualified path to the app folder
8+
public_path = base_path.joinpath(
9+
"public"
10+
) # The fully qualified path to the public folder
11+
storage_path = base_path.joinpath(
12+
"storage"
13+
) # The fully qualified path to the storage folder
1014

1115
load_dotenv(dotenv_path=env_path)
1216

@@ -18,49 +22,44 @@
1822
# This value is the name of your application. This value is used when the
1923
# framework needs to place the application's name in a notification or
2024
# any other location as required by the application or its packages.
21-
'name': getenv('APP_NAME', None),
22-
25+
"name": getenv("APP_NAME", None),
2326
# --------------------------------------------------------------------------
2427
# Application Environment
2528
# --------------------------------------------------------------------------
2629
#
2730
# This value determines the "environment" your application is currently
2831
# running in. This may determine how you prefer to configure various
2932
# services the application utilizes. Set this in your ".env" file.
30-
'env': getenv('APP_ENV', 'production'),
31-
33+
"env": getenv("APP_ENV", "production"),
3234
# --------------------------------------------------------------------------
3335
# Application URL
3436
# --------------------------------------------------------------------------
3537
#
3638
# This URL is used by the console to properly generate URLs when using
3739
# the Artisan command line tool. You should set this to the root of
3840
# your application so that it is used when running Artisan tasks.
39-
'url': getenv('APP_URL', 'http://localhost'),
40-
41+
"url": getenv("APP_URL", "http://localhost"),
4142
# --------------------------------------------------------------------------
4243
# Application Debug Mode
4344
# --------------------------------------------------------------------------
4445
#
4546
# When your application is in debug mode, detailed error messages with
4647
# stack traces will be shown on every error that occurs within your
4748
# application. If disabled, a simple generic error page is shown.
48-
'debug': getenv('APP_DEBUG', False),
49-
49+
"debug": getenv("APP_DEBUG", False),
5050
# --------------------------------------------------------------------------
5151
# Encryption Key
5252
# --------------------------------------------------------------------------
5353
#
5454
# This key is used by the encrypter service and should be set
5555
# to a random, 32 character string, otherwise these encrypted strings
5656
# will not be safe. Please do this before deploying an application!
57-
'key': getenv('APP_KEY', None),
58-
57+
"key": getenv("APP_KEY", None),
5958
# --------------------------------------------------------------------------
6059
# Cross-Origin Resource Sharing (CORS)
6160
# --------------------------------------------------------------------------
6261
#
6362
# The origin, or list of origins to allow requests from. The origin(s) may be
6463
# regular expressions, case-sensitive strings, or else an asterisk
65-
'origins': getenv('CORS_DOMAINS', '*')
64+
"origins": getenv("CORS_DOMAINS", "*"),
6665
}

tests/test_app.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@
44

55

66
def test_version():
7-
assert __version__ == '0.1.0'
7+
assert __version__ == "0.1.0"
88

99

1010
def test_request_headers(client):
11-
headers = {
12-
'Content-Type': 'application/json'
13-
}
11+
headers = {"Content-Type": "application/json"}
1412

15-
client.post(config['url'], headers=headers)
13+
client.post(config["url"], headers=headers)
1614

17-
assert request.headers['Content-Type'] == 'application/json'
15+
assert request.headers["Content-Type"] == "application/json"

0 commit comments

Comments
 (0)