Skip to content

Commit

Permalink
Run black on codebase (#40)
Browse files Browse the repository at this point in the history
* Run black on codebase

Using option -l 79 for compatibility with PEP8

* Run black on setup.py
  • Loading branch information
sethaxen committed Feb 25, 2020
1 parent 74edaeb commit ff9b199
Show file tree
Hide file tree
Showing 26 changed files with 2,425 additions and 1,352 deletions.
2 changes: 1 addition & 1 deletion e3fp/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .util import E3FPWarning, E3FPDeprecationWarning

version_info = (1, 2, 0)
version = '.'.join(str(c) for c in version_info)
version = ".".join(str(c) for c in version_info)
__version__ = version
28 changes: 19 additions & 9 deletions e3fp/config/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,19 @@
import os
import copy
import ast

try:
from ConfigParser import SafeConfigParser, NoSectionError, \
DuplicateSectionError
from ConfigParser import (
SafeConfigParser,
NoSectionError,
DuplicateSectionError,
)
except ImportError: # Python 3
from configparser import SafeConfigParser, NoSectionError, \
DuplicateSectionError
from configparser import (
SafeConfigParser,
NoSectionError,
DuplicateSectionError,
)

CONFIG_DIR = os.path.dirname(os.path.realpath(__file__))
DEF_PARAM_FILE = os.path.join(CONFIG_DIR, "defaults.cfg")
Expand Down Expand Up @@ -63,8 +70,9 @@ def write_params(params, params_file="params.cfg"):
params.write(f)


def get_value(params, section_name, param_name, dtype=str, auto=False,
fallback=None):
def get_value(
params, section_name, param_name, dtype=str, auto=False, fallback=None
):
"""Get value from params with fallback.
Parameters
Expand Down Expand Up @@ -117,8 +125,9 @@ def get_default_value(*args, **kwargs):
return get_value(default_params, *args, **kwargs)


def update_params(params_dict, params=None, section_name=None,
fill_defaults=False):
def update_params(
params_dict, params=None, section_name=None, fill_defaults=False
):
"""Set `SafeConfigParser` values from a sections dict.
Sections dict key must be parameter sections, and value must be dict
Expand Down Expand Up @@ -185,7 +194,8 @@ def params_to_sections_dict(params, auto=True):
if auto:
params_dict = {
param_name: get_value(params, section, param_name, auto=True)
for param_name in params_dict}
for param_name in params_dict
}
params_dicts[section] = params_dict
return params_dicts

Expand Down
Loading

0 comments on commit ff9b199

Please sign in to comment.