Skip to content

Commit

Permalink
Enable type hints (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov authored Nov 9, 2021
1 parent 8ebfee4 commit 8ba51cc
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGES/280.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added type hints support.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ setup: .develop
.PHONY: lint
lint:
pre-commit run --all-files
# mypy aiojobs tests
mypy .


.PHONY: test
Expand Down
13 changes: 2 additions & 11 deletions aiojobs/_scheduler.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
import asyncio
import sys
from collections.abc import Collection

from ._job import Job

try:
from collections.abc import Collection
except ImportError: # pragma: no cover
# Python 3.5 has no Collection ABC class
from collections.abc import Container, Iterable, Sized

bases = Sized, Iterable, Container
else: # pragma: no cover
bases = (Collection,)


class Scheduler(*bases):
class Scheduler(Collection):
def __init__(self, *, close_timeout, limit, pending_limit, exception_handler):
if sys.version_info >= (3, 7):
self._loop = loop = asyncio.get_running_loop()
Expand Down
1 change: 1 addition & 0 deletions aiojobs/py.typed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Placeholder
15 changes: 11 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,31 @@
import codecs
import os
import re
from typing import Dict

_docs_path = os.path.dirname(__file__)
_version_path = os.path.abspath(
os.path.join(_docs_path, "..", "aiojobs", "__init__.py")
)
_version_info = None
with codecs.open(_version_path, "r", "latin1") as fp:
try:
_version_info = re.search(
match = re.search(
r'^__version__ = "'
r"(?P<major>\d+)"
r"\.(?P<minor>\d+)"
r"\.(?P<patch>\d+)"
r'(?P<tag>.*)?"$',
fp.read(),
re.M,
).groupdict()
)
if match is not None:
_version_info = match.groupdict()
except IndexError:
raise RuntimeError("Unable to determine version.")
pass

if _version_info is None:
raise RuntimeError("Unable to determine version.")


# -- General configuration ------------------------------------------------
Expand Down Expand Up @@ -163,7 +170,7 @@

# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
latex_elements: Dict[str, str] = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
Expand Down

0 comments on commit 8ba51cc

Please sign in to comment.