The following issues were found

coq/shared/executor.py
9 issues
Catching too general exception Exception
Error

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.

Missing module docstring
Error

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.

Class name "T" doesn't conform to PascalCase naming style
Error

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.

Missing class docstring
Error

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.

Too few public methods (1/2)
Error

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.

Variable name "f" doesn't conform to snake_case naming style
Error

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.

Missing function or method docstring
Error

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.

Argument name "f" doesn't conform to snake_case naming style
Error

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.

Variable name "e" doesn't conform to snake_case naming style
Error

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
Unable to import 'std2.asyncio'
Error

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.

Attempted relative import beyond top-level package
Error

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.

Attempted relative import beyond top-level package
Error

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.

Missing module docstring
Error

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.

Missing function or method docstring
Error

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.

Variable name "fd" doesn't conform to snake_case naming style
Error

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.

Variable name "t" doesn't conform to snake_case naming style
Error

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.

Missing function or method docstring
Error

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.

Unnecessary "elif" after "return"
Error

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.

tests/server/reviewer.py
9 issues
Attempted relative import beyond top-level package
Error

Line: 4 Column: 1

              from random import uniform
from unittest import TestCase

from ...coq.server.reviewer import sigmoid


class Sigmoid(TestCase):
    def test_1(self) -> None:
        y = sigmoid(0)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from random import uniform
from unittest import TestCase

from ...coq.server.reviewer import sigmoid


class Sigmoid(TestCase):
    def test_1(self) -> None:
        y = sigmoid(0)

            

Reported by Pylint.

Missing class docstring
Error

Line: 7 Column: 1

              from ...coq.server.reviewer import sigmoid


class Sigmoid(TestCase):
    def test_1(self) -> None:
        y = sigmoid(0)
        self.assertEqual(y, 1)

    def test_2(self) -> None:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 8 Column: 5

              

class Sigmoid(TestCase):
    def test_1(self) -> None:
        y = sigmoid(0)
        self.assertEqual(y, 1)

    def test_2(self) -> None:
        for _ in range(0, 10000):

            

Reported by Pylint.

Variable name "y" doesn't conform to snake_case naming style
Error

Line: 9 Column: 9

              
class Sigmoid(TestCase):
    def test_1(self) -> None:
        y = sigmoid(0)
        self.assertEqual(y, 1)

    def test_2(self) -> None:
        for _ in range(0, 10000):
            y = sigmoid(uniform(-10, 10))

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 12 Column: 5

                      y = sigmoid(0)
        self.assertEqual(y, 1)

    def test_2(self) -> None:
        for _ in range(0, 10000):
            y = sigmoid(uniform(-10, 10))
            self.assertTrue(y >= 0.5 and y <= 1.5)

            

Reported by Pylint.

Variable name "y" doesn't conform to snake_case naming style
Error

Line: 14 Column: 13

              
    def test_2(self) -> None:
        for _ in range(0, 10000):
            y = sigmoid(uniform(-10, 10))
            self.assertTrue(y >= 0.5 and y <= 1.5)

            

Reported by Pylint.

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Security blacklist

Line: 14
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b311-random

              
    def test_2(self) -> None:
        for _ in range(0, 10000):
            y = sigmoid(uniform(-10, 10))
            self.assertTrue(y >= 0.5 and y <= 1.5)

            

Reported by Bandit.

Simplify chained comparison between the operands
Error

Line: 15 Column: 29

                  def test_2(self) -> None:
        for _ in range(0, 10000):
            y = sigmoid(uniform(-10, 10))
            self.assertTrue(y >= 0.5 and y <= 1.5)

            

Reported by Pylint.

coq/shared/timeit.py
9 issues
Unable to import 'pynvim_pp.logging'
Error

Line: 4 Column: 1

              from contextlib import contextmanager
from typing import Any, Iterator, MutableMapping, Optional, Tuple

from pynvim_pp.logging import log
from std2.locale import si_prefixed_smol
from std2.timeit import timeit as _timeit

from ..consts import DEBUG


            

Reported by Pylint.

Unable to import 'std2.locale'
Error

Line: 5 Column: 1

              from typing import Any, Iterator, MutableMapping, Optional, Tuple

from pynvim_pp.logging import log
from std2.locale import si_prefixed_smol
from std2.timeit import timeit as _timeit

from ..consts import DEBUG

_RECORDS: MutableMapping[str, Tuple[int, float]] = {}

            

Reported by Pylint.

Unable to import 'std2.timeit'
Error

Line: 6 Column: 1

              
from pynvim_pp.logging import log
from std2.locale import si_prefixed_smol
from std2.timeit import timeit as _timeit

from ..consts import DEBUG

_RECORDS: MutableMapping[str, Tuple[int, float]] = {}


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 8 Column: 1

              from std2.locale import si_prefixed_smol
from std2.timeit import timeit as _timeit

from ..consts import DEBUG

_RECORDS: MutableMapping[str, Tuple[int, float]] = {}


@contextmanager

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from contextlib import contextmanager
from typing import Any, Iterator, MutableMapping, Optional, Tuple

from pynvim_pp.logging import log
from std2.locale import si_prefixed_smol
from std2.timeit import timeit as _timeit

from ..consts import DEBUG


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 14 Column: 1

              

@contextmanager
def timeit(
    name: str, *args: Any, force: bool = False, warn: Optional[float] = None
) -> Iterator[None]:
    if DEBUG or force or warn is not None:
        with _timeit() as t:
            yield None

            

Reported by Pylint.

Variable name "t" doesn't conform to snake_case naming style
Error

Line: 18 Column: 27

                  name: str, *args: Any, force: bool = False, warn: Optional[float] = None
) -> Iterator[None]:
    if DEBUG or force or warn is not None:
        with _timeit() as t:
            yield None
        delta = t()
        if DEBUG or delta >= (warn or 0):
            times, cum = _RECORDS.get(name, (0, 0))
            tt, c = times + 1, cum + delta

            

Reported by Pylint.

Variable name "c" doesn't conform to snake_case naming style
Error

Line: 23 Column: 17

                      delta = t()
        if DEBUG or delta >= (warn or 0):
            times, cum = _RECORDS.get(name, (0, 0))
            tt, c = times + 1, cum + delta
            _RECORDS[name] = tt, c

            label = name.ljust(50)
            time = f"{si_prefixed_smol(delta, precision=0)}s".ljust(8)
            ttime = f"{si_prefixed_smol(c / tt, precision=0)}s".ljust(8)

            

Reported by Pylint.

Variable name "tt" doesn't conform to snake_case naming style
Error

Line: 23 Column: 13

                      delta = t()
        if DEBUG or delta >= (warn or 0):
            times, cum = _RECORDS.get(name, (0, 0))
            tt, c = times + 1, cum + delta
            _RECORDS[name] = tt, c

            label = name.ljust(50)
            time = f"{si_prefixed_smol(delta, precision=0)}s".ljust(8)
            ttime = f"{si_prefixed_smol(c / tt, precision=0)}s".ljust(8)

            

Reported by Pylint.

coq/lsp/requests/preview.py
9 issues
Unable to import 'pynvim'
Error

Line: 4 Column: 1

              from pathlib import Path
from typing import Optional, cast

from pynvim import Nvim

from ...lsp.types import CompletionItem
from ...registry import atomic
from ..parse import parse_item
from ..types import Completion

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 6 Column: 1

              
from pynvim import Nvim

from ...lsp.types import CompletionItem
from ...registry import atomic
from ..parse import parse_item
from ..types import Completion
from .request import async_request


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 7 Column: 1

              from pynvim import Nvim

from ...lsp.types import CompletionItem
from ...registry import atomic
from ..parse import parse_item
from ..types import Completion
from .request import async_request

_LUA = (Path(__file__).resolve().parent / "preview.lua").read_text("UTF-8")

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 8 Column: 1

              
from ...lsp.types import CompletionItem
from ...registry import atomic
from ..parse import parse_item
from ..types import Completion
from .request import async_request

_LUA = (Path(__file__).resolve().parent / "preview.lua").read_text("UTF-8")


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 9 Column: 1

              from ...lsp.types import CompletionItem
from ...registry import atomic
from ..parse import parse_item
from ..types import Completion
from .request import async_request

_LUA = (Path(__file__).resolve().parent / "preview.lua").read_text("UTF-8")

atomic.exec_lua(_LUA, ())

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 10 Column: 1

              from ...registry import atomic
from ..parse import parse_item
from ..types import Completion
from .request import async_request

_LUA = (Path(__file__).resolve().parent / "preview.lua").read_text("UTF-8")

atomic.exec_lua(_LUA, ())


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from pathlib import Path
from typing import Optional, cast

from pynvim import Nvim

from ...lsp.types import CompletionItem
from ...registry import atomic
from ..parse import parse_item
from ..types import Completion

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 17 Column: 1

              atomic.exec_lua(_LUA, ())


async def request(nvim: Nvim, item: CompletionItem) -> Optional[Completion]:
    stream = async_request(nvim, "COQlsp_preview", item)
    async for reply in stream:
        if reply:
            break
    else:

            

Reported by Pylint.

Unnecessary "else" after "return"
Error

Line: 25 Column: 5

                  else:
        reply = None

    if reply:
        resp = cast(CompletionItem, reply)
        return parse_item("", weight_adjust=0, item=resp)
    else:
        return None

            

Reported by Pylint.

coq/clients/snippet/worker.py
8 issues
Attempted relative import beyond top-level package
Error

Line: 3 Column: 1

              from typing import AsyncIterator

from ...databases.snippets.database import SDB
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import SnippetClient
from ...shared.types import Completion, Context, Doc, SnippetEdit


class Worker(BaseWorker[SnippetClient, SDB]):

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 4 Column: 1

              from typing import AsyncIterator

from ...databases.snippets.database import SDB
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import SnippetClient
from ...shared.types import Completion, Context, Doc, SnippetEdit


class Worker(BaseWorker[SnippetClient, SDB]):

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 5 Column: 1

              
from ...databases.snippets.database import SDB
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import SnippetClient
from ...shared.types import Completion, Context, Doc, SnippetEdit


class Worker(BaseWorker[SnippetClient, SDB]):
    async def work(self, context: Context) -> AsyncIterator[Completion]:

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 6 Column: 1

              from ...databases.snippets.database import SDB
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import SnippetClient
from ...shared.types import Completion, Context, Doc, SnippetEdit


class Worker(BaseWorker[SnippetClient, SDB]):
    async def work(self, context: Context) -> AsyncIterator[Completion]:
        match = context.words or context.syms

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from typing import AsyncIterator

from ...databases.snippets.database import SDB
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import SnippetClient
from ...shared.types import Completion, Context, Doc, SnippetEdit


class Worker(BaseWorker[SnippetClient, SDB]):

            

Reported by Pylint.

Missing class docstring
Error

Line: 9 Column: 1

              from ...shared.types import Completion, Context, Doc, SnippetEdit


class Worker(BaseWorker[SnippetClient, SDB]):
    async def work(self, context: Context) -> AsyncIterator[Completion]:
        match = context.words or context.syms
        snippets = await self._misc.select(
            self._supervisor.options,
            filetype=context.filetype,

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 9 Column: 1

              from ...shared.types import Completion, Context, Doc, SnippetEdit


class Worker(BaseWorker[SnippetClient, SDB]):
    async def work(self, context: Context) -> AsyncIterator[Completion]:
        match = context.words or context.syms
        snippets = await self._misc.select(
            self._supervisor.options,
            filetype=context.filetype,

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 10 Column: 5

              

class Worker(BaseWorker[SnippetClient, SDB]):
    async def work(self, context: Context) -> AsyncIterator[Completion]:
        match = context.words or context.syms
        snippets = await self._misc.select(
            self._supervisor.options,
            filetype=context.filetype,
            word=match,

            

Reported by Pylint.

coq/databases/insertions/sql/create/tables.sql
8 issues
Syntax error at or near "rowid"
Syntax error

Line: 6 Column: 11

              
CREATE TABLE IF NOT EXISTS sources (
  name TEXT NOT NULL PRIMARY KEY
) WITHOUT ROWID;


CREATE TABLE IF NOT EXISTS batches (
  rowid BLOB NOT NULL PRIMARY KEY
) WITHOUT rowid;

            

Reported by SQLint.

Syntax error at or near "rowid"
Syntax error

Line: 11 Column: 11

              
CREATE TABLE IF NOT EXISTS batches (
  rowid BLOB NOT NULL PRIMARY KEY
) WITHOUT rowid;


CREATE TABLE IF NOT EXISTS instances (
  rowid     BLOB NOT NULL PRIMARY KEY,
  source_id TEXT NOT NULL REFERENCES sources (name)  ON UPDATE CASCADE ON DELETE CASCADE,

            

Reported by SQLint.

Syntax error at or near "rowid"
Syntax error

Line: 19 Column: 11

                source_id TEXT NOT NULL REFERENCES sources (name)  ON UPDATE CASCADE ON DELETE CASCADE,
  batch_id  BLOB NOT NULL REFERENCES batches (rowid) ON UPDATE CASCADE ON DELETE CASCADE,
  UNIQUE(batch_id, source_id)
) WITHOUT rowid;
CREATE INDEX IF NOT EXISTS instances_batch_id  ON instances (batch_id);
CREATE INDEX IF NOT EXISTS instances_source_id ON instances (source_id);


CREATE TABLE IF NOT EXISTS instance_stats (

            

Reported by SQLint.

Syntax error at or near "autoincrement"
Syntax error

Line: 34 Column: 44

              

CREATE TABLE IF NOT EXISTS inserted (
  rowid       INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  instance_id BLOB    NOT NULL REFERENCES instances (rowid) ON UPDATE CASCADE ON DELETE CASCADE,
  sort_by     TEXT    NOT NULL
);
CREATE INDEX IF NOT EXISTS inserted_instance_id ON inserted (instance_id);
CREATE INDEX IF NOT EXISTS inserted_sort_by     ON inserted (sort_by);

            

Reported by SQLint.

Syntax error at or near "not"
Syntax error

Line: 47 Column: 16

              --


CREATE VIEW IF NOT EXISTS instance_stats_view AS
SELECT
  instances.source_id                     AS source,
  COALESCE(instance_stats.interrupted, 1) AS interrupted,
  instance_stats.duration                 AS duration,
  COALESCE(instance_stats.items, 0)       AS items

            

Reported by SQLint.

Syntax error at or near "not"
Syntax error

Line: 59 Column: 16

                instance_stats.instance_id = instances.rowid;


CREATE VIEW IF NOT EXISTS stats_quantiles_view AS
SELECT
  source                                                 AS source,
  COALESCE(SUM(interrupted), 0)                          AS interrupted,
  COALESCE(AVG(duration), 0)                             AS avg_duration,
  COALESCE(X_QUANTILES(duration, 0, 0.5, 0.95, 1), '{}') AS q_duration,

            

Reported by SQLint.

Syntax error at or near "not"
Syntax error

Line: 72 Column: 16

                source;


CREATE VIEW IF NOT EXISTS stats_inserted_view AS
SELECT
  instances.source_id   AS source,
  COUNT(inserted.rowid) AS inserted
FROM instances
LEFT JOIN inserted

            

Reported by SQLint.

Syntax error at or near "not"
Syntax error

Line: 84 Column: 16

                instances.source_id;


CREATE VIEW IF NOT EXISTS stats_view AS
SELECT
  sources.name                                    AS source,
  COALESCE(stats_quantiles_view.interrupted, 0)   AS interrupted,
  COALESCE(stats_quantiles_view.avg_items, 0)     AS avg_items,
  COALESCE(stats_quantiles_view.q_items, '{}')    AS q_items,

            

Reported by SQLint.

coq/shared/trans.py
8 issues
Attempted relative import beyond top-level package
Error

Line: 4 Column: 1

              from itertools import accumulate
from typing import AbstractSet

from .parse import coalesce, is_word, lower
from .types import Context, ContextualEdit, Edit


def _match(lhs: bool, existing: str, insertion: str) -> str:
    existing, insertion = lower(existing), lower(insertion)

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 5 Column: 1

              from typing import AbstractSet

from .parse import coalesce, is_word, lower
from .types import Context, ContextualEdit, Edit


def _match(lhs: bool, existing: str, insertion: str) -> str:
    existing, insertion = lower(existing), lower(insertion)
    if lhs:

            

Reported by Pylint.

Else clause on loop without a break statement
Error

Line: 14 Column: 9

                      for match in reversed(tuple(accumulate(insertion))):
            if match == existing[-len(match) :]:
                return match
        else:
            return ""
    else:
        for match in reversed(tuple(accumulate(reversed(insertion)))):
            if match == existing[: len(match) :]:
                return match

            

Reported by Pylint.

Else clause on loop without a break statement
Error

Line: 20 Column: 9

                      for match in reversed(tuple(accumulate(reversed(insertion)))):
            if match == existing[: len(match) :]:
                return match
        else:
            return ""


def trans(line_before: str, line_after: str, edit: Edit) -> ContextualEdit:
    l_match = _match(True, existing=line_before, insertion=edit.new_text)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from itertools import accumulate
from typing import AbstractSet

from .parse import coalesce, is_word, lower
from .types import Context, ContextualEdit, Edit


def _match(lhs: bool, existing: str, insertion: str) -> str:
    existing, insertion = lower(existing), lower(insertion)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 24 Column: 1

                          return ""


def trans(line_before: str, line_after: str, edit: Edit) -> ContextualEdit:
    l_match = _match(True, existing=line_before, insertion=edit.new_text)
    rest = edit.new_text[len(l_match) :]
    r_match = _match(False, existing=line_after, insertion=rest)
    c_edit = ContextualEdit(
        new_text=edit.new_text,

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 37 Column: 1

                  return c_edit


def trans_adjusted(
    unifying_chars: AbstractSet[str], ctx: Context, edit: Edit
) -> ContextualEdit:
    c_edit = trans(line_before=ctx.line_before, line_after=ctx.line_after, edit=edit)
    new_syms = len(tuple(coalesce(edit.new_text, unifying_chars=unifying_chars)))
    simple_before = (

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 65 Column: 1

                  return adjusted


def expand_tabs(context: Context, text: str) -> str:
    new_text = (
        text.expandtabs(context.tabstop)
        if context.expandtab
        else text.replace(" " * context.tabstop, "\t")
    )

            

Reported by Pylint.

coq/clients/cache/worker.py
8 issues
Attempted relative import beyond top-level package
Error

Line: 5 Column: 1

              from typing import Awaitable, Callable, Iterator, MutableMapping, Sequence, Tuple
from uuid import UUID, uuid4

from ...shared.runtime import Supervisor
from ...shared.timeit import timeit
from ...shared.types import Completion, Context, Edit, SnippetEdit
from .database import Database



            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 6 Column: 1

              from uuid import UUID, uuid4

from ...shared.runtime import Supervisor
from ...shared.timeit import timeit
from ...shared.types import Completion, Context, Edit, SnippetEdit
from .database import Database


@dataclass(frozen=True)

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 7 Column: 1

              
from ...shared.runtime import Supervisor
from ...shared.timeit import timeit
from ...shared.types import Completion, Context, Edit, SnippetEdit
from .database import Database


@dataclass(frozen=True)
class _CacheCtx:

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 8 Column: 1

              from ...shared.runtime import Supervisor
from ...shared.timeit import timeit
from ...shared.types import Completion, Context, Edit, SnippetEdit
from .database import Database


@dataclass(frozen=True)
class _CacheCtx:
    change_id: UUID

            

Reported by Pylint.

Redefining built-in 'set'
Error

Line: 86 Column: 9

                              comps = (self._cached.get(sort_by) for sort_by in words)
                return (c for c in comps if c)

        async def set(completions: Sequence[Completion]) -> None:
            new_comps = {c.sort_by: c for c in map(_trans, completions)}
            await self._db.insert(new_comps.keys())
            self._cached.update(new_comps)

        return use_cache, get(), set

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from dataclasses import dataclass, replace
from typing import Awaitable, Callable, Iterator, MutableMapping, Sequence, Tuple
from uuid import UUID, uuid4

from ...shared.runtime import Supervisor
from ...shared.timeit import timeit
from ...shared.types import Completion, Context, Edit, SnippetEdit
from .database import Database


            

Reported by Pylint.

Missing class docstring
Error

Line: 41 Column: 1

                  return replace(comp, primary_edit=edit, secondary_edits=())


class CacheWorker:
    def __init__(self, supervisor: Supervisor) -> None:
        self._soup = supervisor
        self._db = Database(supervisor.pool)
        self._cache_ctx = _CacheCtx(
            change_id=uuid4(),

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 41 Column: 1

                  return replace(comp, primary_edit=edit, secondary_edits=())


class CacheWorker:
    def __init__(self, supervisor: Supervisor) -> None:
        self._soup = supervisor
        self._db = Database(supervisor.pool)
        self._cache_ctx = _CacheCtx(
            change_id=uuid4(),

            

Reported by Pylint.

coq/snippets/loaders/neosnippet.py
8 issues
Attempted relative import beyond top-level package
Error

Line: 8 Column: 1

              from textwrap import dedent
from typing import AbstractSet, MutableSequence, MutableSet, Sequence, Tuple

from ..types import ParsedSnippet
from .parse import raise_err

_COMMENT_START = "#"
_EXTENDS_START = "extends"
_INCLUDES_START = "include"

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 9 Column: 1

              from typing import AbstractSet, MutableSequence, MutableSet, Sequence, Tuple

from ..types import ParsedSnippet
from .parse import raise_err

_COMMENT_START = "#"
_EXTENDS_START = "extends"
_INCLUDES_START = "include"
_SNIPPET_START = "snippet"

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from os import linesep
from os.path import splitext
from pathlib import Path
from string import whitespace
from textwrap import dedent
from typing import AbstractSet, MutableSequence, MutableSet, Sequence, Tuple

from ..types import ParsedSnippet
from .parse import raise_err

            

Reported by Pylint.

Unnecessary "else" after "return"
Error

Line: 25 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().split(" ")}
        return name, quoted, options
    else:
        return name, label, set()

            

Reported by Pylint.

Too many branches (14/12)
Error

Line: 33 Column: 1

                      return name, label, set()


def parse(path: Path) -> Tuple[AbstractSet[str], Sequence[ParsedSnippet]]:
    snippets: MutableSequence[ParsedSnippet] = []
    extends: MutableSet[str] = set()

    current_name = ""
    current_label: str = ""

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 33 Column: 1

                      return name, label, set()


def parse(path: Path) -> Tuple[AbstractSet[str], Sequence[ParsedSnippet]]:
    snippets: MutableSequence[ParsedSnippet] = []
    extends: MutableSet[str] = set()

    current_name = ""
    current_label: str = ""

            

Reported by Pylint.

Too many local variables (18/15)
Error

Line: 33 Column: 1

                      return name, label, set()


def parse(path: Path) -> Tuple[AbstractSet[str], Sequence[ParsedSnippet]]:
    snippets: MutableSequence[ParsedSnippet] = []
    extends: MutableSet[str] = set()

    current_name = ""
    current_label: str = ""

            

Reported by Pylint.

Variable name "ft" doesn't conform to snake_case naming style
Error

Line: 72 Column: 13

                              extends.add(filetype.strip())

        elif line.startswith(_INCLUDES_START):
            ft = line[len(_INCLUDES_START) :].strip()
            filetype, _ = splitext(ft)
            extends.add(filetype)

        elif line.startswith(_SNIPPET_START):
            push()

            

Reported by Pylint.