Fix reference to undefined variable (issue #12), and fix some lint.

This commit is contained in:
Bryan Gardiner 2023-03-17 21:16:02 -07:00
parent f87f29530b
commit 1bf9d1740d
No known key found for this signature in database
GPG key ID: 53EFBCA063E6183C
2 changed files with 5 additions and 3 deletions

View file

@ -2,6 +2,9 @@
## 0.2.1 (unreleased)
- Fixed reference to undefined variable in `StorePath` constructor (issue #12),
plus some code lint.
## 0.2.0 (2022-10-15)
- Add display of the change in closure disk size (issue #8).

View file

@ -43,7 +43,6 @@ import os.path
import re
import subprocess
import sys
from collections import namedtuple
from pathlib import Path
from signal import SIGPIPE, SIG_DFL, signal
from subprocess import PIPE
@ -103,7 +102,7 @@ def raise_arg(e):
class StorePath:
def __init__(self, path: Union[str, Path]):
assert str(path).startswith("/nix/store/"), \
f"Doesn't start with /nix/store/: {str(resolved)!r}"
f"Doesn't start with /nix/store/: {str(path)!r}"
self._path = Path(path)
def __str__(self) -> str:
@ -348,7 +347,7 @@ def render_versions(version_list: List[str], *, colour: bool = False) -> str:
version_list.pop()
count += 1
if version == None:
if version is None:
version = "<none>"
elif colour: # (Don't apply colour to <none>.)
version = sgr(SGR_FG + SGR_YELLOW) + version + sgr(SGR_RESET)