Skip to content

Commit

Permalink
Scheduled monthly dependency update for July (#89)
Browse files Browse the repository at this point in the history
* Update aiohttp from 3.1.3 to 3.3.2

* Update aiohttp-session from 2.3.0 to 2.5.1

* Update chevron from 0.11.1 to 0.12.1

* Update uvloop from 0.9.1 to 0.10.2

* Update sphinx from 1.7.4 to 1.7.5

* Update sphinxcontrib-websupport from 1.0.1 to 1.1.0

* Update mypy from 0.590 to 0.610

* Update pycodestyle from 2.3.1 to 2.4.0

* Update pyflakes from 1.6.0 to 2.0.0

* Update pytest from 3.5.1 to 3.6.2

* Update pytest-isort from 0.1.0 to 0.2.0

* Update pytest-mock from 1.9.0 to 1.10.0

* Update pytest-timeout from 1.2.1 to 1.3.0

* Update pytz from 2018.4 to 2018.5

* reset pycodestyle

* fix typing for new mypy
  • Loading branch information
pyup-bot authored and samuelcolvin committed Jul 9, 2018
1 parent 5170810 commit 23b57b6
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 34 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ lint:
python setup.py check -rms
flake8 arq/ tests/
pytest arq -p no:sugar -q
mypy --ignore-missing-imports arq/
mypy --ignore-missing-imports --warn-unused-ignores arq/

.PHONY: test
test:
Expand Down
12 changes: 6 additions & 6 deletions arq/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# flake8: noqa
from .drain import * # type: ignore
from .jobs import * # type: ignore
from .main import * # type: ignore
from .utils import * # type: ignore
from .version import * # type: ignore
from .worker import * # type: ignore
from .drain import *
from .jobs import *
from .main import *
from .utils import *
from .version import *
from .worker import *
4 changes: 2 additions & 2 deletions arq/drain.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"""
import asyncio
import logging
from typing import Set # noqa
from typing import Optional, Set # noqa

from aioredis import Redis
from async_timeout import timeout
Expand Down Expand Up @@ -56,7 +56,7 @@ def __init__(self, *,
self.burst_mode = burst_mode
self.raise_task_exception = raise_task_exception
self.pending_tasks: Set[asyncio.futures.Future] = set()
self.task_exception: Exception = None
self.task_exception: Optional[Exception] = None
self.semaphore_timeout = semaphore_timeout

self.jobs_complete, self.jobs_failed, self.jobs_timed_out = 0, 0, 0
Expand Down
5 changes: 3 additions & 2 deletions arq/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import base64
import os
from datetime import datetime
from typing import cast

import msgpack

Expand Down Expand Up @@ -54,8 +55,8 @@ def __init__(self, raw_data: bytes, *, queue_name: str=None, raw_queue: bytes=No
self.raw_data = raw_data
if queue_name is None and raw_queue is None:
raise ArqError('either queue_name or raw_queue are required')
self.queue = queue_name or raw_queue.decode()
self.raw_queue = raw_queue or queue_name.encode()
self.queue = queue_name or cast(bytes, raw_queue).decode()
self.raw_queue = raw_queue or cast(str, queue_name).encode()
self.queued_at, self.class_name, self.func_name, self.args, self.kwargs, self.id = self.decode_raw(raw_data)
self.queued_at /= 1000

Expand Down
8 changes: 4 additions & 4 deletions arq/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import inspect
import logging
from datetime import datetime
from typing import Any, Callable, Dict, List, Union # noqa
from typing import Any, Callable, Dict, List, Optional, Union, cast # noqa

from .jobs import Job
from .utils import RedisMixin, next_cron, to_unix_ms
Expand Down Expand Up @@ -54,7 +54,7 @@ class Actor(RedisMixin, metaclass=ActorMeta):

#: if not None this name is used instead of the class name when encoding and referencing jobs,
#: if None the class's name is used
name: str = None
name: Optional[str] = None

#: job class to use when encoding and decoding jobs from this actor
job_class = Job
Expand Down Expand Up @@ -123,14 +123,14 @@ async def enqueue_job(self, func_name: str, *args, queue: str=None, **kwargs):
await self.job_future(redis, queue, func_name, *args, **kwargs)
else:
main_logger.debug('%s.%s → %s (called directly)', self.name, func_name, queue)
data = self.job_class.encode(class_name=self.name, func_name=func_name, args=args, kwargs=kwargs)
data = self.job_class.encode(class_name=cast(str, self.name), func_name=func_name, args=args, kwargs=kwargs)
j = self.job_class(data, queue_name=queue)
await getattr(self, j.func_name).direct(*j.args, **j.kwargs)

def job_future(self, redis, queue: str, func_name: str, *args, **kwargs):
return redis.rpush(
self.queue_lookup[queue],
self.job_class.encode(class_name=self.name, func_name=func_name, args=args, kwargs=kwargs),
self.job_class.encode(class_name=cast(str, self.name), func_name=func_name, args=args, kwargs=kwargs),
)

def _now(self):
Expand Down
12 changes: 6 additions & 6 deletions arq/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from importlib import import_module, reload
from multiprocessing import Process
from signal import Signals
from typing import Dict, List, Type # noqa
from typing import Dict, List, Optional, Type # noqa

from async_timeout import timeout

Expand Down Expand Up @@ -97,16 +97,16 @@ def __init__(self, *,
"""
self._burst_mode = burst
self.shadows = shadows or self.shadows
self.queues: List[str] = queues
self.queues: Optional[List[str]] = queues
self.timeout_seconds = timeout_seconds or self.timeout_seconds

self._shadow_lookup: Dict[str, Actor] = {}
self.start: float = None
self.start: Optional[float] = None
self.last_health_check = 0
self._last_health_check_log = None
self._closed = False
self.drain: Drain = None
self.job_class: Type[Job] = None
self.drain: Optional[Drain] = None
self.job_class: Optional[Type[Job]] = None
super().__init__(**kwargs)
self._add_signal_handler(signal.SIGINT, self.handle_sig)
self._add_signal_handler(signal.SIGTERM, self.handle_sig)
Expand Down Expand Up @@ -330,7 +330,7 @@ def log_job_result(self, started_at: float, result, j: Job):
jobs_logger.info('%-4s ran in%7.3fs ← %s ● %s', j.queue, job_time, j.short_ref(), sr)

def handle_prepare_exc(self, msg: str):
self.drain.jobs_failed += 1
self.drain.jobs_failed += 1 # type: ignore
jobs_logger.error(msg)
# exit with zero so we don't increment jobs_failed twice
return 0
Expand Down
8 changes: 4 additions & 4 deletions demo/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
aiohttp==3.1.3
aiohttp-session==2.3.0
chevron==0.11.1
uvloop==0.9.1
aiohttp==3.3.2
aiohttp-session==2.5.1
chevron==0.12.1
uvloop==0.10.2
4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
docutils==0.14
Pygments==2.2.0
Sphinx==1.7.4
sphinxcontrib-websupport==1.0.1
Sphinx==1.7.5
sphinxcontrib-websupport==1.1.0
14 changes: 7 additions & 7 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ coverage==4.5.1
docutils==0.14
flake8==3.5.0
isort==4.3.4
mypy==0.590
mypy==0.610
pycodestyle==2.3.1
pyflakes==1.6.0
pytest==3.5.1
pyflakes==2.0.0
pytest==3.6.2
pytest-aiohttp==0.3.0
pytest-cov==2.5.1
pytest-isort==0.1.0
pytest-mock==1.9.0
pytest-isort==0.2.0
pytest-mock==1.10.0
pytest-sugar==0.9.1
pytest-timeout==1.2.1
pytest-timeout==1.3.0
pytest-toolbox==0.4
pytz==2018.4
pytz==2018.5

0 comments on commit 23b57b6

Please sign in to comment.