Created
April 22, 2021 16:09
-
-
Save jhunterkohler/0dcb13899c96b3670ccaab930b6ba6d6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Union, Any | |
class namespace: | |
def __init__(self, *args: Union[tuple[str, Any], dict[str, Any]], **kwargs): | |
for arg in args: | |
if type(arg) == dict: | |
self.__dict__.update(arg) | |
elif type(arg) == tuple and len(tuple) == 2: | |
self.__dict__.update(arg) | |
else: | |
raise TypeError("Invalid arg type: " + type(arg)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment