Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Optimization: Remove redundant list call in check_file in Build/check_indents.py #602

@sayandipdutta

Description

@sayandipdutta

In the check_file function of Build/check_indents.py, it is performing a redundant list call, on f.readlines() which itself returns a list, in line 28:

def check_file(filename : str) -> bool:
    ...
    with open(filename, 'r') as f:
        contents = list(f.readlines())
    ...

This can have impact on performance, if the file is really large. This does not have any benefit over the plain f.readlines() either.

I propose the following change:

-        contents = list(f.readlines())
+        contents = f.readlines()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-BuildAffects CI pipelines and other build processesKind-MaintenanceRequest or suggestion for general code quality improvements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions