Use python 3.10 and fix types
This commit is contained in:
parent
11afd70979
commit
470f03dd07
4 changed files with 7 additions and 6 deletions
|
|
@ -14,6 +14,7 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue