diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9f78898..f8076c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,19 +7,6 @@ on: - master jobs: - Linting: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.9 - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - name: Linting - run: | - pip install flake8 - flake8 --ignore=W,E203,F405 --max-line-length=88 cfonts tests Testing: runs-on: ${{ matrix.os }} strategy: @@ -34,7 +21,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Install dependencies - run: pdm install -d + run: pdm install - name: Run Tests run: | pdm run pytest tests diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..bcb5dcb --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,31 @@ +name: Release + +on: + push: + tags: + - "*" + +jobs: + release-pypi: + name: release-pypi + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.8 + architecture: "x64" + - name: Install build tool + run: | + pip install -U build + - name: Build artifacts + run: | + python -m build + - name: Test Build + run: | + pip install twine + twine check dist/* + - name: Upload to Pypi + run: | + twine upload --username __token__ --password ${{ secrets.PYPI_TOKEN }} dist/* diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..2e4f423 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,25 @@ +ci: + autoupdate_schedule: monthly +repos: + - repo: https://github.com/psf/black + rev: 21.6b0 + hooks: + - id: black + exclude: ^pdm/_vendor + + - repo: https://github.com/PyCQA/flake8 + rev: 3.9.2 + hooks: + - id: flake8 + + - repo: https://github.com/pycqa/isort + rev: 5.8.0 + hooks: + - id: isort + + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v0.812 + hooks: + - id: mypy + args: [cfonts] + pass_filenames: false diff --git a/cfonts/__init__.py b/cfonts/__init__.py index e7509df..fab4c3a 100644 --- a/cfonts/__init__.py +++ b/cfonts/__init__.py @@ -8,4 +8,4 @@ """ __all__ = ["say", "render"] -from .core import say, render +from .core import render, say diff --git a/cfonts/cli.py b/cfonts/cli.py index d397630..b746c2c 100644 --- a/cfonts/cli.py +++ b/cfonts/cli.py @@ -8,10 +8,11 @@ """ import argparse import sys +from typing import List, Optional -from .consts import * # noqa -from .core import say, render +from . import consts from .__version__ import __version__ +from .core import render, say class CFontsArgumentParser(argparse.ArgumentParser): @@ -26,7 +27,9 @@ def format_help(self) -> str: formatter.add_text(self.description) # usage - formatter.add_usage(self.usage, self._actions, self._mutually_exclusive_groups) + formatter.add_usage( + self.usage or "", self._actions, self._mutually_exclusive_groups + ) # positionals, optionals and user-defined groups for action_group in self._action_groups: @@ -42,7 +45,7 @@ def format_help(self) -> str: return formatter.format_help() -def parse_args(): +def parse_args() -> argparse.Namespace: parser = CFontsArgumentParser( "cfonts", description="This is a tool for sexy fonts in the console. " @@ -60,24 +63,28 @@ def parse_args(): parser.add_argument( "-f", "--font", - default=FONTFACES.block, - choices=FONTFACES.all(), + default=consts.FontFaces.block, + choices=consts.FontFaces, + type=consts.FontFaces, help="Use to define the font face", ) parser.add_argument( - "-c", "--colors", default=COLORS.system, help="Use to define the font color" + "-c", + "--colors", + default=consts.Colors.system.value, + help="Use to define the font color", ) parser.add_argument( "-b", "--background", - default=BGCOLORS.transparent, + default=consts.BgColors.transparent.value, help="Use to define the background color", ) parser.add_argument( "-a", "--align", default="left", - choices=ALIGNMENT, + choices=consts.ALIGNMENT, help="Use to align the text output", ) parser.add_argument( @@ -130,16 +137,16 @@ def parse_args(): return args -def main(): +def main() -> None: args = parse_args() colors = [c.strip() for c in args.colors.split(",")] if args.gradient: - gradient = [g.strip() for g in args.gradient.split(",")] + gradient: Optional[List[str]] = [g.strip() for g in args.gradient.split(",")] else: gradient = None options = { - "font": args.font, + "font": args.font.value, "colors": colors, "background": args.background, "align": args.align, diff --git a/cfonts/colors.py b/cfonts/colors.py index 5ec45dd..30ede93 100644 --- a/cfonts/colors.py +++ b/cfonts/colors.py @@ -1,105 +1,75 @@ """ Utility functions for handling terminal colors """ -from __future__ import division +import colorsys import os -from collections import namedtuple +from typing import Iterable, List, Mapping, NamedTuple, Tuple from .consts import ANSI_COLORS, ANSI_RGB -Style = namedtuple("Style", "open,close") +class Style(NamedTuple): + open: str + close: str -def hex_to_rgb(hex_string): + +_Rgb = Tuple[int, int, int] +_Hsv = Tuple[float, float, float] + + +def hex_to_rgb(hex_string: str) -> _Rgb: """Return a tuple of red, green and blue components for the color given as #rrggbb. """ assert len(hex_string) in (4, 7), "Hex color format is not correct." if len(hex_string) == 4: - return tuple(int(c * 2, 16) for c in hex_string[1:]) - return tuple(int(hex_string[i : i + 2], 16) for i in range(1, len(hex_string), 2)) + return tuple(int(c * 2, 16) for c in hex_string[1:]) # type: ignore + return tuple( + int(hex_string[i : i + 2], 16) for i in range(1, len(hex_string), 2) + ) # type: ignore -def rgb_to_hex(rgb): +def rgb_to_hex(rgb: _Rgb) -> str: return "#" + "".join("%02x" % c for c in rgb) -def rgb_to_hsv(rgb): - r, g, b = rgb - r /= 255 - g /= 255 - b /= 255 - - max_value = max(r, g, b) - min_value = min(r, g, b) - diff = max_value - min_value - - h, s, v = 0, diff / max_value if max_value > 0 else 0, max_value - - if max_value == min_value: - h = 0 - elif max_value == r: - h = 60 * (g - b) / diff - if g < b: - h += 360 - elif max_value == g: - h = 60 * (b - r) / diff + 120 - else: - h = 60 * (r - g) / diff + 240 - - return h, (s * 100), (v * 100) - - -def hsv_to_rgb(hsv): - h, s, v = hsv - h /= 60 - s /= 100 - v /= 100 - hi = int(h) % 6 +def rgb_to_hsv(rgb: _Rgb) -> _Hsv: + return colorsys.rgb_to_hsv(*rgb) - f = h - int(h) - p = 255 * v * (1 - s) - q = 255 * v * (1 - (s * f)) - t = 255 * v * (1 - (s * (1 - f))) - v *= 255 - result = { - 0: (v, t, p), - 1: (q, v, p), - 2: (p, v, t), - 3: (p, q, v), - 4: (t, p, v), - 5: (v, p, q), - }[hi] - return tuple(int(c) for c in result) +def hsv_to_rgb(hsv: _Hsv) -> _Rgb: + return tuple(int(c) for c in colorsys.hsv_to_rgb(*hsv)) # type: ignore -def _color_distance(left, right): +def _color_distance(left: _Hsv, right: _Hsv) -> float: return sum((i - j) ** 2 for i, j in zip(left, right)) -def _ensure_rgb(color): +def _ensure_rgb(color: str) -> _Rgb: if color in ANSI_RGB: return ANSI_RGB[color] return hex_to_rgb(color) -def get_closest(rgb, rgb_map=ANSI_RGB): +def get_closest(rgb: _Rgb, rgb_map: Mapping[str, _Rgb] = ANSI_RGB) -> str: """Return the closest ANSI color name from the given RGB.""" - color = min(rgb_map.items(), key=lambda x: _color_distance(rgb, x[1])) - return color[0] + return min(rgb_map, key=lambda name: _color_distance(rgb, rgb_map[name])) -def get_linear(start, end, steps): +def get_linear(start: float, end: float, steps: int) -> List[float]: """Get a list of numbers interpolated from start to end inclusively.""" step = (end - start) / (steps - 1) return [start + i * step for i in range(steps)] -def get_interpolated_hsv(start_hsv, end_hsv, steps, transition=False): +def get_interpolated_hsv( + start_hsv: _Hsv, end_hsv: _Hsv, steps: int, transition: bool = False +) -> Iterable[_Hsv]: """Get a sequence of HSV colors interpolated from start to end""" if transition: - return zip(*[get_linear(s, e, steps) for s, e in zip(start_hsv, end_hsv)]) + return zip( + *[get_linear(s, e, steps) for s, e in zip(start_hsv, end_hsv)] + ) # type: ignore s_sequence = get_linear(start_hsv[1], end_hsv[1], steps) v_sequence = get_linear(start_hsv[2], end_hsv[2], steps) start_h, end_h = start_hsv[0], end_hsv[0] @@ -119,7 +89,7 @@ class AnsiPen: CLOSE_BIT = "\x1b[39m" BG_CLOSE_BIT = "\x1b[49m" - def style(self, color, background=False): + def style(self, color: str, background: bool = False) -> Style: if color == "system": return Style("", "") if color in ANSI_COLORS: @@ -128,31 +98,33 @@ def style(self, color, background=False): return self.hex_style(color, background) raise ValueError("Unsupported color: {}".format(color)) - def ansi_style(self, color, background): + def ansi_style(self, color: str, background: bool) -> Style: offset = 10 if background else 0 close = self.BG_CLOSE_BIT if background else self.CLOSE_BIT code = ANSI_COLORS[color] return Style("\x1b[{}m".format(offset + code), close) - def hex_style(self, color, background): + def hex_style(self, color: str, background: bool) -> Style: return self.rgb_style(hex_to_rgb(color), background) - def rgb_style(self, color, background): + def rgb_style(self, color: _Rgb, background: bool) -> Style: ansi_color = get_closest(color) return self.ansi_style(ansi_color, background) - def get_gradient(self, colors, steps, transition=False): + def get_gradient( + self, colors: List[str], steps: int, transition: bool = False + ) -> List[Style]: if transition and len(colors) < 2: raise ValueError("Transition gradient needs at least two colors") elif not transition and len(colors) != 2: raise ValueError("Gradient needs exactly two colors") - colors = [_ensure_rgb(color) for color in colors] - color_steps = [(steps - 1) // (len(colors) - 1)] * (len(colors) - 1) + rgb_colors = [_ensure_rgb(color) for color in colors] + color_steps = [(steps - 1) // (len(rgb_colors) - 1)] * (len(rgb_colors) - 1) if sum(color_steps) < (steps - 1): color_steps[-1] += 1 assert sum(color_steps) == steps - 1 - result = [] - for start, end, st in zip(colors, colors[1:], color_steps): + result: List[Style] = [] + for start, end, st in zip(rgb_colors, rgb_colors[1:], color_steps): start_hsv, end_hsv = rgb_to_hsv(start), rgb_to_hsv(end) styles = [ hsv_to_rgb(hsv) @@ -168,11 +140,11 @@ def get_gradient(self, colors, steps, transition=False): class TrueColorPen(AnsiPen): - def rgb_style(self, color, background): + def rgb_style(self, color: _Rgb, background: bool) -> Style: open_bit = 48 if background else 38 close = self.BG_CLOSE_BIT if background else self.CLOSE_BIT r, g, b = color - return Style("\x01\x1b[{};2;{};{};{}m".format(open_bit, r, g, b), close) + return Style("\x1b[{};2;{};{};{}m".format(open_bit, r, g, b), close) if (os.getenv("DISABLE_TRUECOLOR") or os.name == "nt") and not os.getenv( diff --git a/cfonts/consts.py b/cfonts/consts.py index 33d84e7..8a80ae1 100644 --- a/cfonts/consts.py +++ b/cfonts/consts.py @@ -6,21 +6,15 @@ :license: GNU GPLv2 :author: Frost Ming """ +import enum from shutil import get_terminal_size +from typing import Mapping, Tuple -SIZE = tuple(get_terminal_size((80, 24))) +SIZE = get_terminal_size((80, 24)) CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789|!?.+-_=@#$%&()/:;,' \"" -class Enum: - @classmethod - def all(cls): - return [ - v for k, v in cls.__dict__.items() if not k.startswith("_") and k != "all" - ] - - -class COLORS(Enum): +class Colors(enum.Enum): system = "system" black = "black" red = "red" @@ -40,7 +34,7 @@ class COLORS(Enum): bright_white = "bright_white" -class CANDYCOLORS(Enum): +class CandyColors(enum.Enum): red = "red" green = "green" yellow = "yellow" @@ -56,7 +50,7 @@ class CANDYCOLORS(Enum): bright_cyan = "bright_cyan" -class BGCOLORS(Enum): +class BgColors(enum.Enum): transparent = "transparent" black = "black" red = "red" @@ -79,7 +73,7 @@ class BGCOLORS(Enum): ALIGNMENT = ["left", "center", "right"] -class FONTFACES(Enum): +class FontFaces(enum.Enum): console = "console" block = "block" simpleblock = "simpleBlock" @@ -114,7 +108,7 @@ class FONTFACES(Enum): "bright_white": 97, } -ANSI_RGB = { +ANSI_RGB: Mapping[str, Tuple[int, int, int]] = { "black": (0, 0, 0), "red": (127, 0, 0), "green": (0, 127, 0), diff --git a/cfonts/core.py b/cfonts/core.py index e7746df..ff991ed 100644 --- a/cfonts/core.py +++ b/cfonts/core.py @@ -11,28 +11,35 @@ import pkgutil import random import re +from typing import List, Mapping, Optional, Tuple import colorama -from .consts import ALIGNMENT, BGCOLORS, CANDYCOLORS, CHARS, COLORS, FONTFACES, SIZE from .colors import pen +from .consts import ALIGNMENT, CHARS, SIZE, BgColors, CandyColors, Colors, FontFaces colorama.init() class Font: - def __init__(self, name): + colors: int + lines: int + buffer: List[str] + letterspace: List[str] + chars: Mapping[str, List[str]] + + def __init__(self, name: str) -> None: self.name = name - if name == FONTFACES.console: + if name == FontFaces.console.value: self.colors = 1 self.lines = 1 return - font_face = json.loads( - pkgutil.get_data(__package__, "fonts/{}.json".format(name)).decode("utf-8") - ) + metadata = pkgutil.get_data(__package__, "fonts/{}.json".format(name)) + assert metadata + font_face = json.loads(metadata.decode("utf-8")) self.__dict__.update(font_face) - def add_letter_spacing(self, output, letter_spacing): + def add_letter_spacing(self, output: List[str], letter_spacing: int) -> List[str]: lines = len(output) - self.lines for i in range(lines, len(output)): idx = i - lines @@ -40,7 +47,7 @@ def add_letter_spacing(self, output, letter_spacing): output[i] += space * letter_spacing return output - def add_char(self, output, char): + def add_char(self, output: List[str], char: str) -> List[str]: lines = len(output) - self.lines for i in range(lines, len(output)): idx = i - lines @@ -48,7 +55,7 @@ def add_char(self, output, char): return output -def add_line(output, buffer, line_height): +def add_line(output: List[str], buffer: List[str], line_height: int) -> List[str]: """Add a new line to the output array. :param output: The output array the line shall be appended to @@ -65,7 +72,7 @@ def add_line(output, buffer, line_height): return output -def get_font(font): +def get_font(font: str) -> Font: """Get a selected JSON font-file object. :param font: The name of the font to be returned @@ -75,7 +82,7 @@ def get_font(font): return Font(font) -def clean_input(text, allowed_chars=CHARS): +def clean_input(text: str, allowed_chars: str = CHARS) -> str: """Filter only allowed characters. :param text: The input text to be filtered @@ -85,7 +92,7 @@ def clean_input(text, allowed_chars=CHARS): return "".join(c for c in text if c.upper() in allowed_chars) -def char_length(character, letter_spacing=0): +def char_length(character: List[str], letter_spacing: int = 0) -> int: """Return the max width of a character by looking at its longest line. :param character: The character array from the font face @@ -101,7 +108,13 @@ def char_length(character, letter_spacing=0): return char_width -def align_text(output, line_length, character_lines, align, size=SIZE): +def align_text( + output: List[str], + line_length: int, + character_lines: int, + align: str, + size: Tuple[int, int] = SIZE, +) -> List[str]: assert align in ALIGNMENT space = 0 if align == "center": @@ -115,15 +128,15 @@ def align_text(output, line_length, character_lines, align, size=SIZE): return output -def colorize(line, font_colors, colors): +def colorize(line: str, font_colors: int, colors: List[str]) -> str: if font_colors > 1: for i in range(font_colors): try: color = colors[i] except IndexError: - color = COLORS.system - if color == COLORS.candy: - color = random.choice(CANDYCOLORS.all()) + color = Colors.system.value + if color == Colors.candy.value: + color = random.choice(list(CandyColors)).value style = pen.style(color, False) line = re.sub("".format(i + 1), style.open, line) line = re.sub("".format(i + 1), style.close, line) @@ -131,18 +144,23 @@ def colorize(line, font_colors, colors): try: color = colors[0] except IndexError: - color = COLORS.system - if color == COLORS.candy: - color = random.choice(CANDYCOLORS.all()) + color = Colors.system.value + if color == Colors.candy.value: + color = random.choice(list(CandyColors)).value style = pen.style(color, False) line = style.open + re.sub(r"", "", line) + style.close return line def render_console( - text, size=SIZE, colors=[], align="left", letter_spacing=None, line_height=1 -): - output = [] + text: str, + size: Tuple[int, int] = SIZE, + colors: List[str] = [], + align: str = "left", + letter_spacing: Optional[int] = None, + line_height: int = 1, +) -> List[str]: + output: List[str] = [] i = 0 letter_spacing = max((letter_spacing or 1) - 1, 0) line_height = max(line_height - 1, 0) @@ -157,7 +175,7 @@ def render_console( if len(line) > size[0]: output_lines[i : i + 1] = line[: size[0]].strip(), line[size[0] :].strip() line = output_lines[i] - if len(colors) > 0 and colors[0] == COLORS.candy: + if len(colors) > 0 and colors[0] == Colors.candy.value: output.append("".join(colorize(c, 1, colors) for c in line)) else: output.append(line) @@ -170,20 +188,26 @@ def render_console( return output -def _find_left_most_non_space(line): +def _find_left_most_non_space(line: str) -> int: return min(i for i, c in enumerate(line) if c.strip() != "") -def _find_right_most_non_space(line): +def _find_right_most_non_space(line: str) -> int: return max(i for i, c in enumerate(line) if c.strip() != "") def paint_gradient( - output, gradient, independent_gradient, lines, font_lines, line_height, transition -): + output: List[str], + gradient: List[str], + independent_gradient: bool, + lines: int, + font_lines: int, + line_height: int, + transition: bool, +) -> List[str]: """Apply gradient colors to output""" if independent_gradient: - buffer = [] + buffer: List[str] = [] start = 0 for _ in range(lines): temp = output[start : start + font_lines] @@ -199,7 +223,7 @@ def paint_gradient( min_index = min(_find_left_most_non_space(line) for line in output if line.strip()) max_index = max(_find_right_most_non_space(line) for line in output if line.strip()) styles = pen.get_gradient(gradient, max_index - min_index + 1, transition) - new_output = [] + new_output: List[str] = [] for line in output: if not line.strip(): new_output.append(line) @@ -214,20 +238,20 @@ def paint_gradient( def render( - text, - font=FONTFACES.block, - size=SIZE, - colors=None, - background=BGCOLORS.transparent, - align="left", - letter_spacing=None, - line_height=1, - space=True, - max_length=0, - gradient=None, - independent_gradient=False, - transition=False, -): + text: str, + font: str = FontFaces.block.value, + size: Tuple[int, int] = SIZE, + colors: Optional[List[str]] = None, + background: str = BgColors.transparent.value, + align: str = "left", + letter_spacing: Optional[int] = None, + line_height: int = 1, + space: bool = True, + max_length: int = 0, + gradient: Optional[List[str]] = None, + independent_gradient: bool = False, + transition: bool = False, +) -> str: """Main function to get the colored output for a string. :param text: the string you want to render @@ -249,9 +273,9 @@ def render( colors = colors or [] if colors and colors[0] != "system" and gradient: raise argparse.ArgumentError( - "colors and gradient cannot be specified at the same time." + None, "colors and gradient cannot be specified at the same time." ) - if font == FONTFACES.console: + if font == FontFaces.console.value: # console fontface is pretty easy to process output = render_console( text, @@ -326,7 +350,7 @@ def render( if space: # Blank lines at the beginning and end output = [""] * 2 + output + [""] * 2 - if background != BGCOLORS.transparent: + if background != BgColors.transparent.value: # Fill whitespaces to the full width. # See https://github.com/frostming/python-cfonts/issues/3 output = [(line + " " * (size[0] - len(_strip_color(line)))) for line in output] @@ -337,7 +361,7 @@ def render( return "\n".join(output) -def say(text, **options): +def say(text: str, **options) -> None: """Render and write the output to stout. :param text: the string you want to render @@ -349,6 +373,6 @@ def say(text, **options): print(write) -def _strip_color(text): +def _strip_color(text: str) -> str: regex = re.compile(r"\x1b\[\d+?m") return regex.sub("", text) diff --git a/cfonts/py.typed b/cfonts/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/docs/conf.py b/docs/conf.py index 3e04c65..4bd4697 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -23,14 +23,14 @@ # -- Project information ----------------------------------------------------- -project = 'python-cfonts' -copyright = '2018, Frost Ming' -author = 'Frost Ming' +project = "python-cfonts" +copyright = "2018, Frost Ming" +author = "Frost Ming" # The short X.Y version -version = about['__version__'] +version = about["__version__"] # The full version, including alpha/beta/rc tags -release = about['__version__'] +release = about["__version__"] # -- General configuration --------------------------------------------------- @@ -47,16 +47,16 @@ ] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # # source_suffix = ['.rst', '.md'] -source_suffix = '.rst' +source_suffix = ".rst" # The master toctree document. -master_doc = 'index' +master_doc = "index" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -68,10 +68,10 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path . -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # -- Options for HTML output ------------------------------------------------- @@ -79,7 +79,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'alabaster' +html_theme = "alabaster" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -90,7 +90,7 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ["_static"] # Custom sidebar templates, must be a dictionary that maps document names # to template names. @@ -101,15 +101,14 @@ # 'searchbox.html']``. # html_sidebars = { - "*": ['sidebarintro.html', 'localtoc.html', 'relations.html', - 'sourcelink.html'] + "*": ["sidebarintro.html", "localtoc.html", "relations.html", "sourcelink.html"] } # -- Options for HTMLHelp output --------------------------------------------- # Output file base name for HTML help builder. -htmlhelp_basename = 'python-cfontsdoc' +htmlhelp_basename = "python-cfontsdoc" # -- Options for LaTeX output ------------------------------------------------ @@ -118,15 +117,12 @@ # The paper size ('letterpaper' or 'a4paper'). # # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). # # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. # # 'preamble': '', - # Latex figure (float) alignment # # 'figure_align': 'htbp', @@ -136,8 +132,13 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'python-cfonts.tex', 'python-cfonts Documentation', - 'Frost Ming', 'manual'), + ( + master_doc, + "python-cfonts.tex", + "python-cfonts Documentation", + "Frost Ming", + "manual", + ), ] @@ -145,10 +146,7 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [ - (master_doc, 'python-cfonts', 'python-cfonts Documentation', - [author], 1) -] +man_pages = [(master_doc, "python-cfonts", "python-cfonts Documentation", [author], 1)] # -- Options for Texinfo output ---------------------------------------------- @@ -157,7 +155,13 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'python-cfonts', 'python-cfonts Documentation', - author, 'python-cfonts', 'One line description of project.', - 'Miscellaneous'), + ( + master_doc, + "python-cfonts", + "python-cfonts Documentation", + author, + "python-cfonts", + "One line description of project.", + "Miscellaneous", + ), ] diff --git a/pdm.lock b/pdm.lock index 32d8658..f2297be 100644 --- a/pdm.lock +++ b/pdm.lock @@ -1,26 +1,24 @@ [[package]] name = "alabaster" -sections = ["dev"] version = "0.7.12" summary = "A configurable sidebar-enabled Sphinx theme" [[package]] name = "atomicwrites" -sections = ["dev"] version = "1.4.0" -marker = "sys_platform == 'win32'" +requires_python = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*" summary = "Atomic file writes." [[package]] name = "attrs" -sections = ["dev"] version = "21.2.0" +requires_python = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*" summary = "Classes Without Boilerplate" [[package]] name = "babel" -sections = ["dev"] version = "2.9.1" +requires_python = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*" summary = "Internationalization utilities" dependencies = [ "pytz>=2015.7", @@ -28,94 +26,90 @@ dependencies = [ [[package]] name = "certifi" -sections = ["dev"] -version = "2020.12.5" +version = "2021.5.30" summary = "Python package for providing Mozilla's CA Bundle." [[package]] name = "chardet" -sections = ["dev"] version = "4.0.0" +requires_python = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*" summary = "Universal encoding detector for Python 2 and 3" [[package]] name = "colorama" -sections = ["default", "dev"] version = "0.4.4" +requires_python = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*" summary = "Cross-platform colored terminal text." [[package]] name = "docutils" -sections = ["dev"] version = "0.17.1" +requires_python = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*" summary = "Docutils -- Python Documentation Utilities" [[package]] name = "flake8" -sections = ["dev"] version = "3.9.2" +requires_python = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*" summary = "the modular source code checker: pep8 pyflakes and co" dependencies = [ - "pyflakes<2.4.0,>=2.3.0", - "pycodestyle<2.8.0,>=2.7.0", - "mccabe<0.7.0,>=0.6.0", "importlib-metadata; python_version < \"3.8\"", + "mccabe<0.7.0,>=0.6.0", + "pycodestyle<2.8.0,>=2.7.0", + "pyflakes<2.4.0,>=2.3.0", ] [[package]] name = "idna" -sections = ["dev"] version = "2.10" +requires_python = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*" summary = "Internationalized Domain Names in Applications (IDNA)" [[package]] name = "imagesize" -sections = ["dev"] version = "1.2.0" +requires_python = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*" summary = "Getting image size from png/jpeg/jpeg2000/gif file" [[package]] name = "importlib-metadata" -sections = ["dev"] -version = "4.0.1" -marker = "python_version < '3.8'" +version = "4.5.0" +requires_python = ">=3.6" summary = "Read metadata from Python packages" dependencies = [ - "zipp>=0.5", "typing-extensions>=3.6.4; python_version < \"3.8\"", + "zipp>=0.5", ] [[package]] name = "iniconfig" -sections = ["dev"] version = "1.1.1" summary = "iniconfig: brain-dead simple config-ini parsing" [[package]] name = "Jinja2" -sections = ["dev"] -version = "2.11.3" +version = "3.0.1" +requires_python = ">=3.6" summary = "A very fast and expressive template engine." dependencies = [ - "MarkupSafe>=0.23", + "MarkupSafe>=2.0", ] [[package]] name = "MarkupSafe" -sections = ["dev"] -version = "1.1.1" +version = "2.0.1" +requires_python = ">=3.6" summary = "Safely add untrusted strings to HTML/XML markup." [[package]] name = "mccabe" -sections = ["dev"] version = "0.6.1" summary = "McCabe checker, plugin for flake8" [[package]] name = "packaging" -sections = ["dev"] version = "20.9" +requires_python = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*" summary = "Core utilities for Python packages" dependencies = [ "pyparsing>=2.0.2", @@ -123,8 +117,8 @@ dependencies = [ [[package]] name = "pluggy" -sections = ["dev"] version = "0.13.1" +requires_python = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*" summary = "plugin and hook calling mechanisms for python" dependencies = [ "importlib-metadata>=0.12; python_version < \"3.8\"", @@ -132,171 +126,165 @@ dependencies = [ [[package]] name = "py" -sections = ["dev"] version = "1.10.0" +requires_python = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*" summary = "library with cross-python path, ini-parsing, io, code, log facilities" [[package]] name = "pycodestyle" -sections = ["dev"] version = "2.7.0" +requires_python = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*" summary = "Python style guide checker" [[package]] name = "pyflakes" -sections = ["dev"] version = "2.3.1" +requires_python = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*" summary = "passive checker of Python programs" [[package]] name = "Pygments" -sections = ["dev"] version = "2.9.0" +requires_python = ">=3.5" summary = "Pygments is a syntax highlighting package written in Python." [[package]] name = "pyparsing" -sections = ["dev"] version = "2.4.7" +requires_python = ">=2.6,!=3.0.*,!=3.1.*,!=3.2.*" summary = "Python parsing module" [[package]] name = "pytest" -sections = ["dev"] version = "6.2.4" +requires_python = ">=3.6" summary = "pytest: simple powerful testing with Python" dependencies = [ + "atomicwrites>=1.0; sys_platform == \"win32\"", "attrs>=19.2.0", + "colorama; sys_platform == \"win32\"", + "importlib-metadata>=0.12; python_version < \"3.8\"", "iniconfig", "packaging", "pluggy<1.0.0a1,>=0.12", "py>=1.8.2", "toml", - "importlib-metadata>=0.12; python_version < \"3.8\"", - "atomicwrites>=1.0; sys_platform == \"win32\"", - "colorama; sys_platform == \"win32\"", ] [[package]] name = "pytz" -sections = ["dev"] version = "2021.1" summary = "World timezone definitions, modern and historical" [[package]] name = "requests" -sections = ["dev"] version = "2.25.1" +requires_python = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*" summary = "Python HTTP for Humans." dependencies = [ + "certifi>=2017.4.17", "chardet<5,>=3.0.2", "idna<3,>=2.5", "urllib3<1.27,>=1.21.1", - "certifi>=2017.4.17", ] [[package]] name = "setuptools" -sections = ["dev"] -version = "56.2.0" +version = "57.0.0" +requires_python = ">=3.6" summary = "Easily download, build, install, upgrade, and uninstall Python packages" [[package]] name = "snowballstemmer" -sections = ["dev"] version = "2.1.0" summary = "This package provides 29 stemmers for 28 languages generated from Snowball algorithms." [[package]] name = "sphinx" -sections = ["dev"] -version = "4.0.1" +version = "4.0.2" +requires_python = ">=3.6" summary = "Python documentation generator" dependencies = [ - "sphinxcontrib-applehelp", - "sphinxcontrib-devhelp", - "sphinxcontrib-jsmath", - "sphinxcontrib-htmlhelp", - "sphinxcontrib-serializinghtml", - "sphinxcontrib-qthelp", - "Jinja2<3.0,>=2.3", - "MarkupSafe<2.0", + "Jinja2>=2.3", "Pygments>=2.0", - "docutils<0.18,>=0.14", - "snowballstemmer>=1.1", - "babel>=1.3", "alabaster<0.8,>=0.7", + "babel>=1.3", + "colorama>=0.3.5; sys_platform == \"win32\"", + "docutils<0.18,>=0.14", "imagesize", + "packaging", "requests>=2.5.0", "setuptools", - "packaging", - "colorama>=0.3.5; sys_platform == \"win32\"", + "snowballstemmer>=1.1", + "sphinxcontrib-applehelp", + "sphinxcontrib-devhelp", + "sphinxcontrib-htmlhelp", + "sphinxcontrib-jsmath", + "sphinxcontrib-qthelp", + "sphinxcontrib-serializinghtml", ] [[package]] name = "sphinxcontrib-applehelp" -sections = ["dev"] version = "1.0.2" +requires_python = ">=3.5" summary = "sphinxcontrib-applehelp is a sphinx extension which outputs Apple help books" [[package]] name = "sphinxcontrib-devhelp" -sections = ["dev"] version = "1.0.2" +requires_python = ">=3.5" summary = "sphinxcontrib-devhelp is a sphinx extension which outputs Devhelp document." [[package]] name = "sphinxcontrib-htmlhelp" -sections = ["dev"] -version = "1.0.3" +version = "2.0.0" +requires_python = ">=3.6" summary = "sphinxcontrib-htmlhelp is a sphinx extension which renders HTML help files" [[package]] name = "sphinxcontrib-jsmath" -sections = ["dev"] version = "1.0.1" +requires_python = ">=3.5" summary = "A sphinx extension which renders display math in HTML via JavaScript" [[package]] name = "sphinxcontrib-qthelp" -sections = ["dev"] version = "1.0.3" +requires_python = ">=3.5" summary = "sphinxcontrib-qthelp is a sphinx extension which outputs QtHelp document." [[package]] name = "sphinxcontrib-serializinghtml" -sections = ["dev"] -version = "1.1.4" +version = "1.1.5" +requires_python = ">=3.5" summary = "sphinxcontrib-serializinghtml is a sphinx extension which outputs \"serialized\" HTML files (json and pickle)." [[package]] name = "toml" -sections = ["dev"] version = "0.10.2" +requires_python = ">=2.6,!=3.0.*,!=3.1.*,!=3.2.*" summary = "Python Library for Tom's Obvious, Minimal Language" [[package]] name = "typing-extensions" -sections = ["dev"] version = "3.10.0.0" -marker = "python_version < '3.8'" summary = "Backported and Experimental Type Hints for Python 3.5+" [[package]] name = "urllib3" -sections = ["dev"] -version = "1.26.4" +version = "1.26.5" +requires_python = ">=2.7,<4.0,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*" summary = "HTTP library with thread-safe connection pooling, file post, and more." [[package]] name = "zipp" -sections = ["dev"] version = "3.4.1" -marker = "python_version < '3.8'" +requires_python = ">=3.6" summary = "Backport of pathlib-compatible object wrapper for zip files" [metadata] -lock_version = "2" +lock_version = "3" content_hash = "sha256:6d9bde62ab30bf5c4d2ff76bafc37388aed09b82efd98d94525545b749c6e0b0" [metadata.files] @@ -316,9 +304,9 @@ content_hash = "sha256:6d9bde62ab30bf5c4d2ff76bafc37388aed09b82efd98d94525545b74 {file = "Babel-2.9.1-py2.py3-none-any.whl", hash = "sha256:ab49e12b91d937cd11f0b67cb259a57ab4ad2b59ac7a3b41d6c06c0ac5b0def9"}, {file = "Babel-2.9.1.tar.gz", hash = "sha256:bc0c176f9f6a994582230df350aa6e05ba2ebe4b3ac317eab29d9be5d2768da0"}, ] -"certifi 2020.12.5" = [ - {file = "certifi-2020.12.5-py2.py3-none-any.whl", hash = "sha256:719a74fb9e33b9bd44cc7f3a8d94bc35e4049deebe19ba7d8e108280cfd59830"}, - {file = "certifi-2020.12.5.tar.gz", hash = "sha256:1a4995114262bffbc2413b159f2a1a480c969de6e6eb13ee966d470af86af59c"}, +"certifi 2021.5.30" = [ + {file = "certifi-2021.5.30-py2.py3-none-any.whl", hash = "sha256:50b1e4f8446b06f41be7dd6338db18e0990601dce795c2b1686458aa7e8fa7d8"}, + {file = "certifi-2021.5.30.tar.gz", hash = "sha256:2bbf76fd432960138b3ef6dda3dde0544f27cbf8546c458e60baf371917ba9ee"}, ] "chardet 4.0.0" = [ {file = "chardet-4.0.0-py2.py3-none-any.whl", hash = "sha256:f864054d66fd9118f2e67044ac8981a54775ec5b67aed0441892edb553d21da5"}, @@ -344,71 +332,53 @@ content_hash = "sha256:6d9bde62ab30bf5c4d2ff76bafc37388aed09b82efd98d94525545b74 {file = "imagesize-1.2.0-py2.py3-none-any.whl", hash = "sha256:6965f19a6a2039c7d48bca7dba2473069ff854c36ae6f19d2cde309d998228a1"}, {file = "imagesize-1.2.0.tar.gz", hash = "sha256:b1f6b5a4eab1f73479a50fb79fcf729514a900c341d8503d62a62dbc4127a2b1"}, ] -"importlib-metadata 4.0.1" = [ - {file = "importlib_metadata-4.0.1-py3-none-any.whl", hash = "sha256:d7eb1dea6d6a6086f8be21784cc9e3bcfa55872b52309bc5fad53a8ea444465d"}, - {file = "importlib_metadata-4.0.1.tar.gz", hash = "sha256:8c501196e49fb9df5df43833bdb1e4328f64847763ec8a50703148b73784d581"}, +"importlib-metadata 4.5.0" = [ + {file = "importlib_metadata-4.5.0-py3-none-any.whl", hash = "sha256:833b26fb89d5de469b24a390e9df088d4e52e4ba33b01dc5e0e4f41b81a16c00"}, + {file = "importlib_metadata-4.5.0.tar.gz", hash = "sha256:b142cc1dd1342f31ff04bb7d022492b09920cb64fed867cd3ea6f80fe3ebd139"}, ] "iniconfig 1.1.1" = [ {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, ] -"jinja2 2.11.3" = [ - {file = "Jinja2-2.11.3-py2.py3-none-any.whl", hash = "sha256:03e47ad063331dd6a3f04a43eddca8a966a26ba0c5b7207a9a9e4e08f1b29419"}, - {file = "Jinja2-2.11.3.tar.gz", hash = "sha256:a6d58433de0ae800347cab1fa3043cebbabe8baa9d29e668f1c768cb87a333c6"}, -] -"markupsafe 1.1.1" = [ - {file = "MarkupSafe-1.1.1-cp27-cp27m-macosx_10_6_intel.whl", hash = "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161"}, - {file = "MarkupSafe-1.1.1-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7"}, - {file = "MarkupSafe-1.1.1-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183"}, - {file = "MarkupSafe-1.1.1-cp27-cp27m-win32.whl", hash = "sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b"}, - {file = "MarkupSafe-1.1.1-cp27-cp27m-win_amd64.whl", hash = "sha256:98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e"}, - {file = "MarkupSafe-1.1.1-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f"}, - {file = "MarkupSafe-1.1.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1"}, - {file = "MarkupSafe-1.1.1-cp34-cp34m-macosx_10_6_intel.whl", hash = "sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5"}, - {file = "MarkupSafe-1.1.1-cp34-cp34m-manylinux1_i686.whl", hash = "sha256:62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1"}, - {file = "MarkupSafe-1.1.1-cp34-cp34m-manylinux1_x86_64.whl", hash = "sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735"}, - {file = "MarkupSafe-1.1.1-cp34-cp34m-win32.whl", hash = "sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21"}, - {file = "MarkupSafe-1.1.1-cp34-cp34m-win_amd64.whl", hash = "sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235"}, - {file = "MarkupSafe-1.1.1-cp35-cp35m-macosx_10_6_intel.whl", hash = "sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b"}, - {file = "MarkupSafe-1.1.1-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f"}, - {file = "MarkupSafe-1.1.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905"}, - {file = "MarkupSafe-1.1.1-cp35-cp35m-win32.whl", hash = "sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1"}, - {file = "MarkupSafe-1.1.1-cp35-cp35m-win_amd64.whl", hash = "sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d"}, - {file = "MarkupSafe-1.1.1-cp36-cp36m-macosx_10_6_intel.whl", hash = "sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff"}, - {file = "MarkupSafe-1.1.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:d53bc011414228441014aa71dbec320c66468c1030aae3a6e29778a3382d96e5"}, - {file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473"}, - {file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e"}, - {file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:3b8a6499709d29c2e2399569d96719a1b21dcd94410a586a18526b143ec8470f"}, - {file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:84dee80c15f1b560d55bcfe6d47b27d070b4681c699c572af2e3c7cc90a3b8e0"}, - {file = "MarkupSafe-1.1.1-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:b1dba4527182c95a0db8b6060cc98ac49b9e2f5e64320e2b56e47cb2831978c7"}, - {file = "MarkupSafe-1.1.1-cp36-cp36m-win32.whl", hash = "sha256:535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66"}, - {file = "MarkupSafe-1.1.1-cp36-cp36m-win_amd64.whl", hash = "sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5"}, - {file = "MarkupSafe-1.1.1-cp37-cp37m-macosx_10_6_intel.whl", hash = "sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d"}, - {file = "MarkupSafe-1.1.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:bf5aa3cbcfdf57fa2ee9cd1822c862ef23037f5c832ad09cfea57fa846dec193"}, - {file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e"}, - {file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6"}, - {file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:6fffc775d90dcc9aed1b89219549b329a9250d918fd0b8fa8d93d154918422e1"}, - {file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:a6a744282b7718a2a62d2ed9d993cad6f5f585605ad352c11de459f4108df0a1"}, - {file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:195d7d2c4fbb0ee8139a6cf67194f3973a6b3042d742ebe0a9ed36d8b6f0c07f"}, - {file = "MarkupSafe-1.1.1-cp37-cp37m-win32.whl", hash = "sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2"}, - {file = "MarkupSafe-1.1.1-cp37-cp37m-win_amd64.whl", hash = "sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c"}, - {file = "MarkupSafe-1.1.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6788b695d50a51edb699cb55e35487e430fa21f1ed838122d722e0ff0ac5ba15"}, - {file = "MarkupSafe-1.1.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:cdb132fc825c38e1aeec2c8aa9338310d29d337bebbd7baa06889d09a60a1fa2"}, - {file = "MarkupSafe-1.1.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:13d3144e1e340870b25e7b10b98d779608c02016d5184cfb9927a9f10c689f42"}, - {file = "MarkupSafe-1.1.1-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:acf08ac40292838b3cbbb06cfe9b2cb9ec78fce8baca31ddb87aaac2e2dc3bc2"}, - {file = "MarkupSafe-1.1.1-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:d9be0ba6c527163cbed5e0857c451fcd092ce83947944d6c14bc95441203f032"}, - {file = "MarkupSafe-1.1.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:caabedc8323f1e93231b52fc32bdcde6db817623d33e100708d9a68e1f53b26b"}, - {file = "MarkupSafe-1.1.1-cp38-cp38-win32.whl", hash = "sha256:596510de112c685489095da617b5bcbbac7dd6384aeebeda4df6025d0256a81b"}, - {file = "MarkupSafe-1.1.1-cp38-cp38-win_amd64.whl", hash = "sha256:e8313f01ba26fbbe36c7be1966a7b7424942f670f38e666995b88d012765b9be"}, - {file = "MarkupSafe-1.1.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:d73a845f227b0bfe8a7455ee623525ee656a9e2e749e4742706d80a6065d5e2c"}, - {file = "MarkupSafe-1.1.1-cp39-cp39-manylinux1_i686.whl", hash = "sha256:98bae9582248d6cf62321dcb52aaf5d9adf0bad3b40582925ef7c7f0ed85fceb"}, - {file = "MarkupSafe-1.1.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:2beec1e0de6924ea551859edb9e7679da6e4870d32cb766240ce17e0a0ba2014"}, - {file = "MarkupSafe-1.1.1-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:7fed13866cf14bba33e7176717346713881f56d9d2bcebab207f7a036f41b850"}, - {file = "MarkupSafe-1.1.1-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:6f1e273a344928347c1290119b493a1f0303c52f5a5eae5f16d74f48c15d4a85"}, - {file = "MarkupSafe-1.1.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:feb7b34d6325451ef96bc0e36e1a6c0c1c64bc1fbec4b854f4529e51887b1621"}, - {file = "MarkupSafe-1.1.1-cp39-cp39-win32.whl", hash = "sha256:22c178a091fc6630d0d045bdb5992d2dfe14e3259760e713c490da5323866c39"}, - {file = "MarkupSafe-1.1.1-cp39-cp39-win_amd64.whl", hash = "sha256:b7d644ddb4dbd407d31ffb699f1d140bc35478da613b441c582aeb7c43838dd8"}, - {file = "MarkupSafe-1.1.1.tar.gz", hash = "sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b"}, +"jinja2 3.0.1" = [ + {file = "Jinja2-3.0.1-py3-none-any.whl", hash = "sha256:1f06f2da51e7b56b8f238affdd6b4e2c61e39598a378cc49345bc1bd42a978a4"}, + {file = "Jinja2-3.0.1.tar.gz", hash = "sha256:703f484b47a6af502e743c9122595cc812b0271f661722403114f71a79d0f5a4"}, +] +"markupsafe 2.0.1" = [ + {file = "MarkupSafe-2.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:f9081981fe268bd86831e5c75f7de206ef275defcb82bc70740ae6dc507aee51"}, + {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:0955295dd5eec6cb6cc2fe1698f4c6d84af2e92de33fbcac4111913cd100a6ff"}, + {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:0446679737af14f45767963a1a9ef7620189912317d095f2d9ffa183a4d25d2b"}, + {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:f826e31d18b516f653fe296d967d700fddad5901ae07c622bb3705955e1faa94"}, + {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:fa130dd50c57d53368c9d59395cb5526eda596d3ffe36666cd81a44d56e48872"}, + {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:905fec760bd2fa1388bb5b489ee8ee5f7291d692638ea5f67982d968366bef9f"}, + {file = "MarkupSafe-2.0.1-cp36-cp36m-win32.whl", hash = "sha256:6c4ca60fa24e85fe25b912b01e62cb969d69a23a5d5867682dd3e80b5b02581d"}, + {file = "MarkupSafe-2.0.1-cp36-cp36m-win_amd64.whl", hash = "sha256:b2f4bf27480f5e5e8ce285a8c8fd176c0b03e93dcc6646477d4630e83440c6a9"}, + {file = "MarkupSafe-2.0.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:0717a7390a68be14b8c793ba258e075c6f4ca819f15edfc2a3a027c823718567"}, + {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:6557b31b5e2c9ddf0de32a691f2312a32f77cd7681d8af66c2692efdbef84c18"}, + {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:49e3ceeabbfb9d66c3aef5af3a60cc43b85c33df25ce03d0031a608b0a8b2e3f"}, + {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:d7f9850398e85aba693bb640262d3611788b1f29a79f0c93c565694658f4071f"}, + {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:6a7fae0dd14cf60ad5ff42baa2e95727c3d81ded453457771d02b7d2b3f9c0c2"}, + {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:b7f2d075102dc8c794cbde1947378051c4e5180d52d276987b8d28a3bd58c17d"}, + {file = "MarkupSafe-2.0.1-cp37-cp37m-win32.whl", hash = "sha256:a30e67a65b53ea0a5e62fe23682cfe22712e01f453b95233b25502f7c61cb415"}, + {file = "MarkupSafe-2.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:611d1ad9a4288cf3e3c16014564df047fe08410e628f89805e475368bd304914"}, + {file = "MarkupSafe-2.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:be98f628055368795d818ebf93da628541e10b75b41c559fdf36d104c5787066"}, + {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:1d609f577dc6e1aa17d746f8bd3c31aa4d258f4070d61b2aa5c4166c1539de35"}, + {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:7d91275b0245b1da4d4cfa07e0faedd5b0812efc15b702576d103293e252af1b"}, + {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:01a9b8ea66f1658938f65b93a85ebe8bc016e6769611be228d797c9d998dd298"}, + {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:47ab1e7b91c098ab893b828deafa1203de86d0bc6ab587b160f78fe6c4011f75"}, + {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:97383d78eb34da7e1fa37dd273c20ad4320929af65d156e35a5e2d89566d9dfb"}, + {file = "MarkupSafe-2.0.1-cp38-cp38-win32.whl", hash = "sha256:023cb26ec21ece8dc3907c0e8320058b2e0cb3c55cf9564da612bc325bed5e64"}, + {file = "MarkupSafe-2.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:984d76483eb32f1bcb536dc27e4ad56bba4baa70be32fa87152832cdd9db0833"}, + {file = "MarkupSafe-2.0.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:2ef54abee730b502252bcdf31b10dacb0a416229b72c18b19e24a4509f273d26"}, + {file = "MarkupSafe-2.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3c112550557578c26af18a1ccc9e090bfe03832ae994343cfdacd287db6a6ae7"}, + {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux1_i686.whl", hash = "sha256:53edb4da6925ad13c07b6d26c2a852bd81e364f95301c66e930ab2aef5b5ddd8"}, + {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:f5653a225f31e113b152e56f154ccbe59eeb1c7487b39b9d9f9cdb58e6c79dc5"}, + {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:4efca8f86c54b22348a5467704e3fec767b2db12fc39c6d963168ab1d3fc9135"}, + {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:ab3ef638ace319fa26553db0624c4699e31a28bb2a835c5faca8f8acf6a5a902"}, + {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:f8ba0e8349a38d3001fae7eadded3f6606f0da5d748ee53cc1dab1d6527b9509"}, + {file = "MarkupSafe-2.0.1-cp39-cp39-win32.whl", hash = "sha256:10f82115e21dc0dfec9ab5c0223652f7197feb168c940f3ef61563fc2d6beb74"}, + {file = "MarkupSafe-2.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:693ce3f9e70a6cf7d2fb9e6c9d8b204b6b39897a2c4a1aa65728d5ac97dcc1d8"}, + {file = "MarkupSafe-2.0.1.tar.gz", hash = "sha256:594c67807fb16238b30c44bdf74f36c02cdf22d1c8cda91ef8a0ed8dabf5620a"}, ] "mccabe 0.6.1" = [ {file = "mccabe-0.6.1-py2.py3-none-any.whl", hash = "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"}, @@ -454,17 +424,17 @@ content_hash = "sha256:6d9bde62ab30bf5c4d2ff76bafc37388aed09b82efd98d94525545b74 {file = "requests-2.25.1-py2.py3-none-any.whl", hash = "sha256:c210084e36a42ae6b9219e00e48287def368a26d03a048ddad7bfee44f75871e"}, {file = "requests-2.25.1.tar.gz", hash = "sha256:27973dd4a904a4f13b263a19c866c13b92a39ed1c964655f025f3f8d3d75b804"}, ] -"setuptools 56.2.0" = [ - {file = "setuptools-56.2.0-py3-none-any.whl", hash = "sha256:bc30153eec47d82f20c6f5e1a13d4ee725c6deb7013a67557f89bfe5d25235c4"}, - {file = "setuptools-56.2.0.tar.gz", hash = "sha256:7bb5652625e94e73b9358b7ed8c6431b732e80cf31f4e0972294c64f0e5b849e"}, +"setuptools 57.0.0" = [ + {file = "setuptools-57.0.0-py3-none-any.whl", hash = "sha256:c8b9f1a457949002e358fea7d3f2a1e1b94ddc0354b2e40afc066bf95d21bf7b"}, + {file = "setuptools-57.0.0.tar.gz", hash = "sha256:401cbf33a7bf817d08014d51560fc003b895c4cdc1a5b521ad2969e928a07535"}, ] "snowballstemmer 2.1.0" = [ {file = "snowballstemmer-2.1.0-py2.py3-none-any.whl", hash = "sha256:b51b447bea85f9968c13b650126a888aabd4cb4463fca868ec596826325dedc2"}, {file = "snowballstemmer-2.1.0.tar.gz", hash = "sha256:e997baa4f2e9139951b6f4c631bad912dfd3c792467e2f03d7239464af90e914"}, ] -"sphinx 4.0.1" = [ - {file = "Sphinx-4.0.1-py3-none-any.whl", hash = "sha256:b2566f5f339737a6ef37198c47d56de1f4a746c722bebdb2fe045c34bfd8b9d0"}, - {file = "Sphinx-4.0.1.tar.gz", hash = "sha256:cf5104777571b2b7f06fa88ee08fade24563f4a0594cf4bd17d31c47b8740b4c"}, +"sphinx 4.0.2" = [ + {file = "Sphinx-4.0.2-py3-none-any.whl", hash = "sha256:d1cb10bee9c4231f1700ec2e24a91be3f3a3aba066ea4ca9f3bbe47e59d5a1d4"}, + {file = "Sphinx-4.0.2.tar.gz", hash = "sha256:b5c2ae4120bf00c799ba9b3699bc895816d272d120080fbc967292f29b52b48c"}, ] "sphinxcontrib-applehelp 1.0.2" = [ {file = "sphinxcontrib_applehelp-1.0.2-py2.py3-none-any.whl", hash = "sha256:806111e5e962be97c29ec4c1e7fe277bfd19e9652fb1a4392105b43e01af885a"}, @@ -474,9 +444,9 @@ content_hash = "sha256:6d9bde62ab30bf5c4d2ff76bafc37388aed09b82efd98d94525545b74 {file = "sphinxcontrib_devhelp-1.0.2-py2.py3-none-any.whl", hash = "sha256:8165223f9a335cc1af7ffe1ed31d2871f325254c0423bc0c4c7cd1c1e4734a2e"}, {file = "sphinxcontrib-devhelp-1.0.2.tar.gz", hash = "sha256:ff7f1afa7b9642e7060379360a67e9c41e8f3121f2ce9164266f61b9f4b338e4"}, ] -"sphinxcontrib-htmlhelp 1.0.3" = [ - {file = "sphinxcontrib_htmlhelp-1.0.3-py2.py3-none-any.whl", hash = "sha256:3c0bc24a2c41e340ac37c85ced6dafc879ab485c095b1d65d2461ac2f7cca86f"}, - {file = "sphinxcontrib-htmlhelp-1.0.3.tar.gz", hash = "sha256:e8f5bb7e31b2dbb25b9cc435c8ab7a79787ebf7f906155729338f3156d93659b"}, +"sphinxcontrib-htmlhelp 2.0.0" = [ + {file = "sphinxcontrib_htmlhelp-2.0.0-py2.py3-none-any.whl", hash = "sha256:d412243dfb797ae3ec2b59eca0e52dac12e75a241bf0e4eb861e450d06c6ed07"}, + {file = "sphinxcontrib-htmlhelp-2.0.0.tar.gz", hash = "sha256:f5f8bb2d0d629f398bf47d0d69c07bc13b65f75a81ad9e2f71a63d4b7a2f6db2"}, ] "sphinxcontrib-jsmath 1.0.1" = [ {file = "sphinxcontrib_jsmath-1.0.1-py2.py3-none-any.whl", hash = "sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178"}, @@ -486,9 +456,9 @@ content_hash = "sha256:6d9bde62ab30bf5c4d2ff76bafc37388aed09b82efd98d94525545b74 {file = "sphinxcontrib_qthelp-1.0.3-py2.py3-none-any.whl", hash = "sha256:bd9fc24bcb748a8d51fd4ecaade681350aa63009a347a8c14e637895444dfab6"}, {file = "sphinxcontrib-qthelp-1.0.3.tar.gz", hash = "sha256:4c33767ee058b70dba89a6fc5c1892c0d57a54be67ddd3e7875a18d14cba5a72"}, ] -"sphinxcontrib-serializinghtml 1.1.4" = [ - {file = "sphinxcontrib_serializinghtml-1.1.4-py2.py3-none-any.whl", hash = "sha256:f242a81d423f59617a8e5cf16f5d4d74e28ee9a66f9e5b637a18082991db5a9a"}, - {file = "sphinxcontrib-serializinghtml-1.1.4.tar.gz", hash = "sha256:eaa0eccc86e982a9b939b2b82d12cc5d013385ba5eadcc7e4fed23f4405f77bc"}, +"sphinxcontrib-serializinghtml 1.1.5" = [ + {file = "sphinxcontrib_serializinghtml-1.1.5-py2.py3-none-any.whl", hash = "sha256:352a9a00ae864471d3a7ead8d7d79f5fc0b57e8b3f95e9867eb9eb28999b92fd"}, + {file = "sphinxcontrib-serializinghtml-1.1.5.tar.gz", hash = "sha256:aa5f6de5dfdf809ef505c4895e51ef5c9eac17d0f287933eb49ec495280b6952"}, ] "toml 0.10.2" = [ {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, @@ -499,9 +469,9 @@ content_hash = "sha256:6d9bde62ab30bf5c4d2ff76bafc37388aed09b82efd98d94525545b74 {file = "typing_extensions-3.10.0.0-py3-none-any.whl", hash = "sha256:779383f6086d90c99ae41cf0ff39aac8a7937a9283ce0a414e5dd782f4c94a84"}, {file = "typing_extensions-3.10.0.0.tar.gz", hash = "sha256:50b6f157849174217d0656f99dc82fe932884fb250826c18350e159ec6cdf342"}, ] -"urllib3 1.26.4" = [ - {file = "urllib3-1.26.4-py2.py3-none-any.whl", hash = "sha256:2f4da4594db7e1e110a944bb1b551fdf4e6c136ad42e4234131391e21eb5b0df"}, - {file = "urllib3-1.26.4.tar.gz", hash = "sha256:e7b021f7241115872f92f43c6508082facffbd1c048e3c6e2bb9c2a157e28937"}, +"urllib3 1.26.5" = [ + {file = "urllib3-1.26.5-py2.py3-none-any.whl", hash = "sha256:753a0374df26658f99d826cfe40394a686d05985786d946fbe4165b5148f5a7c"}, + {file = "urllib3-1.26.5.tar.gz", hash = "sha256:a7acd0977125325f516bda9735fa7142b909a8d01e8b2e4c8108d0984e6e0098"}, ] "zipp 3.4.1" = [ {file = "zipp-3.4.1-py3-none-any.whl", hash = "sha256:51cb66cc54621609dd593d1787f286ee42a5c0adbb4b29abea5a63edc3e03098"}, diff --git a/pyproject.toml b/pyproject.toml index 40a49c8..db4fbb2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,16 +2,6 @@ requires = ["pdm-pep517"] build-backend = "pdm.pep517.api" -[tool.pdm.dev-dependencies] -dev = [ - "pytest", - "flake8", - "sphinx", -] - -[tool.pdm.cli] -cfonts = "cfonts.cli:main" - [project] # PEP 621 project metadata # See https://www.python.org/dev/peps/pep-0621/ @@ -39,7 +29,31 @@ classifiers = [ homepage = "https://github.com/frostming/python-cfonts" Documentation = "https://python-cfonts.readthedocs.io/" -[project.optional-dependencies] - [project.scripts] cfonts = "cfonts.cli:main" + +[tool.pdm.dev-dependencies] +dev = [ + "pytest", + "flake8", + "sphinx", +] + +[tool.isort] +profile = "black" +atomic = true +skip_glob = ["*/setup.py", "pdm/_vendor/*"] +filter_files = true +known_first_party = ["pdm"] +known_third_party = [ + "appdirs", + "atoml", + "click", + "cfonts", + "distlib", + "halo", + "packaging", + "pip_shims", + "pytest", + "pythonfinder" +] diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..37fc453 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,15 @@ +[flake8] +exclude = + .git, + env, + dist, + build, + __pypackages__, +max_line_length = 88 +ignore = + E203 + W503 + +[mypy] +follow_imports = silent +ignore_missing_imports = True diff --git a/tests/conftest.py b/tests/conftest.py index a3bc3d9..482721d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,5 +1,6 @@ """pytest configuration""" import re + import pytest from cfonts.core import Font @@ -24,6 +25,7 @@ def font_factory(chars={}, colors=1, letterspace=[], buffer=[]): @pytest.fixture def strip_color(): def func(text): - REGEX = re.compile(r'\x1b\[\d+?m') - return REGEX.sub('', text) + REGEX = re.compile(r"\x1b\[\d+?m") + return REGEX.sub("", text) + return func diff --git a/tests/example.py b/tests/example.py index d12f44b..715abeb 100644 --- a/tests/example.py +++ b/tests/example.py @@ -9,7 +9,7 @@ def main(): font="console", colors=["gray"], background="green", - align="center" + align="center", ) diff --git a/tests/test_font_class.py b/tests/test_font_class.py index 46941e2..e7106f3 100644 --- a/tests/test_font_class.py +++ b/tests/test_font_class.py @@ -46,4 +46,3 @@ def test_add_letter_spacing_multi_lines(font): "_", "_", ] - diff --git a/tests/test_render.py b/tests/test_render.py index 5a722eb..2ce94b1 100644 --- a/tests/test_render.py +++ b/tests/test_render.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # flake8: noqa from __future__ import unicode_literals + import pytest from cfonts import render diff --git a/tests/test_render_console.py b/tests/test_render_console.py index 1701560..9b90c1e 100644 --- a/tests/test_render_console.py +++ b/tests/test_render_console.py @@ -7,10 +7,9 @@ def test_render_console_default(): def test_render_console_long_text(): - assert ( - render_console("this is a very long line to test multi lines", size=(10, 10)) - == ["this is a", "very long", "line to te", "st multi l", "ines"] - ) + assert render_console( + "this is a very long line to test multi lines", size=(10, 10) + ) == ["this is a", "very long", "line to te", "st multi l", "ines"] def test_render_console_align(): @@ -22,23 +21,22 @@ def test_render_console_align(): def test_render_console_letter_spacing(): assert render_console("text", letter_spacing=2, size=(10, 10)) == ["t e x t"] assert render_console("text", letter_spacing=3, size=(100, 10)) == ["t e x t"] - assert ( - render_console("text", letter_spacing=10, size=(100, 10)) - == ["t e x t"] - ) - - assert ( - render_console("text|text", letter_spacing=2, size=(10, 10)) - == ["t e x t", "t e x t"] - ) - assert ( - render_console("text|text", letter_spacing=3, size=(100, 10)) - == ["t e x t", "t e x t"] - ) - assert ( - render_console("text|text", letter_spacing=10, size=(100, 10)) - == ["t e x t", "t e x t"] - ) + assert render_console("text", letter_spacing=10, size=(100, 10)) == [ + "t e x t" + ] + + assert render_console("text|text", letter_spacing=2, size=(10, 10)) == [ + "t e x t", + "t e x t", + ] + assert render_console("text|text", letter_spacing=3, size=(100, 10)) == [ + "t e x t", + "t e x t", + ] + assert render_console("text|text", letter_spacing=10, size=(100, 10)) == [ + "t e x t", + "t e x t", + ] def test_render_console_line_height(): @@ -61,39 +59,42 @@ def test_render_console_line_height(): def test_render_console_line_break(): - assert ( - render_console("this is a long line", line_height=2, size=(10, 10)) - == ["this is a", "", "long line", ""] - ) - assert ( - render_console("this is a long line", line_height=3, size=(10, 10)) - == ["this is a", "", "", "long line", "", ""] - ) - assert ( - render_console("this is a long line", line_height=10, size=(10, 10)) - == [ - "this is a", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "long line", - "", - "", - "", - "", - "", - "", - "", - "", - "", - ] - ) + assert render_console("this is a long line", line_height=2, size=(10, 10)) == [ + "this is a", + "", + "long line", + "", + ] + assert render_console("this is a long line", line_height=3, size=(10, 10)) == [ + "this is a", + "", + "", + "long line", + "", + "", + ] + assert render_console("this is a long line", line_height=10, size=(10, 10)) == [ + "this is a", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "long line", + "", + "", + "", + "", + "", + "", + "", + "", + "", + ] def test_render_console_color(strip_color): diff --git a/tests/test_utils.py b/tests/test_utils.py index 3bd61a2..5ad0156 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,17 +1,16 @@ # -*- coding: utf-8 -*- """Test utility functions""" import pytest - -from cfonts.core import add_line, char_length, align_text, clean_input, colorize from cfonts.colors import ( - get_closest, - hex_to_rgb, AnsiPen, TrueColorPen, + get_closest, + hex_to_rgb, + hsv_to_rgb, rgb_to_hex, rgb_to_hsv, - hsv_to_rgb, ) +from cfonts.core import add_line, align_text, char_length, clean_input, colorize def test_add_line_single_font(): @@ -128,8 +127,8 @@ def test_ansi_pen(color, is_background, style): @pytest.mark.parametrize( "color,is_background,style", [ - ("#ff5f52", False, ("\x01\x1b[38;2;255;95;82m", "\x1b[39m")), - ("#ff5f52", True, ("\x01\x1b[48;2;255;95;82m", "\x1b[49m")), + ("#ff5f52", False, ("\x1b[38;2;255;95;82m", "\x1b[39m")), + ("#ff5f52", True, ("\x1b[48;2;255;95;82m", "\x1b[49m")), ], ) def test_truecolor_pen(color, is_background, style):