Skip to content

improve variable names based on mypy feedback

Hans Fangohr requested to merge improve-code-based-on-mypy-report into main

lib.py:

  • use 'unit_index' instead of unit to refer to the index into the units list
  • use 'number' instead of 'bytes' to compute the "1.2" in "1.2 GB". This way, we do not change the type or bytes (is int initially, then becomes float) and is clearer as once we read the while loop, 'bytes' does not represent 'bytes' anymore but just some number.

quota.py:

  • 'used' -> 'used_bytes' when referring to the bytes used

  • keep 'used' for the string to be printed in the end

  • same for 'avail' -> 'avail_bytes'

  • when passing a Path object (such as 'homedir' and 'scratchdir') to scratch_bytes_used_quota, convert it to a string (str(homedir)) as the scratch_bytes_used_quota expects a string. The conversion takes place automatically.

Merge request reports