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

Use length of children returned from RenderTree.childiter #78

Merged
merged 1 commit into from Sep 22, 2019

Conversation

salkinium
Copy link
Contributor

@salkinium salkinium commented Feb 20, 2019

This is just a small fix, but it allows to use the childiter function to not just sort, but also filter nodes when rendering.
I need to "hide" some node types when rendering, and thus do this in childiter:

    def childiter(items):
        items = [i for i in items if i.type in lbuild.format.SHOW_NODES]
        return sorted(items, key=lambda item: (item.type, item.name))

However, this renders an additional node line without the node:

    ├── Module(modm:build)   Build System Generators
    │   ├── Module(modm:build:scons)   SCons Build Script Generator
    │   │   ╰── EnumerationOption(info.git) = Disabled in [Disabled, Info, Info+Status]
    ├── Module(modm:cmsis)   ARM CMSIS Support

After this fix:

    ├── Module(modm:build)   Build System Generators
    │   ╰── Module(modm:build:scons)   SCons Build Script Generator
    │       ╰── EnumerationOption(info.git) = Disabled in [Disabled, Info, Info+Status]
    ├── Module(modm:cmsis)   ARM CMSIS Support

cc @c0fec0de

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0002%) to 99.861% when pulling 71cfd0d on salkinium:fix/RenderTree.childiter into 775477e on c0fec0de:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage increased (+0.0002%) to 99.861% when pulling 71cfd0d on salkinium:fix/RenderTree.childiter into 775477e on c0fec0de:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0002%) to 99.861% when pulling 71cfd0d on salkinium:fix/RenderTree.childiter into 775477e on c0fec0de:master.

@salkinium
Copy link
Contributor Author

Ping @c0fec0de

@c0fec0de
Copy link
Owner

c0fec0de commented Jul 23, 2019 via email

@c0fec0de c0fec0de merged commit 8cbb051 into c0fec0de:master Sep 22, 2019
@salkinium salkinium deleted the fix/RenderTree.childiter branch September 22, 2019 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants