Check if the all keys in kwargs exist in the __init__ method of the class. Args: cls: the class to check. kwargs: kwargs to examine. Returns: a boolean indicating if all keys exist. a set of extra keys that are not used in the __init__.
(cls, kwargs)
| 855 | |
| 856 | |
| 857 | def check_kwargs_exist_in_class_init(cls, kwargs): |
| 858 | """ |
| 859 | Check if the all keys in kwargs exist in the __init__ method of the class. |
| 860 | |
| 861 | Args: |
| 862 | cls: the class to check. |
| 863 | kwargs: kwargs to examine. |
| 864 | |
| 865 | Returns: |
| 866 | a boolean indicating if all keys exist. |
| 867 | a set of extra keys that are not used in the __init__. |
| 868 | """ |
| 869 | init_signature = inspect.signature(cls.__init__) |
| 870 | init_params = set(init_signature.parameters) - {"self"} # Exclude 'self' from the parameter list |
| 871 | input_kwargs = set(kwargs) |
| 872 | extra_kwargs = input_kwargs - init_params |
| 873 | |
| 874 | return extra_kwargs == set(), extra_kwargs |
| 875 | |
| 876 | |
| 877 | def run_cmd(cmd_list: list[str], **kwargs: Any) -> subprocess.CompletedProcess: |
no outgoing calls
searching dependent graphs…