From 3fda3af0df1a92c5794c6b396501c97647853222 Mon Sep 17 00:00:00 2001 From: Joan Lucas Date: Mon, 27 Nov 2023 20:59:26 -0300 Subject: [PATCH] Added functions return typing in some files: __init__.py; keys.py and lazyre.py --- bpython/__init__.py | 3 ++- bpython/keys.py | 4 ++-- bpython/lazyre.py | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/bpython/__init__.py b/bpython/__init__.py index dff06c0f..8c7bfb37 100644 --- a/bpython/__init__.py +++ b/bpython/__init__.py @@ -21,6 +21,7 @@ # THE SOFTWARE. import os.path +from typing import Any try: from ._version import __version__ as version # type: ignore @@ -36,7 +37,7 @@ package_dir = os.path.abspath(os.path.dirname(__file__)) -def embed(locals_=None, args=None, banner=None): +def embed(locals_=None, args=None, banner=None) -> Any: if args is None: args = ["-i", "-q"] diff --git a/bpython/keys.py b/bpython/keys.py index cfcac86b..fe27dbcc 100644 --- a/bpython/keys.py +++ b/bpython/keys.py @@ -42,10 +42,10 @@ def __getitem__(self, key: str) -> T: f"Configured keymap ({key}) does not exist in bpython.keys" ) - def __delitem__(self, key: str): + def __delitem__(self, key: str) -> None: del self.map[key] - def __setitem__(self, key: str, value: T): + def __setitem__(self, key: str, value: T) -> None: self.map[key] = value diff --git a/bpython/lazyre.py b/bpython/lazyre.py index 0ca5b9ff..8d166b74 100644 --- a/bpython/lazyre.py +++ b/bpython/lazyre.py @@ -21,7 +21,7 @@ # THE SOFTWARE. import re -from typing import Optional, Pattern, Match, Optional +from typing import Optional, Pattern, Match, Optional, Iterator try: from functools import cached_property @@ -43,7 +43,7 @@ def __init__(self, regex: str, flags: int = 0) -> None: def compiled(self) -> Pattern[str]: return re.compile(self.regex, self.flags) - def finditer(self, *args, **kwargs): + def finditer(self, *args, **kwargs) -> Iterator[Match[str]]: return self.compiled.finditer(*args, **kwargs) def search(self, *args, **kwargs) -> Optional[Match[str]]: pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy