Skip to content

SIM105 : try: ... except: pass > contextlib.suppress() #1300

@ns-rse

Description

@ns-rse

Doing some work on AFMSlicer and was made warea of ruff SIM105 which also crops up in tests/test_entry_point() a couple of times.

The change is trivial...

Before

    try:
        entry_point(manually_provided_args=[argument, option])
    except SystemExit:
        pass

After

import contextlib

...

    with contextlib.suppress(SystemExit):
        entry_point(manually_provided_args=[option])

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions