Skip to content

Commit

Permalink
inline
Browse files Browse the repository at this point in the history
  • Loading branch information
lubaskinc0de committed Jul 29, 2024
1 parent d8ca305 commit 3e0be5f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/dataclass_rest/boundmethod.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

from abc import ABC, abstractmethod
from inspect import getcallargs
from logging import getLogger
Expand Down
17 changes: 12 additions & 5 deletions src/dataclass_rest/parse_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ def get_file_params(spec):
]


def get_url_params_from_callable(
url_template: Callable[..., str],
) -> List[str]:
url_template_func_arg_spec = getfullargspec(url_template)
return url_template_func_arg_spec.args


def parse_func(
func: Callable,
method: str,
Expand All @@ -78,11 +85,11 @@ def parse_func(
url_template.format if is_string_url_template else url_template
)

if not is_string_url_template:
url_template_func_arg_spec = getfullargspec(url_template_callable)
url_params = url_template_func_arg_spec.args
else:
url_params = get_url_params_from_string(url_template)
url_params = (
get_url_params_from_string(url_template)
if is_string_url_template
else get_url_params_from_callable(url_template)
)

skipped_params = url_params + file_params + [body_param_name]

Expand Down

0 comments on commit 3e0be5f

Please sign in to comment.