Skip to content

Commit 0c07a7e

Browse files
committed
fix: Initialized OrderedDict to fix documentation function
fix: black line length reformatting
1 parent 6d642df commit 0c07a7e

File tree

6 files changed

+13
-6
lines changed

6 files changed

+13
-6
lines changed

examples/cli_multiple.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import hug
22

3+
34
@hug.cli()
4-
def add(numbers: list=None):
5+
def add(numbers: list = None):
56
return sum([int(number) for number in numbers])
67

78

examples/matplotlib/plot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
@hug.get(output=hug.output_format.png_image)
88
def plot():
99
pyplot.plot([1, 2, 3, 4])
10-
pyplot.ylabel('some numbers')
10+
pyplot.ylabel("some numbers")
1111

1212
image_output = io.BytesIO()
13-
pyplot.savefig(image_output, format='png')
13+
pyplot.savefig(image_output, format="png")
1414
image_output.seek(0)
1515
return image_output

hug/interface.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,8 @@ def check_requirements(self, request=None, response=None, context=None):
305305

306306
def documentation(self, add_to=None):
307307
"""Produces general documentation for the interface"""
308-
doc = OrderedDict if add_to is None else add_to
308+
309+
doc = OrderedDict() if add_to is None else add_to
309310

310311
usage = self.interface.spec.__doc__
311312
if usage:

tests/test_decorators.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,6 +1044,7 @@ def extend_with():
10441044

10451045
# But not both
10461046
with pytest.raises(ValueError):
1047+
10471048
@hug.extend_api(sub_command="sub_api", command_prefix="api_", http=False)
10481049
def extend_with():
10491050
return (tests.module_fake_http_and_cli,)
@@ -1940,7 +1941,7 @@ def pull_record(record_id: hug.types.number = 1):
19401941

19411942
def test_multiple_cli(hug_api):
19421943
@hug.cli(api=hug_api)
1943-
def multiple(items: list=None):
1944+
def multiple(items: list = None):
19441945
return items
19451946

19461947
hug_api.cli([None, "multiple", "-i", "one", "-i", "two"])

tests/test_documentation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ def marshtest() -> Returns():
186186

187187
assert doc["handlers"]["/marshtest"]["POST"]["outputs"]["type"] == "Return docs"
188188

189+
189190
def test_map_params_documentation_preserves_type():
190191
@hug.get(map_params={"from": "from_mapped"})
191192
def map_params_test(from_mapped: hug.types.number):

tests/test_routing.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,4 +418,7 @@ def test_allow_origins_request_handling(self, hug_api):
418418
def my_endpoint():
419419
return "Success"
420420

421-
assert hug.test.get(hug_api, "/my_endpoint", headers={'ORIGIN': 'google.com'}).data == "Success"
421+
assert (
422+
hug.test.get(hug_api, "/my_endpoint", headers={"ORIGIN": "google.com"}).data
423+
== "Success"
424+
)

0 commit comments

Comments
 (0)