table-stream 0.2.7__tar.gz → 0.2.8__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.
@@ -1,10 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: table_stream
3
- Version: 0.2.7
3
+ Version: 0.2.8
4
4
  Summary: Tipos de dados e implementações para o uso em tabelas.
5
5
  Requires-Python: >=3.12
6
6
  Description-Content-Type: text/markdown
7
7
  Requires-Dist: openpyxl>=3.1.5
8
8
  Requires-Dist: pandas>=3.0.0
9
+ Requires-Dist: pandas-stubs~=3.0.0
9
10
 
10
11
  # table_stream
@@ -1,12 +1,13 @@
1
1
  [project]
2
2
  name = "table_stream"
3
- version = "0.2.7"
3
+ version = "0.2.8"
4
4
  description = "Tipos de dados e implementações para o uso em tabelas."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
7
7
  dependencies = [
8
8
  "openpyxl>=3.1.5",
9
9
  "pandas>=3.0.0",
10
+ "pandas-stubs~=3.0.0",
10
11
  ]
11
12
 
12
13
  [dependency-groups]
@@ -1,14 +1,13 @@
1
1
  from __future__ import annotations
2
- from collections.abc import Iterable
2
+ #from collections.abc import Iterable
3
3
 
4
- from abc import abstractmethod, ABC, ABCMeta
4
+ from abc import abstractmethod, ABC #ABCMeta
5
5
  from typing import (
6
6
  Any,
7
7
  Callable,
8
8
  Union,
9
9
  Literal,
10
10
  Optional,
11
- Type,
12
11
  TypeVar,
13
12
  NewType,
14
13
  Protocol,
@@ -27,9 +26,11 @@ from zipfile import ZipFile
27
26
 
28
27
  import json
29
28
  from pandas import DataFrame
30
- from pandas import Series
29
+ #from pandas import Series
31
30
  import pandas as pd
32
31
 
32
+ __version__ = "0.2.8"
33
+
33
34
  T = TypeVar("T")
34
35
  K = TypeVar("K")
35
36
  V = TypeVar("V", contravariant=True)
@@ -57,7 +58,7 @@ stateName = Literal[
57
58
  "success",
58
59
  "stopped",
59
60
  "running",
60
- "not_incialized",
61
+ "not_inicialized",
61
62
  ]
62
63
 
63
64
  MOD_ODF: bool = False
@@ -885,9 +886,7 @@ class Listener[NOTIFIER](ABC):
885
886
 
886
887
  def __init__(self) -> None:
887
888
  super().__init__()
888
- self.func_read_notifier: Callable[[type[NOTIFIER]], NOTIFIER] = (
889
- self._read_notifier
890
- )
889
+ self.fn_read: Callable[[type[NOTIFIER]], NOTIFIER] = self._read_notifier
891
890
 
892
891
  # Notifiers já observados por este Consumer (evita registrar o
893
892
  # mesmo listener duas vezes a cada build(), e permite unwatch_all()).
@@ -895,10 +894,12 @@ class Listener[NOTIFIER](ABC):
895
894
  self.type_notifier: type[NOTIFIER] = None
896
895
 
897
896
  def _read_notifier(self, type_notifier: type[NOTIFIER]) -> NOTIFIER:
897
+ if self.type_notifier is None:
898
+ raise ValueError(f"Nenhum notificador foi definido em ... {__class__.__name__}()")
898
899
  return self._watched[type_notifier]
899
900
 
900
901
  def read(self) -> NOTIFIER:
901
- return self.func_read_notifier(self.type_notifier)
902
+ return self.fn_read(self.type_notifier)
902
903
 
903
904
  def watch(self, notifier: NOTIFIER) -> NOTIFIER:
904
905
  self.type_notifier = type(notifier)
@@ -987,10 +988,10 @@ class EventState(ABC):
987
988
  estado para o ThreadStateContext (self._context._set_state(...)).
988
989
  """
989
990
 
990
- name: str = "abstract"
991
+ name: stateName = "abstract"
991
992
 
992
993
  def __init__(self) -> None:
993
- self._state_name: stateName = "not_incialized"
994
+ self._state_name: stateName = "not_inicialized"
994
995
 
995
996
  def __repr__(self) -> str:
996
997
  return f"<{self.__class__.__name__}()>"
@@ -1050,11 +1051,11 @@ class EventState(ABC):
1050
1051
  class NotInicializedState(EventState):
1051
1052
  """Estado inicial. Nenhum trabalho começou ainda."""
1052
1053
 
1053
- name = "not_started"
1054
+ name: stateName = "not_inicialized"
1054
1055
 
1055
1056
  def __init__(self) -> None:
1056
1057
  super().__init__()
1057
- self._state_name = "not_incialized"
1058
+ self._state_name: stateName = "not_inicialized"
1058
1059
 
1059
1060
  def start(self, context: StateValue) -> None:
1060
1061
  context.set_state(RunningState())
@@ -1182,11 +1183,11 @@ class StopState(EventState):
1182
1183
 
1183
1184
  class StateValue[V]:
1184
1185
 
1185
- def __init__(self, on_finish: Callable[[StateValue]] = None) -> None:
1186
+ def __init__(self, on_finish: Callable[[StateValue], None] | None = None) -> None:
1186
1187
  super().__init__()
1187
1188
 
1188
1189
  self._state: EventState = NotInicializedState()
1189
- self.on_finish: Callable[[StateValue]] = on_finish
1190
+ self.on_finish: Callable[[StateValue], None] | None = on_finish
1190
1191
 
1191
1192
  self._exception: Exception | None = None
1192
1193
  self.msg_error: str | None = None
@@ -1209,7 +1210,7 @@ class StateValue[V]:
1209
1210
  def set_state(self, new_state: EventState) -> None:
1210
1211
  self._state = new_state
1211
1212
 
1212
- def execute_command(self, cmd: Callable[[StateValue]] | None) -> None:
1213
+ def execute_command(self, cmd: Callable[[StateValue], None] | None) -> None:
1213
1214
  if cmd is not None:
1214
1215
  cmd(self)
1215
1216
 
@@ -1,10 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: table_stream
3
- Version: 0.2.7
3
+ Version: 0.2.8
4
4
  Summary: Tipos de dados e implementações para o uso em tabelas.
5
5
  Requires-Python: >=3.12
6
6
  Description-Content-Type: text/markdown
7
7
  Requires-Dist: openpyxl>=3.1.5
8
8
  Requires-Dist: pandas>=3.0.0
9
+ Requires-Dist: pandas-stubs~=3.0.0
9
10
 
10
11
  # table_stream
@@ -1,7 +1,6 @@
1
1
  README.md
2
2
  pyproject.toml
3
3
  table_stream/__init__.py
4
- table_stream/erros.py
5
4
  table_stream.egg-info/PKG-INFO
6
5
  table_stream.egg-info/SOURCES.txt
7
6
  table_stream.egg-info/dependency_links.txt
@@ -1,2 +1,3 @@
1
1
  openpyxl>=3.1.5
2
2
  pandas>=3.0.0
3
+ pandas-stubs~=3.0.0
@@ -1,162 +0,0 @@
1
- class CoreException(Exception):
2
-
3
- def __init__(self, message: str = f"Erro") -> None:
4
- super().__init__(message)
5
- self._message = message
6
-
7
- def get_message(self) -> str:
8
- return self._message
9
-
10
- def set_message(self, message: str) -> None:
11
- self._message = message
12
- super().__init__(f"{__class__.__name__}: {message}")
13
-
14
- def launch_exception_handler(self) -> None:
15
- raise self
16
-
17
-
18
- class ValueNotifyNullError(CoreException):
19
-
20
- def __init__(self, message: str = "Notificação nula...") -> None:
21
- super().__init__(message)
22
-
23
-
24
- class UnsuportedSheetError(CoreException):
25
-
26
- def __init__(self, message: str = "Planilha inválida...") -> None:
27
- super().__init__(message)
28
-
29
-
30
- # ============================================================#
31
- # Erros relacionados a HashMap
32
- # ============================================================#
33
-
34
-
35
- class InvalidHashMapTableError(CoreException):
36
-
37
- def __init__(self, message: str = "HashMap inválido") -> None:
38
- super().__init__(message)
39
-
40
-
41
- class InvalidBodyTableError(InvalidHashMapTableError):
42
-
43
- def __init__(self, message: str = "Erro corpo de tabela inválido") -> None:
44
- super().__init__(message)
45
-
46
-
47
- class SizeTableError(InvalidHashMapTableError):
48
-
49
- def __init__(self, message: str = "Tamanho de tabela inválido") -> None:
50
- super().__init__(message)
51
-
52
-
53
- # ============================================================#
54
- # Erros relacionados a planilhas
55
- # ============================================================#
56
- class UndefinedSheetIndex(CoreException):
57
-
58
- def __init__(self, message: str = "SheetIndexNames não foi definido") -> None:
59
- super().__init__(message)
60
-
61
-
62
- class LoadWorkbookError(CoreException):
63
-
64
- def __init__(self, message: str = "Erro ao tentar ler Workbook") -> None:
65
- super().__init__(message)
66
-
67
-
68
- # ============================================================#
69
- # Erros relacionados a arquivos/bytes de imagem (.png, .jpg, ...)
70
- # ============================================================#
71
- class InvalidSourceImageError(CoreException):
72
-
73
- def __init__(self, message: str = "Erro, use bytes de imagem") -> None:
74
- super().__init__(message)
75
-
76
-
77
- # ============================================================#
78
- # Erros relacionados a módulos
79
- # ============================================================#
80
- class NotImplementedModuleError(CoreException):
81
-
82
- def __init__(self, message: str = "Erro, módulo não implementado") -> None:
83
- super().__init__(message)
84
-
85
-
86
- class NotImplementedModuleImageError(NotImplementedModuleError):
87
-
88
- def __init__(self, message: str = "Erro, módulo IMAGEM não implementado") -> None:
89
- super().__init__(message)
90
-
91
-
92
- class NotImplementedModulePdfError(NotImplementedModuleError):
93
-
94
- def __init__(self, message: str = "Erro, módulo PDF não implementado") -> None:
95
- super().__init__(message)
96
-
97
-
98
- class NotImplementedInvertColor(NotImplementedError):
99
-
100
- def __init__(
101
- self, message: str = "Adaptador InvertColor não implementado..."
102
- ) -> None:
103
- super().__init__(message)
104
-
105
-
106
- # ============================================================#
107
- # Erros relacionados a tabelas
108
- # ============================================================#
109
-
110
-
111
- class ColumnNotFoudError(ValueError):
112
-
113
- def __init__(self, *args: object) -> None:
114
- super().__init__(*args)
115
-
116
-
117
- class ColumnExistsError(ValueError):
118
-
119
- def __init__(self, *args: object) -> None:
120
- super().__init__(*args)
121
-
122
-
123
- class ColumnNotIqualSizeError(ValueError):
124
-
125
- def __init__(self, *args: object) -> None:
126
- super().__init__(*args)
127
-
128
-
129
- class EmptyRowError(Exception):
130
-
131
- def __init__(self, *args: object) -> None:
132
- super().__init__(*args)
133
-
134
-
135
- class TableEmptyError(Exception):
136
-
137
- def __init__(self, *args: object) -> None:
138
- super().__init__(*args)
139
-
140
-
141
- class HeadersSizeNotIqualError(Exception):
142
-
143
- def __init__(self, *args: object) -> None:
144
- super().__init__(*args)
145
-
146
-
147
- class ListTablesEmptyError(ValueError):
148
-
149
- def __init__(self, *args: object) -> None:
150
- super().__init__(*args)
151
-
152
-
153
- class ColumnNotFoundError(ValueError):
154
-
155
- def __init__(self, *args: object) -> None:
156
- super().__init__(*args)
157
-
158
-
159
- class RowNotExistError(ValueError):
160
-
161
- def __init__(self, *args: object) -> None:
162
- super().__init__(*args)
File without changes
File without changes