Skip to content

Commit

Permalink
swap deprecated and classmethod decorators
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielYang59 committed Mar 29, 2024
1 parent 1ba7feb commit dfa183e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
10 changes: 5 additions & 5 deletions pymatgen/analysis/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ def from_empty_graph(

return cls(structure, graph_data=graph_data)

@classmethod
@deprecated(
from_empty_graph,
"Deprecated on 2024-03-29, to be removed on 2025-03-20.",
)
@classmethod
def with_empty_graph(cls, *args, **kwargs):
return cls.from_empty_graph(*args, **kwargs)

Expand Down Expand Up @@ -259,11 +259,11 @@ def from_edges(cls, structure: Structure, edges: dict) -> Self:
struct_graph.set_node_attributes()
return struct_graph

@classmethod
@deprecated(
from_edges,
"Deprecated on 2024-03-29, to be removed on 2025-03-20.",
)
@classmethod
def with_edges(cls, *args, **kwargs):
return cls.from_edges(*args, **kwargs)

Expand Down Expand Up @@ -304,11 +304,11 @@ def from_local_env_strategy(

return struct_graph

@classmethod
@deprecated(
from_local_env_strategy,
"Deprecated on 2024-03-29, to be removed on 2025-03-20.",
)
@classmethod
def with_local_env_strategy(cls, *args, **kwargs):
return cls.from_local_env_strategy(*args, **kwargs)

Expand Down Expand Up @@ -1645,11 +1645,11 @@ def from_empty_graph(cls, molecule, name="bonds", edge_weight_name=None, edge_we

return cls(molecule, graph_data=graph_data)

@classmethod
@deprecated(
from_empty_graph,
"Deprecated on 2024-03-29, to be removed on 2025-03-20.",
)
@classmethod
def with_empty_graph(cls, *args, **kwargs):
return cls.from_empty_graph(*args, **kwargs)

Expand Down Expand Up @@ -1697,11 +1697,11 @@ def from_edges(cls, molecule: Molecule, edges: dict[tuple[int, int], None | dict
mg.set_node_attributes()
return mg

@classmethod
@deprecated(
from_edges,
"Deprecated on 2024-03-29, to be removed on 2025-03-20.",
)
@classmethod
def with_edges(cls, *args, **kwargs):
return cls.from_edges(*args, **kwargs)

Expand Down
3 changes: 1 addition & 2 deletions tests/analysis/test_fragmenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ def test_babel_pc_old_defaults(self):
fragmenter = Fragmenter(molecule=self.pc, open_rings=True)
assert fragmenter.open_rings
assert fragmenter.opt_steps == 10000
# DEBUG(@DanielYang59): test deprecated decorator
default_mol_graph = MoleculeGraph.with_local_env_strategy(self.pc, OpenBabelNN())
default_mol_graph = MoleculeGraph.from_local_env_strategy(self.pc, OpenBabelNN())
assert fragmenter.mol_graph == default_mol_graph
assert fragmenter.total_unique_fragments == 13

Expand Down

0 comments on commit dfa183e

Please sign in to comment.