PEP8
This commit is contained in:
parent
ba732934d0
commit
a9ec77cce0
2 changed files with 5 additions and 2 deletions
|
@ -1,8 +1,8 @@
|
||||||
import click
|
import click
|
||||||
from project.utils import get_config
|
from project.utils import get_config
|
||||||
|
|
||||||
|
|
||||||
@click.command('config')
|
@click.command('config')
|
||||||
@click.argument('key')
|
@click.argument('key')
|
||||||
def cli(key):
|
def cli(key):
|
||||||
print(get_config(key))
|
print(get_config(key))
|
||||||
pass
|
|
||||||
|
|
|
@ -6,9 +6,11 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from yaml import Loader
|
from yaml import Loader
|
||||||
|
|
||||||
|
|
||||||
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
USER_CONFIG_DIR = "~/.dfa.yml"
|
USER_CONFIG_DIR = "~/.dfa.yml"
|
||||||
|
|
||||||
|
|
||||||
def get_config_data(filename):
|
def get_config_data(filename):
|
||||||
try:
|
try:
|
||||||
config_file = open(filename)
|
config_file = open(filename)
|
||||||
|
@ -21,6 +23,7 @@ DEFAULT_CONFIG = get_config_data(os.path.join(BASE_DIR, 'config' ,'defaults.yml'
|
||||||
|
|
||||||
USER_CONFIG = get_config_data(os.path.expanduser(USER_CONFIG_DIR))
|
USER_CONFIG = get_config_data(os.path.expanduser(USER_CONFIG_DIR))
|
||||||
|
|
||||||
|
|
||||||
def get_config(key):
|
def get_config(key):
|
||||||
if USER_CONFIG and key in USER_CONFIG:
|
if USER_CONFIG and key in USER_CONFIG:
|
||||||
return USER_CONFIG[key]
|
return USER_CONFIG[key]
|
||||||
|
|
Reference in a new issue