Skip to content

Conversation

@dylanbmorgan
Copy link
Member

No description provided.

@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 19927157305

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 988 unchanged lines in 5 files lost coverage.
  • Overall coverage increased (+0.1%) to 32.565%

Files with Coverage Reduction New Missed Lines %
parameters.py 1 64.0%
cube.py 43 0.0%
output.py 106 73.21%
vibrations.py 124 0.0%
geometry.py 714 29.23%
Totals Coverage Status
Change from base Build 19838632644: 0.1%
Covered Lines: 1371
Relevant Lines: 4210

💛 - Coveralls



class AimsVibrations(Vibrations, AimsGeometry): # pyright: ignore
class AimsVibrations(Vibrations, AimsGeometry):


class VaspVibrations(Vibrations, VaspGeometry): # pyright: ignore
class VaspVibrations(Vibrations, VaspGeometry):
Comment on lines +419 to +420
# for i, d in enumerate(edges[0]):
# self.settings["edge"].append([d, *list(edges[1][i, :])])
Comment on lines +592 to +605
# if len(self.type) > 0:
# text += "output cube " + self.type + "\n"
# else:
# warn("No cube type specified", stacklevel=2)
# text += "output cube" + "CUBETYPE" + "\n"

# for key, values in self.settings.items():
# for v in values:
# text += "cube " + key + " "
# if key in self.parsing_functions:
# text += self.parsing_functions[key][1](v) + "\n"
# else:
# print(v)
# text += v + "\n"
def _supported_files(self) -> dict:
return {"arbitrary_format": ".arb_format"}

def dummy_method() -> None:

@pytest.fixture(scope="session")
def aims_calc_dir(run_aims, cwd) -> Generator[str, None, None] | str: # noqa: ANN001
def aims_calc_dir(run_aims: bool, cwd: Path) -> Generator[str, None, None] | str:

__name__: str

def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
output_file: str = "aims.out",
calc_dir: str = "./",
force: bool = False,
) -> Decorator: ...
output_file: str = "aims.out",
calc_dir: str = "./",
force: bool = False,
) -> Wrapper: ...
@dylanbmorgan dylanbmorgan marked this pull request as draft December 4, 2025 11:23
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses CodeQL findings and performs minor refactoring across the codebase. The changes focus on improving type safety by removing pyright ignore comments, modernizing file handling with pathlib, and cleaning up unused code.

Key changes include:

  • Improved type annotations with Protocol and @overload patterns for better decorator typing
  • Removed pyright ignore comments by fixing underlying type issues
  • Modernized file path handling using pathlib.Path instead of os.path
  • Updated dependencies (ipython 9.7.0→9.8.0, loro 1.8.2→1.10.0, marimo 0.18.1→0.18.2, narwhals 2.12.0→2.13.0)
  • Cleaned up unused/unreachable code and dead logic branches
  • Fixed several spelling errors in comments and docstrings

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
uv.lock Dependency version updates for ipython, loro, marimo, and narwhals packages
tests/test_utils.py Refactored to use pathlib.Path and updated docstrings
tests/test_benchmarking.py Added pytest.mark.skip decorator and TODO placeholder
tests/test_base.py Added noqa comments and dummy methods to satisfy CodeQL checks
tests/conftest.py Added type hints and corrected spelling in comments
dfttoolkit/vibrations.py Removed pyright ignore comments throughout, but introduced incorrect type changes for time_step parameters
dfttoolkit/utils/run_utils.py Added Protocol and overload for better decorator type safety
dfttoolkit/utils/periodic_table.py Changed classproperty parameter names from cls to self (incorrect)
dfttoolkit/parameters.py Simplified lambda expressions and commented out NotImplementedError code blocks
dfttoolkit/output.py Refactored control flow and updated return type annotations
dfttoolkit/geometry.py Removed unused variable assignments and function parameters
dfttoolkit/cube.py Removed unused method with NotImplementedError
dfttoolkit/benchmarking.py Changed from inheritance to composition pattern for AimsOutput
dfttoolkit/base.py Fixed spelling in comment (file type → filetype)
Comments suppressed due to low confidence (1)

tests/test_base.py:168

  • Normal methods should have at least one parameter (the first of which should be 'self').
                def dummy_method() -> None:

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

velocities: npt.NDArray[np.float64],
index_pair: tuple,
time_step: float,
time_step: int,
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing time_step from float to int is likely incorrect. Time steps in physics simulations are typically floating-point values (e.g., 0.5 fs, 1.0 fs). The docstring on line 578 even says "time_step : float". This type change appears to be a mistake and could cause type errors when passing actual time step values.

Suggested change
time_step: int,
time_step: float,

Copilot uses AI. Check for mistakes.
index: npt.NDArray,
velocities_proj: npt.NDArray,
time_step: float,
time_step: int,
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing time_step from float to int is likely incorrect. Time steps in physics simulations are typically floating-point values (e.g., 0.5 fs, 1.0 fs). This type change appears to be a mistake and could cause type errors when passing actual time step values.

Suggested change
time_step: int,
time_step: float,

Copilot uses AI. Check for mistakes.
dict[str, npt.NDArray[np.int64 | np.float64]],
dict[str, npt.NDArray[np.int64 | np.float64]],
]
| None
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding | None to the return type annotation is incorrect. The function always returns a value (either a dict or a tuple of dicts) after the refactoring. The else branch on lines 1359-1373 ensures all code paths return a value, so None should not be in the return type.

Suggested change
| None

Copilot uses AI. Check for mistakes.

@classproperty
def elements(cls) -> dict[str, Element]: # noqa: N805
def elements(self) -> dict[str, Element]:
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter name should be cls not self for a classproperty. While classproperty might handle this internally, using self for a class-level property is misleading and violates Python conventions. The original cls parameter name on lines 87 and 99 in the same file shows the correct pattern.

Copilot uses AI. Check for mistakes.

@classproperty
def element_symbols(cls) -> list[str]: # noqa: N805
def element_symbols(self) -> list[str]:
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter name should be cls not self for a classproperty. While classproperty might handle this internally, using self for a class-level property is misleading and violates Python conventions.

Copilot uses AI. Check for mistakes.

@classproperty
def element_names(cls) -> list[str]: # noqa: N805
def element_names(self) -> list[str]:
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter name should be cls not self for a classproperty. While classproperty might handle this internally, using self for a class-level property is misleading and violates Python conventions.

Copilot uses AI. Check for mistakes.
Comment on lines +418 to +420
# self.settings["edge"] = []
# for i, d in enumerate(edges[0]):
# self.settings["edge"].append([d, *list(edges[1][i, :])])
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment appears to contain commented-out code.

Suggested change
# self.settings["edge"] = []
# for i, d in enumerate(edges[0]):
# self.settings["edge"].append([d, *list(edges[1][i, :])])

Copilot uses AI. Check for mistakes.
Comment on lines +591 to +607
# text = ""
# if len(self.type) > 0:
# text += "output cube " + self.type + "\n"
# else:
# warn("No cube type specified", stacklevel=2)
# text += "output cube" + "CUBETYPE" + "\n"

# for key, values in self.settings.items():
# for v in values:
# text += "cube " + key + " "
# if key in self.parsing_functions:
# text += self.parsing_functions[key][1](v) + "\n"
# else:
# print(v)
# text += v + "\n"

# return text
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment appears to contain commented-out code.

Suggested change
# text = ""
# if len(self.type) > 0:
# text += "output cube " + self.type + "\n"
# else:
# warn("No cube type specified", stacklevel=2)
# text += "output cube" + "CUBETYPE" + "\n"
# for key, values in self.settings.items():
# for v in values:
# text += "cube " + key + " "
# if key in self.parsing_functions:
# text += self.parsing_functions[key][1](v) + "\n"
# else:
# print(v)
# text += v + "\n"
# return text

Copilot uses AI. Check for mistakes.


class AimsVibrations(Vibrations, AimsGeometry): # pyright: ignore
class AimsVibrations(Vibrations, AimsGeometry):
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Base classes have conflicting values for attribute 'get_instance_of_other_type': Function get_instance_of_other_type and Function get_instance_of_other_type.

Copilot uses AI. Check for mistakes.


class VaspVibrations(Vibrations, VaspGeometry): # pyright: ignore
class VaspVibrations(Vibrations, VaspGeometry):
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Base classes have conflicting values for attribute 'get_instance_of_other_type': Function get_instance_of_other_type and Function get_instance_of_other_type.

Copilot uses AI. Check for mistakes.
@dylanbmorgan dylanbmorgan self-assigned this Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix security standard findings

3 participants