nsarchive 0.1b0__py3-none-any.whl → 0.1b2__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/__init__.py CHANGED
@@ -33,9 +33,10 @@ class EntityInstance:
33
33
  entity = Organization(id)
34
34
 
35
35
  entity.owner = self.get_entity(_data['owner_id'].upper())
36
- entity.members = [
37
- self.get_entity(_id) for _id in _data['members']
38
- ]
36
+
37
+ for _member in _data['members']:
38
+ member = GroupMember(_member['id'])
39
+ member.permissions.__dict__ = _member['permissions']
39
40
 
40
41
  entity.avatar = self.avatars.get(id).read()
41
42
 
@@ -60,9 +61,17 @@ class EntityInstance:
60
61
 
61
62
  if type(entity) == Organization:
62
63
  _data['owner_id'] = entity.owner.id.upper() if entity.owner else "0"
63
- _data['members'] = [ member.id.upper() for member in entity.members ] if entity.members else []
64
+ _data['members'] = []
64
65
  _data['certifications'] = entity.certifications
65
66
 
67
+ for member in entity.members:
68
+ _member = {
69
+ 'id': member.id,
70
+ 'permissions': member.permissions.__dict__.copy()
71
+ }
72
+
73
+ _data['members'] += _member
74
+
66
75
  self.avatars.put(name = entity.id, data = entity.avatar)
67
76
  elif type(entity) == User:
68
77
  _data['xp'] = entity.xp
@@ -205,8 +214,8 @@ class RepublicInstance:
205
214
  archives = self.mandate if current_mandate else self.archives
206
215
 
207
216
  _contributions = archives.fetch({'author': id, 'type': 'contrib'}).items
208
- _mandates = archives.fetch({'target': id, 'type': 'election'}).items()\
209
- + archives.fetch({'target': id, 'type': 'promotion'}).items()
217
+ _mandates = archives.fetch({'target': id, 'type': 'election'}).items\
218
+ + archives.fetch({'target': id, 'type': 'promotion'}).items
210
219
 
211
220
  user = FunctionalUser(id)
212
221
  for mandate in _mandates:
@@ -283,7 +292,7 @@ class RepublicInstance:
283
292
  self.functions.put(key = 'MIN_OUT', data = { 'users': [ institutions.government.outer_minister.id ] })
284
293
 
285
294
  def new_mandate(self, institutions: Institutions, weeks: int = 4):
286
- for item in self.mandate.fetch().items():
295
+ for item in self.mandate.fetch().items:
287
296
  if item['date'] >= round(time.time()) - weeks * 604800:
288
297
  self.mandate.delete(item['id'])
289
298
 
nsarchive/cls/entities.py CHANGED
@@ -56,11 +56,11 @@ class MemberPermissions:
56
56
  for perm in permissions.values():
57
57
  self.__setattr__(*perm)
58
58
 
59
- class GroupMember(User):
59
+ class GroupMember():
60
60
  def __init__(self, id: str) -> None:
61
- super().__init__(id)
62
-
61
+ self.id = id
63
62
  self.permissions: MemberPermissions = MemberPermissions()
63
+ self.position: str = 'membre'
64
64
 
65
65
  class FunctionalUser:
66
66
  def __init__(self, id: str) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nsarchive
3
- Version: 0.1b0
3
+ Version: 0.1b2
4
4
  Summary:
5
5
  License: GPL-3.0
6
6
  Author: happex
@@ -11,6 +11,8 @@ Classifier: Programming Language :: Python :: 3
11
11
  Classifier: Programming Language :: Python :: 3.10
12
12
  Classifier: Programming Language :: Python :: 3.11
13
13
  Classifier: Programming Language :: Python :: 3.12
14
+ Requires-Dist: deta (>=1.2,<2.0)
15
+ Requires-Dist: pillow (>=10.4,<11.0)
14
16
  Description-Content-Type: text/markdown
15
17
 
16
18
  # nsarchive
@@ -1,12 +1,12 @@
1
- nsarchive/__init__.py,sha256=Y-I47MuPc8FIHIhvt8RZ-t5TXAi7APD0XlfEjqevfjk,15273
1
+ nsarchive/__init__.py,sha256=bZvn2TDKBxMmPst7PJY8SqYIYUxRTeDA6QLDI7JJpss,15528
2
2
  nsarchive/assets/default_avatar.png,sha256=n-4vG_WPke8LvbY3ZU6oA-H-OtRoIu7woKnRq9DCIlI,51764
3
3
  nsarchive/cls/archives.py,sha256=5C66pXuXAANRXNDqNTvIepRtUrXIWOL7ymmYiBHsHAY,1720
4
4
  nsarchive/cls/bank.py,sha256=OactEpRn8PGv7BwnBUbMpzgHqrvv4yx526AMzh9uBO8,220
5
- nsarchive/cls/entities.py,sha256=u5u46HzHJp2H_DngLALLgedHaLXlJpjhmxU_Ggozp3Q,3474
5
+ nsarchive/cls/entities.py,sha256=Gv6nNEmLXyUokQfoQgNUIjq0kLTTlPT0Wmdpw83z7gY,3499
6
6
  nsarchive/cls/exceptions.py,sha256=UZ7G7AFUN5OkKAGpNl1OT7jauF1jC7WW8wWXVFt5sMs,539
7
7
  nsarchive/cls/republic.py,sha256=aY79B5PZF5IErwzEjn9ito6T8gXA4trm6LmIeYu6XLM,1821
8
8
  nsarchive/utils/assets.py,sha256=hd0STSpa0yT-OJlUyI_wCYXJqcBiUMQds2pZTXNNg9c,382
9
- nsarchive-0.1b0.dist-info/LICENSE,sha256=aFLFZg6LEJFpTlNQ8su3__jw4GfV-xWBmC1cePkKZVw,35802
10
- nsarchive-0.1b0.dist-info/METADATA,sha256=rvpiq-iES71BGQ2r4pUmSPeItUkt0KW6u-XqZExWNXk,5559
11
- nsarchive-0.1b0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
12
- nsarchive-0.1b0.dist-info/RECORD,,
9
+ nsarchive-0.1b2.dist-info/LICENSE,sha256=aFLFZg6LEJFpTlNQ8su3__jw4GfV-xWBmC1cePkKZVw,35802
10
+ nsarchive-0.1b2.dist-info/METADATA,sha256=EXX1Thjma4a5aH4IZIVO5yKb3qexLml59ryC_C8YOj8,5629
11
+ nsarchive-0.1b2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
12
+ nsarchive-0.1b2.dist-info/RECORD,,