• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ggravlingen / pypmanager / 14422545649

12 Apr 2025 07:06PM UTC coverage: 94.183% (-0.3%) from 94.531%
14422545649

push

github

web-flow
Use database in async_security_map_isin_to_security (#1422)

109 of 116 branches covered (93.97%)

Branch coverage included in aggregate %.

1332 of 1414 relevant lines covered (94.2%)

0.94 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.93
pypmanager/settings.py
1
"""Settings."""
2

3
from __future__ import annotations
1✔
4

5
import logging
1✔
6
from pathlib import Path
1✔
7
from zoneinfo import ZoneInfo
1✔
8

9
from dotenv import load_dotenv
1✔
10
from pydantic_settings import BaseSettings, SettingsConfigDict
1✔
11

12
load_dotenv()
1✔
13

14

15
class TypedSettings(BaseSettings):
1✔
16
    """Settings."""
17

18
    model_config = SettingsConfigDict(
1✔
19
        env_file=".env",
20
        env_file_encoding="utf-8",
21
        extra="ignore",
22
    )
23

24
    debug_name: str | None = None
1✔
25

26
    dir_config: Path = Path("pypmanager/configuration")
1✔
27
    dir_static: Path = Path("frontend/static")
1✔
28
    dir_templates: Path = Path("frontend/templates")
1✔
29

30
    system_time_zone: ZoneInfo = ZoneInfo("Europe/Stockholm")
1✔
31

32
    @property
1✔
33
    def file_market_data_config(self: TypedSettings) -> Path:
1✔
34
        """Return market data file."""
35
        return self.dir_config / "market_data.yaml"
1✔
36

37
    @property
1✔
38
    def security_config(self: TypedSettings) -> Path:
1✔
39
        """Return security configuration file."""
40
        return self.dir_config / "security.yaml"
1✔
41

42
    @property
1✔
43
    def dir_data_local(self: TypedSettings) -> Path:
1✔
44
        """Return data directory."""
45
        return Path("data")
1✔
46

47
    @property
1✔
48
    def dir_configuration_local(self: TypedSettings) -> Path:
1✔
49
        """Return local configuration path."""
50
        return self.dir_data_local / "configuration"
×
51

52
    @property
1✔
53
    def dir_market_data_local(self: TypedSettings) -> Path:
1✔
54
        """Return folder path for market data."""
55
        return self.dir_data_local / "market_data"
×
56

57
    @property
1✔
58
    def dir_transaction_data_local(self: TypedSettings) -> Path:
1✔
59
        """Return folder path for transaction data."""
60
        return self.dir_data_local / "transactions"
1✔
61

62
    @property
1✔
63
    def file_market_data_config_local(self: TypedSettings) -> Path | None:
1✔
64
        """Return local market data file."""
65
        local_market_data = self.dir_configuration_local / "market_data.yaml"
×
66
        if local_market_data.exists():
×
67
            return local_market_data
×
68

69
        return None
×
70

71
    @property
1✔
72
    def security_config_local(self: TypedSettings) -> Path | None:
1✔
73
        """Return local security configuration file."""
74
        local_market_data = self.dir_configuration_local / "security.yaml"
×
75
        if local_market_data.exists():
×
76
            return local_market_data
×
77

78
        return None
×
79

80
    @property
1✔
81
    def database_local(self: TypedSettings) -> Path:
1✔
82
        """Return path to local SQL lite database."""
83
        return self.dir_data_local / "database" / "database.sqlite"
×
84

85

86
Settings = TypedSettings()
1✔
87

88
logging.basicConfig(level=logging.INFO)
1✔
89

90
for _module in ("aiosqlite",):
1✔
91
    logging.getLogger(_module).setLevel(logging.INFO)
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc