Files
OpenBB/openbb_terminal/core/models/preferences_model.py
dio db9d462188 Feature/companies house (#4721)
* Addition of UK Companies House data. Allows you to search for companies and inspect their details and download any filings including accounts

* reformatting of code

* reformatting

* reformat code

* reformat

* fix codespell issue

* updated for changes in way key are handled

* small reformatting

* added timeout for requests

* formatting

* ruff order fixes

* black reformatting

* merge issue - removed function call_openbb

* black format change

* Added new Companies House functionality to SDK

* formattng

* more Formatting (black)

* Ruff fix

* change return type for function

* forced type conversion

* return type fix

* correct error return type

* fix return type

* deleted companieshouse tests as they require API key

* Extra validation added for when data not exist from remote calls

* Added extra commands to en.yml

* spelling mistake correction

* fat finger trouble corrected

* Save documents with identifying names and allow documents to be viewed directly within OpenBB

* ruff updates

* black changes

* ruff change

* Addition of currently loaded company information in menu

* add entry in the API keys guide for Companies Hosue

* adds images to api keys guide

* adds section in SDK API Keys Guide for Companies House

* test file for companieshouse_model

* changed test data due to ruff line size limit

* resolve merge issues

* resolve merge issue

* doc strings examples

* added docstrings for companieshouse_model

* allow download_filking_document methid in view class to be called from SDK

* added docstring for download_filing_document SDK method

* correct Companies house key literal

* replace starnge . with ,

* add check_api_key decorator to each methopd in controller

* implement next and previous for looping through filings

* ruff changes

* correct tests

* companing filings now allows you specify category

* ruff line length issue resolved

* retrieves all filings  and  added charges command

* bug fix

* Added limit parameter to filings command, def :100

* fix ruff issue

* added get_charges to sdk and to test class

* resolved ruff line length issue

* add some view tests

* add some controller tests

* applying fix not merged to develop yet, column_keep_types=['Company Number']

* fix i18n description

* update test_print_help

* actually update test_print_help.txt

* Update en.yml - no colon

* rerorder imports - ruff failurre

* simple text change

* ruff fix

* help text change trying to fix pytest issue

---------

Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>
Co-authored-by: James Maslek <jmaslek11@gmail.com>
2023-08-28 14:28:33 +00:00

92 lines
3.7 KiB
Python

import os
from typing import Literal, Optional
from pydantic import NonNegativeInt, PositiveFloat, PositiveInt
from pydantic.dataclasses import dataclass
from openbb_terminal.core.config.paths import HOME_DIRECTORY
from openbb_terminal.core.models import BaseModel
# pylint: disable=too-many-instance-attributes, disable=no-member, useless-parent-delegation
@dataclass(config=dict(validate_assignment=True, frozen=True))
class PreferencesModel(BaseModel):
"""Data model for preferences."""
# PLOT
# Plot backend
# Examples:
# "tkAgg" - This uses the tkinter library. If unsure, set to this
# "module://backend_interagg" - This is what pycharm defaults to in Scientific Mode
# "MacOSX" - Mac default. Does not work with backtesting
# "Qt5Agg" - This requires the PyQt5 package is installed
# See more: https://matplotlib.org/stable/tutorials/introductory/usage.html#the-builtin-backends
PLOT_BACKEND: Optional[str] = None
PLOT_DPI: PositiveInt = 100
PLOT_HEIGHT: PositiveInt = 500
PLOT_WIDTH: PositiveInt = 800
PLOT_HEIGHT_PERCENTAGE: PositiveFloat = 50.0
PLOT_WIDTH_PERCENTAGE: PositiveFloat = 70.0
# Whether to open plot image exports after they are created
PLOT_OPEN_EXPORT: bool = False
# Use interactive window to display plots
PLOT_ENABLE_PYWRY: bool = True
PLOT_PYWRY_WIDTH: PositiveInt = 1400
PLOT_PYWRY_HEIGHT: PositiveInt = 762
# FEATURE FLAGS
FILE_OVERWRITE: bool = False
SHOW_VERSION: bool = True
RETRY_WITH_LOAD: bool = False
USE_TABULATE_DF: bool = True
# Use interactive window to display dataframes with options to sort, filter, etc.
USE_INTERACTIVE_DF: bool = True
USE_CLEAR_AFTER_CMD: bool = False
USE_DATETIME: bool = True
# Enable interactive matplotlib mode: change variable name to be more descriptive and delete comment
USE_PROMPT_TOOLKIT: bool = True
USE_PLOT_AUTOSCALING: bool = False
ENABLE_THOUGHTS_DAY: bool = False
ENABLE_QUICK_EXIT: bool = False
OPEN_REPORT_AS_HTML: bool = True
ENABLE_EXIT_AUTO_HELP: bool = True
REMEMBER_CONTEXTS: bool = True
ENABLE_RICH_PANEL: bool = True
ENABLE_CHECK_API: bool = True
TOOLBAR_HINT: bool = True
# GENERAL
PREVIOUS_USE: bool = False
TIMEZONE: str = "America/New_York"
FLAIR: str = ":bug"
USE_LANGUAGE: str = "en"
REQUEST_TIMEOUT: PositiveInt = 5
MONITOR: NonNegativeInt = 0
# STYLE
MPL_STYLE: str = "dark"
PMF_STYLE: str = "dark"
RICH_STYLE: str = "dark"
CHART_STYLE: Literal["dark", "light"] = "dark"
TABLE_STYLE: Literal["dark", "light"] = "dark"
# PATHS
GUESS_EASTER_EGG_FILE: str = os.getcwd() + os.path.sep + "guess_game.json"
USER_DATA_DIRECTORY = HOME_DIRECTORY / "OpenBBUserData"
USER_DATA_SOURCES_FILE: str = str(USER_DATA_DIRECTORY / "sources" / "sources.json")
USER_EXPORTS_DIRECTORY = USER_DATA_DIRECTORY / "exports"
USER_CUSTOM_IMPORTS_DIRECTORY = USER_DATA_DIRECTORY / "custom_imports"
USER_PORTFOLIO_DATA_DIRECTORY = USER_DATA_DIRECTORY / "portfolio"
USER_ROUTINES_DIRECTORY = USER_DATA_DIRECTORY / "routines"
USER_PRESETS_DIRECTORY = USER_DATA_DIRECTORY / "presets"
USER_REPORTS_DIRECTORY = USER_DATA_DIRECTORY / "reports"
USER_CUSTOM_REPORTS_DIRECTORY = USER_DATA_DIRECTORY / "reports" / "custom reports"
USER_FORECAST_MODELS_DIRECTORY = USER_DATA_DIRECTORY / "exports" / "forecast_models"
USER_FORECAST_WHISPER_DIRECTORY = USER_DATA_DIRECTORY / "exports" / "whisper"
USER_STYLES_DIRECTORY = USER_DATA_DIRECTORY / "styles"
USER_COMPANIES_HOUSE_DIRECTORY = USER_DATA_DIRECTORY / "companies_house"
def __repr__(self) -> str: # pylint: disable=useless-super-delegation
return super().__repr__()