pyquoks 2.1.0__py3-none-any.whl → 2.1.1__py3-none-any.whl

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.
pyquoks/models.py CHANGED
@@ -1,9 +1,25 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import typing
4
+
3
5
  import pyquoks.utils
4
6
 
5
7
 
6
- class Model:
8
+ class _HasInitialData:
9
+ """
10
+ Assistive class for providing initial data
11
+
12
+ Attributes:
13
+ _data: Initial data that was passed into object
14
+ """
15
+
16
+ _data: typing.Any
17
+
18
+ def __init__(self, data: typing.Any) -> None:
19
+ self._data = data
20
+
21
+
22
+ class Model(_HasInitialData):
7
23
  """
8
24
  Class for storing parameters and models
9
25
 
@@ -11,7 +27,7 @@ class Model:
11
27
 
12
28
  _ATTRIBUTES = {"beatmap_id", "score_id"}
13
29
 
14
- _OBJECTS = {"scores": ScoreModel}
30
+ _OBJECTS = {"beatmap": BeatmapModel}
15
31
 
16
32
  Attributes:
17
33
  _ATTRIBUTES: Set of parameters that stored in this model
@@ -26,7 +42,7 @@ class Model:
26
42
  _data: dict
27
43
 
28
44
  def __init__(self, data: dict) -> None:
29
- self._data = data
45
+ super().__init__(data)
30
46
 
31
47
  if hasattr(self, "_ATTRIBUTES"):
32
48
  if isinstance(self._ATTRIBUTES, set):
@@ -46,7 +62,7 @@ class Model:
46
62
  self._OBJECTS = None
47
63
 
48
64
 
49
- class Container:
65
+ class Container(Model, _HasInitialData):
50
66
  """
51
67
  Class for storing lists of models and another parameters
52
68
 
@@ -74,24 +90,7 @@ class Container:
74
90
  _data: dict
75
91
 
76
92
  def __init__(self, data: dict) -> None:
77
- self._data = data
78
-
79
- if hasattr(self, "_ATTRIBUTES"):
80
- if isinstance(self._ATTRIBUTES, set):
81
- for attribute in self._ATTRIBUTES:
82
- setattr(self, attribute, self._data.get(attribute, None))
83
- else:
84
- self._ATTRIBUTES = None
85
-
86
- if hasattr(self, "_OBJECTS"):
87
- if isinstance(self._OBJECTS, dict):
88
- for attribute, object_class in self._OBJECTS.items():
89
- try:
90
- setattr(self, attribute, object_class(self._data.get(attribute)))
91
- except Exception:
92
- setattr(self, attribute, None)
93
- else:
94
- self._OBJECTS = None
93
+ super().__init__(data)
95
94
 
96
95
  if hasattr(self, "_DATA"):
97
96
  if isinstance(self._DATA, dict):
@@ -104,7 +103,7 @@ class Container:
104
103
  self._DATA = None
105
104
 
106
105
 
107
- class Listing:
106
+ class Listing(_HasInitialData):
108
107
  """
109
108
  Class for storing list of models
110
109
 
@@ -122,7 +121,7 @@ class Listing:
122
121
  _data: list
123
122
 
124
123
  def __init__(self, data: list) -> None:
125
- self._data = data
124
+ super().__init__(data)
126
125
 
127
126
  if hasattr(self, "_DATA"):
128
127
  if isinstance(self._DATA, dict):
pyquoks/utils.py CHANGED
@@ -9,7 +9,7 @@ import psutil
9
9
 
10
10
  class _HasRequiredAttributes:
11
11
  """
12
- Assistive class for checking for required attributes
12
+ Assistive class for checking required attributes
13
13
 
14
14
  **Required attributes**::
15
15
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyquoks
3
- Version: 2.1.0
3
+ Version: 2.1.1
4
4
  Summary: Пакет PyPI для часто используемых модулей в проектах diquoks
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -0,0 +1,10 @@
1
+ pyquoks/__init__.py,sha256=axiG3ptbyRzfPKNrEGSGb9ZeQztdwWOq_LNbJhZDHOs,143
2
+ pyquoks/data.py,sha256=WnrgMO04anzi1e5AiVDSL-JxwjDRLIm4UceVp9cv8p0,16389
3
+ pyquoks/localhost.py,sha256=dn9Dwx0wKRIudPxOIql7JgsDomUtf-bOr7SkZozAbqk,1100
4
+ pyquoks/models.py,sha256=NSrwbL1eOEDz1HnYt_4_Lx95Hj8q2OumvsHWxhD_ygE,4501
5
+ pyquoks/test.py,sha256=i7smDot_13Kzu1gONhLGVFEkXz6x9MFi-_8DBNnRXd4,3060
6
+ pyquoks/utils.py,sha256=AQTVexZxn_-XAVBQjHmwdNM2oKZY4W98ZO1VEzMyVxE,1513
7
+ pyquoks-2.1.1.dist-info/licenses/LICENSE,sha256=eEd8UIYxvKUY7vqrV1XTFo70_FQdiW6o1fznseCXRJs,1095
8
+ pyquoks-2.1.1.dist-info/METADATA,sha256=jX9pAEOvQ6A_UoNHpEkg3wUjLxgdO-B9bFxYNpWm6PI,1714
9
+ pyquoks-2.1.1.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
10
+ pyquoks-2.1.1.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- pyquoks/__init__.py,sha256=axiG3ptbyRzfPKNrEGSGb9ZeQztdwWOq_LNbJhZDHOs,143
2
- pyquoks/data.py,sha256=WnrgMO04anzi1e5AiVDSL-JxwjDRLIm4UceVp9cv8p0,16389
3
- pyquoks/localhost.py,sha256=dn9Dwx0wKRIudPxOIql7JgsDomUtf-bOr7SkZozAbqk,1100
4
- pyquoks/models.py,sha256=XXBWKvGgWvMxSIn6EYoAZ_vx7vct2gyMA7bBO4nwSps,4833
5
- pyquoks/test.py,sha256=i7smDot_13Kzu1gONhLGVFEkXz6x9MFi-_8DBNnRXd4,3060
6
- pyquoks/utils.py,sha256=iAYG56cZ3xjBnR3wzeF-B5ELcx7UTkQi8H1x3W4vCvk,1517
7
- pyquoks-2.1.0.dist-info/licenses/LICENSE,sha256=eEd8UIYxvKUY7vqrV1XTFo70_FQdiW6o1fznseCXRJs,1095
8
- pyquoks-2.1.0.dist-info/METADATA,sha256=OPFRa6UFDe055Pi8QyQMyE3UiEoVaPWkRdtLFNroIUI,1714
9
- pyquoks-2.1.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
10
- pyquoks-2.1.0.dist-info/RECORD,,