The following issues were found
coq/clients/tree_sitter/worker.py
11 issues
Line: 3
Column: 1
from typing import AsyncIterator
from pynvim_pp.lib import go
from ...databases.treesitter.database import TDB
from ...shared.runtime import Supervisor
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import BaseClient
from ...shared.types import Completion, Context, Edit
Reported by Pylint.
Line: 5
Column: 1
from pynvim_pp.lib import go
from ...databases.treesitter.database import TDB
from ...shared.runtime import Supervisor
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import BaseClient
from ...shared.types import Completion, Context, Edit
Reported by Pylint.
Line: 6
Column: 1
from pynvim_pp.lib import go
from ...databases.treesitter.database import TDB
from ...shared.runtime import Supervisor
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import BaseClient
from ...shared.types import Completion, Context, Edit
Reported by Pylint.
Line: 7
Column: 1
from ...databases.treesitter.database import TDB
from ...shared.runtime import Supervisor
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import BaseClient
from ...shared.types import Completion, Context, Edit
class Worker(BaseWorker[BaseClient, TDB]):
Reported by Pylint.
Line: 8
Column: 1
from ...databases.treesitter.database import TDB
from ...shared.runtime import Supervisor
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import BaseClient
from ...shared.types import Completion, Context, Edit
class Worker(BaseWorker[BaseClient, TDB]):
def __init__(self, supervisor: Supervisor, options: BaseClient, misc: TDB) -> None:
Reported by Pylint.
Line: 9
Column: 1
from ...shared.runtime import Supervisor
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import BaseClient
from ...shared.types import Completion, Context, Edit
class Worker(BaseWorker[BaseClient, TDB]):
def __init__(self, supervisor: Supervisor, options: BaseClient, misc: TDB) -> None:
super().__init__(supervisor, options=options, misc=misc)
Reported by Pylint.
Line: 19
Column: 13
async def _poll(self) -> None:
while True:
pass
async with self._supervisor.idling:
await self._supervisor.idling.wait()
async def work(self, context: Context) -> AsyncIterator[Completion]:
Reported by Pylint.
Line: 1
Column: 1
from typing import AsyncIterator
from pynvim_pp.lib import go
from ...databases.treesitter.database import TDB
from ...shared.runtime import Supervisor
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import BaseClient
from ...shared.types import Completion, Context, Edit
Reported by Pylint.
Line: 12
Column: 1
from ...shared.types import Completion, Context, Edit
class Worker(BaseWorker[BaseClient, TDB]):
def __init__(self, supervisor: Supervisor, options: BaseClient, misc: TDB) -> None:
super().__init__(supervisor, options=options, misc=misc)
go(supervisor.nvim, aw=self._poll())
async def _poll(self) -> None:
Reported by Pylint.
Line: 12
Column: 1
from ...shared.types import Completion, Context, Edit
class Worker(BaseWorker[BaseClient, TDB]):
def __init__(self, supervisor: Supervisor, options: BaseClient, misc: TDB) -> None:
super().__init__(supervisor, options=options, misc=misc)
go(supervisor.nvim, aw=self._poll())
async def _poll(self) -> None:
Reported by Pylint.
coq/server/state.py
11 issues
Line: 8
Column: 1
from typing import AbstractSet, Optional, Tuple, Union
from uuid import UUID, uuid4
from std2.types import Void, VoidType
from ..shared.context import EMPTY_CONTEXT
from ..shared.types import Context, NvimPos
Reported by Pylint.
Line: 10
Column: 1
from std2.types import Void, VoidType
from ..shared.context import EMPTY_CONTEXT
from ..shared.types import Context, NvimPos
@dataclass(frozen=True)
class State:
Reported by Pylint.
Line: 11
Column: 1
from std2.types import Void, VoidType
from ..shared.context import EMPTY_CONTEXT
from ..shared.types import Context, NvimPos
@dataclass(frozen=True)
class State:
cwd: PurePath
Reported by Pylint.
Line: 54
Column: 5
inserted: Optional[NvimPos] = None,
pum_location: Union[VoidType, Optional[int]] = Void,
) -> State:
global _state
with _LOCK:
state = State(
cwd=cwd or _state.cwd,
screen=screen or _state.screen,
Reported by Pylint.
Line: 57
Column: 9
global _state
with _LOCK:
state = State(
cwd=cwd or _state.cwd,
screen=screen or _state.screen,
change_id=change_id or _state.change_id,
commit_id=commit_id or _state.commit_id,
preview_id=preview_id or _state.preview_id,
Reported by Pylint.
Line: 1
Column: 1
from dataclasses import dataclass
from os import sep
from pathlib import PurePath
from threading import Lock
from typing import AbstractSet, Optional, Tuple, Union
from uuid import UUID, uuid4
from std2.types import Void, VoidType
Reported by Pylint.
Line: 15
Column: 1
@dataclass(frozen=True)
class State:
cwd: PurePath
screen: Tuple[int, int]
change_id: UUID
commit_id: UUID
preview_id: UUID
Reported by Pylint.
Line: 15
Column: 1
@dataclass(frozen=True)
class State:
cwd: PurePath
screen: Tuple[int, int]
change_id: UUID
commit_id: UUID
preview_id: UUID
Reported by Pylint.
Line: 43
Column: 1
)
def state(
cwd: Optional[PurePath] = None,
screen: Optional[Tuple[int, int]] = None,
change_id: Optional[UUID] = None,
commit_id: Optional[UUID] = None,
preview_id: Optional[UUID] = None,
Reported by Pylint.
Line: 43
Column: 1
)
def state(
cwd: Optional[PurePath] = None,
screen: Optional[Tuple[int, int]] = None,
change_id: Optional[UUID] = None,
commit_id: Optional[UUID] = None,
preview_id: Optional[UUID] = None,
Reported by Pylint.
coq/shared/types.py
11 issues
Line: 1
Column: 1
from dataclasses import dataclass, field
from enum import Enum, auto
from pathlib import PurePath
from typing import Any, Literal, Optional, Sequence, Tuple, Union
from uuid import UUID, uuid4
UTF8 = "UTF-8"
UTF16 = "UTF-16-LE"
Reported by Pylint.
Line: 22
Column: 1
@dataclass(frozen=True)
class Context:
"""
|... line ...|
|... line_before 🐭 line_after ...|
|... <syms_before><words_before>🐭<words_after><syms_after> ...|
"""
Reported by Pylint.
Line: 67
Column: 1
@dataclass(frozen=True)
class Edit:
new_text: str
@dataclass(frozen=True)
class ContextualEdit(Edit):
Reported by Pylint.
Line: 94
Column: 1
@dataclass(frozen=True)
class SnippetEdit(Edit):
grammar: str # ie. LSP, Texmate, Ultisnip, etc
@dataclass(frozen=True)
class Mark:
Reported by Pylint.
Line: 99
Column: 1
@dataclass(frozen=True)
class Mark:
idx: int
begin: NvimPos
end: NvimPos
text: str
Reported by Pylint.
Line: 111
Column: 1
@dataclass(frozen=True)
class Doc:
text: str
syntax: str
class Extern(Enum):
Reported by Pylint.
Line: 116
Column: 1
syntax: str
class Extern(Enum):
lsp = auto()
path = auto()
@dataclass(frozen=True)
Reported by Pylint.
Line: 117
Column: 5
class Extern(Enum):
lsp = auto()
path = auto()
@dataclass(frozen=True)
class Completion:
Reported by Pylint.
Line: 118
Column: 5
class Extern(Enum):
lsp = auto()
path = auto()
@dataclass(frozen=True)
class Completion:
source: str
Reported by Pylint.
Line: 122
Column: 1
@dataclass(frozen=True)
class Completion:
source: str
weight_adjust: float
label: str
sort_by: str
primary_edit: PrimaryEdit
Reported by Pylint.
coq/clients/buffers/worker.py
11 issues
Line: 3
Column: 1
from typing import AsyncIterator
from pynvim_pp.api import list_bufs
from pynvim_pp.lib import async_call, go
from ...databases.buffers.database import BDB
from ...shared.runtime import Supervisor
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import BuffersClient
Reported by Pylint.
Line: 4
Column: 1
from typing import AsyncIterator
from pynvim_pp.api import list_bufs
from pynvim_pp.lib import async_call, go
from ...databases.buffers.database import BDB
from ...shared.runtime import Supervisor
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import BuffersClient
Reported by Pylint.
Line: 6
Column: 1
from pynvim_pp.api import list_bufs
from pynvim_pp.lib import async_call, go
from ...databases.buffers.database import BDB
from ...shared.runtime import Supervisor
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import BuffersClient
from ...shared.types import Completion, Context, Edit
Reported by Pylint.
Line: 7
Column: 1
from pynvim_pp.lib import async_call, go
from ...databases.buffers.database import BDB
from ...shared.runtime import Supervisor
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import BuffersClient
from ...shared.types import Completion, Context, Edit
Reported by Pylint.
Line: 8
Column: 1
from ...databases.buffers.database import BDB
from ...shared.runtime import Supervisor
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import BuffersClient
from ...shared.types import Completion, Context, Edit
class Worker(BaseWorker[BuffersClient, BDB]):
Reported by Pylint.
Line: 9
Column: 1
from ...databases.buffers.database import BDB
from ...shared.runtime import Supervisor
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import BuffersClient
from ...shared.types import Completion, Context, Edit
class Worker(BaseWorker[BuffersClient, BDB]):
def __init__(
Reported by Pylint.
Line: 10
Column: 1
from ...shared.runtime import Supervisor
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import BuffersClient
from ...shared.types import Completion, Context, Edit
class Worker(BaseWorker[BuffersClient, BDB]):
def __init__(
self, supervisor: Supervisor, options: BuffersClient, misc: BDB
Reported by Pylint.
Line: 1
Column: 1
from typing import AsyncIterator
from pynvim_pp.api import list_bufs
from pynvim_pp.lib import async_call, go
from ...databases.buffers.database import BDB
from ...shared.runtime import Supervisor
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import BuffersClient
Reported by Pylint.
Line: 13
Column: 1
from ...shared.types import Completion, Context, Edit
class Worker(BaseWorker[BuffersClient, BDB]):
def __init__(
self, supervisor: Supervisor, options: BuffersClient, misc: BDB
) -> None:
super().__init__(supervisor, options=options, misc=misc)
go(supervisor.nvim, aw=self._poll())
Reported by Pylint.
Line: 13
Column: 1
from ...shared.types import Completion, Context, Edit
class Worker(BaseWorker[BuffersClient, BDB]):
def __init__(
self, supervisor: Supervisor, options: BuffersClient, misc: BDB
) -> None:
super().__init__(supervisor, options=options, misc=misc)
go(supervisor.nvim, aw=self._poll())
Reported by Pylint.
coq/tags/parse.py
11 issues
Line: 5
Column: 1
from json.decoder import JSONDecodeError
from typing import Iterator, Mapping, MutableMapping, MutableSequence, Tuple
from pynvim_pp.logging import log
from std2.asyncio.subprocess import call
from std2.string import removeprefix, removesuffix
from .types import Tag, Tags
Reported by Pylint.
Line: 6
Column: 1
from typing import Iterator, Mapping, MutableMapping, MutableSequence, Tuple
from pynvim_pp.logging import log
from std2.asyncio.subprocess import call
from std2.string import removeprefix, removesuffix
from .types import Tag, Tags
_FIELDS = "".join(
Reported by Pylint.
Line: 7
Column: 1
from pynvim_pp.logging import log
from std2.asyncio.subprocess import call
from std2.string import removeprefix, removesuffix
from .types import Tag, Tags
_FIELDS = "".join(
f"{{{f}}}"
Reported by Pylint.
Line: 9
Column: 1
from std2.asyncio.subprocess import call
from std2.string import removeprefix, removesuffix
from .types import Tag, Tags
_FIELDS = "".join(
f"{{{f}}}"
for f in (
"language",
Reported by Pylint.
Line: 1
Column: 1
from json import loads
from json.decoder import JSONDecodeError
from typing import Iterator, Mapping, MutableMapping, MutableSequence, Tuple
from pynvim_pp.logging import log
from std2.asyncio.subprocess import call
from std2.string import removeprefix, removesuffix
from .types import Tag, Tags
Reported by Pylint.
Line: 29
Column: 1
)
async def run(*args: str) -> str:
if not args:
return ""
else:
try:
proc = await call(
Reported by Pylint.
Line: 30
Column: 5
async def run(*args: str) -> str:
if not args:
return ""
else:
try:
proc = await call(
"ctags",
Reported by Pylint.
Line: 51
Column: 9
def _unescape(pattern: str) -> str:
def cont() -> Iterator[str]:
stripped = removesuffix(removeprefix(pattern[1:-1], "^"), "$").strip()
it = iter(stripped)
for c in it:
if c == "\\":
nc = next(it, "")
if nc in {"/", "\\"}:
yield nc
Reported by Pylint.
Line: 52
Column: 13
def cont() -> Iterator[str]:
stripped = removesuffix(removeprefix(pattern[1:-1], "^"), "$").strip()
it = iter(stripped)
for c in it:
if c == "\\":
nc = next(it, "")
if nc in {"/", "\\"}:
yield nc
else:
Reported by Pylint.
Line: 54
Column: 17
it = iter(stripped)
for c in it:
if c == "\\":
nc = next(it, "")
if nc in {"/", "\\"}:
yield nc
else:
yield c
Reported by Pylint.
coq/snippets/loaders/ultisnip.py
11 issues
Line: 6
Column: 1
from pathlib import Path
from typing import AbstractSet, MutableSequence, MutableSet, Sequence, Tuple
from ..types import ParsedSnippet
from .parse import raise_err
_COMMENT_START = "#"
_EXTENDS_START = "extends"
_SNIPPET_START = "snippet"
Reported by Pylint.
Line: 7
Column: 1
from typing import AbstractSet, MutableSequence, MutableSet, Sequence, Tuple
from ..types import ParsedSnippet
from .parse import raise_err
_COMMENT_START = "#"
_EXTENDS_START = "extends"
_SNIPPET_START = "snippet"
_SNIPPET_END = "endsnippet"
Reported by Pylint.
Line: 1
Column: 1
from enum import Enum, auto
from os import linesep
from pathlib import Path
from typing import AbstractSet, MutableSequence, MutableSet, Sequence, Tuple
from ..types import ParsedSnippet
from .parse import raise_err
_COMMENT_START = "#"
Reported by Pylint.
Line: 26
Column: 5
class _State(Enum):
normal = auto()
snippet = auto()
pglobal = auto()
def _start(line: str) -> Tuple[str, str, MutableSet[str]]:
Reported by Pylint.
Line: 27
Column: 5
class _State(Enum):
normal = auto()
snippet = auto()
pglobal = auto()
def _start(line: str) -> Tuple[str, str, MutableSet[str]]:
rest = line[len(_SNIPPET_START) :].strip()
Reported by Pylint.
Line: 28
Column: 5
class _State(Enum):
normal = auto()
snippet = auto()
pglobal = auto()
def _start(line: str) -> Tuple[str, str, MutableSet[str]]:
rest = line[len(_SNIPPET_START) :].strip()
name, _, label = rest.partition(" ")
Reported by Pylint.
Line: 34
Column: 5
def _start(line: str) -> Tuple[str, str, MutableSet[str]]:
rest = line[len(_SNIPPET_START) :].strip()
name, _, label = rest.partition(" ")
if label.startswith('"') and label[1:].count('"') == 1:
quoted, _, opts = label[1:].partition('"')
options = {*opts.strip()}
return name, quoted, options
else:
return name, label, set()
Reported by Pylint.
Line: 42
Column: 1
return name, label, set()
def parse(path: Path) -> Tuple[AbstractSet[str], Sequence[ParsedSnippet]]:
snippets: MutableSequence[ParsedSnippet] = []
extends: MutableSet[str] = set()
current_name = ""
state = _State.normal
Reported by Pylint.
Line: 42
Column: 1
return name, label, set()
def parse(path: Path) -> Tuple[AbstractSet[str], Sequence[ParsedSnippet]]:
snippets: MutableSequence[ParsedSnippet] = []
extends: MutableSet[str] = set()
current_name = ""
state = _State.normal
Reported by Pylint.
Line: 42
Column: 1
return name, label, set()
def parse(path: Path) -> Tuple[AbstractSet[str], Sequence[ParsedSnippet]]:
snippets: MutableSequence[ParsedSnippet] = []
extends: MutableSet[str] = set()
current_name = ""
state = _State.normal
Reported by Pylint.
coq/tmux/parse.py
10 issues
Line: 5
Column: 1
from dataclasses import dataclass
from typing import AbstractSet, Iterator, Mapping, Optional, Tuple
from std2.asyncio.subprocess import call
from ..shared.parse import coalesce
@dataclass(frozen=True)
Reported by Pylint.
Line: 7
Column: 1
from std2.asyncio.subprocess import call
from ..shared.parse import coalesce
@dataclass(frozen=True)
class _Pane:
uid: str
Reported by Pylint.
Line: 51
Column: 5
for pane in await _panes():
if pane.window_active and pane.pane_active:
return pane
else:
return None
async def _screenshot(
unifying_chars: AbstractSet[str], uid: str
Reported by Pylint.
Line: 87
Column: 5
for pane in await _panes()
)
)
snapshot = {uid: words for uid, words in shots}
return snapshot
Reported by Pylint.
Line: 1
Column: 1
from asyncio import gather
from dataclasses import dataclass
from typing import AbstractSet, Iterator, Mapping, Optional, Tuple
from std2.asyncio.subprocess import call
from ..shared.parse import coalesce
Reported by Pylint.
Line: 30
Column: 9
except FileNotFoundError:
return iter(())
else:
if proc.code:
return iter(())
else:
def cont() -> Iterator[_Pane]:
for line in proc.out.decode().strip().splitlines():
Reported by Pylint.
Line: 47
Column: 1
return cont()
async def cur() -> Optional[_Pane]:
for pane in await _panes():
if pane.window_active and pane.pane_active:
return pane
else:
return None
Reported by Pylint.
Line: 70
Column: 9
except FileNotFoundError:
return uid, iter(())
else:
if proc.code:
return uid, iter(())
else:
words = coalesce(proc.out.decode(), unifying_chars=unifying_chars)
return uid, words
Reported by Pylint.
Line: 77
Column: 1
return uid, words
async def snapshot(unifying_chars: AbstractSet[str]) -> Mapping[str, Iterator[str]]:
shots = await gather(
*(
_screenshot(
unifying_chars=unifying_chars,
uid=pane.uid,
Reported by Pylint.
Line: 87
Column: 1
for pane in await _panes()
)
)
snapshot = {uid: words for uid, words in shots}
return snapshot
Reported by Pylint.
coq/lsp/requests/request.py
10 issues
Line: 6
Column: 1
from itertools import count
from typing import Any, AsyncIterator, MutableMapping, Sequence, Tuple
from pynvim.api.nvim import Nvim
from pynvim_pp.lib import async_call, go
from ...registry import rpc
from ...server.rt_types import Stack
from ...shared.timeit import timeit
Reported by Pylint.
Line: 7
Column: 1
from typing import Any, AsyncIterator, MutableMapping, Sequence, Tuple
from pynvim.api.nvim import Nvim
from pynvim_pp.lib import async_call, go
from ...registry import rpc
from ...server.rt_types import Stack
from ...shared.timeit import timeit
Reported by Pylint.
Line: 9
Column: 1
from pynvim.api.nvim import Nvim
from pynvim_pp.lib import async_call, go
from ...registry import rpc
from ...server.rt_types import Stack
from ...shared.timeit import timeit
_UIDS = count()
_CONDS: MutableMapping[str, Condition] = {}
Reported by Pylint.
Line: 10
Column: 1
from pynvim_pp.lib import async_call, go
from ...registry import rpc
from ...server.rt_types import Stack
from ...shared.timeit import timeit
_UIDS = count()
_CONDS: MutableMapping[str, Condition] = {}
_STATE: MutableMapping[str, Tuple[int, bool, Sequence[Any]]] = defaultdict(
Reported by Pylint.
Line: 11
Column: 1
from ...registry import rpc
from ...server.rt_types import Stack
from ...shared.timeit import timeit
_UIDS = count()
_CONDS: MutableMapping[str, Condition] = {}
_STATE: MutableMapping[str, Tuple[int, bool, Sequence[Any]]] = defaultdict(
lambda: (-1, True, ())
Reported by Pylint.
Line: 22
Column: 17
@rpc(blocking=False)
def _lsp_notify(
nvim: Nvim, stack: Stack, method: str, ses: int, done: bool, reply: Any
) -> None:
async def cont() -> None:
cond = _CONDS.setdefault(method, Condition())
session, _, acc = _STATE[method]
if ses == session:
Reported by Pylint.
Line: 1
Column: 1
from asyncio import Condition
from collections import defaultdict
from itertools import count
from typing import Any, AsyncIterator, MutableMapping, Sequence, Tuple
from pynvim.api.nvim import Nvim
from pynvim_pp.lib import async_call, go
from ...registry import rpc
Reported by Pylint.
Line: 21
Column: 1
@rpc(blocking=False)
def _lsp_notify(
nvim: Nvim, stack: Stack, method: str, ses: int, done: bool, reply: Any
) -> None:
async def cont() -> None:
cond = _CONDS.setdefault(method, Condition())
session, _, acc = _STATE[method]
Reported by Pylint.
Line: 35
Column: 1
go(nvim, aw=cont())
async def async_request(nvim: Nvim, method: str, *args: Any) -> AsyncIterator[Any]:
with timeit(f"LSP :: {method}"):
session, done = next(_UIDS), False
cond = _CONDS.setdefault(method, Condition())
_STATE[method] = (session, done, ())
Reported by Pylint.
Line: 52
Column: 21
while True:
ses, done, acc = _STATE[method]
if ses == session:
for a in acc:
yield a
if done:
break
elif ses > session:
break
Reported by Pylint.
coq/shared/executor.py
9 issues
Line: 25
Column: 20
def cont() -> None:
try:
ret = f(*args, **kwargs)
except Exception as e:
with suppress(InvalidStateError):
fut.set_exception(e)
else:
with suppress(InvalidStateError):
fut.set_result(ret)
Reported by Pylint.
Line: 1
Column: 1
from concurrent.futures import Executor, Future, InvalidStateError
from contextlib import suppress
from queue import SimpleQueue
from typing import Any, Callable, TypeVar, cast
T = TypeVar("T")
class SingleThreadExecutor:
Reported by Pylint.
Line: 6
Column: 1
from queue import SimpleQueue
from typing import Any, Callable, TypeVar, cast
T = TypeVar("T")
class SingleThreadExecutor:
def __init__(self, pool: Executor) -> None:
self._q: SimpleQueue = SimpleQueue()
Reported by Pylint.
Line: 9
Column: 1
T = TypeVar("T")
class SingleThreadExecutor:
def __init__(self, pool: Executor) -> None:
self._q: SimpleQueue = SimpleQueue()
pool.submit(self._forever)
def _forever(self) -> None:
Reported by Pylint.
Line: 9
Column: 1
T = TypeVar("T")
class SingleThreadExecutor:
def __init__(self, pool: Executor) -> None:
self._q: SimpleQueue = SimpleQueue()
pool.submit(self._forever)
def _forever(self) -> None:
Reported by Pylint.
Line: 16
Column: 13
def _forever(self) -> None:
while True:
f = self._q.get()
f()
def submit(self, f: Callable[..., T], *args: Any, **kwargs: Any) -> T:
fut: Future = Future()
Reported by Pylint.
Line: 19
Column: 5
f = self._q.get()
f()
def submit(self, f: Callable[..., T], *args: Any, **kwargs: Any) -> T:
fut: Future = Future()
def cont() -> None:
try:
ret = f(*args, **kwargs)
Reported by Pylint.
Line: 19
Column: 5
f = self._q.get()
f()
def submit(self, f: Callable[..., T], *args: Any, **kwargs: Any) -> T:
fut: Future = Future()
def cont() -> None:
try:
ret = f(*args, **kwargs)
Reported by Pylint.
Line: 25
Column: 13
def cont() -> None:
try:
ret = f(*args, **kwargs)
except Exception as e:
with suppress(InvalidStateError):
fut.set_exception(e)
else:
with suppress(InvalidStateError):
fut.set_result(ret)
Reported by Pylint.
coq/paths/show.py
9 issues
Line: 9
Column: 1
from pathlib import Path, PurePath
from typing import Iterator, Optional
from std2.asyncio import run_in_executor
from ..lang import LANG
from ..shared.types import Doc
_KB = 1000
Reported by Pylint.
Line: 11
Column: 1
from std2.asyncio import run_in_executor
from ..lang import LANG
from ..shared.types import Doc
_KB = 1000
_HOME = Path.home()
Reported by Pylint.
Line: 12
Column: 1
from std2.asyncio import run_in_executor
from ..lang import LANG
from ..shared.types import Doc
_KB = 1000
_HOME = Path.home()
Reported by Pylint.
Line: 1
Column: 1
from contextlib import suppress
from itertools import islice
from locale import strxfrm
from os import linesep, sep
from os.path import normcase
from pathlib import Path, PurePath
from typing import Iterator, Optional
from std2.asyncio import run_in_executor
Reported by Pylint.
Line: 18
Column: 1
_HOME = Path.home()
def show_path(cwd: PurePath, path: PurePath, is_dir: bool) -> str:
posfix = sep if is_dir else ""
with suppress(ValueError):
rel = path.relative_to(cwd)
return f".{sep}{normcase(rel)}{posfix}"
Reported by Pylint.
Line: 50
Column: 32
async def _show_file(path: Path, ellipsis: str, height: int) -> Doc:
def lines() -> Iterator[str]:
with path.open("r") as fd:
lines = fd.readlines(_KB)
lit = islice((line.rstrip() for line in lines), height)
for idx, line in enumerate(lit, start=1):
if idx >= height and len(lines) > height:
yield ellipsis
Reported by Pylint.
Line: 65
Column: 9
except UnicodeDecodeError:
text = LANG("file binary")
t = text or LANG("file empty")
doc = Doc(text=t, syntax="")
return doc
return await run_in_executor(cont)
Reported by Pylint.
Line: 72
Column: 1
return await run_in_executor(cont)
async def show(cwd: PurePath, path: Path, ellipsis: str, height: int) -> Optional[Doc]:
try:
if path.is_dir():
return await _show_dir(cwd, path=path, ellipsis=ellipsis, height=height)
elif path.is_file():
return await _show_file(path, ellipsis=ellipsis, height=height)
Reported by Pylint.
Line: 74
Column: 9
async def show(cwd: PurePath, path: Path, ellipsis: str, height: int) -> Optional[Doc]:
try:
if path.is_dir():
return await _show_dir(cwd, path=path, ellipsis=ellipsis, height=height)
elif path.is_file():
return await _show_file(path, ellipsis=ellipsis, height=height)
else:
return None
Reported by Pylint.