REFACTOR: Split into modules (controller, models, and utils)
This commit is contained in:
0
utils/__init__.py
Normal file
0
utils/__init__.py
Normal file
12
utils/json_object.py
Normal file
12
utils/json_object.py
Normal file
@@ -0,0 +1,12 @@
|
||||
import json
|
||||
|
||||
class JSONObject:
|
||||
def __init__(self, path):
|
||||
self.path = path
|
||||
|
||||
def read(self):
|
||||
with open(self.path, "r") as f:
|
||||
return json.load(f)
|
||||
|
||||
def get(self, key):
|
||||
return self.read()[key]
|
||||
2
utils/utils.py
Normal file
2
utils/utils.py
Normal file
@@ -0,0 +1,2 @@
|
||||
def mapped_value(value, in_min, in_max, out_min, out_max):
|
||||
return (value - in_min) * (out_max - out_min) / (in_max - in_min) + out_min
|
||||
Reference in New Issue
Block a user