From 53a6807fccb14c1522e76603893ac1c3d67ccf51 Mon Sep 17 00:00:00 2001
From: Thomas Kluyver <thomas@kluyver.me.uk>
Date: Wed, 13 Dec 2023 18:11:12 +0000
Subject: [PATCH] Autoformat file

---
 src/cal_tools/calcat_interface2.py | 42 ++++++++++++++++++------------
 1 file changed, 25 insertions(+), 17 deletions(-)

diff --git a/src/cal_tools/calcat_interface2.py b/src/cal_tools/calcat_interface2.py
index 39e4f1752..5c8b64de4 100644
--- a/src/cal_tools/calcat_interface2.py
+++ b/src/cal_tools/calcat_interface2.py
@@ -233,15 +233,15 @@ class ModulesConstantVersions:
             )
 
         if module_nums is not None:
-            by_mod_no = {m['module_number']: m for m in self.module_details}
-            aggregators = [by_mod_no[n]['karabo_da'] for n in module_nums]
+            by_mod_no = {m["module_number"]: m for m in self.module_details}
+            aggregators = [by_mod_no[n]["karabo_da"] for n in module_nums]
         elif qm_names is not None:
-            by_qm = {m['virtual_device_name']: m for m in self.module_details}
-            aggregators = [by_qm[s]['karabo_da'] for s in qm_names]
+            by_qm = {m["virtual_device_name"]: m for m in self.module_details}
+            aggregators = [by_qm[s]["karabo_da"] for s in qm_names]
         elif aggregators is not None:
-            miss = set(aggregators) - {m['karabo_da'] for m in self.module_details}
+            miss = set(aggregators) - {m["karabo_da"] for m in self.module_details}
             if miss:
-                raise KeyError("Aggregators not found: " + ', '.join(sorted(miss)))
+                raise KeyError("Aggregators not found: " + ", ".join(sorted(miss)))
 
         d = {aggr: scv for (aggr, scv) in self.constants.items() if aggr in aggregators}
         return ModulesConstantVersions(d, self.module_details)
@@ -254,13 +254,19 @@ class ModulesConstantVersions:
 
     @property
     def module_nums(self):
-        return [m['module_number'] for m in self.module_details
-                if m['karabo_da'] in self.constants]
+        return [
+            m["module_number"]
+            for m in self.module_details
+            if m["karabo_da"] in self.constants
+        ]
 
     @property
     def qm_names(self):
-        return [m['virtual_device_name'] for m in self.module_details
-                if m['karabo_da'] in self.constants]
+        return [
+            m["virtual_device_name"]
+            for m in self.module_details
+            if m["karabo_da"] in self.constants
+        ]
 
     def ndarray(self, caldb_root=None):
         eg_dset = self.constants[self.aggregators[0]].dataset_obj(caldb_root)
@@ -456,27 +462,29 @@ class CalibrationData(Mapping):
         return len(self.constant_groups)
 
     def __repr__(self):
-        return (f"<CalibrationData: {', '.join(sorted(self.constant_groups))} "
-                f"constants for {len(self.module_details)} modules>")
+        return (
+            f"<CalibrationData: {', '.join(sorted(self.constant_groups))} "
+            f"constants for {len(self.module_details)} modules>"
+        )
 
     # These properties may include modules for which we have no constants -
     # when created with .from_condition(), they represent all modules present in
     # the detector (at the specified time).
     @property
     def module_nums(self):
-        return [m['module_number'] for m in self.module_details]
+        return [m["module_number"] for m in self.module_details]
 
     @property
     def aggregator_names(self):
-        return [m['karabo_da'] for m in self.module_details]
+        return [m["karabo_da"] for m in self.module_details]
 
     @property
     def qm_names(self):
-        return [m['virtual_device_name'] for m in self.module_details]
+        return [m["virtual_device_name"] for m in self.module_details]
 
     @property
     def pdu_names(self):
-        return [m['physical_name'] for m in self.module_details]
+        return [m["physical_name"] for m in self.module_details]
 
     def require_calibrations(self, calibrations):
         """Drop any modules missing the specified constant types"""
@@ -500,7 +508,7 @@ class CalibrationData(Mapping):
         return type(self)(d, self.aggregators)
 
     def select_modules(
-            self, module_nums=None, *, aggregators=None, qm_names=None
+        self, module_nums=None, *, aggregators=None, qm_names=None
     ) -> "CalibrationData":
         return type(self)(
             {
-- 
GitLab