Skip to content

Commit 8eef6ac

Browse files
author
Joel Collins
committed
Removed redundant if condition
1 parent 8e2912a commit 8eef6ac

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

labthings/server/spec/apispec.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -89,25 +89,24 @@ def view_to_apispec_operations(view: View, spec: APISpec):
8989
ops = {}
9090
for method in view.methods:
9191
method = str(method).lower()
92-
if hasattr(view, method):
93-
ops[method] = {}
94-
method_function = getattr(view, method)
92+
ops[method] = {}
93+
method_function = getattr(view, method)
9594

96-
# Populate missing spec parameters
97-
build_spec(method_function, inherit_from=view)
95+
# Populate missing spec parameters
96+
build_spec(method_function, inherit_from=view)
9897

99-
rupdate(
100-
ops[method],
101-
{
102-
"description": getattr(method_function, "__apispec__").get(
103-
"description"
104-
),
105-
"summary": getattr(method_function, "__apispec__").get("summary"),
106-
"tags": getattr(method_function, "__apispec__").get("tags"),
107-
},
108-
)
98+
rupdate(
99+
ops[method],
100+
{
101+
"description": getattr(method_function, "__apispec__").get(
102+
"description"
103+
),
104+
"summary": getattr(method_function, "__apispec__").get("summary"),
105+
"tags": getattr(method_function, "__apispec__").get("tags"),
106+
},
107+
)
109108

110-
rupdate(ops[method], method_to_apispec_operation(method_function, spec))
109+
rupdate(ops[method], method_to_apispec_operation(method_function, spec))
111110

112111
return ops
113112

0 commit comments

Comments
 (0)