Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make invest relations iterable #1063

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from

Apply black

e856754
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Open

Make invest relations iterable #1063

Apply black
e856754
Select commit
Loading
Failed to load commit list.
GitHub Actions / Black failed May 22, 2024 in 0s

17 errors

Black found 17 errors

Annotations

Check failure on line 49 in /home/runner/work/oemof-solph/oemof-solph/examples/cellular/cellular.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/oemof-solph/oemof-solph/examples/cellular/cellular.py#L38-L49

 Lennart Schürmann <[email protected]>
 
 `MIT license <https://github.com/oemof/oemof-solph/blob/dev/LICENSE>`_
 
 """
-
 
 from oemof.solph import EnergySystem
 from oemof.solph import Model
 from oemof.solph import buses
 from oemof.solph import components as cmp

Check failure on line 153 in /home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/_link.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/_link.py#L143-L153

         \times P_{\mathrm{out},n}(p, t)
             \quad \forall t \in T, \forall n in {1,2} \\
         &
 
     """
+
     CONSTRAINT_GROUP = True
 
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)
 

Check failure on line 74 in /home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/_sink.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/_sink.py#L62-L74

                 msg.format(len(inputs)),
                 debugging.SuspiciousUsageWarning,
             )
 
         super().__init__(
-            label=label,
-            inputs=inputs,
-            custom_properties=custom_attributes
+            label=label, inputs=inputs, custom_properties=custom_attributes
         )
 
     def constraint_group(self):
         pass

Check failure on line 193 in /home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/_offset_converter.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/_offset_converter.py#L183-L193

     +--------------------+------------------------+------+--------------------------------------------+
 
     Note that :math:`P_{max}(t) \cdot Y(t)` is merged into one variable,
     called `status_nominal[n, o, p, t]`.
     """  # noqa: E501
+
     CONSTRAINT_GROUP = True
 
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)
 

Check failure on line 84 in /home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/_source.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/_source.py#L72-L84

                 msg.format(len(outputs)),
                 debugging.SuspiciousUsageWarning,
             )
 
         super().__init__(
-            label=label,
-            outputs=outputs,
-            custom_properties=custom_attributes
+            label=label, outputs=outputs, custom_properties=custom_attributes
         )
 
     def constraint_group(self):
         pass

Check failure on line 120 in /home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/experimental/_piecewise_linear_converter.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/experimental/_piecewise_linear_converter.py#L110-L120

     :class:`~oemof.solph.components.experimental._piecewise_linear_converter.PiecewiseLinearConverter`
 
     **The following constraints are created:**
 
     """
+
     CONSTRAINT_GROUP = True
 
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)
 

Check failure on line 307 in /home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/_generic_chp.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/_generic_chp.py#L297-L307

     :math:`\eta_{el,min,woDH}`      `Eta_el_min_woDH[n,t]`  P    el. eff. at min. fuel flow w/o distr. heating
     :math:`\eta_{el,max,woDH}`      `Eta_el_max_woDH[n,t]`  P    el. eff. at max. fuel flow w/o distr. heating
     =============================== ======================= ==== =============================================
 
     """  # noqa: E501
+
     CONSTRAINT_GROUP = True
 
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)
 

Check failure on line 424 in /home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/views.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/views.py#L407-L424

 
     for lb in labels:
         subset = (
             df.T.groupby(
                 lambda x1: (
-                    lambda fr, to, ty: "output"
-                    if (fr == lb and ty == "flow")
-                    else "input"
-                    if (to == lb and ty == "flow")
-                    else "level"
-                    if (fr == lb and ty != "flow")
-                    else None
+                    lambda fr, to, ty: (
+                        "output"
+                        if (fr == lb and ty == "flow")
+                        else (
+                            "input"
+                            if (to == lb and ty == "flow")
+                            else (
+                                "level"
+                                if (fr == lb and ty != "flow")
+                                else None
+                            )
+                        )
+                    )
                 )(*x1)
             )
             .sum()
             .T
         )

Check failure on line 244 in /home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/processing.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/processing.py#L231-L244

     # Extraction steps that are the same for both model types
     df = create_dataframe(model)
 
     # create a dict of dataframes keyed by oemof tuples
     df_dict = {
-        k
-        if len(k) > 1
-        else (k[0], None): v[["timestep", "variable_name", "value"]]
+        k if len(k) > 1 else (k[0], None): v[
+            ["timestep", "variable_name", "value"]
+        ]
         for k, v in df.groupby("oemof_tuple")
     }
 
     # Define index
     if model.es.timeindex is None:

Check failure on line 443 in /home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/processing.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/processing.py#L428-L443

     converted into strings that represent the object labels
     e.g. results[('pp1','bus1')].
     """
     if keep_none_type:
         converted = {
-            tuple([str(e) if e is not None else None for e in k])
-            if isinstance(k, tuple)
-            else str(k)
-            if k is not None
-            else None: v
+            (
+                tuple([str(e) if e is not None else None for e in k])
+                if isinstance(k, tuple)
+                else str(k) if k is not None else None
+            ): v
             for k, v in result.items()
         }
     else:
         converted = {
             tuple(map(str, k)) if isinstance(k, tuple) else str(k): v

Check failure on line 14 in /home/runner/work/oemof-solph/oemof-solph/tests/test_options.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/oemof-solph/oemof-solph/tests/test_options.py#L4-L14

 by the contributors recorded in the version control history of the file,
 available from its original location oemof/tests/test_components.py
 
 SPDX-License-Identifier: MIT
 """
+
 import pytest
 
 from oemof import solph
 
 

Check failure on line 502 in /home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/experimental/_sink_dsm.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/experimental/_sink_dsm.py#L492-L502

         :math:`\omega_{t}`                                         P    Objective weighting of the model for timestep t
         :math:`year_{max}`                                         P    Last year of the optimization horizon
         ================================= ======================== ==== =======================================
 
     """  # noqa: E501
+
     CONSTRAINT_GROUP = True
 
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)
 

Check failure on line 902 in /home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/experimental/_sink_dsm.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/experimental/_sink_dsm.py#L892-L902

         :math:`\mathbb{P}`                                         S    Periods of the model
         :math:`\textrm{TIMEINDEX}`                                 S    Timeindex set of the model (periods, timesteps)
         ================================= ======================== ==== =======================================
 
     """  # noqa: E501
+
     CONSTRAINT_GROUP = True
 
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)
 

Check failure on line 1674 in /home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/experimental/_sink_dsm.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/experimental/_sink_dsm.py#L1664-L1674

         :math:`\omega_{t}`                                         P    Objective weighting of the model for timestep t
         :math:`year_{max}`                                         P    Last year of the optimization horizon
         ================================= ======================== ==== =======================================
 
     """  # noqa E:501
+
     CONSTRAINT_GROUP = True
 
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)
 

Check failure on line 2422 in /home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/experimental/_sink_dsm.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/experimental/_sink_dsm.py#L2412-L2422

         :math:`\mathbb{P}`                                         S    Periods of the model
         :math:`\textrm{TIMEINDEX}`                                 S    Timeindex set of the model (periods, timesteps)
         ================================= ======================== ==== =======================================
 
     """  # noqa: E501
+
     CONSTRAINT_GROUP = True
 
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)
 

Check failure on line 3618 in /home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/experimental/_sink_dsm.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/experimental/_sink_dsm.py#L3608-L3618

                                                                                                | resp. in the last hours before the current"
             :math:`year_{max}`                                                            P    Last year of the optimization horizon
             =========================================== ================================= ==== =======================================
 
     """  # noqa: E501
+
     CONSTRAINT_GROUP = True
 
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)
 

Check failure on line 4689 in /home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/experimental/_sink_dsm.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/oemof-solph/oemof-solph/src/oemof/solph/components/experimental/_sink_dsm.py#L4679-L4689

         :math:`\mathbb{P}`                                         S    Periods of the model
         :math:`\textrm{TIMEINDEX}`                                 S    Timeindex set of the model (periods, timesteps)
         ================================= ======================== ==== =======================================
 
     """  # noqa: E501
+
     CONSTRAINT_GROUP = True
 
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)