From 1f9a2fa826e72d7d48a3e7500b63c2b7efaec714 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Thu, 6 Jun 2024 12:49:35 +0200 Subject: [PATCH 1/6] make sure that all Linter subclasses are imported for listing them needed in planemo --- lib/galaxy/tool_util/lint.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/galaxy/tool_util/lint.py b/lib/galaxy/tool_util/lint.py index 599006457349..92a1ed291ae4 100644 --- a/lib/galaxy/tool_util/lint.py +++ b/lib/galaxy/tool_util/lint.py @@ -106,6 +106,7 @@ def list_listers(cls) -> List[str]: """ list the names of all linter derived from Linter """ + submodules.import_submodules(galaxy.tool_util.linters) return [s.__name__ for s in cls.__subclasses__()] From c05246396978a652e9fd8b67be164827224925af Mon Sep 17 00:00:00 2001 From: M Bernt Date: Thu, 6 Jun 2024 18:25:09 +0200 Subject: [PATCH 2/6] Fix typo --- lib/galaxy/tool_util/lint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/tool_util/lint.py b/lib/galaxy/tool_util/lint.py index 92a1ed291ae4..926d7a69ea3f 100644 --- a/lib/galaxy/tool_util/lint.py +++ b/lib/galaxy/tool_util/lint.py @@ -102,7 +102,7 @@ def name(cls) -> str: return cls.__name__ @classmethod - def list_listers(cls) -> List[str]: + def list_linters(cls) -> List[str]: """ list the names of all linter derived from Linter """ From 0f5bbc05cdeeec7105685e8d1642155e5f986587 Mon Sep 17 00:00:00 2001 From: M Bernt Date: Thu, 6 Jun 2024 19:05:49 +0200 Subject: [PATCH 3/6] Add alias Co-authored-by: Nicola Soranzo --- lib/galaxy/tool_util/lint.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/galaxy/tool_util/lint.py b/lib/galaxy/tool_util/lint.py index 926d7a69ea3f..c798b4761a5a 100644 --- a/lib/galaxy/tool_util/lint.py +++ b/lib/galaxy/tool_util/lint.py @@ -109,6 +109,8 @@ def list_linters(cls) -> List[str]: submodules.import_submodules(galaxy.tool_util.linters) return [s.__name__ for s in cls.__subclasses__()] + list_listers = list_linters # deprecated alias + class LintMessage: """ From 089cc1f407d6c9646f4e9d337466100f51f975c2 Mon Sep 17 00:00:00 2001 From: M Bernt Date: Fri, 7 Jun 2024 09:57:48 +0200 Subject: [PATCH 4/6] Alias needs to be a classmethod --- lib/galaxy/tool_util/lint.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/galaxy/tool_util/lint.py b/lib/galaxy/tool_util/lint.py index c798b4761a5a..8c9f6c50adb5 100644 --- a/lib/galaxy/tool_util/lint.py +++ b/lib/galaxy/tool_util/lint.py @@ -109,6 +109,7 @@ def list_linters(cls) -> List[str]: submodules.import_submodules(galaxy.tool_util.linters) return [s.__name__ for s in cls.__subclasses__()] + @classmethod list_listers = list_linters # deprecated alias From 645370755ef0899e6802ffd01341acf02ec49673 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Fri, 7 Jun 2024 10:55:04 +0200 Subject: [PATCH 5/6] make alias work --- lib/galaxy/tool_util/lint.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/tool_util/lint.py b/lib/galaxy/tool_util/lint.py index 8c9f6c50adb5..4ae0976b5a97 100644 --- a/lib/galaxy/tool_util/lint.py +++ b/lib/galaxy/tool_util/lint.py @@ -101,7 +101,6 @@ def name(cls) -> str: """ return cls.__name__ - @classmethod def list_linters(cls) -> List[str]: """ list the names of all linter derived from Linter @@ -109,10 +108,12 @@ def list_linters(cls) -> List[str]: submodules.import_submodules(galaxy.tool_util.linters) return [s.__name__ for s in cls.__subclasses__()] - @classmethod list_listers = list_linters # deprecated alias +Linter.list_listers = classmethod(Linter.list_listers) + + class LintMessage: """ a message from the linter From 8beef0b4d7d2dd70fff8294b9c58c44e0fcb3a8b Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Fri, 7 Jun 2024 16:17:18 +0100 Subject: [PATCH 6/6] Fix ``list_listers`` alias definition to appease mypy --- lib/galaxy/tool_util/lint.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/tool_util/lint.py b/lib/galaxy/tool_util/lint.py index 4ae0976b5a97..3d2796a2927e 100644 --- a/lib/galaxy/tool_util/lint.py +++ b/lib/galaxy/tool_util/lint.py @@ -101,6 +101,7 @@ def name(cls) -> str: """ return cls.__name__ + @classmethod def list_linters(cls) -> List[str]: """ list the names of all linter derived from Linter @@ -108,10 +109,13 @@ def list_linters(cls) -> List[str]: submodules.import_submodules(galaxy.tool_util.linters) return [s.__name__ for s in cls.__subclasses__()] - list_listers = list_linters # deprecated alias + list_listers: Callable[[], List[str]] # deprecated alias -Linter.list_listers = classmethod(Linter.list_listers) +# Define the `list_listers` alias outside of the `Linter` class so that +# @classmethod's change to `list_linters`s signature has taken effect and mypy +# doesn't report an [assignment] error +Linter.list_listers = Linter.list_linters class LintMessage: