Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions starlette/datastructures.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ class Address(typing.NamedTuple):

class URL:
def __init__(
self, url: str = "", scope: Scope = None, **components: typing.Any
self,
url: str = "",
scope: typing.Optional[Scope] = None,
**components: typing.Any,
) -> None:
if scope is not None:
assert not url, 'Cannot set both "url" and "scope".'
Expand Down Expand Up @@ -494,9 +497,9 @@ class Headers(typing.Mapping[str, str]):

def __init__(
self,
headers: typing.Mapping[str, str] = None,
raw: typing.List[typing.Tuple[bytes, bytes]] = None,
scope: Scope = None,
headers: typing.Optional[typing.Mapping[str, str]] = None,
raw: typing.Optional[typing.List[typing.Tuple[bytes, bytes]]] = None,
scope: typing.Optional[typing.Mapping[str, typing.Any]] = None,
) -> None:
self._list: typing.List[typing.Tuple[bytes, bytes]] = []
if headers is not None:
Expand Down Expand Up @@ -659,7 +662,9 @@ class State:
Used for `request.state` and `app.state`.
"""

def __init__(self, state: typing.Dict = None):
_state: typing.Dict[str, typing.Any]

def __init__(self, state: typing.Optional[typing.Dict[str, typing.Any]] = None):
if state is None:
state = {}
super().__setattr__("_state", state)
Expand Down