Skip to content

Improve exception handling and remove dead code in inputs.py #443

@Khushi281300

Description

@Khushi281300

Description

While reviewing the synthesis package to understand the backend architecture, I noticed a few minor code-quality improvements in backend/staticfiles/synthesis/lib/inputs.py that could help make the codebase cleaner and more robust according to PEP 8 standards.

Proposed Changes

1. Prevent Bare Exceptions:
In create_number_wire() (around line 18), there is a bare except: block.
Relying on bare exceptions is generally discouraged as it catches system-exiting exceptions (like KeyboardInterrupt or SystemExit) and can obscure bugs. Since the intention here seems to be catching missing file errors (similar to create_readonly_wire()), it should be narrowed down to except FileNotFoundError:.

2. Remove Dead Code/Comments:
The _init_enabled(self) function (around line 31) contains a comment explicitly stating:
# This function is redundant for now, its not being used anywhere.
For better maintainability, this dead function can be safely removed. Additionally, there are a few resolved TODO comments nearby (e.g., # TODO: Is this case necessary? # Yep case is definitely necessary...) which can be cleaned up into standard documentation comments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions