Skip to content

Commit

Permalink
move constants that superclass requires to superclass
Browse files Browse the repository at this point in the history
  • Loading branch information
glyph committed Nov 2, 2022
1 parent e92e152 commit b42d47c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
17 changes: 16 additions & 1 deletion src/twisted/internet/_glibbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,22 @@ def __init__(self, glib_module: Any, gtk_module: Any, useGtk: bool = False) -> N
self._writes: Set[IWriteDescriptor] = set()
self._sources: Dict[FileDescriptor, int] = {}
self._glib = glib_module
posixbase.PosixReactorBase.__init__(self)

self._POLL_DISCONNECTED = (
glib_module.IOCondition.HUP
| glib_module.IOCondition.ERR
| glib_module.IOCondition.NVAL
)
self._POLL_IN = glib_module.IOCondition.IN
self._POLL_OUT = glib_module.IOCondition.OUT

# glib's iochannel sources won't tell us about any events that we haven't
# asked for, even if those events aren't sensible inputs to the poll()
# call.
self.INFLAGS = self._POLL_IN | self._POLL_DISCONNECTED
self.OUTFLAGS = self._POLL_OUT | self._POLL_DISCONNECTED

super().__init__()

self._source_remove = self._glib.source_remove
self._timeout_add = self._glib.timeout_add
Expand Down
14 changes: 1 addition & 13 deletions src/twisted/internet/gireactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,6 @@ class GIReactor(_glibbase.GlibReactorBase):
with C{registerGApplication}.
"""

_POLL_DISCONNECTED = (
GLib.IOCondition.HUP | GLib.IOCondition.ERR | GLib.IOCondition.NVAL
)
_POLL_IN = GLib.IOCondition.IN
_POLL_OUT = GLib.IOCondition.OUT

# glib's iochannel sources won't tell us about any events that we haven't
# asked for, even if those events aren't sensible inputs to the poll()
# call.
INFLAGS = _POLL_IN | _POLL_DISCONNECTED
OUTFLAGS = _POLL_OUT | _POLL_DISCONNECTED

# By default no Application is registered:
_gapplication = None

Expand Down Expand Up @@ -97,7 +85,7 @@ class PortableGIReactor(_glibbase.GlibReactorBase):
"""

def __init__(self, useGtk=False):
_glibbase.PortableGlibReactorBase.__init__(self, GLib, None, useGtk=useGtk)
super().__init__(GLib, None, useGtk=useGtk)

def registerGApplication(self, app):
"""
Expand Down

0 comments on commit b42d47c

Please sign in to comment.