Skip to content

Commit

Permalink
fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
peteryangms committed Nov 21, 2024
1 parent 70f5855 commit 8e77065
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
19 changes: 10 additions & 9 deletions rdagent/core/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

# TODO: use pydantic for other modules in Qlib
from pathlib import Path
from typing import Any, List, Tuple, Type
from typing import Any, TYPE_CHECKING

from pydantic.fields import FieldInfo
if TYPE_CHECKING:
from pydantic.fields import FieldInfo
from pydantic_settings import (
BaseSettings,
EnvSettingsSource,
Expand All @@ -16,7 +17,7 @@
class ExtendedEnvSettingsSource(EnvSettingsSource):
def get_field_value(self, field: FieldInfo, field_name: str) -> tuple[Any, str, bool]:
# Dynamically gather prefixes from the current and parent classes
prefixes = [self.config.get("env_prefix", "")] or []
prefixes = [self.config.get("env_prefix", "")]
if hasattr(self.settings_cls, "__bases__"):
for base in self.settings_cls.__bases__:
if hasattr(base, "model_config"):
Expand All @@ -40,12 +41,12 @@ class ExtendedBaseSettings(BaseSettings):
@classmethod
def settings_customise_sources(
cls,
settings_cls: Type[BaseSettings],
init_settings: PydanticBaseSettingsSource,
env_settings: PydanticBaseSettingsSource,
dotenv_settings: PydanticBaseSettingsSource,
file_secret_settings: PydanticBaseSettingsSource,
) -> Tuple[PydanticBaseSettingsSource, ...]:
settings_cls: type[BaseSettings],
init_settings: PydanticBaseSettingsSource, # noqa
env_settings: PydanticBaseSettingsSource, # noqa
dotenv_settings: PydanticBaseSettingsSource, # noqa
file_secret_settings: PydanticBaseSettingsSource, # noqa
) -> tuple[PydanticBaseSettingsSource, ...]:
return (ExtendedEnvSettingsSource(settings_cls),)


Expand Down
4 changes: 2 additions & 2 deletions rdagent/core/knowledge_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ def load(self) -> None:
with self.path.open("rb") as f:
loaded = pickle.load(f)
if isinstance(loaded, dict):
self.__dict__.update({k: v for k, v in loaded.items() if not k == "path"})
self.__dict__.update({k: v for k, v in loaded.items() if k != "path"})
else:
self.__dict__.update({k: v for k, v in loaded.__dict__.items() if not k == "path"})
self.__dict__.update({k: v for k, v in loaded.__dict__.items() if k != "path"})

def dump(self) -> None:
if self.path is not None:
Expand Down

0 comments on commit 8e77065

Please sign in to comment.