Skip to content

Commit 1c9627c

Browse files
committed
fix: black formatting
1 parent a017c3c commit 1c9627c

23 files changed

+1263
-267
lines changed

doc/conf.py

+12-8
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
master_doc = "index"
5252

5353
# General information about the project.
54-
project = u"Flask-RESTX"
55-
copyright = u"2020, python-restx Authors"
54+
project = "Flask-RESTX"
55+
copyright = "2020, python-restx Authors"
5656

5757
# The version info for the project you're documenting, acts as replacement for
5858
# |version| and |release|, also used in various other places throughout the
@@ -124,7 +124,11 @@
124124
"show_related": True,
125125
"page_width": "1000px",
126126
"sidebar_width": "260px",
127-
"favicons": {64: "favicon-64.png", 128: "favicon-128.png", 196: "favicon-196.png",},
127+
"favicons": {
128+
64: "favicon-64.png",
129+
128: "favicon-128.png",
130+
196: "favicon-196.png",
131+
},
128132
"badges": [
129133
(
130134
# Gitter.im
@@ -262,8 +266,8 @@
262266
(
263267
"index",
264268
"Flask-RESTX.tex",
265-
u"Flask-RESTX Documentation",
266-
u"python-restx Authors",
269+
"Flask-RESTX Documentation",
270+
"python-restx Authors",
267271
"manual",
268272
),
269273
]
@@ -294,7 +298,7 @@
294298
# One entry per manual page. List of tuples
295299
# (source start file, name, description, authors, manual section).
296300
man_pages = [
297-
("index", "flask-restx", u"Flask-RESTX Documentation", [u"python-restx Authors"], 1)
301+
("index", "flask-restx", "Flask-RESTX Documentation", ["python-restx Authors"], 1)
298302
]
299303

300304
# If true, show URL addresses after external links.
@@ -310,8 +314,8 @@
310314
(
311315
"index",
312316
"Flask-RESTX",
313-
u"Flask-RESTX Documentation",
314-
u"python-restx Authors",
317+
"Flask-RESTX Documentation",
318+
"python-restx Authors",
315319
"Flask-RESTX",
316320
"One line description of project.",
317321
"Miscellaneous",

examples/todo.py

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

55
app = Flask(__name__)
66
app.wsgi_app = ProxyFix(app.wsgi_app)
7-
api = Api(app, version="1.0", title="Todo API", description="A simple TODO API",)
7+
api = Api(
8+
app,
9+
version="1.0",
10+
title="Todo API",
11+
description="A simple TODO API",
12+
)
813

914
ns = api.namespace("todos", description="TODO operations")
1015

examples/todo_blueprint.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33

44
api_v1 = Blueprint("api", __name__, url_prefix="/api/1")
55

6-
api = Api(api_v1, version="1.0", title="Todo API", description="A simple TODO API",)
6+
api = Api(
7+
api_v1,
8+
version="1.0",
9+
title="Todo API",
10+
description="A simple TODO API",
11+
)
712

813
ns = api.namespace("todos", description="TODO operations")
914

examples/todomvc.py

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

55
app = Flask(__name__)
66
app.wsgi_app = ProxyFix(app.wsgi_app)
7-
api = Api(app, version="1.0", title="TodoMVC API", description="A simple TodoMVC API",)
7+
api = Api(
8+
app,
9+
version="1.0",
10+
title="TodoMVC API",
11+
description="A simple TodoMVC API",
12+
)
813

914
ns = api.namespace("todos", description="TODO operations")
1015

examples/xml_representation.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ def output_xml(data, code, headers=None):
2121
@api.route("/<string:entry>")
2222
class Hello(Resource):
2323
"""
24-
# you need requests
25-
>>> from requests import get
26-
>>> get('http://localhost:5000/me').content # default_mediatype
27-
'<?xml version="1.0" ?><response><hello>me</hello></response>'
28-
>>> get('http://localhost:5000/me', headers={"accept":"application/json"}).content
29-
'{"hello": "me"}'
30-
>>> get('http://localhost:5000/me', headers={"accept":"application/xml"}).content
31-
'<?xml version="1.0" ?><response><hello>me</hello></response>'
24+
# you need requests
25+
>>> from requests import get
26+
>>> get('http://localhost:5000/me').content # default_mediatype
27+
'<?xml version="1.0" ?><response><hello>me</hello></response>'
28+
>>> get('http://localhost:5000/me', headers={"accept":"application/json"}).content
29+
'{"hello": "me"}'
30+
>>> get('http://localhost:5000/me', headers={"accept":"application/xml"}).content
31+
'<?xml version="1.0" ?><response><hello>me</hello></response>'
3232
"""
3333

3434
@api.doc(model=hello_fields, params={"entry": "The entry to wrap"})

examples/zoo_app/zoo/__init__.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
from .cat import api as cat_api
44
from .dog import api as dog_api
55

6-
api = Api(title="Zoo API", version="1.0", description="A simple demo API",)
6+
api = Api(
7+
title="Zoo API",
8+
version="1.0",
9+
description="A simple demo API",
10+
)
711

812
api.add_namespace(cat_api)
913
api.add_namespace(dog_api)

flask_restx/api.py

+12-8
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
from flask import url_for, request, current_app
1919
from flask import make_response as original_flask_make_response
20+
2021
try:
2122
from flask.helpers import _endpoint_from_view_func
2223
except ImportError:
@@ -37,7 +38,7 @@
3738

3839
from werkzeug import __version__ as werkzeug_version
3940

40-
if werkzeug_version.split('.')[0] >= '2':
41+
if werkzeug_version.split(".")[0] >= "2":
4142
from werkzeug.wrappers import Response as BaseResponse
4243
else:
4344
from werkzeug.wrappers import BaseResponse
@@ -159,10 +160,12 @@ def __init__(
159160
self._default_error_handler = None
160161
self.tags = tags or []
161162

162-
self.error_handlers = OrderedDict({
163-
ParseError: mask_parse_error_handler,
164-
MaskError: mask_error_handler,
165-
})
163+
self.error_handlers = OrderedDict(
164+
{
165+
ParseError: mask_parse_error_handler,
166+
MaskError: mask_error_handler,
167+
}
168+
)
166169
self._schema = None
167170
self.models = {}
168171
self._refresolver = None
@@ -273,11 +276,11 @@ def _init_app(self, app):
273276

274277
# check for deprecated config variable names
275278
if "ERROR_404_HELP" in app.config:
276-
app.config['RESTX_ERROR_404_HELP'] = app.config['ERROR_404_HELP']
279+
app.config["RESTX_ERROR_404_HELP"] = app.config["ERROR_404_HELP"]
277280
warnings.warn(
278281
"'ERROR_404_HELP' config setting is deprecated and will be "
279282
"removed in the future. Use 'RESTX_ERROR_404_HELP' instead.",
280-
DeprecationWarning
283+
DeprecationWarning,
281284
)
282285

283286
def __getattr__(self, name):
@@ -425,7 +428,8 @@ def make_response(self, data, *args, **kwargs):
425428
kwargs.pop("fallback_mediatype", None) or self.default_mediatype
426429
)
427430
mediatype = request.accept_mimetypes.best_match(
428-
self.representations, default=default_mediatype,
431+
self.representations,
432+
default=default_mediatype,
429433
)
430434
if mediatype is None:
431435
raise NotAcceptable()

flask_restx/inputs.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,16 @@ def boolean(value):
523523
elif not value:
524524
return False
525525
value = str(value).lower()
526-
if value in ("true", "1", "on",):
526+
if value in (
527+
"true",
528+
"1",
529+
"on",
530+
):
527531
return True
528-
if value in ("false", "0",):
532+
if value in (
533+
"false",
534+
"0",
535+
):
529536
return False
530537
raise ValueError("Invalid literal for boolean(): {0}".format(value))
531538

flask_restx/model.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def _schema(self):
171171
}
172172

173173
if self.__strict__:
174-
definition['additionalProperties'] = False
174+
definition["additionalProperties"] = False
175175

176176
return not_none(definition)
177177

flask_restx/resource.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from flask.views import MethodView
66
from werkzeug import __version__ as werkzeug_version
77

8-
if werkzeug_version.split('.')[0] >= '2':
8+
if werkzeug_version.split(".")[0] >= "2":
99
from werkzeug.wrappers import Response as BaseResponse
1010
else:
1111
from werkzeug.wrappers import BaseResponse

setup.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,11 @@ def pip(filename):
8585
install_requires=install_requires,
8686
tests_require=tests_require,
8787
dev_require=dev_require,
88-
extras_require={"test": tests_require, "doc": doc_require, "dev": dev_require,},
88+
extras_require={
89+
"test": tests_require,
90+
"doc": doc_require,
91+
"dev": dev_require,
92+
},
8993
license="BSD-3-Clause",
9094
zip_safe=False,
9195
keywords="flask restx rest api swagger openapi",

tasks.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ def demo(ctx):
103103
def test(ctx, profile=False):
104104
"""Run tests suite"""
105105
header(test.__doc__)
106-
kwargs = build_args("--benchmark-skip", "--profile" if profile else None,)
106+
kwargs = build_args(
107+
"--benchmark-skip",
108+
"--profile" if profile else None,
109+
)
107110
with ctx.cd(ROOT):
108111
ctx.run("pytest {0}".format(kwargs), pty=True)
109112

tests/test_errors.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ def record(sender, exception):
456456

457457
@api.errorhandler(BadRequest)
458458
def handle_bad_request(error):
459-
return {"message": str(error), "value": "test"}, 400
459+
return {"message": str(error), "value": "test"}, 400
460460

461461
got_request_exception.connect(record, app)
462462
try:
@@ -680,7 +680,7 @@ def test_namespace_errorhandler_with_propagate_true(self, app, client):
680680
returned to client, even if PROPAGATE_EXCEPTIONS is set."""
681681
app.config["PROPAGATE_EXCEPTIONS"] = True
682682
api = restx.Api(app)
683-
namespace = restx.Namespace('test_namespace')
683+
namespace = restx.Namespace("test_namespace")
684684
api.add_namespace(namespace)
685685

686686
@namespace.route("/test/", endpoint="test")

0 commit comments

Comments
 (0)