Skip to content

Commit b7e99bc

Browse files
committed
Rename enable_hidden_attributes to add_hidden_timestamp
sed -i 's/enable_hidden_attributes/add_hidden_timestamp/g' ./**/*.py
1 parent 2b3f8d3 commit b7e99bc

File tree

3 files changed

+17
-27
lines changed

3 files changed

+17
-27
lines changed

datajoint/declare.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ def declare(full_table_name, definition, context):
312312
external_stores,
313313
) = prepare_declare(definition, context)
314314

315-
if config.get("enable_hidden_attributes", False):
315+
if config.get("add_hidden_timestamp", False):
316316
metadata_attr_sql = [
317317
"`_{full_table_name}_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP"
318318
]

datajoint/settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"display.show_tuple_count": True,
4848
"database.use_tls": None,
4949
"enable_python_native_blobs": True, # python-native/dj0 encoding support
50-
"enable_hidden_attributes": False,
50+
"add_hidden_timestamp": False,
5151
"filepath_checksum_size_limit": None, # file size limit for when to disable checksums
5252
}
5353
)

tests/test_declare.py

+15-25
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@
77

88

99
@pytest.fixture(scope="function")
10-
def enable_hidden_attributes():
11-
orig_config_val = config.get("enable_hidden_attributes")
12-
config["enable_hidden_attributes"] = True
10+
def enable_add_hidden_timestamp():
11+
orig_config_val = config.get("add_hidden_timestamp")
12+
config["add_hidden_timestamp"] = True
1313
yield
1414
if orig_config_val is not None:
15-
config["enable_hidden_attributes"] = orig_config_val
15+
config["add_hidden_timestamp"] = orig_config_val
1616

1717

1818
@pytest.fixture(scope="function")
19-
def disable_hidden_attributes():
20-
orig_config_val = config.get("enable_hidden_attributes")
21-
config["enable_hidden_attributes"] = False
19+
def disable_add_hidden_timestamp():
20+
orig_config_val = config.get("add_hidden_timestamp")
21+
config["add_hidden_timestamp"] = False
2222
yield
2323
if orig_config_val is not None:
24-
config["enable_hidden_attributes"] = orig_config_val
24+
config["add_hidden_timestamp"] = orig_config_val
2525

2626

2727
def test_schema_decorator(schema_any):
@@ -392,17 +392,15 @@ class Table_With_Underscores(dj.Manual):
392392
schema_any(Table_With_Underscores)
393393

394394

395-
def test_hidden_attributes_default_value():
396-
config_val = config.get("enable_hidden_attributes")
395+
def test_add_hidden_timestamp_default_value():
396+
config_val = config.get("add_hidden_timestamp")
397397
assert (
398398
config_val is not None and not config_val
399-
), "Default value for enable_hidden_attributes is not False"
399+
), "Default value for add_hidden_timestamp is not False"
400400

401401

402-
def test_hidden_attributes_enabled(enable_hidden_attributes, schema_any):
403-
orig_config_val = config.get("enable_hidden_attributes")
404-
config["enable_hidden_attributes"] = True
405-
402+
def test_add_hidden_timestamp_enabled(enable_add_hidden_timestamp, schema_any):
403+
assert config["add_hidden_timestamp"], "add_hidden_timestamp is not enabled"
406404
msg = f"{Experiment().heading._attributes=}"
407405
assert any(
408406
a.name.endswith("_timestamp") for a in Experiment().heading._attributes.values()
@@ -413,14 +411,9 @@ def test_hidden_attributes_enabled(enable_hidden_attributes, schema_any):
413411
assert any(a.is_hidden for a in Experiment().heading._attributes.values()), msg
414412
assert not any(a.is_hidden for a in Experiment().heading.attributes.values()), msg
415413

416-
if orig_config_val is not None:
417-
config["enable_hidden_attributes"] = orig_config_val
418-
419-
420-
def test_hidden_attributes_disabled(disable_hidden_attributes, schema_any):
421-
orig_config_val = config.get("enable_hidden_attributes")
422-
config["enable_hidden_attributes"] = False
423414

415+
def test_add_hidden_timestamp_disabled(disable_add_hidden_timestamp, schema_any):
416+
assert not config["add_hidden_timestamp"], "expected add_hidden_timestamp to be False"
424417
msg = f"{Experiment().heading._attributes=}"
425418
assert not any(
426419
a.name.endswith("_timestamp") for a in Experiment().heading._attributes.values()
@@ -430,6 +423,3 @@ def test_hidden_attributes_disabled(disable_hidden_attributes, schema_any):
430423
), msg
431424
assert not any(a.is_hidden for a in Experiment().heading._attributes.values()), msg
432425
assert not any(a.is_hidden for a in Experiment().heading.attributes.values()), msg
433-
434-
if orig_config_val is not None:
435-
config["enable_hidden_attributes"] = orig_config_val

0 commit comments

Comments
 (0)