[F] Fix #35 python 3.11 compatibility

This commit is contained in:
Azalea (on HyDEV-Daisy) 2022-11-03 23:35:21 -04:00
parent d56f083dbc
commit e8c7266671
No known key found for this signature in database
GPG key ID: E289FAC0DA92DD2B
3 changed files with 5 additions and 7 deletions

View file

@ -295,7 +295,7 @@ def create_config() -> Config:
if random_count > len(perm): if random_count > len(perm):
choices = perm choices = perm
else: 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] 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)] 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] asciis = [[*ca.recolor_ascii(asc, _prs).split('\n'), k.center(asc_width)] for k, ca in arrangements]

View file

@ -1,8 +1,6 @@
from __future__ import annotations from __future__ import annotations
from dataclasses import dataclass from dataclasses import dataclass, field
from typing_extensions import Literal
from .color_util import AnsiMode, LightDark from .color_util import AnsiMode, LightDark
from .constants import CONFIG_PATH from .constants import CONFIG_PATH
@ -16,7 +14,7 @@ class Config:
mode: AnsiMode mode: AnsiMode
light_dark: LightDark = 'dark' light_dark: LightDark = 'dark'
lightness: float | None = None lightness: float | None = None
color_align: ColorAlignment = ColorAlignment('horizontal') color_align: ColorAlignment = field(default_factory=lambda: ColorAlignment('horizontal'))
@classmethod @classmethod
def from_dict(cls, d: dict): def from_dict(cls, d: dict):

View file

@ -3,7 +3,7 @@ import pathlib
from setuptools import setup from setuptools import setup
import hyfetch import hyfetch.constants
# The directory containing this file # The directory containing this file
HERE = pathlib.Path(__file__).parent 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 # This call to setup() does all the work
setup( setup(
name="HyFetch", name="HyFetch",
version=hyfetch.__version__, version=hyfetch.constants.VERSION,
description="neofetch with flags <3", description="neofetch with flags <3",
long_description=README, long_description=README,
long_description_content_type="text/markdown", long_description_content_type="text/markdown",