Skip to content

Conversation

@DerWeh
Copy link
Owner

@DerWeh DerWeh commented Jun 22, 2025

Use modern build system based on pyproject.html and install the package instead of using path hacks. We switch from versioneer, which had some hiccups, to setuptools-scm. Use ruff as linter instead of several other tools. Employ pre-commit.

def gf(self, z, **kwds):
"""Green's function."""
raise NotImplementedError('This is just a placeholder')
def gf(self, z, **kwds): ... # noqa: D102

Check notice

Code scanning / CodeQL

Statement has no effect Note test

This statement has no effect.

Copilot Autofix

AI 7 months ago

To fix the issue, the gf method should be explicitly marked as abstract using the abc module. This will make it clear that the method is intended to be implemented by subclasses. The GfProperties class should inherit from abc.ABC (Abstract Base Class), and the gf method should be decorated with @abc.abstractmethod. This approach is more explicit and aligns with Python's conventions for abstract methods.

Steps to implement the fix:

  1. Import the ABC and abstractmethod classes from the abc module.
  2. Modify the GfProperties class to inherit from ABC.
  3. Decorate the gf method with @abstractmethod and remove the ellipsis (...).

Suggested changeset 1
gftool/tests/greenfunctions_test.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/gftool/tests/greenfunctions_test.py b/gftool/tests/greenfunctions_test.py
--- a/gftool/tests/greenfunctions_test.py
+++ b/gftool/tests/greenfunctions_test.py
@@ -16,2 +16,3 @@
 from scipy import integrate
+from abc import ABC, abstractmethod
 
@@ -35,3 +36,3 @@
 
-class GfProperties:
+class GfProperties(ABC):
     r"""
@@ -50,3 +51,6 @@
 
-    def gf(self, z, **kwds): ...  # noqa: D102
+    @abstractmethod
+    def gf(self, z, **kwds):  # noqa: D102
+        """Abstract method for Green's function."""
+        pass
 
EOF
@@ -16,2 +16,3 @@
from scipy import integrate
from abc import ABC, abstractmethod

@@ -35,3 +36,3 @@

class GfProperties:
class GfProperties(ABC):
r"""
@@ -50,3 +51,6 @@

def gf(self, z, **kwds): ... # noqa: D102
@abstractmethod
def gf(self, z, **kwds): # noqa: D102
"""Abstract method for Green's function."""
pass

Copilot is powered by AI and may make mistakes. Always verify output.
from . import old_pade
from .context import gftool as gt, gt_pade
import gftool as gt
import gftool.pade

Check notice

Code scanning / CodeQL

Unused import Note test

Import of 'gftool' is not used.

Copilot Autofix

AI 7 months ago

To fix the issue, we will remove the unused import statement import gftool.pade from line 7. This will eliminate the unnecessary dependency and improve code readability without affecting the functionality of the script.


Suggested changeset 1
gftool/tests/pade_test.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/gftool/tests/pade_test.py b/gftool/tests/pade_test.py
--- a/gftool/tests/pade_test.py
+++ b/gftool/tests/pade_test.py
@@ -6,3 +6,2 @@
 import gftool as gt
-import gftool.pade
 from gftool.tests import _old_pade as old_pade
EOF
@@ -6,3 +6,2 @@
import gftool as gt
import gftool.pade
from gftool.tests import _old_pade as old_pade
Copilot is powered by AI and may make mistakes. Always verify output.
@DerWeh DerWeh merged commit eaa0c6b into master Jun 22, 2025
8 of 10 checks passed
@DerWeh DerWeh deleted the buildsystem branch June 22, 2025 16:02
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.

2 participants