Skip to content

Commit

Permalink
Refine type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
justvanrossum committed Dec 16, 2023
1 parent cdb7b1e commit b23960a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/fontra/core/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from importlib import resources
from importlib.abc import Traversable
from importlib.metadata import entry_points
from typing import Any, Optional
from typing import Any, Collection, Optional
from urllib.parse import quote

from aiohttp import WSCloseCode, web
Expand Down Expand Up @@ -253,7 +253,7 @@ async def staticContentHandler(
async def notFoundHandler(self, request: web.Request) -> web.Response:
return web.HTTPNotFound()

async def rootDocumentHandler(self, request) -> web.Response:
async def rootDocumentHandler(self, request: web.Request) -> web.Response:
response = await self.projectManager.projectPageHandler(
request, self._addVersionTokenToReferences
)
Expand Down Expand Up @@ -299,7 +299,9 @@ def _addVersionTokenToReferences(self, data: bytes, contentType: str) -> bytes:
return data


def addVersionTokenToReferences(data: bytes, versionToken, extensions) -> bytes:
def addVersionTokenToReferences(
data: bytes, versionToken: str, extensions: Collection[str]
) -> bytes:
assert isinstance(data, bytes)
pattern = rf"""((['"])[./][./A-Za-z-]+)(\.({"|".join(extensions)})\2)""".encode(
"utf-8"
Expand Down

0 comments on commit b23960a

Please sign in to comment.