Skip to content
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

Warning once fix #604

Merged
merged 6 commits into from
Sep 25, 2023
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
2 changes: 1 addition & 1 deletion src/graphnet/models/graphs/edges/edges.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def forward(self, graph: Data) -> Data:
graph: a graph with edges
"""
if graph.edge_index is not None:
self.warnonce(
self.warning_once(
"GraphBuilder received graph with pre-existing "
"structure. Will overwrite."
)
Expand Down
12 changes: 7 additions & 5 deletions src/graphnet/models/graphs/graph_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ def forward( # type: ignore
if self._edge_definition is not None:
graph = self._edge_definition(graph)
else:
self.warnonce(

self.warning_once(
"""No EdgeDefinition provided.
Graphs will not have edges defined!""" # noqa
)
Expand Down Expand Up @@ -305,10 +306,11 @@ def _add_features_individually(
if feature not in ["x"]: # reserved for node features.
graph[feature] = graph.x[:, index].detach()
else:
self.warnonce(
"""Cannot assign graph['x']. This field is reserved
for node features. Please rename your input feature.""" # noqa
)
self.warning_once(
"""Cannot assign graph['x']. This field is reserved for
node features. Please rename your input feature."""
) # noqa

return graph

def _add_custom_labels(
Expand Down