xloft 0.1.8__py3-none-any.whl → 0.1.9__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.

Potentially problematic release.


This version of xloft might be problematic. Click here for more details.

xloft/namedtuple.py CHANGED
@@ -14,14 +14,15 @@ class NamedTuple:
14
14
  VAR_NAME_FOR_KEYS_LIST: str = "_jWjSaNy1RbtQinsN_keys"
15
15
 
16
16
  def __init__(self, **kwargs: dict[str, Any]) -> None: # noqa: D107
17
- self.__dict__[NamedTuple.VAR_NAME_FOR_KEYS_LIST] = []
17
+ vnkl = self.__class__.VAR_NAME_FOR_KEYS_LIST
18
+ self.__dict__[vnkl] = []
18
19
  for name, value in kwargs.items():
19
20
  self.__dict__[name] = value
20
- self.__dict__[NamedTuple.VAR_NAME_FOR_KEYS_LIST].append(name)
21
+ self.__dict__[vnkl].append(name)
21
22
 
22
23
  def __len__(self) -> int:
23
24
  """Get the number of elements."""
24
- return len(self.__dict__[NamedTuple.VAR_NAME_FOR_KEYS_LIST])
25
+ return len(self.__dict__[self.__class__.VAR_NAME_FOR_KEYS_LIST])
25
26
 
26
27
  def __getattr__(self, name: str) -> Any:
27
28
  """Getter."""
@@ -47,7 +48,7 @@ class NamedTuple:
47
48
 
48
49
  Attention: This is an uncharacteristic action for the type `tuple`.
49
50
  """
50
- keys: list[str] = self.__dict__[NamedTuple.VAR_NAME_FOR_KEYS_LIST]
51
+ keys: list[str] = self.__dict__[self.__class__.VAR_NAME_FOR_KEYS_LIST]
51
52
  if not key in keys:
52
53
  err_msg = f"The key `{key}` is missing!"
53
54
  raise KeyError(err_msg)
@@ -55,26 +56,26 @@ class NamedTuple:
55
56
 
56
57
  def to_dict(self) -> dict[str, Any]:
57
58
  """Convert to the dictionary."""
58
- keys: list[str] = self.__dict__[NamedTuple.VAR_NAME_FOR_KEYS_LIST]
59
+ keys: list[str] = self.__dict__[self.__class__.VAR_NAME_FOR_KEYS_LIST]
59
60
  return {key: self.__dict__[key] for key in keys}
60
61
 
61
62
  def items(self) -> list[tuple[str, Any]]:
62
63
  """Return a set-like object providing a view on the NamedTuple's items."""
63
- keys: list[str] = self.__dict__[NamedTuple.VAR_NAME_FOR_KEYS_LIST]
64
+ keys: list[str] = self.__dict__[self.__class__.VAR_NAME_FOR_KEYS_LIST]
64
65
  return [(key, self.__dict__[key]) for key in keys]
65
66
 
66
67
  def keys(self) -> list[str]:
67
68
  """Get a list of keys."""
68
- return self.__dict__[NamedTuple.VAR_NAME_FOR_KEYS_LIST]
69
+ return self.__dict__[self.__class__.VAR_NAME_FOR_KEYS_LIST]
69
70
 
70
71
  def values(self) -> list[Any]:
71
72
  """Get a list of values."""
72
- keys: list[str] = self.__dict__[NamedTuple.VAR_NAME_FOR_KEYS_LIST]
73
+ keys: list[str] = self.__dict__[self.__class__.VAR_NAME_FOR_KEYS_LIST]
73
74
  return [self.__dict__[key] for key in keys]
74
75
 
75
76
  def has_key(self, key: str) -> bool:
76
77
  """Returns True if the key exists, otherwise False."""
77
- keys: list[str] = self.__dict__[NamedTuple.VAR_NAME_FOR_KEYS_LIST]
78
+ keys: list[str] = self.__dict__[self.__class__.VAR_NAME_FOR_KEYS_LIST]
78
79
  return key in keys
79
80
 
80
81
  def has_value(self, value: Any) -> bool:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xloft
3
- Version: 0.1.8
3
+ Version: 0.1.9
4
4
  Summary: (XLOFT) X-Library of tools
5
5
  Project-URL: Homepage, https://github.com/kebasyaty/xloft
6
6
  Project-URL: Repository, https://github.com/kebasyaty/xloft
@@ -0,0 +1,8 @@
1
+ xloft/__init__.py,sha256=yV847dKh9ROtw1fX5NHvPaHN-9cHYOfu9URQ--OVKXw,107
2
+ xloft/errors.py,sha256=GYXvi2l01VUDQSs6skiOfQsKLF6tFuUhJMqNkL7BJNI,857
3
+ xloft/namedtuple.py,sha256=rUTa_9pwZUR3ISGDtTuOJ_ifdiqClNMOD0NSRlNkdyk,2953
4
+ xloft/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ xloft-0.1.9.dist-info/METADATA,sha256=BkI8nk28um9CQ0l1p6vqyzefT38sJsi9_Db05HeR7TI,5677
6
+ xloft-0.1.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
+ xloft-0.1.9.dist-info/licenses/LICENSE,sha256=2zZINd6m_jNYlowdQImlEizyhSui5cBAJZRhWQURcEc,1095
8
+ xloft-0.1.9.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- xloft/__init__.py,sha256=yV847dKh9ROtw1fX5NHvPaHN-9cHYOfu9URQ--OVKXw,107
2
- xloft/errors.py,sha256=GYXvi2l01VUDQSs6skiOfQsKLF6tFuUhJMqNkL7BJNI,857
3
- xloft/namedtuple.py,sha256=PVj9DJDo01mU91EgBcyIx3XFRs0iKTjEv_wfq1A1CKA,2929
4
- xloft/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- xloft-0.1.8.dist-info/METADATA,sha256=ga-tZTK076ryrQuqiFFMn0EiBs-9Nary09uycdwt-tQ,5677
6
- xloft-0.1.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
- xloft-0.1.8.dist-info/licenses/LICENSE,sha256=2zZINd6m_jNYlowdQImlEizyhSui5cBAJZRhWQURcEc,1095
8
- xloft-0.1.8.dist-info/RECORD,,
File without changes