Skip to content

Commit

Permalink
Hotfix/fix black (#4101)
Browse files Browse the repository at this point in the history
* Fix plot look when using eval and add query to choices (#3881)

* convert index to datetime and update choices

* uncomment economy integration test

* fix treasury concat bug

* fix datasets concat on duplciates

* Lock ruff version so that new lints dont break our CI (#3905)

* Lock ruff version so that new lints dont break our CI

* Bumped pre-commit ruff version

* returning always a dataframe

* Revert "returning always a dataframe"

This reverts commit d5dbf31.

* black everything

---------
  • Loading branch information
hjoaquim authored Feb 1, 2023
1 parent cf636a1 commit a37d903
Show file tree
Hide file tree
Showing 117 changed files with 5 additions and 223 deletions.
3 changes: 0 additions & 3 deletions openbb_terminal/common/behavioural_analysis/reddit_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,6 @@ def get_spac(

try:
for submission in submissions:

# Get more information about post using PRAW api
submission = praw_api.submission(id=submission.id)

Expand Down Expand Up @@ -814,13 +813,11 @@ def get_due_dilligence(

# Ensure that the post hasn't been removed in the meanwhile
if not submission.removed_by_category:

# Either just filter out Yolo, and Meme flairs, or focus on DD, based on b_DD flag
if (
submission.link_flair_text in l_flair_text,
submission.link_flair_text not in ["Yolo", "Meme"],
)[show_all_flairs]:

s_datetime = datetime.utcfromtimestamp(
submission.created_utc
).strftime("%Y-%m-%d %H:%M:%S")
Expand Down
1 change: 0 additions & 1 deletion openbb_terminal/common/quantitative_analysis/qa_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ def get_var(
std = data_return.std(axis=0)

if adjusted_var:

# Kurtosis
# Measures height and sharpness of the central peak relative to that of a standard bell curve
k = data_return.kurtosis(axis=0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ def convert_list_to_test_files(path_list: List[str]) -> List[Path]:
test_files = []

for path in path_list:

if path.startswith(
str(Path("openbb_terminal", "core", "integration_tests", "scripts"))
):
Expand Down Expand Up @@ -377,7 +376,6 @@ def run_test_files(
fails: Dict[str, Dict[str, Any]] = {}

if test_files:

n = len(test_files)

start = time.time()
Expand Down Expand Up @@ -407,7 +405,6 @@ def run_test_files(
style="bold",
)
with Pool(processes=subprocesses) as pool:

# Choosing chunksize: line 477 .../lib/python3.9/multiprocessing/pool.py
chunksize, extra = divmod(n, subprocesses * 4)
if extra:
Expand All @@ -424,7 +421,6 @@ def run_test_files(
chunksize=chunksize,
)
):

file_short_name, exception = result
if exception:
n_failures += 1
Expand Down Expand Up @@ -501,7 +497,6 @@ def display_summary(
console.print("\n" + to_section_title("integration test summary"))

for file, exception in fails.items():

# Assuming the broken command is the last one called in the traceback
broken_cmd = "unknown"
frame: FrameSummary
Expand Down
2 changes: 0 additions & 2 deletions openbb_terminal/core/library/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ def about(self):


class OperationLogger:

last_method: Dict[Any, Any] = {}

def __init__(
Expand Down Expand Up @@ -231,7 +230,6 @@ def __remove_key_and_log_state(func_module: str, function_args: dict) -> dict:
"""

if func_module == "openbb_terminal.keys_model":

from openbb_terminal.core.log.generation.settings_logger import ( # pylint: disable=C0415
log_keys,
)
Expand Down
1 change: 0 additions & 1 deletion openbb_terminal/core/log/generation/settings_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ def log_keys() -> None:
current_keys = {}

for cfg_var_name in var_list:

cfg_var_value = getattr(cfg, cfg_var_name)

if cfg_var_value != "REPLACE_ME":
Expand Down
4 changes: 0 additions & 4 deletions openbb_terminal/cryptocurrency/crypto_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def find(


def _find_CoinGecko(key: str, query: str, limit: int) -> pd.DataFrame:

# pylint: disable=C0415
from openbb_terminal.cryptocurrency.discovery.pycoingecko_model import (
get_coin_list,
Expand All @@ -85,7 +84,6 @@ def _find_CoinGecko(key: str, query: str, limit: int) -> pd.DataFrame:


def _find_CoinPaprika(key: str, query: str, limit: int) -> pd.DataFrame:

# pylint: disable=C0415
from openbb_terminal.cryptocurrency.due_diligence.coinpaprika_model import (
get_coin_list,
Expand All @@ -107,7 +105,6 @@ def _find_CoinPaprika(key: str, query: str, limit: int) -> pd.DataFrame:


def _find_Binance(key: str, query: str, limit: int) -> pd.DataFrame:

# pylint: disable=C0415
from openbb_terminal.cryptocurrency.discovery.pycoingecko_model import (
get_coin_list,
Expand All @@ -134,7 +131,6 @@ def _find_Binance(key: str, query: str, limit: int) -> pd.DataFrame:


def _find_Coinbase(key: str, query: str, limit: int) -> pd.DataFrame:

# pylint: disable=C0415
from openbb_terminal.cryptocurrency.discovery.pycoingecko_model import (
get_coin_list,
Expand Down
1 change: 0 additions & 1 deletion openbb_terminal/cryptocurrency/cryptocurrency_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,6 @@ def display_all_coins(
df.drop("index", axis=1, inplace=True)

else:

if source == "CoinGecko":
coins_df = pycoingecko_model.get_coin_list().drop("index", axis=1)
df = _create_closest_match_df(symbol.lower(), coins_df, limit, cutoff)
Expand Down
1 change: 0 additions & 1 deletion openbb_terminal/cryptocurrency/dataframe_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ def lambda_very_long_number_formatter(num: Union[str, int, float]) -> str:


def prettify_paragraph(text):

# Add tab to the beginning of paragraph
text = "\t" + text
pat = "(?<!\n)\n(?!\n)"
Expand Down
2 changes: 0 additions & 2 deletions openbb_terminal/cryptocurrency/discovery/pycoingecko_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ def get_coins(
sortby: str = "Symbol",
ascend: bool = False,
) -> pd.DataFrame:

"""Get N coins from CoinGecko [Source: CoinGecko]
Parameters
Expand Down Expand Up @@ -248,7 +247,6 @@ def get_gainers_or_losers(
)

if sortby in GAINERS_LOSERS_COLUMNS:

sorted_df = sorted_df[
(sorted_df["Volume [$]"].notna()) & (sorted_df["Market Cap"].notna())
]
Expand Down
2 changes: 0 additions & 2 deletions openbb_terminal/cryptocurrency/discovery/pycoingecko_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ def display_gainers(
df = pycoingecko_model.get_gainers(limit=limit, interval=interval, sortby=sortby)

if not df.empty:

for col in ["Volume [$]", "Market Cap"]:
if col in df.columns:
df[col] = df[col].apply(lambda x: lambda_very_long_number_formatter(x))
Expand Down Expand Up @@ -172,7 +171,6 @@ def display_losers(
df = pycoingecko_model.get_losers(limit=limit, interval=interval, sortby=sortby)

if not df.empty:

for col in ["Volume [$]", "Market Cap"]:
if col in df.columns:
df[col] = df[col].apply(lambda x: lambda_very_long_number_formatter(x))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ def plot_data(
ylabel: str = "",
external_axes: Optional[List[plt.Axes]] = None,
):

# This plot has 2 axes
if not external_axes:
_, axes = plt.subplots(
Expand Down Expand Up @@ -180,7 +179,6 @@ def plot_data_bar(
ylabel: str = "",
external_axes: Optional[List[plt.Axes]] = None,
):

# This plot has 2 axes
if not external_axes:
_, axes = plt.subplots(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,6 @@ def get_exchange_balances(
) # get price TODO: grab data from loaded symbol

if r1.status_code == 200 and r2.status_code == 200 and r3.status_code == 200:

df1 = pd.DataFrame(json.loads(r1.text))
df1.set_index("t", inplace=True)
df1.rename(columns={"v": "stacked"}, inplace=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ def display_marketcap_dominance(
)

if not df.empty:

# This plot has 1 axis
if not external_axes:
_, ax = plt.subplots(figsize=plot_autoscale(), dpi=cfgPlot.PLOT_DPI)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ def get_github_activity(
df = pd.DataFrame()

if response.status_code == 200:

if "getMetric" in response.json()["data"]:
df = pd.DataFrame(response.json()["data"]["getMetric"]["timeseriesData"])
df["datetime"] = pd.to_datetime(df["datetime"])
Expand Down
2 changes: 0 additions & 2 deletions openbb_terminal/cryptocurrency/onchain/bitquery_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ def display_ethereum_unique_senders(

df = bitquery_model.get_ethereum_unique_senders(interval, limit, sortby, ascend)
if not df.empty:

column_names = ["uniqueSenders", "transactions", "maximumGasPrice"]
column_names = prettify_column_names(column_names)

Expand Down Expand Up @@ -391,7 +390,6 @@ def display_spread_for_crypto_pair(
symbol=symbol, to_symbol=to_symbol, limit=limit, sortby=sortby, ascend=ascend
)
if not df.empty:

print_rich_table(
df,
headers=list(df.columns),
Expand Down
1 change: 0 additions & 1 deletion openbb_terminal/cryptocurrency/onchain/blockchain_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ def get_btc_single_block(blockhash: str) -> pd.DataFrame:
data = _blockchain_data_api_make_request(f"rawblock/{blockhash}?format=json")

if data:

df = pd.json_normalize(data)
return df

Expand Down
1 change: 0 additions & 1 deletion openbb_terminal/cryptocurrency/onchain/shroom_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ def get_total_value_locked(
symbol: str = "USDC",
interval: int = 1,
) -> pd.DataFrame:

"""
Get total value locked for a user/name address and symbol
TVL measures the total amount of a token that is locked in a contract.
Expand Down
1 change: 0 additions & 1 deletion openbb_terminal/cryptocurrency/onchain/shroom_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ def display_total_value_locked(
sheet_name: str = None,
external_axes: Optional[List[plt.Axes]] = None,
) -> None:

"""
Get total value locked for a certain address
TVL measures the total amount of a token that is locked in a contract.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ def display_altcoin_index(
if df.empty:
console.print("\nError scraping blockchain central\n")
else:

# This plot has 1 axis
if not external_axes:
_, ax = plt.subplots(figsize=plot_autoscale(), dpi=PLOT_DPI)
Expand Down
1 change: 0 additions & 1 deletion openbb_terminal/cryptocurrency/overview/loanscan_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def display_crypto_rates(
colors = iter(cfg.theme.get_colors(reverse=True))

for asset in assets:

width = df_non_null.loc[(df_non_null.variable == asset)]
# silence Setcopywarnings
pd.options.mode.chained_assignment = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ def call_btcrb(self, other_args: List[str]):
parser, other_args, EXPORT_BOTH_RAW_DATA_AND_FIGURES
)
if ns_parser:

display_btc_rainbow(
start_date=ns_parser.since.strftime("%Y-%m-%d"),
end_date=ns_parser.until.strftime("%Y-%m-%d"),
Expand Down
3 changes: 0 additions & 3 deletions openbb_terminal/cryptocurrency/overview/pycoingecko_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,6 @@ def display_stablecoins(
df = gecko.get_stable_coins(limit, sortby=sortby, ascend=ascend)

if not df.empty:

total_market_cap = int(df["Market_Cap_[$]"].sum())
df.columns = df.columns.str.replace("_", " ")

Expand Down Expand Up @@ -532,7 +531,6 @@ def display_exchanges(
df = gecko.get_exchanges(sortby, ascend)

if not df.empty:

if links is True:
df = df[["Rank", "Name", "Url"]]
else:
Expand Down Expand Up @@ -709,7 +707,6 @@ def display_derivatives(
df = gecko.get_derivatives(sortby=sortby, ascend=ascend)

if not df.empty:

print_rich_table(
df.head(limit),
headers=list(df.columns),
Expand Down
2 changes: 0 additions & 2 deletions openbb_terminal/custom_prompt_toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def __init__(
match_middle: bool = False,
pattern: Optional[Pattern[str]] = None,
) -> None:

assert not (WORD and sentence) # noqa: S101

self.words = words
Expand Down Expand Up @@ -131,7 +130,6 @@ class NestedCompleter(Completer):
def __init__(
self, options: Dict[str, Optional[Completer]], ignore_case: bool = True
) -> None:

self.flags_processed: List = list()
self.original_options = options
self.options = options
Expand Down
1 change: 0 additions & 1 deletion openbb_terminal/dashboards/stream/forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ def on_ticker_change(self):
]

def run(self):

st.title("OpenBB Forecasting") # Title does not like being in a column

r1c1, r1c2, r1c3, r1c4, r1c5 = st.columns([2, 1, 1, 1, 1])
Expand Down
1 change: 0 additions & 1 deletion openbb_terminal/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def log_start_end(func=None, log=None):
def decorator(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):

logging_name = ""

args_passed_in_function = [
Expand Down
2 changes: 0 additions & 2 deletions openbb_terminal/econometrics/econometrics_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -1682,7 +1682,6 @@ def call_granger(self, other_args: List[str]):
)

if ns_parser and ns_parser.ts:

datasetcol_y, datasetcol_x = ns_parser.ts.split(",")

dataset_y, column_y = datasetcol_y.split(".")
Expand Down Expand Up @@ -1737,7 +1736,6 @@ def call_coint(self, other_args: List[str]):
)

if ns_parser:

if ns_parser.ts:
# We are going to pass through a variable number of series, so datasets will be a list of series
if len(ns_parser.ts) > 1:
Expand Down
1 change: 0 additions & 1 deletion openbb_terminal/economy/alphavantage_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def realtime_performance_sector(
)

else:

if external_axes is None:
_, ax = plt.subplots(figsize=plot_autoscale(), dpi=cfp.PLOT_DPI)
elif is_valid_axes_count(external_axes, 1):
Expand Down
2 changes: 0 additions & 2 deletions openbb_terminal/economy/econdb_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ def show_macro_data(
df_rounded.columns = ["_".join(column) for column in df_rounded.columns]

if raw:

print_rich_table(
df_rounded.fillna("-").iloc[-10:],
headers=list(df_rounded.columns),
Expand Down Expand Up @@ -217,7 +216,6 @@ def show_treasuries(
theme.visualize_output()

if raw:

print_rich_table(
treasury_data.iloc[-10:],
headers=list(treasury_data.columns),
Expand Down
Loading

0 comments on commit a37d903

Please sign in to comment.