Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 891089a

Browse files
committed
API/CLN: remove threading classes from cbook
These are not used anywhere internally and no one should be using these externally.
1 parent 7285c4c commit 891089a

File tree

2 files changed

+5
-68
lines changed

2 files changed

+5
-68
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Removed threading related classes from cbook
2+
````````````````````````````````````````````
3+
The classes ``Scheduler``, ``Timeout``, and ``Idle`` were in cbook, but
4+
are not used internally. They appear to be a prototype for the idle event
5+
system which was not working and has recently been pulled out.

lib/matplotlib/cbook.py

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import os
2424
import re
2525
import sys
26-
import threading
2726
import time
2827
import traceback
2928
import types
@@ -535,7 +534,6 @@ def _remove_proxy(self, proxy):
535534
del self.callbacks[signal]
536535
del self._func_cid_map[signal]
537536

538-
539537
def disconnect(self, cid):
540538
"""
541539
disconnect the callback registered with callback id *cid*
@@ -566,72 +564,6 @@ def process(self, s, *args, **kwargs):
566564
self._remove_proxy(proxy)
567565

568566

569-
class Scheduler(threading.Thread):
570-
"""
571-
Base class for timeout and idle scheduling
572-
"""
573-
idlelock = threading.Lock()
574-
id = 0
575-
576-
def __init__(self):
577-
threading.Thread.__init__(self)
578-
self.id = Scheduler.id
579-
self._stopped = False
580-
Scheduler.id += 1
581-
self._stopevent = threading.Event()
582-
583-
def stop(self):
584-
if self._stopped:
585-
return
586-
self._stopevent.set()
587-
self.join()
588-
self._stopped = True
589-
590-
591-
class Timeout(Scheduler):
592-
"""
593-
Schedule recurring events with a wait time in seconds
594-
"""
595-
def __init__(self, wait, func):
596-
Scheduler.__init__(self)
597-
self.wait = wait
598-
self.func = func
599-
600-
def run(self):
601-
602-
while not self._stopevent.isSet():
603-
self._stopevent.wait(self.wait)
604-
Scheduler.idlelock.acquire()
605-
b = self.func(self)
606-
Scheduler.idlelock.release()
607-
if not b:
608-
break
609-
610-
611-
class Idle(Scheduler):
612-
"""
613-
Schedule callbacks when scheduler is idle
614-
"""
615-
# the prototype impl is a bit of a poor man's idle handler. It
616-
# just implements a short wait time. But it will provide a
617-
# placeholder for a proper impl ater
618-
waittime = 0.05
619-
620-
def __init__(self, func):
621-
Scheduler.__init__(self)
622-
self.func = func
623-
624-
def run(self):
625-
626-
while not self._stopevent.isSet():
627-
self._stopevent.wait(Idle.waittime)
628-
Scheduler.idlelock.acquire()
629-
b = self.func(self)
630-
Scheduler.idlelock.release()
631-
if not b:
632-
break
633-
634-
635567
class silent_list(list):
636568
"""
637569
override repr when returning a list of matplotlib artists to

0 commit comments

Comments
 (0)