The following issues were found

docs/examples/messages_and_events/color_changer.py
6 issues
Unable to import 'textual.app'
Error

Line: 1 Column: 1

              from textual.app import App


class ColorChanger(App):
    def on_key(self, event):
        if event.key.isdigit():
            self.background = f"on color({event.key})"



            

Reported by Pylint.

Attribute 'background' defined outside __init__
Error

Line: 7 Column: 13

              class ColorChanger(App):
    def on_key(self, event):
        if event.key.isdigit():
            self.background = f"on color({event.key})"


ColorChanger.run(log="textual.log")

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from textual.app import App


class ColorChanger(App):
    def on_key(self, event):
        if event.key.isdigit():
            self.background = f"on color({event.key})"



            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 4 Column: 1

              from textual.app import App


class ColorChanger(App):
    def on_key(self, event):
        if event.key.isdigit():
            self.background = f"on color({event.key})"



            

Reported by Pylint.

Missing class docstring
Error

Line: 4 Column: 1

              from textual.app import App


class ColorChanger(App):
    def on_key(self, event):
        if event.key.isdigit():
            self.background = f"on color({event.key})"



            

Reported by Pylint.

Missing function or method docstring
Error

Line: 5 Column: 5

              

class ColorChanger(App):
    def on_key(self, event):
        if event.key.isdigit():
            self.background = f"on color({event.key})"


ColorChanger.run(log="textual.log")

            

Reported by Pylint.

docs/examples/actions/colorizer.py
6 issues
Unable to import 'textual.app'
Error

Line: 1 Column: 1

              from textual.app import App


class Colorizer(App):
    async def on_load(self):
        await self.bind("r", "color('red')")
        await self.bind("g", "color('green')")
        await self.bind("b", "color('blue')")


            

Reported by Pylint.

Attribute 'background' defined outside __init__
Error

Line: 11 Column: 9

                      await self.bind("b", "color('blue')")

    async def action_color(self, color: str) -> None:
        self.background = f"on {color}"


Colorizer.run()

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from textual.app import App


class Colorizer(App):
    async def on_load(self):
        await self.bind("r", "color('red')")
        await self.bind("g", "color('green')")
        await self.bind("b", "color('blue')")


            

Reported by Pylint.

Missing class docstring
Error

Line: 4 Column: 1

              from textual.app import App


class Colorizer(App):
    async def on_load(self):
        await self.bind("r", "color('red')")
        await self.bind("g", "color('green')")
        await self.bind("b", "color('blue')")


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 5 Column: 5

              

class Colorizer(App):
    async def on_load(self):
        await self.bind("r", "color('red')")
        await self.bind("g", "color('green')")
        await self.bind("b", "color('blue')")

    async def action_color(self, color: str) -> None:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 10 Column: 5

                      await self.bind("g", "color('green')")
        await self.bind("b", "color('blue')")

    async def action_color(self, color: str) -> None:
        self.background = f"on {color}"


Colorizer.run()

            

Reported by Pylint.

examples/grid.py
5 issues
Unable to import 'textual.app'
Error

Line: 1 Column: 1

              from textual.app import App
from textual.widgets import Placeholder


class GridTest(App):
    async def on_mount(self) -> None:
        """Make a simple grid arrangement."""

        grid = await self.view.dock_grid(edge="left", size=70, name="left")

            

Reported by Pylint.

Unable to import 'textual.widgets'
Error

Line: 2 Column: 1

              from textual.app import App
from textual.widgets import Placeholder


class GridTest(App):
    async def on_mount(self) -> None:
        """Make a simple grid arrangement."""

        grid = await self.view.dock_grid(edge="left", size=70, name="left")

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from textual.app import App
from textual.widgets import Placeholder


class GridTest(App):
    async def on_mount(self) -> None:
        """Make a simple grid arrangement."""

        grid = await self.view.dock_grid(edge="left", size=70, name="left")

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 5 Column: 1

              from textual.widgets import Placeholder


class GridTest(App):
    async def on_mount(self) -> None:
        """Make a simple grid arrangement."""

        grid = await self.view.dock_grid(edge="left", size=70, name="left")


            

Reported by Pylint.

Missing class docstring
Error

Line: 5 Column: 1

              from textual.widgets import Placeholder


class GridTest(App):
    async def on_mount(self) -> None:
        """Make a simple grid arrangement."""

        grid = await self.view.dock_grid(edge="left", size=70, name="left")


            

Reported by Pylint.

src/textual/actions.py
5 issues
Unused Tuple imported from typing
Error

Line: 4 Column: 1

              from __future__ import annotations

import ast
from typing import Any, Tuple
import re


class ActionError(Exception):
    pass

            

Reported by Pylint.

Consider explicitly re-raising using the 'from' keyword
Error

Line: 22 Column: 13

                      try:
            action_params = ast.literal_eval(action_params_str)
        except Exception:
            raise ActionError(
                f"unable to parse {action_params_str!r} in action {action!r}"
            )
    else:
        action_name = action
        action_params = ()

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from __future__ import annotations

import ast
from typing import Any, Tuple
import re


class ActionError(Exception):
    pass

            

Reported by Pylint.

Missing class docstring
Error

Line: 8 Column: 1

              import re


class ActionError(Exception):
    pass


re_action_params = re.compile(r"([\w\.]+)(\(.*?\))")


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 15 Column: 1

              re_action_params = re.compile(r"([\w\.]+)(\(.*?\))")


def parse(action: str) -> tuple[str, tuple[Any, ...]]:
    params_match = re_action_params.match(action)
    if params_match is not None:
        action_name, action_params_str = params_match.groups()
        try:
            action_params = ast.literal_eval(action_params_str)

            

Reported by Pylint.

src/textual/_lines.py
5 issues
Unable to import 'rich.segment'
Error

Line: 3 Column: 1

              from __future__ import annotations

from rich.segment import Segment

from .geometry import Region
from ._types import Lines


def crop_lines(lines: Lines, clip: Region) -> Lines:

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 5 Column: 1

              
from rich.segment import Segment

from .geometry import Region
from ._types import Lines


def crop_lines(lines: Lines, clip: Region) -> Lines:
    lines = lines[clip.y : clip.y + clip.height]

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 6 Column: 1

              from rich.segment import Segment

from .geometry import Region
from ._types import Lines


def crop_lines(lines: Lines, clip: Region) -> Lines:
    lines = lines[clip.y : clip.y + clip.height]


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from __future__ import annotations

from rich.segment import Segment

from .geometry import Region
from ._types import Lines


def crop_lines(lines: Lines, clip: Region) -> Lines:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 9 Column: 1

              from ._types import Lines


def crop_lines(lines: Lines, clip: Region) -> Lines:
    lines = lines[clip.y : clip.y + clip.height]

    def width_view(line: list[Segment]) -> list[Segment]:
        _, line = Segment.divide(line, [clip.x, clip.x + clip.width])
        return line

            

Reported by Pylint.

docs/examples/actions/quiter.py
5 issues
Unable to import 'textual.app'
Error

Line: 1 Column: 1

              from textual.app import App


class Quiter(App):
    async def on_load(self):
        await self.bind("q", "quit")


Quiter.run()

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from textual.app import App


class Quiter(App):
    async def on_load(self):
        await self.bind("q", "quit")


Quiter.run()

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 4 Column: 1

              from textual.app import App


class Quiter(App):
    async def on_load(self):
        await self.bind("q", "quit")


Quiter.run()

            

Reported by Pylint.

Missing class docstring
Error

Line: 4 Column: 1

              from textual.app import App


class Quiter(App):
    async def on_load(self):
        await self.bind("q", "quit")


Quiter.run()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 5 Column: 5

              

class Quiter(App):
    async def on_load(self):
        await self.bind("q", "quit")


Quiter.run()

            

Reported by Pylint.

docs/examples/messages_and_events/beep.py
5 issues
Unable to import 'textual.app'
Error

Line: 1 Column: 1

              from textual.app import App


class Beeper(App):
    def on_key(self):
        self.console.bell()


Beeper.run()

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from textual.app import App


class Beeper(App):
    def on_key(self):
        self.console.bell()


Beeper.run()

            

Reported by Pylint.

Missing class docstring
Error

Line: 4 Column: 1

              from textual.app import App


class Beeper(App):
    def on_key(self):
        self.console.bell()


Beeper.run()

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 4 Column: 1

              from textual.app import App


class Beeper(App):
    def on_key(self):
        self.console.bell()


Beeper.run()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 5 Column: 5

              

class Beeper(App):
    def on_key(self):
        self.console.bell()


Beeper.run()

            

Reported by Pylint.

src/textual/views/__init__.py
4 issues
Unable to import '__init__._dock_view'
Error

Line: 1 Column: 1

              from ._dock_view import DockView, Dock, DockEdge
from ._grid_view import GridView
from ._window_view import WindowView

            

Reported by Pylint.

Unable to import '__init__._grid_view'
Error

Line: 2 Column: 1

              from ._dock_view import DockView, Dock, DockEdge
from ._grid_view import GridView
from ._window_view import WindowView

            

Reported by Pylint.

Unable to import '__init__._window_view'
Error

Line: 3 Column: 1

              from ._dock_view import DockView, Dock, DockEdge
from ._grid_view import GridView
from ._window_view import WindowView

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from ._dock_view import DockView, Dock, DockEdge
from ._grid_view import GridView
from ._window_view import WindowView

            

Reported by Pylint.

src/textual/_event_broker.py
4 issues
Missing module docstring
Error

Line: 1 Column: 1

              from __future__ import annotations

from typing import Any, NamedTuple


class NoHandler(Exception):
    pass



            

Reported by Pylint.

Missing class docstring
Error

Line: 6 Column: 1

              from typing import Any, NamedTuple


class NoHandler(Exception):
    pass


class HandlerArguments(NamedTuple):
    modifiers: set[str]

            

Reported by Pylint.

Missing class docstring
Error

Line: 10 Column: 1

                  pass


class HandlerArguments(NamedTuple):
    modifiers: set[str]
    action: Any


def extract_handler_actions(event_name: str, meta: dict[str, Any]) -> HandlerArguments:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 15 Column: 1

                  action: Any


def extract_handler_actions(event_name: str, meta: dict[str, Any]) -> HandlerArguments:
    event_path = event_name.split(".")
    for key, value in meta.items():
        if key.startswith("@"):
            name_args = key[1:].split(".")
            if name_args[: len(event_path)] == event_path:

            

Reported by Pylint.

src/textual/views/_document_view.py
3 issues
Attempted relative import beyond top-level package
Error

Line: 3 Column: 1

              from __future__ import annotations

from ..view import View

            

Reported by Pylint.

Unused View imported from view
Error

Line: 3 Column: 1

              from __future__ import annotations

from ..view import View

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from __future__ import annotations

from ..view import View

            

Reported by Pylint.