Pylint report from report.jinja2

Score

7.30 / 10 (previous score: 7.30 / 10)

Messages

Module agentlib_flexquant (agentlib_flexquant/__init__.py)

Line Col. Type Symbol ID Obj Message
3 0 error import-error E0401
Unable to import 'agentlib.utils.plugin_import'
4 0 error import-error E0401
Unable to import 'agentlib_mpc.optimization_backends'

Module agentlib_flexquant.data_structures.flex_kpis (agentlib_flexquant/data_structures/flex_kpis.py)

Line Col. Type Symbol ID Obj Message
8 0 error import-error E0401
Unable to import 'numpy'
9 0 error import-error E0401
Unable to import 'pandas'
10 0 error import-error E0401
Unable to import 'pydantic'
11 0 error import-error E0401
Unable to import 'agentlib_mpc.utils'
19 0 warning unused-import W0611
Unused strip_multi_index imported from agentlib_flexquant.utils.data_handling
22 0 refactor too-few-public-methods R0903 KPI
Too few public methods (1/2)
41 4 refactor too-few-public-methods R0903 KPI.Config
Too few public methods (0/2)
52 0 convention trailing-whitespace C0303
Trailing whitespace
72 8 convention invalid-name C0103 KPISeries._get_dt
Variable name "dt" doesn't conform to snake_case naming style
76 8 convention invalid-name C0103 KPISeries._get_dt
Attribute name "dt" doesn't conform to snake_case naming style
95 4 refactor inconsistent-return-statements R1710 KPISeries.integrate
Either all return statements in a function should return an expression, or none of them should.
118 0 convention trailing-whitespace C0303
Trailing whitespace
164 0 convention line-too-long C0301
Line too long (115/100)
191 4 refactor too-many-arguments R0913 FlexibilityKPIs.calculate
Too many arguments (13/5)
257 4 refactor too-many-arguments R0913 FlexibilityKPIs._calculate_power_flex
Too many arguments (6/5)
353 8 refactor no-else-return R1705 FlexibilityKPIs._get_series_for_integration
Unnecessary "else" after "return", remove the "else" and de-indent the code inside it
354 21 convention unnecessary-dunder-call C2801 FlexibilityKPIs._get_series_for_integration
Unnecessarily calls dunder method __deepcopy__. Use copy.deepcopy function.
358 19 convention unnecessary-dunder-call C2801 FlexibilityKPIs._get_series_for_integration
Unnecessarily calls dunder method __deepcopy__. Use copy.deepcopy function.
380 4 refactor too-many-arguments R0913 FlexibilityKPIs._calculate_costs
Too many arguments (9/5)
380 4 refactor too-many-locals R0914 FlexibilityKPIs._calculate_costs
Too many local variables (17/15)
417 0 convention line-too-long C0301
Line too long (119/100)
564 4 refactor too-few-public-methods R0903 FlexibilityData.Config
Too few public methods (0/2)
570 4 refactor too-many-arguments R0913 FlexibilityData.__init__
Too many arguments (6/5)
598 12 warning self-assigning-variable W0127 FlexibilityData.unify_inputs
Assigning the same variable 'series' to itself
701 29 convention trailing-whitespace C0303
Trailing whitespace
705 0 convention trailing-whitespace C0303
Trailing whitespace

Module agentlib_flexquant.data_structures.flex_offer (agentlib_flexquant/data_structures/flex_offer.py)

Line Col. Type Symbol ID Obj Message
12 0 error import-error E0401
Unable to import 'pandas'
13 0 error import-error E0401
Unable to import 'pydantic'
14 0 error import-error E0401
Unable to import 'agentlib.core.datamodels'
15 0 error import-error E0401
Unable to import 'pydantic'
26 0 refactor too-few-public-methods R0903 FlexOffer
Too few public methods (1/2)
65 4 refactor too-few-public-methods R0903 FlexOffer.Config
Too few public methods (0/2)
90 8 convention invalid-name C0103 FlexOffer.as_dataframe
Variable name "df" doesn't conform to snake_case naming style

Module agentlib_flexquant.data_structures.flex_results (agentlib_flexquant/data_structures/flex_results.py)

Line Col. Type Symbol ID Obj Message
11 0 error import-error E0401
Unable to import 'pandas'
12 0 error import-error E0401
Unable to import 'pydantic'
13 0 error import-error E0401
Unable to import 'agentlib.core.agent'
14 0 error import-error E0401
Unable to import 'agentlib.modules.simulation.simulator'
15 0 error import-error E0401
Unable to import 'agentlib.utils'
16 0 error import-error E0401
Unable to import 'agentlib_mpc.modules.mpc.mpc'
17 0 error import-error E0401
Unable to import 'agentlib_mpc.utils'
18 0 error import-error E0401
Unable to import 'agentlib_mpc.utils.analysis'
48 4 convention invalid-name C0103 load_indicator
Variable name "df" doesn't conform to snake_case naming style
62 4 convention invalid-name C0103 load_market
Variable name "df" doesn't conform to snake_case naming style
66 0 refactor too-many-instance-attributes R0902 Results
Too many instance attributes (29/7)
113 4 refactor too-many-arguments R0913 Results.__init__
Too many arguments (6/5)
178 65 convention invalid-name C0103 Results._load_flex_config
Variable name "f" doesn't conform to snake_case naming style
278 12 convention import-outside-toplevel C0415 Results._load_agent_module_configs
Import outside toplevel (warnings)
294 72 convention invalid-name C0103 Results._load_simulator_config
Variable name "f" doesn't conform to snake_case naming style
523 12 convention invalid-name C0103 Results.convert_timescale_of_dataframe_index
Variable name "df" doesn't conform to snake_case naming style

Module agentlib_flexquant.data_structures.flexquant (agentlib_flexquant/data_structures/flexquant.py)

Line Col. Type Symbol ID Obj Message
7 0 error import-error E0401
Unable to import 'pydantic'
9 0 error import-error E0401
Unable to import 'agentlib.core.agent'
10 0 error import-error E0401
Unable to import 'agentlib.core.errors'
11 0 error import-error E0401
Unable to import 'agentlib_mpc.data_structures.mpc_datamodels'
36 0 convention line-too-long C0301
Line too long (106/100)
42 0 convention line-too-long C0301
Line too long (117/100)
64 0 convention trailing-whitespace C0303
Trailing whitespace
68 0 convention trailing-whitespace C0303
Trailing whitespace
72 4 convention missing-function-docstring C0116 ShadowMPCConfigGeneratorConfig.serialize_mpc_variables
Missing function or method docstring
76 0 refactor too-few-public-methods R0903 FlexibilityMarketConfig
Too few public methods (1/2)
100 0 refactor too-few-public-methods R0903 FlexibilityIndicatorConfig
Too few public methods (1/2)
213 4 convention missing-function-docstring C0116 FlexQuantConfig.is_none_negative_integer
Missing function or method docstring

Module agentlib_flexquant.data_structures.globals (agentlib_flexquant/data_structures/globals.py)

Line Col. Type Symbol ID Obj Message
17 0 convention invalid-name C0103
Class name "INTEGRATION_METHOD" doesn't conform to PascalCase naming style

Module agentlib_flexquant.data_structures.market (agentlib_flexquant/data_structures/market.py)

Line Col. Type Symbol ID Obj Message
10 0 error import-error E0401
Unable to import 'pydantic'
15 0 refactor too-few-public-methods R0903 RandomOptions
Too few public methods (0/2)
43 0 refactor too-few-public-methods R0903 SingleOptions
Too few public methods (0/2)
55 0 refactor too-few-public-methods R0903 CustomOptions
Too few public methods (0/2)
63 0 refactor too-few-public-methods R0903 MarketSpecifications
Too few public methods (1/2)
114 0 refactor too-few-public-methods R0903 RandomMarket
Too few public methods (1/2)

Module agentlib_flexquant.data_structures.mpcs (agentlib_flexquant/data_structures/mpcs.py)

Line Col. Type Symbol ID Obj Message
9 0 error import-error E0401
Unable to import 'pydantic'
10 0 error import-error E0401
Unable to import 'agentlib_mpc.data_structures.mpc_datamodels'
11 0 error import-error E0401
Unable to import 'pydantic'
71 0 convention line-too-long C0301
Line too long (109/100)
79 0 convention trailing-whitespace C0303
Trailing whitespace
81 0 refactor too-few-public-methods R0903 BaseMPCData
Too few public methods (1/2)
107 0 convention trailing-whitespace C0303
Trailing whitespace
109 4 convention missing-function-docstring C0116 BaseMPCData.serialize_mpc_variables
Missing function or method docstring
226 0 convention trailing-whitespace C0303
Trailing whitespace
227 0 convention trailing-whitespace C0303
Trailing whitespace
233 16 convention trailing-whitespace C0303
Trailing whitespace
234 44 convention trailing-whitespace C0303
Trailing whitespace
255 0 convention trailing-whitespace C0303
Trailing whitespace
282 88 convention trailing-whitespace C0303
Trailing whitespace
290 0 convention trailing-whitespace C0303
Trailing whitespace
292 16 convention trailing-whitespace C0303
Trailing whitespace
293 44 convention trailing-whitespace C0303
Trailing whitespace

Module agentlib_flexquant.generate_flex_agents (agentlib_flexquant/generate_flex_agents.py)

Line Col. Type Symbol ID Obj Message
1 0 convention too-many-lines C0302
Too many lines in module (1050/1000)
15 0 error import-error E0401
Unable to import 'astor'
16 0 error import-error E0401
Unable to import 'black'
17 0 convention wrong-import-order C0411
standard import "import json" should be placed before "import astor"
18 0 error import-error E0401
Unable to import 'numpy'
19 0 convention wrong-import-order C0411
standard import "from copy import deepcopy" should be placed before "import astor"
20 0 convention wrong-import-order C0411
standard import "from pathlib import Path" should be placed before "import astor"
21 0 convention wrong-import-order C0411
standard import "from typing import Union" should be placed before "import astor"
22 0 error import-error E0401
Unable to import 'pydantic'
23 0 error import-error E0401
Unable to import 'agentlib.core.agent'
24 0 error import-error E0401
Unable to import 'agentlib.core.datamodels'
25 0 error import-error E0401
Unable to import 'agentlib.core.errors'
26 0 error import-error E0401
Unable to import 'agentlib.core.module'
27 0 error import-error E0401
Unable to import 'agentlib.utils'
28 0 error import-error E0401
Unable to import 'agentlib_mpc.data_structures.mpc_datamodels'
29 0 error import-error E0401
Unable to import 'agentlib_mpc.models.casadi_model'
30 0 error import-error E0401
Unable to import 'agentlib_mpc.modules.mpc.mpc_full'
32 0 error import-error E0401
Unable to import 'agentlib_mpc.optimization_backends.casadi_.basic'
33 0 error import-error E0401
Unable to import 'agentlib_mpc.data_structures.casadi_utils'
49 0 refactor too-many-instance-attributes R0902 FlexAgentGenerator
Too many instance attributes (17/7)
239 28 warning unnecessary-lambda W0108 FlexAgentGenerator.generate_flex_agents.<lambda>
Lambda may not be necessary
282 17 convention invalid-name C0103 FlexAgentGenerator.append_module_and_dump_agent
Variable name "f" doesn't conform to snake_case naming style
335 4 refactor too-many-locals R0914 FlexAgentGenerator.adapt_mpc_module_config
Too many local variables (22/15)
335 4 refactor too-many-branches R0912 FlexAgentGenerator.adapt_mpc_module_config
Too many branches (27/12)
335 4 refactor too-many-statements R0915 FlexAgentGenerator.adapt_mpc_module_config
Too many statements (73/50)
458 19 warning redefined-builtin W0622 FlexAgentGenerator.adapt_mpc_module_config
Redefining built-in 'input'
569 16 warning logging-fstring-interpolation W1203 FlexAgentGenerator.adapt_mpc_module_config
Use lazy % formatting in logging functions
662 16 convention unnecessary-dunder-call C2801 FlexAgentGenerator.adapt_market_module_config
Unnecessarily calls dunder method __setattr__. Set attribute directly or use setattr built-in function.
710 46 convention invalid-name C0103 FlexAgentGenerator.adapt_and_dump_flex_config
Variable name "f" doesn't conform to snake_case naming style
726 29 warning protected-access W0212 FlexAgentGenerator.get_collocation_time_grid
Access to a protected member _collocation_polynomial of a client class
739 4 refactor too-many-locals R0914 FlexAgentGenerator._generate_flex_model_definition
Too many local variables (18/15)
760 0 convention line-too-long C0301
Line too long (110/100)
761 0 convention line-too-long C0301
Line too long (115/100)
768 0 convention line-too-long C0301
Line too long (110/100)
769 0 convention line-too-long C0301
Line too long (115/100)
774 65 convention invalid-name C0103 FlexAgentGenerator._generate_flex_model_definition
Variable name "f" doesn't conform to snake_case naming style
824 57 convention invalid-name C0103 FlexAgentGenerator._generate_flex_model_definition
Variable name "f" doesn't conform to snake_case naming style
856 12 warning logging-fstring-interpolation W1203 FlexAgentGenerator.check_variables_in_casadi_config
Use lazy % formatting in logging functions
860 4 refactor too-many-branches R0912 FlexAgentGenerator.run_config_validations
Too many branches (19/12)
924 8 refactor no-else-raise R1720 FlexAgentGenerator.run_config_validations
Unnecessary "else" after "raise", remove the "else" and de-indent the code inside it
1027 68 convention invalid-name C0103 FlexAgentGenerator.adapt_sim_results_path
Variable name "f" doesn't conform to snake_case naming style
1042 48 convention invalid-name C0103 FlexAgentGenerator.adapt_sim_results_path
Variable name "f" doesn't conform to snake_case naming style
1046 8 convention invalid-name C0103 FlexAgentGenerator.adapt_sim_results_path
Variable name "e" doesn't conform to snake_case naming style
1047 12 warning raise-missing-from W0707 FlexAgentGenerator.adapt_sim_results_path
Consider explicitly re-raising using 'raise Exception(f"Could not adapt and create a new simulation config due to: {e}. Please check {simulator_agent_config} and '{save_name_suffix}'") from e'
1047 12 warning broad-exception-raised W0719 FlexAgentGenerator.adapt_sim_results_path
Raising too general exception: Exception

Module agentlib_flexquant.modules.baseline_mpc (agentlib_flexquant/modules/baseline_mpc.py)

Line Col. Type Symbol ID Obj Message
6 0 error import-error E0401
Unable to import 'numpy'
7 0 error import-error E0401
Unable to import 'pandas'
8 0 convention wrong-import-order C0411
standard import "from typing import Optional, Dict" should be placed before "import numpy as np"
9 0 error import-error E0401
Unable to import 'pydantic'
10 0 convention wrong-import-order C0411
standard import "from collections.abc import Iterable" should be placed before "import numpy as np"
12 0 error import-error E0401
Unable to import 'agentlib'
12 0 convention wrong-import-order C0411
third party import "from agentlib import AgentVariable" should be placed before "import agentlib_flexquant.data_structures.globals as glbs"
13 0 error import-error E0401
Unable to import 'agentlib_mpc.modules.mpc'
13 0 convention wrong-import-order C0411
third party import "from agentlib_mpc.modules.mpc import mpc_full, minlp_mpc" should be placed before "import agentlib_flexquant.data_structures.globals as glbs"
14 0 error import-error E0401
Unable to import 'agentlib_mpc.data_structures.mpc_datamodels'
14 0 convention wrong-import-order C0411
third party import "from agentlib_mpc.data_structures.mpc_datamodels import Results, InitStatus" should be placed before "import agentlib_flexquant.data_structures.globals as glbs"
19 0 convention missing-class-docstring C0115 FlexibilityBaselineMPCConfig
Missing class docstring
19 0 refactor too-few-public-methods R0903 FlexibilityBaselineMPCConfig
Too few public methods (0/2)
138 4 convention missing-function-docstring C0116 FlexibilityBaselineMPC.set_actuation
Missing function or method docstring
160 8 convention invalid-name C0103 FlexibilityBaselineMPC.set_output
Variable name "df" doesn't conform to snake_case naming style
294 4 refactor too-many-arguments R0913 FlexibilityBaselineMPC._run_simulation
Too many arguments (6/5)
294 4 refactor too-many-locals R0914 FlexibilityBaselineMPC._run_simulation
Too many local variables (18/15)
295 49 warning unused-argument W0613 FlexibilityBaselineMPC._run_simulation
Unused argument 'mpc_time_step'
330 30 warning eval-used W0123 FlexibilityBaselineMPC._run_simulation
Use of eval
350 0 convention missing-class-docstring C0115 FlexibilityBaselineMINLPMPCConfig
Missing class docstring
350 0 refactor too-few-public-methods R0903 FlexibilityBaselineMINLPMPCConfig
Too few public methods (0/2)
471 4 convention missing-function-docstring C0116 FlexibilityBaselineMINLPMPC.set_actuation
Missing function or method docstring
492 8 convention invalid-name C0103 FlexibilityBaselineMINLPMPC.set_output
Variable name "df" doesn't conform to snake_case naming style
625 4 refactor too-many-arguments R0913 FlexibilityBaselineMINLPMPC._run_simulation
Too many arguments (6/5)
625 4 refactor too-many-locals R0914 FlexibilityBaselineMINLPMPC._run_simulation
Too many local variables (19/15)
626 49 warning unused-argument W0613 FlexibilityBaselineMINLPMPC._run_simulation
Unused argument 'mpc_time_step'
670 30 warning eval-used W0123 FlexibilityBaselineMINLPMPC._run_simulation
Use of eval

Module agentlib_flexquant.modules.flexibility_indicator (agentlib_flexquant/modules/flexibility_indicator.py)

Line Col. Type Symbol ID Obj Message
14 0 error import-error E0401
Unable to import 'agentlib'
15 0 error import-error E0401
Unable to import 'numpy'
16 0 error import-error E0401
Unable to import 'pandas'
17 0 error import-error E0401
Unable to import 'pydantic'
28 0 refactor too-few-public-methods R0903 InputsForCorrectFlexCosts
Too few public methods (0/2)
58 0 refactor too-few-public-methods R0903 InputsForCalculateFlexCosts
Too few public methods (1/2)
118 0 refactor too-few-public-methods R0903 FlexibilityIndicatorModuleConfig
Too few public methods (1/2)
365 22 convention trailing-whitespace C0303
Trailing whitespace
373 64 convention trailing-whitespace C0303
Trailing whitespace
375 35 convention trailing-whitespace C0303
Trailing whitespace
385 0 convention line-too-long C0301
Line too long (102/100)
385 4 convention missing-function-docstring C0116 CallBackHandler.update_price_variables
Missing function or method docstring
394 0 convention line-too-long C0301
Line too long (134/100)
395 0 convention trailing-whitespace C0303
Trailing whitespace
403 0 convention line-too-long C0301
Line too long (138/100)
405 0 convention trailing-whitespace C0303
Trailing whitespace
406 0 convention line-too-long C0301
Line too long (128/100)
406 4 convention missing-function-docstring C0116 CallBackHandler.initialize_callback_variables
Missing function or method docstring
411 0 convention line-too-long C0301
Line too long (103/100)
412 0 convention line-too-long C0301
Line too long (103/100)
414 0 convention trailing-whitespace C0303
Trailing whitespace
416 0 convention trailing-whitespace C0303
Trailing whitespace
419 12 warning unused-variable W0612 CallBackHandler.set_all_callback_variables_to_none
Unused variable 'alias'
423 98 convention trailing-whitespace C0303
Trailing whitespace
426 33 convention trailing-whitespace C0303
Trailing whitespace
430 0 convention trailing-whitespace C0303
Trailing whitespace
433 0 convention line-too-long C0301
Line too long (114/100)
454 8 convention invalid-name C0103 FlexibilityIndicatorModule.__init__
Attribute name "df" doesn't conform to snake_case naming style
463 0 convention line-too-long C0301
Line too long (107/100)
465 4 convention missing-function-docstring C0116 FlexibilityIndicatorModule.register_callbacks
Missing function or method docstring
483 11 convention trailing-whitespace C0303
Trailing whitespace
484 0 convention trailing-whitespace C0303
Trailing whitespace
490 13 convention trailing-whitespace C0303
Trailing whitespace
491 0 convention line-too-long C0301
Line too long (102/100)
492 0 convention trailing-whitespace C0303
Trailing whitespace
499 75 convention trailing-whitespace C0303
Trailing whitespace
502 0 convention trailing-whitespace C0303
Trailing whitespace
513 28 convention invalid-name C0103 FlexibilityIndicatorModule.write_results
Argument name "df" doesn't conform to snake_case naming style
513 46 convention invalid-name C0103 FlexibilityIndicatorModule.write_results
Argument name "ts" doesn't conform to snake_case naming style
513 57 convention invalid-name C0103 FlexibilityIndicatorModule.write_results
Argument name "n" doesn't conform to snake_case naming style
513 4 refactor too-many-locals R0914 FlexibilityIndicatorModule.write_results
Too many local variables (18/15)
513 4 refactor too-many-branches R0912 FlexibilityIndicatorModule.write_results
Too many branches (16/12)
573 12 warning unused-variable W0612 FlexibilityIndicatorModule.write_results
Unused variable 'i'
674 4 refactor too-many-arguments R0913 FlexibilityIndicatorModule.send_flex_offer
Too many arguments (8/5)
752 0 convention trailing-newlines C0305
Trailing newlines

Module agentlib_flexquant.modules.flexibility_market (agentlib_flexquant/modules/flexibility_market.py)

Line Col. Type Symbol ID Obj Message
1 0 convention missing-module-docstring C0114
Missing module docstring
5 0 error import-error E0401
Unable to import 'agentlib'
6 0 error import-error E0401
Unable to import 'numpy'
7 0 error import-error E0401
Unable to import 'pandas'
9 0 error import-error E0401
Unable to import 'agentlib.core.datamodels'
9 0 convention wrong-import-order C0411
third party import "from agentlib.core.datamodels import AgentVariable" should be placed before "import agentlib_flexquant.data_structures.globals as glbs"
10 0 error import-error E0401
Unable to import 'pydantic'
10 0 convention wrong-import-order C0411
third party import "from pydantic import ConfigDict, Field, model_validator" should be placed before "import agentlib_flexquant.data_structures.globals as glbs"
16 0 convention missing-class-docstring C0115 FlexibilityMarketModuleConfig
Missing class docstring
16 0 refactor too-few-public-methods R0903 FlexibilityMarketModuleConfig
Too few public methods (1/2)
62 4 convention missing-function-docstring C0116 FlexibilityMarketModuleConfig.check_results_file_extension
Missing function or method docstring
85 8 warning attribute-defined-outside-init W0201 FlexibilityMarketModule.set_random_seed
Attribute 'random_generator' defined outside __init__
97 4 convention missing-function-docstring C0116 FlexibilityMarketModule.register_callbacks
Missing function or method docstring
119 8 warning attribute-defined-outside-init W0201 FlexibilityMarketModule.register_callbacks
Attribute 'cooldown_ticker' defined outside __init__
125 8 convention invalid-name C0103 FlexibilityMarketModule.write_results
Variable name "df" doesn't conform to snake_case naming style
137 62 warning unused-argument W0613 FlexibilityMarketModule.random_flexibility_callback
Unused argument 'name'
200 20 warning attribute-defined-outside-init W0201 FlexibilityMarketModule.random_flexibility_callback
Attribute 'cooldown_ticker' defined outside __init__
207 62 warning unused-argument W0613 FlexibilityMarketModule.single_flexibility_callback
Unused argument 'name'
265 8 warning unnecessary-pass W0107 FlexibilityMarketModule.custom_flexibility_callback
Unnecessary pass statement
267 29 warning unused-argument W0613 FlexibilityMarketModule.dummy_callback
Unused argument 'inp'
267 49 warning unused-argument W0613 FlexibilityMarketModule.dummy_callback
Unused argument 'name'
278 4 convention missing-function-docstring C0116 FlexibilityMarketModule.process
Missing function or method docstring

Module agentlib_flexquant.modules.shadow_mpc (agentlib_flexquant/modules/shadow_mpc.py)

Line Col. Type Symbol ID Obj Message
6 0 error import-error E0401
Unable to import 'numpy'
7 0 error import-error E0401
Unable to import 'pandas'
8 0 error import-error E0401
Unable to import 'pydantic'
9 0 convention wrong-import-order C0411
standard import "from typing import Dict, Union, Optional" should be placed before "import numpy as np"
10 0 convention wrong-import-order C0411
standard import "from collections.abc import Iterable" should be placed before "import numpy as np"
11 0 error import-error E0401
Unable to import 'agentlib.core.datamodels'
12 0 error import-error E0401
Unable to import 'agentlib_mpc.modules.mpc'
20 0 convention missing-class-docstring C0115 FlexibilityShadowMPCConfig
Missing class docstring
20 0 refactor too-few-public-methods R0903 FlexibilityShadowMPCConfig
Too few public methods (0/2)
90 8 convention invalid-name C0103 FlexibilityShadowMPC.set_output
Variable name "df" doesn't conform to snake_case naming style
115 0 convention line-too-long C0301
Line too long (102/100)
156 4 convention missing-function-docstring C0116 FlexibilityShadowMPC.register_callbacks
Missing function or method docstring
166 0 convention line-too-long C0301
Line too long (102/100)
179 0 convention line-too-long C0301
Line too long (102/100)
223 4 convention missing-function-docstring C0116 FlexibilityShadowMPC.process
Missing function or method docstring
289 4 refactor too-many-arguments R0913 FlexibilityShadowMPC._run_simulation
Too many arguments (6/5)
289 4 refactor too-many-locals R0914 FlexibilityShadowMPC._run_simulation
Too many local variables (18/15)
290 49 warning unused-argument W0613 FlexibilityShadowMPC._run_simulation
Unused argument 'mpc_time_step'
320 30 warning eval-used W0123 FlexibilityShadowMPC._run_simulation
Use of eval
339 0 convention missing-class-docstring C0115 FlexibilityShadowMINLPMPCConfig
Missing class docstring
339 0 refactor too-few-public-methods R0903 FlexibilityShadowMINLPMPCConfig
Too few public methods (0/2)
404 4 convention missing-function-docstring C0116 FlexibilityShadowMINLPMPC.register_callbacks
Missing function or method docstring
414 0 convention line-too-long C0301
Line too long (102/100)
427 0 convention line-too-long C0301
Line too long (102/100)
472 4 convention missing-function-docstring C0116 FlexibilityShadowMINLPMPC.process
Missing function or method docstring
489 8 convention invalid-name C0103 FlexibilityShadowMINLPMPC.set_output
Variable name "df" doesn't conform to snake_case naming style
515 0 convention line-too-long C0301
Line too long (102/100)
612 4 refactor too-many-arguments R0913 FlexibilityShadowMINLPMPC._run_simulation
Too many arguments (6/5)
612 4 refactor too-many-locals R0914 FlexibilityShadowMINLPMPC._run_simulation
Too many local variables (19/15)
613 49 warning unused-argument W0613 FlexibilityShadowMINLPMPC._run_simulation
Unused argument 'mpc_time_step'
650 30 warning eval-used W0123 FlexibilityShadowMINLPMPC._run_simulation
Use of eval

Module agentlib_flexquant.optimization_backends.constrained_cia (agentlib_flexquant/optimization_backends/constrained_cia.py)

Line Col. Type Symbol ID Obj Message
1 0 convention missing-module-docstring C0114
Missing module docstring
1 0 error import-error E0401
Unable to import 'pydantic'
2 0 error import-error E0401
Unable to import 'numpy'
3 0 error import-error E0401
Unable to import 'agentlib.core.errors'
4 0 error import-error E0401
Unable to import 'agentlib_mpc.optimization_backends.casadi_.minlp_cia'
5 0 error import-error E0401
Unable to import 'agentlib_mpc.optimization_backends.casadi_.core.casadi_backend'
6 0 error import-error E0401
Unable to import 'agentlib_mpc.data_structures.mpc_datamodels'
8 0 error import-error E0401
Unable to import 'agentlib_mpc.optimization_backends.casadi_.core.discretization'
8 0 convention wrong-import-order C0411
third party import "from agentlib_mpc.optimization_backends.casadi_.core.discretization import Results" should be placed before "from agentlib_flexquant.data_structures.globals import full_trajectory_suffix"
8 0 convention ungrouped-imports C0412
Imports from package agentlib_mpc are not grouped
13 4 warning raise-missing-from W0707
Consider explicitly re-raising using 'except ImportError as exc' and 'raise OptionalDependencyError(used_object='Pycombina', dependency_install='.\\ after cloning pycombina. Instructions: https://pycombina.readthedocs.io/en/latest/install.html#') from exc'
15 29 warning anomalous-backslash-in-string W1401
Anomalous backslash in string: '\ '. String constant might be missing an r prefix.
20 0 convention missing-class-docstring C0115 ConstrainedCIABackendConfig
Missing class docstring
20 0 refactor too-few-public-methods R0903 ConstrainedCIABackendConfig
Too few public methods (0/2)
36 4 convention missing-class-docstring C0115 ConstrainedCIABackendConfig.Config
Missing class docstring
36 4 refactor too-few-public-methods R0903 ConstrainedCIABackendConfig.Config
Too few public methods (0/2)
41 0 convention missing-class-docstring C0115 ConstrainedCasADiCIABackend
Missing class docstring
45 4 warning useless-parent-delegation W0246 ConstrainedCasADiCIABackend.__init__
Useless parent or super() delegation in method '__init__'
48 4 convention missing-function-docstring C0116 ConstrainedCasADiCIABackend.solve
Missing function or method docstring
48 4 refactor too-many-locals R0914 ConstrainedCasADiCIABackend.solve
Too many local variables (20/15)
97 4 convention missing-function-docstring C0116 ConstrainedCasADiCIABackend.do_pycombina
Missing function or method docstring
134 4 convention missing-function-docstring C0116 ConstrainedCasADiCIABackend.get_baseline_binary_solution
Missing function or method docstring
134 4 refactor inconsistent-return-statements R1710 ConstrainedCasADiCIABackend.get_baseline_binary_solution
Either all return statements in a function should return an expression, or none of them should.
148 0 convention missing-final-newline C0304
Final newline missing

Module agentlib_flexquant.utils.config_management (agentlib_flexquant/utils/config_management.py)

Line Col. Type Symbol ID Obj Message
1 0 convention missing-module-docstring C0114
Missing module docstring
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[315:349]
==agentlib_flexquant.modules.shadow_mpc:[306:338]
        for i in range(0, n_simulation_steps):
            current_sim_time = i * sim_time_step

            # Apply control and input values from the appropriate MPC step
            for control, value in zip(
                self.var_ref.controls, control_values_full.loc[current_sim_time]
            ):
                self.flex_model.set(control, value)

            for input_var, value in zip(
                self.var_ref.inputs, input_values_full.loc[current_sim_time]
            ):
                # change the type of iterable input, since casadi model can't deal with iterable
                if issubclass(eval(self.flex_model.get(input_var).type), Iterable):
                    self.flex_model.get(input_var).type = type(value).__name__
                self.flex_model.set(input_var, value)

            # do integration
            # reduce the simulation time step so that the total horizon time will not be exceeded
            if current_sim_time + sim_time_step <= total_horizon_time:
                t_sample = sim_time_step
            else:
                t_sample = total_horizon_time - current_sim_time
            self.flex_model.do_step(t_start=0, t_sample=t_sample)

            # save output
            for output in self.var_ref.outputs:
                self.flex_results.loc[
                    (self.env.now, current_sim_time + t_sample), output
                ] = self.flex_model.get_output(output).value

1 0 refactor duplicate-code R0801
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[217:257]
==agentlib_flexquant.modules.shadow_mpc:[540:580]
        )

        # set index of flex results to the same as mpc result
        store_results_df = self.flex_results.copy(deep=True)
        store_results_df.index = self.flex_results.index.tolist()

        # save results
        if not os.path.exists(self.res_file_flex):
            store_results_df.to_csv(self.res_file_flex)
        else:
            store_results_df.to_csv(self.res_file_flex, mode="a", header=False)

        # set the flex results format same as mpc result while updating Agentvariable
        self.flex_results.index = self.flex_results.index.get_level_values(1)

    def _initialize_flex_results(
        self, n_simulation_steps, horizon_length, sim_time_step, result_df
    ):
        """Initialize the flex results dataframe with the correct dimension
        and index and fill with existing results from optimization

        """

        # create MultiIndex for collocation points
        index_coll = pd.MultiIndex.from_arrays(
            [[self.env.now] * len(result_df.index), result_df.index],
            names=["time_step", "time"]
            # Match the names with multi_index but note they're reversed
        )
        # create Multiindex for full simulation sample times
        index_full_sample = pd.MultiIndex.from_tuples(
            zip(
                [self.env.now] * (n_simulation_steps + 1),
                range(0, horizon_length + sim_time_step, sim_time_step),
            ),
            names=["time_step", "time"],
        )
        # merge indexes
        new_index = index_coll.union(index_full_sample).sort_values()
        # initialize the flex results with correct dimension
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[258:306]
==agentlib_flexquant.modules.shadow_mpc:[253:300]
                                         columns=self.var_ref.outputs)

        # Get the optimization outputs and create a series for fixed
        # optimization outputs with the correct MultiIndex format
        opti_outputs = result_df.variable[self.config.power_variable_name]
        fixed_opti_output = pd.Series(
            opti_outputs.values,
            index=index_coll,
        )
        # fill the output value at the time step where it already exists
        # in optimization output
        for idx in fixed_opti_output.index:
            if idx in self.flex_results.index:
                self.flex_results.loc[idx, self.config.power_variable_name] = (
                    fixed_opti_output)[idx]

    def _update_model_parameters(self):
        """update the value of module parameters with value from config,
        since creating a model just reads the value in the model class but
        not the config

        """

        for par in self.config.parameters:
            self.flex_model.set(par.name, par.value)

    def _update_initial_states(self, result_df):
        """set the initial value of states"""

        # get state values from the mpc optimization result
        state_values = result_df.variable[self.var_ref.states]
        # update state values with last measurement
        for state, value in zip(self.var_ref.states, state_values.iloc[0]):
            self.flex_model.set(state, value)

    def _run_simulation(
        self, n_simulation_steps, sim_time_step, mpc_time_step, result_df,
            total_horizon_time
    ):
        """simulate with flex model over the prediction horizon

        """

        # get control and input values from the mpc optimization result
        control_values = result_df.variable[self.var_ref.controls].dropna()
        input_values = result_df.parameter[self.var_ref.inputs].dropna()

        # Get the simulation time step index
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[648:687]
==agentlib_flexquant.modules.shadow_mpc:[629:666]
        for i in range(0, n_simulation_steps):
            current_sim_time = i * sim_time_step

            # Apply control and input values from the appropriate MPC step
            for control, value in zip(
                self.var_ref.controls,
                control_values_full.loc[current_sim_time, self.var_ref.controls],
            ):
                self.flex_model.set(control, value)

            for binary_control, value in zip(
                self.var_ref.binary_controls,
                control_values_full.loc[current_sim_time, self.var_ref.binary_controls],
            ):
                self.flex_model.set(binary_control, value)

            for input_var, value in zip(
                self.var_ref.inputs, input_values_full.loc[current_sim_time]
            ):
                # change the type of iterable input, since casadi model can't
                # deal with iterable
                if issubclass(eval(self.flex_model.get(input_var).type), Iterable):
                    self.flex_model.get(input_var).type = type(value).__name__
                self.flex_model.set(input_var, value)

            # do integration
            # reduce the simulation time step so that the total horizon time
            # will not be exceeded
            if current_sim_time + sim_time_step <= total_horizon_time:
                t_sample = sim_time_step
            else:
                t_sample = total_horizon_time - current_sim_time
            self.flex_model.do_step(t_start=0, t_sample=t_sample)

            # save output
            for output in self.var_ref.outputs:
                self.flex_results.loc[
                    (self.env.now, current_sim_time + t_sample), output
                ] = self.flex_model.get_output(output).value
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[151:174]
==agentlib_flexquant.modules.shadow_mpc:[481:501]
        if not self.config.set_outputs:
            return
        self.logger.info("Sending optimal output values to data_broker.")

        # simulate with the casadi simulator
        self.sim_flex_model(solution)

        # extract solution DataFrama
        df = solution.df

        # send the outputs
        if self.flex_results is not None:
            for output in self.var_ref.outputs:
                if output not in [
                    self.config.power_variable_name,
                    self.config.storage_variable_name,
                ]:
                    series = df.variable[output]
                    self.set(output, series)
            # send the power and storage variable value from simulation results
            upsampled_output_power = self.flex_results[self.config.power_variable_name]
            self.set(self.config.power_variable_name, upsampled_output_power)
            if self.config.storage_variable_name is not None:
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[324:349]
==agentlib_flexquant.modules.shadow_mpc:[645:666]
            for input_var, value in zip(
                self.var_ref.inputs, input_values_full.loc[current_sim_time]
            ):
                # change the type of iterable input, since casadi model can't deal with iterable
                if issubclass(eval(self.flex_model.get(input_var).type), Iterable):
                    self.flex_model.get(input_var).type = type(value).__name__
                self.flex_model.set(input_var, value)

            # do integration
            # reduce the simulation time step so that the total horizon time will not be exceeded
            if current_sim_time + sim_time_step <= total_horizon_time:
                t_sample = sim_time_step
            else:
                t_sample = total_horizon_time - current_sim_time
            self.flex_model.do_step(t_start=0, t_sample=t_sample)

            # save output
            for output in self.var_ref.outputs:
                self.flex_results.loc[
                    (self.env.now, current_sim_time + t_sample), output
                ] = self.flex_model.get_output(output).value
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[664:687]
==agentlib_flexquant.modules.shadow_mpc:[315:338]
            for input_var, value in zip(
                self.var_ref.inputs, input_values_full.loc[current_sim_time]
            ):
                # change the type of iterable input, since casadi model can't
                # deal with iterable
                if issubclass(eval(self.flex_model.get(input_var).type), Iterable):
                    self.flex_model.get(input_var).type = type(value).__name__
                self.flex_model.set(input_var, value)

            # do integration
            # reduce the simulation time step so that the total horizon time
            # will not be exceeded
            if current_sim_time + sim_time_step <= total_horizon_time:
                t_sample = sim_time_step
            else:
                t_sample = total_horizon_time - current_sim_time
            self.flex_model.do_step(t_start=0, t_sample=t_sample)

            # save output
            for output in self.var_ref.outputs:
                self.flex_results.loc[
                    (self.env.now, current_sim_time + t_sample), output
                ] = self.flex_model.get_output(output).value
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[589:633]
==agentlib_flexquant.modules.shadow_mpc:[253:296]
                                         columns=self.var_ref.outputs)

        # Get the optimization outputs and create a series for fixed
        # optimization outputs with the correct MultiIndex format
        opti_outputs = result_df.variable[self.config.power_variable_name]
        fixed_opti_output = pd.Series(
            opti_outputs.values,
            index=index_coll,
        )
        # fill the output value at the time step where it already exists
        # in optimization output
        for idx in fixed_opti_output.index:
            if idx in self.flex_results.index:
                self.flex_results.loc[idx, self.config.power_variable_name] = (
                    fixed_opti_output)[idx]

    def _update_model_parameters(self):
        """update the value of module parameters with value from config,
        since creating a model just reads the value in the model class but
        not the config

        """

        for par in self.config.parameters:
            self.flex_model.set(par.name, par.value)

    def _update_initial_states(self, result_df):
        """set the initial value of states"""

        # get state values from the mpc optimization result
        state_values = result_df.variable[self.var_ref.states]
        # update state values with last measurement
        for state, value in zip(self.var_ref.states, state_values.iloc[0]):
            self.flex_model.set(state, value)

    def _run_simulation(
        self, n_simulation_steps, sim_time_step, mpc_time_step, result_df,
            total_horizon_time
    ):
        """simulate with flex model over the prediction horizon

        """

        # get control and input values from the mpc optimization result
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[484:501]
==agentlib_flexquant.modules.shadow_mpc:[481:498]
        if not self.config.set_outputs:
            return
        self.logger.info("Sending optimal output values to data_broker.")

        # simulate with the casadi simulator
        self.sim_flex_model(solution)

        df = solution.df
        if self.flex_results is not None:
            for output in self.var_ref.outputs:
                if output not in [
                    self.config.power_variable_name,
                    self.config.storage_variable_name,
                ]:
                    series = df.variable[output]
                    self.set(output, series)
            # send the power and storage variable value from simulation results
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[241:257]
==agentlib_flexquant.modules.shadow_mpc:[235:251]
        index_coll = pd.MultiIndex.from_arrays(
            [[self.env.now] * len(result_df.index), result_df.index],
            names=["time_step", "time"]
            # Match the names with multi_index but note they're reversed
        )
        # create Multiindex for full simulation sample times
        index_full_sample = pd.MultiIndex.from_tuples(
            zip(
                [self.env.now] * (n_simulation_steps + 1),
                range(0, horizon_length + sim_time_step, sim_time_step),
            ),
            names=["time_step", "time"],
        )
        # merge indexes
        new_index = index_coll.union(index_full_sample).sort_values()
        # initialize the flex results with correct dimension
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[522:546]
==agentlib_flexquant.modules.shadow_mpc:[515:539]
            return

        # read the defined simulation time step
        sim_time_step = self.config.casadi_sim_time_step
        mpc_time_step = self.config.time_step

        # set the horizon length and the number of simulation steps
        total_horizon_time = int(self.config.prediction_horizon * self.config.time_step)
        n_simulation_steps = math.ceil(total_horizon_time / sim_time_step)

        # read the current optimization result
        result_df = solution.df

        # initialize the flex sim results Dataframe
        self._initialize_flex_results(
            n_simulation_steps, total_horizon_time, sim_time_step, result_df
        )

        # Update model parameters and initial states
        self._update_model_parameters()
        self._update_initial_states(result_df)

        # Run simulation
        self._run_simulation(
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[191:215]
==agentlib_flexquant.modules.shadow_mpc:[115:139]
            return

        # read the defined simulation time step
        sim_time_step = self.config.casadi_sim_time_step
        mpc_time_step = self.config.time_step

        # set the horizon length and the number of simulation steps
        total_horizon_time = int(self.config.prediction_horizon * self.config.time_step)
        n_simulation_steps = math.ceil(total_horizon_time / sim_time_step)

        # read the current optimization result
        result_df = solution.df

        # initialize the flex sim results Dataframe
        self._initialize_flex_results(
            n_simulation_steps, total_horizon_time, sim_time_step, result_df
        )

        # Update model parameters and initial states
        self._update_model_parameters()
        self._update_initial_states(result_df)

        # Run simulation
        self._run_simulation(
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==agentlib_flexquant.data_structures.flexquant:[18:31]
==agentlib_flexquant.data_structures.mpcs:[15:27]
excluded_fields = [
        "rdf_class",
        "source",
        "type",
        "timestamp",
        "description",
        "unit",
        "clip",
        "interpolation_method",
        "allowed_values",
    ]
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[162:174]
==agentlib_flexquant.modules.shadow_mpc:[91:103]
        if self.flex_results is not None:
            for output in self.var_ref.outputs:
                if output not in [
                    self.config.power_variable_name,
                    self.config.storage_variable_name,
                ]:
                    series = df.variable[output]
                    self.set(output, series)
            # send the power and storage variable value from simulation results
            upsampled_output_power = self.flex_results[self.config.power_variable_name]
            self.set(self.config.power_variable_name, upsampled_output_power)
            if self.config.storage_variable_name is not None:
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[612:639]
==agentlib_flexquant.modules.shadow_mpc:[599:623]
        for par in self.config.parameters:
            self.flex_model.set(par.name, par.value)

    def _update_initial_states(self, result_df):
        """set the initial value of states"""

        # get state values from the mpc optimization result
        state_values = result_df.variable[self.var_ref.states]
        # update state values with last measurement
        for state, value in zip(self.var_ref.states, state_values.iloc[0]):
            self.flex_model.set(state, value)

    def _run_simulation(
        self, n_simulation_steps, sim_time_step, mpc_time_step, result_df, total_horizon_time
    ):
        """simulate with flex model over the prediction horizon"""

        # get control and input values from the mpc optimization result
        control_values = result_df.variable[
            [*self.var_ref.controls, *self.var_ref.binary_controls]
        ].dropna()
        input_values = result_df.parameter[self.var_ref.inputs].dropna()

        # Get the simulation time step index
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==agentlib_flexquant.data_structures.mpcs:[15:23]
==agentlib_flexquant.utils.config_management:[125:133]
    excluded_fields = [
        "rdf_class",
        "source",
        "type",
        "timestamp",
        "description",
        "unit",
        "clip",
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[217:241]
==agentlib_flexquant.modules.shadow_mpc:[140:156]
        )

        # set index of flex results to the same as mpc result
        store_results_df = self.flex_results.copy(deep=True)
        store_results_df.index = self.flex_results.index.tolist()

        # save results
        if not os.path.exists(self.res_file_flex):
            store_results_df.to_csv(self.res_file_flex)
        else:
            store_results_df.to_csv(self.res_file_flex, mode="a", header=False)

        # set the flex results format same as mpc result while updating Agentvariable
        self.flex_results.index = self.flex_results.index.get_level_values(1)

    def _initialize_flex_results(
        self, n_simulation_steps, horizon_length, sim_time_step, result_df
    ):
        """Initialize the flex results dataframe with the correct dimension and index
        and fill with existing results from optimization

        """

        # create MultiIndex for collocation points
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[492:501]
==agentlib_flexquant.modules.shadow_mpc:[91:100]
        if self.flex_results is not None:
            for output in self.var_ref.outputs:
                if output not in [
                    self.config.power_variable_name,
                    self.config.storage_variable_name,
                ]:
                    series = df.variable[output]
                    self.set(output, series)
            # send the power and storage variable value from simulation results
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==agentlib_flexquant.modules.flexibility_indicator:[504:527]
==agentlib_flexquant.modules.flexibility_market:[88:97]
        results_file = self.config.results_file
        try:
            results = pd.read_csv(results_file, header=[0], index_col=[0, 1])
            return results
        except FileNotFoundError:
            self.logger.error("Results file %s was not found.", results_file)
            return None

    def write_results(self, df: pd.DataFrame, ts: float, n: int) -> pd.DataFrame:
        """Write every data of variables in self.var_list in an DataFrame.

        DataFrame will be updated every time step

        Args:
            df: DataFrame which is initialised as an empty DataFrame with columns
            according to self.var_list
            ts: time step
            n: number of time steps during prediction horizon

        Returns:
            DataFrame with results of every variable in self.var_list

        """
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[262:271]
==agentlib_flexquant.modules.shadow_mpc:[584:592]
        opti_outputs = result_df.variable[self.config.power_variable_name]
        fixed_opti_output = pd.Series(
            opti_outputs.values,
            index=index_coll,
        )
        # fill the output value at the time step where it already exists in optimization output
        for idx in fixed_opti_output.index:
            if idx in self.flex_results.index:
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==agentlib_flexquant.modules.flexibility_indicator:[357:364]
==agentlib_flexquant.modules.flexibility_market:[62:70]
        if self.results_file and self.results_file.suffix != ".csv":
            raise ValueError(
                f"Invalid file extension for 'results_file': '{self.results_file}'. "
                f"Expected a '.csv' file."
            )
        return self
1 0 refactor duplicate-code R0801
Similar lines in 2 files
==agentlib_flexquant.modules.baseline_mpc:[281:302]
==agentlib_flexquant.modules.shadow_mpc:[599:617]
        for par in self.config.parameters:
            self.flex_model.set(par.name, par.value)

    def _update_initial_states(self, result_df):
        """set the initial value of states"""

        # get state values from the mpc optimization result
        state_values = result_df.variable[self.var_ref.states]
        # update state values with last measurement
        for state, value in zip(self.var_ref.states, state_values.iloc[0]):
            self.flex_model.set(state, value)

    def _run_simulation(
        self, n_simulation_steps, sim_time_step, mpc_time_step, result_df,
            total_horizon_time
    ):
        """simulate with flex model over the prediction horizon

        """

        # get control and input values from the mpc optimization result
9 0 error import-error E0401
Unable to import 'agentlib.core.agent'
10 0 error import-error E0401
Unable to import 'agentlib.core.module'
11 0 error import-error E0401
Unable to import 'agentlib.modules'
52 11 convention invalid-name C0103 get_module_type_matching_dict
Variable name "v" doesn't conform to snake_case naming style
59 12 convention consider-using-dict-items C0206 get_module_type_matching_dict
Consider iterating with .items()
59 16 convention invalid-name C0103 get_module_type_matching_dict
Variable name "vv" doesn't conform to snake_case naming style
68 8 convention invalid-name C0103 get_module_type_matching_dict
Variable name "v" doesn't conform to snake_case naming style
86 0 refactor inconsistent-return-statements R1710 get_orig_module_type
Either all return statements in a function should return an expression, or none of them should.
103 4 warning useless-else-on-loop W0120 get_module
Else clause on loop without a break statement, remove the else and de-indent all the code inside it
176 24 convention unnecessary-direct-lambda-call C3002 to_dict_and_remove_unnecessary_fields
Lambda expression called directly. Execute the expression inline instead.
184 24 convention unnecessary-direct-lambda-call C3002 to_dict_and_remove_unnecessary_fields
Lambda expression called directly. Execute the expression inline instead.
193 0 convention missing-function-docstring C0116 get_class_from_file
Missing function or method docstring

Module agentlib_flexquant.utils.data_handling (agentlib_flexquant/utils/data_handling.py)

Line Col. Type Symbol ID Obj Message
1 0 convention missing-module-docstring C0114
Missing module docstring
3 0 error import-error E0401
Unable to import 'pandas'
4 0 error import-error E0401
Unable to import 'agentlib_mpc.utils'
42 32 convention invalid-name C0103 _set_mean_values._get_intervals_for_mean
Argument name "s" doesn't conform to snake_case naming style
74 0 convention missing-function-docstring C0116 strip_multi_index
Missing function or method docstring
77 40 warning unnecessary-lambda W0108 strip_multi_index.<lambda>
Lambda may not be necessary
77 50 warning eval-used W0123 strip_multi_index.<lambda>
Use of eval
85 4 convention invalid-name C0103 convert_timescale_of_index
Argument name "df" doesn't conform to snake_case naming style

Module agentlib_flexquant.utils.interactive (agentlib_flexquant/utils/interactive.py)

Line Col. Type Symbol ID Obj Message
1 0 convention missing-module-docstring C0114
Missing module docstring
4 0 error import-error E0401
Unable to import 'pandas'
5 0 error import-error E0401
Unable to import 'agentlib.core.agent'
6 0 error import-error E0401
Unable to import 'agentlib_mpc.utils'
7 0 error import-error E0401
Unable to import 'agentlib_mpc.utils.analysis'
8 0 error import-error E0401
Unable to import 'agentlib_mpc.utils.plotting.interactive'
9 0 error import-error E0401
Unable to import 'dash'
10 0 error import-error E0401
Unable to import 'plotly'
11 0 error import-error E0401
Unable to import 'pydantic'
13 0 refactor consider-using-from-import R0402
Use 'from agentlib_flexquant.data_structures import flex_results' instead
20 0 refactor too-few-public-methods R0903 CustomBound
Too few public methods (0/2)
46 0 refactor too-many-instance-attributes R0902 Dashboard
Too many instance attributes (8/7)
64 4 refactor too-many-arguments R0913 Dashboard.__init__
Too many arguments (7/5)
88 8 convention invalid-name C0103 Dashboard.__init__
Attribute name "LINE_PROPERTIES" doesn't conform to snake_case naming style
110 12 refactor unnecessary-comprehension R1721 Dashboard.__init__
Unnecessary use of a comprehension, use list(self.intersection_mpcs_sim.keys()) instead.
110 28 convention consider-iterating-dictionary C0201 Dashboard.__init__
Consider iterating the dictionary directly instead of calling .keys()
199 30 convention invalid-name C0103 Dashboard._plot_one_mpc_variable._add_step_to_data
Argument name "s" doesn't conform to snake_case naming style
324 4 refactor inconsistent-return-statements R1710 Dashboard._plot_flexibility_kpi
Either all return statements in a function should return an expression, or none of them should.
479 4 refactor inconsistent-return-statements R1710 Dashboard._mark_characteristic_times_of_accepted_offers
Either all return statements in a function should return an expression, or none of them should.
506 4 refactor too-many-arguments R0913 Dashboard._create_plot
Too many arguments (7/5)
541 25 convention consider-iterating-dictionary C0201 Dashboard._create_plot
Consider iterating the dictionary directly instead of calling .keys()
562 16 convention invalid-name C0103 Dashboard._create_plot
Variable name "ts" doesn't conform to snake_case naming style
596 19 refactor use-dict-literal R1735 Dashboard._create_plot
Consider using '{"t": 20, "b": 20}' instead of a call to 'dict'.
691 41 warning f-string-without-interpolation W1309 Dashboard._create_layout
Using an f-string that does not have any interpolated variables

Module agentlib_flexquant.utils.parsing (agentlib_flexquant/utils/parsing.py)

Line Col. Type Symbol ID Obj Message
1 0 convention missing-module-docstring C0114
Missing module docstring
6 0 error import-error E0401
Unable to import 'agentlib_mpc.data_structures.mpc_datamodels'
59 74 warning redefined-builtin W0622 add_input
Redefining built-in 'type'
114 26 warning redefined-builtin W0622 add_output
Redefining built-in 'type'
154 4 refactor no-else-return R1705 _get_assignment_name
Unnecessary "elif" after "return", remove the leading "el" from "elif"
190 4 convention invalid-name C0103 SetupSystemModifier.visit_Module
Method name "visit_Module" doesn't conform to snake_case naming style
213 4 convention invalid-name C0103 SetupSystemModifier.visit_ClassDef
Method name "visit_ClassDef" doesn't conform to snake_case naming style
265 8 refactor no-else-return R1705 SetupSystemModifier.get_leftmost_list
Unnecessary "elif" after "return", remove the leading "el" from "elif"
330 0 convention trailing-whitespace C0303
Trailing whitespace
335 0 convention line-too-long C0301
Line too long (109/100)
370 21 refactor consider-merging-isinstance R1701 SetupSystemModifier.modify_config_class_baseline
Consider merging these isinstance calls to isinstance(body.value, (ast.BinOp, ast.Tuple))
381 21 refactor consider-merging-isinstance R1701 SetupSystemModifier.modify_config_class_baseline
Consider merging these isinstance calls to isinstance(body.value, (ast.BinOp, ast.Tuple))
448 24 warning unused-variable W0612 SetupSystemModifier.modify_setup_system_shadow
Unused variable 'ind'
585 0 convention missing-function-docstring C0116 remove_all_imports_from_tree
Missing function or method docstring
592 0 convention missing-final-newline C0304
Final newline missing

Metrics

Count per types

Name Count
error 81
convention 157
refactor 88
warning 37

Count per messages

Name Count
import-error 81
line-too-long 25
too-many-lines 1
too-many-instance-attributes 3
unnecessary-lambda 2
invalid-name 35
too-many-locals 9
redefined-builtin 3
logging-fstring-interpolation 2
too-many-branches 3
too-many-statements 1
unnecessary-dunder-call 3
protected-access 1
no-else-raise 1
raise-missing-from 2
broad-exception-raised 1
wrong-import-order 14
missing-final-newline 2
anomalous-backslash-in-string 1
missing-module-docstring 6
missing-class-docstring 8
too-few-public-methods 24
useless-parent-delegation 1
missing-function-docstring 21
inconsistent-return-statements 5
ungrouped-imports 1
too-many-arguments 12
eval-used 5
unused-argument 8
unnecessary-pass 1
attribute-defined-outside-init 3
trailing-whitespace 34
trailing-newlines 1
unused-variable 3
import-outside-toplevel 1
no-else-return 3
self-assigning-variable 1
unused-import 1
consider-merging-isinstance 2
consider-using-from-import 1
unnecessary-comprehension 1
consider-iterating-dictionary 2
use-dict-literal 1
f-string-without-interpolation 1
consider-using-dict-items 1
useless-else-on-loop 1
unnecessary-direct-lambda-call 2
duplicate-code 22

Count per modules

Name Count
agentlib_flexquant 2
agentlib_flexquant.generate_flex_agents 45
agentlib_flexquant.optimization_backends.constrained_cia 24
agentlib_flexquant.modules.shadow_mpc 31
agentlib_flexquant.modules.flexibility_market 22
agentlib_flexquant.modules.baseline_mpc 27
agentlib_flexquant.modules.flexibility_indicator 45
agentlib_flexquant.data_structures.flex_results 16
agentlib_flexquant.data_structures.mpcs 17
agentlib_flexquant.data_structures.market 6
agentlib_flexquant.data_structures.flexquant 12
agentlib_flexquant.data_structures.globals 1
agentlib_flexquant.data_structures.flex_kpis 26
agentlib_flexquant.data_structures.flex_offer 7
agentlib_flexquant.utils.data_handling 8
agentlib_flexquant.utils.parsing 15
agentlib_flexquant.utils.interactive 24
agentlib_flexquant.utils.config_management 35

Count per path

Name Count
agentlib_flexquant/__init__.py 2
agentlib_flexquant/generate_flex_agents.py 45
agentlib_flexquant/optimization_backends/constrained_cia.py 24
agentlib_flexquant/modules/shadow_mpc.py 31
agentlib_flexquant/modules/flexibility_market.py 22
agentlib_flexquant/modules/baseline_mpc.py 27
agentlib_flexquant/modules/flexibility_indicator.py 45
agentlib_flexquant/data_structures/flex_results.py 16
agentlib_flexquant/data_structures/mpcs.py 17
agentlib_flexquant/data_structures/market.py 6
agentlib_flexquant/data_structures/flexquant.py 12
agentlib_flexquant/data_structures/globals.py 1
agentlib_flexquant/data_structures/flex_kpis.py 26
agentlib_flexquant/data_structures/flex_offer.py 7
agentlib_flexquant/utils/data_handling.py 8
agentlib_flexquant/utils/parsing.py 15
agentlib_flexquant/utils/interactive.py 24
agentlib_flexquant/utils/config_management.py 35