The following issues were found

coq/clients/t9/worker.py
22 issues
Unable to import 'pynvim_pp.lib'
Error

Line: 13 Column: 1

              from subprocess import DEVNULL, PIPE
from typing import Any, AsyncIterator, Iterator, Optional, Tuple

from pynvim_pp.lib import awrite, go
from pynvim_pp.logging import log
from std2.pickle import DecodeError, new_decoder, new_encoder

from ...lang import LANG
from ...shared.runtime import Supervisor

            

Reported by Pylint.

Unable to import 'pynvim_pp.logging'
Error

Line: 14 Column: 1

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

from pynvim_pp.lib import awrite, go
from pynvim_pp.logging import log
from std2.pickle import DecodeError, new_decoder, new_encoder

from ...lang import LANG
from ...shared.runtime import Supervisor
from ...shared.runtime import Worker as BaseWorker

            

Reported by Pylint.

Unable to import 'std2.pickle'
Error

Line: 15 Column: 1

              
from pynvim_pp.lib import awrite, go
from pynvim_pp.logging import log
from std2.pickle import DecodeError, new_decoder, new_encoder

from ...lang import LANG
from ...shared.runtime import Supervisor
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import BaseClient, Options

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 17 Column: 1

              from pynvim_pp.logging import log
from std2.pickle import DecodeError, new_decoder, new_encoder

from ...lang import LANG
from ...shared.runtime import Supervisor
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import BaseClient, Options
from ...shared.types import Completion, Context, ContextualEdit
from .install import T9_BIN, ensure_updated

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 18 Column: 1

              from std2.pickle import DecodeError, new_decoder, new_encoder

from ...lang import LANG
from ...shared.runtime import Supervisor
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import BaseClient, Options
from ...shared.types import Completion, Context, ContextualEdit
from .install import T9_BIN, ensure_updated
from .types import ReqL1, ReqL2, Request, Response

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 19 Column: 1

              
from ...lang import LANG
from ...shared.runtime import Supervisor
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import BaseClient, Options
from ...shared.types import Completion, Context, ContextualEdit
from .install import T9_BIN, ensure_updated
from .types import ReqL1, ReqL2, Request, Response


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 20 Column: 1

              from ...lang import LANG
from ...shared.runtime import Supervisor
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import BaseClient, Options
from ...shared.types import Completion, Context, ContextualEdit
from .install import T9_BIN, ensure_updated
from .types import ReqL1, ReqL2, Request, Response

_VERSION = "3.2.28"

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 21 Column: 1

              from ...shared.runtime import Supervisor
from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import BaseClient, Options
from ...shared.types import Completion, Context, ContextualEdit
from .install import T9_BIN, ensure_updated
from .types import ReqL1, ReqL2, Request, Response

_VERSION = "3.2.28"


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 22 Column: 1

              from ...shared.runtime import Worker as BaseWorker
from ...shared.settings import BaseClient, Options
from ...shared.types import Completion, Context, ContextualEdit
from .install import T9_BIN, ensure_updated
from .types import ReqL1, ReqL2, Request, Response

_VERSION = "3.2.28"

_DECODER = new_decoder(Response, strict=False)

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 23 Column: 1

              from ...shared.settings import BaseClient, Options
from ...shared.types import Completion, Context, ContextualEdit
from .install import T9_BIN, ensure_updated
from .types import ReqL1, ReqL2, Request, Response

_VERSION = "3.2.28"

_DECODER = new_decoder(Response, strict=False)
_ENCODER = new_encoder(Request)

            

Reported by Pylint.

coq/server/context.py
21 issues
Unable to import 'pynvim'
Error

Line: 5 Column: 1

              from os import linesep
from typing import Literal, Tuple, cast

from pynvim import Nvim
from pynvim.api import Buffer
from pynvim_pp.api import LFfmt, buf_get_lines
from pynvim_pp.atomic import Atomic
from pynvim_pp.text_object import gen_split


            

Reported by Pylint.

Unable to import 'pynvim.api'
Error

Line: 6 Column: 1

              from typing import Literal, Tuple, cast

from pynvim import Nvim
from pynvim.api import Buffer
from pynvim_pp.api import LFfmt, buf_get_lines
from pynvim_pp.atomic import Atomic
from pynvim_pp.text_object import gen_split

from ..consts import DEBUG

            

Reported by Pylint.

Unable to import 'pynvim_pp.api'
Error

Line: 7 Column: 1

              
from pynvim import Nvim
from pynvim.api import Buffer
from pynvim_pp.api import LFfmt, buf_get_lines
from pynvim_pp.atomic import Atomic
from pynvim_pp.text_object import gen_split

from ..consts import DEBUG
from ..databases.buffers.database import BDB

            

Reported by Pylint.

Unable to import 'pynvim_pp.atomic'
Error

Line: 8 Column: 1

              from pynvim import Nvim
from pynvim.api import Buffer
from pynvim_pp.api import LFfmt, buf_get_lines
from pynvim_pp.atomic import Atomic
from pynvim_pp.text_object import gen_split

from ..consts import DEBUG
from ..databases.buffers.database import BDB
from ..shared.settings import Options

            

Reported by Pylint.

Unable to import 'pynvim_pp.text_object'
Error

Line: 9 Column: 1

              from pynvim.api import Buffer
from pynvim_pp.api import LFfmt, buf_get_lines
from pynvim_pp.atomic import Atomic
from pynvim_pp.text_object import gen_split

from ..consts import DEBUG
from ..databases.buffers.database import BDB
from ..shared.settings import Options
from ..shared.types import Context

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 11 Column: 1

              from pynvim_pp.atomic import Atomic
from pynvim_pp.text_object import gen_split

from ..consts import DEBUG
from ..databases.buffers.database import BDB
from ..shared.settings import Options
from ..shared.types import Context
from .state import State


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 12 Column: 1

              from pynvim_pp.text_object import gen_split

from ..consts import DEBUG
from ..databases.buffers.database import BDB
from ..shared.settings import Options
from ..shared.types import Context
from .state import State



            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 13 Column: 1

              
from ..consts import DEBUG
from ..databases.buffers.database import BDB
from ..shared.settings import Options
from ..shared.types import Context
from .state import State


def context(

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 14 Column: 1

              from ..consts import DEBUG
from ..databases.buffers.database import BDB
from ..shared.settings import Options
from ..shared.types import Context
from .state import State


def context(
    nvim: Nvim, db: BDB, options: Options, state: State, manual: bool

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 15 Column: 1

              from ..databases.buffers.database import BDB
from ..shared.settings import Options
from ..shared.types import Context
from .state import State


def context(
    nvim: Nvim, db: BDB, options: Options, state: State, manual: bool
) -> Context:

            

Reported by Pylint.

coq/server/registrants/stats.py
21 issues
Unable to import 'pynvim'
Error

Line: 7 Column: 1

              from string import Template
from typing import Iterable, Iterator, Mapping, Sequence, Tuple

from pynvim import Nvim
from pynvim_pp.api import buf_set_lines, buf_set_option, create_buf, win_close
from pynvim_pp.float_win import list_floatwins, open_float_win
from std2.locale import si_prefixed_smol

from ...consts import MD_STATS

            

Reported by Pylint.

Unable to import 'pynvim_pp.api'
Error

Line: 8 Column: 1

              from typing import Iterable, Iterator, Mapping, Sequence, Tuple

from pynvim import Nvim
from pynvim_pp.api import buf_set_lines, buf_set_option, create_buf, win_close
from pynvim_pp.float_win import list_floatwins, open_float_win
from std2.locale import si_prefixed_smol

from ...consts import MD_STATS
from ...databases.insertions.database import Statistics

            

Reported by Pylint.

Unable to import 'pynvim_pp.float_win'
Error

Line: 9 Column: 1

              
from pynvim import Nvim
from pynvim_pp.api import buf_set_lines, buf_set_option, create_buf, win_close
from pynvim_pp.float_win import list_floatwins, open_float_win
from std2.locale import si_prefixed_smol

from ...consts import MD_STATS
from ...databases.insertions.database import Statistics
from ...lang import LANG

            

Reported by Pylint.

Unable to import 'std2.locale'
Error

Line: 10 Column: 1

              from pynvim import Nvim
from pynvim_pp.api import buf_set_lines, buf_set_option, create_buf, win_close
from pynvim_pp.float_win import list_floatwins, open_float_win
from std2.locale import si_prefixed_smol

from ...consts import MD_STATS
from ...databases.insertions.database import Statistics
from ...lang import LANG
from ...registry import rpc

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 12 Column: 1

              from pynvim_pp.float_win import list_floatwins, open_float_win
from std2.locale import si_prefixed_smol

from ...consts import MD_STATS
from ...databases.insertions.database import Statistics
from ...lang import LANG
from ...registry import rpc
from ...shared.parse import display_width
from ..rt_types import Stack

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 13 Column: 1

              from std2.locale import si_prefixed_smol

from ...consts import MD_STATS
from ...databases.insertions.database import Statistics
from ...lang import LANG
from ...registry import rpc
from ...shared.parse import display_width
from ..rt_types import Stack


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 14 Column: 1

              
from ...consts import MD_STATS
from ...databases.insertions.database import Statistics
from ...lang import LANG
from ...registry import rpc
from ...shared.parse import display_width
from ..rt_types import Stack

_TAB_SIZE = 2

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 15 Column: 1

              from ...consts import MD_STATS
from ...databases.insertions.database import Statistics
from ...lang import LANG
from ...registry import rpc
from ...shared.parse import display_width
from ..rt_types import Stack

_TAB_SIZE = 2
_H_SEP = " | "

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 16 Column: 1

              from ...databases.insertions.database import Statistics
from ...lang import LANG
from ...registry import rpc
from ...shared.parse import display_width
from ..rt_types import Stack

_TAB_SIZE = 2
_H_SEP = " | "
_V_SEP = "─"

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 17 Column: 1

              from ...lang import LANG
from ...registry import rpc
from ...shared.parse import display_width
from ..rt_types import Stack

_TAB_SIZE = 2
_H_SEP = " | "
_V_SEP = "─"


            

Reported by Pylint.

coq/snippets/parsers/lsp.py
21 issues
Attempted relative import beyond top-level package
Error

Line: 5 Column: 1

              from string import ascii_letters, ascii_lowercase, digits
from typing import AbstractSet, MutableSequence, Optional, Sequence

from ...shared.types import Context
from .parser import context_from, next_char, pushback_chars, raise_err, token_parser
from .types import (
    Begin,
    DummyBegin,
    End,

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 6 Column: 1

              from typing import AbstractSet, MutableSequence, Optional, Sequence

from ...shared.types import Context
from .parser import context_from, next_char, pushback_chars, raise_err, token_parser
from .types import (
    Begin,
    DummyBegin,
    End,
    Parsed,

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 7 Column: 1

              
from ...shared.types import Context
from .parser import context_from, next_char, pushback_chars, raise_err, token_parser
from .types import (
    Begin,
    DummyBegin,
    End,
    Parsed,
    ParseInfo,

            

Reported by Pylint.

String statement has no effect
Error

Line: 24 Column: 1

              #


"""
any         ::= tabstop | placeholder | choice | variable | text
tabstop     ::= '$' int | '${' int '}'
placeholder ::= '${' int ':' any '}'
choice      ::= '${' int '|' text (',' text)* '|}'
variable    ::= '$' var | '${' var }'

            

Reported by Pylint.

Unused argument 'context'
Error

Line: 187 Column: 5

              
# /' regex '/' (format | text)+ '/'
def _variable_decoration(
    context: ParserCtx, *, var: str, decoration: Sequence[str]
) -> TokenStream:
    text = "".join(decoration)
    yield var
    yield Unparsed(text=text)


            

Reported by Pylint.

Redefining name 'char' from outer scope (line 201)
Error

Line: 209 Column: 17

                      elif char == "/":
            seen += 1
            if seen >= 3:
                for pos, char in context:
                    if char in _regex_flag_chars:
                        decoration_acc.append(char)
                    elif char == "}":
                        decoration = "".join(decoration_acc)
                        yield from _variable_decoration(

            

Reported by Pylint.

Redefining name 'pos' from outer scope (line 201)
Error

Line: 209 Column: 17

                      elif char == "/":
            seen += 1
            if seen >= 3:
                for pos, char in context:
                    if char in _regex_flag_chars:
                        decoration_acc.append(char)
                    elif char == "}":
                        decoration = "".join(decoration_acc)
                        yield from _variable_decoration(

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from os.path import basename, dirname, splitext
from string import ascii_letters, ascii_lowercase, digits
from typing import AbstractSet, MutableSequence, Optional, Sequence

from ...shared.types import Context
from .parser import context_from, next_char, pushback_chars, raise_err, token_parser
from .types import (
    Begin,
    DummyBegin,

            

Reported by Pylint.

Either all return statements in a function should return an expression, or none of them should.
Error

Line: 54 Column: 1

              _regex_flag_chars = {*ascii_lowercase}


def _parse_escape(context: ParserCtx, *, escapable_chars: AbstractSet[str]) -> str:
    pos, char = next_char(context)
    assert char == "\\"

    pos, char = next_char(context)
    if char in escapable_chars:

            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 56
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              
def _parse_escape(context: ParserCtx, *, escapable_chars: AbstractSet[str]) -> str:
    pos, char = next_char(context)
    assert char == "\\"

    pos, char = next_char(context)
    if char in escapable_chars:
        return char
    else:

            

Reported by Bandit.

coq/databases/tags/database.py
20 issues
Unable to import 'std2.asyncio'
Error

Line: 11 Column: 1

              from threading import Lock
from typing import AbstractSet, Iterator, Mapping, cast

from std2.asyncio import run_in_executor
from std2.sqlite3 import with_transaction

from ...consts import CLIENTS_DIR
from ...shared.executor import SingleThreadExecutor
from ...shared.settings import Options

            

Reported by Pylint.

Unable to import 'std2.sqlite3'
Error

Line: 12 Column: 1

              from typing import AbstractSet, Iterator, Mapping, cast

from std2.asyncio import run_in_executor
from std2.sqlite3 import with_transaction

from ...consts import CLIENTS_DIR
from ...shared.executor import SingleThreadExecutor
from ...shared.settings import Options
from ...shared.sql import BIGGEST_INT, init_db

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 14 Column: 1

              from std2.asyncio import run_in_executor
from std2.sqlite3 import with_transaction

from ...consts import CLIENTS_DIR
from ...shared.executor import SingleThreadExecutor
from ...shared.settings import Options
from ...shared.sql import BIGGEST_INT, init_db
from ...shared.timeit import timeit
from ...tags.types import Tag, Tags

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 15 Column: 1

              from std2.sqlite3 import with_transaction

from ...consts import CLIENTS_DIR
from ...shared.executor import SingleThreadExecutor
from ...shared.settings import Options
from ...shared.sql import BIGGEST_INT, init_db
from ...shared.timeit import timeit
from ...tags.types import Tag, Tags
from .sql import sql

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 16 Column: 1

              
from ...consts import CLIENTS_DIR
from ...shared.executor import SingleThreadExecutor
from ...shared.settings import Options
from ...shared.sql import BIGGEST_INT, init_db
from ...shared.timeit import timeit
from ...tags.types import Tag, Tags
from .sql import sql


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 17 Column: 1

              from ...consts import CLIENTS_DIR
from ...shared.executor import SingleThreadExecutor
from ...shared.settings import Options
from ...shared.sql import BIGGEST_INT, init_db
from ...shared.timeit import timeit
from ...tags.types import Tag, Tags
from .sql import sql

_TAGS_DIR = CLIENTS_DIR / "tags"

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 18 Column: 1

              from ...shared.executor import SingleThreadExecutor
from ...shared.settings import Options
from ...shared.sql import BIGGEST_INT, init_db
from ...shared.timeit import timeit
from ...tags.types import Tag, Tags
from .sql import sql

_TAGS_DIR = CLIENTS_DIR / "tags"
_SCHEMA = "v1"

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 19 Column: 1

              from ...shared.settings import Options
from ...shared.sql import BIGGEST_INT, init_db
from ...shared.timeit import timeit
from ...tags.types import Tag, Tags
from .sql import sql

_TAGS_DIR = CLIENTS_DIR / "tags"
_SCHEMA = "v1"


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 20 Column: 1

              from ...shared.sql import BIGGEST_INT, init_db
from ...shared.timeit import timeit
from ...tags.types import Tag, Tags
from .sql import sql

_TAGS_DIR = CLIENTS_DIR / "tags"
_SCHEMA = "v1"

_NIL_TAG = Tag(

            

Reported by Pylint.

Use of insecure MD2, MD4, MD5, or SHA1 hash function.
Security blacklist

Line: 41
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b303-md5

              
def _init(cwd: PurePath) -> Connection:
    ncwd = normcase(cwd)
    name = f"{md5(ncwd.encode()).hexdigest()}-{_SCHEMA}"
    db = (_TAGS_DIR / name).with_suffix(".sqlite3")
    db.parent.mkdir(parents=True, exist_ok=True)
    conn = Connection(str(db), isolation_level=None)
    init_db(conn)
    conn.executescript(sql("create", "pragma"))

            

Reported by Bandit.

coq/server/trans.py
20 issues
Unable to import 'std2'
Error

Line: 6 Column: 1

              from locale import strxfrm
from typing import Any, Callable, Iterable, Iterator, MutableSet, Sequence

from std2 import clamp

from ..shared.parse import display_width, lower
from ..shared.runtime import Metric
from ..shared.settings import PumDisplay, Weights
from ..shared.types import Context

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 8 Column: 1

              
from std2 import clamp

from ..shared.parse import display_width, lower
from ..shared.runtime import Metric
from ..shared.settings import PumDisplay, Weights
from ..shared.types import Context
from .nvim.completions import UserData, VimCompletion
from .rt_types import Stack

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 9 Column: 1

              from std2 import clamp

from ..shared.parse import display_width, lower
from ..shared.runtime import Metric
from ..shared.settings import PumDisplay, Weights
from ..shared.types import Context
from .nvim.completions import UserData, VimCompletion
from .rt_types import Stack
from .state import state

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 10 Column: 1

              
from ..shared.parse import display_width, lower
from ..shared.runtime import Metric
from ..shared.settings import PumDisplay, Weights
from ..shared.types import Context
from .nvim.completions import UserData, VimCompletion
from .rt_types import Stack
from .state import state


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 11 Column: 1

              from ..shared.parse import display_width, lower
from ..shared.runtime import Metric
from ..shared.settings import PumDisplay, Weights
from ..shared.types import Context
from .nvim.completions import UserData, VimCompletion
from .rt_types import Stack
from .state import state



            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 12 Column: 1

              from ..shared.runtime import Metric
from ..shared.settings import PumDisplay, Weights
from ..shared.types import Context
from .nvim.completions import UserData, VimCompletion
from .rt_types import Stack
from .state import state


def _cum(adjustment: Weights, metrics: Iterable[Metric]) -> Weights:

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 13 Column: 1

              from ..shared.settings import PumDisplay, Weights
from ..shared.types import Context
from .nvim.completions import UserData, VimCompletion
from .rt_types import Stack
from .state import state


def _cum(adjustment: Weights, metrics: Iterable[Metric]) -> Weights:
    zero = Weights(

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 14 Column: 1

              from ..shared.types import Context
from .nvim.completions import UserData, VimCompletion
from .rt_types import Stack
from .state import state


def _cum(adjustment: Weights, metrics: Iterable[Metric]) -> Weights:
    zero = Weights(
        prefix_matches=0,

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from dataclasses import asdict
from itertools import chain
from locale import strxfrm
from typing import Any, Callable, Iterable, Iterator, MutableSet, Sequence

from std2 import clamp

from ..shared.parse import display_width, lower
from ..shared.runtime import Metric

            

Reported by Pylint.

Unnecessary "elif" after "break"
Error

Line: 64 Column: 9

              ) -> Iterator[Metric]:
    seen: MutableSet[str] = set()
    for metric in ranked:
        if not context.manual and len(seen) > stack.settings.match.max_results:
            break
        elif metric.comp.primary_edit.new_text not in seen:
            seen.add(metric.comp.primary_edit.new_text)
            yield metric


            

Reported by Pylint.

coq/lsp/parse.py
20 issues
Unable to import 'pynvim_pp.logging'
Error

Line: 4 Column: 1

              from random import shuffle
from typing import Any, Mapping, MutableSequence, Optional, Sequence, cast

from pynvim_pp.logging import log

from ..shared.types import UTF16, Completion, Doc, Edit, Extern, RangeEdit, SnippetEdit
from .protocol import PROTOCOL
from .types import CompletionItem, CompletionResponse, LSPcomp, TextEdit


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 6 Column: 1

              
from pynvim_pp.logging import log

from ..shared.types import UTF16, Completion, Doc, Edit, Extern, RangeEdit, SnippetEdit
from .protocol import PROTOCOL
from .types import CompletionItem, CompletionResponse, LSPcomp, TextEdit


def _falsy(thing: Any) -> bool:

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 7 Column: 1

              from pynvim_pp.logging import log

from ..shared.types import UTF16, Completion, Doc, Edit, Extern, RangeEdit, SnippetEdit
from .protocol import PROTOCOL
from .types import CompletionItem, CompletionResponse, LSPcomp, TextEdit


def _falsy(thing: Any) -> bool:
    return thing is None or thing == False or thing == 0 or thing == "" or thing == b""

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 8 Column: 1

              
from ..shared.types import UTF16, Completion, Doc, Edit, Extern, RangeEdit, SnippetEdit
from .protocol import PROTOCOL
from .types import CompletionItem, CompletionResponse, LSPcomp, TextEdit


def _falsy(thing: Any) -> bool:
    return thing is None or thing == False or thing == 0 or thing == "" or thing == b""


            

Reported by Pylint.

TODO -- InsertReplaceEdit
Error

Line: 47 Column: 3

                      return SnippetEdit(grammar="lsp", new_text=new_text)

    elif isinstance(text_edit, Mapping):
        # TODO -- InsertReplaceEdit
        # if "insert" in text_edit:
        #     return Edit(new_text=fall_back)
        if "range" in text_edit:
            re = _range_edit(cast(TextEdit, text_edit))
            if re:

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from random import shuffle
from typing import Any, Mapping, MutableSequence, Optional, Sequence, cast

from pynvim_pp.logging import log

from ..shared.types import UTF16, Completion, Doc, Edit, Extern, RangeEdit, SnippetEdit
from .protocol import PROTOCOL
from .types import CompletionItem, CompletionResponse, LSPcomp, TextEdit


            

Reported by Pylint.

Comparison 'thing == False' should be 'thing is False' if checking for the singleton value False, or 'not thing' if testing for falsiness
Error

Line: 12 Column: 29

              

def _falsy(thing: Any) -> bool:
    return thing is None or thing == False or thing == 0 or thing == "" or thing == b""


def _range_edit(edit: TextEdit) -> Optional[RangeEdit]:
    rg = edit.get("range", {})
    s, e = rg.get("start", {}), rg.get("end", {})

            

Reported by Pylint.

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

Line: 16 Column: 5

              

def _range_edit(edit: TextEdit) -> Optional[RangeEdit]:
    rg = edit.get("range", {})
    s, e = rg.get("start", {}), rg.get("end", {})
    b_r, b_c = s.get("line"), s.get("character")
    e_r, e_c = e.get("line"), e.get("character")
    new_text = edit.get("newText")
    if (

            

Reported by Pylint.

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

Line: 17 Column: 8

              
def _range_edit(edit: TextEdit) -> Optional[RangeEdit]:
    rg = edit.get("range", {})
    s, e = rg.get("start", {}), rg.get("end", {})
    b_r, b_c = s.get("line"), s.get("character")
    e_r, e_c = e.get("line"), e.get("character")
    new_text = edit.get("newText")
    if (
        new_text

            

Reported by Pylint.

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

Line: 17 Column: 5

              
def _range_edit(edit: TextEdit) -> Optional[RangeEdit]:
    rg = edit.get("range", {})
    s, e = rg.get("start", {}), rg.get("end", {})
    b_r, b_c = s.get("line"), s.get("character")
    e_r, e_c = e.get("line"), e.get("character")
    new_text = edit.get("newText")
    if (
        new_text

            

Reported by Pylint.

coq/shared/settings.py
20 issues
Unused Sequence imported from typing
Error

Line: 2 Column: 1

              from dataclasses import dataclass
from typing import AbstractSet, Literal, Optional, Sequence, Tuple, Union


@dataclass(frozen=True)
class Limits:
    idle_timeout: float
    index_cutoff: int
    completion_auto_timeout: float

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from dataclasses import dataclass
from typing import AbstractSet, Literal, Optional, Sequence, Tuple, Union


@dataclass(frozen=True)
class Limits:
    idle_timeout: float
    index_cutoff: int
    completion_auto_timeout: float

            

Reported by Pylint.

Missing class docstring
Error

Line: 6 Column: 1

              

@dataclass(frozen=True)
class Limits:
    idle_timeout: float
    index_cutoff: int
    completion_auto_timeout: float
    completion_manual_timeout: float
    download_retries: int

            

Reported by Pylint.

Missing class docstring
Error

Line: 16 Column: 1

              

@dataclass(frozen=True)
class PumDisplay:
    y_ratio: float
    y_max_len: int

    x_max_len: int
    x_truncate_len: int

            

Reported by Pylint.

Missing class docstring
Error

Line: 30 Column: 1

              

@dataclass(frozen=True)
class PreviewPositions:
    north: Optional[int]
    south: Optional[int]
    west: Optional[int]
    east: Optional[int]


            

Reported by Pylint.

Missing class docstring
Error

Line: 38 Column: 1

              

@dataclass(frozen=True)
class PreviewDisplay:
    x_max_len: int
    positions: PreviewPositions
    resolve_timeout: float



            

Reported by Pylint.

Missing class docstring
Error

Line: 45 Column: 1

              

@dataclass(frozen=True)
class Display:
    pum: PumDisplay
    preview: PreviewDisplay
    mark_highlight_group: str



            

Reported by Pylint.

Missing class docstring
Error

Line: 52 Column: 1

              

@dataclass(frozen=True)
class Options:
    unifying_chars: AbstractSet[str]
    max_results: int
    proximate_lines: int
    look_ahead: int
    exact_matches: int

            

Reported by Pylint.

Missing class docstring
Error

Line: 62 Column: 1

              

@dataclass(frozen=True)
class Weights:
    prefix_matches: float
    edit_distance: float
    recency: float
    proximity: float


            

Reported by Pylint.

Missing class docstring
Error

Line: 70 Column: 1

              

@dataclass(frozen=True)
class KeyMapping:
    recommended: bool
    manual_complete: Optional[str]
    jump_to_mark: Optional[str]
    bigger_preview: Optional[str]


            

Reported by Pylint.

coq/databases/insertions/database.py
19 issues
Unable to import 'std2.asyncio'
Error

Line: 10 Column: 1

              from threading import Lock
from typing import Iterator, Mapping, Optional

from std2.asyncio import run_in_executor
from std2.sqlite3 import with_transaction

from ...consts import INSERT_DB
from ...shared.executor import SingleThreadExecutor
from ...shared.sql import init_db

            

Reported by Pylint.

Unable to import 'std2.sqlite3'
Error

Line: 11 Column: 1

              from typing import Iterator, Mapping, Optional

from std2.asyncio import run_in_executor
from std2.sqlite3 import with_transaction

from ...consts import INSERT_DB
from ...shared.executor import SingleThreadExecutor
from ...shared.sql import init_db
from ...shared.timeit import timeit

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 13 Column: 1

              from std2.asyncio import run_in_executor
from std2.sqlite3 import with_transaction

from ...consts import INSERT_DB
from ...shared.executor import SingleThreadExecutor
from ...shared.sql import init_db
from ...shared.timeit import timeit
from .sql import sql


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 14 Column: 1

              from std2.sqlite3 import with_transaction

from ...consts import INSERT_DB
from ...shared.executor import SingleThreadExecutor
from ...shared.sql import init_db
from ...shared.timeit import timeit
from .sql import sql



            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 15 Column: 1

              
from ...consts import INSERT_DB
from ...shared.executor import SingleThreadExecutor
from ...shared.sql import init_db
from ...shared.timeit import timeit
from .sql import sql


@dataclass(frozen=True)

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 16 Column: 1

              from ...consts import INSERT_DB
from ...shared.executor import SingleThreadExecutor
from ...shared.sql import init_db
from ...shared.timeit import timeit
from .sql import sql


@dataclass(frozen=True)
class Statistics:

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 17 Column: 1

              from ...shared.executor import SingleThreadExecutor
from ...shared.sql import init_db
from ...shared.timeit import timeit
from .sql import sql


@dataclass(frozen=True)
class Statistics:
    source: str

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from asyncio.exceptions import CancelledError
from concurrent.futures import Executor
from contextlib import closing
from dataclasses import dataclass
from json import loads
from sqlite3 import Connection, OperationalError
from threading import Lock
from typing import Iterator, Mapping, Optional


            

Reported by Pylint.

Too many instance attributes (11/7)
Error

Line: 21 Column: 1

              

@dataclass(frozen=True)
class Statistics:
    source: str
    interrupted: int
    inserted: int

    avg_duration: float

            

Reported by Pylint.

Missing class docstring
Error

Line: 21 Column: 1

              

@dataclass(frozen=True)
class Statistics:
    source: str
    interrupted: int
    inserted: int

    avg_duration: float

            

Reported by Pylint.

coq/snippets/parsers/parser.py
19 issues
Unable to import 'std2.itertools'
Error

Line: 17 Column: 1

                  Union,
)

from std2.itertools import deiter
from std2.types import never

from ...shared.types import UTF8, Context
from ..consts import MOD_PAD
from .types import (

            

Reported by Pylint.

Unable to import 'std2.types'
Error

Line: 18 Column: 1

              )

from std2.itertools import deiter
from std2.types import never

from ...shared.types import UTF8, Context
from ..consts import MOD_PAD
from .types import (
    Begin,

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 20 Column: 1

              from std2.itertools import deiter
from std2.types import never

from ...shared.types import UTF8, Context
from ..consts import MOD_PAD
from .types import (
    Begin,
    DummyBegin,
    EChar,

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 21 Column: 1

              from std2.types import never

from ...shared.types import UTF8, Context
from ..consts import MOD_PAD
from .types import (
    Begin,
    DummyBegin,
    EChar,
    End,

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 22 Column: 1

              
from ...shared.types import UTF8, Context
from ..consts import MOD_PAD
from .types import (
    Begin,
    DummyBegin,
    EChar,
    End,
    Index,

            

Reported by Pylint.

Assigning the same variable 'token' to itself
Error

Line: 145 Column: 13

              
    for token in stream:
        if isinstance(token, Unparsed):
            token = token
            bad_tokens.append((idx, token))
        elif isinstance(token, str):
            idx += len(token.encode(UTF8))
            slices.append(token)
        elif isinstance(token, Begin):

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from os import linesep
from string import Template
from textwrap import dedent
from typing import (
    Iterable,
    Iterator,
    Mapping,
    MutableMapping,
    MutableSequence,

            

Reported by Pylint.

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

Line: 39 Column: 1

                  Unparsed,
)

T = TypeVar("T")


def raise_err(
    text: str, pos: Index, condition: str, expected: Iterable[str], actual: str
) -> NoReturn:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 42 Column: 1

              T = TypeVar("T")


def raise_err(
    text: str, pos: Index, condition: str, expected: Iterable[str], actual: str
) -> NoReturn:
    band = 5
    char = f"'{actual}'" if actual else "EOF"
    expected_chars = ", ".join(map(lambda c: f"'{c}'", expected))

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 72 Column: 1

                  raise ParseError(msg)


def next_char(context: ParserCtx) -> EChar:
    return next(context, (Index(i=-1, row=-1, col=-1), ""))


def pushback_chars(context: ParserCtx, *vals: EChar) -> None:
    for pos, char in reversed(vals):

            

Reported by Pylint.