From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RvEwP-0007sR-PV for garchives@archives.gentoo.org; Wed, 08 Feb 2012 21:20:38 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1116EE063D; Wed, 8 Feb 2012 21:20:30 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id C52A5E063D for ; Wed, 8 Feb 2012 21:20:30 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D26801B4035 for ; Wed, 8 Feb 2012 21:20:29 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 2247CE5400 for ; Wed, 8 Feb 2012 21:20:28 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/PollScheduler.py pym/_emerge/Scheduler.py X-VCS-Directories: pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: b003b7e2374051fa050e6a05f1defec6a6c67252 Date: Wed, 8 Feb 2012 21:20:28 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 0d37fabd-0aea-4f96-b6ac-083b100c4d05 X-Archives-Hash: f1390321b051e998f129e680f2743895 commit: b003b7e2374051fa050e6a05f1defec6a6c67252 Author: Zac Medico gentoo org> AuthorDate: Wed Feb 8 21:20:06 2012 +0000 Commit: Zac Medico gentoo org> CommitDate: Wed Feb 8 21:20:06 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Db003b7e2 EventLoop: use same method names as glib --- pym/_emerge/PollScheduler.py | 32 ++++++++++++++++---------------- pym/_emerge/Scheduler.py | 14 +++++++------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pym/_emerge/PollScheduler.py b/pym/_emerge/PollScheduler.py index b9188f7..ee00f10 100644 --- a/pym/_emerge/PollScheduler.py +++ b/pym/_emerge/PollScheduler.py @@ -158,7 +158,7 @@ class EventLoop(object): f, event =3D self._next_poll_event() x =3D event_handlers[f] if not x.callback(f, event, *x.args): - self._unregister(x.source_id) + self.source_remove(x.source_id) event_handled =3D True except StopIteration: event_handled =3D True @@ -166,7 +166,7 @@ class EventLoop(object): if not event_handled: raise AssertionError("tight loop") =20 - def _iteration(self, *args): + def iteration(self, *args): """ Like glib.MainContext.iteration(), runs a single iteration. @type may_block: bool @@ -202,14 +202,14 @@ class EventLoop(object): f, event =3D self._next_poll_event() x =3D event_handlers[f] if not x.callback(f, event, *x.args): - self._unregister(x.source_id) + self.source_remove(x.source_id) events_handled +=3D 1 except StopIteration: events_handled +=3D 1 =20 return bool(events_handled) =20 - def _idle_add(self, callback, *args): + def idle_add(self, callback, *args): """ Like glib.idle_add(), if callback returns False it is automatically removed from the list of event sources and will @@ -236,9 +236,9 @@ class EventLoop(object): # it got cancelled while executing another callback continue if not x.callback(*x.args): - self._unregister(x.source_id) + self.source_remove(x.source_id) =20 - def _timeout_add(self, interval, function, *args): + def timeout_add(self, interval, function, *args): """ Like glib.timeout_add(), interval argument is the number of milliseconds between calls to your function, and your function @@ -287,11 +287,11 @@ class EventLoop(object): continue x.timestamp =3D time.time() if not x.function(*x.args): - self._unregister(x.source_id) + self.source_remove(x.source_id) =20 return bool(ready_timeouts) =20 - def _register(self, f, condition, callback, *args): + def io_add_watch(self, f, condition, callback, *args): """ Like glib.io_add_watch(), your function should return False to stop being called, or True to continue being called. Any @@ -317,7 +317,7 @@ class EventLoop(object): self._poll_obj.register(f, condition) return source_id =20 - def _unregister(self, reg_id): + def source_remove(self, reg_id): """ Like glib.source_remove(), this returns True if the given reg_id is found and removed, and False if the reg_id is invalid or has @@ -378,15 +378,15 @@ class PollScheduler(object): self._event_loop =3D EventLoop() self._event_loop._schedule =3D self._schedule self.sched_iface =3D self._sched_iface_class( - idle_add=3Dself._event_loop._idle_add, - io_add_watch=3Dself._event_loop._register, - iteration=3Dself._event_loop._iteration, + idle_add=3Dself._event_loop.idle_add, + io_add_watch=3Dself._event_loop.io_add_watch, + iteration=3Dself._event_loop.iteration, output=3Dself._task_output, - register=3Dself._event_loop._register, + register=3Dself._event_loop.io_add_watch, run=3Dself._event_loop._poll_loop, - source_remove=3Dself._event_loop._unregister, - timeout_add=3Dself._event_loop._timeout_add, - unregister=3Dself._event_loop._unregister) + source_remove=3Dself._event_loop.source_remove, + timeout_add=3Dself._event_loop.timeout_add, + unregister=3Dself._event_loop.source_remove) =20 def terminate(self): """ diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index d2d6ad8..770cb6c 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -219,16 +219,16 @@ class Scheduler(PollScheduler): schedule=3Dself._schedule_fetch) self._sched_iface =3D self._iface_class( fetch=3Dfetch_iface, output=3Dself._task_output, - idle_add=3Dself._event_loop._idle_add, - io_add_watch=3Dself._event_loop._register, - iteration=3Dself._event_loop._iteration, - register=3Dself._event_loop._register, + idle_add=3Dself._event_loop.idle_add, + io_add_watch=3Dself._event_loop.io_add_watch, + iteration=3Dself._event_loop.iteration, + register=3Dself._event_loop.io_add_watch, schedule=3Dself._event_loop._poll_loop, scheduleSetup=3Dself._schedule_setup, scheduleUnpack=3Dself._schedule_unpack, - source_remove=3Dself._event_loop._unregister, - timeout_add=3Dself._event_loop._timeout_add, - unregister=3Dself._event_loop._unregister) + source_remove=3Dself._event_loop.source_remove, + timeout_add=3Dself._event_loop.timeout_add, + unregister=3Dself._event_loop.source_remove) =20 self._prefetchers =3D weakref.WeakValueDictionary() self._pkg_queue =3D []