The following issues were found

src/textual/widgets/__init__.py
9 issues
Unable to import '__init__._footer'
Error

Line: 1 Column: 1

              from ._footer import Footer
from ._header import Header
from ._button import Button, ButtonPressed
from ._placeholder import Placeholder
from ._scroll_view import ScrollView
from ._static import Static
from ._tree_control import TreeControl, TreeClick, TreeNode, NodeID
from ._directory_tree import DirectoryTree, FileClick


            

Reported by Pylint.

Unable to import '__init__._header'
Error

Line: 2 Column: 1

              from ._footer import Footer
from ._header import Header
from ._button import Button, ButtonPressed
from ._placeholder import Placeholder
from ._scroll_view import ScrollView
from ._static import Static
from ._tree_control import TreeControl, TreeClick, TreeNode, NodeID
from ._directory_tree import DirectoryTree, FileClick


            

Reported by Pylint.

Unable to import '__init__._button'
Error

Line: 3 Column: 1

              from ._footer import Footer
from ._header import Header
from ._button import Button, ButtonPressed
from ._placeholder import Placeholder
from ._scroll_view import ScrollView
from ._static import Static
from ._tree_control import TreeControl, TreeClick, TreeNode, NodeID
from ._directory_tree import DirectoryTree, FileClick


            

Reported by Pylint.

Unable to import '__init__._placeholder'
Error

Line: 4 Column: 1

              from ._footer import Footer
from ._header import Header
from ._button import Button, ButtonPressed
from ._placeholder import Placeholder
from ._scroll_view import ScrollView
from ._static import Static
from ._tree_control import TreeControl, TreeClick, TreeNode, NodeID
from ._directory_tree import DirectoryTree, FileClick


            

Reported by Pylint.

Unable to import '__init__._scroll_view'
Error

Line: 5 Column: 1

              from ._header import Header
from ._button import Button, ButtonPressed
from ._placeholder import Placeholder
from ._scroll_view import ScrollView
from ._static import Static
from ._tree_control import TreeControl, TreeClick, TreeNode, NodeID
from ._directory_tree import DirectoryTree, FileClick

__all__ = [

            

Reported by Pylint.

Unable to import '__init__._static'
Error

Line: 6 Column: 1

              from ._button import Button, ButtonPressed
from ._placeholder import Placeholder
from ._scroll_view import ScrollView
from ._static import Static
from ._tree_control import TreeControl, TreeClick, TreeNode, NodeID
from ._directory_tree import DirectoryTree, FileClick

__all__ = [
    "Button",

            

Reported by Pylint.

Unable to import '__init__._tree_control'
Error

Line: 7 Column: 1

              from ._placeholder import Placeholder
from ._scroll_view import ScrollView
from ._static import Static
from ._tree_control import TreeControl, TreeClick, TreeNode, NodeID
from ._directory_tree import DirectoryTree, FileClick

__all__ = [
    "Button",
    "ButtonPressed",

            

Reported by Pylint.

Unable to import '__init__._directory_tree'
Error

Line: 8 Column: 1

              from ._scroll_view import ScrollView
from ._static import Static
from ._tree_control import TreeControl, TreeClick, TreeNode, NodeID
from ._directory_tree import DirectoryTree, FileClick

__all__ = [
    "Button",
    "ButtonPressed",
    "DirectoryTree",

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from ._footer import Footer
from ._header import Header
from ._button import Button, ButtonPressed
from ._placeholder import Placeholder
from ._scroll_view import ScrollView
from ._static import Static
from ._tree_control import TreeControl, TreeClick, TreeNode, NodeID
from ._directory_tree import DirectoryTree, FileClick


            

Reported by Pylint.

src/textual/widgets/_static.py
9 issues
Unable to import 'rich.console'
Error

Line: 3 Column: 1

              from __future__ import annotations

from rich.console import RenderableType
from rich.padding import Padding, PaddingDimensions
from rich.style import StyleType
from rich.styled import Styled
from ..widget import Widget



            

Reported by Pylint.

Unable to import 'rich.padding'
Error

Line: 4 Column: 1

              from __future__ import annotations

from rich.console import RenderableType
from rich.padding import Padding, PaddingDimensions
from rich.style import StyleType
from rich.styled import Styled
from ..widget import Widget



            

Reported by Pylint.

Unable to import 'rich.style'
Error

Line: 5 Column: 1

              
from rich.console import RenderableType
from rich.padding import Padding, PaddingDimensions
from rich.style import StyleType
from rich.styled import Styled
from ..widget import Widget


class Static(Widget):

            

Reported by Pylint.

Unable to import 'rich.styled'
Error

Line: 6 Column: 1

              from rich.console import RenderableType
from rich.padding import Padding, PaddingDimensions
from rich.style import StyleType
from rich.styled import Styled
from ..widget import Widget


class Static(Widget):
    def __init__(

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 7 Column: 1

              from rich.padding import Padding, PaddingDimensions
from rich.style import StyleType
from rich.styled import Styled
from ..widget import Widget


class Static(Widget):
    def __init__(
        self,

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from __future__ import annotations

from rich.console import RenderableType
from rich.padding import Padding, PaddingDimensions
from rich.style import StyleType
from rich.styled import Styled
from ..widget import Widget



            

Reported by Pylint.

Missing class docstring
Error

Line: 10 Column: 1

              from ..widget import Widget


class Static(Widget):
    def __init__(
        self,
        renderable: RenderableType,
        name: str | None = None,
        style: StyleType = "",

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 23 Column: 5

                      self.style = style
        self.padding = padding

    def render(self) -> RenderableType:
        renderable = self.renderable
        if self.padding:
            renderable = Padding(renderable, self.padding)
        return Styled(renderable, self.style)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 29 Column: 5

                          renderable = Padding(renderable, self.padding)
        return Styled(renderable, self.style)

    async def update(self, renderable: RenderableType) -> None:
        self.renderable = renderable
        self.refresh()

            

Reported by Pylint.

examples/animation.py
8 issues
Unable to import 'textual'
Error

Line: 1 Column: 1

              from textual import events
from textual.app import App
from textual.reactive import Reactive
from textual.widgets import Footer, Placeholder


class SmoothApp(App):
    """Demonstrates smooth animation. Press 'b' to see it in action."""


            

Reported by Pylint.

Unable to import 'textual.app'
Error

Line: 2 Column: 1

              from textual import events
from textual.app import App
from textual.reactive import Reactive
from textual.widgets import Footer, Placeholder


class SmoothApp(App):
    """Demonstrates smooth animation. Press 'b' to see it in action."""


            

Reported by Pylint.

Unable to import 'textual.reactive'
Error

Line: 3 Column: 1

              from textual import events
from textual.app import App
from textual.reactive import Reactive
from textual.widgets import Footer, Placeholder


class SmoothApp(App):
    """Demonstrates smooth animation. Press 'b' to see it in action."""


            

Reported by Pylint.

Unable to import 'textual.widgets'
Error

Line: 4 Column: 1

              from textual import events
from textual.app import App
from textual.reactive import Reactive
from textual.widgets import Footer, Placeholder


class SmoothApp(App):
    """Demonstrates smooth animation. Press 'b' to see it in action."""


            

Reported by Pylint.

Unused argument 'event'
Error

Line: 25 Column: 30

                      """Called when user hits 'b' key."""
        self.show_bar = not self.show_bar

    async def on_mount(self, event: events.Mount) -> None:
        """Build layout here."""
        footer = Footer()
        self.bar = Placeholder(name="left")

        await self.view.dock(footer, edge="bottom")

            

Reported by Pylint.

Attribute 'bar' defined outside __init__
Error

Line: 28 Column: 9

                  async def on_mount(self, event: events.Mount) -> None:
        """Build layout here."""
        footer = Footer()
        self.bar = Placeholder(name="left")

        await self.view.dock(footer, edge="bottom")
        await self.view.dock(Placeholder(), Placeholder(), edge="top")
        await self.view.dock(self.bar, edge="left", size=40, z=1)


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from textual import events
from textual.app import App
from textual.reactive import Reactive
from textual.widgets import Footer, Placeholder


class SmoothApp(App):
    """Demonstrates smooth animation. Press 'b' to see it in action."""


            

Reported by Pylint.

Black listed name "bar"
Error

Line: 28 Column: 9

                  async def on_mount(self, event: events.Mount) -> None:
        """Build layout here."""
        footer = Footer()
        self.bar = Placeholder(name="left")

        await self.view.dock(footer, edge="bottom")
        await self.view.dock(Placeholder(), Placeholder(), edge="top")
        await self.view.dock(self.bar, edge="left", size=40, z=1)


            

Reported by Pylint.

examples/simple.py
8 issues
Unable to import 'rich.markdown'
Error

Line: 1 Column: 1

              from rich.markdown import Markdown

from textual import events
from textual.app import App
from textual.widgets import Header, Footer, Placeholder, ScrollView


class MyApp(App):
    """An example of a very simple Textual App"""

            

Reported by Pylint.

Unable to import 'textual'
Error

Line: 3 Column: 1

              from rich.markdown import Markdown

from textual import events
from textual.app import App
from textual.widgets import Header, Footer, Placeholder, ScrollView


class MyApp(App):
    """An example of a very simple Textual App"""

            

Reported by Pylint.

Unable to import 'textual.app'
Error

Line: 4 Column: 1

              from rich.markdown import Markdown

from textual import events
from textual.app import App
from textual.widgets import Header, Footer, Placeholder, ScrollView


class MyApp(App):
    """An example of a very simple Textual App"""

            

Reported by Pylint.

Unable to import 'textual.widgets'
Error

Line: 5 Column: 1

              
from textual import events
from textual.app import App
from textual.widgets import Header, Footer, Placeholder, ScrollView


class MyApp(App):
    """An example of a very simple Textual App"""


            

Reported by Pylint.

Unused argument 'event'
Error

Line: 11 Column: 29

              class MyApp(App):
    """An example of a very simple Textual App"""

    async def on_load(self, event: events.Load) -> None:
        """Bind keys with the app loads (but before entering application mode)"""
        await self.bind("b", "view.toggle('sidebar')", "Toggle sidebar")
        await self.bind("q", "quit", "Quit")

    async def on_mount(self, event: events.Mount) -> None:

            

Reported by Pylint.

Unused argument 'event'
Error

Line: 16 Column: 30

                      await self.bind("b", "view.toggle('sidebar')", "Toggle sidebar")
        await self.bind("q", "quit", "Quit")

    async def on_mount(self, event: events.Mount) -> None:
        """Create and dock the widgets."""

        # A scrollview to contain the markdown file
        body = ScrollView()


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from rich.markdown import Markdown

from textual import events
from textual.app import App
from textual.widgets import Header, Footer, Placeholder, ScrollView


class MyApp(App):
    """An example of a very simple Textual App"""

            

Reported by Pylint.

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

Line: 31 Column: 42

                      await self.view.dock(body, edge="right")

        async def get_markdown(filename: str) -> None:
            with open(filename, "rt") as fh:
                readme = Markdown(fh.read(), hyperlinks=True)
            await body.update(readme)

        await self.call_later(get_markdown, "richreadme.md")


            

Reported by Pylint.

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

Line: 1 Column: 1

              from ..view import View
from ..layouts.grid import GridLayout


class GridView(View, layout=GridLayout):
    @property
    def grid(self) -> GridLayout:
        assert isinstance(self.layout, GridLayout)
        return self.layout

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 2 Column: 1

              from ..view import View
from ..layouts.grid import GridLayout


class GridView(View, layout=GridLayout):
    @property
    def grid(self) -> GridLayout:
        assert isinstance(self.layout, GridLayout)
        return self.layout

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from ..view import View
from ..layouts.grid import GridLayout


class GridView(View, layout=GridLayout):
    @property
    def grid(self) -> GridLayout:
        assert isinstance(self.layout, GridLayout)
        return self.layout

            

Reported by Pylint.

Missing class docstring
Error

Line: 5 Column: 1

              from ..layouts.grid import GridLayout


class GridView(View, layout=GridLayout):
    @property
    def grid(self) -> GridLayout:
        assert isinstance(self.layout, GridLayout)
        return self.layout

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 5 Column: 1

              from ..layouts.grid import GridLayout


class GridView(View, layout=GridLayout):
    @property
    def grid(self) -> GridLayout:
        assert isinstance(self.layout, GridLayout)
        return self.layout

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 7 Column: 5

              
class GridView(View, layout=GridLayout):
    @property
    def grid(self) -> GridLayout:
        assert isinstance(self.layout, GridLayout)
        return self.layout

            

Reported by Pylint.

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

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

              class GridView(View, layout=GridLayout):
    @property
    def grid(self) -> GridLayout:
        assert isinstance(self.layout, GridLayout)
        return self.layout

            

Reported by Bandit.

src/textual/__init__.py
7 issues
Unable to import '__init__._context'
Error

Line: 7 Column: 5

              

def log(*args: Any, verbosity: int = 0) -> None:
    from ._context import active_app

    app = active_app.get()
    app.log(*args, verbosity=verbosity)



            

Reported by Pylint.

Unable to import '__init__._context'
Error

Line: 14 Column: 5

              

def panic(*args: Any) -> None:
    from ._context import active_app

    app = active_app.get()
    app.panic(*args)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from typing import Any

__all__ = ["log", "panic"]


def log(*args: Any, verbosity: int = 0) -> None:
    from ._context import active_app

    app = active_app.get()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 6 Column: 1

              __all__ = ["log", "panic"]


def log(*args: Any, verbosity: int = 0) -> None:
    from ._context import active_app

    app = active_app.get()
    app.log(*args, verbosity=verbosity)


            

Reported by Pylint.

Import outside toplevel (_context.active_app)
Error

Line: 7 Column: 5

              

def log(*args: Any, verbosity: int = 0) -> None:
    from ._context import active_app

    app = active_app.get()
    app.log(*args, verbosity=verbosity)



            

Reported by Pylint.

Missing function or method docstring
Error

Line: 13 Column: 1

                  app.log(*args, verbosity=verbosity)


def panic(*args: Any) -> None:
    from ._context import active_app

    app = active_app.get()
    app.panic(*args)

            

Reported by Pylint.

Import outside toplevel (_context.active_app)
Error

Line: 14 Column: 5

              

def panic(*args: Any) -> None:
    from ._context import active_app

    app = active_app.get()
    app.panic(*args)

            

Reported by Pylint.

examples/grid_auto.py
7 issues
Unable to import 'textual.app'
Error

Line: 1 Column: 1

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


class GridTest(App):
    async def on_mount(self, event: events.Mount) -> None:
        """Create a grid with auto-arranging cells."""


            

Reported by Pylint.

Unable to import 'textual'
Error

Line: 2 Column: 1

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


class GridTest(App):
    async def on_mount(self, event: events.Mount) -> None:
        """Create a grid with auto-arranging cells."""


            

Reported by Pylint.

Unable to import 'textual.widgets'
Error

Line: 3 Column: 1

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


class GridTest(App):
    async def on_mount(self, event: events.Mount) -> None:
        """Create a grid with auto-arranging cells."""


            

Reported by Pylint.

Unused argument 'event'
Error

Line: 7 Column: 30

              

class GridTest(App):
    async def on_mount(self, event: events.Mount) -> None:
        """Create a grid with auto-arranging cells."""

        grid = await self.view.dock_grid()

        grid.add_column("col", fraction=1, max_size=20)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

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


class GridTest(App):
    async def on_mount(self, event: events.Mount) -> None:
        """Create a grid with auto-arranging cells."""


            

Reported by Pylint.

Missing class docstring
Error

Line: 6 Column: 1

              from textual.widgets import Placeholder


class GridTest(App):
    async def on_mount(self, event: events.Mount) -> None:
        """Create a grid with auto-arranging cells."""

        grid = await self.view.dock_grid()


            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 6 Column: 1

              from textual.widgets import Placeholder


class GridTest(App):
    async def on_mount(self, event: events.Mount) -> None:
        """Create a grid with auto-arranging cells."""

        grid = await self.view.dock_grid()


            

Reported by Pylint.

src/textual/message.py
7 issues
Unable to import 'rich.repr'
Error

Line: 7 Column: 1

              from time import monotonic
from typing import ClassVar

import rich.repr

from .case import camel_to_snake
from ._types import MessageTarget



            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 9 Column: 1

              
import rich.repr

from .case import camel_to_snake
from ._types import MessageTarget


@rich.repr.auto
class Message:

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 10 Column: 1

              import rich.repr

from .case import camel_to_snake
from ._types import MessageTarget


@rich.repr.auto
class Message:
    """Base class for a message."""

            

Reported by Pylint.

Unused argument 'message'
Error

Line: 69 Column: 27

                      """Mark this event as being forwarded."""
        self._forwarded = True

    def can_replace(self, message: "Message") -> bool:
        """Check if another message may supersede this one.

        Args:
            message (Message): Another message.


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from __future__ import annotations

from asyncio import Event
from time import monotonic
from typing import ClassVar

import rich.repr

from .case import camel_to_snake

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 62 Column: 5

                      return self.__done_event

    @property
    def is_forwarded(self) -> bool:
        return self._forwarded

    def set_forwarded(self) -> None:
        """Mark this event as being forwarded."""
        self._forwarded = True

            

Reported by Pylint.

Method could be a function
Error

Line: 69 Column: 5

                      """Mark this event as being forwarded."""
        self._forwarded = True

    def can_replace(self, message: "Message") -> bool:
        """Check if another message may supersede this one.

        Args:
            message (Message): Another message.


            

Reported by Pylint.

docs/examples/messages_and_events/beep_typed.py
7 issues
Unable to import 'textual.app'
Error

Line: 1 Column: 1

              from textual.app import App
from textual import events


class Beeper(App):
    async def on_key(self, event: events.Key) -> None:
        self.console.bell()



            

Reported by Pylint.

Unable to import 'textual'
Error

Line: 2 Column: 1

              from textual.app import App
from textual import events


class Beeper(App):
    async def on_key(self, event: events.Key) -> None:
        self.console.bell()



            

Reported by Pylint.

Unused argument 'event'
Error

Line: 6 Column: 28

              

class Beeper(App):
    async def on_key(self, event: events.Key) -> None:
        self.console.bell()


Beeper.run()

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from textual.app import App
from textual import events


class Beeper(App):
    async def on_key(self, event: events.Key) -> None:
        self.console.bell()



            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 5 Column: 1

              from textual import events


class Beeper(App):
    async def on_key(self, event: events.Key) -> None:
        self.console.bell()


Beeper.run()

            

Reported by Pylint.

Missing class docstring
Error

Line: 5 Column: 1

              from textual import events


class Beeper(App):
    async def on_key(self, event: events.Key) -> None:
        self.console.bell()


Beeper.run()

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 6 Column: 5

              

class Beeper(App):
    async def on_key(self, event: events.Key) -> None:
        self.console.bell()


Beeper.run()

            

Reported by Pylint.

docs/examples/widgets/placeholders.py
6 issues
Unable to import 'textual'
Error

Line: 1 Column: 1

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


class SimpleApp(App):
    """Demonstrates smooth animation"""

    async def on_mount(self, event: events.Mount) -> None:

            

Reported by Pylint.

Unable to import 'textual.app'
Error

Line: 2 Column: 1

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


class SimpleApp(App):
    """Demonstrates smooth animation"""

    async def on_mount(self, event: events.Mount) -> None:

            

Reported by Pylint.

Unable to import 'textual.widgets'
Error

Line: 3 Column: 1

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


class SimpleApp(App):
    """Demonstrates smooth animation"""

    async def on_mount(self, event: events.Mount) -> None:

            

Reported by Pylint.

Unused argument 'event'
Error

Line: 9 Column: 30

              class SimpleApp(App):
    """Demonstrates smooth animation"""

    async def on_mount(self, event: events.Mount) -> None:
        """Build layout here."""

        await self.view.dock(Placeholder(), edge="left", size=40)
        await self.view.dock(Placeholder(), Placeholder(), edge="top")


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

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


class SimpleApp(App):
    """Demonstrates smooth animation"""

    async def on_mount(self, event: events.Mount) -> None:

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 6 Column: 1

              from textual.widgets import Placeholder


class SimpleApp(App):
    """Demonstrates smooth animation"""

    async def on_mount(self, event: events.Mount) -> None:
        """Build layout here."""


            

Reported by Pylint.