mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
parent
d392dc1cfa
commit
f5e79adf26
9 changed files with 129 additions and 4 deletions
|
|
@ -842,7 +842,7 @@ def parse_metadata(content):
|
|||
raise BadMetadataError("Metadata is not valid JSON or YAML")
|
||||
|
||||
|
||||
def call_with_supported_arguments(fn, **kwargs):
|
||||
def _gather_arguments(fn, kwargs):
|
||||
parameters = inspect.signature(fn).parameters.keys()
|
||||
call_with = []
|
||||
for parameter in parameters:
|
||||
|
|
@ -853,9 +853,19 @@ def call_with_supported_arguments(fn, **kwargs):
|
|||
)
|
||||
)
|
||||
call_with.append(kwargs[parameter])
|
||||
return call_with
|
||||
|
||||
|
||||
def call_with_supported_arguments(fn, **kwargs):
|
||||
call_with = _gather_arguments(fn, kwargs)
|
||||
return fn(*call_with)
|
||||
|
||||
|
||||
async def async_call_with_supported_arguments(fn, **kwargs):
|
||||
call_with = _gather_arguments(fn, kwargs)
|
||||
return await fn(*call_with)
|
||||
|
||||
|
||||
def actor_matches_allow(actor, allow):
|
||||
actor = actor or {}
|
||||
if allow is None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue