Skip to content

Commit

Permalink
GIT-2045: use Optional instead of Union for Typing
Browse files Browse the repository at this point in the history
  • Loading branch information
harshanarayana committed Mar 7, 2021
1 parent 1d8836a commit c6b1129
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
4 changes: 2 additions & 2 deletions sanic/blueprint_group.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections.abc import MutableSequence
from typing import List, Union
from typing import List, Optional, Union

import sanic

Expand Down Expand Up @@ -98,7 +98,7 @@ def version(self) -> Union[None, str, int, float]:
return self._version

@property
def strict_slashes(self) -> Union[None, bool]:
def strict_slashes(self) -> Optional[bool]:
"""
URL Slash termination behavior configuration
Expand Down
14 changes: 7 additions & 7 deletions sanic/models/futures.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pathlib import PurePath
from typing import NamedTuple, List, Union, Iterable
from typing import NamedTuple, List, Union, Iterable, Optional

from sanic.models.handler_types import (
ListenerType,
Expand All @@ -11,15 +11,15 @@
class FutureRoute(NamedTuple):
handler: str
uri: str
methods: Union[None, Iterable[str]]
methods: Optional[Iterable[str]]
host: str
strict_slashes: bool
stream: bool
version: Union[None, int]
version: Optional[int]
name: str
ignore_body: bool
websocket: bool
subprotocols: Union[None, List[str]]
subprotocols: Optional[List[str]]
unquote: bool
static: bool

Expand Down Expand Up @@ -47,6 +47,6 @@ class FutureStatic(NamedTuple):
use_content_range: bool
stream_large_files: bool
name: str
host: Union[None, str]
strict_slashes: Union[None, bool]
content_type: Union[None, bool]
host: Optional[str]
strict_slashes: Optional[bool]
content_type: Optional[bool]
3 changes: 0 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import json
import os
import random
import re
import string
Expand All @@ -11,7 +9,6 @@
import pytest

from sanic_routing.exceptions import RouteExists
from sanic_testing import TestManager

from sanic import Sanic
from sanic.constants import HTTP_METHODS
Expand Down

0 comments on commit c6b1129

Please sign in to comment.