Start
This commit is contained in:
parent
f0cdfc5d1c
commit
a8d50bb699
5 changed files with 63 additions and 0 deletions
22
src/settings.py
Normal file
22
src/settings.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
import getpass
|
||||
import platform
|
||||
import json
|
||||
|
||||
|
||||
class Settings(object):
|
||||
|
||||
def __init__(self):
|
||||
path = Settings.get_default_path() + 'toxygen.json'
|
||||
with open(path) as fl:
|
||||
data = fl.read()
|
||||
self.data = json.loads(data)
|
||||
|
||||
def __get__(self, attr):
|
||||
return self.data[attr]
|
||||
|
||||
@staticmethod
|
||||
def get_default_path():
|
||||
name = platform.system()
|
||||
if name == 'Linux':
|
||||
user = getpass.getuser()
|
||||
return '/home/{}/.config/tox/'.format(user)
|
Loading…
Add table
Add a link
Reference in a new issue