提交 f9f5c5b9 authored 作者: Virgile Andreani's avatar Virgile Andreani 提交者: Virgile Andreani

Remove default in_c_key and change for cast_policy

上级 b9f2dde1
...@@ -258,6 +258,7 @@ def add_basic_configvars(): ...@@ -258,6 +258,7 @@ def add_basic_configvars():
# was expected, so it is currently not available. # was expected, so it is currently not available.
# numpy, # numpy,
), ),
in_c_key=False,
) )
config.add( config.add(
......
...@@ -214,9 +214,7 @@ class PyTensorConfigParser: ...@@ -214,9 +214,7 @@ class PyTensorConfigParser:
) )
) )
def add( def add(self, name: str, doc: str, configparam: "ConfigParam", in_c_key: bool):
self, name: str, doc: str, configparam: "ConfigParam", in_c_key: bool = True
):
"""Add a new variable to PyTensorConfigParser. """Add a new variable to PyTensorConfigParser.
This method performs some of the work of initializing `ConfigParam` instances. This method performs some of the work of initializing `ConfigParam` instances.
......
...@@ -98,6 +98,7 @@ def test_config_hash(): ...@@ -98,6 +98,7 @@ def test_config_hash():
"test__config_hash", "test__config_hash",
"A config var from a test case.", "A config var from a test case.",
configparser.StrParam("test_default"), configparser.StrParam("test_default"),
in_c_key=True,
) )
h0 = root.get_config_hash() h0 = root.get_config_hash()
...@@ -160,6 +161,7 @@ def test_config_context(): ...@@ -160,6 +161,7 @@ def test_config_context():
"test__config_context", "test__config_context",
"A config var from a test case.", "A config var from a test case.",
configparser.StrParam("test_default"), configparser.StrParam("test_default"),
in_c_key=False,
) )
assert hasattr(root, "test__config_context") assert hasattr(root, "test__config_context")
assert root.test__config_context == "test_default" assert root.test__config_context == "test_default"
...@@ -181,6 +183,7 @@ def test_invalid_configvar_access(): ...@@ -181,6 +183,7 @@ def test_invalid_configvar_access():
"test__on_test_instance", "test__on_test_instance",
"This config setting was added to the test instance.", "This config setting was added to the test instance.",
configparser.IntParam(5), configparser.IntParam(5),
in_c_key=False,
) )
assert hasattr(root_test, "test__on_test_instance") assert hasattr(root_test, "test__on_test_instance")
# While the property _actually_ exists on all instances, # While the property _actually_ exists on all instances,
...@@ -197,6 +200,7 @@ def test_invalid_configvar_access(): ...@@ -197,6 +200,7 @@ def test_invalid_configvar_access():
"test__on_test_instance", "test__on_test_instance",
"This config setting was already added to another instance.", "This config setting was already added to another instance.",
configparser.IntParam(5), configparser.IntParam(5),
in_c_key=False,
) )
...@@ -248,6 +252,7 @@ def test_config_pickling(): ...@@ -248,6 +252,7 @@ def test_config_pickling():
"test__lambda_kills_pickling", "test__lambda_kills_pickling",
"Lambda functions cause pickling problems.", "Lambda functions cause pickling problems.",
configparser.IntParam(5, lambda i: i > 0), configparser.IntParam(5, lambda i: i > 0),
in_c_key=False,
) )
with pytest.raises(AttributeError, match="Can't pickle local object"): with pytest.raises(AttributeError, match="Can't pickle local object"):
pickle.dump(root, io.BytesIO()) pickle.dump(root, io.BytesIO())
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论