nsarchive 2.0.0a3__py3-none-any.whl → 2.0.0a4__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.
nsarchive/cls/base.py CHANGED
@@ -37,7 +37,7 @@ class Instance:
37
37
  def __init__(self, client: Client):
38
38
  self.db = client
39
39
 
40
- def _select_from_db(self, table: str, key: str, value: str) -> dict:
40
+ def _select_from_db(self, table: str, key: str, value: str) -> list:
41
41
  """
42
42
  Récupère des données JSON d'une table Supabase en fonction de l'ID.
43
43
 
@@ -112,11 +112,12 @@ class Instance:
112
112
  matches = []
113
113
 
114
114
  for key, value in query.items():
115
- matches.append(self._select_from_db(table, key, value))
115
+ entity = self._select_from_db(table, key, value)
116
+ if entity is not None: matches.append(entity[0])
116
117
 
117
118
  _res = []
118
119
 
119
- for item in matches[0]:
120
+ for item in matches:
120
121
  if all(item in sublist for sublist in matches[1:]):
121
122
  _res.append(item)
122
123
 
nsarchive/cls/entities.py CHANGED
@@ -29,7 +29,7 @@ class PositionPermissions:
29
29
  self.vote_representatives = False # Participer aux élections législatives
30
30
 
31
31
  def edit(self, **permissions: bool) -> None:
32
- for perm in permissions.values():
32
+ for perm in permissions.items():
33
33
  self.__setattr__(*perm)
34
34
 
35
35
  class Position:
@@ -167,7 +167,8 @@ class EntityInstance(Instance):
167
167
  - `list[Entity | User | Organization]`
168
168
  """
169
169
 
170
- _res = self.fetch('entities', **query)
170
+ _res = self.fetch('individuals', **query)
171
+ _res.extend(self.fetch('organizations', **query))
171
172
 
172
173
  return [ self.get_entity(NSID(entity['id'])) for entity in _res if entity is not None ]
173
174
 
@@ -221,8 +222,8 @@ class EntityInstance(Instance):
221
222
  return None
222
223
 
223
224
  position = Position(id)
224
- position.name = _data['name']
225
- position.permissions.edit(dict(zip(_data['permissions'], True)))
225
+ position.name = _data['title']
226
+ position.permissions.edit(**{ p: True for p in _data['permissions'] })
226
227
 
227
228
  return position
228
229
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nsarchive
3
- Version: 2.0.0a3
3
+ Version: 2.0.0a4
4
4
  Summary: API-wrapper pour récupérer des données liées à Nation
5
5
  License: GPL-3.0
6
6
  Author: happex
@@ -1,16 +1,16 @@
1
1
  nsarchive/__init__.py,sha256=-yXGGJBOkoQo-6Vg6hJVIqr-C7sQyL_LaYcQ3yx9aFs,696
2
2
  nsarchive/assets/default_avatar.png,sha256=n-4vG_WPke8LvbY3ZU6oA-H-OtRoIu7woKnRq9DCIlI,51764
3
3
  nsarchive/cls/archives.py,sha256=HHQhGKdnl7vD5zC8-bbXeQLhp8A98bBlneJTkztOmMg,2007
4
- nsarchive/cls/base.py,sha256=jJOsGgnURxR8YwJiIHgodPOmJ31LOtYDVbz33kIM5Yg,3512
4
+ nsarchive/cls/base.py,sha256=7DRehwuUETaelrVDCQiOx3lZC00XhX5iVIIjTqnlM4s,3564
5
5
  nsarchive/cls/economy.py,sha256=-eV8R5KMXSeXcKEu2G8OP1UgYgb0X6uks0aD2XhlbcU,1220
6
- nsarchive/cls/entities.py,sha256=h5lRLszZQ48As0VzkK3dkXLKOvdrHOFivtTdbMvd5PU,6623
6
+ nsarchive/cls/entities.py,sha256=-88-mfd58PjuTHuOLH9COoa447Dp0e7d70Naa9TS_Ow,6622
7
7
  nsarchive/cls/exceptions.py,sha256=QN6Qn7cxTkGoC4lO50hBAq4gZCgo7scQvCkb-xKl6Xs,692
8
8
  nsarchive/cls/republic.py,sha256=F6il2FrvCoutHxQlW3xM36GaFfIqdorg2jicMAlPdUo,2503
9
9
  nsarchive/instances/_economy.py,sha256=kaFRm6SpWCgvkv-PTVicGztL3e34gSy6WZQDiLZLaT4,6346
10
- nsarchive/instances/_entities.py,sha256=O64MHs_LRbJfuaIOFLKmPi1SIBlQz-aNk95ZzlvGP1k,9765
10
+ nsarchive/instances/_entities.py,sha256=HX1yDqIC5gr0XOx9PpwHbZ42f3WI9P4z9NWhBxNUQFk,9834
11
11
  nsarchive/instances/_republic.py,sha256=TBfgILDJujbp5tiEgbHGnP_uuW1tdAzGUtkwJmuMogE,10063
12
12
  nsarchive/utils/assets.py,sha256=WGC03K1VZ5LwGzcVXbqphtGBZ_Vjso-1hmbIkpgL_X8,382
13
- nsarchive-2.0.0a3.dist-info/LICENSE,sha256=aFLFZg6LEJFpTlNQ8su3__jw4GfV-xWBmC1cePkKZVw,35802
14
- nsarchive-2.0.0a3.dist-info/METADATA,sha256=287bbQVMbfutjiSzRXH-HBXQBVX207tJgOg2Wp90QRs,5697
15
- nsarchive-2.0.0a3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
16
- nsarchive-2.0.0a3.dist-info/RECORD,,
13
+ nsarchive-2.0.0a4.dist-info/LICENSE,sha256=aFLFZg6LEJFpTlNQ8su3__jw4GfV-xWBmC1cePkKZVw,35802
14
+ nsarchive-2.0.0a4.dist-info/METADATA,sha256=C3k5PaWIG3o1gMHFosXOUwGWHytHufq291hxEKqdVQo,5697
15
+ nsarchive-2.0.0a4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
16
+ nsarchive-2.0.0a4.dist-info/RECORD,,