Fix types and linting

This commit is contained in:
Theodore Aptekarev
2022-03-26 01:26:32 +03:00
parent 09a0200010
commit 2a47c9ee72
3 changed files with 30 additions and 25 deletions

View File

@@ -1,7 +1,7 @@
import os
import json
from distutils.util import strtobool
from typing import Union
from typing import Union, Optional
from dotenv import load_dotenv
@@ -19,7 +19,7 @@ if env_files:
def assign_feature_flag(
feature_flag: str, fallback_value: str, return_bool: bool = False
) -> Union[str, bool, None]:
) -> Optional[Union[str, bool]]:
"""Get the feature flag value in order of priority.
- Env variables have the highest priority
@@ -37,8 +37,8 @@ def assign_feature_flag(
Returns
-------
Union[str, bool, None]
The feature flag value
Optional[Union[str, bool]]
The feature flag value or None
"""
if bool(os.getenv(feature_flag)):
feature_flag_value = (

View File

@@ -942,7 +942,11 @@ def get_flair() -> str:
":yy": "(☯)",
}
flair = flairs[gtff.USE_FLAIR] if gtff.USE_FLAIR in flairs else gtff.USE_FLAIR
flair = (
flairs[str(gtff.USE_FLAIR)]
if str(gtff.USE_FLAIR) in flairs
else str(gtff.USE_FLAIR)
)
if gtff.USE_DATETIME and get_user_timezone_or_invalid() != "INVALID":
dtime = datetime.now(pytz.timezone(get_user_timezone())).strftime(
"%Y %b %d, %H:%M"
@@ -1150,7 +1154,7 @@ def export_data(
now = datetime.now()
if gtff.EXPORT_FOLDER_PATH:
full_path_dir = gtff.EXPORT_FOLDER_PATH
full_path_dir = str(gtff.EXPORT_FOLDER_PATH)
path_cmd = dir_path.split("gamestonk_terminal/")[1].replace("/", "_")
default_filename = f"{now.strftime('%Y%m%d_%H%M%S')}_{path_cmd}_{func_name}"

View File

@@ -81,9 +81,9 @@ def update_terminal():
"Seems like more modules have been added, grab a coke, this may take a while."
)
completed_process = subprocess.run(
completed_process = subprocess.run( # nosec
"poetry install", shell=True, check=False
) # nosec
)
if completed_process.returncode != 0:
return completed_process.returncode
@@ -110,23 +110,24 @@ def about_us():
console.print(
"[green]Thanks for using Gamestonk Terminal. This is our way![/green]\n"
"\n"
"[cyan]Join our community on discord: [/cyan]https://discord.gg/Up2QGbMKHY\n"
"[cyan]Follow our twitter for updates: [/cyan]https://twitter.com/gamestonkt\n"
"[cyan]Access our landing page: [/cyan]https://gamestonkterminal.github.io/GamestonkTerminal/\n"
"\n"
"[yellow]Partnerships:[/yellow]\n"
"[cyan]FinBrain: [/cyan]https://finbrain.tech\n"
"[cyan]Quiver Quantitative: [/cyan]https://www.quiverquant.com\n"
"[cyan]SentimentInvestor: [/cyan]https://sentimentinvestor.com\n"
"\n[red]"
"DISCLAIMER: Trading in financial instruments involves high risks including the risk of losing some, "
"or all, of your investment amount, and may not be suitable for all investors. Before deciding to trade in "
"financial instrument you should be fully informed of the risks and costs associated with trading the financial "
"markets, carefully consider your investment objectives, level of experience, and risk appetite, and seek "
"professional advice where needed. The data contained in Gamestonk Terminal (GST) is not necessarily accurate. "
"GST and any provider of the data contained in this website will not accept liability for any loss or damage "
"as a result of your trading, or your reliance on the information displayed.[/red]\n"
+ "\n"
+ "[cyan]Join our community on discord: [/cyan]https://discord.gg/Up2QGbMKHY\n"
+ "[cyan]Follow our twitter for updates: [/cyan]https://twitter.com/gamestonkt\n"
+ "[cyan]Access our landing page: [/cyan]https://gamestonkterminal.github.io/GamestonkTerminal/\n"
+ "\n"
+ "[yellow]Partnerships:[/yellow]\n"
+ "[cyan]FinBrain: [/cyan]https://finbrain.tech\n"
+ "[cyan]Quiver Quantitative: [/cyan]https://www.quiverquant.com\n"
+ "[cyan]SentimentInvestor: [/cyan]https://sentimentinvestor.com\n"
+ "\n[red]"
+ "DISCLAIMER: Trading in financial instruments involves high risks including the risk of losing some, "
+ "or all, of your investment amount, and may not be suitable for all investors. Before deciding to "
+ "trade in financial instrument you should be fully informed of the risks and costs associated with "
+ "trading the financial markets, carefully consider your investment objectives, level of experience, "
+ "and risk appetite, and seek professional advice where needed.\n"
+ "The data contained in Gamestonk Terminal (GST) is not necessarily accurate. GST and any provider "
+ "of the data contained in this software will not accept liability for any loss or damage "
+ "as a result of your trading, or your reliance on the information displayed.[/red]\n"
)