Skip to content

Commit

Permalink
Added complete Xlib stubs (#9279)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Waygood <[email protected]>
  • Loading branch information
Avasam and AlexWaygood authored Nov 30, 2022
1 parent 5c3f10e commit ee69f60
Show file tree
Hide file tree
Showing 69 changed files with 5,878 additions and 0 deletions.
34 changes: 34 additions & 0 deletions stubs/python-xlib/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Type helpers
Xlib._typing

# __all__ is a map at runtime
# https://github.com/python-xlib/python-xlib/pull/238
Xlib.ext(\.__all__)?

# These will unconditionally fail at runtime
# See: https://github.com/python-xlib/python-xlib/issues/253
Xlib.protocol.rq.DictWrapper.__gt__
Xlib.protocol.rq.DictWrapper.__lt__
Xlib.protocol.rq.Event.__gt__
Xlib.protocol.rq.Event.__lt__

# Default values
Xlib.protocol.display.Display.send_and_recv
# Can be None or str once instanciated
Xlib.protocol.rq.*.structcode
# Should only ever be str once instanciated
Xlib.protocol.rq.*.name

# Structs generate their attributes (@type_check_only)
Xlib.protocol.rq.Struct.__getattr__

# Iteration variable bleed into the global scope
Xlib.protocol.rq.c
# Re-export from tkinter
Xlib.ext.randr.W
# Re-exports from six
Xlib.ext.xinput.integer_types
Xlib.protocol.display.PY3
Xlib.protocol.display.byte2int
Xlib.protocol.rq.PY3
Xlib.protocol.rq.byte2int
3 changes: 3 additions & 0 deletions stubs/python-xlib/@tests/stubtest_allowlist_win32.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# failed to import, ModuleNotFoundError: No module named 'fcntl'
# https://github.com/python-xlib/python-xlib/pull/217
Xlib.support.unix_connect
5 changes: 5 additions & 0 deletions stubs/python-xlib/METADATA.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version = "0.32.*"
requires = ["types-Pillow"]

[tool.stubtest]
ignore_missing_stub = false
345 changes: 345 additions & 0 deletions stubs/python-xlib/Xlib/X.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,345 @@
NONE: int
ParentRelative: int
CopyFromParent: int
PointerWindow: int
InputFocus: int
PointerRoot: int
AnyPropertyType: int
AnyKey: int
AnyButton: int
AllTemporary: int
CurrentTime: int
NoSymbol: int
NoEventMask: int
KeyPressMask: int
KeyReleaseMask: int
ButtonPressMask: int
ButtonReleaseMask: int
EnterWindowMask: int
LeaveWindowMask: int
PointerMotionMask: int
PointerMotionHintMask: int
Button1MotionMask: int
Button2MotionMask: int
Button3MotionMask: int
Button4MotionMask: int
Button5MotionMask: int
ButtonMotionMask: int
KeymapStateMask: int
ExposureMask: int
VisibilityChangeMask: int
StructureNotifyMask: int
ResizeRedirectMask: int
SubstructureNotifyMask: int
SubstructureRedirectMask: int
FocusChangeMask: int
PropertyChangeMask: int
ColormapChangeMask: int
OwnerGrabButtonMask: int
KeyPress: int
KeyRelease: int
ButtonPress: int
ButtonRelease: int
MotionNotify: int
EnterNotify: int
LeaveNotify: int
FocusIn: int
FocusOut: int
KeymapNotify: int
Expose: int
GraphicsExpose: int
NoExpose: int
VisibilityNotify: int
CreateNotify: int
DestroyNotify: int
UnmapNotify: int
MapNotify: int
MapRequest: int
ReparentNotify: int
ConfigureNotify: int
ConfigureRequest: int
GravityNotify: int
ResizeRequest: int
CirculateNotify: int
CirculateRequest: int
PropertyNotify: int
SelectionClear: int
SelectionRequest: int
SelectionNotify: int
ColormapNotify: int
ClientMessage: int
MappingNotify: int
LASTEvent: int
ShiftMask: int
LockMask: int
ControlMask: int
Mod1Mask: int
Mod2Mask: int
Mod3Mask: int
Mod4Mask: int
Mod5Mask: int
ShiftMapIndex: int
LockMapIndex: int
ControlMapIndex: int
Mod1MapIndex: int
Mod2MapIndex: int
Mod3MapIndex: int
Mod4MapIndex: int
Mod5MapIndex: int
Button1Mask: int
Button2Mask: int
Button3Mask: int
Button4Mask: int
Button5Mask: int
AnyModifier: int
Button1: int
Button2: int
Button3: int
Button4: int
Button5: int
NotifyNormal: int
NotifyGrab: int
NotifyUngrab: int
NotifyWhileGrabbed: int
NotifyHint: int
NotifyAncestor: int
NotifyVirtual: int
NotifyInferior: int
NotifyNonlinear: int
NotifyNonlinearVirtual: int
NotifyPointer: int
NotifyPointerRoot: int
NotifyDetailNone: int
VisibilityUnobscured: int
VisibilityPartiallyObscured: int
VisibilityFullyObscured: int
PlaceOnTop: int
PlaceOnBottom: int
FamilyInternet: int
FamilyDECnet: int
FamilyChaos: int
FamilyServerInterpreted: int
FamilyInternetV6: int
PropertyNewValue: int
PropertyDelete: int
ColormapUninstalled: int
ColormapInstalled: int
GrabModeSync: int
GrabModeAsync: int
GrabSuccess: int
AlreadyGrabbed: int
GrabInvalidTime: int
GrabNotViewable: int
GrabFrozen: int
AsyncPointer: int
SyncPointer: int
ReplayPointer: int
AsyncKeyboard: int
SyncKeyboard: int
ReplayKeyboard: int
AsyncBoth: int
SyncBoth: int
RevertToNone: int
RevertToPointerRoot: int
RevertToParent: int
Success: int
BadRequest: int
BadValue: int
BadWindow: int
BadPixmap: int
BadAtom: int
BadCursor: int
BadFont: int
BadMatch: int
BadDrawable: int
BadAccess: int
BadAlloc: int
BadColor: int
BadGC: int
BadIDChoice: int
BadName: int
BadLength: int
BadImplementation: int
FirstExtensionError: int
LastExtensionError: int
InputOutput: int
InputOnly: int
CWBackPixmap: int
CWBackPixel: int
CWBorderPixmap: int
CWBorderPixel: int
CWBitGravity: int
CWWinGravity: int
CWBackingStore: int
CWBackingPlanes: int
CWBackingPixel: int
CWOverrideRedirect: int
CWSaveUnder: int
CWEventMask: int
CWDontPropagate: int
CWColormap: int
CWCursor: int
CWX: int
CWY: int
CWWidth: int
CWHeight: int
CWBorderWidth: int
CWSibling: int
CWStackMode: int
ForgetGravity: int
NorthWestGravity: int
NorthGravity: int
NorthEastGravity: int
WestGravity: int
CenterGravity: int
EastGravity: int
SouthWestGravity: int
SouthGravity: int
SouthEastGravity: int
StaticGravity: int
UnmapGravity: int
NotUseful: int
WhenMapped: int
Always: int
IsUnmapped: int
IsUnviewable: int
IsViewable: int
SetModeInsert: int
SetModeDelete: int
DestroyAll: int
RetainPermanent: int
RetainTemporary: int
Above: int
Below: int
TopIf: int
BottomIf: int
Opposite: int
RaiseLowest: int
LowerHighest: int
PropModeReplace: int
PropModePrepend: int
PropModeAppend: int
GXclear: int
GXand: int
GXandReverse: int
GXcopy: int
GXandInverted: int
GXnoop: int
GXxor: int
GXor: int
GXnor: int
GXequiv: int
GXinvert: int
GXorReverse: int
GXcopyInverted: int
GXorInverted: int
GXnand: int
GXset: int
LineSolid: int
LineOnOffDash: int
LineDoubleDash: int
CapNotLast: int
CapButt: int
CapRound: int
CapProjecting: int
JoinMiter: int
JoinRound: int
JoinBevel: int
FillSolid: int
FillTiled: int
FillStippled: int
FillOpaqueStippled: int
EvenOddRule: int
WindingRule: int
ClipByChildren: int
IncludeInferiors: int
Unsorted: int
YSorted: int
YXSorted: int
YXBanded: int
CoordModeOrigin: int
CoordModePrevious: int
Complex: int
Nonconvex: int
Convex: int
ArcChord: int
ArcPieSlice: int
GCFunction: int
GCPlaneMask: int
GCForeground: int
GCBackground: int
GCLineWidth: int
GCLineStyle: int
GCCapStyle: int
GCJoinStyle: int
GCFillStyle: int
GCFillRule: int
GCTile: int
GCStipple: int
GCTileStipXOrigin: int
GCTileStipYOrigin: int
GCFont: int
GCSubwindowMode: int
GCGraphicsExposures: int
GCClipXOrigin: int
GCClipYOrigin: int
GCClipMask: int
GCDashOffset: int
GCDashList: int
GCArcMode: int
GCLastBit: int
FontLeftToRight: int
FontRightToLeft: int
FontChange: int
XYBitmap: int
XYPixmap: int
ZPixmap: int
AllocNone: int
AllocAll: int
DoRed: int
DoGreen: int
DoBlue: int
CursorShape: int
TileShape: int
StippleShape: int
AutoRepeatModeOff: int
AutoRepeatModeOn: int
AutoRepeatModeDefault: int
LedModeOff: int
LedModeOn: int
KBKeyClickPercent: int
KBBellPercent: int
KBBellPitch: int
KBBellDuration: int
KBLed: int
KBLedMode: int
KBKey: int
KBAutoRepeatMode: int
MappingSuccess: int
MappingBusy: int
MappingFailed: int
MappingModifier: int
MappingKeyboard: int
MappingPointer: int
DontPreferBlanking: int
PreferBlanking: int
DefaultBlanking: int
DisableScreenSaver: int
DisableScreenInterval: int
DontAllowExposures: int
AllowExposures: int
DefaultExposures: int
ScreenSaverReset: int
ScreenSaverActive: int
HostInsert: int
HostDelete: int
EnableAccess: int
DisableAccess: int
StaticGray: int
GrayScale: int
StaticColor: int
PseudoColor: int
TrueColor: int
DirectColor: int
LSBFirst: int
MSBFirst: int
7 changes: 7 additions & 0 deletions stubs/python-xlib/Xlib/XK.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from Xlib.keysymdef.latin1 import *
from Xlib.keysymdef.miscellany import *
from Xlib.X import NoSymbol as NoSymbol

def string_to_keysym(keysym: str) -> int: ...
def load_keysym_group(group: str) -> None: ...
def keysym_to_string(keysym: int) -> str | None: ...
Loading

0 comments on commit ee69f60

Please sign in to comment.