Skip to content

Commit

Permalink
refactor: change methods not using its bound instance to staticmethods
Browse files Browse the repository at this point in the history
The method doesn't use its bound instance. Decorate this method with `@staticmethod` decorator, so that Python does not have to instantiate a bound method for every instance of this class thereby saving memory and computation. Read more about staticmethods [here](https://docs.python.org/3/library/functions.html#staticmethod).
  • Loading branch information
deepsource-autofix[bot] authored Jan 13, 2024
1 parent a195a1c commit 12b4d91
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/raspa_ase/calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ def execute(self, directory: Path | str, profile: RaspaProfile) -> None:
"""
profile.run(directory, self.output_file)

@staticmethod
def write_input(
self,
directory: Path | str,
atoms: Atoms,
parameters: dict[str, Any],
Expand Down Expand Up @@ -148,7 +148,8 @@ def write_input(
write_simulation_input(parameters, directory / SIMULATION_INPUT)
write_frameworks(frameworks, directory)

def read_results(self, directory: Path | str) -> Results:
@staticmethod
def read_results(directory: Path | str) -> Results:
"""
Read the results of a RASPA calculation.
Expand Down

0 comments on commit 12b4d91

Please sign in to comment.