Skip to content

Commit

Permalink
make lgtm/inspector happy
Browse files Browse the repository at this point in the history
  • Loading branch information
hnesk committed Jun 15, 2022
1 parent a02717a commit c17a3b9
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
3 changes: 1 addition & 2 deletions ocrd_browser/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*-
import os
import sys
from pstats import SortKey
import pstats
import io
import cProfile
Expand Down Expand Up @@ -49,7 +48,7 @@ def new_hook(type_: Type[BaseException], value: BaseException, traceback: Traceb
def startup_time() -> None:
PROFILER.disable()
s = io.StringIO()
ps = pstats.Stats(PROFILER, stream=s).sort_stats(SortKey.TIME)
ps = pstats.Stats(PROFILER, stream=s).sort_stats(pstats.SortKey.TIME)
ps.print_stats(20)
print(s.getvalue())

Expand Down
3 changes: 2 additions & 1 deletion ocrd_browser/model/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def baseurl_mets(self) -> str:
"""
return str(self.workspace.baseurl) + '/' + self.mets_filename if self.workspace else None

def path(self, other: Union[OcrdFile, Path, str]) -> Path:
def path(self, other: Union[OcrdFile, Path, str]) -> Optional[Path]:
"""
Resolves other relative to current workspace
"""
Expand Down Expand Up @@ -445,6 +445,7 @@ def editable(self, editable: bool) -> None:
if self._original_url:
self.workspace = self._clone_workspace(self._original_url)
else:
# noinspection PyTypeChecker
self.workspace = Resolver().workspace_from_nothing(directory=None, mets_basename='mets.xml')
else:
self.workspace = Resolver().workspace_from_url(self.baseurl_mets)
Expand Down
1 change: 1 addition & 0 deletions ocrd_browser/model/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def file(self) -> Optional[OcrdFile]:
elif self.image_files:
return next(iter(self.image_files))
else:
# noinspection PyTypeChecker
any_files = self.get_files(mimetype=None)
if any_files:
return next(iter(any_files))
Expand Down
2 changes: 1 addition & 1 deletion ocrd_browser/view/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def __init__(self, name: str, window: Gtk.Window):
self.file_group2: Tuple[Optional[str], Optional[str]] = (None, MIMETYPE_PAGE)
self.font_size: Optional[int] = None

self.current2: Page = None
self.current2: Optional[Page] = None

# noinspection PyTypeChecker
self.text_view: GtkSource.View = None
Expand Down
2 changes: 1 addition & 1 deletion serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def _browse_workspace(self, path):
if not path.endswith('mets.xml'):
path = os.path.join(path, 'mets.xml')
## run app
ret = Popen([which('browse-ocrd'),
Popen([which('browse-ocrd'),
'--display', ':' + str(self.bwport - 8080),
path])
## proxy does not work, because the follow-up requests would need to be forwarded, too:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
import fastentrypoints
import fastentrypoints # lgtm [py/unused-import]
import codecs
import subprocess

Expand Down

0 comments on commit c17a3b9

Please sign in to comment.