Downgrade required Python version from 3.10 to 3.8

Python 3.10 was require because I was using the `str | None` style
typing syntax instead of Optional. This is 3.10+, but now the max
required version is 3.8 for the `Protocol` typing API.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2022-09-22 20:33:03 -07:00
parent dc86529fb8
commit 2b57eb8c98

View File

@@ -18,7 +18,7 @@ import functools
import random
import re
import string
from typing import Protocol
from typing import Optional, Protocol
NAME_CHARS = string.ascii_letters + string.digits
@@ -196,7 +196,7 @@ class MarkupParser:
################################################################################
def render(text: str, ctx: MarkupContext | None = None) -> str:
def render(text: str, ctx: Optional[MarkupContext] = None) -> str:
if not ctx:
ctx = default_context()
assert ctx
@@ -210,7 +210,7 @@ def render(text: str, ctx: MarkupContext | None = None) -> str:
def macro_random(
ctx: MarkupContext, first: str | None = None, second: str | None = None, *tail: str
ctx: MarkupContext, first: Optional[str] = None, second: Optiona[str] = None, *tail: str
) -> str:
"""
Choose a random number.
@@ -237,7 +237,7 @@ def macro_choose(ctx: MarkupContext, *choices: str):
return random.choice(choices)
def macro_round(ctx: MarkupContext, n: str, digits: str | None = None) -> str:
def macro_round(ctx: MarkupContext, n: str, digits: Optional[str] = None) -> str:
"round() function, same as Python's."
if digits:
res = round(float(n), int(digits))