Skip to content

Commit

Permalink
Pylint fixes for .pyi files
Browse files Browse the repository at this point in the history
  • Loading branch information
avylove committed Mar 6, 2024
1 parent c28b53f commit 05bb167
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 1 deletion.
2 changes: 2 additions & 0 deletions blessed/_capabilities.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Type hint for terminal capability builder patterns"""

# std imports
from typing import Any, Dict, Tuple, OrderedDict

Expand Down
4 changes: 4 additions & 0 deletions blessed/color.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
"""Type hints for color functions"""

# std imports
from typing import Dict, Tuple, Callable

_RGB = Tuple[int, int, int]

# pylint: disable=unused-argument,missing-function-docstring

def rgb_to_xyz(red: int, green: int, blue: int) -> Tuple[float, float, float]: ...
def xyz_to_lab(
x_val: float, y_val: float, z_val: float
Expand Down
4 changes: 4 additions & 0 deletions blessed/colorspace.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
"""Type hints for color reference data"""

# std imports
from typing import Set, Dict, Tuple, NamedTuple

CGA_COLORS: Set[str]

#pylint: disable=missing-class-docstring

class RGBColor(NamedTuple):
red: int
green: int
Expand Down
4 changes: 4 additions & 0 deletions blessed/formatters.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Type hints for sequence-formatting functions"""

# std imports
from typing import (Any,
Set,
Expand All @@ -19,6 +21,8 @@ COMPOUNDABLES: Set[str]

_T = TypeVar("_T")

# pylint: disable=unused-argument,missing-function-docstring,missing-class-docstring

class ParameterizingString(str):
def __new__(cls: Type[_T], cap: str, normal: str = ..., name: str = ...) -> _T: ...
@overload
Expand Down
4 changes: 4 additions & 0 deletions blessed/keyboard.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Type hints for 'keyboard awareness'"""

# std imports
from typing import Set, Dict, Type, Mapping, TypeVar, Iterable, Optional, OrderedDict

Expand All @@ -6,6 +8,8 @@ from .terminal import Terminal

_T = TypeVar("_T")

# pylint: disable=unused-argument,missing-function-docstring,missing-class-docstring

class Keystroke(str):
def __new__(
cls: Type[_T],
Expand Down
2 changes: 2 additions & 0 deletions blessed/sequences.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
__all__ = ('Sequence', 'SequenceTextWrapper', 'iter_parse', 'measure_length')


# pylint: disable=unused-argument,missing-function-docstring

class Termcap(object):
"""Terminal capability of given variable name and pattern."""

Expand Down
5 changes: 5 additions & 0 deletions blessed/sequences.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Type hints for 'sequence awareness'"""

# std imports
import textwrap
from typing import Any, Type, Tuple, Pattern, TypeVar, Iterator, Optional, SupportsIndex
Expand All @@ -7,6 +9,9 @@ from .terminal import Terminal

_T = TypeVar("_T")

# pylint: disable=unused-argument,missing-function-docstring,missing-class-docstring
# pylint: disable=super-init-not-called

class Termcap:
name: str = ...
pattern: str = ...
Expand Down
8 changes: 7 additions & 1 deletion blessed/terminal.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Type hints for :class:`Terminal`, the primary API entry point."""

# std imports
from typing import IO, Any, List, Tuple, Union, Optional, OrderedDict, SupportsIndex, ContextManager

Expand All @@ -11,6 +13,9 @@ from .formatters import (FormattingString,

HAS_TTY: bool

# pylint: disable=unused-argument,missing-function-docstring,missing-class-docstring
# pylint: disable=too-many-public-methods,too-few-public-methods

class Terminal:
caps: OrderedDict[str, Termcap]
errors: List[str] = ...
Expand Down Expand Up @@ -105,4 +110,5 @@ class Terminal:
self, timeout: Optional[float] = ..., esc_delay: float = ...
) -> Keystroke: ...

class WINSZ: ...
class WINSZ:
...
4 changes: 4 additions & 0 deletions blessed/win_terminal.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
"""Type hints for Windows version of :class:`Terminal`."""

# std imports
from typing import Optional, ContextManager

# local
from .terminal import Terminal as _Terminal

# pylint: disable=missing-class-docstring

class Terminal(_Terminal):
def getch(self) -> str: ...
def kbhit(self, timeout: Optional[float] = ...) -> bool: ...
Expand Down

0 comments on commit 05bb167

Please sign in to comment.