compuglobal 0.4.1__tar.gz → 0.4.2__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.
Files changed (25) hide show
  1. {compuglobal-0.4.1 → compuglobal-0.4.2}/PKG-INFO +1 -1
  2. {compuglobal-0.4.1 → compuglobal-0.4.2}/compuglobal/__init__.py +1 -1
  3. {compuglobal-0.4.1 → compuglobal-0.4.2}/compuglobal/models/overlay.py +11 -29
  4. {compuglobal-0.4.1 → compuglobal-0.4.2}/LICENSE +0 -0
  5. {compuglobal-0.4.1 → compuglobal-0.4.2}/README.rst +0 -0
  6. {compuglobal-0.4.1 → compuglobal-0.4.2}/compuglobal/aio.py +0 -0
  7. {compuglobal-0.4.1 → compuglobal-0.4.2}/compuglobal/api/__init__.py +0 -0
  8. {compuglobal-0.4.1 → compuglobal-0.4.2}/compuglobal/api/client.py +0 -0
  9. {compuglobal-0.4.1 → compuglobal-0.4.2}/compuglobal/api/config.py +0 -0
  10. {compuglobal-0.4.1 → compuglobal-0.4.2}/compuglobal/api/discovery.py +0 -0
  11. {compuglobal-0.4.1 → compuglobal-0.4.2}/compuglobal/api/endpoint.py +0 -0
  12. {compuglobal-0.4.1 → compuglobal-0.4.2}/compuglobal/api/media.py +0 -0
  13. {compuglobal-0.4.1 → compuglobal-0.4.2}/compuglobal/api/metadata.py +0 -0
  14. {compuglobal-0.4.1 → compuglobal-0.4.2}/compuglobal/errors.py +0 -0
  15. {compuglobal-0.4.1 → compuglobal-0.4.2}/compuglobal/models/__init__.py +0 -0
  16. {compuglobal-0.4.1 → compuglobal-0.4.2}/compuglobal/models/base.py +0 -0
  17. {compuglobal-0.4.1 → compuglobal-0.4.2}/compuglobal/models/comic.py +0 -0
  18. {compuglobal-0.4.1 → compuglobal-0.4.2}/compuglobal/models/episode.py +0 -0
  19. {compuglobal-0.4.1 → compuglobal-0.4.2}/compuglobal/models/font.py +0 -0
  20. {compuglobal-0.4.1 → compuglobal-0.4.2}/compuglobal/models/frame.py +0 -0
  21. {compuglobal-0.4.1 → compuglobal-0.4.2}/compuglobal/models/screencap.py +0 -0
  22. {compuglobal-0.4.1 → compuglobal-0.4.2}/compuglobal/models/stream.py +0 -0
  23. {compuglobal-0.4.1 → compuglobal-0.4.2}/compuglobal/models/subtitle.py +0 -0
  24. {compuglobal-0.4.1 → compuglobal-0.4.2}/compuglobal/models/timestamp.py +0 -0
  25. {compuglobal-0.4.1 → compuglobal-0.4.2}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: compuglobal
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: Python wrapper for the CGHMC API (Frinkiac, Morbotron Master Of All Science and more.
5
5
  Keywords: The Simpsons,Futurama,Rick and Morty,West Wing,Frinkiac,Morbotron,Master of all Science,Capital Beat,API,API Wrapper,CompuGlobal,CompuGlobalHyperMegaNet,CGHMC
6
6
  Author: MitchellAW
@@ -22,7 +22,7 @@ from compuglobal.models.timestamp import Timestamp
22
22
  __title__ = "compuglobal"
23
23
  __author__ = "MitchellAW"
24
24
  __license__ = "MIT"
25
- __version__ = "0.4.1"
25
+ __version__ = "0.4.2"
26
26
 
27
27
  __all__ = [
28
28
  "APIPageStatusError",
@@ -1,13 +1,12 @@
1
1
  """Helper class for formatting of StreamOverlays and ComicOverlays."""
2
2
 
3
- import dataclasses
4
- from dataclasses import dataclass, field
3
+ from pydantic import Field
5
4
 
5
+ from compuglobal.models.base import BaseCompuGlobalModel
6
6
  from compuglobal.models.font import FontAlignment, FontColor, FontFamily
7
7
 
8
8
 
9
- @dataclass(frozen=True)
10
- class OverlayFormat:
9
+ class OverlayFormat(BaseCompuGlobalModel):
11
10
  """The formatting style to use in an overlay.
12
11
 
13
12
  Attributes
@@ -29,33 +28,16 @@ class OverlayFormat:
29
28
 
30
29
  """
31
30
 
32
- font_family: FontFamily = FontFamily.IMPACT
33
- font_size: int = 0
34
- font_color: FontColor = field(default_factory=FontColor)
35
- text_position_x: int = 50
36
- text_position_y: int = 97
37
- text_alignment: FontAlignment = FontAlignment.ALIGN_CENTER
38
- all_caps: bool = True
39
-
40
- def __post_init__(self) -> None:
41
- """Validate font size.
42
-
43
- Raises
44
- ------
45
- ValueError
46
- Font size must be between 0-120
47
-
48
- """
49
- max_font_size = 120
50
- if self.font_size < 0 or self.font_size > max_font_size:
51
- msg = f"Font size must be between 0 and {max_font_size}, but got {self.font_size}"
52
- raise ValueError(msg)
53
-
54
- def _changed_fields(self) -> dict:
55
- return {f.name: getattr(self, f.name) for f in dataclasses.fields(self) if getattr(self, f.name) != f.default}
31
+ font_family: FontFamily = Field(default=FontFamily.IMPACT)
32
+ font_size: int = Field(ge=0, le=120, default=0)
33
+ font_color: FontColor = Field(default=FontColor())
34
+ text_position_x: int = Field(default=50)
35
+ text_position_y: int = Field(default=97)
36
+ text_alignment: FontAlignment = Field(default=FontAlignment.ALIGN_CENTER)
37
+ all_caps: bool = Field(default=True)
56
38
 
57
39
  def __str__(self) -> str: # noqa: D105
58
- return str(self._changed_fields())
40
+ return str(self.model_dump(exclude_defaults=True))
59
41
 
60
42
  @property
61
43
  def font_color_hex(self) -> str:
File without changes
File without changes
File without changes