Skip to content

Commit

Permalink
Don't use .get() with defaultdicts (#9918)
Browse files Browse the repository at this point in the history
This provides a small speed-up on large codebases.
  • Loading branch information
correctmost committed Sep 7, 2024
1 parent da89985 commit b7eeccb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pylint/utils/ast_walker.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import sys
import traceback
from collections import defaultdict
from collections.abc import Callable, Sequence
from collections.abc import Callable
from typing import TYPE_CHECKING

from astroid import nodes
Expand Down Expand Up @@ -75,8 +75,8 @@ def walk(self, astroid: nodes.NodeNG) -> None:
"""
cid = astroid.__class__.__name__.lower()

visit_events: Sequence[AstCallback] = self.visit_events.get(cid, ())
leave_events: Sequence[AstCallback] = self.leave_events.get(cid, ())
visit_events = self.visit_events[cid]
leave_events = self.leave_events[cid]

# pylint: disable = too-many-try-statements
try:
Expand Down

0 comments on commit b7eeccb

Please sign in to comment.