• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

PyCQA / pylint / 860 / 4
92%
main: 95%

Build:
Build:
LAST BUILD BRANCH: maintenance/2.15.x
DEFAULT BRANCH: main
Ran 02 Mar 2018 09:25AM UTC
Files 57
Run time 2s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

02 Mar 2018 09:13AM UTC coverage: 0.0%. Remained the same
TOXENV=py36

push

travis-ci

Claudiu Popa
Add type-specific nodes_of_class

nodes_of_class is a very flexible method, which is great for use in
client code (e.g. Pylint). However, that flexibility requires a great
deal of runtime type checking:

    def nodes_of_class(self, klass, skip_klass=None):
        if isinstance(self, klass):
            yield self

        if skip_klass is None:
            for child_node in self.get_children():
                for matching in child_node.nodes_of_class(klass, skip_klass):
                    yield matching

            return

        for child_node in self.get_children():
            if isinstance(child_node, skip_klass):
                continue
            for matching in child_node.nodes_of_class(klass, skip_klass):
                yield matching

First, the node has to check its own type to see whether it's of the
desired class. Then the skip_klass flag has to be checked to see
whether anything needs to be skipped. If so, the type of every yielded
node has to be check to see if it should be skipped.

This is fine for calling code whose arguments can't be known in
advance ("Give me all the Assign and ClassDef nodes, but skip all the
BinOps, YieldFroms, and Globals."), but in Astroid itself, every call
to this function can be known in advance. There's no need to do any
type checking if all the nodes know how to respond to certain
requests. Take get_assign_nodes for example. The Assign nodes know
that they should yield themselves and then yield their Assign
children. Other nodes know in advance that they aren't Assign nodes,
so they don't need to check their own type, just immediately yield
their Assign children.

Overly specific functions like get_yield_nodes_skip_lambdas certainly
aren't very elegant, but the tradeoff is to take advantage of knowing
how the library code works to improve speed.

0 of 7555 relevant lines covered (0.0%)

0.0 hits per line

Source Files on job 860.4 (TOXENV=py36)
  • Tree
  • List 0
  • Changed 39
  • Source Changed 2
  • Coverage Changed 39
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 1
  • Travis Job 860.4
  • 9b5aa979 on github
  • Prev Job for TOXENV=py37 on master (#859.5)
  • Next Job for TOXENV=py36 on master (#1833.3)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc