Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cidrblock committed Sep 12, 2023
1 parent 6d57d19 commit 08e7803
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/pip4a/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import os

from typing import Union


class Ansi:
"""ANSI escape codes."""
Expand All @@ -21,16 +23,15 @@ class Ansi:
YELLOW = "\x1B[33m"


ScalarVal = bool | str | float | int | None
JSONVal = ScalarVal | list["JSONVal"] | dict[str, "JSONVal"]
ScalarVal = Union[bool, str, float, int, None]
JSONVal = Union[ScalarVal, list["JSONVal"], dict[str, "JSONVal"]]


class Tree: # pylint: disable=R0902
"""Renderer for the tree."""

PIPE = "│"
ELBOW = "└──"
UEBLOW = "┌──"
TEE = "├──"
PIPE_PREFIX = "│ "
SPACE_PREFIX = " "
Expand Down Expand Up @@ -58,7 +59,10 @@ def in_color(self: Tree, val: ScalarVal) -> str:
"""Colorize the string.
Args:
string: The string to colorize
val: The thing to colorize
Returns:
The colorized string
"""
if os.environ.get("NO_COLOR"):
return str(val)
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_tree.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# cspell:ignore mkey, mfour
"""Test the tree generator."""

from __future__ import annotations
Expand Down

0 comments on commit 08e7803

Please sign in to comment.