Skip to content

Commit c7a93a7

Browse files
style: pre-commit fixes
1 parent 9dad7a8 commit c7a93a7

File tree

6 files changed

+27
-19
lines changed

6 files changed

+27
-19
lines changed

docs/examples/cuboids_demagnetization.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,17 @@ coll_meshed.show()
9797
colls = [coll]
9898
for target_elems in [1, 2, 8, 16, 32, 64, 128, 256]:
9999
logger.info("🔄 Processing demagnetization with {target_elems} target elements", target_elems=target_elems)
100-
100+
101101
coll_meshed = mesh_all(
102102
coll, target_elems=target_elems, per_child_elems=True, min_elems=1
103103
)
104-
104+
105105
coll_demag = apply_demag(
106106
coll_meshed,
107107
style={"label": f"Coll_demag ({len(coll_meshed.sources_all):3d} cells)"},
108108
)
109109
colls.append(coll_demag)
110-
110+
111111
logger.info("✅ Completed demagnetization: {actual_cells} cells created", actual_cells=len(coll_meshed.sources_all))
112112
```
113113

docs/examples/soft_magnets.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,17 @@ magpy.show(*coll_meshed)
9292
colls = [coll]
9393
for target_elems in [1, 2, 8, 16, 32, 64, 128, 256]:
9494
logger.info("🔄 Processing demagnetization with {target_elems} target elements", target_elems=target_elems)
95-
95+
9696
coll_meshed = mesh_all(
9797
coll, target_elems=target_elems, per_child_elems=True, min_elems=1
9898
)
99-
99+
100100
coll_demag = apply_demag(
101101
coll_meshed,
102102
style={"label": f"Coll_demag ({len(coll_meshed.sources_all):3d} cells)"},
103103
)
104104
colls.append(coll_demag)
105-
105+
106106
logger.info("✅ Completed demagnetization: {actual_cells} cells created", actual_cells=len(coll_meshed.sources_all))
107107
```
108108

src/magpylib_material_response/demag.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,9 @@ def apply_demag(
396396
]
397397
if others_list:
398398
counts_others = Counter(s.__class__.__name__ for s in others_list)
399-
counts_str = ", ".join(f"{count} {name}" for name, count in counts_others.items())
399+
counts_str = ", ".join(
400+
f"{count} {name}" for name, count in counts_others.items()
401+
)
400402
msg = (
401403
"Only Magnet and Current sources supported. "
402404
f"Incompatible objects found: {counts_str}"

src/magpylib_material_response/logging_config.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,27 +87,31 @@ def configure_logging(
8787

8888
# Custom format function to display structured data cleanly
8989
def format_record(record):
90-
time_part = f"<green>{record['time'].strftime('%Y-%m-%d %H:%M:%S')}</green> | " if show_time else ""
91-
90+
time_part = (
91+
f"<green>{record['time'].strftime('%Y-%m-%d %H:%M:%S')}</green> | "
92+
if show_time
93+
else ""
94+
)
95+
9296
# Base format
9397
base = (
9498
f"{time_part}"
9599
f"<level>{record['level'].name:^8}</level> | "
96100
f"<cyan>{record['extra'].get('module', 'unknown')}</cyan> | "
97101
f"{record['level'].icon:<2} {record['message']}"
98102
)
99-
103+
100104
# Add extra context (excluding 'module' since it's already shown)
101105
extra_items = []
102-
for key, value in record['extra'].items():
103-
if key != 'module':
106+
for key, value in record["extra"].items():
107+
if key != "module":
104108
extra_items.append(f"<dim>{key}={value}</dim>")
105-
109+
106110
if extra_items:
107111
base += " | " + " | ".join(extra_items)
108-
112+
109113
return base + "\n"
110-
114+
111115
format_str = format_record
112116

113117
# Configure the logger

src/magpylib_material_response/meshing.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,9 @@ def mesh_all(
430430
target_elems_by_child = [max(min_elems, target_elems)] * len(supported_objs)
431431
if incompatible_objs:
432432
counts_incompatible = Counter(s.__class__.__name__ for s in incompatible_objs)
433-
counts_str = ", ".join(f"{count} {name}" for name, count in counts_incompatible.items())
433+
counts_str = ", ".join(
434+
f"{count} {name}" for name, count in counts_incompatible.items()
435+
)
434436
msg = (
435437
"Incompatible objects found: "
436438
f"{counts_str}"

src/magpylib_material_response/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ def timelog(msg, min_log_time=1):
6666

6767
if end > min_log_time:
6868
logger.info(
69-
"✅ Completed: {operation} in {duration}s",
70-
operation=msg,
71-
duration=round(end, 3)
69+
"✅ Completed: {operation} in {duration}s",
70+
operation=msg,
71+
duration=round(end, 3),
7272
)
7373

7474

0 commit comments

Comments
 (0)