Skip to content

Commit

Permalink
Remove commented code
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasBBS committed Dec 8, 2022
1 parent ada896e commit da172c9
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions falcon_apispec/falcon_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,6 @@ def init_spec(self, spec):
def _get_valid_methods(self):
return set(VALID_METHODS[self._spec.openapi_version.major])

# def _generate_resource_uri_mapping(self, app, resource):
# valid_methods = self._get_valid_methods()
# routes_to_check = copy.copy(app._router._roots)

# mapping = {}
# for route in routes_to_check:
# uri = route.uri_template
# resource = route.resource
# mapping[resource] = {
# "uri": uri,
# "methods": {}
# }

# if route.method_map:
# for method_name, method_handler in route.method_map.items():
# if method_handler.__module__ == "falcon.responders":
# continue
# if method_name.lower() not in valid_methods:
# continue
# if method_name.lower() not in valid_methods:
# continue
# mapping[resource]["methods"][method_name.lower()] = method_handler

# routes_to_check.extend(route.children)
# return mapping

def _generate_resource_uri(self, resource):
valid_methods = self._get_valid_methods()
routes_to_check = copy.copy(self._app._router._roots)
Expand All @@ -70,14 +44,11 @@ def _generate_resource_uri(self, resource):

def path_helper(self, operations, resource, base_path=None, **kwargs):
"""Path helper that allows passing a Falcon resource instance."""
#resource_uri_mapping = self._generate_resource_uri_mapping(self._app, resource)
resource_uri = self._generate_resource_uri(resource)
#if resource not in resource_uri_mapping:
if not resource_uri:
raise APISpecError("Could not find endpoint for resource {0}".format(resource))

operations.update(yaml_utils.load_operations_from_docstring(resource.__doc__) or {})
#path = resource_uri_mapping[resource]["uri"]
path = resource_uri["uri"]

if base_path is not None:
Expand All @@ -86,7 +57,6 @@ def path_helper(self, operations, resource, base_path=None, **kwargs):
base_path = '/' + base_path.strip('/')
path = re.sub(base_path, "", path, 1)

#methods = resource_uri_mapping[resource]["methods"]
methods = resource_uri["methods"]

for method_name, method_handler in methods.items():
Expand Down

0 comments on commit da172c9

Please sign in to comment.