Skip to content

Commit

Permalink
Fix mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanlatr committed Jan 29, 2024
1 parent c26ca3f commit 60e4b98
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions burpa/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import concurrent.futures
from datetime import datetime, time
from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, TextIO, Tuple
from importlib_resources import files, Package, Resource
from importlib_resources import files

def get_valid_filename(s: str) -> str:
'''Return the given string converted to a string that can be used for a clean filename. Stolen from Django, I think.'''
Expand Down Expand Up @@ -129,7 +129,7 @@ def get_version(s:str) -> Tuple[int, ...]:
Parse a version string like <major>.<minor>.<micro> into a tuple of ints.
"""
parts = s.strip().split('.')
intparts = []
intparts: 'list[int]' = []

for p in parts:
try:
Expand All @@ -155,20 +155,20 @@ def strip_tags(html:str) -> str:
return _tag.sub('', html)

def open_text(
package: Package,
resource: Resource,
package: str,
resource: str,
encoding: str = 'utf-8',
errors: str = 'strict',
) -> TextIO:
"""Return a file-like object opened for text reading of the resource."""
return (files(package) / resource).open(
return (files(package) / resource).open( # type:ignore
'r', encoding=encoding, errors=errors
)


def read_text(
package: Package,
resource: Resource,
package: str,
resource: str,
encoding: str = 'utf-8',
errors: str = 'strict',
) -> str:
Expand Down

0 comments on commit 60e4b98

Please sign in to comment.