Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make optional types explicit #255

Merged
merged 16 commits into from
Feb 7, 2022
Prev Previous commit
Next Next commit
Fix imports for tests
- Also fix optional types for worker
  • Loading branch information
dbrattli committed Feb 2, 2022
commit 684a6a94fa1c823b449607e3db19ede3df0feea4
12 changes: 6 additions & 6 deletions faust/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,20 +216,20 @@ def __init__(
self,
app: AppT,
*services: ServiceT,
sensors: Iterable[SensorT] = None,
sensors: Optional[Iterable[SensorT]] = None,
debug: bool = DEBUG,
quiet: bool = False,
loglevel: Union[str, int] = None,
logfile: Union[str, IO] = None,
loglevel: Union[str, int, None] = None,
logfile: Union[str, IO, None] = None,
stdout: IO = sys.stdout,
stderr: IO = sys.stderr,
blocking_timeout: Optional[float] = None,
workdir: Union[Path, str] = None,
workdir: Union[Path, str, None] = None,
console_port: int = CONSOLE_PORT,
loop: Optional[asyncio.AbstractEventLoop] = None,
redirect_stdouts: Optional[bool] = None,
redirect_stdouts_level: Severity = None,
logging_config: Dict = None,
redirect_stdouts_level: Optional[Severity] = None,
logging_config: Optional[Dict] = None,
**kwargs: Any,
) -> None:
self.app = app
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import threading
import time
from http import HTTPStatus
from typing import Any, NamedTuple
from typing import Any, NamedTuple, Optional

import pytest
from _pytest.assertion.util import _compare_eq_dict, _compare_eq_set
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
from typing import List
from typing import List, Optional

import faust

Expand Down
3 changes: 2 additions & 1 deletion tests/stress/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import random
from datetime import datetime, timezone
from itertools import count
from typing import Optional

import faust

Expand All @@ -9,7 +10,7 @@ class Withdrawal(faust.Record, isodates=True, serializer="json"):
user: str
country: str
amount: float
date: datetime = None
date: Optional[datetime] = None


def generate_withdrawals(n: Optional[int] = None):
Expand Down
2 changes: 2 additions & 0 deletions tests/stress/reports/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Optional

import faust

__all__ = ["Error", "Status"]
Expand Down