mirror of
https://github.com/farcasclaudiu/xtb-investment-tools.git
synced 2026-06-22 07:01:58 +03:00
Add warning suppression for openpyxl default style in portfolio scripts and tests
This commit is contained in:
@@ -2,6 +2,7 @@ import argparse
|
||||
import contextlib
|
||||
import io
|
||||
import re
|
||||
import warnings
|
||||
from dataclasses import dataclass, field
|
||||
from datetime import datetime, date, timedelta
|
||||
from html import escape
|
||||
@@ -37,6 +38,18 @@ COST_FALLBACK_NOTES = {
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
def suppress_openpyxl_default_style_warning() -> None:
|
||||
warnings.filterwarnings(
|
||||
"ignore",
|
||||
message=r"Workbook contains no default style, apply openpyxl's default",
|
||||
category=UserWarning,
|
||||
module=r"openpyxl\.styles\.stylesheet",
|
||||
)
|
||||
|
||||
|
||||
suppress_openpyxl_default_style_warning()
|
||||
|
||||
# XTB "Type" values that represent trading activity (not cash transfers).
|
||||
TRADE_TYPE_RE = re.compile(
|
||||
r"stock\s*(purchase|sale|buy|sell)|\bopen\b|\bclose\b",
|
||||
|
||||
@@ -2,6 +2,7 @@ import argparse
|
||||
import contextlib
|
||||
import io
|
||||
import re
|
||||
import warnings
|
||||
from dataclasses import dataclass, field
|
||||
from datetime import datetime, date, timedelta
|
||||
from html import escape
|
||||
@@ -37,6 +38,18 @@ COST_FALLBACK_NOTES = {
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
def suppress_openpyxl_default_style_warning() -> None:
|
||||
warnings.filterwarnings(
|
||||
"ignore",
|
||||
message=r"Workbook contains no default style, apply openpyxl's default",
|
||||
category=UserWarning,
|
||||
module=r"openpyxl\.styles\.stylesheet",
|
||||
)
|
||||
|
||||
|
||||
suppress_openpyxl_default_style_warning()
|
||||
|
||||
# XTB "Type" values that represent trading activity (not cash transfers).
|
||||
TRADE_TYPE_RE = re.compile(
|
||||
r"stock\s*(purchase|sale|buy|sell)|\bopen\b|\bclose\b",
|
||||
|
||||
Reference in New Issue
Block a user