lru_cache 3

1107. I love you, a little , a lot, passionately ... not at all

Who remembers back to their time in the schoolyard, when girls would take a flower and tear its petals, saying each of the following phrases each time a petal was torn: "I love you" "a little" "a lot" "passionately" "madly" "not at all" If there are more than 6 petals, you start over with "I love you" for 7 petals, "a little" for 8 petals and so on. When the last petal was torn there were cries ..

FastAPI _ BaseSettings 을 lru_cache 할 때, unhashable type 에러 해결방법

BaseSettings을 사용한 객체를 lru_cache 할 때, TypeError: unhashable type: 에러가 발생할 때가 있다. 정리하면 다음과 같은 상황이다. given FastAPI 에서 lru_cache로 반환하는 BaseSettings 객체를, when 다시 lru_cache를 사용하는 함수가 인수로 받을 때, then TypeError: unhashable type: 에러가 발생함. e.g class Config(BaseSettings): URL: str = Field(..., env="URL") class Config: env_file = "secrets/.env" env_file_encoding = "utf-8" @lru_cache def get_config() -> Confi..