Skip to content

Commit

Permalink
Solved linting errors (#98)
Browse files Browse the repository at this point in the history
Solve multiple linting issues
  • Loading branch information
Marvmann authored Nov 30, 2023
1 parent f2a9050 commit 0f6ab6c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/quark2_adapter/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@
import logging

from modules.Core import Core

from modules.applications.Application import Application as Application_NEW
from quark2_adapter.legacy_classes.Application import Application as Application_OLD
from modules.applications.Mapping import Mapping as Mapping_NEW
from quark2_adapter.legacy_classes.Mapping import Mapping as Mapping_OLD
from modules.solvers.Solver import Solver as Solver_NEW
from quark2_adapter.legacy_classes.Solver import Solver as Solver_OLD
from modules.devices.Device import Device as Device_NEW
from quark2_adapter.legacy_classes.Application import Application as Application_OLD
from quark2_adapter.legacy_classes.Mapping import Mapping as Mapping_OLD
from quark2_adapter.legacy_classes.Solver import Solver as Solver_OLD
from quark2_adapter.legacy_classes.Device import Device as Device_OLD


Expand Down Expand Up @@ -234,7 +233,7 @@ def recursive_replace_dict_keys(obj: any)-> any:
obj_new[str(key)] = recursive_replace_dict_keys(obj[key])
elif isinstance(obj, list):
obj_new = []
for i, element in enumerate(obj):
for element in obj:
obj_new.append(recursive_replace_dict_keys(element))
elif isinstance(obj, tuple):
obj_new = tuple(recursive_replace_dict_keys(element) for element in obj)
Expand Down Expand Up @@ -324,7 +323,8 @@ def postprocess(self, input_data: any, config: dict, **kwargs) -> (any, float):
run_kwargs = {
"store_dir": kwargs["store_dir"], "repetition": kwargs["rep_count"]}
raw_solution, runtime, additional_solver_information = self.run(input_data["mapped_problem"],
device_wrapper=input_data["device"], config=config, **run_kwargs)
device_wrapper=input_data["device"],
config=config, **run_kwargs)
self.metrics.add_metric("additional_solver_information", dict(
additional_solver_information))
self.metrics.add_metric("solution_raw", self.raw_solution_to_json(raw_solution))
Expand Down
4 changes: 2 additions & 2 deletions src/quark2_adapter/legacy_classes/Application.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ def save(self, path: str, iter_count: int) -> None:

def get_submodule(self, mapping_option: str) -> any:
"""
If self.sub_options is not None, a mapping is instantiated according to the information given in self.sub_options.
Otherwise, get_mapping is called as fall back.
If self.sub_options is not None, a mapping is instantiated according to the information given in
self.sub_options. Otherwise, get_mapping is called as fall back.
:param mapping_option: String with the option
:type mapping_option: str
Expand Down
1 change: 0 additions & 1 deletion src/quark2_adapter/legacy_classes/Device.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def get_parameter_options(self) -> dict:
:rtype: dict
"""
return {

}

def set_config(self, config):
Expand Down
6 changes: 3 additions & 3 deletions src/quark2_adapter/legacy_classes/Solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ def get_parameter_options(self) -> dict:

def get_submodule(self, device_option: str) -> any:
"""
If self.sub_options is not None, a device is instantiated according to the information given in self.sub_options.
Otherwise, get_device is called as fall back.
If self.sub_options is not None, a device is instantiated according to the information given in
self.sub_options. Otherwise, get_device is called as fall back.
:param device_option: String with the option
:type device_option: str
Expand All @@ -84,7 +84,7 @@ def get_submodule(self, device_option: str) -> any:
if self.sub_options is None:
return self.get_device(device_option)
else:
return _get_instance_with_sub_options(self.sub_options, device_option, device_option)
return _get_instance_with_sub_options(self.sub_options, device_option)

@abstractmethod
def get_device(self, device_option: str) -> any:
Expand Down

0 comments on commit 0f6ab6c

Please sign in to comment.