Validate that api key and python package exists in environment.
(cls, values: Dict)
| 37 | |
| 38 | @root_validator() |
| 39 | def validate_environment(cls, values: Dict) -> Dict: |
| 40 | """Validate that api key and python package exists in environment.""" |
| 41 | func = values.get("func") |
| 42 | if func and not values.get("name"): |
| 43 | values["name"] = values["func"].__name__ |
| 44 | |
| 45 | # check if all args from arg_description exist in func args |
| 46 | if values.get("arg_description") and func: |
| 47 | inspection = inspect.getfullargspec(func) |
| 48 | override_args = set(values["arg_description"].keys()) |
| 49 | args = set(inspection.args) |
| 50 | override_without_args = override_args - args |
| 51 | if len(override_without_args) > 0: |
| 52 | raise ValueError( |
| 53 | f"Provide arg description for not existed args: {override_without_args}" |
| 54 | ) |
| 55 | |
| 56 | return values |
| 57 | |
| 58 | def _parse_input( |
| 59 | self, |
nothing calls this directly
no outgoing calls
no test coverage detected