Skip to content

Remove error check in ConfigParser #1009

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions pytensor/configparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,7 @@ def add(self, name: str, doc: str, configparam: "ConfigParam", in_c_key: bool):
raise ValueError(
f"Dot-based sections were removed. Use double underscores! ({name})"
)
# Can't use hasattr here, because it returns False upon AttributeErrors
if name in dir(self):
raise AttributeError(
f"A config parameter with the name '{name}' was already registered on another config instance."
)

configparam.doc = doc
configparam.name = name
configparam.in_c_key = in_c_key
Expand Down
9 changes: 0 additions & 9 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,6 @@ def test_invalid_configvar_access():
with pytest.raises(configparser.ConfigAccessViolation, match="different instance"):
print(root.test__on_test_instance)

# And also that we can't add two configs of the same name to different instances:
with pytest.raises(AttributeError, match="already registered"):
root.add(
"test__on_test_instance",
"This config setting was already added to another instance.",
configparser.IntParam(5),
in_c_key=False,
)


def test_no_more_dotting():
root = configdefaults.config
Expand Down
Loading