Skip to content

Added functions return typing in some files: __init__.py; keys.py and lazyre.py #1003

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bpython/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# THE SOFTWARE.

import os.path
from typing import Any

try:
from ._version import __version__ as version # type: ignore
Expand All @@ -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"]

Expand Down
4 changes: 2 additions & 2 deletions bpython/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
4 changes: 2 additions & 2 deletions bpython/lazyre.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]]:
Expand Down
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