From e8c72666717684138ae934bec8d541a608b2f397 Mon Sep 17 00:00:00 2001 From: "Azalea (on HyDEV-Daisy)" Date: Thu, 3 Nov 2022 23:35:21 -0400 Subject: [PATCH] [F] Fix #35 python 3.11 compatibility --- hyfetch/main.py | 2 +- hyfetch/models.py | 6 ++---- setup.py | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/hyfetch/main.py b/hyfetch/main.py index 39082a24..150f5cc9 100755 --- a/hyfetch/main.py +++ b/hyfetch/main.py @@ -295,7 +295,7 @@ def create_config() -> Config: if random_count > len(perm): choices = perm else: - choices = random.sample(perm, random_count) + choices = random.sample(sorted(perm), random_count) choices = [{slots[i]: n for i, n in enumerate(c)} for c in choices] arrangements += [(f'random{i}', ColorAlignment('custom', r)) for i, r in enumerate(choices)] asciis = [[*ca.recolor_ascii(asc, _prs).split('\n'), k.center(asc_width)] for k, ca in arrangements] diff --git a/hyfetch/models.py b/hyfetch/models.py index b36fccfe..db9e949a 100644 --- a/hyfetch/models.py +++ b/hyfetch/models.py @@ -1,8 +1,6 @@ from __future__ import annotations -from dataclasses import dataclass - -from typing_extensions import Literal +from dataclasses import dataclass, field from .color_util import AnsiMode, LightDark from .constants import CONFIG_PATH @@ -16,7 +14,7 @@ class Config: mode: AnsiMode light_dark: LightDark = 'dark' lightness: float | None = None - color_align: ColorAlignment = ColorAlignment('horizontal') + color_align: ColorAlignment = field(default_factory=lambda: ColorAlignment('horizontal')) @classmethod def from_dict(cls, d: dict): diff --git a/setup.py b/setup.py index 67523140..fa324d9f 100755 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ import pathlib from setuptools import setup -import hyfetch +import hyfetch.constants # The directory containing this file HERE = pathlib.Path(__file__).parent @@ -14,7 +14,7 @@ README = (HERE / "README.md").read_text('utf-8') # This call to setup() does all the work setup( name="HyFetch", - version=hyfetch.__version__, + version=hyfetch.constants.VERSION, description="neofetch with flags <3", long_description=README, long_description_content_type="text/markdown",