Changeset - bfccdcd998fc
[Not reviewed]
default
0 4 0
Dennis Fink - 3 years ago 2022-06-10 09:36:16
dennis.fink@c3l.lu
Remove dead code
4 files changed with 6 insertions and 21 deletions:
0 comments (0 inline, 0 general)
spaceapi/__init__.py
Show inline comments
 
@@ -99,9 +99,8 @@ def create_app():
 

	
 
    app.register_blueprint(sensors_views, url_prefix="/sensors")
 

	
 
    from .utils import ActiveStatus, ActiveStatusv14
 
    from .utils import ActiveStatusv14
 

	
 
    ActiveStatus().reload()
 
    ActiveStatusv14().reload()
 

	
 
    return app
spaceapi/sensors.py
Show inline comments
 
@@ -6,7 +6,7 @@ from flask import Blueprint, abort, curr
 
from pkg_resources import resource_filename
 

	
 
from .auth import httpauth
 
from .utils import ActiveStatus, ActiveStatusv14, first, fuzzy_list_find
 
from .utils import ActiveStatusv14, first, fuzzy_list_find
 

	
 
sensors_views = Blueprint("sensors", __name__)
 

	
spaceapi/utils.py
Show inline comments
 
@@ -8,17 +8,9 @@ import mastodon
 
import tweepy
 
from flask import current_app, request
 

	
 
default_json_file = os.path.abspath("default.json")
 
last_state_file = os.path.abspath("laststate.json")
 

	
 
default_json_file_v14 = os.path.abspath("default_v14.json")
 
last_state_file_v14 = os.path.abspath("laststate_v14.json")
 

	
 
if not os.path.exists(default_json_file):
 
    raise RuntimeError("default.json does not exists!")
 
elif not os.path.isfile(default_json_file):
 
    raise RuntimeError("default.json is not a file!")
 

	
 
if not os.path.exists(default_json_file_v14):
 
    raise RuntimeError("default_v14.json does not exists!")
 
elif not os.path.isfile(default_json_file):
 
@@ -89,10 +81,10 @@ class Singleton:
 
        return cls._instance_dict[key]
 

	
 

	
 
class ActiveStatus(Singleton, dict):
 
class ActiveStatusv14(Singleton, dict):
 
    def __init__(self):
 
        self.default_json_file = default_json_file
 
        self.last_state_file = last_state_file
 
        self.default_json_file = default_json_file_v14
 
        self.last_state_file = last_state_file_v14
 

	
 
    def reload(self):
 

	
 
@@ -208,12 +200,6 @@ class ActiveStatus(Singleton, dict):
 
            self["state"]["message"] = message
 

	
 

	
 
class ActiveStatusv14(ActiveStatus):
 
    def __init__(self):
 
        self.default_json_file = default_json_file_v14
 
        self.last_state_file = last_state_file_v14
 

	
 

	
 
def request_wants_json():
 
    best = request.accept_mimetypes.best_match(["application/json", "text/html"])
 
    return (
spaceapi/views.py
Show inline comments
 
@@ -10,7 +10,7 @@ from flask import (
 
)
 

	
 
from .auth import basicauth, httpauth
 
from .utils import ActiveStatus, ActiveStatusv14, request_wants_json
 
from .utils import ActiveStatusv14, request_wants_json
 

	
 
root_views = Blueprint("root", __name__)
 

	
0 comments (0 inline, 0 general)