Integrated mypy; added coc config; started fixing a few mypy errors

This commit is contained in:
Sumner Evans
2019-11-21 22:38:00 -07:00
parent a4625b5a64
commit fa3db6df66
7 changed files with 26 additions and 9 deletions

View File

@@ -19,7 +19,8 @@ lint:
- pip3 install -e .
script:
- python3 setup.py check -mrs
- pycodestyle
- flake8
- mypy sublime
test:
stage: test

7
.vim/coc-settings.json Normal file
View File

@@ -0,0 +1,7 @@
{
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"python.linting.mypyEnabled": true,
"python.formatting.provider": "yapf"
}

View File

@@ -1,5 +1,6 @@
pytest
pytest-cov
docutils
pycodestyle
flake8
mypy
lxml

View File

@@ -1,6 +1,12 @@
[pycodestyle]
[flake8]
ignore = E402, W503
[mypy-gi]
ignore_missing_imports = True
[mypy-gi.repository]
ignore_missing_imports = True
[yapf]
based_on_style = pep8
split_before_bitwise_operator = true

View File

@@ -1,6 +1,6 @@
import os
from typing import List
from typing import List, Optional
class ServerConfiguration:
@@ -79,7 +79,7 @@ class AppConfiguration:
return os.path.join(default_cache_location, 'sublime-music')
@property
def server(self) -> ServerConfiguration:
def server(self) -> Optional[ServerConfiguration]:
return (
None if self.current_server < 0 or len(self.servers) < 1 else
self.servers[self.current_server])

View File

@@ -1,5 +1,5 @@
import gi
from typing import Optional, Union
from typing import Union
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GObject, GLib, Gio, Pango
@@ -161,7 +161,7 @@ class AlbumsPanel(Gtk.Box):
show_if('byYear', self.to_year_label, self.to_year_entry)
self.grid.update(
state=state,
state,
force=force,
selected_id=state.selected_album_id,
)
@@ -380,7 +380,7 @@ class AlbumsGrid(Gtk.Overlay):
def update(
self,
state: ApplicationState = None,
state: ApplicationState,
force: bool = False,
selected_id: str = None,
):

View File

@@ -4,6 +4,8 @@ import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
NumericFieldDescription = Tuple[str, str, Tuple[int, int, int], int]
class EditFormDialog(Gtk.Dialog):
entity_name: str
@@ -11,7 +13,7 @@ class EditFormDialog(Gtk.Dialog):
initial_size: Tuple[int, int]
text_fields: List[Tuple[str, str, bool]] = []
boolean_fields: List[Tuple[str, str]] = []
numeric_fields: List[Tuple[str, str]] = []
numeric_fields: List[NumericFieldDescription] = []
extra_buttons: List[Gtk.Button] = []
def get_object_name(self, obj):