Skip to content

Commit

Permalink
Autoflake Failed > Now Passed
Browse files Browse the repository at this point in the history
crystal_symmetry and yaml where imported twice
  • Loading branch information
FLorial Jean Baptiste committed Mar 27, 2024
1 parent 4469cda commit 1fac006
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions mxcubecore/model/queue_model_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# imported eventhough HardwareRepository is not avilable.
try:
from mxcubecore import HardwareRepository as HWR
except ImportError as ex:
except ImportError:
logging.getLogger("HWR").exception("Could not import HardwareRepository")


Expand Down Expand Up @@ -358,7 +358,7 @@ def init_from_sc_sample(self, sc_sample):
else:
self.set_name(self.loc_str)

def init_from_lims_object(self, lims_sample):
def init_from_lims_object(self, lims_sample): # noqa: C901
if hasattr(lims_sample, "cellA"):
self.crystals[0].cell_a = lims_sample.cellA
self.processing_parameters.cell_a = lims_sample.cellA
Expand Down Expand Up @@ -1618,7 +1618,7 @@ def get_archive_directory(self):
logging.getLogger("HWR").debug(
"PathTemplate (DESY) - (to be defined) directory is %s" % self.directory
)
#archive_directory = self.directory
# archive_directory = self.directory
archive_directory = HWR.beamline.session.get_archive_directory()
elif PathTemplate.synchrotron_name == "ALBA":
logging.getLogger("HWR").debug(
Expand Down Expand Up @@ -2103,7 +2103,7 @@ def set_from_dict(self, params_dict):
if hasattr(self, dict_item[0]):
setattr(self, dict_item[0], dict_item[1])

def set_pre_strategy_params(
def set_pre_strategy_params( # noqa: C901
self,
space_group="",
crystal_classes=(),
Expand Down Expand Up @@ -2134,7 +2134,6 @@ def set_pre_strategy_params(
"""

from mxcubecore.HardwareObjects.Gphl import GphlMessages
from mxcubecore.model import crystal_symmetry

if space_group:
self.space_group = space_group
Expand Down Expand Up @@ -2321,7 +2320,6 @@ def init_from_task_data(self, sample_model, params):
"""

from mxcubecore.HardwareObjects.Gphl import GphlMessages
import ruamel.yaml as yaml

if self.automation_mode == "TEST_FROM_FILE":
fname = os.getenv("GPHL_TEST_INPUT")
Expand All @@ -2333,7 +2331,6 @@ def init_from_task_data(self, sample_model, params):
else:
print("WARNING no GPHL_TEST_INPUT found. test using default values")


# Set attributes directly from params
self.strategy_settings = HWR.beamline.gphl_workflow.workflow_strategies.get(
params["strategy_name"]
Expand Down Expand Up @@ -2490,6 +2487,7 @@ def cell_parameters(self, value):
self._cell_parameters = tuple(float(x) for x in value)
else:
raise ValueError("invalid value for cell_parameters: %s" % str(value))

@property
def total_strategy_length(self):
"""Total strategy length for a single repetition
Expand All @@ -2501,7 +2499,6 @@ def total_strategy_length(self):
#
return result


def calc_maximum_dose(self, energy=None, exposure_time=None, image_width=None):
"""Dose at transmission=100 for given energy, exposure time and image width
Expand All @@ -2521,7 +2518,7 @@ def calc_maximum_dose(self, energy=None, exposure_time=None, image_width=None):
)
dose_rate = HWR.beamline.gphl_workflow.maximum_dose_rate(energy)
exposure_time = exposure_time or self.exposure_time
image_width = image_width or self.image_width
image_width = image_width or self.image_width
total_strategy_length = self.strategy_length * len(self.wavelengths)
if (dose_rate and exposure_time and image_width and total_strategy_length):
return (dose_rate * total_strategy_length * exposure_time / image_width)
Expand Down

0 comments on commit 1fac006

Please sign in to comment.