DeinAlptraum wrote:
@Endilll do you think this needs a second review?
If not, could you merge this? Since I don't have commit access
https://github.com/llvm/llvm-project/pull/95608
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://github.com/DeinAlptraum edited
https://github.com/llvm/llvm-project/pull/95608
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/DeinAlptraum edited
https://github.com/llvm/llvm-project/pull/95608
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -10,26 +10,6 @@
class TestTokenKind(unittest.TestCase):
-def test_constructor(self):
DeinAlptraum wrote:
So the existing "custom" enum implementation included a sort of constructor, as
we see in this test, that takes a number and name and then adds
https://github.com/DeinAlptraum updated
https://github.com/llvm/llvm-project/pull/95608
>From 35bfcfbc69ee812c59350440b7b15c5e23ad1307 Mon Sep 17 00:00:00 2001
From: Jannick Kremer
Date: Fri, 14 Jun 2024 22:12:09 +0100
Subject: [PATCH 1/3] [libclang/python] Refactor enum usage
Use Python's
@@ -10,26 +10,6 @@
class TestTokenKind(unittest.TestCase):
-def test_constructor(self):
Endilll wrote:
> test_constructor: this tests the ability to add enum variants "on the fly",
> which is not possible with the Python stdlib's Enum class
Do we have
https://github.com/DeinAlptraum edited
https://github.com/llvm/llvm-project/pull/95608
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/DeinAlptraum edited
https://github.com/llvm/llvm-project/pull/95608
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -10,26 +10,6 @@
class TestTokenKind(unittest.TestCase):
-def test_constructor(self):
DeinAlptraum wrote:
thNot really:
- `test_constructor`: this tests the ability to add enum variants "on the fly",
which is not possible with the Python stdlib's
@@ -10,26 +10,6 @@
class TestTokenKind(unittest.TestCase):
-def test_constructor(self):
Endilll wrote:
Can't we keep those tests?
https://github.com/llvm/llvm-project/pull/95608
___
cfe-commits mailing list
DeinAlptraum wrote:
\*Ping*
@boomanaiden154 @linux4life798 a review/feedback would be appreciated!
https://github.com/llvm/llvm-project/pull/95608
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://github.com/DeinAlptraum edited
https://github.com/llvm/llvm-project/pull/95608
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Endilll wrote:
Also worth pinging @linux4life798
https://github.com/llvm/llvm-project/pull/95608
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
DeinAlptraum wrote:
@Endilll done with the TokenKind refactoring, so this is ready to go from my
side.
Regarding reviewers, can you recommend any others? Since I assume I'll open a
couple more PRs for the Python bindings after this
https://github.com/llvm/llvm-project/pull/95608
https://github.com/DeinAlptraum updated
https://github.com/llvm/llvm-project/pull/95608
>From 35bfcfbc69ee812c59350440b7b15c5e23ad1307 Mon Sep 17 00:00:00 2001
From: Jannick Kremer
Date: Fri, 14 Jun 2024 22:12:09 +0100
Subject: [PATCH 1/2] [libclang/python] Refactor enum usage
Use Python's
github-actions[bot] wrote:
:warning: Python code formatter, darker found issues in your code. :warning:
You can test this locally with the following command:
``bash
darker --check --diff -r
cc7a18c18011d1e0c70187ceb60e3e69bf7cd0ee...82f120f207a4a9425cdbccafdba8974bc00ffc51
https://github.com/DeinAlptraum updated
https://github.com/llvm/llvm-project/pull/95608
>From 35bfcfbc69ee812c59350440b7b15c5e23ad1307 Mon Sep 17 00:00:00 2001
From: Jannick Kremer
Date: Fri, 14 Jun 2024 22:12:09 +0100
Subject: [PATCH 1/2] [libclang/python] Refactor enum usage
Use Python's
https://github.com/Endilll edited
https://github.com/llvm/llvm-project/pull/95608
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Endilll wrote:
> @Endilll are you taking a look at this, and/or should I ask other reviewers?
It's never a bad idea to add more reviewers, as long as they are relevant.
https://github.com/llvm/llvm-project/pull/95608
___
cfe-commits mailing list
https://github.com/Endilll commented:
LGTM
> There is also TokenKind: this one does not currently inherit from
> BaseEnumeration and is defined somewhat differently, having all its variants
> and their IDs as a dictionary in enumerations.py. This seems quite arbitrary
> to me, is there any
DeinAlptraum wrote:
@Endilll are you taking a look at this, and/or should I ask other reviewers?
https://github.com/llvm/llvm-project/pull/95608
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://github.com/DeinAlptraum edited
https://github.com/llvm/llvm-project/pull/95608
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
DeinAlptraum wrote:
@Endilll can I ask you for a review again?
As a next step towards the python-bindings strict typing PR, this one captures
all the enum refactoring changes necessary towards that goal. Don't be scared
by the LoC changed: 90% of that is just indentation changes :)
@@ -611,51 +612,25 @@ def register(value, name):
### Cursor Kinds ###
-class BaseEnumeration:
+class BaseEnumeration(Enum):
"""
Common base class for named enumerations held in sync with Index.h values.
-
-Subclasses must define their own _kinds and _name_map
@@ -611,51 +612,25 @@ def register(value, name):
### Cursor Kinds ###
-class BaseEnumeration:
+class BaseEnumeration(Enum):
"""
Common base class for named enumerations held in sync with Index.h values.
-
-Subclasses must define their own _kinds and _name_map
@@ -31,17 +31,9 @@ class TestCursorKind(unittest.TestCase):
def test_from_id(self):
"""Check that kinds can be constructed from valid IDs"""
for enum in self.enums:
-self.assertEqual(enum.from_id(2), enum._kinds[2])
+
https://github.com/DeinAlptraum commented:
There is also `TokenKind`: this one does not currently inherit from
`BaseEnumeration` and is defined somewhat differently, having all its variants
and their IDs as a dictionary in `enumerations.py`. This seems quite arbitrary
to me, is there any
https://github.com/DeinAlptraum edited
https://github.com/llvm/llvm-project/pull/95608
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -611,51 +612,25 @@ def register(value, name):
### Cursor Kinds ###
-class BaseEnumeration:
+class BaseEnumeration(Enum):
"""
Common base class for named enumerations held in sync with Index.h values.
-
-Subclasses must define their own _kinds and _name_map
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Jannick Kremer (DeinAlptraum)
Changes
Use Python's builtin enum class instead of writing our own.
This is preparation for passing a strict type check in PR #78114 ,
fixing 920 out of 1341 strict typing errors
---
Patch is 64.63 KiB,
https://github.com/DeinAlptraum created
https://github.com/llvm/llvm-project/pull/95608
Use Python's builtin enum class instead of writing our own.
This is preparation for passing a strict type check in PR #78114 , fixing 920
out of 1341 strict typing errors
>From
31 matches
Mail list logo