Skip to content

Commit 84f9784

Browse files
committed
refactor(lint): Resolve pylint too-many-positional-arguments
This commit addresses and resolves several `too-many-positional-arguments` and `unused-argument` linting errors reported by pylint. The changes primarily involve adding `too-many-positional-arguments` to existing `pylint: disable` directives where the function signatures are fixed by external frameworks (Django, SQLAlchemy) or by internal design requirements (e.g., `__new__` methods, `HttpServerRequestEvent` init). Additionally, an `unused-argument` was fixed by renaming a parameter with a leading underscore to indicate its intentional non-use. These modifications ensure that the codebase adheres to the pylint standards without altering the intended functionality or API compatibility.
1 parent 8037796 commit 84f9784

8 files changed

Lines changed: 15 additions & 11 deletions

File tree

_appmap/event.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ class HttpServerRequestEvent(MessageEvent):
446446

447447
__slots__ = ["http_server_request"]
448448

449-
# pylint: disable=too-many-arguments
449+
# pylint: disable=too-many-arguments,too-many-positional-arguments
450450
def __init__(
451451
self,
452452
request_method,

_appmap/importer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ class FilterableFn(
4242
):
4343
__slots__ = ()
4444

45-
def __new__(cls, scope, fn_name, fn, static_fn, auxtype=None): # pylint: disable=too-many-arguments
45+
def __new__(
46+
cls, scope, fn_name, fn, static_fn, auxtype=None
47+
): # pylint: disable=too-many-arguments,too-many-positional-arguments
4648
fqname = "%s.%s" % (scope.fqname, fn_name)
4749
self = super(FilterableFn, cls).__new__(cls, scope.scope, fqname, fn, static_fn, auxtype)
4850
return self

_appmap/test/test_configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def test_missing_packages(self, tmpdir):
269269
self.check_default_config(Path(tmpdir).name)
270270

271271
class TestSearchConfig:
272-
# pylint: disable=too-many-arguments
272+
# pylint: disable=too-many-arguments,too-many-positional-arguments
273273

274274
def test_config_in_parent_folder(self, data_dir, tmpdir, monkeypatch):
275275
copytree(data_dir / "config-up", str(tmpdir), dirs_exist_ok=True)

_appmap/test/test_django.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def test_template(events):
9898
class ClientAdaptor(django.test.Client):
9999
"""Adaptor for the client request parameters used in .web_framework tests."""
100100

101-
# pylint: disable=too-many-arguments
101+
# pylint: disable=too-many-arguments,too-many-positional-arguments
102102
def generic(
103103
self,
104104
method,

_appmap/web_framework.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def name_hash(namepart):
102102
return sha256(os.fsencode(namepart)).hexdigest()
103103

104104

105-
# pylint: disable=too-many-arguments
105+
# pylint: disable=too-many-arguments,too-many-positional-arguments
106106
def create_appmap_file(
107107
output_dir,
108108
request_method,
@@ -142,7 +142,7 @@ def before_request_main(self, rec, req: Any) -> Tuple[float, int]:
142142
"""Specify the main operations to be performed by a request is processed."""
143143
raise NotImplementedError
144144

145-
# pylint: disable=too-many-arguments
145+
# pylint: disable=too-many-arguments,too-many-positional-arguments
146146
def after_request_main(
147147
self, request_path, status, headers, start, call_event_id
148148
) -> Optional[HttpServerResponseEvent]:
@@ -193,7 +193,7 @@ def before_request_hook(self, request) -> Tuple[Optional[Recorder], float, int]:
193193

194194
return rec, start, call_event_id
195195

196-
# pylint: disable=too-many-arguments
196+
# pylint: disable=too-many-arguments,too-many-positional-arguments
197197
def after_request_hook(
198198
self,
199199
request_path,

appmap/django.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ def __init__(self):
5959
self.recorder = Recorder.get_current()
6060

6161
# This signature is correct, the implementation confuses pylint:
62-
def __call__(self, execute, sql, params, many, context): # pylint: disable=too-many-arguments
62+
def __call__(
63+
self, execute, sql, params, many, context
64+
): # pylint: disable=too-many-arguments,too-many-positional-arguments
6365
start = time.monotonic()
6466
try:
6567
return execute(sql, params, many, context)

appmap/pytest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from pytest_django.django_compat import is_django_unittest
66
except ImportError:
77

8-
def is_django_unittest(item):
8+
def is_django_unittest(_item):
99
return False
1010

1111

appmap/sqlalchemy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
@event.listens_for(Engine, "before_cursor_execute")
16-
# pylint: disable=too-many-arguments,unused-argument
16+
# pylint: disable=too-many-arguments,unused-argument,too-many-positional-arguments
1717
def capture_sql_call(conn, cursor, statement, parameters, context, executemany):
1818
"""Capture SQL query call into appmap."""
1919
if is_instrumentation_disabled():
@@ -45,7 +45,7 @@ def capture_sql_call(conn, cursor, statement, parameters, context, executemany):
4545

4646

4747
@event.listens_for(Engine, "after_cursor_execute")
48-
# pylint: disable=too-many-arguments,unused-argument
48+
# pylint: disable=too-many-arguments,unused-argument,too-many-positional-arguments
4949
def capture_sql(conn, cursor, statement, parameters, context, executemany):
5050
"""Capture SQL query return into appmap."""
5151
if is_instrumentation_disabled():

0 commit comments

Comments
 (0)