luxorasap 0.1.31__tar.gz → 0.1.33__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {luxorasap-0.1.31 → luxorasap-0.1.33}/PKG-INFO +1 -1
- {luxorasap-0.1.31 → luxorasap-0.1.33}/pyproject.toml +2 -2
- {luxorasap-0.1.31 → luxorasap-0.1.33}/src/luxorasap/__init__.py +1 -1
- {luxorasap-0.1.31 → luxorasap-0.1.33}/src/luxorasap/ingest/legacy_local/dataloader.py +7 -4
- luxorasap-0.1.33/src/luxorasap/utils/tools/__init__.py +2 -0
- luxorasap-0.1.33/src/luxorasap/utils/tools/excel.py +27 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/src/luxorasap.egg-info/PKG-INFO +1 -1
- {luxorasap-0.1.31 → luxorasap-0.1.33}/src/luxorasap.egg-info/SOURCES.txt +2 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/README.md +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/setup.cfg +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/src/luxorasap/btgapi/__init__.py +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/src/luxorasap/btgapi/auth.py +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/src/luxorasap/btgapi/reports.py +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/src/luxorasap/btgapi/trades.py +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/src/luxorasap/datareader/__init__.py +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/src/luxorasap/datareader/core.py +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/src/luxorasap/ingest/__init__.py +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/src/luxorasap/ingest/cloud/__init__.py +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/src/luxorasap/utils/__init__.py +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/src/luxorasap/utils/dataframe/__init__.py +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/src/luxorasap/utils/dataframe/reader.py +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/src/luxorasap/utils/dataframe/transforms.py +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/src/luxorasap/utils/storage/__init__.py +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/src/luxorasap/utils/storage/blob.py +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/src/luxorasap.egg-info/dependency_links.txt +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/src/luxorasap.egg-info/entry_points.txt +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/src/luxorasap.egg-info/requires.txt +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/src/luxorasap.egg-info/top_level.txt +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/tests/test_btgapi_auth.py +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/tests/test_btgapi_reports.py +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/tests/test_btgapi_trades.py +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/tests/test_datareader.py +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/tests/test_ingest_cloud.py +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/tests/test_ingest_legacy_local.py +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/tests/test_utils_dataframe.py +0 -0
- {luxorasap-0.1.31 → luxorasap-0.1.33}/tests/test_utils_storage.py +0 -0
|
@@ -10,7 +10,7 @@ build-backend = "setuptools.build_meta"
|
|
|
10
10
|
#############################
|
|
11
11
|
[project]
|
|
12
12
|
name = "luxorasap"
|
|
13
|
-
version = "0.1.
|
|
13
|
+
version = "0.1.33"
|
|
14
14
|
description = "Toolbox da Luxor para ingestão, análise e automação de dados financeiros."
|
|
15
15
|
readme = "README.md"
|
|
16
16
|
requires-python = ">=3.9"
|
|
@@ -78,7 +78,7 @@ exclude = ["tests*"]
|
|
|
78
78
|
# bumpver (sem-ver)
|
|
79
79
|
#############################
|
|
80
80
|
[tool.bumpver]
|
|
81
|
-
current_version = "0.1.
|
|
81
|
+
current_version = "0.1.33"
|
|
82
82
|
version_pattern = "MAJOR.MINOR.PATCH"
|
|
83
83
|
|
|
84
84
|
# regex explícito – obrigatório no bumpver 2024+
|
|
@@ -13,7 +13,7 @@ from types import ModuleType
|
|
|
13
13
|
try:
|
|
14
14
|
__version__: str = metadata.version(__name__)
|
|
15
15
|
except metadata.PackageNotFoundError: # editable install
|
|
16
|
-
__version__ = "0.1.
|
|
16
|
+
__version__ = "0.1.33"
|
|
17
17
|
|
|
18
18
|
# ─── Lazy loader ─────────────────────────────────────────────────
|
|
19
19
|
def __getattr__(name: str) -> ModuleType:
|
|
@@ -16,6 +16,7 @@ load_dotenv()
|
|
|
16
16
|
from luxorasap.datareader import LuxorQuery
|
|
17
17
|
from luxorasap.utils.dataframe import transforms
|
|
18
18
|
from luxorasap.ingest import save_table
|
|
19
|
+
from luxorasap.utils.tools.excel import close_excel_worksheet
|
|
19
20
|
|
|
20
21
|
import warnings
|
|
21
22
|
warnings.warn(
|
|
@@ -48,7 +49,7 @@ class DataLoader:
|
|
|
48
49
|
|
|
49
50
|
|
|
50
51
|
def add_file_tracker(self, tracked_file_path, filetype="excel", sheet_names={},
|
|
51
|
-
excel_size_limit = None,index=False, index_name="index",normalize_columns=False):
|
|
52
|
+
excel_size_limit = None,index=False, index_name="index", normalize_columns=False):
|
|
52
53
|
""" Adiciona arquivo na lista para checar por alteracao
|
|
53
54
|
Args:
|
|
54
55
|
tracked_file_path (pathlib.Path): caminho completo ate o arquivo,
|
|
@@ -104,7 +105,7 @@ class DataLoader:
|
|
|
104
105
|
self.tracked_files[tracked_file_path]["last_mtime"] = file_mtime
|
|
105
106
|
|
|
106
107
|
|
|
107
|
-
def load_file_if_modified(self, tracked_file_path, export_to_blob=False, blob_directory='enriched/parquet'):
|
|
108
|
+
def load_file_if_modified(self, tracked_file_path, export_to_blob=False, blob_directory='enriched/parquet', trials=25):
|
|
108
109
|
"""Carrega arquivo no caminho indicado, carregando na base de dados caso modificado.
|
|
109
110
|
Args:
|
|
110
111
|
tracked_file_path (pathlib.Path): caminho ate o arquivo(cadastro previamente por add_file_tracker)
|
|
@@ -125,7 +126,6 @@ class DataLoader:
|
|
|
125
126
|
|
|
126
127
|
# tables sera sempre um dicionario de tabelas
|
|
127
128
|
tables = None
|
|
128
|
-
trials = 25
|
|
129
129
|
t_counter = 1
|
|
130
130
|
while trials - t_counter > 0:
|
|
131
131
|
try:
|
|
@@ -134,8 +134,11 @@ class DataLoader:
|
|
|
134
134
|
except PermissionError:
|
|
135
135
|
|
|
136
136
|
logger.error(f"Erro ao tentar ler arquivo '{tracked_file_path}.\nTentativa {t_counter} de {trials};'.\nSe estiver aberto feche.")
|
|
137
|
-
|
|
137
|
+
|
|
138
138
|
t_counter += 1
|
|
139
|
+
if trials - t_counter == 1:
|
|
140
|
+
close_excel_worksheet(tracked_file_path.name, save=True)
|
|
141
|
+
time.sleep(10)
|
|
139
142
|
|
|
140
143
|
for sheet_name, table_data in tables.items():
|
|
141
144
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import win32com.client
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def close_excel_worksheet(filename, save=True):
|
|
7
|
+
"""
|
|
8
|
+
Fecha um arquivo específico do Excel no Windows.
|
|
9
|
+
:param arquivo: Nome do arquivo aberto no Excel (ex: 'Planilha1.xlsx')
|
|
10
|
+
:param salvar: Se True, salva as alterações antes de fechar
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
try:
|
|
14
|
+
excel = win32com.client.Dispatch("Excel.Application")
|
|
15
|
+
for wb in excel.Workbooks:
|
|
16
|
+
if wb.Name.lower() == filename.lower(): # compara ignorando maiúsc/minúsc
|
|
17
|
+
if save:
|
|
18
|
+
wb.Close(SaveChanges=1) # 1 = salvar alterações
|
|
19
|
+
print(f"O arquivo {filename} foi salvo e fechado com sucesso no Windows.")
|
|
20
|
+
else:
|
|
21
|
+
wb.Close(SaveChanges=0) # 0 = fechar sem salvar
|
|
22
|
+
print(f"O arquivo {filename} foi fechado sem salvar no Windows.")
|
|
23
|
+
return
|
|
24
|
+
print(f"O arquivo {filename} não estava aberto no Excel.")
|
|
25
|
+
except Exception as e:
|
|
26
|
+
print(f"Erro ao tentar fechar {filename} no Windows: {e}")
|
|
27
|
+
|
|
@@ -22,6 +22,8 @@ src/luxorasap/utils/dataframe/reader.py
|
|
|
22
22
|
src/luxorasap/utils/dataframe/transforms.py
|
|
23
23
|
src/luxorasap/utils/storage/__init__.py
|
|
24
24
|
src/luxorasap/utils/storage/blob.py
|
|
25
|
+
src/luxorasap/utils/tools/__init__.py
|
|
26
|
+
src/luxorasap/utils/tools/excel.py
|
|
25
27
|
tests/test_btgapi_auth.py
|
|
26
28
|
tests/test_btgapi_reports.py
|
|
27
29
|
tests/test_btgapi_trades.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|