Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
Merge branch 'read-defaults-from-signature' of github.com:deepset-ai/…
Browse files Browse the repository at this point in the history
…canals into read-defaults-from-signature
  • Loading branch information
ZanSara committed Nov 15, 2023
2 parents 50ab7df + a85f7bc commit db6de10
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion canals/component/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def __call__(cls, *args, **kwargs):
instance.__canals_input__ = {}
run_signature = inspect.signature(getattr(cls, "run"))
for param in list(run_signature.parameters)[1:]: # First is 'self' and it doesn't matter.
if run_signature.parameters[param].kind == inspect.Parameter.POSITIONAL_OR_KEYWORD: # ignore kwargs
if run_signature.parameters[param].kind == inspect.Parameter.POSITIONAL_OR_KEYWORD: # ignore `**kwargs`
instance.__canals_input__[param] = InputSocket(
name=param,
type=run_signature.parameters[param].annotation,
Expand Down
2 changes: 1 addition & 1 deletion sample_components/fstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class FString:
def __init__(self, template: str, variables: Optional[List[str]] = None):
self.template = template
self.variables = variables or []
if any(variable == "template" for variable in self.variables):
if "template" in self.variables:
raise ValueError("The variable name 'template' is reserved and cannot be used.")
component.set_input_types(self, **{variable: Any for variable in self.variables})

Expand Down

0 comments on commit db6de10

Please sign in to comment.