Skip to content

py.typed and type comments #251

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

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
Draft
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ nosetests.xml
coverage.xml
*,cover
.hypothesis/
Coverage_report/
profilex_output

# Translations
*.mo
Expand Down
12 changes: 12 additions & 0 deletions Xlib/XK.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@

from Xlib.X import NoSymbol

try:
from typing import TYPE_CHECKING
except ImportError:
TYPE_CHECKING = False

def string_to_keysym(keysym):
# type: (str) -> int
'''Return the (16 bit) numeric code of keysym.

Given the name of a keysym as a string, return its numeric code.
Expand All @@ -34,6 +40,7 @@ def string_to_keysym(keysym):
return globals().get('XK_' + keysym, NoSymbol)

def load_keysym_group(group):
# type: (str) -> None
'''Load all the keysyms in group.

Given a group name such as 'latin1' or 'katakana' load the keysyms
Expand Down Expand Up @@ -64,10 +71,15 @@ def _load_keysyms_into_XK(mod):

# Always import miscellany and latin1 keysyms
load_keysym_group('miscellany')
if TYPE_CHECKING:
from Xlib.keysymdef.miscellany import *
load_keysym_group('latin1')
if TYPE_CHECKING:
from Xlib.keysymdef.latin1 import *


def keysym_to_string(keysym):
# type: (int) -> str | None
'''Translate a keysym (16 bit number) into a python string.

This will pass 0 to 0xff as well as XK_BackSpace, XK_Tab, XK_Clear,
Expand Down
Loading
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