Update api.py, jumpgate.py and four other files
This commit is contained in:
parent
ffb35f3121
commit
6434ba8a6a
@ -79,7 +79,7 @@ class Api:
|
||||
|
||||
def list_waypoints(self, system):
|
||||
data = self.request('get', f'systems/{system}/waypoints/')
|
||||
# pprintz(self.last_meta)
|
||||
# pprint(data)
|
||||
return self.store.update_list(Waypoint, data)
|
||||
|
||||
def marketplace(self, waypoint):
|
||||
|
@ -16,5 +16,5 @@ class Jumpgate(Base):
|
||||
return 'jmp'
|
||||
|
||||
def path(self):
|
||||
sector, system, symbol = self.symbol.split('-')
|
||||
return f'atlas/{sector}/{system[0:1]}/{system}/{symbol}.{self.ext()}'
|
||||
sector, system, _ = self.symbol.split('-')
|
||||
return f'atlas/{sector}/{system[0:1]}/{system}/{self.symbol}.{self.ext()}'
|
||||
|
@ -17,5 +17,5 @@ class Marketplace(Base):
|
||||
return 'mkt'
|
||||
|
||||
def path(self):
|
||||
sector, system, symbol = self.symbol.split('-')
|
||||
return f'atlas/{sector}/{system[0:1]}/{system}/{symbol}.{self.ext()}'
|
||||
sector, system, _ = self.symbol.split('-')
|
||||
return f'atlas/{sector}/{system[0:1]}/{system}/{self.symbol}.{self.ext()}'
|
||||
|
@ -18,4 +18,4 @@ class System(Base):
|
||||
|
||||
def path(self):
|
||||
sector, symbol = self.symbol.split('-')
|
||||
return f'atlas/{sector}/{symbol[0:1]}/{symbol}.{self.ext()}'
|
||||
return f'atlas/{sector}/{symbol[0:1]}/{self.symbol}.{self.ext()}'
|
||||
|
@ -21,8 +21,8 @@ class Waypoint(Base):
|
||||
return 'way'
|
||||
|
||||
def path(self):
|
||||
sector, system, symbol = self.symbol.split('-')
|
||||
return f'atlas/{sector}/{system[0:1]}/{system}/{symbol}.{self.ext()}'
|
||||
sector, system, _ = self.symbol.split('-')
|
||||
return f'atlas/{sector}/{system[0:1]}/{system}/{self.symbol}.{self.ext()}'
|
||||
|
||||
def system(self):
|
||||
p = self.symbol.split('-')
|
||||
|
@ -3,6 +3,8 @@ from nullptr.models.waypoint import Waypoint
|
||||
from nullptr.models.sector import Sector
|
||||
from nullptr.models.system import System
|
||||
from nullptr.models.agent import Agent
|
||||
from nullptr.models.marketplace import Marketplace
|
||||
from nullptr.models.jumpgate import Jumpgate
|
||||
from os.path import isfile, dirname, isdir
|
||||
import os
|
||||
import json
|
||||
@ -11,10 +13,16 @@ from time import time
|
||||
|
||||
class Store:
|
||||
def __init__(self, data_dir):
|
||||
self.init_models()
|
||||
self.data_dir = data_dir
|
||||
self.data = {}
|
||||
self.dirty_objects = set()
|
||||
|
||||
def init_models(self):
|
||||
self.models = Base.__subclasses__()
|
||||
self.extensions = {c.ext(): c for c in self.models}
|
||||
|
||||
|
||||
def dirty(self, obj):
|
||||
self.dirty_objects.add(obj)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user