From 040d18b2b95cab5fc9d31f7a9a6875e437a435ff Mon Sep 17 00:00:00 2001 From: Ruslan Sayfutdinov Date: Sun, 19 Jun 2022 18:17:58 +0100 Subject: [PATCH] Re-enable mypy --- .pre-commit-config.yaml | 10 +++++----- gpsoauth/__init__.py | 16 ++++++++++------ setup.cfg | 1 + 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9f9fcd0..5ed1b7c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,11 +20,11 @@ repos: language: system types: [python] require_serial: true - # - id: mypy - # name: mypy - # entry: poetry run mypy - # language: system - # types: [python] + - id: mypy + name: mypy + entry: poetry run mypy + language: system + types: [python] - id: flake8 name: flake8 entry: poetry run flake8 diff --git a/gpsoauth/__init__.py b/gpsoauth/__init__.py index cc1735d..e74d7cd 100644 --- a/gpsoauth/__init__.py +++ b/gpsoauth/__init__.py @@ -7,8 +7,10 @@ from typing import Any, Iterable import requests -from urllib3.poolmanager import PoolManager # type: ignore -from urllib3.util import ssl_ + +# Type annotations for urllib3 will be released with v2. +from urllib3.poolmanager import PoolManager # type: ignore[import] +from urllib3.util import ssl_ # type: ignore[import] from . import google @@ -78,10 +80,12 @@ def _perform_auth_request( session.mount(AUTH_URL, AuthHTTPAdapter()) if proxies: session.proxies = proxies - session.headers = { - "User-Agent": USER_AGENT, - "Content-type": "application/x-www-form-urlencoded", - } + session.headers.update( + { + "User-Agent": USER_AGENT, + "Content-type": "application/x-www-form-urlencoded", + } + ) res = session.post(AUTH_URL, data=data, verify=True) diff --git a/setup.cfg b/setup.cfg index cefe048..f9db57f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,6 +6,7 @@ extend-ignore = E203, W503 [mypy] python_version = 3.8 +show_error_codes = True strict = True disallow_any_unimported = True show_none_errors = True