Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
fix: a few minor type sig changes
Browse files Browse the repository at this point in the history
and try running mypy on travis

issue #712
  • Loading branch information
pjenvey committed Feb 11, 2017
1 parent 717b055 commit f8929df
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 13 deletions.
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@ matrix:
- python: pypy-5.4.1
env: TOXENV=pypy DDB=true CODECOV=true
- env: TOXENV=flake8
- python: 3.6
env: TOXENV=py36-mypy
allow_failures:
- env: TOXENV=py36-mypy

install:
- make ${DDB:+ddb} travis
script: tox -- --with-coverage --cover-xml --cover-package=autopush
- ${DDB:+make ddb}
- pip install tox ${CODECOV:+codecov}
script:
- tox -- ${CODECOV:+--with-coverage --cover-xml --cover-package=autopush}
after_success:
- ${CODECOV:+codecov}
notifications:
Expand Down
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@ BUILD_DIRS = bin build deps include lib lib64 lib_pypy lib-python\
src site-packages .tox .eggs .coverage


.PHONY: all build test coverage lint clean clean-env travis
.PHONY: all build test coverage lint clean clean-env

all: build

travis:
pip install coverage nose mock moto codecov tox

ddb:
mkdir $@
curl -sSL http://dynamodb-local.s3-website-us-west-2.amazonaws.com/dynamodb_local_latest.tar.gz | tar xzvC $@
Expand Down
2 changes: 1 addition & 1 deletion autopush/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@


def begin_or_register(observer):
# type: (Any) -> None
"""Register observer with the global LogPublisher
Registers via the global LogBeginner the first time called.
"""
# type: (Any) -> None
global began_logging
if not began_logging:
globalLogBeginner.beginLoggingTo([observer], redirectStandardIO=False)
Expand Down
4 changes: 2 additions & 2 deletions autopush/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,8 @@ def create_endpoint(port):


def start_looping_call(interval, func, *args, **kwargs):
# type: (int, Callable[..., Any], *Any, **Any) -> None
"""Fire off a LoopingCall of interval, logging errors."""
# type: (int, Callable[..., Any], *Any, **Any)
lc = task.LoopingCall(func, *args, **kwargs)
lc.start(interval).addErrback(
lambda failure: log.failure(
Expand All @@ -646,8 +646,8 @@ def start_looping_call(interval, func, *args, **kwargs):


def create_memusage_site(settings, port, debug):
"""Setup MemUsageHandler on a specific port"""
# type: (AutopushSettings, int, bool) -> Port
"""Setup MemUsageHandler on a specific port"""
h_kwargs = dict(ap_settings=settings)
site = cyclone.web.Application(
[(endpoint_paths['memusage'], MemUsageHandler, h_kwargs)],
Expand Down
4 changes: 2 additions & 2 deletions autopush/noseplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import time

try:
from nose.plugins import Plugin
from nose.plugins import Plugin # type: ignore
except ImportError:
class Plugin(object):
class Plugin(object): # type: ignore
pass


Expand Down
2 changes: 1 addition & 1 deletion autopush/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def extract_code(data):


def periodic_reporter(settings, factory):
# type: (AutopushSettings, PushServerFactory)
# type: (AutopushSettings, PushServerFactory) -> None
"""Twisted Task function that runs every few seconds to emit general
metrics regarding twisted and client counts"""
settings.metrics.gauge("update.client.writers",
Expand Down
6 changes: 6 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[mypy]
python_version = 2.7
fast_parser = true
ignore_missing_imports = true
follow_imports = skip
warn_unused_ignores = true
6 changes: 5 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py27,pypy,flake8
envlist = py27,pypy,flake8,py36-mypy

[testenv]
deps = -rtest-requirements.txt
Expand All @@ -16,3 +16,7 @@ deps = -rpypy-test-requirements.txt
[testenv:flake8]
commands = flake8 autopush
deps = -rbase-test-requirements.txt

[testenv:py36-mypy]
commands = mypy autopush
deps = mypy

0 comments on commit f8929df

Please sign in to comment.