Skip to content
Myr

structures.py

This file

Path

httpcore/structures.py

20 lines · 566 bytes · Python

Last changed by

Rollin'Tom Christiebefore adoption8a29a0a

History of this file

Take it

1import typing234class LookupDict(dict):5    """Dictionary lookup object."""67    def __init__(self, name: str = None) -> None:8        self.name = name9        super(LookupDict, self).__init__()1011    def __repr__(self) -> str:12        return "<lookup '%s'>" % (self.name)1314    def __getitem__(self, key: typing.Any) -> typing.Any:15        # We allow fall-through here, so values default to None1617        return self.__dict__.get(key, None)1819    def get(self, key: typing.Any, default: typing.Any = None) -> typing.Any:20        return self.__dict__.get(key, default)