Skip to content

Commit 3c517b7

Browse files
style: Apply ruff formatting
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent a5e2776 commit 3c517b7

File tree

16 files changed

+50
-46
lines changed

16 files changed

+50
-46
lines changed

.secrets/database.password

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tutorial

.secrets/database.user

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
root

datajoint.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"database": {
3+
"host": "127.0.0.1",
4+
"port": 3306
5+
},
6+
"safemode": false,
7+
"loglevel": "WARNING"
8+
}

src/datajoint/codecs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def __init_subclass__(cls, *, register: bool = True, **kwargs):
112112
existing = _codec_registry[cls.name]
113113
if type(existing) is not cls:
114114
raise DataJointError(
115-
f"Codec <{cls.name}> already registered by " f"{type(existing).__module__}.{type(existing).__name__}"
115+
f"Codec <{cls.name}> already registered by {type(existing).__module__}.{type(existing).__name__}"
116116
)
117117
return # Same class, idempotent
118118

@@ -301,7 +301,7 @@ def get_codec(name: str) -> Codec:
301301
return _codec_registry[type_name]
302302

303303
raise DataJointError(
304-
f"Unknown codec: <{type_name}>. " f"Ensure the codec is defined (inherit from dj.Codec with name='{type_name}')."
304+
f"Unknown codec: <{type_name}>. Ensure the codec is defined (inherit from dj.Codec with name='{type_name}')."
305305
)
306306

307307

@@ -499,7 +499,7 @@ def lookup_codec(codec_spec: str) -> tuple[Codec, str | None]:
499499
if is_codec_registered(type_name):
500500
return get_codec(type_name), store_name
501501

502-
raise DataJointError(f"Codec <{type_name}> is not registered. " "Define a Codec subclass with name='{type_name}'.")
502+
raise DataJointError(f"Codec <{type_name}> is not registered. Define a Codec subclass with name='{{type_name}}'.")
503503

504504

505505
# =============================================================================

src/datajoint/content_registry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def get_content(content_hash: str, store_name: str | None = None) -> bytes:
151151
# Verify hash (optional but recommended for integrity)
152152
actual_hash = compute_content_hash(data)
153153
if actual_hash != content_hash:
154-
raise DataJointError(f"Content hash mismatch: expected {content_hash[:16]}..., " f"got {actual_hash[:16]}...")
154+
raise DataJointError(f"Content hash mismatch: expected {content_hash[:16]}..., got {actual_hash[:16]}...")
155155

156156
return data
157157

src/datajoint/heading.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@ def name(self) -> str:
4141

4242
def get_dtype(self, is_external: bool) -> str:
4343
raise DataJointError(
44-
f"Codec <{self._codec_name}> is not registered. " f"Define a Codec subclass with name='{self._codec_name}'."
44+
f"Codec <{self._codec_name}> is not registered. Define a Codec subclass with name='{self._codec_name}'."
4545
)
4646

4747
def encode(self, value, *, key=None, store_name=None):
4848
raise DataJointError(
49-
f"Codec <{self._codec_name}> is not registered. " f"Define a Codec subclass with name='{self._codec_name}'."
49+
f"Codec <{self._codec_name}> is not registered. Define a Codec subclass with name='{self._codec_name}'."
5050
)
5151

5252
def decode(self, stored, *, key=None):
5353
raise DataJointError(
54-
f"Codec <{self._codec_name}> is not registered. " f"Define a Codec subclass with name='{self._codec_name}'."
54+
f"Codec <{self._codec_name}> is not registered. Define a Codec subclass with name='{self._codec_name}'."
5555
)
5656

5757

src/datajoint/jobs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def _generate_definition(self) -> str:
145145

146146
if not pk_attrs:
147147
raise DataJointError(
148-
f"Cannot create jobs table for {self._target.full_table_name}: " "no FK-derived primary key attributes found."
148+
f"Cannot create jobs table for {self._target.full_table_name}: no FK-derived primary key attributes found."
149149
)
150150

151151
pk_lines = "\n ".join(f"{name} : {dtype}" for name, dtype in pk_attrs)

src/datajoint/settings.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ def get_store_spec(self, store: str) -> dict[str, Any]:
389389
if protocol not in supported_protocols:
390390
raise DataJointError(
391391
f'Missing or invalid protocol in config.stores["{store}"]. '
392-
f'Supported protocols: {", ".join(supported_protocols)}'
392+
f"Supported protocols: {', '.join(supported_protocols)}"
393393
)
394394

395395
# Define required and allowed keys by protocol
@@ -479,7 +479,7 @@ def get_object_storage_spec(self) -> dict[str, Any]:
479479
supported_protocols = ("file", "s3", "gcs", "azure")
480480
if protocol not in supported_protocols:
481481
raise DataJointError(
482-
f"Invalid object_storage.protocol: {protocol}. " f'Supported protocols: {", ".join(supported_protocols)}'
482+
f"Invalid object_storage.protocol: {protocol}. Supported protocols: {', '.join(supported_protocols)}"
483483
)
484484

485485
# Build spec dict
@@ -555,8 +555,7 @@ def get_object_store_spec(self, store_name: str | None = None) -> dict[str, Any]
555555
supported_protocols = ("file", "s3", "gcs", "azure")
556556
if protocol not in supported_protocols:
557557
raise DataJointError(
558-
f"Invalid protocol for store '{store_name}': {protocol}. "
559-
f'Supported protocols: {", ".join(supported_protocols)}'
558+
f"Invalid protocol for store '{store_name}': {protocol}. Supported protocols: {', '.join(supported_protocols)}"
560559
)
561560

562561
# Use project_name from default config if not specified in store

src/datajoint/table.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -963,8 +963,7 @@ def cascade(table):
963963
transaction = False
964964
else:
965965
raise DataJointError(
966-
"Delete cannot use a transaction within an ongoing transaction. "
967-
"Set transaction=False or prompt=False."
966+
"Delete cannot use a transaction within an ongoing transaction. Set transaction=False or prompt=False."
968967
)
969968

970969
# Cascading delete

src/datajoint/user_tables.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,7 @@ def drop(self, part_integrity: str = "enforce"):
252252
if part_integrity == "ignore":
253253
super().drop()
254254
elif part_integrity == "enforce":
255-
raise DataJointError(
256-
"Cannot drop a Part directly. Drop master instead, " "or use part_integrity='ignore' to force."
257-
)
255+
raise DataJointError("Cannot drop a Part directly. Drop master instead, or use part_integrity='ignore' to force.")
258256
else:
259257
raise ValueError(f"part_integrity for drop must be 'enforce' or 'ignore', got {part_integrity!r}")
260258

0 commit comments

Comments
 (0)