Skip to content

Improve some of the incomplete types in tkinter.filedialog #14311

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

MarcellPerger1
Copy link
Contributor

Improved some of the incomplete types in the tkinter.filedialog module.

This comment has been minimized.

def files_select_event(self, event) -> None: ...
def ok_event(self, event) -> None: ...
how: str | None
def go(self, dir_or_file: StrOrBytesPath = ".", pattern: str = "*", default: str = "", key: Hashable | None = None): ...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like dir_or_file gets joined with a string, so a bytes path won't work. pattern and default are both processed through os.path.* functions, so a path-like can be accepted

Suggested change
def go(self, dir_or_file: StrOrBytesPath = ".", pattern: str = "*", default: str = "", key: Hashable | None = None): ...
def go(self, dir_or_file: StrPath = ".", pattern: StrPath = "*", default: StrPath = "", key: Hashable | None = None): ...

def get_filter(self) -> tuple[str, str]: ...
def get_selection(self) -> str: ...
def cancel_command(self, event: Event | None = None) -> None: ...
def set_filter(self, dir: StrOrBytesPath, pat: str) -> None: ...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def set_filter(self, dir: StrOrBytesPath, pat: str) -> None: ...
def set_filter(self, dir: StrPath, pat: StrPath) -> None: ...

def get_selection(self) -> str: ...
def cancel_command(self, event: Event | None = None) -> None: ...
def set_filter(self, dir: StrOrBytesPath, pat: str) -> None: ...
def set_selection(self, file: str) -> None: ...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def set_selection(self, file: str) -> None: ...
def set_selection(self, file: StrPath) -> None: ...

Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants