nsarchive 1.1.2__py3-none-any.whl → 1.1.4__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 +20 -7
- nsarchive/cls/entities.py +1 -0
- {nsarchive-1.1.2.dist-info → nsarchive-1.1.4.dist-info}/METADATA +1 -1
- {nsarchive-1.1.2.dist-info → nsarchive-1.1.4.dist-info}/RECORD +6 -6
- {nsarchive-1.1.2.dist-info → nsarchive-1.1.4.dist-info}/LICENSE +0 -0
- {nsarchive-1.1.2.dist-info → nsarchive-1.1.4.dist-info}/WHEEL +0 -0
nsarchive/__init__.py
CHANGED
@@ -21,6 +21,7 @@ class EntityInstance:
|
|
21
21
|
- Position légale et permissions d'une entité: `.Position.Permissions`
|
22
22
|
- Sanctions et modifications d'une entité: `.Action[ .AdminAction | .Sanction ]`
|
23
23
|
"""
|
24
|
+
|
24
25
|
def __init__(self, token: str) -> None:
|
25
26
|
self.db = deta.Deta(token)
|
26
27
|
self.base = self.db.Base('entities')
|
@@ -48,7 +49,7 @@ class EntityInstance:
|
|
48
49
|
_votes = self.electors.get(id)
|
49
50
|
|
50
51
|
if _data is None:
|
51
|
-
return
|
52
|
+
return None
|
52
53
|
|
53
54
|
if _data['_type'] == 'user':
|
54
55
|
entity = User(id)
|
@@ -155,6 +156,7 @@ class EntityInstance:
|
|
155
156
|
## Renvoie
|
156
157
|
- `list[Entity | User | Organization]`
|
157
158
|
"""
|
159
|
+
|
158
160
|
_res = self.base.fetch(query).items
|
159
161
|
|
160
162
|
if listquery is not None:
|
@@ -198,7 +200,7 @@ class EntityInstance:
|
|
198
200
|
_data = self.positions.get(id)
|
199
201
|
|
200
202
|
if _data is None:
|
201
|
-
|
203
|
+
return None
|
202
204
|
|
203
205
|
position = Position(id)
|
204
206
|
position.name = _data['name']
|
@@ -223,6 +225,8 @@ class EntityInstance:
|
|
223
225
|
_data['type'] = "sanction"
|
224
226
|
elif type(archive) == AdminAction:
|
225
227
|
_data['type'] = "adminaction"
|
228
|
+
elif type(archive) == Report:
|
229
|
+
_data['type'] = "report"
|
226
230
|
else:
|
227
231
|
_data['type'] = "unknown"
|
228
232
|
|
@@ -257,9 +261,13 @@ class EntityInstance:
|
|
257
261
|
|
258
262
|
archive.details = _data['details']
|
259
263
|
archive.new_state = _data['new_state']
|
264
|
+
elif _data['type'] == "report": # Plainte
|
265
|
+
archive = Report(_data['author'], _data['target'])
|
266
|
+
|
267
|
+
archive.details = _data['details']
|
260
268
|
else:
|
261
269
|
archive = Action(_data['author'], _data['target'])
|
262
|
-
|
270
|
+
|
263
271
|
archive.id = id
|
264
272
|
archive.action = _data['action']
|
265
273
|
archive.date = _data['date']
|
@@ -279,7 +287,7 @@ class EntityInstance:
|
|
279
287
|
"""
|
280
288
|
|
281
289
|
_res = self.archives.fetch(query).items
|
282
|
-
|
290
|
+
|
283
291
|
return [ self._get_archive(archive['key']) for archive in _res ]
|
284
292
|
|
285
293
|
class RepublicInstance:
|
@@ -301,7 +309,7 @@ class RepublicInstance:
|
|
301
309
|
self.mandate = self.db.Base('mandate')
|
302
310
|
self.functions = self.db.Base('functions') # Liste des fonctionnaires
|
303
311
|
|
304
|
-
def get_vote(self, id: str | NSID) -> Vote | ClosedVote:
|
312
|
+
def get_vote(self, id: str | NSID) -> Vote | ClosedVote | Lawsuit:
|
305
313
|
"""
|
306
314
|
Récupère un vote spécifique.
|
307
315
|
|
@@ -317,12 +325,14 @@ class RepublicInstance:
|
|
317
325
|
_data = self.votes.get(id)
|
318
326
|
|
319
327
|
if _data is None:
|
320
|
-
|
328
|
+
return None
|
321
329
|
|
322
330
|
if _data['_type'] == 'open':
|
323
331
|
vote = Vote(id, _data['title'], tuple(_data['choices'].keys()))
|
324
332
|
elif _data['_type'] == 'closed':
|
325
333
|
vote = ClosedVote(id, _data['title'])
|
334
|
+
elif _data['_type'] == 'lawsuit':
|
335
|
+
vote = Lawsuit(id, _data['title'])
|
326
336
|
else:
|
327
337
|
vote = Vote('0', 'Unknown Vote', ())
|
328
338
|
|
@@ -339,7 +349,10 @@ class RepublicInstance:
|
|
339
349
|
vote.id = NSID(vote.id)
|
340
350
|
|
341
351
|
_data = {
|
342
|
-
'_type':
|
352
|
+
'_type':'open' if type(vote) == Vote else\
|
353
|
+
'closed' if type(vote) == ClosedVote else\
|
354
|
+
'lawsuit' if type(vote) == Lawsuit else\
|
355
|
+
'unknown',
|
343
356
|
'title': vote.title,
|
344
357
|
'author': NSID(vote.author),
|
345
358
|
'startDate': vote.startDate,
|
nsarchive/cls/entities.py
CHANGED
@@ -20,6 +20,7 @@ class PositionPermissions:
|
|
20
20
|
self.edit_laws = False # Proposer une modification des différents textes de loi
|
21
21
|
self.manage_entities = False # Gérer les membres et les organisations
|
22
22
|
self.manage_national_channel = False # Prendre la parole sur la chaîne nationale et avoir une priorité de passage sur les autres chaînes
|
23
|
+
self.manage_reports = False # Accepter ou refuser une plainte
|
23
24
|
self.manage_state_budgets = False # Gérer les différents budgets de l'État
|
24
25
|
self.moderate_members = False # Envoyer des membres en garde à vue, en détention ou toute autre sanction non présente sur le client Discord
|
25
26
|
self.propose_new_laws = self.edit_constitution # Proposer un nouveau texte de loi pris en charge par la Constitution
|
@@ -1,13 +1,13 @@
|
|
1
|
-
nsarchive/__init__.py,sha256=
|
1
|
+
nsarchive/__init__.py,sha256=f8N40DToL96-fLrsqaot4lTZZhCDV1vPpUEcQ9o5HX4,24637
|
2
2
|
nsarchive/assets/default_avatar.png,sha256=n-4vG_WPke8LvbY3ZU6oA-H-OtRoIu7woKnRq9DCIlI,51764
|
3
3
|
nsarchive/cls/archives.py,sha256=Nmt3C0Zq9oGQdCXSzm_wo70VbNq89SY3dx9KKqEpoCg,2182
|
4
4
|
nsarchive/cls/base.py,sha256=z7NTvrtbeaUF1T_o-J7PL2N8axkmJek9EoKcQ8fTF9I,715
|
5
5
|
nsarchive/cls/economy.py,sha256=RjFu3VzNunazslbd4Ia5p1Jr-jJP5CvIcbVOzkDTwTU,549
|
6
|
-
nsarchive/cls/entities.py,sha256=
|
6
|
+
nsarchive/cls/entities.py,sha256=zKprr9dPojzlb4X6zUNRTDLQLNYZxRILH5qDl9ps3Ak,5814
|
7
7
|
nsarchive/cls/exceptions.py,sha256=QN6Qn7cxTkGoC4lO50hBAq4gZCgo7scQvCkb-xKl6Xs,692
|
8
8
|
nsarchive/cls/republic.py,sha256=6eut6OsFoOm9TVhA41fM3NlMEA3Uhg9TCuXgl46vFko,1985
|
9
9
|
nsarchive/utils/assets.py,sha256=hd0STSpa0yT-OJlUyI_wCYXJqcBiUMQds2pZTXNNg9c,382
|
10
|
-
nsarchive-1.1.
|
11
|
-
nsarchive-1.1.
|
12
|
-
nsarchive-1.1.
|
13
|
-
nsarchive-1.1.
|
10
|
+
nsarchive-1.1.4.dist-info/LICENSE,sha256=aFLFZg6LEJFpTlNQ8su3__jw4GfV-xWBmC1cePkKZVw,35802
|
11
|
+
nsarchive-1.1.4.dist-info/METADATA,sha256=KTV3mB8WDSYhKux4Yc-Npz14lQaeQWt8GCPhV5HXxNM,5629
|
12
|
+
nsarchive-1.1.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
13
|
+
nsarchive-1.1.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|