[clang] [libclang/python] Simplify __eq__ operators (PR #140540)
via cfe-commits
cfe-commits at lists.llvm.org
Mon May 19 06:40:14 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r HEAD~1...HEAD clang/bindings/python/clang/cindex.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- cindex.py 2025-05-19 13:36:05.000000 +0000
+++ cindex.py 2025-05-19 13:39:46.979335 +0000
@@ -333,11 +333,13 @@
def is_in_system_header(self):
"""Returns true if the given source location is in a system header."""
return conf.lib.clang_Location_isInSystemHeader(self) # type: ignore [no-any-return]
def __eq__(self, other):
- return isinstance(other, SourceLocation) and conf.lib.clang_equalLocations(self, other)
+ return isinstance(other, SourceLocation) and conf.lib.clang_equalLocations(
+ self, other
+ )
def __ne__(self, other):
return not self.__eq__(other)
def __lt__(self, other: SourceLocation) -> bool:
@@ -391,11 +393,13 @@
source range.
"""
return conf.lib.clang_getRangeEnd(self) # type: ignore [no-any-return]
def __eq__(self, other):
- return isinstance(other, SourceRange) and conf.lib.clang_equalRanges(self, other)
+ return isinstance(other, SourceRange) and conf.lib.clang_equalRanges(
+ self, other
+ )
def __ne__(self, other):
return not self.__eq__(other)
def __contains__(self, other):
``````````
</details>
https://github.com/llvm/llvm-project/pull/140540
More information about the cfe-commits
mailing list