mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-24 18:22:43 +00:00
GitHub Actions: Make mypy a mandatory test
This commit is contained in:
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@@ -25,7 +25,7 @@ jobs:
|
||||
- run: black --check .
|
||||
- run: codespell --ignore-words-list="mape" --quiet-level=2 --skip=".git" # --skip=""
|
||||
- run: flake8 . --count --ignore=E203,E302,F401,F841,W503 --max-line-length=140 --show-source --statistics
|
||||
- run: mypy --ignore-missing-imports . || true
|
||||
- run: mypy --ignore-missing-imports .
|
||||
- run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true
|
||||
- run: safety check
|
||||
- run: pylint **/*.py
|
||||
|
||||
@@ -161,34 +161,29 @@ def long_number_format(num) -> str:
|
||||
|
||||
|
||||
def clean_data_values_to_float(val: str) -> float:
|
||||
# Remove parenthesis if they exist
|
||||
if val.startswith("("):
|
||||
val = val[1:]
|
||||
if val.endswith(")"):
|
||||
val = val[:-1]
|
||||
|
||||
# Remove any leading or trailing parentheses and spaces
|
||||
val = val.strip("( )")
|
||||
if val == "-":
|
||||
val = "0"
|
||||
|
||||
# Convert percentage to decimal
|
||||
if val.endswith("%"):
|
||||
val = float(val[:-1]) / 100.0
|
||||
val_as_float = float(val[:-1]) / 100.0
|
||||
# Convert from billions
|
||||
elif val.endswith("B"):
|
||||
val = float(val[:-1]) * 1_000_000_000
|
||||
val_as_float = float(val[:-1]) * 1_000_000_000
|
||||
# Convert from millions
|
||||
elif val.endswith("M"):
|
||||
val = float(val[:-1]) * 1_000_000
|
||||
val_as_float = float(val[:-1]) * 1_000_000
|
||||
# Convert from thousands
|
||||
elif val.endswith("K"):
|
||||
val = float(val[:-1]) * 1000
|
||||
val_as_float = float(val[:-1]) * 1000
|
||||
else:
|
||||
val = float(val)
|
||||
|
||||
return val
|
||||
val_as_float = float(val)
|
||||
return val_as_float
|
||||
|
||||
|
||||
def int_or_round_float(x):
|
||||
def int_or_round_float(x) -> str:
|
||||
if (x - int(x) < -sys.float_info.epsilon) or (x - int(x) > sys.float_info.epsilon):
|
||||
return " " + str(round(x, 2))
|
||||
|
||||
@@ -221,7 +216,7 @@ def get_next_stock_market_days(last_stock_day, n_next_days) -> list:
|
||||
return l_pred_days
|
||||
|
||||
|
||||
def get_data(tweet) -> hash:
|
||||
def get_data(tweet):
|
||||
if "+" in tweet["created_at"]:
|
||||
s_datetime = tweet["created_at"].split(" +")[0]
|
||||
else:
|
||||
|
||||
@@ -23,7 +23,7 @@ def load_tweets(s_ticker: str, count: int) -> DataFrame:
|
||||
# Request Twitter API
|
||||
response = requests.get(
|
||||
"https://api.twitter.com/1.1/search/tweets.json",
|
||||
params=params,
|
||||
params=params, # type: ignore
|
||||
headers={"authorization": "Bearer " + cfg.API_TWITTER_BEARER_TOKEN},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user