From 470f03dd07b3a5adf3855dbaf9ff69bdb1a440b7 Mon Sep 17 00:00:00 2001 From: Abel Luck Date: Thu, 1 Dec 2022 17:28:22 +0000 Subject: [PATCH] Use python 3.10 and fix types --- .python-version | 2 +- Dockerfile | 2 +- ops_bot/util/template.py | 7 ++++--- pyproject.toml | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.python-version b/.python-version index f69abe4..c84ccce 100644 --- a/.python-version +++ b/.python-version @@ -1 +1 @@ -3.9.7 +3.10.5 diff --git a/Dockerfile b/Dockerfile index 60a7581..554338c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG PYTHON_VERSION=3.9 +ARG PYTHON_VERSION=3.10 FROM docker.io/python:${PYTHON_VERSION}-alpine as builder ARG LIBOLM_VERSION=3.2.10 RUN apk add --no-cache \ diff --git a/ops_bot/util/template.py b/ops_bot/util/template.py index d2ca3ee..377dc9c 100644 --- a/ops_bot/util/template.py +++ b/ops_bot/util/template.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . import os.path +from pathlib import Path from typing import Any, Callable, Dict, List, Tuple, Union from jinja2 import BaseLoader @@ -24,12 +25,12 @@ from ops_bot import get_project_root from ops_bot.util import markdown -def sync_read_file(path: str) -> str: +def sync_read_file(path: Union[Path, str]) -> str: with open(path) as file: return file.read() -def sync_list_files(directory: str) -> list[str]: +def sync_list_files(directory: Union[Path, str]) -> list[str]: return os.listdir(directory) @@ -108,7 +109,7 @@ class TemplateProxy: class PluginTemplateLoader(BaseLoader): - directory: str + directory: Path macros: str def __init__(self, base: str, directory: str) -> None: diff --git a/pyproject.toml b/pyproject.toml index 36e6f90..4d0c90a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ description = "" authors = ["Abel Luck "] [tool.poetry.dependencies] -python = "^3.9" +python = "^3.10" matrix-nio = {extras = ["e2e"], version = "^0.19.0"} fastapi = "^0.79.0" uvicorn = "^0.18.2"