Skip to content

fix_division_safe doesn't support statements with more than 3 elements #354

Closed
@jmadler

Description

@jmadler

fix_division_safe has a test to see if the statement contains division, which assumes a statement length of 3. There are a few divisions in our codebase where that's not the case. Here's a few examples:

p75 = data[len(data) * 3 / 4]
random.randint(0, 1000) * 1.0 / 1000
output["SUCCESS"] * 100 / output["TOTAL"]
float(fraction.numer) / fraction.denom * 1e-9
mount.bytes_free * mount.free_size / bytes_in_gb
self.total_count() * threshold / 100

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