<commit_before>from dotenv import find_dotenv, load_dotenv
from functools import lru_cache
from typing import List
from os import getenv

from pydantic import BaseSettings

import piecewise.config.defaults as default


class Settings(BaseSettings):
    api_v1_route: str = default.API_V1_ROUTE
    openapi_route: str = default.OPENAPI_ROUTE
    name: str = default.NAME
    static_dir: str = default.STATIC_DIR
    static_mount_path: str = default.STATIC_MOUNT_PATH

    _origins: str = ""  # Should be a comma-separated list of origins

    @property
    def origins(self) -> List[str]:
        return [x.strip() for x in self._origins.split(",") if x]

    class Config:
        env_prefix = default.NAME.upper() + "_"
        case_sensitive = True
        fields = {"_origins": {"env": env_prefix + "origins"}}


class DevelopmentSettings(Settings):
    debug: bool = True
    db_url: str = "sqlite:///./test.db"


class StagingSettings(Settings):
    debug: bool = True
    postgres_user: str
    postgres_pass: str
    postgres_server: str
    postgres_db: str

    @property
    def db_url(self) -> str:
        return f"postgresql://{self.postgres_user}:{self.postgres_pass}@{self.postgres_server}/{self.postgres_db}"


class ProductionSettings(Settings):
    debug: bool = False
    postgres_user: str
    postgres_pass: str
    postgres_server: str
    postgres_db: str

    @property
    def db_url(self) -> str:
        return f"postgresql://{self.postgres_user}:{self.postgres_pass}@{self.postgres_server}/{self.postgres_db}"<commit_msg>Fix typo.<commit_after>from dotenv import find_dotenv, load_dotenv
from functools import lru_cache
from typing import List
from os import getenv

from pydantic import BaseSettings

import piecewise.config.defaults as default


class Settings(BaseSettings):
    api_v1_route: str = default.API_V1_ROUTE
    openapi_route: str = default.OPENAPI_ROUTE
    name: str = default.NAME
    static_dir: str = default.STATIC_DIR
    static_mount_path: str = default.STATIC_MOUNT_PATH

    _origins: str = ""  # Should be a comma-separated list of origins

    @property
    def origins(self) -> List[str]:
        return [x.strip() for x in self._origins.split(",") if x]

    class Config:
        env_prefix = default.NAME.upper() + "_"
        case_sensitive = True
        fields = {"_origins": {"env": env_prefix + "origins"}}


class DevelopmentSettings(Settings):
    debug: bool = True
    db_url: str = "sqlite:///./test.db"


class StagingSettings(Settings):
    debug: bool = True
    postgres_user: str
    postgres_pass: str
    postgres_host: str
    postgres_port: int
    postgres_db: str

    @property
    def db_url(self) -> str:
        return f"postgresql://{self.postgres_user}:{self.postgres_pass}@{self.postgres_host}:{self.postgres_port}/{self.postgres_db}"


class ProductionSettings(Settings):
    debug: bool = False
    postgres_user: str
    postgres_pass: str
    postgres_host: str
    postgres_port: int
    postgres_db: str

    @property
    def db_url(self) -> str:
        return f"postgresql://{self.postgres_user}:{self.postgres_pass}@{self.postgres_host}:{self.postgres_port}/{self.postgres_db}"
{'fraction_non_alphanumeric': 0.1042848141146818, 'fraction_numerical': 0.001260239445494644, 'mean_word_length': 3.5552367288378766, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5269039', 'n_tokens_mistral': 1051, 'n_tokens_neox': 1030, 'n_words': 244}