Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
TimoDiepers committed Sep 12, 2024
1 parent 8dc2e61 commit 6fd140c
Show file tree
Hide file tree
Showing 36 changed files with 96 additions and 76 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:

# Create the conda environment
- name: Create conda environment
run: conda create -n timex -c conda-forge -c cmutel -c diepers brightway25 bw_temporalis dynamic_characterization matplotlib seaborn
run: conda create -n timex -c conda-forge -c cmutel -c diepers brightway25 bw_temporalis dynamic_characterization matplotlib seaborn

# Install testing dependencies from pyproject.toml
- name: Install testing dependencies
Expand All @@ -73,4 +73,3 @@ jobs:
source $(conda info --base)/etc/profile.d/conda.sh
conda activate timex
pytest
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,4 @@ poetry.toml
# LSP config files
pyrightconfig.json

# End of https://www.toptal.com/developers/gitignore/api/jupyternotebooks,python
# End of https://www.toptal.com/developers/gitignore/api/jupyternotebooks,python
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ repos:
[
"-rn", # Only display messages
"-sn", # Don't display the score
]
]
4 changes: 2 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ sphinx:
configuration: docs/conf.py

submodules:
include: all
include: all

build:
os: "ubuntu-lts-latest" # https://docs.readthedocs.io/en/stable/config-file/v2.html#build-os
tools:
python: "mambaforge-latest" # https://docs.readthedocs.io/en/stable/config-file/v2.html#build-tools-python, mamba instead of conda for better build performance
python: "mambaforge-latest" # https://docs.readthedocs.io/en/stable/config-file/v2.html#build-tools-python, mamba instead of conda for better build performance
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ If you want to contribute to the development our code with a new feature, want t
Something is not working as expected? You have two options:

### 🥈 Report an error
Please open a new issue in the `bw_timex` [repository](https://github.com/TimoDiepers/timex/issues), describing the error and where you found it.
Please open a new issue in the `bw_timex` [repository](https://github.com/TimoDiepers/timex/issues), describing the error and where you found it.
A member of the bw_timex developer community will then take care of the issue, but it may take some time for your issue to be resolved.

### 🥇 Fix an error yourself
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2024, Institute of Technical Thermodynamics @ RWTH Aachen University, Institute of Environmental Sciences @ Leiden University, Flemish Institute for Technology Research, Paul Scherrer Institut.
Copyright (c) 2024, Institute of Technical Thermodynamics @ RWTH Aachen University, Institute of Environmental Sciences @ Leiden University, Flemish Institute for Technology Research, Paul Scherrer Institut.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
This is a python package for time-explicit Life Cycle Assessment that helps you assess the environmental impacts of products and processes over time. `bw_timex` builds on top of the [Brightway LCA framework](https://docs.brightway.dev/en/latest).

## Features
This package enables you to account for:
This package enables you to account for:
- **Timing of processes** throughout the supply chain (e.g., end-of-life treatment occurs 20 years after construction)
- **Variable** and/or **evolving** supply chains & technologies (e.g., increasing shares of renewable electricity in the future)
- **Timing of emissions** (by applying dynamic characterization functions)
Expand Down
2 changes: 1 addition & 1 deletion bw_timex/data/decay_multipliers.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions bw_timex/timeline_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def add_column_interpolation_weights_to_timeline(
dates_list = [
date
for date in self.database_date_dict_static_only.values()
if type(date) == datetime
if isinstance(date, datetime)
]
if "date_producer" not in list(tl_df.columns):
raise ValueError("The timeline does not contain dates.")
Expand All @@ -377,7 +377,7 @@ def add_column_interpolation_weights_to_timeline(
self.reversed_database_date_dict = {
v: k
for k, v in self.database_date_dict_static_only.items()
if type(v) == datetime
if isinstance(v, datetime)
}

if self.interpolation_type == "nearest":
Expand Down Expand Up @@ -535,7 +535,7 @@ def add_interpolation_weights_at_intersection_to_background(
}
return None

def get_consumer_name(self, id: int) -> str:
def get_consumer_name(self, idx: int) -> str:
"""
Returns the name of consumer node.
If consuming node is the functional unit, returns -1.
Expand All @@ -551,6 +551,6 @@ def get_consumer_name(self, id: int) -> str:
Name of the node or -1
"""
try:
return bd.get_node(id=id)["name"]
return bd.get_node(id=idx)["name"]
except:
return "-1" # functional unit
4 changes: 1 addition & 3 deletions bw_timex/timex_lca.py
Original file line number Diff line number Diff line change
Expand Up @@ -1004,9 +1004,7 @@ def add_static_activities_to_time_mapping_dict(self) -> None:
None but adds the activities to the `activity_time_mapping_dict`
"""
for idx in self.base_lca.dicts.activity.keys(): # activity ids
key = self.base_lca.remapping_dicts["activity"][
idx
] # ('database', 'code')
key = self.base_lca.remapping_dicts["activity"][idx] # ('database', 'code')
time = self.database_date_dict[
key[0]
] # datetime (or 'dynamic' for foreground processes)
Expand Down
6 changes: 4 additions & 2 deletions dev/old_tests/old_t_bioflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

import math
import unittest
import bw2data as bd
from datetime import datetime

import bw2calc as bc
import bw2data as bd
import numpy as np

from bw_timex import MedusaLCA
from tests.databases import db_abc_loopA_with_biosphere_tds_CO2_and_CH4
from datetime import datetime


class TestBioflows(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion docs/_static/bw_timex_dark_nomargins.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/_static/bw_timex_dark_rtd.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 6fd140c

Please sign in to comment.