Skip to content

Commit

Permalink
snapshots for refactored classification logic
Browse files Browse the repository at this point in the history
  • Loading branch information
cake-monotone committed Sep 10, 2024
1 parent 8c1f697 commit 1865ecb
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ def f(a, b):
# Unused arguments on magic methods.
###
class C:
def __new__(cls, x):
print("Hello, world!")

def __init__(self, x) -> None:
print("Hello, world!")

Expand All @@ -198,6 +201,12 @@ def __str__(self) -> str:
def __exit__(self, exc_type, exc_value, traceback) -> None:
print("Hello, world!")

def __init_subclass__(cls, x) -> None:
print("Hello, world!")

def __class_getitem__(cls, x):
print("Hello, world!")


###
# Used arguments on chained cast.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,8 @@ impl<'a> ClassMethod<'a> {
}
}

// Dunder new methods (`__new__`, also known as magic methods) are technically static methods,
// with `cls` as their first argument. However, for the purpose of this check, we treat them
// as class methods.
// Dunder new methods (`__new__`) are technically static methods with `cls` as their first argument.
// For simplicity of implementation, we treat them as class methods.
use ClassMethod as DunderNewMethod;

#[derive(Debug)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ ARG.py:43:16: ARG002 Unused method argument: `x`
44 | print("Hello, world!")
|

ARG.py:192:24: ARG002 Unused method argument: `x`
ARG.py:195:24: ARG002 Unused method argument: `x`
|
190 | ###
191 | class C:
192 | def __init__(self, x) -> None:
| ^ ARG002
193 | print("Hello, world!")
194 |
195 | def __init__(self, x) -> None:
| ^ ARG002
196 | print("Hello, world!")
|


Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,11 @@ ARG.py:55:11: ARG004 Unused static method argument: `x`
56 | print("Hello, world!")
|


ARG.py:192:22: ARG004 Unused static method argument: `x`
|
190 | ###
191 | class C:
192 | def __new__(cls, x):
| ^ ARG004
193 | print("Hello, world!")
|

0 comments on commit 1865ecb

Please sign in to comment.