Skip to content

Strict mypy #390

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

Merged
merged 7 commits into from
Jul 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .tmuxp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ windows:
panes:
- focus: true
- pane
- make watch_mypy
- make start
- window_name: docs
layout: main-horizontal
Expand Down
6 changes: 6 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ $ pip install --user --upgrade --pre libvcs
### What's new

- New and improved logo
- **Improved typings**

Now [`mypy --strict`] compliant ({issue}`390`)

[`mypy --strict`]: https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-strict

- **Parser**: Experimental VCS URL parsing added ({issue}`376`, {issue}`381`, {issue}`384`,
{issue}`386`):

Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,9 @@ watch_mypy:

format_markdown:
prettier --parser=markdown -w *.md docs/*.md docs/**/*.md CHANGES

monkeytype_create:
poetry run monkeytype run `poetry run which py.test`

monkeytype_apply:
poetry run monkeytype list-modules | xargs -n1 -I{} sh -c 'poetry run monkeytype apply {}'
14 changes: 9 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import sys
from os.path import dirname, relpath
from pathlib import Path
from typing import Union

import libvcs

Expand All @@ -15,7 +16,7 @@
sys.path.insert(0, str(doc_path / "_ext"))

# package data
about: dict = {}
about: dict[str, str] = {}
with open(project_root / "libvcs" / "__about__.py") as fp:
exec(fp.read(), about)

Expand Down Expand Up @@ -58,8 +59,8 @@
html_extra_path = ["manifest.json"]
html_favicon = "_static/favicon.ico"
html_theme = "furo"
html_theme_path: list = []
html_theme_options: dict = {
html_theme_path: list[str] = []
html_theme_options: dict[str, Union[str, list[dict[str, str]]]] = {
"light_logo": "img/libvcs.svg",
"dark_logo": "img/libvcs-dark.svg",
"footer_icons": [
Expand Down Expand Up @@ -164,7 +165,9 @@
}


def linkcode_resolve(domain, info): # NOQA: C901
def linkcode_resolve(
domain: str, info: dict[str, str]
) -> Union[None, str]: # NOQA: C901
"""
Determine the URL corresponding to Python object

Expand Down Expand Up @@ -197,7 +200,8 @@ def linkcode_resolve(domain, info): # NOQA: C901
except AttributeError:
pass
else:
obj = unwrap(obj)
if callable(obj):
obj = unwrap(obj)

try:
fn = inspect.getsourcefile(obj)
Expand Down
2 changes: 1 addition & 1 deletion libvcs/_internal/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class SkipDefaultFieldsReprMixin:
ItemWithMixin(name=Test, unit_price=2.05)
"""

def __repr__(self):
def __repr__(self) -> str:
"""Omit default fields in object representation."""
nodef_f_vals = (
(f.name, attrgetter(f.name)(self))
Expand Down
Loading