Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Merge branch 'master' of https://github.com/python-xlib/python-xlib i…
…nto type-comments
  • Loading branch information
Avasam committed Dec 27, 2022
commit 1c163a27a7967d72485e58590b47d543fdb7435a
6 changes: 3 additions & 3 deletions Xlib/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def __init__(self, *args, **keys):
protocol_display.Display.__init__(self, *args, **keys)
self._atom_cache = {}

def get_atom(self, atomname, only_if_exists=0):
def get_atom(self, atomname, only_if_exists=False):
# type: (str, bool) -> int
if atomname in self._atom_cache:
return self._atom_cache[atomname]
Expand Down Expand Up @@ -554,7 +554,7 @@ def rebind_string(self, keysym, newstring):
### X requests
###

def intern_atom(self, name, only_if_exists = 0):
def intern_atom(self, name, only_if_exists = False):
# type: (str, bool) -> int
"""Intern the string name, returning its atom number. If
only_if_exists is true and the atom does not already exist, it
Expand All @@ -564,7 +564,7 @@ def intern_atom(self, name, only_if_exists = 0):
only_if_exists = only_if_exists)
return r.atom

def get_atom(self, atom, only_if_exists = 0):
def get_atom(self, atom, only_if_exists = False):
# type: (str, bool) -> int
"""Alias for intern_atom, using internal cache"""
return self.display.get_atom(atom, only_if_exists)
Expand Down
2 changes: 1 addition & 1 deletion Xlib/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class XError(rq.GetAttrData, Exception):

def __init__(self, display, data):
# type: (display.Display, _SliceableBuffer) -> None
self._data, data = self._fields.parse_binary(data, display, rawdict = 1)
self._data, _ = self._fields.parse_binary(data, display, rawdict = True)

def __str__(self):
s = []
Expand Down
3 changes: 1 addition & 2 deletions Xlib/ext/randr.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@


from Xlib import X
from Xlib.protocol import rq, structs
from Xlib.protocol import rq
try:
from typing import TYPE_CHECKING
except ImportError:
TYPE_CHECKING = False
if TYPE_CHECKING:
from Xlib import error
from Xlib.display import Display
from Xlib.protocol import request
from Xlib.xobject import resource, drawable
Expand Down
1 change: 0 additions & 1 deletion Xlib/ext/xfixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
ShowCursor requests and SelectionNotify events are provided.
'''

from Xlib import X
from Xlib.protocol import rq, request
from Xlib.display import Display
from Xlib.xobject import resource, drawable
Expand Down
2 changes: 1 addition & 1 deletion Xlib/protocol/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def close_internal(self, whom):
self.socket_error_lock.release()


def send_and_recv(self, flush = None, event = None, request = None, recv = None):
def send_and_recv(self, flush = False, event = False, request = None, recv = False):
# type: (bool, bool, int | None, bool) -> None
"""send_and_recv(flush = None, event = None, request = None, recv = None)

Expand Down
6 changes: 3 additions & 3 deletions Xlib/protocol/rq.py
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@ def parse_value(self, val, display, rawdict):
def parse_value(self, val, display, rawdict = False):
# type: (_SliceableBuffer, display.Display | None, Literal[False]) -> DictWrapper
pass
def parse_value(self, val, display, rawdict = 0):
def parse_value(self, val, display, rawdict = False):
# type: (_SliceableBuffer, display.Display | None, bool) -> dict[str, Any] | DictWrapper

"""This function is used by List and Object fields to convert
Expand Down Expand Up @@ -1267,7 +1267,7 @@ def parse_binary(self, data, display, rawdict):
def parse_binary(self, data, display, rawdict = False):
# type: (_SliceableBuffer, display.Display | None, Literal[False]) -> tuple[DictWrapper , _SliceableBuffer]
pass
def parse_binary(self, data, display, rawdict = 0):
def parse_binary(self, data, display, rawdict = False):
# type: (_SliceableBuffer, display.Display | None, bool) -> tuple[DictWrapper | dict[str, Any], _SliceableBuffer]

"""values, remdata = s.parse_binary(data, display, rawdict = False)
Expand Down Expand Up @@ -1510,7 +1510,7 @@ def _set_error(self, error):
return 0

class ReplyRequest(GetAttrData):
def __init__(self, display, defer = 0, *args, **keys):
def __init__(self, display, defer = False, *args, **keys):
# type: (display.Display, bool, object, object) -> None
self._display = display
self._binary = self._request.to_binary(*args, **keys)
Expand Down
10 changes: 0 additions & 10 deletions Xlib/support/unix_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@
import os
import platform
import socket

try:
import fcntl

FD_CLOEXEC = getattr(fcntl, 'FD_CLOEXEC', 1)
F_SETFD = getattr(fcntl, 'F_SETFD', 2)
except ImportError:
FD_CLOEXEC = 1
F_SETFD = 2

from Xlib import error, xauth


Expand Down
6 changes: 3 additions & 3 deletions Xlib/xobject/drawable.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ def delete_property(self, property, onerror = None):
window = self.id,
property = property)

def get_property(self, property, property_type, offset, length, delete = 0):
def get_property(self, property, property_type, offset, length, delete = False):
# type: (int, int, int, int, bool) -> request.GetProperty | None
r = request.GetProperty(display = self.display,
delete = delete,
Expand Down Expand Up @@ -576,7 +576,7 @@ def convert_selection(self, selection, target, property, time, onerror = None):
property = property,
time = time)

def send_event(self, event, event_mask = 0, propagate = 0, onerror = None):
def send_event(self, event, event_mask = 0, propagate = False, onerror = None):
# type: (rq.Event, int, bool, _ErrorHandler[object] | None) -> None
request.SendEvent(display = self.display,
onerror = onerror,
Expand Down Expand Up @@ -700,7 +700,7 @@ def set_input_focus(self, revert_to, time, onerror = None):
focus = self.id,
time = time)

def clear_area(self, x = 0, y = 0, width = 0, height = 0, exposures = 0, onerror = None):
def clear_area(self, x = 0, y = 0, width = 0, height = 0, exposures = False, onerror = None):
# type: (int, int, int, int, bool, _ErrorHandler[object] | None) -> None
request.ClearArea(display = self.display,
onerror = onerror,
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.