Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
cmutel committed Jun 4, 2024
1 parent 9c52057 commit 765318b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion bw2calc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
__version__ = "2.0.DEV16"


import json_logging
import platform
import warnings

import json_logging

json_logging.init_non_web(enable_json=True)

ARM = {"arm", "arm64", "aarch64_be", "aarch64", "armv8b", "armv8l"}
Expand Down
10 changes: 6 additions & 4 deletions bw2calc/log_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def json_record(self, message, extra, record):
else:
# Also support logger.info({'foo': 'bar'})
data = eval(message)
data["time"] = utc_now().isoformat() + 'Z'
data["time"] = utc_now().isoformat() + "Z"

if record.exc_info:
data["exc_info"] = self.formatException(record.exc_info)
Expand All @@ -92,11 +92,13 @@ def json_record(self, message, extra, record):
def create_logger(dirpath=None, name=None, **kwargs):
"""Create a ``logger`` instance named ``bw2calc`` that can be used to log calculations.
``dirpath`` is the directory where the log file is saved. If ``dirpath`` is ``None``, no logger is created.
``dirpath`` is the directory where the log file is saved. If ``dirpath`` is ``None``, no logger
is created.
``name`` is the name of the calculation run, used to construct the log filepath.
You can add other types of loggers, just add another handler to the ``bw2calc`` named logger before starting your calculations.
You can add other types of loggers, just add another handler to the ``bw2calc`` named logger
before starting your calculations.
Returns the filepath of the created log file.
Expand All @@ -108,7 +110,7 @@ def create_logger(dirpath=None, name=None, **kwargs):
assert os.path.isdir(dirpath) and os.access(dirpath, os.W_OK)

# Use safe_filepath here
filename = "{}.{}.json".format(name or uuid.uuid4().hex, utc_now().isoformat() + 'Z')
filename = "{}.{}.json".format(name or uuid.uuid4().hex, utc_now().isoformat() + "Z")

formatter = JSONFormatter()
fp = os.path.abspath(os.path.join(dirpath, filename))
Expand Down
2 changes: 1 addition & 1 deletion bw2calc/single_value_diagonal_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(
seed_override: Union[int, None] = None,
indexer_override: Any = None,
custom_filter: Union[Callable, None] = None,
**kwargs
**kwargs,
):
self.dimension = dimension

Expand Down

0 comments on commit 765318b

Please sign in to comment.