Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 9519 super init with non self arg #10190

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

jzohrab
Copy link
Contributor

@jzohrab jzohrab commented Jan 17, 2025

Work-in-progress for issue #9519, to see if I can crack it.

This is going to contain many junk commits that I'll rebase and get rid of later, just doing this so that people can see it and maybe comment.

The first commit adds a failing test case, then there is some debug crap just so I can understand the code as I go.

@jzohrab jzohrab marked this pull request as draft January 17, 2025 16:50
@jzohrab
Copy link
Contributor Author

jzohrab commented Jan 17, 2025

the test file lines 11-13

class Win(Window):
    def __init__(self, txt):
        super().__init__(txt)   # the bad line

Running pytest -k test_super_init_with_non_self_argument -vv, line 13 stops debugging at point i

     -------------------------
     visit call, node: Call(func=<Attribute.__init__ l.13 at 0x105fd42d0>,
         args=[<Name.txt l.13 at 0x106131fd0>],
         keywords=[])
     a
     b
     c
     d
     f
     g
     i

which is this:

        _dp("f")
        if called.args.args is None:
            _dp("g")
            if called.name == "isinstance":
                # Verify whether second argument of isinstance is a valid type
                _dp("h")
                self._check_isinstance_args(node, callable_name)
            # Built-in functions have no argument information.
            _dp("i")
            return

        _dp("j")

so the function actually exits earlier than what was suggested in the original issue.

@jzohrab
Copy link
Contributor Author

jzohrab commented Jan 17, 2025

Current debug cruft:

     visit call, node: Call(func=<Attribute.__init__ l.13 at 0x108038190>,
         args=[<Name.txt l.13 at 0x1078c26d0>],
         keywords=[])
     Data dump for __init__ call
     node frame: FunctionDef.__init__(name='__init__',
                         position=Position(lineno=12, col_offset=4, end_lineno=12, end_col_offset=16),
                         decorators=None,
                         args=<Arguments l.12 at 0x107f7d9d0>,
                         returns=None,
                         type_params=[],
                         doc_node=None,
                         body=[<Expr l.13 at 0x107fbce60>])
     isinst: False
     funcdef: False
     called: <BoundMethod __init__ of builtins.object at 0x4429550992
     frame body: [<Expr l.13 at 0x107fbce60>]
     called in frame body: False
     npa: 1
     dec names: set()
     called.args.args is None
     called.name: __init__
     Returning now

@jzohrab
Copy link
Contributor Author

jzohrab commented Jan 17, 2025

Just prior to turning off the debug cruft, here is the output:

  -  visit call, node: Call(func=<Attribute.__init__ l.13 at 0x104b14190>,
  -      args=[<Name.txt l.13 at 0x10439e6d0>],
  -      keywords=[])
  -  Data dump for __init__ call
  -  call_site: <astroid.arguments.CallSite object at 0x104acc8a0>
  -  call site positional args:: [<Name.txt l.13 at 0x10439e6d0>]
  -  call site keyword args:: {}
  -  call site invalid args: False
  -  call site inv keywords: False
  -  node args: [<Name.txt l.13 at 0x10439e6d0>]
  -  node frame: FunctionDef.__init__(name='__init__',
  -                      position=Position(lineno=12, col_offset=4, end_lineno=12, end_col_offset=16),
  -                      decorators=None,
  -                      args=<Arguments l.12 at 0x104a599d0>,
  -                      returns=None,
  -                      type_params=[],
  -                      doc_node=None,
  -                      body=[<Expr l.13 at 0x104a98e60>])
  -  isinst: False
  -  funcdef: False
  -  called: <BoundMethod __init__ of builtins.object at 0x4373829008
  -  called.args: Arguments(vararg=None,
  -           kwarg=None,
  -           args=None,
  -           defaults=None,
  -           kwonlyargs=[],
  -           posonlyargs=[],
  -           posonlyargs_annotations=[],
  -           kw_defaults=None,
  -           annotations=[],
  -           varargannotation=None,
  -           kwargannotation=None,
  -           kwonlyargs_annotations=[],
  -           type_comment_args=[],
  -           type_comment_kwonlyargs=[],
  -           type_comment_posonlyargs=[])
  -  frame body: [<Expr l.13 at 0x104a98e60>]
  -  called in frame body: False
  -  npa: 1
  -  dec names: set()
    ************* Module super_init_with_non_self_argument
  + tests/regrtest_data/super_init_with_non_self_argument.py:11:0: blah
  - tests/regrtest_data/super_init_with_non_self_argument.py:13:8: E1121: Too many positional arguments for __init__ call (too-many-function-args)
  -  called.args.args is None
  -  called.name: __init__
  -  Returning now
  - 

@jzohrab jzohrab force-pushed the issue_9519_super_init_with_non_self_arg branch from c4f2c85 to e29a7c8 Compare January 17, 2025 18:36
@jzohrab
Copy link
Contributor Author

jzohrab commented Jan 17, 2025

There's a bunch of cruft in the commits and the code, but the idea is there, so I'm going to mark this as ready for review.

I'm sure the actual ast checking for the __init__ call can be done better but I'm not sure how to do it; I came to the current state after putting in all of the debug cruft during my hacking with the test. It's a start, anyway.

@jzohrab jzohrab marked this pull request as ready for review January 17, 2025 18:38
@Pierre-Sassoulas Pierre-Sassoulas added Work in progress False Negative 🦋 No message is emitted but something is wrong with the code labels Jan 17, 2025
@jzohrab
Copy link
Contributor Author

jzohrab commented Jan 17, 2025

As you can probably tell from my hacking, I'm very new at ast hacking, so there may be a far better way to do it than what I have. At least the test case should be good as a starting point.

@jzohrab
Copy link
Contributor Author

jzohrab commented Jan 17, 2025

There are some test failures, but I'll wait for feedback/notes before I try to address them, as there will likely be changes needed.

This comment has been minimized.

@jacobtylerwalls
Copy link
Member

Hey, thanks for tackling this one!

What do you think about something like this?

diff --git a/pylint/checkers/typecheck.py b/pylint/checkers/typecheck.py
index edef5188b..afed2d3fe 100644
--- a/pylint/checkers/typecheck.py
+++ b/pylint/checkers/typecheck.py
@@ -1453,8 +1453,19 @@ accessed. Python regular expressions are accepted.",
         """Check that called functions/methods are inferred to callable objects,
         and that passed arguments match the parameters in the inferred function.
         """
-        called = safe_infer(node.func, compare_constructors=True)
+        is_super = False
+        if (
+            isinstance(node.func, nodes.Attribute)
+            and node.func.attrname == "__init__"
+            and isinstance(node.func.expr, nodes.Call)
+            and isinstance(node.func.expr.func, nodes.Name)
+            and node.func.expr.func.name == "super"
+        ):
+            inferred = safe_infer(node.func.expr)
+            if isinstance(inferred, astroid.objects.Super):
+                is_super = True
 
+        called = safe_infer(node.func, compare_constructors=True)
         self._check_not_callable(node, called)
 
         try:
@@ -1468,7 +1479,21 @@ accessed. Python regular expressions are accepted.",
             if called.name == "isinstance":
                 # Verify whether second argument of isinstance is a valid type
                 self._check_isinstance_args(node, callable_name)
-            # Built-in functions have no argument information.
+            # Built-in functions have no argument information, but we know
+            # super() only takes self.
+            if is_super and utils.is_builtin_object(called):
+                if (
+                    (call_site := astroid.arguments.CallSite.from_call(node))
+                    and call_site.positional_arguments
+                    and (first_arg := call_site.positional_arguments[0])
+                    and not (isinstance(first_arg, nodes.Name) and first_arg.name == "self")
+                ):
+                    self.add_message(
+                        "too-many-function-args",
+                        node=node,
+                        args=(callable_name,),
+                    )
+
             return
 
         if len(called.argnames()) != len(set(called.argnames())):

@jacobtylerwalls jacobtylerwalls added this to the 4.0.0 milestone Mar 8, 2025
@jzohrab
Copy link
Contributor Author

jzohrab commented Mar 10, 2025

Hi @jacobtylerwalls - thanks very much. I confess that this is out of my range of experience and so I can't say that your suggestion is the right way to handle it! It looks right to the uninformed (aka me), but I'm flying blind.

If you'd like, I can make the change you suggested in the branch, remove the cruft code comments, and push (without squashing).

@jacobtylerwalls
Copy link
Member

Hey @jzohrab that would be great. Once you get a clean test run (I think I remember seeing there were a couple functional tests that needed updating?) the CI will run a "primer" job showing results of making this change on lint runs on several python packages. That might help us see if my suggestions is missing any edge cases. All part of the fun!

(I'm not saying my sketch is perfect, but I was trying to rely less on asserting on the str()ingified value of a node and things like that.)

@jzohrab jzohrab force-pushed the issue_9519_super_init_with_non_self_arg branch from 94a32c2 to 15850fd Compare March 11, 2025 19:20
@jzohrab
Copy link
Contributor Author

jzohrab commented Mar 11, 2025

Rebased off of upstream/main, added the changes suggested by @jacobtylerwalls, moved the is_super check to a separate function for readability. Will see where that leaves us at the end of the run. I don't think there will be any new test failures introduced with this change, but I'm not sure. It's possible that there are some existing test failures (which should be deactivated/indicated in a separate PR, maybe).

@jzohrab
Copy link
Contributor Author

jzohrab commented Mar 11, 2025

There are failures:

=================================== FAILURES ===================================
____________________ test_functional[metaclass_attr_access] ____________________

self = <pylint.testutils.lint_module_test.LintModuleTest object at 0x7f0445c2cd00>

    def runTest(self) -> None:
>       self._runTest()
E       AssertionError: Wrong message(s) raised for "metaclass_attr_access.py":
E       
E       Unexpected in testdata:
E          8: too-many-function-args (times 1)

pylint/testutils/lint_module_test.py:[142](https://github.com/pylint-dev/pylint/actions/runs/13796483619/job/38589265264?pr=10190#step:7:143): AssertionError
________________________ test_functional[super_checks] _________________________

self = <pylint.testutils.lint_module_test.LintModuleTest object at 0x7f043aaf4600>

    def runTest(self) -> None:
>       self._runTest()
E       AssertionError: Wrong message(s) raised for "super_checks.py":
E       
E       Unexpected in testdata:
E         61: too-many-function-args (times 1)

but I have no idea how to approach them! Here's the metaclass_attr_access file:

class Meta(type):
    """the meta class"""
    def __init__(cls, name, bases, dictionary):
        super(Meta, cls).__init__(name, bases, dictionary)
        print(cls, cls._meta_args)
        delattr(cls, '_meta_args')


class Test:
    """metaclassed class"""
    __metaclass__ = Meta
    _meta_args = ('foo', 'bar')

    def __init__(self):
        print('__init__', self)

so maybe the super code suggested is handling super(Meta, cls) incorrectly. Not sure, and I think I might be breaking things if I hack at it further. Maybe someone with more experience with asts etc can take my work as a startisg point.

Copy link
Contributor

🤖 Effect of this PR on checked open source code: 🤖

Effect on astroid:
The following messages are now emitted:

  1. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/pylint-dev/astroid/blob/9f8faeb3c0025aee08698e1a3cd02910579e4220/astroid/exceptions.py#L61

Effect on home-assistant:
The following messages are now emitted:

  1. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/loader.py#L1453
  2. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/loader.py#L1462
  3. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/loader.py#L1471
  4. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/util/yaml/loader.py#L142
  5. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/util/yaml/loader.py#L151
  6. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/util/yaml/input.py#L15
  7. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/ecovacs/select.py#L85
  8. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/ecovacs/event.py#L44
  9. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/ecovacs/lawn_mower.py#L69
  10. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/ecovacs/vacuum.py#L254
  11. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/assist_pipeline/pipeline.py#L493
  12. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/google_assistant/error.py#L14
  13. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/switchbee/light.py#L63
  14. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/switchbee/climate.py#L102
  15. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/teslemetry/entity.py#L64
  16. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/meteo_france/weather.py#L101
  17. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/deconz/binary_sensor.py#L207
  18. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/deconz/alarm_control_panel.py#L90
  19. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/deconz/fan.py#L71
  20. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/deconz/climate.py#L107
  21. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/deconz/number.py#L116
  22. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/deconz/sensor.py#L411
  23. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/deconz/cover.py#L61
  24. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/knx/storage/entity_store_validation.py#L71
  25. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/stream/exceptions.py#L27
  26. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/rainbird/config_flow.py#L56
  27. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/ring/light.py#L67
  28. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/ring/button.py#L50
  29. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/syncthru/binary_sensor.py#L62
  30. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/syncthru/sensor.py#L85
  31. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/econet/water_heater.py#L72
  32. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/econet/climate.py#L85
  33. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/econet/switch.py#L39
  34. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/here_travel_time/sensor.py#L122
  35. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/osoenergy/binary_sensor.py#L77
  36. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/osoenergy/water_heater.py#L177
  37. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/osoenergy/sensor.py#L172
  38. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/emonitor/sensor.py#L80
  39. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/landisgyr_heat_meter/sensor.py#L312
  40. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/nibe_heatpump/config_flow.py#L81
  41. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/blebox/light.py#L67
  42. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/blebox/binary_sensor.py#L46
  43. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/blebox/button.py#L33
  44. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/blebox/sensor.py#L140
  45. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/blebox/cover.py#L63
  46. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/lacrosse_view/sensor.py#L230
  47. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/eheimdigital/light.py#L80
  48. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/eheimdigital/climate.py#L82
  49. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/wemo/coordinator.py#L59
  50. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/fritz/coordinator.py#L93
  51. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/lookin/entity.py#L72
  52. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/lookin/entity.py#L113
  53. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/nextdns/binary_sensor.py#L78
  54. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/nextdns/button.py#L49
  55. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/nextdns/switch.py#L552
  56. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/devolo_home_network/binary_sensor.py#L86
  57. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/devolo_home_network/device_tracker.py#L98
  58. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/components/medcom_ble/sensor.py#L78
  59. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/home-assistant/core/blob/d498dbd5ace41dc9657c265e42749dc49b9c8ea7/homeassistant/helpers/script.py#L400

Effect on pygame:
The following messages are now emitted:

  1. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/pygame/pygame/blob/79807da84c9bacf8df5a177763e14c924e3b15e2/src_py/midi.py#L662

Effect on poetry-core:
The following messages are now emitted:

  1. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/python-poetry/poetry-core/blob/5209a795b12dc9b553c0eb9df3743dc6931c7a73/src/poetry/core/packages/path_dependency.py#L45

Effect on music21:
The following messages are now emitted:

  1. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/cuthbertLab/music21/blob/f7df489a066287f8721cd632a7134af583474a2f/music21/exceptions21.py#L39
  2. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/cuthbertLab/music21/blob/f7df489a066287f8721cd632a7134af583474a2f/music21/environment.py#L120
  3. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/cuthbertLab/music21/blob/f7df489a066287f8721cd632a7134af583474a2f/music21/musicxml/xmlObjects.py#L111

Effect on pytest:
The following messages are now emitted:

  1. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/pytest-dev/pytest/blob/03b5a79170679a017fb58894518b167ff9be463e/src/_pytest/outcomes.py#L28
  2. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/pytest-dev/pytest/blob/03b5a79170679a017fb58894518b167ff9be463e/src/_pytest/outcomes.py#L77
  3. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/pytest-dev/pytest/blob/03b5a79170679a017fb58894518b167ff9be463e/src/_pytest/_code/code.py#L369
  4. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/pytest-dev/pytest/blob/03b5a79170679a017fb58894518b167ff9be463e/src/_pytest/_code/code.py#L371

Effect on django:
The following messages are now emitted:

  1. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/django/django/blob/e44e8327d3d88d86895735c0e427102063ff5b55/django/template/exceptions.py#L36
  2. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/django/django/blob/e44e8327d3d88d86895735c0e427102063ff5b55/django/contrib/gis/gdal/raster/source.py#L45
  3. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/django/django/blob/e44e8327d3d88d86895735c0e427102063ff5b55/django/contrib/postgres/fields/array.py#L259
  4. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/django/django/blob/e44e8327d3d88d86895735c0e427102063ff5b55/django/utils/datastructures.py#L73
  5. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/django/django/blob/e44e8327d3d88d86895735c0e427102063ff5b55/django/utils/datastructures.py#L268
  6. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/django/django/blob/e44e8327d3d88d86895735c0e427102063ff5b55/django/core/exceptions.py#L146
  7. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/django/django/blob/e44e8327d3d88d86895735c0e427102063ff5b55/django/test/client.py#L63
  8. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/django/django/blob/e44e8327d3d88d86895735c0e427102063ff5b55/django/db/models/deletion.py#L13
  9. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/django/django/blob/e44e8327d3d88d86895735c0e427102063ff5b55/django/db/models/deletion.py#L19
  10. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/django/django/blob/e44e8327d3d88d86895735c0e427102063ff5b55/django/db/models/fields/json.py#L479

Effect on pandas:
The following messages are now emitted:

  1. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/pandas-dev/pandas/blob/513e78760a8faee6723908ca23ea83dcabc5dd77/pandas/core/arrays/categorical.py#L496
  2. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/pandas-dev/pandas/blob/513e78760a8faee6723908ca23ea83dcabc5dd77/pandas/core/arrays/categorical.py#L946
  3. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/pandas-dev/pandas/blob/513e78760a8faee6723908ca23ea83dcabc5dd77/pandas/core/arrays/numpy_.py#L118

Effect on sentry:
The following messages are now emitted:

  1. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/getsentry/sentry/blob/19d613ea777fb1f2396a935638a6df01e46c5082/src/sentry/http.py#L50
  2. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/getsentry/sentry/blob/19d613ea777fb1f2396a935638a6df01e46c5082/src/sentry/exceptions.py#L46
  3. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/getsentry/sentry/blob/19d613ea777fb1f2396a935638a6df01e46c5082/src/sentry/exceptions.py#L87
  4. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/getsentry/sentry/blob/19d613ea777fb1f2396a935638a6df01e46c5082/src/sentry/hybridcloud/models/outbox.py#L46
  5. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/getsentry/sentry/blob/19d613ea777fb1f2396a935638a6df01e46c5082/src/sentry/hybridcloud/rpc/sig.py#L16
  6. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/getsentry/sentry/blob/19d613ea777fb1f2396a935638a6df01e46c5082/src/sentry/hybridcloud/rpc/service.py#L54
  7. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/getsentry/sentry/blob/19d613ea777fb1f2396a935638a6df01e46c5082/src/sentry/features/exceptions.py#L10
  8. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/getsentry/sentry/blob/19d613ea777fb1f2396a935638a6df01e46c5082/src/sentry/dynamic_sampling/tasks/common.py#L46
  9. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/getsentry/sentry/blob/19d613ea777fb1f2396a935638a6df01e46c5082/src/sentry/api/paginator.py#L55
  10. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/getsentry/sentry/blob/19d613ea777fb1f2396a935638a6df01e46c5082/src/sentry/api/endpoints/custom_rules.py#L39
  11. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/getsentry/sentry/blob/19d613ea777fb1f2396a935638a6df01e46c5082/src/sentry/api/bases/project.py#L34
  12. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/getsentry/sentry/blob/19d613ea777fb1f2396a935638a6df01e46c5082/src/sentry/api/helpers/source_map_helper.py#L40
  13. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/getsentry/sentry/blob/19d613ea777fb1f2396a935638a6df01e46c5082/src/sentry/utils/retries.py#L18
  14. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/getsentry/sentry/blob/19d613ea777fb1f2396a935638a6df01e46c5082/src/sentry/utils/warnings.py#L15
  15. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/getsentry/sentry/blob/19d613ea777fb1f2396a935638a6df01e46c5082/src/sentry/utils/github_client.py#L24
  16. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/getsentry/sentry/blob/19d613ea777fb1f2396a935638a6df01e46c5082/src/sentry/shared_integrations/exceptions/__init__.py#L77
  17. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/getsentry/sentry/blob/19d613ea777fb1f2396a935638a6df01e46c5082/src/sentry/shared_integrations/exceptions/__init__.py#L197
  18. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/getsentry/sentry/blob/19d613ea777fb1f2396a935638a6df01e46c5082/src/sentry/testutils/helpers/backups.py#L149
  19. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/getsentry/sentry/blob/19d613ea777fb1f2396a935638a6df01e46c5082/src/sentry/auth/email.py#L16
  20. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/getsentry/sentry/blob/19d613ea777fb1f2396a935638a6df01e46c5082/src/sentry/auth/providers/github/client.py#L11
  21. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/getsentry/sentry/blob/19d613ea777fb1f2396a935638a6df01e46c5082/src/sentry/auth/providers/fly/client.py#L11
  22. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/getsentry/sentry/blob/19d613ea777fb1f2396a935638a6df01e46c5082/src/sentry/integrations/discord/message_builder/base/component/action_row.py#L10
  23. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/getsentry/sentry/blob/19d613ea777fb1f2396a935638a6df01e46c5082/src/sentry/integrations/messaging/commands.py#L34
  24. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/getsentry/sentry/blob/19d613ea777fb1f2396a935638a6df01e46c5082/src/sentry/data_export/base.py#L13

Effect on flask:
The following messages are now emitted:

  1. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/pallets/flask/blob/f61172b8dd3f962d33f25c50b2f5405e90ceffa5/src/flask/sessions.py#L82
  2. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/pallets/flask/blob/f61172b8dd3f962d33f25c50b2f5405e90ceffa5/src/flask/config.py#L99
  3. too-many-function-args:
    Too many positional arguments for method call
    https://github.com/pallets/flask/blob/f61172b8dd3f962d33f25c50b2f5405e90ceffa5/src/flask/debughelpers.py#L78

This comment was generated for commit 68bd688

@jacobtylerwalls
Copy link
Member

Hey thanks for the push. What I can say at a glance is that the pylint annotations you see in the files tab of this PR show some false positives with my suggestion -- looks like the logic needs to be fixed to make sure that the inference result for the class being init'ed is really object and not something else that might indeed take non-self args. Does that help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False Negative 🦋 No message is emitted but something is wrong with the code Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants