nsarchive 2.0.0a7__py3-none-any.whl → 2.0.0b1__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
@@ -1,3 +1,4 @@
1
+ import json
1
2
  import typing
2
3
 
3
4
  from supabase import Client
@@ -37,7 +38,7 @@ class Instance:
37
38
  def __init__(self, client: Client):
38
39
  self.db = client
39
40
 
40
- def _select_from_db(self, table: str, key: str, value: str) -> list:
41
+ def _select_from_db(self, table: str, key: str = None, value: str = None) -> list:
41
42
  """
42
43
  Récupère des données JSON d'une table Supabase en fonction de l'ID.
43
44
 
@@ -54,7 +55,10 @@ class Instance:
54
55
  - `None` si aucune donnée n'est trouvée
55
56
  """
56
57
 
57
- res = self.db.from_(table).select("*").eq(key, value).execute()
58
+ if key and value:
59
+ res = self.db.from_(table).select("*").eq(key, value).execute()
60
+ else:
61
+ res = self.db.from_(table).select("*").execute()
58
62
 
59
63
  if res.data:
60
64
  return res.data
@@ -117,9 +121,59 @@ class Instance:
117
121
  if entity is not None:
118
122
  matches.append(entity)
119
123
 
120
- if not matches or len(matches) != len(query):
124
+ if query == {}:
125
+ matches = [ self._select_from_db(table) ]
126
+
127
+ if not matches or (len(matches) != len(query) and query != {}):
121
128
  return []
122
129
 
123
130
  _res = [ item for item in matches[0] if all(item in match for match in matches[1:]) ]
124
131
 
125
132
  return _res
133
+
134
+ def _upload_to_storage(self, bucket: str, data: bytes, path: str, overwrite: bool = False, options: dict = {'content-type': 'image/png'}) -> dict:
135
+ """
136
+ Envoie un fichier dans un bucket Supabase.
137
+
138
+ ## Paramètres
139
+ bucket: `str`\n
140
+ Nom du bucket où le fichier sera stocké
141
+ data: `bytes`\n
142
+ Données à uploader
143
+ path: `str`\n
144
+ Chemin dans le bucket où le fichier sera stocké
145
+
146
+ ## Renvoie
147
+ - `dict` contenant les informations de l'upload si réussi
148
+ - `None` en cas d'échec
149
+ """
150
+
151
+ options["upsert"] = json.dumps(overwrite)
152
+
153
+ if len(data) > 5 * 1000 ** 3:
154
+ raise ValueError("La limite d'un fichier à upload est de 1Mo")
155
+
156
+ res = self.db.storage.from_(bucket).upload(path, data, options)
157
+
158
+ if res.json().get("error"):
159
+ print("Erreur lors de l'upload:", res["error"])
160
+
161
+ return res
162
+
163
+ def _download_from_storage(self, bucket: str, path: str) -> bytes:
164
+ """
165
+ Télécharge un fichier depuis le stockage Supabase.
166
+
167
+ ## Paramètres
168
+ bucket: `str`\n
169
+ Nom du bucket où il faut chercher le fichier
170
+ path: `str`\n
171
+ Chemin du fichier dans le bucket
172
+
173
+ ## Renvoie
174
+ - Le fichier demandé en `bytes`
175
+ """
176
+
177
+ res = self.db.storage.from_(bucket).download(path)
178
+
179
+ return res
nsarchive/cls/entities.py CHANGED
@@ -3,7 +3,7 @@ import time
3
3
  from .exceptions import *
4
4
  from .base import NSID
5
5
 
6
- from ..utils import assets
6
+ from .. import utils
7
7
 
8
8
  class PositionPermissions:
9
9
  """
@@ -38,6 +38,9 @@ class Position:
38
38
  self.id = id
39
39
  self.permissions: PositionPermissions = PositionPermissions()
40
40
 
41
+ def __repr__(self):
42
+ return self.id
43
+
41
44
  class Entity:
42
45
  def __init__(self, id: str | NSID) -> None:
43
46
  self.id: NSID = NSID(id) # ID hexadécimal de l'entité (ou nom dans le cas de l'entreprise)
@@ -52,7 +55,7 @@ class Entity:
52
55
 
53
56
  self.name = new_name
54
57
 
55
- def set_position(self, position: str) -> None:
58
+ def set_position(self, position: Position) -> None:
56
59
  self.position = position
57
60
 
58
61
  def add_link(self, key: str, value: str | int) -> None:
@@ -135,7 +138,7 @@ class Organization(Entity):
135
138
  super().__init__(NSID(id))
136
139
 
137
140
  self.owner: Entity
138
- self.avatar: bytes = assets.open('default_avatar.png')
141
+ self.avatar: bytes = utils.open_asset('default_avatar.png')
139
142
 
140
143
  self.certifications: dict = {}
141
144
  self.members: list[GroupMember] = []
nsarchive/cls/republic.py CHANGED
@@ -2,22 +2,53 @@ from nsarchive.cls.base import NSID
2
2
 
3
3
  # Votes
4
4
 
5
+ class VoteOption:
6
+ def __init__(self, id: str, title: str = None, count: int = 0):
7
+ self.id = id
8
+ self.title = title if title else id
9
+ self.count = count
10
+
5
11
  class Vote:
6
- def __init__(self, id: str | NSID, title: str, choices: tuple[str]) -> None:
12
+ def __init__(self, id: str | NSID, title: str) -> None:
7
13
  self.id: NSID = NSID(id)
8
14
  self.title: str = title
9
- self.choices = { choice : 0 for choice in choices }
10
- self.author: str = '0'
15
+ self.choices: list[VoteOption] = []
16
+ self.author: NSID = NSID("0")
11
17
  self.startDate: int = 0
12
18
  self.endDate: int = 0
13
19
 
20
+ def by_id(self, id: str) -> VoteOption:
21
+ for opt in self.choices:
22
+ if opt.id == id:
23
+ return opt
24
+
25
+ def sorted(self, titles_only: bool = False) -> list[VoteOption] | list[str]:
26
+ sorted_list: list[VoteOption] = sorted(self.choices, lambda opt : opt.count)
27
+
28
+ if titles_only:
29
+ return [ opt.id for opt in sorted_list ]
30
+ else:
31
+ return sorted_list
32
+
14
33
  class Referendum(Vote):
15
- def __init__(self, id: str | NSID, title: str) -> None:
16
- super().__init__(id, title, ('yes', 'no', 'blank'))
34
+ def __init__(self, id: NSID, title: str) -> None:
35
+ super().__init__(id, title)
36
+
37
+ self.choices = [
38
+ VoteOption('yes', 'Oui'),
39
+ VoteOption('no', 'Non'),
40
+ VoteOption('blank', 'Pas d\'avis'),
41
+ ]
17
42
 
18
43
  class Lawsuit(Vote):
19
- def __init__(self, id: str | NSID, title: str) -> None:
20
- super().__init__(id, title, ('innocent', 'guilty', 'blank'))
44
+ def __init__(self, id: NSID, title: str) -> None:
45
+ super().__init__(id, title)
46
+
47
+ self.choices = [
48
+ VoteOption('guilty', 'Coupable'),
49
+ VoteOption('innocent', 'Innocent'),
50
+ VoteOption('blank', 'Pas d\'avis'),
51
+ ]
21
52
 
22
53
 
23
54
  # Institutions (defs)
@@ -30,21 +61,19 @@ class Official:
30
61
  'PRE_REP': 0, # Président de la République
31
62
  'MIN': 0, # Différents ministres
32
63
  'PRE_AS': 0, # Président de l'Assemblée Nationale
33
- 'JUDGE': 0, # Juge
34
64
  'REPR': 0 # Député
35
65
  }
36
66
 
37
67
  self.contributions: dict = {
38
- 'project': 0,
39
- 'approved_project': 0,
40
- 'admin_action': 0,
41
- 'law_vote': 0
68
+ 'propose_project': 0,
69
+ 'success_project': 0,
70
+ 'vote_law': 0
42
71
  }
43
72
 
44
73
  class Administration:
45
74
  def __init__(self) -> None:
46
75
  self.president: Official
47
- self.members: list[Official]
76
+ self.members: list[Official] = []
48
77
 
49
78
  class Government:
50
79
  def __init__(self, president: Official) -> None:
@@ -61,17 +90,17 @@ class Court:
61
90
  def __init__(self) -> None:
62
91
  self.president: Official
63
92
  # On discutera de la mise en place d'un potentiel président. Pour l'instant c'est le Ministre de la Justice
64
- self.members: list[Official]
93
+ self.members: list[Official] = []
65
94
 
66
95
  class Assembly:
67
96
  def __init__(self) -> None:
68
97
  self.president: Official
69
- self.members: list[Official]
98
+ self.members: list[Official] = []
70
99
 
71
100
  class PoliceForces:
72
101
  def __init__(self) -> None:
73
102
  self.president: Official
74
- self.members: list[Official]
103
+ self.members: list[Official] = []
75
104
 
76
105
  class State:
77
106
  def __init__(self) -> None:
@@ -85,11 +85,12 @@ class EntityInstance(Instance):
85
85
 
86
86
  entity.certifications = _data['certifications']
87
87
  entity.parts = _data['parts']
88
+ entity.avatar = self._download_from_storage('organizations', f"avatars/{entity.id}")
88
89
  else:
89
90
  entity = Entity(id)
90
91
 
91
92
  entity.name = _data['name']
92
- entity.position = _data['position'] # Métier si c'est un utilisateur, domaine professionnel si c'est un collectif
93
+ entity.position = self.get_position(_data['position']) # Métier si c'est un utilisateur, domaine professionnel si c'est un collectif
93
94
  entity.registerDate = _data['register_date']
94
95
 
95
96
  for key, value in _data.get('additional', {}).items():
@@ -114,7 +115,7 @@ class EntityInstance(Instance):
114
115
  _data = {
115
116
  'id': entity.id,
116
117
  'name': entity.name,
117
- 'position': entity.position,
118
+ 'position': entity.position.id,
118
119
  'register_date': entity.registerDate,
119
120
  'additional': {},
120
121
  }
@@ -136,7 +137,9 @@ class EntityInstance(Instance):
136
137
  'position': member.permission_level
137
138
  }
138
139
 
139
- _data['members'] += [_member]
140
+ _data['members'] += [_member]
141
+
142
+ self._upload_to_storage('organizations', entity.avatar, f'/avatars/{entity.id}')
140
143
  elif type(entity) == User:
141
144
  _data['xp'] = entity.xp
142
145
  _data['boosts'] = entity.boosts
@@ -155,7 +158,7 @@ class EntityInstance(Instance):
155
158
 
156
159
  self._delete_by_ID('individuals' if isinstance(entity, User) else 'organizations', NSID(entity.id))
157
160
 
158
- def fetch_entities(self, **query: dict) -> list[ Entity | User | Organization ]:
161
+ def fetch_entities(self, **query: typing.Any) -> list[ Entity | User | Organization ]:
159
162
  """
160
163
  Récupère une liste d'entités en fonction d'une requête.
161
164
 
@@ -198,7 +201,6 @@ class EntityInstance(Instance):
198
201
 
199
202
  id = NSID(id)
200
203
  groups = self.fetch_entities(_type = 'organization')
201
- groups.extend(self.fetch_entities(_type = 'organization', owner_id = id))
202
204
 
203
205
  for group in groups:
204
206
  if group is None:
@@ -41,22 +41,34 @@ class RepublicInstance(Instance):
41
41
  id = NSID(id)
42
42
  _data = self._get_by_ID('votes', id)
43
43
 
44
- if _data is None:
44
+ if not _data: # Pas dans les votes -> peut-être dans les procès
45
+ _data = self._get_by_ID('lawsuits', id)
46
+
47
+ if not _data: # Le vote n'existe juste pas
45
48
  return None
49
+ elif '_type' not in _data.keys(): # Le vote est un procès
50
+ _data['_type'] = "lawsuit"
46
51
 
47
52
  if _data['_type'] == 'vote':
48
- vote = Vote(id, _data['title'], tuple(_data['choices'].keys()))
53
+ vote = Vote(id, _data['title'])
49
54
  elif _data['_type'] == 'referendum':
50
55
  vote = Referendum(id, _data['title'])
56
+ vote.choices = []
51
57
  elif _data['_type'] == 'lawsuit':
52
58
  vote = Lawsuit(id, _data['title'])
59
+ vote.choices = []
53
60
  else:
54
- vote = Vote('0', 'Unknown Vote', ())
61
+ vote = Vote('0', 'Unknown Vote')
62
+
63
+ vote.author = _data['author_id']
64
+ vote.startDate = _data['start_date']
65
+ vote.endDate = _data['end_date']
55
66
 
56
- vote.author = _data['author']
57
- vote.startDate = _data['startDate']
58
- vote.endDate = _data['endDate']
59
- vote.choices = _data['choices']
67
+ for opt in _data['choices']:
68
+ option = VoteOption(opt["id"], opt["title"])
69
+ option.count = opt["count"]
70
+
71
+ vote.choices.append(option)
60
72
 
61
73
  return vote
62
74
 
@@ -70,14 +82,19 @@ class RepublicInstance(Instance):
70
82
  'referendum' if type(vote) == Referendum else\
71
83
  'lawsuit' if type(vote) == Lawsuit else\
72
84
  'unknown',
85
+ 'id': NSID(vote.id),
73
86
  'title': vote.title,
74
- 'author': NSID(vote.author),
75
- 'startDate': vote.startDate,
76
- 'endDate': vote.endDate,
77
- 'choices': vote.choices
87
+ 'author_id': NSID(vote.author),
88
+ 'start_date': vote.startDate,
89
+ 'end_date': vote.endDate,
90
+ 'choices': [ opt.__dict__ for opt in vote.choices ]
78
91
  }
79
92
 
80
- self._put_in_db('votes', _data)
93
+ if type(vote) == Lawsuit:
94
+ del _data['_type']
95
+ self._put_in_db('lawsuits', _data)
96
+ else:
97
+ self._put_in_db('votes', _data)
81
98
 
82
99
  # Aucune possibilité de supprimer un vote
83
100
 
@@ -103,19 +120,19 @@ class RepublicInstance(Instance):
103
120
 
104
121
  base = 'mandate' if current_mandate else 'archives'
105
122
 
106
- _contributions = self.fetch(base, {'author': id, '_type': 'contrib'})
107
- _mandates = self.fetch(base, {'target': id, '_type': 'election'}) +\
108
- self.fetch(base, {'target': id, '_type': 'promotion'})
123
+ _contributions = self.fetch(base, author = id, _type = 'contrib')
124
+ _mandates = self.fetch(base, target = id, _type = 'election') +\
125
+ self.fetch(base, target = id, _type = 'promotion')
109
126
 
110
127
  user = Official(id)
111
128
  for mandate in _mandates:
112
- if mandate['position'].startswith('MIN'):
113
- mandate['position'] = 'MIN'
129
+ if mandate['details']['position'].startswith('MIN'):
130
+ mandate['details']['position'] = 'MIN'
114
131
 
115
132
  try:
116
- user.mandates[mandate['position']] += 1
133
+ user.mandates[mandate['details']['position']] += 1
117
134
  except KeyError:
118
- user.mandates[mandate['position']] = 1
135
+ user.mandates[mandate['details']['position']] = 1
119
136
 
120
137
  for contrib in _contributions:
121
138
  try:
@@ -134,14 +151,14 @@ class RepublicInstance(Instance):
134
151
  court = Court()
135
152
  police_forces = PoliceForces()
136
153
 
137
- _get_position: list[dict] = lambda pos : self._select_from_db('functions', 'id', pos)['users']
154
+ _get_position: list[dict] = lambda pos : self._select_from_db('functions', 'id', pos)[0]['users']
138
155
 
139
- admin.members = [ self.get_official(user['id']) for user in _get_position('ADMIN') ]
140
- admin.president = self.get_official('F7DB60DD1C4300A') # happex (remplace Kheops pour l'instant)
156
+ admin.members = [ self.get_official(user) for user in _get_position('ADMIN') ]
157
+ admin.president = self.get_official(0xF7DB60DD1C4300A) # happex (remplace Kheops pour l'instant)
141
158
 
142
- gov.president = self.get_official([0])
159
+ gov.president = self.get_official(0x0)
143
160
 
144
- minister = lambda code : self.get_official(_get_position(f'MIN_{code}')[0]['id'])
161
+ minister = lambda code : self.get_official(_get_position(f'MIN_{code}')[0])
145
162
  gov.prime_minister = minister('PRIM')
146
163
  gov.economy_minister = minister('ECO')
147
164
  gov.inner_minister = minister('INN')
@@ -150,13 +167,13 @@ class RepublicInstance(Instance):
150
167
  gov.outer_minister = minister('OUT')
151
168
 
152
169
  assembly.president = self.get_official(_get_position('PRE_AS')[0])
153
- assembly.members = [ self.get_official(user['id']) for user in _get_position('REPR') ]
170
+ assembly.members = [ self.get_official(user) for user in _get_position('REPR') ]
154
171
 
155
172
  court.president = gov.justice_minister
156
- court.members = [ self.get_official(user['id']) for user in _get_position('JUDGE') ]
173
+ court.members = [ self.get_official(user) for user in _get_position('JUDGE') ]
157
174
 
158
175
  police_forces.president = gov.inner_minister
159
- police_forces.members = [ self.get_official(user['id']) for user in _get_position('POLICE') ]
176
+ police_forces.members = [ self.get_official(user) for user in _get_position('POLICE') ]
160
177
 
161
178
  instits = State()
162
179
  instits.administration = admin
@@ -179,20 +196,20 @@ class RepublicInstance(Instance):
179
196
 
180
197
  get_ids = lambda institution : [ member.id for member in institutions.__getattribute__(institution).members ]
181
198
 
182
- self._put_in_db('functions', { 'users': get_ids('administration') })
183
- self._put_in_db('functions', { 'users': get_ids('assembly') })
184
- self._put_in_db('functions', { 'users': get_ids('court') })
185
- self._put_in_db('functions', { 'users': get_ids('police') })
199
+ self._put_in_db('functions', { 'id': 'ADMIN', 'users': get_ids('administration') })
200
+ self._put_in_db('functions', { 'id': 'REPR', 'users': get_ids('assembly') })
201
+ self._put_in_db('functions', { 'id': 'JUDGE', 'users': get_ids('court') })
202
+ self._put_in_db('functions', { 'id': 'POLICE', 'users': get_ids('police') })
186
203
 
187
- self._put_in_db('functions', { 'users': [ institutions.assembly.president.id ] })
188
- self._put_in_db('functions', { 'users': [ institutions.government.president.id ] })
204
+ self._put_in_db('functions', { 'id': 'PRE_AS', 'users': [ institutions.assembly.president.id ] })
205
+ self._put_in_db('functions', { 'id': 'PRE_REP', 'users': [ institutions.government.president.id ] })
189
206
 
190
- self._put_in_db('functions', { 'users': [ institutions.government.prime_minister.id ] })
191
- self._put_in_db('functions', { 'users': [ institutions.government.inner_minister.id ] })
192
- self._put_in_db('functions', { 'users': [ institutions.government.justice_minister.id ] })
193
- self._put_in_db('functions', { 'users': [ institutions.government.economy_minister.id ] })
194
- self._put_in_db('functions', { 'users': [ institutions.government.press_minister.id ] })
195
- self._put_in_db('functions', { 'users': [ institutions.government.outer_minister.id ] })
207
+ self._put_in_db('functions', { 'id': 'MIN_PRIM', 'users': [ institutions.government.prime_minister.id ] })
208
+ self._put_in_db('functions', { 'id': 'MIN_INN', 'users': [ institutions.government.inner_minister.id ] })
209
+ self._put_in_db('functions', { 'id': 'MIN_JUS', 'users': [ institutions.government.justice_minister.id ] })
210
+ self._put_in_db('functions', { 'id': 'MIN_ECO', 'users': [ institutions.government.economy_minister.id ] })
211
+ self._put_in_db('functions', { 'id': 'MIN_AUD', 'users': [ institutions.government.press_minister.id ] })
212
+ self._put_in_db('functions', { 'id': 'MIN_OUT', 'users': [ institutions.government.outer_minister.id ] })
196
213
 
197
214
  def new_mandate(self, institutions: State, weeks: int = 4) -> None:
198
215
  """
@@ -222,7 +239,7 @@ class RepublicInstance(Instance):
222
239
  elif type(archive) == Demotion:
223
240
  _data['_type'] = "demotion"
224
241
  else:
225
- _data['_type'] = "action"
242
+ _data['_type'] = "unknown"
226
243
 
227
244
  self._put_in_db('archives', _data)
228
245
  self._put_in_db('mandate', _data) # Ajouter les archives à celle du mandat actuel
@@ -246,9 +263,9 @@ class RepublicInstance(Instance):
246
263
  return None
247
264
 
248
265
  if _data['_type'] == "election":
249
- archive = Election(_data['author'], _data['target'], _data['position'])
266
+ archive = Election(_data['author'], _data['target'], _data['details']['position'])
250
267
  elif _data['_type'] == "promotion":
251
- archive = Promotion(_data['author'], _data['target'], _data['position'])
268
+ archive = Promotion(_data['author'], _data['target'], _data['details']['position'])
252
269
  elif _data['_type'] == "demotion":
253
270
  archive = Demotion(_data['author'], _data['target'])
254
271
  else:
nsarchive/utils.py ADDED
@@ -0,0 +1,26 @@
1
+ import io
2
+ import math
3
+ import os
4
+ from PIL import Image
5
+
6
+ def open_asset(path: str) -> bytes:
7
+ curr_dir = os.path.dirname(os.path.abspath(os.path.join(__file__)))
8
+ asset_path = os.path.join(curr_dir, 'assets', path)
9
+
10
+ image = Image.open(asset_path)
11
+ val = io.BytesIO()
12
+
13
+ image.save(val, format = 'PNG')
14
+
15
+ return val.getvalue()
16
+
17
+ def compress_image(data: bytes, _max: int = 1000 ** 2) -> bytes:
18
+ img = Image.open(io.BytesIO(data))
19
+ size = 2 * ( math.floor(math.sqrt(_max),) )
20
+
21
+ img.resize(size)
22
+
23
+ val = io.BytesIO()
24
+ img.save(val)
25
+
26
+ return val.getvalue()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nsarchive
3
- Version: 2.0.0a7
3
+ Version: 2.0.0b1
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
@@ -0,0 +1,16 @@
1
+ nsarchive/__init__.py,sha256=_hwIocDyD7R-4rS7ypca8jZex93H6mK-b9NpTpt-Rvo,724
2
+ nsarchive/assets/default_avatar.png,sha256=n-4vG_WPke8LvbY3ZU6oA-H-OtRoIu7woKnRq9DCIlI,51764
3
+ nsarchive/cls/archives.py,sha256=HHQhGKdnl7vD5zC8-bbXeQLhp8A98bBlneJTkztOmMg,2007
4
+ nsarchive/cls/base.py,sha256=7MXIsvJdBoWqUPcsQI22EFIx0pJKcx78WFOD1TrPbgg,5306
5
+ nsarchive/cls/economy.py,sha256=fnzmliHsUBEdu5RrrSkimpcgou_HFnivP_lmzLKCaDI,1360
6
+ nsarchive/cls/entities.py,sha256=hY4_cO-LtH69NMm8lK_INU8-qGmM5Qzmm0md3bNvoyU,6667
7
+ nsarchive/cls/exceptions.py,sha256=QN6Qn7cxTkGoC4lO50hBAq4gZCgo7scQvCkb-xKl6Xs,692
8
+ nsarchive/cls/republic.py,sha256=QofGTFnm4YaKG4sxA0pbfeEpmmbaMKGadWQA4C3V9OQ,3298
9
+ nsarchive/instances/_economy.py,sha256=7p1Ofu17hhuN2RWVWxwA28EDlMP8sAueT3bCOVlvRsY,7444
10
+ nsarchive/instances/_entities.py,sha256=zWgaPH-ITCXHuGv1Ua4UNN1cui-_pv8ZMwRuygOHwlA,10469
11
+ nsarchive/instances/_republic.py,sha256=XYD_Jf9l8VvWoykaPT1iEb_VJpgy42AsidoHVPZtY8s,10966
12
+ nsarchive/utils.py,sha256=qpQCZLlbVApOLtCI2ml54QwUld6K8fDxyBfwzofqXzw,610
13
+ nsarchive-2.0.0b1.dist-info/LICENSE,sha256=aFLFZg6LEJFpTlNQ8su3__jw4GfV-xWBmC1cePkKZVw,35802
14
+ nsarchive-2.0.0b1.dist-info/METADATA,sha256=sdap2f3MUnQsQTyn74CuvY4CTZ2rCEIdxiTWTvTpWT8,5697
15
+ nsarchive-2.0.0b1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
16
+ nsarchive-2.0.0b1.dist-info/RECORD,,
nsarchive/utils/assets.py DELETED
@@ -1,15 +0,0 @@
1
- import io
2
- import os
3
- from PIL import Image
4
-
5
- def open(path: str) -> bytes:
6
- curr_dir = os.path.dirname(os.path.abspath(os.path.join(__file__)))
7
- parent_dir = os.path.dirname(curr_dir)
8
- asset_path = os.path.join(parent_dir, 'assets', path)
9
-
10
- image = Image.open(asset_path)
11
- val = io.BytesIO()
12
-
13
- image.save(val, format = 'PNG')
14
-
15
- return val.getvalue()
@@ -1,16 +0,0 @@
1
- nsarchive/__init__.py,sha256=_hwIocDyD7R-4rS7ypca8jZex93H6mK-b9NpTpt-Rvo,724
2
- nsarchive/assets/default_avatar.png,sha256=n-4vG_WPke8LvbY3ZU6oA-H-OtRoIu7woKnRq9DCIlI,51764
3
- nsarchive/cls/archives.py,sha256=HHQhGKdnl7vD5zC8-bbXeQLhp8A98bBlneJTkztOmMg,2007
4
- nsarchive/cls/base.py,sha256=RWcpUDfo96BjsUR_G49c9mR80qZKGKD82RoZB2do1p8,3606
5
- nsarchive/cls/economy.py,sha256=fnzmliHsUBEdu5RrrSkimpcgou_HFnivP_lmzLKCaDI,1360
6
- nsarchive/cls/entities.py,sha256=hjqCtsQHQZrLFwR57d_n4FssJ53-jdniQMHUAJGuDPY,6612
7
- nsarchive/cls/exceptions.py,sha256=QN6Qn7cxTkGoC4lO50hBAq4gZCgo7scQvCkb-xKl6Xs,692
8
- nsarchive/cls/republic.py,sha256=4amjvCS5BnrvEgbjjDx_tOit3TbOSCMTsns6ifceL_8,2464
9
- nsarchive/instances/_economy.py,sha256=7p1Ofu17hhuN2RWVWxwA28EDlMP8sAueT3bCOVlvRsY,7444
10
- nsarchive/instances/_entities.py,sha256=zu0ZaKXKCEFv6DNQiRkk13CufHyEYAi3Bx9LaYJ6tkc,10346
11
- nsarchive/instances/_republic.py,sha256=5-6XjPWNcR8sHxm1ipWlQXUIi-UKmfo2OHir9QSQvWM,10106
12
- nsarchive/utils/assets.py,sha256=WGC03K1VZ5LwGzcVXbqphtGBZ_Vjso-1hmbIkpgL_X8,382
13
- nsarchive-2.0.0a7.dist-info/LICENSE,sha256=aFLFZg6LEJFpTlNQ8su3__jw4GfV-xWBmC1cePkKZVw,35802
14
- nsarchive-2.0.0a7.dist-info/METADATA,sha256=wysDMQVOMEo3d23n2HkSAyd8DFUmHjd36DKow8REQF8,5697
15
- nsarchive-2.0.0a7.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
16
- nsarchive-2.0.0a7.dist-info/RECORD,,