ZTWHHH commited on
Commit
9028976
·
verified ·
1 Parent(s): 6e7736c

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. parrot/lib/python3.10/concurrent/__pycache__/__init__.cpython-310.pyc +0 -0
  2. parrot/lib/python3.10/concurrent/futures/__pycache__/process.cpython-310.pyc +0 -0
  3. parrot/lib/python3.10/concurrent/futures/_base.py +656 -0
  4. parrot/lib/python3.10/encodings/iso2022_jp_2.py +39 -0
  5. parrot/lib/python3.10/encodings/iso8859_8.py +307 -0
  6. parrot/lib/python3.10/idlelib/Icons/idle.ico +0 -0
  7. parrot/lib/python3.10/idlelib/NEWS.txt +1321 -0
  8. parrot/lib/python3.10/idlelib/TODO.txt +210 -0
  9. parrot/lib/python3.10/idlelib/__pycache__/calltip_w.cpython-310.pyc +0 -0
  10. parrot/lib/python3.10/idlelib/__pycache__/colorizer.cpython-310.pyc +0 -0
  11. parrot/lib/python3.10/idlelib/__pycache__/debugobj_r.cpython-310.pyc +0 -0
  12. parrot/lib/python3.10/idlelib/__pycache__/editor.cpython-310.pyc +0 -0
  13. parrot/lib/python3.10/idlelib/__pycache__/filelist.cpython-310.pyc +0 -0
  14. parrot/lib/python3.10/idlelib/__pycache__/format.cpython-310.pyc +0 -0
  15. parrot/lib/python3.10/idlelib/__pycache__/multicall.cpython-310.pyc +0 -0
  16. parrot/lib/python3.10/idlelib/__pycache__/outwin.cpython-310.pyc +0 -0
  17. parrot/lib/python3.10/idlelib/__pycache__/percolator.cpython-310.pyc +0 -0
  18. parrot/lib/python3.10/idlelib/__pycache__/query.cpython-310.pyc +0 -0
  19. parrot/lib/python3.10/idlelib/__pycache__/run.cpython-310.pyc +0 -0
  20. parrot/lib/python3.10/idlelib/__pycache__/runscript.cpython-310.pyc +0 -0
  21. parrot/lib/python3.10/idlelib/__pycache__/scrolledlist.cpython-310.pyc +0 -0
  22. parrot/lib/python3.10/idlelib/__pycache__/search.cpython-310.pyc +0 -0
  23. parrot/lib/python3.10/idlelib/__pycache__/searchengine.cpython-310.pyc +0 -0
  24. parrot/lib/python3.10/idlelib/__pycache__/statusbar.cpython-310.pyc +0 -0
  25. parrot/lib/python3.10/idlelib/__pycache__/textview.cpython-310.pyc +0 -0
  26. parrot/lib/python3.10/idlelib/__pycache__/undo.cpython-310.pyc +0 -0
  27. parrot/lib/python3.10/idlelib/__pycache__/zzdummy.cpython-310.pyc +0 -0
  28. parrot/lib/python3.10/idlelib/autocomplete.py +228 -0
  29. parrot/lib/python3.10/idlelib/autoexpand.py +96 -0
  30. parrot/lib/python3.10/idlelib/config.py +911 -0
  31. parrot/lib/python3.10/idlelib/history.py +106 -0
  32. parrot/lib/python3.10/idlelib/idle_test/__init__.py +17 -0
  33. parrot/lib/python3.10/idlelib/idle_test/__pycache__/htest.cpython-310.pyc +0 -0
  34. parrot/lib/python3.10/idlelib/idle_test/__pycache__/mock_idle.cpython-310.pyc +0 -0
  35. parrot/lib/python3.10/idlelib/idle_test/__pycache__/mock_tk.cpython-310.pyc +0 -0
  36. parrot/lib/python3.10/idlelib/idle_test/__pycache__/template.cpython-310.pyc +0 -0
  37. parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_autocomplete_w.cpython-310.pyc +0 -0
  38. parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_editmenu.cpython-310.pyc +0 -0
  39. parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_editor.cpython-310.pyc +0 -0
  40. parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_grep.cpython-310.pyc +0 -0
  41. parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_parenmatch.cpython-310.pyc +0 -0
  42. parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_pathbrowser.cpython-310.pyc +0 -0
  43. parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_percolator.cpython-310.pyc +0 -0
  44. parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_pyparse.cpython-310.pyc +0 -0
  45. parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_pyshell.cpython-310.pyc +0 -0
  46. parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_sidebar.cpython-310.pyc +0 -0
  47. parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_stackviewer.cpython-310.pyc +0 -0
  48. parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_statusbar.cpython-310.pyc +0 -0
  49. parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_textview.cpython-310.pyc +0 -0
  50. parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_undo.cpython-310.pyc +0 -0
parrot/lib/python3.10/concurrent/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (389 Bytes). View file
 
parrot/lib/python3.10/concurrent/futures/__pycache__/process.cpython-310.pyc ADDED
Binary file (22 kB). View file
 
parrot/lib/python3.10/concurrent/futures/_base.py ADDED
@@ -0,0 +1,656 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2009 Brian Quinlan. All Rights Reserved.
2
+ # Licensed to PSF under a Contributor Agreement.
3
+
4
+ __author__ = 'Brian Quinlan (brian@sweetapp.com)'
5
+
6
+ import collections
7
+ import logging
8
+ import threading
9
+ import time
10
+ import types
11
+
12
+ FIRST_COMPLETED = 'FIRST_COMPLETED'
13
+ FIRST_EXCEPTION = 'FIRST_EXCEPTION'
14
+ ALL_COMPLETED = 'ALL_COMPLETED'
15
+ _AS_COMPLETED = '_AS_COMPLETED'
16
+
17
+ # Possible future states (for internal use by the futures package).
18
+ PENDING = 'PENDING'
19
+ RUNNING = 'RUNNING'
20
+ # The future was cancelled by the user...
21
+ CANCELLED = 'CANCELLED'
22
+ # ...and _Waiter.add_cancelled() was called by a worker.
23
+ CANCELLED_AND_NOTIFIED = 'CANCELLED_AND_NOTIFIED'
24
+ FINISHED = 'FINISHED'
25
+
26
+ _FUTURE_STATES = [
27
+ PENDING,
28
+ RUNNING,
29
+ CANCELLED,
30
+ CANCELLED_AND_NOTIFIED,
31
+ FINISHED
32
+ ]
33
+
34
+ _STATE_TO_DESCRIPTION_MAP = {
35
+ PENDING: "pending",
36
+ RUNNING: "running",
37
+ CANCELLED: "cancelled",
38
+ CANCELLED_AND_NOTIFIED: "cancelled",
39
+ FINISHED: "finished"
40
+ }
41
+
42
+ # Logger for internal use by the futures package.
43
+ LOGGER = logging.getLogger("concurrent.futures")
44
+
45
+ class Error(Exception):
46
+ """Base class for all future-related exceptions."""
47
+ pass
48
+
49
+ class CancelledError(Error):
50
+ """The Future was cancelled."""
51
+ pass
52
+
53
+ class TimeoutError(Error):
54
+ """The operation exceeded the given deadline."""
55
+ pass
56
+
57
+ class InvalidStateError(Error):
58
+ """The operation is not allowed in this state."""
59
+ pass
60
+
61
+ class _Waiter(object):
62
+ """Provides the event that wait() and as_completed() block on."""
63
+ def __init__(self):
64
+ self.event = threading.Event()
65
+ self.finished_futures = []
66
+
67
+ def add_result(self, future):
68
+ self.finished_futures.append(future)
69
+
70
+ def add_exception(self, future):
71
+ self.finished_futures.append(future)
72
+
73
+ def add_cancelled(self, future):
74
+ self.finished_futures.append(future)
75
+
76
+ class _AsCompletedWaiter(_Waiter):
77
+ """Used by as_completed()."""
78
+
79
+ def __init__(self):
80
+ super(_AsCompletedWaiter, self).__init__()
81
+ self.lock = threading.Lock()
82
+
83
+ def add_result(self, future):
84
+ with self.lock:
85
+ super(_AsCompletedWaiter, self).add_result(future)
86
+ self.event.set()
87
+
88
+ def add_exception(self, future):
89
+ with self.lock:
90
+ super(_AsCompletedWaiter, self).add_exception(future)
91
+ self.event.set()
92
+
93
+ def add_cancelled(self, future):
94
+ with self.lock:
95
+ super(_AsCompletedWaiter, self).add_cancelled(future)
96
+ self.event.set()
97
+
98
+ class _FirstCompletedWaiter(_Waiter):
99
+ """Used by wait(return_when=FIRST_COMPLETED)."""
100
+
101
+ def add_result(self, future):
102
+ super().add_result(future)
103
+ self.event.set()
104
+
105
+ def add_exception(self, future):
106
+ super().add_exception(future)
107
+ self.event.set()
108
+
109
+ def add_cancelled(self, future):
110
+ super().add_cancelled(future)
111
+ self.event.set()
112
+
113
+ class _AllCompletedWaiter(_Waiter):
114
+ """Used by wait(return_when=FIRST_EXCEPTION and ALL_COMPLETED)."""
115
+
116
+ def __init__(self, num_pending_calls, stop_on_exception):
117
+ self.num_pending_calls = num_pending_calls
118
+ self.stop_on_exception = stop_on_exception
119
+ self.lock = threading.Lock()
120
+ super().__init__()
121
+
122
+ def _decrement_pending_calls(self):
123
+ with self.lock:
124
+ self.num_pending_calls -= 1
125
+ if not self.num_pending_calls:
126
+ self.event.set()
127
+
128
+ def add_result(self, future):
129
+ super().add_result(future)
130
+ self._decrement_pending_calls()
131
+
132
+ def add_exception(self, future):
133
+ super().add_exception(future)
134
+ if self.stop_on_exception:
135
+ self.event.set()
136
+ else:
137
+ self._decrement_pending_calls()
138
+
139
+ def add_cancelled(self, future):
140
+ super().add_cancelled(future)
141
+ self._decrement_pending_calls()
142
+
143
+ class _AcquireFutures(object):
144
+ """A context manager that does an ordered acquire of Future conditions."""
145
+
146
+ def __init__(self, futures):
147
+ self.futures = sorted(futures, key=id)
148
+
149
+ def __enter__(self):
150
+ for future in self.futures:
151
+ future._condition.acquire()
152
+
153
+ def __exit__(self, *args):
154
+ for future in self.futures:
155
+ future._condition.release()
156
+
157
+ def _create_and_install_waiters(fs, return_when):
158
+ if return_when == _AS_COMPLETED:
159
+ waiter = _AsCompletedWaiter()
160
+ elif return_when == FIRST_COMPLETED:
161
+ waiter = _FirstCompletedWaiter()
162
+ else:
163
+ pending_count = sum(
164
+ f._state not in [CANCELLED_AND_NOTIFIED, FINISHED] for f in fs)
165
+
166
+ if return_when == FIRST_EXCEPTION:
167
+ waiter = _AllCompletedWaiter(pending_count, stop_on_exception=True)
168
+ elif return_when == ALL_COMPLETED:
169
+ waiter = _AllCompletedWaiter(pending_count, stop_on_exception=False)
170
+ else:
171
+ raise ValueError("Invalid return condition: %r" % return_when)
172
+
173
+ for f in fs:
174
+ f._waiters.append(waiter)
175
+
176
+ return waiter
177
+
178
+
179
+ def _yield_finished_futures(fs, waiter, ref_collect):
180
+ """
181
+ Iterate on the list *fs*, yielding finished futures one by one in
182
+ reverse order.
183
+ Before yielding a future, *waiter* is removed from its waiters
184
+ and the future is removed from each set in the collection of sets
185
+ *ref_collect*.
186
+
187
+ The aim of this function is to avoid keeping stale references after
188
+ the future is yielded and before the iterator resumes.
189
+ """
190
+ while fs:
191
+ f = fs[-1]
192
+ for futures_set in ref_collect:
193
+ futures_set.remove(f)
194
+ with f._condition:
195
+ f._waiters.remove(waiter)
196
+ del f
197
+ # Careful not to keep a reference to the popped value
198
+ yield fs.pop()
199
+
200
+
201
+ def as_completed(fs, timeout=None):
202
+ """An iterator over the given futures that yields each as it completes.
203
+
204
+ Args:
205
+ fs: The sequence of Futures (possibly created by different Executors) to
206
+ iterate over.
207
+ timeout: The maximum number of seconds to wait. If None, then there
208
+ is no limit on the wait time.
209
+
210
+ Returns:
211
+ An iterator that yields the given Futures as they complete (finished or
212
+ cancelled). If any given Futures are duplicated, they will be returned
213
+ once.
214
+
215
+ Raises:
216
+ TimeoutError: If the entire result iterator could not be generated
217
+ before the given timeout.
218
+ """
219
+ if timeout is not None:
220
+ end_time = timeout + time.monotonic()
221
+
222
+ fs = set(fs)
223
+ total_futures = len(fs)
224
+ with _AcquireFutures(fs):
225
+ finished = set(
226
+ f for f in fs
227
+ if f._state in [CANCELLED_AND_NOTIFIED, FINISHED])
228
+ pending = fs - finished
229
+ waiter = _create_and_install_waiters(fs, _AS_COMPLETED)
230
+ finished = list(finished)
231
+ try:
232
+ yield from _yield_finished_futures(finished, waiter,
233
+ ref_collect=(fs,))
234
+
235
+ while pending:
236
+ if timeout is None:
237
+ wait_timeout = None
238
+ else:
239
+ wait_timeout = end_time - time.monotonic()
240
+ if wait_timeout < 0:
241
+ raise TimeoutError(
242
+ '%d (of %d) futures unfinished' % (
243
+ len(pending), total_futures))
244
+
245
+ waiter.event.wait(wait_timeout)
246
+
247
+ with waiter.lock:
248
+ finished = waiter.finished_futures
249
+ waiter.finished_futures = []
250
+ waiter.event.clear()
251
+
252
+ # reverse to keep finishing order
253
+ finished.reverse()
254
+ yield from _yield_finished_futures(finished, waiter,
255
+ ref_collect=(fs, pending))
256
+
257
+ finally:
258
+ # Remove waiter from unfinished futures
259
+ for f in fs:
260
+ with f._condition:
261
+ f._waiters.remove(waiter)
262
+
263
+ DoneAndNotDoneFutures = collections.namedtuple(
264
+ 'DoneAndNotDoneFutures', 'done not_done')
265
+ def wait(fs, timeout=None, return_when=ALL_COMPLETED):
266
+ """Wait for the futures in the given sequence to complete.
267
+
268
+ Args:
269
+ fs: The sequence of Futures (possibly created by different Executors) to
270
+ wait upon.
271
+ timeout: The maximum number of seconds to wait. If None, then there
272
+ is no limit on the wait time.
273
+ return_when: Indicates when this function should return. The options
274
+ are:
275
+
276
+ FIRST_COMPLETED - Return when any future finishes or is
277
+ cancelled.
278
+ FIRST_EXCEPTION - Return when any future finishes by raising an
279
+ exception. If no future raises an exception
280
+ then it is equivalent to ALL_COMPLETED.
281
+ ALL_COMPLETED - Return when all futures finish or are cancelled.
282
+
283
+ Returns:
284
+ A named 2-tuple of sets. The first set, named 'done', contains the
285
+ futures that completed (is finished or cancelled) before the wait
286
+ completed. The second set, named 'not_done', contains uncompleted
287
+ futures. Duplicate futures given to *fs* are removed and will be
288
+ returned only once.
289
+ """
290
+ fs = set(fs)
291
+ with _AcquireFutures(fs):
292
+ done = {f for f in fs
293
+ if f._state in [CANCELLED_AND_NOTIFIED, FINISHED]}
294
+ not_done = fs - done
295
+ if (return_when == FIRST_COMPLETED) and done:
296
+ return DoneAndNotDoneFutures(done, not_done)
297
+ elif (return_when == FIRST_EXCEPTION) and done:
298
+ if any(f for f in done
299
+ if not f.cancelled() and f.exception() is not None):
300
+ return DoneAndNotDoneFutures(done, not_done)
301
+
302
+ if len(done) == len(fs):
303
+ return DoneAndNotDoneFutures(done, not_done)
304
+
305
+ waiter = _create_and_install_waiters(fs, return_when)
306
+
307
+ waiter.event.wait(timeout)
308
+ for f in fs:
309
+ with f._condition:
310
+ f._waiters.remove(waiter)
311
+
312
+ done.update(waiter.finished_futures)
313
+ return DoneAndNotDoneFutures(done, fs - done)
314
+
315
+
316
+ def _result_or_cancel(fut, timeout=None):
317
+ try:
318
+ try:
319
+ return fut.result(timeout)
320
+ finally:
321
+ fut.cancel()
322
+ finally:
323
+ # Break a reference cycle with the exception in self._exception
324
+ del fut
325
+
326
+
327
+ class Future(object):
328
+ """Represents the result of an asynchronous computation."""
329
+
330
+ def __init__(self):
331
+ """Initializes the future. Should not be called by clients."""
332
+ self._condition = threading.Condition()
333
+ self._state = PENDING
334
+ self._result = None
335
+ self._exception = None
336
+ self._waiters = []
337
+ self._done_callbacks = []
338
+
339
+ def _invoke_callbacks(self):
340
+ for callback in self._done_callbacks:
341
+ try:
342
+ callback(self)
343
+ except Exception:
344
+ LOGGER.exception('exception calling callback for %r', self)
345
+
346
+ def __repr__(self):
347
+ with self._condition:
348
+ if self._state == FINISHED:
349
+ if self._exception:
350
+ return '<%s at %#x state=%s raised %s>' % (
351
+ self.__class__.__name__,
352
+ id(self),
353
+ _STATE_TO_DESCRIPTION_MAP[self._state],
354
+ self._exception.__class__.__name__)
355
+ else:
356
+ return '<%s at %#x state=%s returned %s>' % (
357
+ self.__class__.__name__,
358
+ id(self),
359
+ _STATE_TO_DESCRIPTION_MAP[self._state],
360
+ self._result.__class__.__name__)
361
+ return '<%s at %#x state=%s>' % (
362
+ self.__class__.__name__,
363
+ id(self),
364
+ _STATE_TO_DESCRIPTION_MAP[self._state])
365
+
366
+ def cancel(self):
367
+ """Cancel the future if possible.
368
+
369
+ Returns True if the future was cancelled, False otherwise. A future
370
+ cannot be cancelled if it is running or has already completed.
371
+ """
372
+ with self._condition:
373
+ if self._state in [RUNNING, FINISHED]:
374
+ return False
375
+
376
+ if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
377
+ return True
378
+
379
+ self._state = CANCELLED
380
+ self._condition.notify_all()
381
+
382
+ self._invoke_callbacks()
383
+ return True
384
+
385
+ def cancelled(self):
386
+ """Return True if the future was cancelled."""
387
+ with self._condition:
388
+ return self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]
389
+
390
+ def running(self):
391
+ """Return True if the future is currently executing."""
392
+ with self._condition:
393
+ return self._state == RUNNING
394
+
395
+ def done(self):
396
+ """Return True if the future was cancelled or finished executing."""
397
+ with self._condition:
398
+ return self._state in [CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED]
399
+
400
+ def __get_result(self):
401
+ if self._exception:
402
+ try:
403
+ raise self._exception
404
+ finally:
405
+ # Break a reference cycle with the exception in self._exception
406
+ self = None
407
+ else:
408
+ return self._result
409
+
410
+ def add_done_callback(self, fn):
411
+ """Attaches a callable that will be called when the future finishes.
412
+
413
+ Args:
414
+ fn: A callable that will be called with this future as its only
415
+ argument when the future completes or is cancelled. The callable
416
+ will always be called by a thread in the same process in which
417
+ it was added. If the future has already completed or been
418
+ cancelled then the callable will be called immediately. These
419
+ callables are called in the order that they were added.
420
+ """
421
+ with self._condition:
422
+ if self._state not in [CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED]:
423
+ self._done_callbacks.append(fn)
424
+ return
425
+ try:
426
+ fn(self)
427
+ except Exception:
428
+ LOGGER.exception('exception calling callback for %r', self)
429
+
430
+ def result(self, timeout=None):
431
+ """Return the result of the call that the future represents.
432
+
433
+ Args:
434
+ timeout: The number of seconds to wait for the result if the future
435
+ isn't done. If None, then there is no limit on the wait time.
436
+
437
+ Returns:
438
+ The result of the call that the future represents.
439
+
440
+ Raises:
441
+ CancelledError: If the future was cancelled.
442
+ TimeoutError: If the future didn't finish executing before the given
443
+ timeout.
444
+ Exception: If the call raised then that exception will be raised.
445
+ """
446
+ try:
447
+ with self._condition:
448
+ if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
449
+ raise CancelledError()
450
+ elif self._state == FINISHED:
451
+ return self.__get_result()
452
+
453
+ self._condition.wait(timeout)
454
+
455
+ if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
456
+ raise CancelledError()
457
+ elif self._state == FINISHED:
458
+ return self.__get_result()
459
+ else:
460
+ raise TimeoutError()
461
+ finally:
462
+ # Break a reference cycle with the exception in self._exception
463
+ self = None
464
+
465
+ def exception(self, timeout=None):
466
+ """Return the exception raised by the call that the future represents.
467
+
468
+ Args:
469
+ timeout: The number of seconds to wait for the exception if the
470
+ future isn't done. If None, then there is no limit on the wait
471
+ time.
472
+
473
+ Returns:
474
+ The exception raised by the call that the future represents or None
475
+ if the call completed without raising.
476
+
477
+ Raises:
478
+ CancelledError: If the future was cancelled.
479
+ TimeoutError: If the future didn't finish executing before the given
480
+ timeout.
481
+ """
482
+
483
+ with self._condition:
484
+ if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
485
+ raise CancelledError()
486
+ elif self._state == FINISHED:
487
+ return self._exception
488
+
489
+ self._condition.wait(timeout)
490
+
491
+ if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
492
+ raise CancelledError()
493
+ elif self._state == FINISHED:
494
+ return self._exception
495
+ else:
496
+ raise TimeoutError()
497
+
498
+ # The following methods should only be used by Executors and in tests.
499
+ def set_running_or_notify_cancel(self):
500
+ """Mark the future as running or process any cancel notifications.
501
+
502
+ Should only be used by Executor implementations and unit tests.
503
+
504
+ If the future has been cancelled (cancel() was called and returned
505
+ True) then any threads waiting on the future completing (though calls
506
+ to as_completed() or wait()) are notified and False is returned.
507
+
508
+ If the future was not cancelled then it is put in the running state
509
+ (future calls to running() will return True) and True is returned.
510
+
511
+ This method should be called by Executor implementations before
512
+ executing the work associated with this future. If this method returns
513
+ False then the work should not be executed.
514
+
515
+ Returns:
516
+ False if the Future was cancelled, True otherwise.
517
+
518
+ Raises:
519
+ RuntimeError: if this method was already called or if set_result()
520
+ or set_exception() was called.
521
+ """
522
+ with self._condition:
523
+ if self._state == CANCELLED:
524
+ self._state = CANCELLED_AND_NOTIFIED
525
+ for waiter in self._waiters:
526
+ waiter.add_cancelled(self)
527
+ # self._condition.notify_all() is not necessary because
528
+ # self.cancel() triggers a notification.
529
+ return False
530
+ elif self._state == PENDING:
531
+ self._state = RUNNING
532
+ return True
533
+ else:
534
+ LOGGER.critical('Future %s in unexpected state: %s',
535
+ id(self),
536
+ self._state)
537
+ raise RuntimeError('Future in unexpected state')
538
+
539
+ def set_result(self, result):
540
+ """Sets the return value of work associated with the future.
541
+
542
+ Should only be used by Executor implementations and unit tests.
543
+ """
544
+ with self._condition:
545
+ if self._state in {CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED}:
546
+ raise InvalidStateError('{}: {!r}'.format(self._state, self))
547
+ self._result = result
548
+ self._state = FINISHED
549
+ for waiter in self._waiters:
550
+ waiter.add_result(self)
551
+ self._condition.notify_all()
552
+ self._invoke_callbacks()
553
+
554
+ def set_exception(self, exception):
555
+ """Sets the result of the future as being the given exception.
556
+
557
+ Should only be used by Executor implementations and unit tests.
558
+ """
559
+ with self._condition:
560
+ if self._state in {CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED}:
561
+ raise InvalidStateError('{}: {!r}'.format(self._state, self))
562
+ self._exception = exception
563
+ self._state = FINISHED
564
+ for waiter in self._waiters:
565
+ waiter.add_exception(self)
566
+ self._condition.notify_all()
567
+ self._invoke_callbacks()
568
+
569
+ __class_getitem__ = classmethod(types.GenericAlias)
570
+
571
+ class Executor(object):
572
+ """This is an abstract base class for concrete asynchronous executors."""
573
+
574
+ def submit(self, fn, /, *args, **kwargs):
575
+ """Submits a callable to be executed with the given arguments.
576
+
577
+ Schedules the callable to be executed as fn(*args, **kwargs) and returns
578
+ a Future instance representing the execution of the callable.
579
+
580
+ Returns:
581
+ A Future representing the given call.
582
+ """
583
+ raise NotImplementedError()
584
+
585
+ def map(self, fn, *iterables, timeout=None, chunksize=1):
586
+ """Returns an iterator equivalent to map(fn, iter).
587
+
588
+ Args:
589
+ fn: A callable that will take as many arguments as there are
590
+ passed iterables.
591
+ timeout: The maximum number of seconds to wait. If None, then there
592
+ is no limit on the wait time.
593
+ chunksize: The size of the chunks the iterable will be broken into
594
+ before being passed to a child process. This argument is only
595
+ used by ProcessPoolExecutor; it is ignored by
596
+ ThreadPoolExecutor.
597
+
598
+ Returns:
599
+ An iterator equivalent to: map(func, *iterables) but the calls may
600
+ be evaluated out-of-order.
601
+
602
+ Raises:
603
+ TimeoutError: If the entire result iterator could not be generated
604
+ before the given timeout.
605
+ Exception: If fn(*args) raises for any values.
606
+ """
607
+ if timeout is not None:
608
+ end_time = timeout + time.monotonic()
609
+
610
+ fs = [self.submit(fn, *args) for args in zip(*iterables)]
611
+
612
+ # Yield must be hidden in closure so that the futures are submitted
613
+ # before the first iterator value is required.
614
+ def result_iterator():
615
+ try:
616
+ # reverse to keep finishing order
617
+ fs.reverse()
618
+ while fs:
619
+ # Careful not to keep a reference to the popped future
620
+ if timeout is None:
621
+ yield _result_or_cancel(fs.pop())
622
+ else:
623
+ yield _result_or_cancel(fs.pop(), end_time - time.monotonic())
624
+ finally:
625
+ for future in fs:
626
+ future.cancel()
627
+ return result_iterator()
628
+
629
+ def shutdown(self, wait=True, *, cancel_futures=False):
630
+ """Clean-up the resources associated with the Executor.
631
+
632
+ It is safe to call this method several times. Otherwise, no other
633
+ methods can be called after this one.
634
+
635
+ Args:
636
+ wait: If True then shutdown will not return until all running
637
+ futures have finished executing and the resources used by the
638
+ executor have been reclaimed.
639
+ cancel_futures: If True then shutdown will cancel all pending
640
+ futures. Futures that are completed or running will not be
641
+ cancelled.
642
+ """
643
+ pass
644
+
645
+ def __enter__(self):
646
+ return self
647
+
648
+ def __exit__(self, exc_type, exc_val, exc_tb):
649
+ self.shutdown(wait=True)
650
+ return False
651
+
652
+
653
+ class BrokenExecutor(RuntimeError):
654
+ """
655
+ Raised when a executor has become non-functional after a severe failure.
656
+ """
parrot/lib/python3.10/encodings/iso2022_jp_2.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # iso2022_jp_2.py: Python Unicode Codec for ISO2022_JP_2
3
+ #
4
+ # Written by Hye-Shik Chang <perky@FreeBSD.org>
5
+ #
6
+
7
+ import _codecs_iso2022, codecs
8
+ import _multibytecodec as mbc
9
+
10
+ codec = _codecs_iso2022.getcodec('iso2022_jp_2')
11
+
12
+ class Codec(codecs.Codec):
13
+ encode = codec.encode
14
+ decode = codec.decode
15
+
16
+ class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
17
+ codecs.IncrementalEncoder):
18
+ codec = codec
19
+
20
+ class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
21
+ codecs.IncrementalDecoder):
22
+ codec = codec
23
+
24
+ class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
25
+ codec = codec
26
+
27
+ class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
28
+ codec = codec
29
+
30
+ def getregentry():
31
+ return codecs.CodecInfo(
32
+ name='iso2022_jp_2',
33
+ encode=Codec().encode,
34
+ decode=Codec().decode,
35
+ incrementalencoder=IncrementalEncoder,
36
+ incrementaldecoder=IncrementalDecoder,
37
+ streamreader=StreamReader,
38
+ streamwriter=StreamWriter,
39
+ )
parrot/lib/python3.10/encodings/iso8859_8.py ADDED
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """ Python Character Mapping Codec iso8859_8 generated from 'MAPPINGS/ISO8859/8859-8.TXT' with gencodec.py.
2
+
3
+ """#"
4
+
5
+ import codecs
6
+
7
+ ### Codec APIs
8
+
9
+ class Codec(codecs.Codec):
10
+
11
+ def encode(self,input,errors='strict'):
12
+ return codecs.charmap_encode(input,errors,encoding_table)
13
+
14
+ def decode(self,input,errors='strict'):
15
+ return codecs.charmap_decode(input,errors,decoding_table)
16
+
17
+ class IncrementalEncoder(codecs.IncrementalEncoder):
18
+ def encode(self, input, final=False):
19
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
20
+
21
+ class IncrementalDecoder(codecs.IncrementalDecoder):
22
+ def decode(self, input, final=False):
23
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
24
+
25
+ class StreamWriter(Codec,codecs.StreamWriter):
26
+ pass
27
+
28
+ class StreamReader(Codec,codecs.StreamReader):
29
+ pass
30
+
31
+ ### encodings module API
32
+
33
+ def getregentry():
34
+ return codecs.CodecInfo(
35
+ name='iso8859-8',
36
+ encode=Codec().encode,
37
+ decode=Codec().decode,
38
+ incrementalencoder=IncrementalEncoder,
39
+ incrementaldecoder=IncrementalDecoder,
40
+ streamreader=StreamReader,
41
+ streamwriter=StreamWriter,
42
+ )
43
+
44
+
45
+ ### Decoding Table
46
+
47
+ decoding_table = (
48
+ '\x00' # 0x00 -> NULL
49
+ '\x01' # 0x01 -> START OF HEADING
50
+ '\x02' # 0x02 -> START OF TEXT
51
+ '\x03' # 0x03 -> END OF TEXT
52
+ '\x04' # 0x04 -> END OF TRANSMISSION
53
+ '\x05' # 0x05 -> ENQUIRY
54
+ '\x06' # 0x06 -> ACKNOWLEDGE
55
+ '\x07' # 0x07 -> BELL
56
+ '\x08' # 0x08 -> BACKSPACE
57
+ '\t' # 0x09 -> HORIZONTAL TABULATION
58
+ '\n' # 0x0A -> LINE FEED
59
+ '\x0b' # 0x0B -> VERTICAL TABULATION
60
+ '\x0c' # 0x0C -> FORM FEED
61
+ '\r' # 0x0D -> CARRIAGE RETURN
62
+ '\x0e' # 0x0E -> SHIFT OUT
63
+ '\x0f' # 0x0F -> SHIFT IN
64
+ '\x10' # 0x10 -> DATA LINK ESCAPE
65
+ '\x11' # 0x11 -> DEVICE CONTROL ONE
66
+ '\x12' # 0x12 -> DEVICE CONTROL TWO
67
+ '\x13' # 0x13 -> DEVICE CONTROL THREE
68
+ '\x14' # 0x14 -> DEVICE CONTROL FOUR
69
+ '\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
70
+ '\x16' # 0x16 -> SYNCHRONOUS IDLE
71
+ '\x17' # 0x17 -> END OF TRANSMISSION BLOCK
72
+ '\x18' # 0x18 -> CANCEL
73
+ '\x19' # 0x19 -> END OF MEDIUM
74
+ '\x1a' # 0x1A -> SUBSTITUTE
75
+ '\x1b' # 0x1B -> ESCAPE
76
+ '\x1c' # 0x1C -> FILE SEPARATOR
77
+ '\x1d' # 0x1D -> GROUP SEPARATOR
78
+ '\x1e' # 0x1E -> RECORD SEPARATOR
79
+ '\x1f' # 0x1F -> UNIT SEPARATOR
80
+ ' ' # 0x20 -> SPACE
81
+ '!' # 0x21 -> EXCLAMATION MARK
82
+ '"' # 0x22 -> QUOTATION MARK
83
+ '#' # 0x23 -> NUMBER SIGN
84
+ '$' # 0x24 -> DOLLAR SIGN
85
+ '%' # 0x25 -> PERCENT SIGN
86
+ '&' # 0x26 -> AMPERSAND
87
+ "'" # 0x27 -> APOSTROPHE
88
+ '(' # 0x28 -> LEFT PARENTHESIS
89
+ ')' # 0x29 -> RIGHT PARENTHESIS
90
+ '*' # 0x2A -> ASTERISK
91
+ '+' # 0x2B -> PLUS SIGN
92
+ ',' # 0x2C -> COMMA
93
+ '-' # 0x2D -> HYPHEN-MINUS
94
+ '.' # 0x2E -> FULL STOP
95
+ '/' # 0x2F -> SOLIDUS
96
+ '0' # 0x30 -> DIGIT ZERO
97
+ '1' # 0x31 -> DIGIT ONE
98
+ '2' # 0x32 -> DIGIT TWO
99
+ '3' # 0x33 -> DIGIT THREE
100
+ '4' # 0x34 -> DIGIT FOUR
101
+ '5' # 0x35 -> DIGIT FIVE
102
+ '6' # 0x36 -> DIGIT SIX
103
+ '7' # 0x37 -> DIGIT SEVEN
104
+ '8' # 0x38 -> DIGIT EIGHT
105
+ '9' # 0x39 -> DIGIT NINE
106
+ ':' # 0x3A -> COLON
107
+ ';' # 0x3B -> SEMICOLON
108
+ '<' # 0x3C -> LESS-THAN SIGN
109
+ '=' # 0x3D -> EQUALS SIGN
110
+ '>' # 0x3E -> GREATER-THAN SIGN
111
+ '?' # 0x3F -> QUESTION MARK
112
+ '@' # 0x40 -> COMMERCIAL AT
113
+ 'A' # 0x41 -> LATIN CAPITAL LETTER A
114
+ 'B' # 0x42 -> LATIN CAPITAL LETTER B
115
+ 'C' # 0x43 -> LATIN CAPITAL LETTER C
116
+ 'D' # 0x44 -> LATIN CAPITAL LETTER D
117
+ 'E' # 0x45 -> LATIN CAPITAL LETTER E
118
+ 'F' # 0x46 -> LATIN CAPITAL LETTER F
119
+ 'G' # 0x47 -> LATIN CAPITAL LETTER G
120
+ 'H' # 0x48 -> LATIN CAPITAL LETTER H
121
+ 'I' # 0x49 -> LATIN CAPITAL LETTER I
122
+ 'J' # 0x4A -> LATIN CAPITAL LETTER J
123
+ 'K' # 0x4B -> LATIN CAPITAL LETTER K
124
+ 'L' # 0x4C -> LATIN CAPITAL LETTER L
125
+ 'M' # 0x4D -> LATIN CAPITAL LETTER M
126
+ 'N' # 0x4E -> LATIN CAPITAL LETTER N
127
+ 'O' # 0x4F -> LATIN CAPITAL LETTER O
128
+ 'P' # 0x50 -> LATIN CAPITAL LETTER P
129
+ 'Q' # 0x51 -> LATIN CAPITAL LETTER Q
130
+ 'R' # 0x52 -> LATIN CAPITAL LETTER R
131
+ 'S' # 0x53 -> LATIN CAPITAL LETTER S
132
+ 'T' # 0x54 -> LATIN CAPITAL LETTER T
133
+ 'U' # 0x55 -> LATIN CAPITAL LETTER U
134
+ 'V' # 0x56 -> LATIN CAPITAL LETTER V
135
+ 'W' # 0x57 -> LATIN CAPITAL LETTER W
136
+ 'X' # 0x58 -> LATIN CAPITAL LETTER X
137
+ 'Y' # 0x59 -> LATIN CAPITAL LETTER Y
138
+ 'Z' # 0x5A -> LATIN CAPITAL LETTER Z
139
+ '[' # 0x5B -> LEFT SQUARE BRACKET
140
+ '\\' # 0x5C -> REVERSE SOLIDUS
141
+ ']' # 0x5D -> RIGHT SQUARE BRACKET
142
+ '^' # 0x5E -> CIRCUMFLEX ACCENT
143
+ '_' # 0x5F -> LOW LINE
144
+ '`' # 0x60 -> GRAVE ACCENT
145
+ 'a' # 0x61 -> LATIN SMALL LETTER A
146
+ 'b' # 0x62 -> LATIN SMALL LETTER B
147
+ 'c' # 0x63 -> LATIN SMALL LETTER C
148
+ 'd' # 0x64 -> LATIN SMALL LETTER D
149
+ 'e' # 0x65 -> LATIN SMALL LETTER E
150
+ 'f' # 0x66 -> LATIN SMALL LETTER F
151
+ 'g' # 0x67 -> LATIN SMALL LETTER G
152
+ 'h' # 0x68 -> LATIN SMALL LETTER H
153
+ 'i' # 0x69 -> LATIN SMALL LETTER I
154
+ 'j' # 0x6A -> LATIN SMALL LETTER J
155
+ 'k' # 0x6B -> LATIN SMALL LETTER K
156
+ 'l' # 0x6C -> LATIN SMALL LETTER L
157
+ 'm' # 0x6D -> LATIN SMALL LETTER M
158
+ 'n' # 0x6E -> LATIN SMALL LETTER N
159
+ 'o' # 0x6F -> LATIN SMALL LETTER O
160
+ 'p' # 0x70 -> LATIN SMALL LETTER P
161
+ 'q' # 0x71 -> LATIN SMALL LETTER Q
162
+ 'r' # 0x72 -> LATIN SMALL LETTER R
163
+ 's' # 0x73 -> LATIN SMALL LETTER S
164
+ 't' # 0x74 -> LATIN SMALL LETTER T
165
+ 'u' # 0x75 -> LATIN SMALL LETTER U
166
+ 'v' # 0x76 -> LATIN SMALL LETTER V
167
+ 'w' # 0x77 -> LATIN SMALL LETTER W
168
+ 'x' # 0x78 -> LATIN SMALL LETTER X
169
+ 'y' # 0x79 -> LATIN SMALL LETTER Y
170
+ 'z' # 0x7A -> LATIN SMALL LETTER Z
171
+ '{' # 0x7B -> LEFT CURLY BRACKET
172
+ '|' # 0x7C -> VERTICAL LINE
173
+ '}' # 0x7D -> RIGHT CURLY BRACKET
174
+ '~' # 0x7E -> TILDE
175
+ '\x7f' # 0x7F -> DELETE
176
+ '\x80' # 0x80 -> <control>
177
+ '\x81' # 0x81 -> <control>
178
+ '\x82' # 0x82 -> <control>
179
+ '\x83' # 0x83 -> <control>
180
+ '\x84' # 0x84 -> <control>
181
+ '\x85' # 0x85 -> <control>
182
+ '\x86' # 0x86 -> <control>
183
+ '\x87' # 0x87 -> <control>
184
+ '\x88' # 0x88 -> <control>
185
+ '\x89' # 0x89 -> <control>
186
+ '\x8a' # 0x8A -> <control>
187
+ '\x8b' # 0x8B -> <control>
188
+ '\x8c' # 0x8C -> <control>
189
+ '\x8d' # 0x8D -> <control>
190
+ '\x8e' # 0x8E -> <control>
191
+ '\x8f' # 0x8F -> <control>
192
+ '\x90' # 0x90 -> <control>
193
+ '\x91' # 0x91 -> <control>
194
+ '\x92' # 0x92 -> <control>
195
+ '\x93' # 0x93 -> <control>
196
+ '\x94' # 0x94 -> <control>
197
+ '\x95' # 0x95 -> <control>
198
+ '\x96' # 0x96 -> <control>
199
+ '\x97' # 0x97 -> <control>
200
+ '\x98' # 0x98 -> <control>
201
+ '\x99' # 0x99 -> <control>
202
+ '\x9a' # 0x9A -> <control>
203
+ '\x9b' # 0x9B -> <control>
204
+ '\x9c' # 0x9C -> <control>
205
+ '\x9d' # 0x9D -> <control>
206
+ '\x9e' # 0x9E -> <control>
207
+ '\x9f' # 0x9F -> <control>
208
+ '\xa0' # 0xA0 -> NO-BREAK SPACE
209
+ '\ufffe'
210
+ '\xa2' # 0xA2 -> CENT SIGN
211
+ '\xa3' # 0xA3 -> POUND SIGN
212
+ '\xa4' # 0xA4 -> CURRENCY SIGN
213
+ '\xa5' # 0xA5 -> YEN SIGN
214
+ '\xa6' # 0xA6 -> BROKEN BAR
215
+ '\xa7' # 0xA7 -> SECTION SIGN
216
+ '\xa8' # 0xA8 -> DIAERESIS
217
+ '\xa9' # 0xA9 -> COPYRIGHT SIGN
218
+ '\xd7' # 0xAA -> MULTIPLICATION SIGN
219
+ '\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
220
+ '\xac' # 0xAC -> NOT SIGN
221
+ '\xad' # 0xAD -> SOFT HYPHEN
222
+ '\xae' # 0xAE -> REGISTERED SIGN
223
+ '\xaf' # 0xAF -> MACRON
224
+ '\xb0' # 0xB0 -> DEGREE SIGN
225
+ '\xb1' # 0xB1 -> PLUS-MINUS SIGN
226
+ '\xb2' # 0xB2 -> SUPERSCRIPT TWO
227
+ '\xb3' # 0xB3 -> SUPERSCRIPT THREE
228
+ '\xb4' # 0xB4 -> ACUTE ACCENT
229
+ '\xb5' # 0xB5 -> MICRO SIGN
230
+ '\xb6' # 0xB6 -> PILCROW SIGN
231
+ '\xb7' # 0xB7 -> MIDDLE DOT
232
+ '\xb8' # 0xB8 -> CEDILLA
233
+ '\xb9' # 0xB9 -> SUPERSCRIPT ONE
234
+ '\xf7' # 0xBA -> DIVISION SIGN
235
+ '\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
236
+ '\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER
237
+ '\xbd' # 0xBD -> VULGAR FRACTION ONE HALF
238
+ '\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS
239
+ '\ufffe'
240
+ '\ufffe'
241
+ '\ufffe'
242
+ '\ufffe'
243
+ '\ufffe'
244
+ '\ufffe'
245
+ '\ufffe'
246
+ '\ufffe'
247
+ '\ufffe'
248
+ '\ufffe'
249
+ '\ufffe'
250
+ '\ufffe'
251
+ '\ufffe'
252
+ '\ufffe'
253
+ '\ufffe'
254
+ '\ufffe'
255
+ '\ufffe'
256
+ '\ufffe'
257
+ '\ufffe'
258
+ '\ufffe'
259
+ '\ufffe'
260
+ '\ufffe'
261
+ '\ufffe'
262
+ '\ufffe'
263
+ '\ufffe'
264
+ '\ufffe'
265
+ '\ufffe'
266
+ '\ufffe'
267
+ '\ufffe'
268
+ '\ufffe'
269
+ '\ufffe'
270
+ '\ufffe'
271
+ '\u2017' # 0xDF -> DOUBLE LOW LINE
272
+ '\u05d0' # 0xE0 -> HEBREW LETTER ALEF
273
+ '\u05d1' # 0xE1 -> HEBREW LETTER BET
274
+ '\u05d2' # 0xE2 -> HEBREW LETTER GIMEL
275
+ '\u05d3' # 0xE3 -> HEBREW LETTER DALET
276
+ '\u05d4' # 0xE4 -> HEBREW LETTER HE
277
+ '\u05d5' # 0xE5 -> HEBREW LETTER VAV
278
+ '\u05d6' # 0xE6 -> HEBREW LETTER ZAYIN
279
+ '\u05d7' # 0xE7 -> HEBREW LETTER HET
280
+ '\u05d8' # 0xE8 -> HEBREW LETTER TET
281
+ '\u05d9' # 0xE9 -> HEBREW LETTER YOD
282
+ '\u05da' # 0xEA -> HEBREW LETTER FINAL KAF
283
+ '\u05db' # 0xEB -> HEBREW LETTER KAF
284
+ '\u05dc' # 0xEC -> HEBREW LETTER LAMED
285
+ '\u05dd' # 0xED -> HEBREW LETTER FINAL MEM
286
+ '\u05de' # 0xEE -> HEBREW LETTER MEM
287
+ '\u05df' # 0xEF -> HEBREW LETTER FINAL NUN
288
+ '\u05e0' # 0xF0 -> HEBREW LETTER NUN
289
+ '\u05e1' # 0xF1 -> HEBREW LETTER SAMEKH
290
+ '\u05e2' # 0xF2 -> HEBREW LETTER AYIN
291
+ '\u05e3' # 0xF3 -> HEBREW LETTER FINAL PE
292
+ '\u05e4' # 0xF4 -> HEBREW LETTER PE
293
+ '\u05e5' # 0xF5 -> HEBREW LETTER FINAL TSADI
294
+ '\u05e6' # 0xF6 -> HEBREW LETTER TSADI
295
+ '\u05e7' # 0xF7 -> HEBREW LETTER QOF
296
+ '\u05e8' # 0xF8 -> HEBREW LETTER RESH
297
+ '\u05e9' # 0xF9 -> HEBREW LETTER SHIN
298
+ '\u05ea' # 0xFA -> HEBREW LETTER TAV
299
+ '\ufffe'
300
+ '\ufffe'
301
+ '\u200e' # 0xFD -> LEFT-TO-RIGHT MARK
302
+ '\u200f' # 0xFE -> RIGHT-TO-LEFT MARK
303
+ '\ufffe'
304
+ )
305
+
306
+ ### Encoding table
307
+ encoding_table=codecs.charmap_build(decoding_table)
parrot/lib/python3.10/idlelib/Icons/idle.ico ADDED
parrot/lib/python3.10/idlelib/NEWS.txt ADDED
@@ -0,0 +1,1321 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ What's New in IDLE 3.10.z
2
+ after 3.10.0 until 3.10.10?
3
+ Released 2023-04-03?
4
+ =========================
5
+
6
+
7
+ gh-97527: Fix a bug in the previous bugfix that caused IDLE to not
8
+ start when run with 3.10.8, 3.12.0a1, and at least Microsoft Python
9
+ 3.10.2288.0 installed without the Lib/test package. 3.11.0 was never
10
+ affected.
11
+
12
+ gh-65802: Document handling of extensions in Save As dialogs.
13
+
14
+ gh-95191: Include prompts when saving Shell (interactive input/output).
15
+
16
+ gh-95511: Fix the Shell context menu copy-with-prompts bug of copying
17
+ an extra line when one selects whole lines.
18
+
19
+ gh-95471: Tweak Edit menu. Move 'Select All' above 'Cut' as it is used
20
+ with 'Cut' and 'Copy' but not 'Paste'. Add a separator between 'Replace'
21
+ and 'Go to Line' to help IDLE issue triagers.
22
+
23
+ gh-95411: Enable using IDLE's module browser with .pyw files.
24
+
25
+ gh-89610: Add .pyi as a recognized extension for IDLE on macOS. This allows
26
+ opening stub files by double clicking on them in the Finder.
27
+
28
+ bpo-28950: Apply IDLE syntax highlighting to `.pyi` files. Add util.py
29
+ for common components. Patch by Alex Waygood and Terry Jan Reedy.
30
+
31
+ bpo-46630: Make query dialogs on Windows start with a cursor in the
32
+ entry box.
33
+
34
+ bpo-46591: Make the IDLE doc URL on the About IDLE dialog clickable.
35
+
36
+ bpo-45296: Clarify close, quit, and exit in IDLE. In the File menu,
37
+ 'Close' and 'Exit' are now 'Close Window' (the current one) and 'Exit'
38
+ is now 'Exit IDLE' (by closing all windows). In Shell, 'quit()' and
39
+ 'exit()' mean 'close Shell'. If there are no other windows,
40
+ this also exits IDLE.
41
+
42
+ bpo-45495: Add context keywords 'case' and 'match' to completions list.
43
+
44
+ bpo-45296: On Windows, change exit/quit message to suggest Ctrl-D, which
45
+ works, instead of <Ctrl-Z Return>, which does not work in IDLE.
46
+
47
+
48
+ What's New in IDLE 3.10.0
49
+ (since 3.9.0)
50
+ Released on 2021-10-04
51
+ =========================
52
+
53
+ bpo-45193: Make completion boxes appear on Ubuntu again.
54
+
55
+ bpo-40128: Mostly fix completions on macOS when not using tcl/tk 8.6.11
56
+ (as with 3.9).
57
+
58
+ bpo-33962: Move the indent space setting from the Font tab to the new Windows
59
+ tab. Patch by Mark Roseman and Terry Jan Reedy.
60
+
61
+ bpo-40468: Split the settings dialog General tab into Windows and Shell/Ed
62
+ tabs. Move help sources, which extend the Help menu, to the Extensions tab.
63
+ Make space for new options and shorten the dialog. The latter makes the
64
+ dialog better fit small screens.
65
+
66
+ bpo-44010: Highlight the new match statement's soft keywords: match, case,
67
+ and _. This highlighting is not perfect and will be incorrect in some rare
68
+ cases, especially for some _s in case patterns.
69
+
70
+ bpo-44026: Include interpreter's typo fix suggestions in message line
71
+ for NameErrors and AttributeErrors. Patch by E. Paine.
72
+
73
+ bpo-41611: Avoid occasional uncaught exceptions and freezing when using
74
+ completions on macOS.
75
+
76
+ bpo-37903: Add mouse actions to the shell sidebar. Left click and
77
+ optional drag selects one or more lines of text, as with the
78
+ editor line number sidebar. Right click after selecting text lines
79
+ displays a context menu with 'copy with prompts'. This zips together
80
+ prompts from the sidebar with lines from the selected text. This option
81
+ also appears on the context menu for the text.
82
+
83
+ bpo-43981: Fix reference leaks in test_sidebar and test_squeezer.
84
+ Patches by Terry Jan Reedy and Pablo Galindo
85
+
86
+ bpo-37892: Change Shell input indents from tabs to spaces. Shell input
87
+ now 'looks right'. Making this feasible motivated the shell sidebar.
88
+
89
+ bpo-37903: Move the Shell input prompt to a side bar.
90
+
91
+ bpo-43655: Make window managers on macOS and X Window recognize
92
+ IDLE dialog windows as dialogs.
93
+
94
+ bpo-42225: Document that IDLE can fail on Unix either from misconfigured IP
95
+ masquerade rules or failure displaying complex colored (non-ascii) characters.
96
+
97
+ bpo-43283: Document why printing to IDLE's Shell is often slower than
98
+ printing to a system terminal and that it can be made faster by
99
+ pre-formatting a single string before printing.
100
+
101
+ bpo-23544: Disable Debug=>Stack Viewer when user code is running or
102
+ Debugger is active, to prevent hang or crash. Patch by Zackery Spytz.
103
+
104
+ bpo-43008: Make IDLE invoke :func:`sys.excepthook` in normal,
105
+ 2-process mode. User hooks were previously ignored.
106
+ Patch by Ken Hilton.
107
+
108
+ bpo-33065: Fix problem debugging user classes with __repr__ method.
109
+
110
+ bpo-32631: Finish zzdummy example extension module: make menu entries
111
+ work; add docstrings and tests with 100% coverage.
112
+
113
+ bpo-42508: Keep IDLE running on macOS. Remove obsolete workaround
114
+ that prevented running files with shortcuts when using new universal2
115
+ installers built on macOS 11.
116
+
117
+ bpo-42426: Fix reporting offset of the RE error in searchengine.
118
+
119
+ bpo-42416: Display docstrings in IDLE calltips in more cases,
120
+ by using inspect.getdoc.
121
+
122
+ bpo-33987: Mostly finish using ttk widgets, mainly for editor,
123
+ settings, and searches. Some patches by Mark Roseman.
124
+
125
+ bpo-40511: Stop unnecessary "flashing" when typing opening and closing
126
+ parentheses inside the parentheses of a function call.
127
+
128
+ bpo-38439: Add a 256x256 pixel IDLE icon to the Windows .ico file. Created by
129
+ Andrew Clover. Remove the low-color gif variations from the .ico file.
130
+
131
+ bpo-41775: Make 'IDLE Shell' the shell title.
132
+
133
+ bpo-35764: Rewrite the Calltips doc section.
134
+
135
+ bpo-40181: In calltips, stop reminding that '/' marks the end of
136
+ positional-only arguments.
137
+
138
+
139
+ What's New in IDLE 3.9.0 (since 3.8.0)
140
+ Released on 2020-10-05?
141
+ ======================================
142
+
143
+ bpo-41468: Improve IDLE run crash error message (which users should
144
+ never see).
145
+
146
+ bpo-41373: Save files loaded with no line ending, as when blank, or
147
+ different line endings, by setting its line ending to the system
148
+ default. Fix regression in 3.8.4 and 3.9.0b4.
149
+
150
+ bpo-41300: Save files with non-ascii chars. Fix regression in
151
+ 3.9.0b4 and 3.8.4.
152
+
153
+ bpo-37765: Add keywords to module name completion list. Rewrite
154
+ Completions section of IDLE doc.
155
+
156
+ bpo-41152: The encoding of ``stdin``, ``stdout`` and ``stderr`` in IDLE
157
+ is now always UTF-8.
158
+
159
+ bpo-41144: Make Open Module open a special module such as os.path.
160
+
161
+ bpo-40723: Make test_idle pass when run after import.
162
+ Patch by Florian Dahlitz.
163
+
164
+ bpo-38689: IDLE will no longer freeze when inspect.signature fails
165
+ when fetching a calltip.
166
+
167
+ bpo-27115: For 'Go to Line', use a Query entry box subclass with
168
+ IDLE standard behavior and improved error checking.
169
+
170
+ bpo-39885: When a context menu is invoked by right-clicking outside
171
+ of a selection, clear the selection and move the cursor. Cut and
172
+ Copy require that the click be within the selection.
173
+
174
+ bpo-39852: Edit "Go to line" now clears any selection, preventing
175
+ accidental deletion. It also updates Ln and Col on the status bar.
176
+
177
+ bpo-39781: Selecting code context lines no longer causes a jump.
178
+
179
+ bpo-39663: Add tests for pyparse find_good_parse_start().
180
+
181
+ bpo-39600: Remove duplicate font names from configuration list.
182
+
183
+ bpo-38792: Close a shell calltip if a :exc:`KeyboardInterrupt`
184
+ or shell restart occurs. Patch by Zackery Spytz.
185
+
186
+ bpo-30780: Add remaining configdialog tests for buttons and
187
+ highlights and keys tabs.
188
+
189
+ bpo-39388: Settings dialog Cancel button cancels pending changes.
190
+
191
+ bpo-39050: Settings dialog Help button again displays help text.
192
+
193
+ bpo-32989: Add tests for editor newline_and_indent_event method.
194
+ Remove unneeded arguments and dead code from pyparse
195
+ find_good_parse_start method.
196
+
197
+ bpo-38943: Fix autocomplete windows not always appearing on some
198
+ systems. Patch by Johnny Najera.
199
+
200
+ bpo-38944: Escape key now closes IDLE completion windows. Patch by
201
+ Johnny Najera.
202
+
203
+ bpo-38862: 'Strip Trailing Whitespace' on the Format menu removes extra
204
+ newlines at the end of non-shell files.
205
+
206
+ bpo-38636: Fix IDLE Format menu tab toggle and file indent width. These
207
+ functions (default shortcuts Alt-T and Alt-U) were mistakenly disabled
208
+ in 3.7.5 and 3.8.0.
209
+
210
+ bpo-4630: Add an option to toggle IDLE's cursor blink for shell,
211
+ editor, and output windows. See Settings, General, Window Preferences,
212
+ Cursor Blink. Patch by Zackery Spytz.
213
+
214
+ bpo-26353: Stop adding newline when saving an IDLE shell window.
215
+
216
+ bpo-38598: Do not try to compile IDLE shell or output windows.
217
+
218
+
219
+ What's New in IDLE 3.8.0 (since 3.7.0)
220
+ Released on 2019-10-14
221
+ ======================================
222
+
223
+ bpo-36698: IDLE no longer fails when writing non-encodable characters
224
+ to stderr. It now escapes them with a backslash, like the regular
225
+ Python interpreter. Add an errors field to the standard streams.
226
+
227
+ bpo-13153: Improve tkinter's handing of non-BMP (astral) unicode
228
+ characters, such as 'rocket \U0001f680'. Whether a proper glyph or
229
+ replacement char is displayed depends on the OS and font. For IDLE,
230
+ astral chars in code interfere with editing.
231
+
232
+ bpo-35379: When exiting IDLE, catch any AttributeError. One happens
233
+ when EditorWindow.close is called twice. Printing a traceback, when
234
+ IDLE is run from a terminal, is useless and annoying.
235
+
236
+ bpo-38183: To avoid test issues, test_idle ignores the user config
237
+ directory. It no longer tries to create or access .idlerc or any files
238
+ within. Users must run IDLE to discover problems with saving settings.
239
+
240
+ bpo-38077: IDLE no longer adds 'argv' to the user namespace when
241
+ initializing it. This bug only affected 3.7.4 and 3.8.0b2 to 3.8.0b4.
242
+
243
+ bpo-38401: Shell restart lines now fill the window width, always start
244
+ with '=', and avoid wrapping unnecessarily. The line will still wrap
245
+ if the included file name is long relative to the width.
246
+
247
+ bpo-37092: Add mousewheel scrolling for IDLE module, path, and stack
248
+ browsers. Patch by George Zhang.
249
+
250
+ bpo-35771: To avoid occasional spurious test_idle failures on slower
251
+ machines, increase the ``hover_delay`` in test_tooltip.
252
+
253
+ bpo-37824: Properly handle user input warnings in IDLE shell.
254
+ Cease turning SyntaxWarnings into SyntaxErrors.
255
+
256
+ bpo-37929: IDLE Settings dialog now closes properly when there is no
257
+ shell window.
258
+
259
+ bpo-37849: Fix completions list appearing too high or low when shown
260
+ above the current line.
261
+
262
+ bpo-36419: Refactor autocompete and improve testing.
263
+
264
+ bpo-37748: Reorder the Run menu. Put the most common choice,
265
+ Run Module, at the top.
266
+
267
+ bpo-37692: Improve highlight config sample with example shell
268
+ interaction and better labels for shell elements.
269
+
270
+ bpo-37628: Settings dialog no longer expands with font size.
271
+ The font and highlight sample boxes gain scrollbars instead.
272
+
273
+ bpo-17535: Add optional line numbers for IDLE editor windows.
274
+
275
+ bpo-37627: Initialize the Customize Run dialog with the command line
276
+ arguments most recently entered before. The user can optionally edit
277
+ before submitting them.
278
+
279
+ bpo-33610: Code context always shows the correct context when toggled on.
280
+
281
+ bpo-36390: Gather Format menu functions into format.py. Combine
282
+ paragraph.py, rstrip.py, and format methods from editor.py.
283
+
284
+ bpo-37530: Optimize code context to reduce unneeded background activity.
285
+ Font and highlight changes now occur along with text changes instead
286
+ of after a random delay.
287
+
288
+ bpo-27452: Cleanup config.py by inlining RemoveFile and simplifying
289
+ the handling of __file__ in CreateConfigHandlers/
290
+
291
+ bpo-26806: To compensate for stack frames added by IDLE and avoid
292
+ possible problems with low recursion limits, add 30 to limits in the
293
+ user code execution process. Subtract 30 when reporting recursion
294
+ limits to make this addition mostly transparent.
295
+
296
+ bpo-37325: Fix tab focus traversal order for help source and custom
297
+ run dialogs.
298
+
299
+ bpo-37321: Both subprocess connection error messages now refer to
300
+ the 'Startup failure' section of the IDLE doc.
301
+
302
+ bpo-37177: Properly attach search dialogs to their main window so
303
+ that they behave like other dialogs and do not get hidden behind
304
+ their main window.
305
+
306
+ bpo-37039: Adjust "Zoom Height" to individual screens by momentarily
307
+ maximizing the window on first use with a particular screen. Changing
308
+ screen settings may invalidate the saved height. While a window is
309
+ maximized, "Zoom Height" has no effect.
310
+
311
+ bpo-35763: Make calltip reminder about '/' meaning positional-only less
312
+ obtrusive by only adding it when there is room on the first line.
313
+
314
+ bpo-5680: Add 'Run Customized' to the Run menu to run a module with
315
+ customized settings. Any command line arguments entered are added
316
+ to sys.argv. One can suppress the normal Shell main module restart.
317
+
318
+ bpo-35610: Replace now redundant editor.context_use_ps1 with
319
+ .prompt_last_line. This finishes change started in bpo-31858.
320
+
321
+ bpo-32411: Stop sorting dict created with desired line order.
322
+
323
+ bpo-37038: Make idlelib.run runnable; add test clause.
324
+
325
+ bpo-36958: Print any argument other than None or int passed to
326
+ SystemExit or sys.exit().
327
+
328
+ bpo-36807: When saving a file, call file.flush() and os.fsync()
329
+ so bits are flushed to e.g. a USB drive.
330
+
331
+ bpo-36429: Fix starting IDLE with pyshell.
332
+ Add idlelib.pyshell alias at top; remove pyshell alias at bottom.
333
+ Remove obsolete __name__=='__main__' command.
334
+
335
+ bpo-30348: Increase test coverage of idlelib.autocomplete by 30%.
336
+ Patch by Louie Lu.
337
+
338
+ bpo-23205: Add tests and refactor grep's findfiles.
339
+
340
+ bpo-36405: Use dict unpacking in idlelib.
341
+
342
+ bpo-36396: Remove fgBg param of idlelib.config.GetHighlight().
343
+ This param was only used twice and changed the return type.
344
+
345
+ bpo-23216: IDLE: Add docstrings to search modules.
346
+
347
+ bpo-36176: Fix IDLE autocomplete & calltip popup colors.
348
+ Prevent conflicts with Linux dark themes
349
+ (and slightly darken calltip background).
350
+
351
+ bpo-36152: Remove colorizer.ColorDelegator.close_when_done and the
352
+ corresponding argument of .close(). In IDLE, both have always been
353
+ None or False since 2007.
354
+
355
+ bpo-36096: Make colorizer state variables instance-only.
356
+
357
+ bpo-32129: Avoid blurry IDLE application icon on macOS with Tk 8.6.
358
+ Patch by Kevin Walzer.
359
+
360
+ bpo-24310: Document settings dialog font tab sample.
361
+
362
+ bpo-35689: Add docstrings and tests for colorizer.
363
+
364
+ bpo-35833: Revise IDLE doc for control codes sent to Shell.
365
+ Add a code example block.
366
+
367
+ bpo-35770: IDLE macosx deletes Options => Configure IDLE.
368
+ It previously deleted Window => Zoom Height by mistake.
369
+ (Zoom Height is now on the Options menu). On Mac, the settings
370
+ dialog is accessed via Preferences on the IDLE menu.
371
+
372
+ bpo-35769: Change new file name from 'Untitled' to 'untitled'.
373
+
374
+ bpo-35660: Fix imports in window module.
375
+
376
+ bpo-35641: Properly format calltip for function without docstring.
377
+
378
+ bpo-33987: Use ttk Frame for ttk widgets.
379
+
380
+ bpo-34055: Fix erroneous 'smart' indents and newlines in IDLE Shell.
381
+
382
+ bpo-28097: Add Previous/Next History entries to Shell menu.
383
+
384
+ bpo-35591: Find Selection now works when selection not found.
385
+
386
+ bpo-35598: Update config_key: use PEP 8 names and ttk widgets,
387
+ make some objects global, and add tests.
388
+
389
+ bpo-35196: Speed up squeezer line counting.
390
+
391
+ bpo-35208: Squeezer now counts wrapped lines before newlines.
392
+
393
+ bpo-35555: Gray out Code Context menu entry when it's not applicable.
394
+
395
+ bpo-22703: Improve the Code Context and Zoom Height menu labels.
396
+ The Code Context menu label now toggles between Show/Hide Code Context.
397
+ The Zoom Height menu now toggles between Zoom/Restore Height.
398
+ Zoom Height has moved from the Window menu to the Options menu.
399
+
400
+ bpo-35521: Document the editor code context feature.
401
+ Add some internal references within the IDLE doc.
402
+
403
+ bpo-34864: When starting IDLE on MacOS, warn if the system setting
404
+ "Prefer tabs when opening documents" is "Always". As previous
405
+ documented for this issue, running IDLE with this setting causes
406
+ problems. If the setting is changed while IDLE is running,
407
+ there will be no warning until IDLE is restarted.
408
+
409
+ bpo-35213: Where appropriate, use 'macOS' in idlelib.
410
+
411
+ bpo-34864: Document two IDLE on MacOS issues. The System Preferences
412
+ Dock "prefer tabs always" setting disables some IDLE features.
413
+ Menus are a bit different than as described for Windows and Linux.
414
+
415
+ bpo-35202: Remove unused imports in idlelib.
416
+
417
+ bpo-33000: Document that IDLE's shell has no line limit.
418
+ A program that runs indefinitely can overfill memory.
419
+
420
+ bpo-23220: Explain how IDLE's Shell displays output.
421
+ Add new subsection "User output in Shell".
422
+
423
+ bpo-35099: Improve the doc about IDLE running user code.
424
+ "IDLE -- console differences" is renamed "Running user code".
425
+ It mostly covers the implications of using custom sys.stdxxx objects.
426
+
427
+ bpo-35097: Add IDLE doc subsection explaining editor windows.
428
+ Topics include opening, title and status bars, .py* extension, and running.
429
+
430
+ Issue 35093: Document the IDLE document viewer in the IDLE doc.
431
+ Add a paragraph in "Help and preferences", "Help sources" subsection.
432
+
433
+ bpo-1529353: Explain Shell text squeezing in the IDLE doc.
434
+
435
+ bpo-35088: Update idlelib.help.copy_string docstring.
436
+ We now use git and backporting instead of hg and forward merging.
437
+
438
+ bpo-35087: Update idlelib help files for the current doc build.
439
+ The main change is the elimination of chapter-section numbers.
440
+
441
+ bpo-1529353: Output over N lines (50 by default) is squeezed down to a button.
442
+ N can be changed in the PyShell section of the General page of the
443
+ Settings dialog. Fewer, but possibly extra long, lines can be squeezed by
444
+ right clicking on the output. Squeezed output can be expanded in place
445
+ by double-clicking the button or into the clipboard or a separate window
446
+ by right-clicking the button.
447
+
448
+ bpo-34548: Use configured color theme for read-only text views.
449
+
450
+ bpo-33839: Refactor ToolTip and CallTip classes; add documentation
451
+ and tests.
452
+
453
+ bpo-34047: Fix mouse wheel scrolling direction on macOS.
454
+
455
+ bpo-34275: Make calltips always visible on Mac.
456
+ Patch by Kevin Walzer.
457
+
458
+ bpo-34120: Fix freezing after closing some dialogs on Mac.
459
+ This is one of multiple regressions from using newer tcl/tk.
460
+
461
+ bpo-33975: Avoid small type when running htests.
462
+ Since part of the purpose of human-viewed tests is to determine that
463
+ widgets look right, it is important that they look the same for
464
+ testing as when running IDLE.
465
+
466
+ bpo-33905: Add test for idlelib.stackview.StackBrowser.
467
+
468
+ bpo-33924: Change mainmenu.menudefs key 'windows' to 'window'.
469
+ Every other menudef key is the lowercase version of the
470
+ corresponding main menu entry (in this case, 'Window').
471
+
472
+ bpo-33906: Rename idlelib.windows as window
473
+ Match Window on the main menu and remove last plural module name.
474
+ Change imports, test, and attribute references to match new name.
475
+
476
+ bpo-33917: Fix and document idlelib/idle_test/template.py.
477
+ The revised file compiles, runs, and tests OK. idle_test/README.txt
478
+ explains how to use it to create new IDLE test files.
479
+
480
+ bpo-33904: In rstrip module, rename class RstripExtension as Rstrip.
481
+
482
+ bpo-33907: For consistency and clarity, rename calltip objects.
483
+ Module calltips and its class CallTips are now calltip and Calltip.
484
+ In module calltip_w, class CallTip is now CalltipWindow.
485
+
486
+ bpo-33855: Minimally test all IDLE modules.
487
+ Standardize the test file format. Add missing test files that import
488
+ the tested module and perform at least one test. Check and record the
489
+ coverage of each test.
490
+
491
+ bpo-33856: Add 'help' to Shell's initial welcome message.
492
+
493
+
494
+ What's New in IDLE 3.7.0 (since 3.6.0)
495
+ Released on 2018-06-27
496
+ ======================================
497
+
498
+ bpo-33656: On Windows, add API call saying that tk scales for DPI.
499
+ On Windows 8.1+ or 10, with DPI compatibility properties of the Python
500
+ binary unchanged, and a monitor resolution greater than 96 DPI, this
501
+ should make text and lines sharper and some colors brighter.
502
+ On other systems, it should have no effect. If you have a custom theme,
503
+ you may want to adjust a color or two. If perchance it make text worse
504
+ on your monitor, you can disable the ctypes.OleDLL call near the top of
505
+ pyshell.py and report the problem on python-list or idle-dev@python.org.
506
+
507
+ bpo-33768: Clicking on a context line moves that line to the top
508
+ of the editor window.
509
+
510
+ bpo-33763: Replace the code context label widget with a text widget.
511
+
512
+ bpo-33664: Scroll IDLE editor text by lines.
513
+ (Previously, the mouse wheel and scrollbar slider moved text by a fixed
514
+ number of pixels, resulting in partial lines at the top of the editor
515
+ box.) This change also applies to the shell and grep output windows,
516
+ but currently not to read-only text views.
517
+
518
+ bpo-33679: Enable theme-specific color configuration for Code Context.
519
+ (Previously, there was one code context foreground and background font
520
+ color setting, default or custom, on the extensions tab, that applied
521
+ to all themes.) For built-in themes, the foreground is the same as
522
+ normal text and the background is a contrasting gray. Context colors for
523
+ custom themes are set on the Hightlights tab along with other colors.
524
+ When one starts IDLE from a console and loads a custom theme without
525
+ definitions for 'context', one will see a warning message on the
526
+ console.
527
+
528
+ bpo-33642: Display up to maxlines non-blank lines for Code Context.
529
+ If there is no current context, show a single blank line. (Previously,
530
+ the Code Contex had numlines lines, usually with some blank.) The use
531
+ of a new option, 'maxlines' (default 15), avoids possible interference
532
+ with user settings of the old option, 'numlines' (default 3).
533
+
534
+ bpo-33628: Cleanup codecontext.py and its test.
535
+
536
+ bpo-32831: Add docstrings and tests for codecontext.py.
537
+ Coverage is 100%. Patch by Cheryl Sabella.
538
+
539
+ bpo-33564: Code context now recognizes async as a block opener.
540
+
541
+ bpo-21474: Update word/identifier definition from ascii to unicode.
542
+ In text and entry boxes, this affects selection by double-click,
543
+ movement left/right by control-left/right, and deletion left/right
544
+ by control-BACKSPACE/DEL.
545
+
546
+ bpo-33204: Consistently color invalid string prefixes.
547
+ A 'u' string prefix cannot be paired with either 'r' or 'f'.
548
+ IDLE now consistently colors as much of the prefix, starting at the
549
+ right, as is valid. Revise and extend colorizer test.
550
+
551
+ bpo-32984: Set __file__ while running a startup file.
552
+ Like Python, IDLE optionally runs 1 startup file in the Shell window
553
+ before presenting the first interactive input prompt. For IDLE,
554
+ option -s runs a file named in environmental variable IDLESTARTUP or
555
+ PYTHONSTARTUP; -r file runs file. Python sets __file__ to the startup
556
+ file name before running the file and unsets it before the first
557
+ prompt. IDLE now does the same when run normally, without the -n
558
+ option.
559
+
560
+ bpo-32940: Replace StringTranslatePseudoMapping with faster code.
561
+
562
+ bpo-32916: Change 'str' to 'code' in idlelib.pyparse and users.
563
+
564
+ bpo-32905: Remove unused code in pyparse module.
565
+
566
+ bpo-32874: IDLE - add pyparse tests with 97% coverage.
567
+
568
+ bpo-32837: IDLE - require encoding argument for textview.view_file.
569
+ Using the system and place-dependent default encoding for open()
570
+ is a bad idea for IDLE's system and location-independent files.
571
+
572
+ bpo-32826: Add "encoding=utf-8" to open() in IDLE's test_help_about.
573
+ GUI test test_file_buttons() only looks at initial ascii-only lines,
574
+ but failed on systems where open() defaults to 'ascii' because
575
+ readline() internally reads and decodes far enough ahead to encounter
576
+ a non-ascii character in CREDITS.txt.
577
+
578
+ bpo-32765: Update configdialog General tab create page docstring.
579
+ Add new widgets to the widget list.
580
+
581
+ bpo-32207: Improve tk event exception tracebacks in IDLE.
582
+ When tk event handling is driven by IDLE's run loop, a confusing
583
+ and distracting queue.EMPTY traceback context is no longer added
584
+ to tk event exception tracebacks. The traceback is now the same
585
+ as when event handling is driven by user code. Patch based on
586
+ a suggestion by Serhiy Storchaka.
587
+
588
+ bpo-32164: Delete unused file idlelib/tabbedpages.py.
589
+ Use of TabbedPageSet in configdialog was replaced by ttk.Notebook.
590
+
591
+ bpo-32100: Fix old and new bugs in pathbrowser; improve tests.
592
+ Patch mostly by Cheryl Sabella.
593
+
594
+ bpo-31860: The font sample in the settings dialog is now editable.
595
+ Edits persist while IDLE remains open.
596
+ Patch by Serhiy Storchake and Terry Jan Reedy.
597
+
598
+ bpo-31858: Restrict shell prompt manipulation to the shell.
599
+ Editor and output windows only see an empty last prompt line. This
600
+ simplifies the code and fixes a minor bug when newline is inserted.
601
+ Sys.ps1, if present, is read on Shell start-up, but is not set or changed.
602
+ Patch by Terry Jan Reedy.
603
+
604
+ bpo-28603: Fix a TypeError that caused a shell restart when printing
605
+ a traceback that includes an exception that is unhashable.
606
+ Patch by Zane Bitter.
607
+
608
+ bpo-13802: Use non-Latin characters in the Font settings sample.
609
+ Even if one selects a font that defines a limited subset of the unicode
610
+ Basic Multilingual Plane, tcl/tk will use other fonts that define a
611
+ character. The expanded example give users of non-Latin characters
612
+ a better idea of what they might see in the shell and editors.
613
+
614
+ To make room for the expanded sample, frames on the Font tab are
615
+ re-arranged. The Font/Tabs help explains a bit about the additions.
616
+ Patch by Terry Jan Reedy
617
+
618
+ bpo-31460: Simplify the API of IDLE's Module Browser.
619
+ Passing a widget instead of an flist with a root widget opens the
620
+ option of creating a browser frame that is only part of a window.
621
+ Passing a full file name instead of pieces assumed to come from a
622
+ .py file opens the possibility of browsing python files that do not
623
+ end in .py.
624
+
625
+ bpo-31649: Make _htest and _utest parameters keyword-only.
626
+ These are used to adjust code for human and unit tests.
627
+
628
+ bpo-31459: Rename module browser from Class Browser to Module Browser.
629
+ The original module-level class and method browser became a module
630
+ browser, with the addition of module-level functions, years ago.
631
+ Nested classes and functions were added yesterday. For back-
632
+ compatibility, the virtual event <<open-class-browser>>, which
633
+ appears on the Keys tab of the Settings dialog, is not changed.
634
+ Patch by Cheryl Sabella.
635
+
636
+ bpo-1612262: Module browser now shows nested classes and functions.
637
+ Original patches for code and tests by Guilherme Polo and
638
+ Cheryl Sabella, respectively. Revisions by Terry Jan Reedy.
639
+
640
+ bpo-31500: Tk's default fonts now are scaled on HiDPI displays.
641
+ This affects all dialogs. Patch by Serhiy Storchaka.
642
+
643
+ bpo-31493: Fix code context update and font update timers.
644
+ Canceling timers prevents a warning message when test_idle completes.
645
+
646
+ bpo-31488: Update non-key options in former extension classes.
647
+ When applying configdialog changes, call .reload for each feature class.
648
+ Change ParenMatch so updated options affect existing instances attached
649
+ to existing editor windows.
650
+
651
+ bpo-31477: Improve rstrip entry in IDLE doc.
652
+ Strip Trailing Whitespace strips more than blank spaces.
653
+ Multiline string literals are not skipped.
654
+
655
+ bpo-31480: fix tests to pass with zzdummy extension disabled. (#3590)
656
+ To see the example in action, enable it on options extensions tab.
657
+
658
+ bpo-31421: Document how IDLE runs tkinter programs.
659
+ IDLE calls tcl/tk update in the background in order to make live
660
+ interaction and experimentation with tkinter applications much easier.
661
+
662
+ bpo-31414: Fix tk entry box tests by deleting first.
663
+ Adding to an int entry is not the same as deleting and inserting
664
+ because int('') will fail. Patch by Terry Jan Reedy.
665
+
666
+ bpo-27099: Convert IDLE's built-in 'extensions' to regular features.
667
+ About 10 IDLE features were implemented as supposedly optional
668
+ extensions. Their different behavior could be confusing or worse for
669
+ users and not good for maintenance. Hence the conversion.
670
+ The main difference for users is that user configurable key bindings
671
+ for builtin features are now handled uniformly. Now, editing a binding
672
+ in a keyset only affects its value in the keyset. All bindings are
673
+ defined together in the system-specific default keysets in config-
674
+ extensions.def. All custom keysets are saved as a whole in config-
675
+ extension.cfg. All take effect as soon as one clicks Apply or Ok.
676
+ The affected events are '<<force-open-completions>>',
677
+ '<<expand-word>>', '<<force-open-calltip>>', '<<flash-paren>>',
678
+ '<<format-paragraph>>', '<<run-module>>', '<<check-module>>', and
679
+ '<<zoom-height>>'. Any (global) customizations made before 3.6.3 will
680
+ not affect their keyset-specific customization after 3.6.3. and vice
681
+ versa.
682
+ Initial patch by Charles Wohlganger, revised by Terry Jan Reedy.
683
+
684
+ bpo-31051: Rearrange condigdialog General tab.
685
+ Sort non-Help options into Window (Shell+Editor) and Editor (only).
686
+ Leave room for the addition of new options.
687
+ Patch by Terry Jan Reedy.
688
+
689
+ bpo-30617: Add docstrings and tests for outwin subclass of editor.
690
+ Move some data and functions from the class to module level.
691
+ Patch by Cheryl Sabella.
692
+
693
+ bpo-31287: Do not modify tkinter.messagebox in test_configdialog.
694
+ Instead, mask it with an instance mock that can be deleted.
695
+ Patch by Terry Jan Reedy.
696
+
697
+ bpo-30781: Use ttk widgets in ConfigDialog pages.
698
+ These should especially look better on MacOSX.
699
+ Patches by Terry Jan Reedy and Cheryl Sabella.
700
+
701
+ bpo-31206: Factor HighPage(Frame) class from ConfigDialog.
702
+ Patch by Cheryl Sabella.
703
+
704
+ bp0-31001: Add tests for configdialog highlight tab.
705
+ Patch by Cheryl Sabella.
706
+
707
+ bpo-31205: Factor KeysPage(Frame) class from ConfigDialog.
708
+ The slightly modified tests continue to pass.
709
+ Patch by Cheryl Sabella.
710
+
711
+ bpo-31002: Add tests for configdialog keys tab.
712
+ Patch by Cheryl Sabella.
713
+
714
+ bpo-19903: Change calltipes to use inspect.signature.
715
+ Idlelib.calltips.get_argspec now uses inspect.signature instead of
716
+ inspect.getfullargspec, like help() does. This improves the signature
717
+ in the call tip in a few different cases, including builtins converted
718
+ to provide a signature. A message is added if the object is not
719
+ callable, has an invalid signature, or if it has positional-only
720
+ parameters. Patch by Louie Lu.
721
+
722
+ bop-31083: Add an outline of a TabPage class in configdialog.
723
+ Add template as comment. Update existing classes to match outline.
724
+ Initial patch by Cheryl Sabella.
725
+
726
+ bpo-31050: Factor GenPage(Frame) class from ConfigDialog.
727
+ The slightly modified tests for the General tab continue to pass.
728
+ Patch by Cheryl Sabella.
729
+
730
+ bpo-31004: Factor FontPage(Frame) class from ConfigDialog.
731
+ The slightly modified tests continue to pass. The General test
732
+ broken by the switch to ttk.Notebook is fixed.
733
+ Patch mostly by Cheryl Sabella.
734
+
735
+ bpo-30781: IDLE - Use ttk Notebook in ConfigDialog.
736
+ This improves navigation by tabbing.
737
+ Patch by Terry Jan Reedy.
738
+
739
+ bpo-31060: IDLE - Finish rearranging methods of ConfigDialog.
740
+ Grouping methods pertaining to each tab and the buttons will aid
741
+ writing tests and improving the tabs and will enable splitting the
742
+ groups into classes.
743
+ Patch by Terry Jan Reedy.
744
+
745
+ bpo-30853: IDLE -- Factor a VarTrace class out of ConfigDialog.
746
+ Instance tracers manages pairs consisting of a tk variable and a
747
+ callback function. When tracing is turned on, setting the variable
748
+ calls the function. Test coverage for the new class is 100%.
749
+ Patch by Terry Jan Reedy.
750
+
751
+ bpo-31003: IDLE: Add more tests for General tab.
752
+ Patch by Terry Jan Reedy.
753
+
754
+ bpo-30993: IDLE - Improve configdialog font page and tests.
755
+ *In configdialog: Document causal pathways in create_font_tab
756
+ docstring. Simplify some attribute names. Move set_samples calls to
757
+ var_changed_font (idea from Cheryl Sabella). Move related functions to
758
+ positions after the create widgets function.
759
+ * In test_configdialog: Fix test_font_set so not order dependent. Fix
760
+ renamed test_indent_scale so it tests the widget. Adjust tests for
761
+ movement of set_samples call. Add tests for load functions. Put all
762
+ font tests in one class and tab indent tests in another. Except for
763
+ two lines, these tests completely cover the related functions.
764
+ Patch by Terry Jan Reedy.
765
+
766
+ bpo-30981: IDLE -- Add more configdialog font page tests.
767
+
768
+ bpo-28523: IDLE: replace 'colour' with 'color' in configdialog.
769
+
770
+ bpo-30917: Add tests for idlelib.config.IdleConf.
771
+ Increase coverage from 46% to 96%.
772
+ Patch by Louie Lu.
773
+
774
+ bpo-30913: Document ConfigDialog tk Vars, methods, and widgets in docstrings
775
+ This will facilitate improving the dialog and splitting up the class.
776
+ Original patch by Cheryl Sabella.
777
+
778
+ bpo-30899: Add tests for ConfigParser subclasses in config.
779
+ Coverage is 100% for those classes and ConfigChanges.
780
+ Patch by Louie Lu.
781
+
782
+ bpo-30881: Add docstrings to browser.py.
783
+ Patch by Cheryl Sabella.
784
+
785
+ bpo-30851: Remove unused tk variables in configdialog.
786
+ One is a duplicate, one is set but cannot be altered by users.
787
+ Patch by Cheryl Sabella.
788
+
789
+ bpo-30870: Select font option with Up and Down keys, as well as with mouse.
790
+ Added test increases configdialog coverage to 60%
791
+ Patches mostly by Louie Lu.
792
+
793
+ bpo-8231: Call config.IdleConf.GetUserCfgDir only once per process.
794
+
795
+ bpo-30779: Factor ConfigChanges class from configdialog, put in config; test.
796
+ * In config, put dump test code in a function; run it and unittest in
797
+ 'if __name__ == '__main__'.
798
+ * Add class config.ConfigChanges based on changes_class_v4.py on bpo issue.
799
+ * Add class test_config.ChangesTest, partly using configdialog_tests_v1.py.
800
+ * Revise configdialog to use ConfigChanges; see tracker msg297804.
801
+ * Revise test_configdialog to match configdialog changes.
802
+ * Remove configdialog functions unused or moved to ConfigChanges.
803
+ Cheryl Sabella contributed parts of the patch.
804
+
805
+ bpo-30777: Configdialog - add docstrings and improve comments.
806
+ Patch by Cheryl Sabella.
807
+
808
+ bpo-30495: Improve textview with docstrings, PEP8 names, and more tests.
809
+ Split TextViewer class into ViewWindow, ViewFrame, and TextFrame classes
810
+ so that instances of the latter two can be placed with other widgets
811
+ within a multiframe window.
812
+ Patches by Cheryl Sabella and Terry Jan Reedy.
813
+
814
+ bpo-30723: Make several improvements to parenmatch.
815
+ * Add 'parens' style to highlight both opener and closer.
816
+ * Make 'default' style, which is not default, a synonym for 'opener'.
817
+ * Make time-delay work the same with all styles.
818
+ * Add help for config dialog extensions tab, including parenmatch.
819
+ * Add new tests.
820
+ Original patch by Charles Wohlganger. Revisions by Terry Jan Reedy
821
+
822
+ bpo-30674: Grep -- Add docstrings. Patch by Cheryl Sabella.
823
+
824
+ bpo-21519: IDLE's basic custom key entry dialog now detects
825
+ duplicates properly. Original patch by Saimadhav Heblikar.
826
+
827
+ bpo-29910: IDLE no longer deletes a character after commenting out a
828
+ region by a key shortcut. Add "return 'break'" for this and other
829
+ potential conflicts between IDLE and default key bindings.
830
+ Patch by Serhiy Storchaka.
831
+
832
+ bpo-30728: Modernize idlelib.configdialog:
833
+ * replace import * with specific imports;
834
+ * lowercase method and attribute lines.
835
+ Patch by Cheryl Sabella.
836
+
837
+ bpo-6739: Verify user-entered key sequences by trying to bind them
838
+ with to a tk widget. Add tests for all 3 validation functions.
839
+ Original patch by G Polo. Tests added by Cheryl Sabella.
840
+ Code revised and more tests added by Terry Jan Reedy
841
+
842
+ bpo-24813: Add icon to help_about and make other changes.
843
+
844
+ bpo-15786: Fix several problems with IDLE's autocompletion box.
845
+ The following should now work: clicking on selection box items;
846
+ using the scrollbar; selecting an item by hitting Return.
847
+ Hangs on MacOSX should no longer happen. Patch by Louie Lu.
848
+
849
+ bpo-25514: Add doc subsubsection about IDLE failure to start.
850
+ Popup no-connection message directs users to this section.
851
+
852
+ bpo-30642: Fix reference leaks in IDLE tests.
853
+ Patches by Louie Lu and Terry Jan Reedy.
854
+
855
+ bpo-30495: Add docstrings for textview.py and use PEP8 names.
856
+ Patches by Cheryl Sabella and Terry Jan Reedy.
857
+
858
+ bpo-30290: Help-about: use pep8 names and add tests.
859
+ Increase coverage to 100%.
860
+ Patches by Louie Lu, Cheryl Sabella, and Terry Jan Reedy.
861
+
862
+ bpo-30303: Add _utest option to textview; add new tests.
863
+ Increase coverage to 100%.
864
+ Patches by Louie Lu and Terry Jan Reedy.
865
+
866
+ Issue #29071: IDLE colors f-string prefixes but not invalid ur prefixes.
867
+
868
+ Issue #28572: Add 10% to coverage of IDLE's test_configdialog.
869
+ Update and augment description of the configuration system.
870
+
871
+
872
+ What's New in IDLE 3.6.0 (since 3.5.0)
873
+ Released on 2016-12-23
874
+ ======================================
875
+
876
+ - Issue #15308: Add 'interrupt execution' (^C) to Shell menu.
877
+ Patch by Roger Serwy, updated by Bayard Randel.
878
+
879
+ - Issue #27922: Stop IDLE tests from 'flashing' gui widgets on the screen.
880
+
881
+ - Issue #27891: Consistently group and sort imports within idlelib modules.
882
+
883
+ - Issue #17642: add larger font sizes for classroom projection.
884
+
885
+ - Add version to title of IDLE help window.
886
+
887
+ - Issue #25564: In section on IDLE -- console differences, mention that
888
+ using exec means that __builtins__ is defined for each statement.
889
+
890
+ - Issue #27821: Fix 3.6.0a3 regression that prevented custom key sets
891
+ from being selected when no custom theme was defined.
892
+
893
+ - Issue #27714: text_textview and test_autocomplete now pass when re-run
894
+ in the same process. This occurs when test_idle fails when run with the
895
+ -w option but without -jn. Fix warning from test_config.
896
+
897
+ - Issue #27621: Put query response validation error messages in the query
898
+ box itself instead of in a separate messagebox. Redo tests to match.
899
+ Add Mac OSX refinements. Original patch by Mark Roseman.
900
+
901
+ - Issue #27620: Escape key now closes Query box as cancelled.
902
+
903
+ - Issue #27609: IDLE: tab after initial whitespace should tab, not
904
+ autocomplete. This fixes problem with writing docstrings at least
905
+ twice indented.
906
+
907
+ - Issue #27609: Explicitly return None when there are also non-None
908
+ returns. In a few cases, reverse a condition and eliminate a return.
909
+
910
+ - Issue #25507: IDLE no longer runs buggy code because of its tkinter imports.
911
+ Users must include the same imports required to run directly in Python.
912
+
913
+ - Issue #27173: Add 'IDLE Modern Unix' to the built-in key sets.
914
+ Make the default key set depend on the platform.
915
+ Add tests for the changes to the config module.
916
+
917
+ - Issue #27452: add line counter and crc to IDLE configHandler test dump.
918
+
919
+ - Issue #27477: IDLE search dialogs now use ttk widgets.
920
+
921
+ - Issue #27173: Add 'IDLE Modern Unix' to the built-in key sets.
922
+ Make the default key set depend on the platform.
923
+ Add tests for the changes to the config module.
924
+
925
+ - Issue #27452: make command line "idle-test> python test_help.py" work.
926
+ __file__ is relative when python is started in the file's directory.
927
+
928
+ - Issue #27452: add line counter and crc to IDLE configHandler test dump.
929
+
930
+ - Issue #27380: IDLE: add query.py with base Query dialog and ttk widgets.
931
+ Module had subclasses SectionName, ModuleName, and HelpSource, which are
932
+ used to get information from users by configdialog and file =>Load Module.
933
+ Each subclass has itw own validity checks. Using ModuleName allows users
934
+ to edit bad module names instead of starting over.
935
+ Add tests and delete the two files combined into the new one.
936
+
937
+ - Issue #27372: Test_idle no longer changes the locale.
938
+
939
+ - Issue #27365: Allow non-ascii chars in IDLE NEWS.txt, for contributor names.
940
+
941
+ - Issue #27245: IDLE: Cleanly delete custom themes and key bindings.
942
+ Previously, when IDLE was started from a console or by import, a cascade
943
+ of warnings was emitted. Patch by Serhiy Storchaka.
944
+
945
+ - Issue #24137: Run IDLE, test_idle, and htest with tkinter default root disabled.
946
+ Fix code and tests that fail with this restriction.
947
+ Fix htests to not create a second and redundant root and mainloop.
948
+
949
+ - Issue #27310: Fix IDLE.app failure to launch on OS X due to vestigial import.
950
+
951
+ - Issue #5124: Paste with text selected now replaces the selection on X11.
952
+ This matches how paste works on Windows, Mac, most modern Linux apps,
953
+ and ttk widgets. Original patch by Serhiy Storchaka.
954
+
955
+ - Issue #24750: Switch all scrollbars in IDLE to ttk versions.
956
+ Where needed, minimal tests are added to cover changes.
957
+
958
+ - Issue #24759: IDLE requires tk 8.5 and availability ttk widgets.
959
+ Delete now unneeded tk version tests and code for older versions.
960
+ Add test for IDLE syntax colorizer.
961
+
962
+ - Issue #27239: idlelib.macosx.isXyzTk functions initialize as needed.
963
+
964
+ - Issue #27262: move Aqua unbinding code, which enable context menus, to macosx.
965
+
966
+ - Issue #24759: Make clear in idlelib.idle_test.__init__ that the directory
967
+ is a private implementation of test.test_idle and tool for maintainers.
968
+
969
+ - Issue #27196: Stop 'ThemeChanged' warnings when running IDLE tests.
970
+ These persisted after other warnings were suppressed in #20567.
971
+ Apply Serhiy Storchaka's update_idletasks solution to four test files.
972
+ Record this additional advice in idle_test/README.txt
973
+
974
+ - Issue #20567: Revise idle_test/README.txt with advice about avoiding
975
+ tk warning messages from tests. Apply advice to several IDLE tests.
976
+
977
+ - Issue # 24225: Update idlelib/README.txt with new file names
978
+ and event handlers.
979
+
980
+ - Issue #27156: Remove obsolete code not used by IDLE. Replacements:
981
+ 1. help.txt, replaced by help.html, is out-of-date and should not be used.
982
+ Its dedicated viewer has be replaced by the html viewer in help.py.
983
+ 2. 'import idlever; I = idlever.IDLE_VERSION' is the same as
984
+ 'import sys; I = version[:version.index(' ')]'
985
+ 3. After 'ob = stackviewer.VariablesTreeItem(*args)',
986
+ 'ob.keys()' == 'list(ob.object.keys).
987
+ 4. In macosc, runningAsOSXAPP == isAquaTk; idCarbonAquaTk == isCarbonTk
988
+
989
+ - Issue #27117: Make colorizer htest and turtledemo work with dark themes.
990
+ Move code for configuring text widget colors to a new function.
991
+
992
+ - Issue #24225: Rename many idlelib/*.py and idle_test/test_*.py files.
993
+ Edit files to replace old names with new names when the old name
994
+ referred to the module rather than the class it contained.
995
+ See the issue and IDLE section in What's New in 3.6 for more.
996
+
997
+ - Issue #26673: When tk reports font size as 0, change to size 10.
998
+ Such fonts on Linux prevented the configuration dialog from opening.
999
+
1000
+ - Issue #21939: Add test for IDLE's percolator.
1001
+ Original patch by Saimadhav Heblikar.
1002
+
1003
+ - Issue #21676: Add test for IDLE's replace dialog.
1004
+ Original patch by Saimadhav Heblikar.
1005
+
1006
+ - Issue #18410: Add test for IDLE's search dialog.
1007
+ Original patch by Westley Martínez.
1008
+
1009
+ - Issue #21703: Add test for undo delegator. Patch mostly by
1010
+ Saimadhav Heblikar .
1011
+
1012
+ - Issue #27044: Add ConfigDialog.remove_var_callbacks to stop memory leaks.
1013
+
1014
+ - Issue #23977: Add more asserts to test_delegator.
1015
+
1016
+ - Issue #20640: Add tests for idlelib.configHelpSourceEdit.
1017
+ Patch by Saimadhav Heblikar.
1018
+
1019
+ - In the 'IDLE-console differences' section of the IDLE doc, clarify
1020
+ how running with IDLE affects sys.modules and the standard streams.
1021
+
1022
+ - Issue #25507: fix incorrect change in IOBinding that prevented printing.
1023
+ Augment IOBinding htest to include all major IOBinding functions.
1024
+
1025
+ - Issue #25905: Revert unwanted conversion of ' to ’ RIGHT SINGLE QUOTATION
1026
+ MARK in README.txt and open this and NEWS.txt with 'ascii'.
1027
+ Re-encode CREDITS.txt to utf-8 and open it with 'utf-8'.
1028
+
1029
+ - Issue 15348: Stop the debugger engine (normally in a user process)
1030
+ before closing the debugger window (running in the IDLE process).
1031
+ This prevents the RuntimeErrors that were being caught and ignored.
1032
+
1033
+ - Issue #24455: Prevent IDLE from hanging when a) closing the shell while the
1034
+ debugger is active (15347); b) closing the debugger with the [X] button
1035
+ (15348); and c) activating the debugger when already active (24455).
1036
+ The patch by Mark Roseman does this by making two changes.
1037
+ 1. Suspend and resume the gui.interaction method with the tcl vwait
1038
+ mechanism intended for this purpose (instead of root.mainloop & .quit).
1039
+ 2. In gui.run, allow any existing interaction to terminate first.
1040
+
1041
+ - Change 'The program' to 'Your program' in an IDLE 'kill program?' message
1042
+ to make it clearer that the program referred to is the currently running
1043
+ user program, not IDLE itself.
1044
+
1045
+ - Issue #24750: Improve the appearance of the IDLE editor window status bar.
1046
+ Patch by Mark Roseman.
1047
+
1048
+ - Issue #25313: Change the handling of new built-in text color themes to better
1049
+ address the compatibility problem introduced by the addition of IDLE Dark.
1050
+ Consistently use the revised idleConf.CurrentTheme everywhere in idlelib.
1051
+
1052
+ - Issue #24782: Extension configuration is now a tab in the IDLE Preferences
1053
+ dialog rather than a separate dialog. The former tabs are now a sorted
1054
+ list. Patch by Mark Roseman.
1055
+
1056
+ - Issue #22726: Re-activate the config dialog help button with some content
1057
+ about the other buttons and the new IDLE Dark theme.
1058
+
1059
+ - Issue #24820: IDLE now has an 'IDLE Dark' built-in text color theme.
1060
+ It is more or less IDLE Classic inverted, with a cobalt blue background.
1061
+ Strings, comments, keywords, ... are still green, red, orange, ... .
1062
+ To use it with IDLEs released before November 2015, hit the
1063
+ 'Save as New Custom Theme' button and enter a new name,
1064
+ such as 'Custom Dark'. The custom theme will work with any IDLE
1065
+ release, and can be modified.
1066
+
1067
+ - Issue #25224: README.txt is now an idlelib index for IDLE developers and
1068
+ curious users. The previous user content is now in the IDLE doc chapter.
1069
+ 'IDLE' now means 'Integrated Development and Learning Environment'.
1070
+
1071
+ - Issue #24820: Users can now set breakpoint colors in
1072
+ Settings -> Custom Highlighting. Original patch by Mark Roseman.
1073
+
1074
+ - Issue #24972: Inactive selection background now matches active selection
1075
+ background, as configured by users, on all systems. Found items are now
1076
+ always highlighted on Windows. Initial patch by Mark Roseman.
1077
+
1078
+ - Issue #24570: Idle: make calltip and completion boxes appear on Macs
1079
+ affected by a tk regression. Initial patch by Mark Roseman.
1080
+
1081
+ - Issue #24988: Idle ScrolledList context menus (used in debugger)
1082
+ now work on Mac Aqua. Patch by Mark Roseman.
1083
+
1084
+ - Issue #24801: Make right-click for context menu work on Mac Aqua.
1085
+ Patch by Mark Roseman.
1086
+
1087
+ - Issue #25173: Associate tkinter messageboxes with a specific widget.
1088
+ For Mac OSX, make them a 'sheet'. Patch by Mark Roseman.
1089
+
1090
+ - Issue #25198: Enhance the initial html viewer now used for Idle Help.
1091
+ * Properly indent fixed-pitch text (patch by Mark Roseman).
1092
+ * Give code snippet a very Sphinx-like light blueish-gray background.
1093
+ * Re-use initial width and height set by users for shell and editor.
1094
+ * When the Table of Contents (TOC) menu is used, put the section header
1095
+ at the top of the screen.
1096
+
1097
+ - Issue #25225: Condense and rewrite Idle doc section on text colors.
1098
+
1099
+ - Issue #21995: Explain some differences between IDLE and console Python.
1100
+
1101
+ - Issue #22820: Explain need for *print* when running file from Idle editor.
1102
+
1103
+ - Issue #25224: Doc: augment Idle feature list and no-subprocess section.
1104
+
1105
+ - Issue #25219: Update doc for Idle command line options.
1106
+ Some were missing and notes were not correct.
1107
+
1108
+ - Issue #24861: Most of idlelib is private and subject to change.
1109
+ Use idleib.idle.* to start Idle. See idlelib.__init__.__doc__.
1110
+
1111
+ - Issue #25199: Idle: add synchronization comments for future maintainers.
1112
+
1113
+ - Issue #16893: Replace help.txt with help.html for Idle doc display.
1114
+ The new idlelib/help.html is rstripped Doc/build/html/library/idle.html.
1115
+ It looks better than help.txt and will better document Idle as released.
1116
+ The tkinter html viewer that works for this file was written by Mark Roseman.
1117
+ The now unused EditorWindow.HelpDialog class and helt.txt file are deprecated.
1118
+
1119
+ - Issue #24199: Deprecate unused idlelib.idlever with possible removal in 3.6.
1120
+
1121
+ - Issue #24790: Remove extraneous code (which also create 2 & 3 conflicts).
1122
+
1123
+
1124
+ What's New in IDLE 3.5.0?
1125
+ =========================
1126
+ *Release date: 2015-09-13*
1127
+
1128
+ - Issue #23672: Allow Idle to edit and run files with astral chars in name.
1129
+ Patch by Mohd Sanad Zaki Rizvi.
1130
+
1131
+ - Issue 24745: Idle editor default font. Switch from Courier to
1132
+ platform-sensitive TkFixedFont. This should not affect current customized
1133
+ font selections. If there is a problem, edit $HOME/.idlerc/config-main.cfg
1134
+ and remove 'fontxxx' entries from [Editor Window]. Patch by Mark Roseman.
1135
+
1136
+ - Issue #21192: Idle editor. When a file is run, put its name in the restart bar.
1137
+ Do not print false prompts. Original patch by Adnan Umer.
1138
+
1139
+ - Issue #13884: Idle menus. Remove tearoff lines. Patch by Roger Serwy.
1140
+
1141
+ - Issue #23184: remove unused names and imports in idlelib.
1142
+ Initial patch by Al Sweigart.
1143
+
1144
+ - Issue #20577: Configuration of the max line length for the FormatParagraph
1145
+ extension has been moved from the General tab of the Idle preferences dialog
1146
+ to the FormatParagraph tab of the Config Extensions dialog.
1147
+ Patch by Tal Einat.
1148
+
1149
+ - Issue #16893: Update Idle doc chapter to match current Idle and add new
1150
+ information.
1151
+
1152
+ - Issue #3068: Add Idle extension configuration dialog to Options menu.
1153
+ Changes are written to HOME/.idlerc/config-extensions.cfg.
1154
+ Original patch by Tal Einat.
1155
+
1156
+ - Issue #16233: A module browser (File : Class Browser, Alt+C) requires an
1157
+ editor window with a filename. When Class Browser is requested otherwise,
1158
+ from a shell, output window, or 'Untitled' editor, Idle no longer displays
1159
+ an error box. It now pops up an Open Module box (Alt+M). If a valid name
1160
+ is entered and a module is opened, a corresponding browser is also opened.
1161
+
1162
+ - Issue #4832: Save As to type Python files automatically adds .py to the
1163
+ name you enter (even if your system does not display it). Some systems
1164
+ automatically add .txt when type is Text files.
1165
+
1166
+ - Issue #21986: Code objects are not normally pickled by the pickle module.
1167
+ To match this, they are no longer pickled when running under Idle.
1168
+
1169
+ - Issue #23180: Rename IDLE "Windows" menu item to "Window".
1170
+ Patch by Al Sweigart.
1171
+
1172
+ - Issue #17390: Adjust Editor window title; remove 'Python',
1173
+ move version to end.
1174
+
1175
+ - Issue #14105: Idle debugger breakpoints no longer disappear
1176
+ when inserting or deleting lines.
1177
+
1178
+ - Issue #17172: Turtledemo can now be run from Idle.
1179
+ Currently, the entry is on the Help menu, but it may move to Run.
1180
+ Patch by Ramchandra Apt and Lita Cho.
1181
+
1182
+ - Issue #21765: Add support for non-ascii identifiers to HyperParser.
1183
+
1184
+ - Issue #21940: Add unittest for WidgetRedirector. Initial patch by Saimadhav
1185
+ Heblikar.
1186
+
1187
+ - Issue #18592: Add unittest for SearchDialogBase. Patch by Phil Webster.
1188
+
1189
+ - Issue #21694: Add unittest for ParenMatch. Patch by Saimadhav Heblikar.
1190
+
1191
+ - Issue #21686: add unittest for HyperParser. Original patch by Saimadhav
1192
+ Heblikar.
1193
+
1194
+ - Issue #12387: Add missing upper(lower)case versions of default Windows key
1195
+ bindings for Idle so Caps Lock does not disable them. Patch by Roger Serwy.
1196
+
1197
+ - Issue #21695: Closing a Find-in-files output window while the search is
1198
+ still in progress no longer closes Idle.
1199
+
1200
+ - Issue #18910: Add unittest for textView. Patch by Phil Webster.
1201
+
1202
+ - Issue #18292: Add unittest for AutoExpand. Patch by Saihadhav Heblikar.
1203
+
1204
+ - Issue #18409: Add unittest for AutoComplete. Patch by Phil Webster.
1205
+
1206
+ - Issue #21477: htest.py - Improve framework, complete set of tests.
1207
+ Patches by Saimadhav Heblikar
1208
+
1209
+ - Issue #18104: Add idlelib/idle_test/htest.py with a few sample tests to begin
1210
+ consolidating and improving human-validated tests of Idle. Change other files
1211
+ as needed to work with htest. Running the module as __main__ runs all tests.
1212
+
1213
+ - Issue #21139: Change default paragraph width to 72, the PEP 8 recommendation.
1214
+
1215
+ - Issue #21284: Paragraph reformat test passes after user changes reformat width.
1216
+
1217
+ - Issue #17654: Ensure IDLE menus are customized properly on OS X for
1218
+ non-framework builds and for all variants of Tk.
1219
+
1220
+
1221
+ What's New in IDLE 3.4.0?
1222
+ =========================
1223
+ *Release date: 2014-03-16*
1224
+
1225
+ - Issue #17390: Display Python version on Idle title bar.
1226
+ Initial patch by Edmond Burnett.
1227
+
1228
+ - Issue #5066: Update IDLE docs. Patch by Todd Rovito.
1229
+
1230
+ - Issue #17625: Close the replace dialog after it is used.
1231
+
1232
+ - Issue #16226: Fix IDLE Path Browser crash.
1233
+ (Patch by Roger Serwy)
1234
+
1235
+ - Issue #15853: Prevent IDLE crash on OS X when opening Preferences menu
1236
+ with certain versions of Tk 8.5. Initial patch by Kevin Walzer.
1237
+
1238
+
1239
+ What's New in IDLE 3.3.0?
1240
+ =========================
1241
+ *Release date: 2012-09-29*
1242
+
1243
+ - Issue #17625: Close the replace dialog after it is used.
1244
+
1245
+ - Issue #7163: Propagate return value of sys.stdout.write.
1246
+
1247
+ - Issue #15318: Prevent writing to sys.stdin.
1248
+
1249
+ - Issue #4832: Modify IDLE to save files with .py extension by
1250
+ default on Windows and OS X (Tk 8.5) as it already does with X11 Tk.
1251
+
1252
+ - Issue #13532, #15319: Check that arguments to sys.stdout.write are strings.
1253
+
1254
+ - Issue # 12510: Attempt to get certain tool tips no longer crashes IDLE.
1255
+ Erroneous tool tips have been corrected. Default added for callables.
1256
+
1257
+ - Issue #10365: File open dialog now works instead of crashing even when
1258
+ parent window is closed while dialog is open.
1259
+
1260
+ - Issue 14876: use user-selected font for highlight configuration.
1261
+
1262
+ - Issue #14937: Perform auto-completion of filenames in strings even for
1263
+ non-ASCII filenames. Likewise for identifiers.
1264
+
1265
+ - Issue #8515: Set __file__ when run file in IDLE.
1266
+ Initial patch by Bruce Frederiksen.
1267
+
1268
+ - IDLE can be launched as `python -m idlelib`
1269
+
1270
+ - Issue #14409: IDLE now properly executes commands in the Shell window
1271
+ when it cannot read the normal config files on startup and
1272
+ has to use the built-in default key bindings.
1273
+ There was previously a bug in one of the defaults.
1274
+
1275
+ - Issue #3573: IDLE hangs when passing invalid command line args
1276
+ (directory(ies) instead of file(s)).
1277
+
1278
+ - Issue #14018: Update checks for unstable system Tcl/Tk versions on OS X
1279
+ to include versions shipped with OS X 10.7 and 10.8 in addition to 10.6.
1280
+
1281
+
1282
+ What's New in IDLE 3.2.1?
1283
+ =========================
1284
+ *Release date: 15-May-11*
1285
+
1286
+ - Issue #6378: Further adjust idle.bat to start associated Python
1287
+
1288
+ - Issue #11896: Save on Close failed despite selecting "Yes" in dialog.
1289
+
1290
+ - Issue #1028: Ctrl-space binding to show completions was causing IDLE to exit.
1291
+ Tk < 8.5 was sending invalid Unicode null; replaced with valid null.
1292
+
1293
+ - Issue #4676: <Home> toggle failing on Tk 8.5, causing IDLE exits and strange selection
1294
+ behavior. Improve selection extension behaviour.
1295
+
1296
+ - Issue #3851: <Home> toggle non-functional when NumLock set on Windows.
1297
+
1298
+
1299
+ What's New in IDLE 3.1b1?
1300
+ =========================
1301
+ *Release date: 06-May-09*
1302
+
1303
+ - Issue #5707: Use of 'filter' in keybindingDialog.py was causing custom key assignment to
1304
+ fail. Patch by Amaury Forgeot d'Arc.
1305
+
1306
+ - Issue #4815: Offer conversion to UTF-8 if source files have
1307
+ no encoding declaration and are not encoded in UTF-8.
1308
+
1309
+ - Issue #4008: Fix problems with non-ASCII source files.
1310
+
1311
+ - Issue #4323: Always encode source as UTF-8 without asking
1312
+ the user (unless a different encoding is declared); remove
1313
+ user configuration of source encoding; all according to
1314
+ PEP 3120.
1315
+
1316
+ - Issue #2665: On Windows, an IDLE installation upgraded from an old version
1317
+ would not start if a custom theme was defined.
1318
+
1319
+ ------------------------------------------------------------------------
1320
+ Refer to NEWS2x.txt and HISTORY.txt for information on earlier releases.
1321
+ ------------------------------------------------------------------------
parrot/lib/python3.10/idlelib/TODO.txt ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Original IDLE todo, much of it now outdated:
2
+ ============================================
3
+ TO DO:
4
+
5
+ - improve debugger:
6
+ - manage breakpoints globally, allow bp deletion, tbreak, cbreak etc.
7
+ - real object browser
8
+ - help on how to use it (a simple help button will do wonders)
9
+ - performance? (updates of large sets of locals are slow)
10
+ - better integration of "debug module"
11
+ - debugger should be global resource (attached to flist, not to shell)
12
+ - fix the stupid bug where you need to step twice
13
+ - display class name in stack viewer entries for methods
14
+ - suppress tracing through IDLE internals (e.g. print) DONE
15
+ - add a button to suppress through a specific module or class or method
16
+ - more object inspection to stack viewer, e.g. to view all array items
17
+ - insert the initial current directory into sys.path DONE
18
+ - default directory attribute for each window instead of only for windows
19
+ that have an associated filename
20
+ - command expansion from keywords, module contents, other buffers, etc.
21
+ - "Recent documents" menu item DONE
22
+ - Filter region command
23
+ - Optional horizontal scroll bar
24
+ - more Emacsisms:
25
+ - ^K should cut to buffer
26
+ - M-[, M-] to move by paragraphs
27
+ - incremental search?
28
+ - search should indicate wrap-around in some way
29
+ - restructure state sensitive code to avoid testing flags all the time
30
+ - persistent user state (e.g. window and cursor positions, bindings)
31
+ - make backups when saving
32
+ - check file mtimes at various points
33
+ - Pluggable interface with RCS/CVS/Perforce/Clearcase
34
+ - better help?
35
+ - don't open second class browser on same module (nor second path browser)
36
+ - unify class and path browsers
37
+ - Need to define a standard way whereby one can determine one is running
38
+ inside IDLE (needed for Tk mainloop, also handy for $PYTHONSTARTUP)
39
+ - Add more utility methods for use by extensions (a la get_selection)
40
+ - Way to run command in totally separate interpreter (fork+os.system?) DONE
41
+ - Way to find definition of fully-qualified name:
42
+ In other words, select "UserDict.UserDict", hit some magic key and
43
+ it loads up UserDict.py and finds the first def or class for UserDict.
44
+ - need a way to force colorization on/off
45
+ - need a way to force auto-indent on/off
46
+
47
+ Details:
48
+
49
+ - ^O (on Unix -- open-line) should honor autoindent
50
+ - after paste, show end of pasted text
51
+ - on Windows, should turn short filename to long filename (not only in argv!)
52
+ (shouldn't this be done -- or undone -- by ntpath.normpath?)
53
+ - new autoindent after colon even indents when the colon is in a comment!
54
+ - sometimes forward slashes in pathname remain
55
+ - sometimes star in window name remains in Windows menu
56
+ - With unix bindings, ESC by itself is ignored
57
+ - Sometimes for no apparent reason a selection from the cursor to the
58
+ end of the command buffer appears, which is hard to get rid of
59
+ because it stays when you are typing!
60
+ - The Line/Col in the status bar can be wrong initially in PyShell DONE
61
+
62
+ Structural problems:
63
+
64
+ - too much knowledge in FileList about EditorWindow (for example)
65
+ - should add some primitives for accessing the selection etc.
66
+ to repeat cumbersome code over and over
67
+
68
+ ======================================================================
69
+
70
+ Jeff Bauer suggests:
71
+
72
+ - Open Module doesn't appear to handle hierarchical packages.
73
+ - Class browser should also allow hierarchical packages.
74
+ - Open and Open Module could benefit from a history, DONE
75
+ either command line style, or Microsoft recent-file
76
+ style.
77
+ - Add a Smalltalk-style inspector (i.e. Tkinspect)
78
+
79
+ The last suggestion is already a reality, but not yet
80
+ integrated into IDLE. I use a module called inspector.py,
81
+ that used to be available from python.org(?) It no longer
82
+ appears to be in the contributed section, and the source
83
+ has no author attribution.
84
+
85
+ In any case, the code is useful for visually navigating
86
+ an object's attributes, including its container hierarchy.
87
+
88
+ >>> from inspector import Tkinspect
89
+ >>> Tkinspect(None, myObject)
90
+
91
+ Tkinspect could probably be extended and refined to
92
+ integrate better into IDLE.
93
+
94
+ ======================================================================
95
+
96
+ Comparison to PTUI
97
+ ------------------
98
+
99
+ + PTUI's help is better (HTML!)
100
+
101
+ + PTUI can attach a shell to any module
102
+
103
+ + PTUI has some more I/O commands:
104
+ open multiple
105
+ append
106
+ examine (what's that?)
107
+
108
+ ======================================================================
109
+
110
+ Notes after trying to run Grail
111
+ -------------------------------
112
+
113
+ - Grail does stuff to sys.path based on sys.argv[0]; you must set
114
+ sys.argv[0] to something decent first (it is normally set to the path of
115
+ the idle script).
116
+
117
+ - Grail must be exec'ed in __main__ because that's imported by some
118
+ other parts of Grail.
119
+
120
+ - Grail uses a module called History and so does idle :-(
121
+
122
+ ======================================================================
123
+
124
+ Robin Friedrich's items:
125
+
126
+ Things I'd like to see:
127
+ - I'd like support for shift-click extending the selection. There's a
128
+ bug now that it doesn't work the first time you try it.
129
+ - Printing is needed. How hard can that be on Windows? FIRST CUT DONE
130
+ - The python-mode trick of autoindenting a line with <tab> is neat and
131
+ very handy.
132
+ - (someday) a spellchecker for docstrings and comments.
133
+ - a pagedown/up command key which moves to next class/def statement (top
134
+ level)
135
+ - split window capability
136
+ - DnD text relocation/copying
137
+
138
+ Things I don't want to see.
139
+ - line numbers... will probably slow things down way too much.
140
+ - Please use another icon for the tree browser leaf. The small snake
141
+ isn't cutting it.
142
+
143
+ ----------------------------------------------------------------------
144
+
145
+ - Customizable views (multi-window or multi-pane). (Markus Gritsch)
146
+
147
+ - Being able to double click (maybe double right click) on a callable
148
+ object in the editor which shows the source of the object, if
149
+ possible. (Gerrit Holl)
150
+
151
+ - Hooks into the guts, like in Emacs. (Mike Romberg)
152
+
153
+ - Sharing the editor with a remote tutor. (Martijn Faassen)
154
+
155
+ - Multiple views on the same file. (Tony J Ibbs)
156
+
157
+ - Store breakpoints in a global (per-project) database (GvR); Dirk
158
+ Heise adds: save some space-trimmed context and search around when
159
+ reopening a file that might have been edited by someone else.
160
+
161
+ - Capture menu events in extensions without changing the IDLE source.
162
+ (Matthias Barmeier)
163
+
164
+ - Use overlapping panels (a "notebook" in MFC terms I think) for info
165
+ that doesn't need to be accessible simultaneously (e.g. HTML source
166
+ and output). Use multi-pane windows for info that does need to be
167
+ shown together (e.g. class browser and source). (Albert Brandl)
168
+
169
+ - A project should invisibly track all symbols, for instant search,
170
+ replace and cross-ref. Projects should be allowed to span multiple
171
+ directories, hosts, etc. Project management files are placed in a
172
+ directory you specify. A global mapping between project names and
173
+ project directories should exist [not so sure --GvR]. (Tim Peters)
174
+
175
+ - Merge attr-tips and auto-expand. (Mark Hammond, Tim Peters)
176
+
177
+ - Python Shell should behave more like a "shell window" as users know
178
+ it -- i.e. you can only edit the current command, and the cursor can't
179
+ escape from the command area. (Albert Brandl)
180
+
181
+ - Set X11 class to "idle/Idle", set icon and title to something
182
+ beginning with "idle" -- for window manangers. (Randall Hopper)
183
+
184
+ - Config files editable through a preferences dialog. (me) DONE
185
+
186
+ - Config files still editable outside the preferences dialog.
187
+ (Randall Hopper) DONE
188
+
189
+ - When you're editing a command in PyShell, and there are only blank
190
+ lines below the cursor, hitting Return should ignore or delete those
191
+ blank lines rather than deciding you're not on the last line. (me)
192
+
193
+ - Run command (F5 c.s.) should be more like Pythonwin's Run -- a
194
+ dialog with options to give command line arguments, run the debugger,
195
+ etc. (me)
196
+
197
+ - Shouldn't be able to delete part of the prompt (or any text before
198
+ it) in the PyShell. (Martijn Faassen) DONE
199
+
200
+ - Emacs style auto-fill (also smart about comments and strings).
201
+ (Jeremy Hylton)
202
+
203
+ - Output of Run Script should go to a separate output window, not to
204
+ the shell window. Output of separate runs should all go to the same
205
+ window but clearly delimited. (David Scherer) REJECT FIRST, LATTER DONE
206
+
207
+ - GUI form designer to kick VB's butt. (Robert Geiger) THAT'S NOT IDLE
208
+
209
+ - Printing! Possibly via generation of PDF files which the user must
210
+ then send to the printer separately. (Dinu Gherman) FIRST CUT
parrot/lib/python3.10/idlelib/__pycache__/calltip_w.cpython-310.pyc ADDED
Binary file (6.2 kB). View file
 
parrot/lib/python3.10/idlelib/__pycache__/colorizer.cpython-310.pyc ADDED
Binary file (11.7 kB). View file
 
parrot/lib/python3.10/idlelib/__pycache__/debugobj_r.cpython-310.pyc ADDED
Binary file (2.24 kB). View file
 
parrot/lib/python3.10/idlelib/__pycache__/editor.cpython-310.pyc ADDED
Binary file (47.3 kB). View file
 
parrot/lib/python3.10/idlelib/__pycache__/filelist.cpython-310.pyc ADDED
Binary file (3.7 kB). View file
 
parrot/lib/python3.10/idlelib/__pycache__/format.cpython-310.pyc ADDED
Binary file (13.8 kB). View file
 
parrot/lib/python3.10/idlelib/__pycache__/multicall.cpython-310.pyc ADDED
Binary file (15.2 kB). View file
 
parrot/lib/python3.10/idlelib/__pycache__/outwin.cpython-310.pyc ADDED
Binary file (5.99 kB). View file
 
parrot/lib/python3.10/idlelib/__pycache__/percolator.cpython-310.pyc ADDED
Binary file (3.98 kB). View file
 
parrot/lib/python3.10/idlelib/__pycache__/query.cpython-310.pyc ADDED
Binary file (13 kB). View file
 
parrot/lib/python3.10/idlelib/__pycache__/run.cpython-310.pyc ADDED
Binary file (19.1 kB). View file
 
parrot/lib/python3.10/idlelib/__pycache__/runscript.cpython-310.pyc ADDED
Binary file (7.13 kB). View file
 
parrot/lib/python3.10/idlelib/__pycache__/scrolledlist.cpython-310.pyc ADDED
Binary file (5.31 kB). View file
 
parrot/lib/python3.10/idlelib/__pycache__/search.cpython-310.pyc ADDED
Binary file (5.93 kB). View file
 
parrot/lib/python3.10/idlelib/__pycache__/searchengine.cpython-310.pyc ADDED
Binary file (7.03 kB). View file
 
parrot/lib/python3.10/idlelib/__pycache__/statusbar.cpython-310.pyc ADDED
Binary file (1.99 kB). View file
 
parrot/lib/python3.10/idlelib/__pycache__/textview.cpython-310.pyc ADDED
Binary file (7.06 kB). View file
 
parrot/lib/python3.10/idlelib/__pycache__/undo.cpython-310.pyc ADDED
Binary file (10.7 kB). View file
 
parrot/lib/python3.10/idlelib/__pycache__/zzdummy.cpython-310.pyc ADDED
Binary file (2.48 kB). View file
 
parrot/lib/python3.10/idlelib/autocomplete.py ADDED
@@ -0,0 +1,228 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Complete either attribute names or file names.
2
+
3
+ Either on demand or after a user-selected delay after a key character,
4
+ pop up a list of candidates.
5
+ """
6
+ import __main__
7
+ import keyword
8
+ import os
9
+ import string
10
+ import sys
11
+
12
+ # Modified keyword list is used in fetch_completions.
13
+ completion_kwds = [s for s in keyword.kwlist
14
+ if s not in {'True', 'False', 'None'}] # In builtins.
15
+ completion_kwds.extend(('match', 'case')) # Context keywords.
16
+ completion_kwds.sort()
17
+
18
+ # Two types of completions; defined here for autocomplete_w import below.
19
+ ATTRS, FILES = 0, 1
20
+ from idlelib import autocomplete_w
21
+ from idlelib.config import idleConf
22
+ from idlelib.hyperparser import HyperParser
23
+
24
+ # Tuples passed to open_completions.
25
+ # EvalFunc, Complete, WantWin, Mode
26
+ FORCE = True, False, True, None # Control-Space.
27
+ TAB = False, True, True, None # Tab.
28
+ TRY_A = False, False, False, ATTRS # '.' for attributes.
29
+ TRY_F = False, False, False, FILES # '/' in quotes for file name.
30
+
31
+ # This string includes all chars that may be in an identifier.
32
+ # TODO Update this here and elsewhere.
33
+ ID_CHARS = string.ascii_letters + string.digits + "_"
34
+
35
+ SEPS = f"{os.sep}{os.altsep if os.altsep else ''}"
36
+ TRIGGERS = f".{SEPS}"
37
+
38
+ class AutoComplete:
39
+
40
+ def __init__(self, editwin=None, tags=None):
41
+ self.editwin = editwin
42
+ if editwin is not None: # not in subprocess or no-gui test
43
+ self.text = editwin.text
44
+ self.tags = tags
45
+ self.autocompletewindow = None
46
+ # id of delayed call, and the index of the text insert when
47
+ # the delayed call was issued. If _delayed_completion_id is
48
+ # None, there is no delayed call.
49
+ self._delayed_completion_id = None
50
+ self._delayed_completion_index = None
51
+
52
+ @classmethod
53
+ def reload(cls):
54
+ cls.popupwait = idleConf.GetOption(
55
+ "extensions", "AutoComplete", "popupwait", type="int", default=0)
56
+
57
+ def _make_autocomplete_window(self): # Makes mocking easier.
58
+ return autocomplete_w.AutoCompleteWindow(self.text, tags=self.tags)
59
+
60
+ def _remove_autocomplete_window(self, event=None):
61
+ if self.autocompletewindow:
62
+ self.autocompletewindow.hide_window()
63
+ self.autocompletewindow = None
64
+
65
+ def force_open_completions_event(self, event):
66
+ "(^space) Open completion list, even if a function call is needed."
67
+ self.open_completions(FORCE)
68
+ return "break"
69
+
70
+ def autocomplete_event(self, event):
71
+ "(tab) Complete word or open list if multiple options."
72
+ if hasattr(event, "mc_state") and event.mc_state or\
73
+ not self.text.get("insert linestart", "insert").strip():
74
+ # A modifier was pressed along with the tab or
75
+ # there is only previous whitespace on this line, so tab.
76
+ return None
77
+ if self.autocompletewindow and self.autocompletewindow.is_active():
78
+ self.autocompletewindow.complete()
79
+ return "break"
80
+ else:
81
+ opened = self.open_completions(TAB)
82
+ return "break" if opened else None
83
+
84
+ def try_open_completions_event(self, event=None):
85
+ "(./) Open completion list after pause with no movement."
86
+ lastchar = self.text.get("insert-1c")
87
+ if lastchar in TRIGGERS:
88
+ args = TRY_A if lastchar == "." else TRY_F
89
+ self._delayed_completion_index = self.text.index("insert")
90
+ if self._delayed_completion_id is not None:
91
+ self.text.after_cancel(self._delayed_completion_id)
92
+ self._delayed_completion_id = self.text.after(
93
+ self.popupwait, self._delayed_open_completions, args)
94
+
95
+ def _delayed_open_completions(self, args):
96
+ "Call open_completions if index unchanged."
97
+ self._delayed_completion_id = None
98
+ if self.text.index("insert") == self._delayed_completion_index:
99
+ self.open_completions(args)
100
+
101
+ def open_completions(self, args):
102
+ """Find the completions and create the AutoCompleteWindow.
103
+ Return True if successful (no syntax error or so found).
104
+ If complete is True, then if there's nothing to complete and no
105
+ start of completion, won't open completions and return False.
106
+ If mode is given, will open a completion list only in this mode.
107
+ """
108
+ evalfuncs, complete, wantwin, mode = args
109
+ # Cancel another delayed call, if it exists.
110
+ if self._delayed_completion_id is not None:
111
+ self.text.after_cancel(self._delayed_completion_id)
112
+ self._delayed_completion_id = None
113
+
114
+ hp = HyperParser(self.editwin, "insert")
115
+ curline = self.text.get("insert linestart", "insert")
116
+ i = j = len(curline)
117
+ if hp.is_in_string() and (not mode or mode==FILES):
118
+ # Find the beginning of the string.
119
+ # fetch_completions will look at the file system to determine
120
+ # whether the string value constitutes an actual file name
121
+ # XXX could consider raw strings here and unescape the string
122
+ # value if it's not raw.
123
+ self._remove_autocomplete_window()
124
+ mode = FILES
125
+ # Find last separator or string start
126
+ while i and curline[i-1] not in "'\"" + SEPS:
127
+ i -= 1
128
+ comp_start = curline[i:j]
129
+ j = i
130
+ # Find string start
131
+ while i and curline[i-1] not in "'\"":
132
+ i -= 1
133
+ comp_what = curline[i:j]
134
+ elif hp.is_in_code() and (not mode or mode==ATTRS):
135
+ self._remove_autocomplete_window()
136
+ mode = ATTRS
137
+ while i and (curline[i-1] in ID_CHARS or ord(curline[i-1]) > 127):
138
+ i -= 1
139
+ comp_start = curline[i:j]
140
+ if i and curline[i-1] == '.': # Need object with attributes.
141
+ hp.set_index("insert-%dc" % (len(curline)-(i-1)))
142
+ comp_what = hp.get_expression()
143
+ if (not comp_what or
144
+ (not evalfuncs and comp_what.find('(') != -1)):
145
+ return None
146
+ else:
147
+ comp_what = ""
148
+ else:
149
+ return None
150
+
151
+ if complete and not comp_what and not comp_start:
152
+ return None
153
+ comp_lists = self.fetch_completions(comp_what, mode)
154
+ if not comp_lists[0]:
155
+ return None
156
+ self.autocompletewindow = self._make_autocomplete_window()
157
+ return not self.autocompletewindow.show_window(
158
+ comp_lists, "insert-%dc" % len(comp_start),
159
+ complete, mode, wantwin)
160
+
161
+ def fetch_completions(self, what, mode):
162
+ """Return a pair of lists of completions for something. The first list
163
+ is a sublist of the second. Both are sorted.
164
+
165
+ If there is a Python subprocess, get the comp. list there. Otherwise,
166
+ either fetch_completions() is running in the subprocess itself or it
167
+ was called in an IDLE EditorWindow before any script had been run.
168
+
169
+ The subprocess environment is that of the most recently run script. If
170
+ two unrelated modules are being edited some calltips in the current
171
+ module may be inoperative if the module was not the last to run.
172
+ """
173
+ try:
174
+ rpcclt = self.editwin.flist.pyshell.interp.rpcclt
175
+ except:
176
+ rpcclt = None
177
+ if rpcclt:
178
+ return rpcclt.remotecall("exec", "get_the_completion_list",
179
+ (what, mode), {})
180
+ else:
181
+ if mode == ATTRS:
182
+ if what == "": # Main module names.
183
+ namespace = {**__main__.__builtins__.__dict__,
184
+ **__main__.__dict__}
185
+ bigl = eval("dir()", namespace)
186
+ bigl.extend(completion_kwds)
187
+ bigl.sort()
188
+ if "__all__" in bigl:
189
+ smalll = sorted(eval("__all__", namespace))
190
+ else:
191
+ smalll = [s for s in bigl if s[:1] != '_']
192
+ else:
193
+ try:
194
+ entity = self.get_entity(what)
195
+ bigl = dir(entity)
196
+ bigl.sort()
197
+ if "__all__" in bigl:
198
+ smalll = sorted(entity.__all__)
199
+ else:
200
+ smalll = [s for s in bigl if s[:1] != '_']
201
+ except:
202
+ return [], []
203
+
204
+ elif mode == FILES:
205
+ if what == "":
206
+ what = "."
207
+ try:
208
+ expandedpath = os.path.expanduser(what)
209
+ bigl = os.listdir(expandedpath)
210
+ bigl.sort()
211
+ smalll = [s for s in bigl if s[:1] != '.']
212
+ except OSError:
213
+ return [], []
214
+
215
+ if not smalll:
216
+ smalll = bigl
217
+ return smalll, bigl
218
+
219
+ def get_entity(self, name):
220
+ "Lookup name in a namespace spanning sys.modules and __main.dict__."
221
+ return eval(name, {**sys.modules, **__main__.__dict__})
222
+
223
+
224
+ AutoComplete.reload()
225
+
226
+ if __name__ == '__main__':
227
+ from unittest import main
228
+ main('idlelib.idle_test.test_autocomplete', verbosity=2)
parrot/lib/python3.10/idlelib/autoexpand.py ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''Complete the current word before the cursor with words in the editor.
2
+
3
+ Each menu selection or shortcut key selection replaces the word with a
4
+ different word with the same prefix. The search for matches begins
5
+ before the target and moves toward the top of the editor. It then starts
6
+ after the cursor and moves down. It then returns to the original word and
7
+ the cycle starts again.
8
+
9
+ Changing the current text line or leaving the cursor in a different
10
+ place before requesting the next selection causes AutoExpand to reset
11
+ its state.
12
+
13
+ There is only one instance of Autoexpand.
14
+ '''
15
+ import re
16
+ import string
17
+
18
+
19
+ class AutoExpand:
20
+ wordchars = string.ascii_letters + string.digits + "_"
21
+
22
+ def __init__(self, editwin):
23
+ self.text = editwin.text
24
+ self.bell = self.text.bell
25
+ self.state = None
26
+
27
+ def expand_word_event(self, event):
28
+ "Replace the current word with the next expansion."
29
+ curinsert = self.text.index("insert")
30
+ curline = self.text.get("insert linestart", "insert lineend")
31
+ if not self.state:
32
+ words = self.getwords()
33
+ index = 0
34
+ else:
35
+ words, index, insert, line = self.state
36
+ if insert != curinsert or line != curline:
37
+ words = self.getwords()
38
+ index = 0
39
+ if not words:
40
+ self.bell()
41
+ return "break"
42
+ word = self.getprevword()
43
+ self.text.delete("insert - %d chars" % len(word), "insert")
44
+ newword = words[index]
45
+ index = (index + 1) % len(words)
46
+ if index == 0:
47
+ self.bell() # Warn we cycled around
48
+ self.text.insert("insert", newword)
49
+ curinsert = self.text.index("insert")
50
+ curline = self.text.get("insert linestart", "insert lineend")
51
+ self.state = words, index, curinsert, curline
52
+ return "break"
53
+
54
+ def getwords(self):
55
+ "Return a list of words that match the prefix before the cursor."
56
+ word = self.getprevword()
57
+ if not word:
58
+ return []
59
+ before = self.text.get("1.0", "insert wordstart")
60
+ wbefore = re.findall(r"\b" + word + r"\w+\b", before)
61
+ del before
62
+ after = self.text.get("insert wordend", "end")
63
+ wafter = re.findall(r"\b" + word + r"\w+\b", after)
64
+ del after
65
+ if not wbefore and not wafter:
66
+ return []
67
+ words = []
68
+ dict = {}
69
+ # search backwards through words before
70
+ wbefore.reverse()
71
+ for w in wbefore:
72
+ if dict.get(w):
73
+ continue
74
+ words.append(w)
75
+ dict[w] = w
76
+ # search onwards through words after
77
+ for w in wafter:
78
+ if dict.get(w):
79
+ continue
80
+ words.append(w)
81
+ dict[w] = w
82
+ words.append(word)
83
+ return words
84
+
85
+ def getprevword(self):
86
+ "Return the word prefix before the cursor."
87
+ line = self.text.get("insert linestart", "insert")
88
+ i = len(line)
89
+ while i > 0 and line[i-1] in self.wordchars:
90
+ i = i-1
91
+ return line[i:]
92
+
93
+
94
+ if __name__ == '__main__':
95
+ from unittest import main
96
+ main('idlelib.idle_test.test_autoexpand', verbosity=2)
parrot/lib/python3.10/idlelib/config.py ADDED
@@ -0,0 +1,911 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """idlelib.config -- Manage IDLE configuration information.
2
+
3
+ The comments at the beginning of config-main.def describe the
4
+ configuration files and the design implemented to update user
5
+ configuration information. In particular, user configuration choices
6
+ which duplicate the defaults will be removed from the user's
7
+ configuration files, and if a user file becomes empty, it will be
8
+ deleted.
9
+
10
+ The configuration database maps options to values. Conceptually, the
11
+ database keys are tuples (config-type, section, item). As implemented,
12
+ there are separate dicts for default and user values. Each has
13
+ config-type keys 'main', 'extensions', 'highlight', and 'keys'. The
14
+ value for each key is a ConfigParser instance that maps section and item
15
+ to values. For 'main' and 'extensions', user values override
16
+ default values. For 'highlight' and 'keys', user sections augment the
17
+ default sections (and must, therefore, have distinct names).
18
+
19
+ Throughout this module there is an emphasis on returning useable defaults
20
+ when a problem occurs in returning a requested configuration value back to
21
+ idle. This is to allow IDLE to continue to function in spite of errors in
22
+ the retrieval of config information. When a default is returned instead of
23
+ a requested config value, a message is printed to stderr to aid in
24
+ configuration problem notification and resolution.
25
+ """
26
+ # TODOs added Oct 2014, tjr
27
+
28
+ from configparser import ConfigParser
29
+ import os
30
+ import sys
31
+
32
+ from tkinter.font import Font
33
+ import idlelib
34
+
35
+ class InvalidConfigType(Exception): pass
36
+ class InvalidConfigSet(Exception): pass
37
+ class InvalidTheme(Exception): pass
38
+
39
+ class IdleConfParser(ConfigParser):
40
+ """
41
+ A ConfigParser specialised for idle configuration file handling
42
+ """
43
+ def __init__(self, cfgFile, cfgDefaults=None):
44
+ """
45
+ cfgFile - string, fully specified configuration file name
46
+ """
47
+ self.file = cfgFile # This is currently '' when testing.
48
+ ConfigParser.__init__(self, defaults=cfgDefaults, strict=False)
49
+
50
+ def Get(self, section, option, type=None, default=None, raw=False):
51
+ """
52
+ Get an option value for given section/option or return default.
53
+ If type is specified, return as type.
54
+ """
55
+ # TODO Use default as fallback, at least if not None
56
+ # Should also print Warning(file, section, option).
57
+ # Currently may raise ValueError
58
+ if not self.has_option(section, option):
59
+ return default
60
+ if type == 'bool':
61
+ return self.getboolean(section, option)
62
+ elif type == 'int':
63
+ return self.getint(section, option)
64
+ else:
65
+ return self.get(section, option, raw=raw)
66
+
67
+ def GetOptionList(self, section):
68
+ "Return a list of options for given section, else []."
69
+ if self.has_section(section):
70
+ return self.options(section)
71
+ else: #return a default value
72
+ return []
73
+
74
+ def Load(self):
75
+ "Load the configuration file from disk."
76
+ if self.file:
77
+ self.read(self.file)
78
+
79
+ class IdleUserConfParser(IdleConfParser):
80
+ """
81
+ IdleConfigParser specialised for user configuration handling.
82
+ """
83
+
84
+ def SetOption(self, section, option, value):
85
+ """Return True if option is added or changed to value, else False.
86
+
87
+ Add section if required. False means option already had value.
88
+ """
89
+ if self.has_option(section, option):
90
+ if self.get(section, option) == value:
91
+ return False
92
+ else:
93
+ self.set(section, option, value)
94
+ return True
95
+ else:
96
+ if not self.has_section(section):
97
+ self.add_section(section)
98
+ self.set(section, option, value)
99
+ return True
100
+
101
+ def RemoveOption(self, section, option):
102
+ """Return True if option is removed from section, else False.
103
+
104
+ False if either section does not exist or did not have option.
105
+ """
106
+ if self.has_section(section):
107
+ return self.remove_option(section, option)
108
+ return False
109
+
110
+ def AddSection(self, section):
111
+ "If section doesn't exist, add it."
112
+ if not self.has_section(section):
113
+ self.add_section(section)
114
+
115
+ def RemoveEmptySections(self):
116
+ "Remove any sections that have no options."
117
+ for section in self.sections():
118
+ if not self.GetOptionList(section):
119
+ self.remove_section(section)
120
+
121
+ def IsEmpty(self):
122
+ "Return True if no sections after removing empty sections."
123
+ self.RemoveEmptySections()
124
+ return not self.sections()
125
+
126
+ def Save(self):
127
+ """Update user configuration file.
128
+
129
+ If self not empty after removing empty sections, write the file
130
+ to disk. Otherwise, remove the file from disk if it exists.
131
+ """
132
+ fname = self.file
133
+ if fname and fname[0] != '#':
134
+ if not self.IsEmpty():
135
+ try:
136
+ cfgFile = open(fname, 'w')
137
+ except OSError:
138
+ os.unlink(fname)
139
+ cfgFile = open(fname, 'w')
140
+ with cfgFile:
141
+ self.write(cfgFile)
142
+ elif os.path.exists(self.file):
143
+ os.remove(self.file)
144
+
145
+ class IdleConf:
146
+ """Hold config parsers for all idle config files in singleton instance.
147
+
148
+ Default config files, self.defaultCfg --
149
+ for config_type in self.config_types:
150
+ (idle install dir)/config-{config-type}.def
151
+
152
+ User config files, self.userCfg --
153
+ for config_type in self.config_types:
154
+ (user home dir)/.idlerc/config-{config-type}.cfg
155
+ """
156
+ def __init__(self, _utest=False):
157
+ self.config_types = ('main', 'highlight', 'keys', 'extensions')
158
+ self.defaultCfg = {}
159
+ self.userCfg = {}
160
+ self.cfg = {} # TODO use to select userCfg vs defaultCfg
161
+ # self.blink_off_time = <first editor text>['insertofftime']
162
+ # See https:/bugs.python.org/issue4630, msg356516.
163
+
164
+ if not _utest:
165
+ self.CreateConfigHandlers()
166
+ self.LoadCfgFiles()
167
+
168
+ def CreateConfigHandlers(self):
169
+ "Populate default and user config parser dictionaries."
170
+ idledir = os.path.dirname(__file__)
171
+ self.userdir = userdir = '' if idlelib.testing else self.GetUserCfgDir()
172
+ for cfg_type in self.config_types:
173
+ self.defaultCfg[cfg_type] = IdleConfParser(
174
+ os.path.join(idledir, f'config-{cfg_type}.def'))
175
+ self.userCfg[cfg_type] = IdleUserConfParser(
176
+ os.path.join(userdir or '#', f'config-{cfg_type}.cfg'))
177
+
178
+ def GetUserCfgDir(self):
179
+ """Return a filesystem directory for storing user config files.
180
+
181
+ Creates it if required.
182
+ """
183
+ cfgDir = '.idlerc'
184
+ userDir = os.path.expanduser('~')
185
+ if userDir != '~': # expanduser() found user home dir
186
+ if not os.path.exists(userDir):
187
+ if not idlelib.testing:
188
+ warn = ('\n Warning: os.path.expanduser("~") points to\n ' +
189
+ userDir + ',\n but the path does not exist.')
190
+ try:
191
+ print(warn, file=sys.stderr)
192
+ except OSError:
193
+ pass
194
+ userDir = '~'
195
+ if userDir == "~": # still no path to home!
196
+ # traditionally IDLE has defaulted to os.getcwd(), is this adequate?
197
+ userDir = os.getcwd()
198
+ userDir = os.path.join(userDir, cfgDir)
199
+ if not os.path.exists(userDir):
200
+ try:
201
+ os.mkdir(userDir)
202
+ except OSError:
203
+ if not idlelib.testing:
204
+ warn = ('\n Warning: unable to create user config directory\n' +
205
+ userDir + '\n Check path and permissions.\n Exiting!\n')
206
+ try:
207
+ print(warn, file=sys.stderr)
208
+ except OSError:
209
+ pass
210
+ raise SystemExit
211
+ # TODO continue without userDIr instead of exit
212
+ return userDir
213
+
214
+ def GetOption(self, configType, section, option, default=None, type=None,
215
+ warn_on_default=True, raw=False):
216
+ """Return a value for configType section option, or default.
217
+
218
+ If type is not None, return a value of that type. Also pass raw
219
+ to the config parser. First try to return a valid value
220
+ (including type) from a user configuration. If that fails, try
221
+ the default configuration. If that fails, return default, with a
222
+ default of None.
223
+
224
+ Warn if either user or default configurations have an invalid value.
225
+ Warn if default is returned and warn_on_default is True.
226
+ """
227
+ try:
228
+ if self.userCfg[configType].has_option(section, option):
229
+ return self.userCfg[configType].Get(section, option,
230
+ type=type, raw=raw)
231
+ except ValueError:
232
+ warning = ('\n Warning: config.py - IdleConf.GetOption -\n'
233
+ ' invalid %r value for configuration option %r\n'
234
+ ' from section %r: %r' %
235
+ (type, option, section,
236
+ self.userCfg[configType].Get(section, option, raw=raw)))
237
+ _warn(warning, configType, section, option)
238
+ try:
239
+ if self.defaultCfg[configType].has_option(section,option):
240
+ return self.defaultCfg[configType].Get(
241
+ section, option, type=type, raw=raw)
242
+ except ValueError:
243
+ pass
244
+ #returning default, print warning
245
+ if warn_on_default:
246
+ warning = ('\n Warning: config.py - IdleConf.GetOption -\n'
247
+ ' problem retrieving configuration option %r\n'
248
+ ' from section %r.\n'
249
+ ' returning default value: %r' %
250
+ (option, section, default))
251
+ _warn(warning, configType, section, option)
252
+ return default
253
+
254
+ def SetOption(self, configType, section, option, value):
255
+ """Set section option to value in user config file."""
256
+ self.userCfg[configType].SetOption(section, option, value)
257
+
258
+ def GetSectionList(self, configSet, configType):
259
+ """Return sections for configSet configType configuration.
260
+
261
+ configSet must be either 'user' or 'default'
262
+ configType must be in self.config_types.
263
+ """
264
+ if not (configType in self.config_types):
265
+ raise InvalidConfigType('Invalid configType specified')
266
+ if configSet == 'user':
267
+ cfgParser = self.userCfg[configType]
268
+ elif configSet == 'default':
269
+ cfgParser=self.defaultCfg[configType]
270
+ else:
271
+ raise InvalidConfigSet('Invalid configSet specified')
272
+ return cfgParser.sections()
273
+
274
+ def GetHighlight(self, theme, element):
275
+ """Return dict of theme element highlight colors.
276
+
277
+ The keys are 'foreground' and 'background'. The values are
278
+ tkinter color strings for configuring backgrounds and tags.
279
+ """
280
+ cfg = ('default' if self.defaultCfg['highlight'].has_section(theme)
281
+ else 'user')
282
+ theme_dict = self.GetThemeDict(cfg, theme)
283
+ fore = theme_dict[element + '-foreground']
284
+ if element == 'cursor':
285
+ element = 'normal'
286
+ back = theme_dict[element + '-background']
287
+ return {"foreground": fore, "background": back}
288
+
289
+ def GetThemeDict(self, type, themeName):
290
+ """Return {option:value} dict for elements in themeName.
291
+
292
+ type - string, 'default' or 'user' theme type
293
+ themeName - string, theme name
294
+ Values are loaded over ultimate fallback defaults to guarantee
295
+ that all theme elements are present in a newly created theme.
296
+ """
297
+ if type == 'user':
298
+ cfgParser = self.userCfg['highlight']
299
+ elif type == 'default':
300
+ cfgParser = self.defaultCfg['highlight']
301
+ else:
302
+ raise InvalidTheme('Invalid theme type specified')
303
+ # Provide foreground and background colors for each theme
304
+ # element (other than cursor) even though some values are not
305
+ # yet used by idle, to allow for their use in the future.
306
+ # Default values are generally black and white.
307
+ # TODO copy theme from a class attribute.
308
+ theme ={'normal-foreground':'#000000',
309
+ 'normal-background':'#ffffff',
310
+ 'keyword-foreground':'#000000',
311
+ 'keyword-background':'#ffffff',
312
+ 'builtin-foreground':'#000000',
313
+ 'builtin-background':'#ffffff',
314
+ 'comment-foreground':'#000000',
315
+ 'comment-background':'#ffffff',
316
+ 'string-foreground':'#000000',
317
+ 'string-background':'#ffffff',
318
+ 'definition-foreground':'#000000',
319
+ 'definition-background':'#ffffff',
320
+ 'hilite-foreground':'#000000',
321
+ 'hilite-background':'gray',
322
+ 'break-foreground':'#ffffff',
323
+ 'break-background':'#000000',
324
+ 'hit-foreground':'#ffffff',
325
+ 'hit-background':'#000000',
326
+ 'error-foreground':'#ffffff',
327
+ 'error-background':'#000000',
328
+ 'context-foreground':'#000000',
329
+ 'context-background':'#ffffff',
330
+ 'linenumber-foreground':'#000000',
331
+ 'linenumber-background':'#ffffff',
332
+ #cursor (only foreground can be set)
333
+ 'cursor-foreground':'#000000',
334
+ #shell window
335
+ 'stdout-foreground':'#000000',
336
+ 'stdout-background':'#ffffff',
337
+ 'stderr-foreground':'#000000',
338
+ 'stderr-background':'#ffffff',
339
+ 'console-foreground':'#000000',
340
+ 'console-background':'#ffffff',
341
+ }
342
+ for element in theme:
343
+ if not (cfgParser.has_option(themeName, element) or
344
+ # Skip warning for new elements.
345
+ element.startswith(('context-', 'linenumber-'))):
346
+ # Print warning that will return a default color
347
+ warning = ('\n Warning: config.IdleConf.GetThemeDict'
348
+ ' -\n problem retrieving theme element %r'
349
+ '\n from theme %r.\n'
350
+ ' returning default color: %r' %
351
+ (element, themeName, theme[element]))
352
+ _warn(warning, 'highlight', themeName, element)
353
+ theme[element] = cfgParser.Get(
354
+ themeName, element, default=theme[element])
355
+ return theme
356
+
357
+ def CurrentTheme(self):
358
+ "Return the name of the currently active text color theme."
359
+ return self.current_colors_and_keys('Theme')
360
+
361
+ def CurrentKeys(self):
362
+ """Return the name of the currently active key set."""
363
+ return self.current_colors_and_keys('Keys')
364
+
365
+ def current_colors_and_keys(self, section):
366
+ """Return the currently active name for Theme or Keys section.
367
+
368
+ idlelib.config-main.def ('default') includes these sections
369
+
370
+ [Theme]
371
+ default= 1
372
+ name= IDLE Classic
373
+ name2=
374
+
375
+ [Keys]
376
+ default= 1
377
+ name=
378
+ name2=
379
+
380
+ Item 'name2', is used for built-in ('default') themes and keys
381
+ added after 2015 Oct 1 and 2016 July 1. This kludge is needed
382
+ because setting 'name' to a builtin not defined in older IDLEs
383
+ to display multiple error messages or quit.
384
+ See https://bugs.python.org/issue25313.
385
+ When default = True, 'name2' takes precedence over 'name',
386
+ while older IDLEs will just use name. When default = False,
387
+ 'name2' may still be set, but it is ignored.
388
+ """
389
+ cfgname = 'highlight' if section == 'Theme' else 'keys'
390
+ default = self.GetOption('main', section, 'default',
391
+ type='bool', default=True)
392
+ name = ''
393
+ if default:
394
+ name = self.GetOption('main', section, 'name2', default='')
395
+ if not name:
396
+ name = self.GetOption('main', section, 'name', default='')
397
+ if name:
398
+ source = self.defaultCfg if default else self.userCfg
399
+ if source[cfgname].has_section(name):
400
+ return name
401
+ return "IDLE Classic" if section == 'Theme' else self.default_keys()
402
+
403
+ @staticmethod
404
+ def default_keys():
405
+ if sys.platform[:3] == 'win':
406
+ return 'IDLE Classic Windows'
407
+ elif sys.platform == 'darwin':
408
+ return 'IDLE Classic OSX'
409
+ else:
410
+ return 'IDLE Modern Unix'
411
+
412
+ def GetExtensions(self, active_only=True,
413
+ editor_only=False, shell_only=False):
414
+ """Return extensions in default and user config-extensions files.
415
+
416
+ If active_only True, only return active (enabled) extensions
417
+ and optionally only editor or shell extensions.
418
+ If active_only False, return all extensions.
419
+ """
420
+ extns = self.RemoveKeyBindNames(
421
+ self.GetSectionList('default', 'extensions'))
422
+ userExtns = self.RemoveKeyBindNames(
423
+ self.GetSectionList('user', 'extensions'))
424
+ for extn in userExtns:
425
+ if extn not in extns: #user has added own extension
426
+ extns.append(extn)
427
+ for extn in ('AutoComplete','CodeContext',
428
+ 'FormatParagraph','ParenMatch'):
429
+ extns.remove(extn)
430
+ # specific exclusions because we are storing config for mainlined old
431
+ # extensions in config-extensions.def for backward compatibility
432
+ if active_only:
433
+ activeExtns = []
434
+ for extn in extns:
435
+ if self.GetOption('extensions', extn, 'enable', default=True,
436
+ type='bool'):
437
+ #the extension is enabled
438
+ if editor_only or shell_only: # TODO both True contradict
439
+ if editor_only:
440
+ option = "enable_editor"
441
+ else:
442
+ option = "enable_shell"
443
+ if self.GetOption('extensions', extn,option,
444
+ default=True, type='bool',
445
+ warn_on_default=False):
446
+ activeExtns.append(extn)
447
+ else:
448
+ activeExtns.append(extn)
449
+ return activeExtns
450
+ else:
451
+ return extns
452
+
453
+ def RemoveKeyBindNames(self, extnNameList):
454
+ "Return extnNameList with keybinding section names removed."
455
+ return [n for n in extnNameList if not n.endswith(('_bindings', '_cfgBindings'))]
456
+
457
+ def GetExtnNameForEvent(self, virtualEvent):
458
+ """Return the name of the extension binding virtualEvent, or None.
459
+
460
+ virtualEvent - string, name of the virtual event to test for,
461
+ without the enclosing '<< >>'
462
+ """
463
+ extName = None
464
+ vEvent = '<<' + virtualEvent + '>>'
465
+ for extn in self.GetExtensions(active_only=0):
466
+ for event in self.GetExtensionKeys(extn):
467
+ if event == vEvent:
468
+ extName = extn # TODO return here?
469
+ return extName
470
+
471
+ def GetExtensionKeys(self, extensionName):
472
+ """Return dict: {configurable extensionName event : active keybinding}.
473
+
474
+ Events come from default config extension_cfgBindings section.
475
+ Keybindings come from GetCurrentKeySet() active key dict,
476
+ where previously used bindings are disabled.
477
+ """
478
+ keysName = extensionName + '_cfgBindings'
479
+ activeKeys = self.GetCurrentKeySet()
480
+ extKeys = {}
481
+ if self.defaultCfg['extensions'].has_section(keysName):
482
+ eventNames = self.defaultCfg['extensions'].GetOptionList(keysName)
483
+ for eventName in eventNames:
484
+ event = '<<' + eventName + '>>'
485
+ binding = activeKeys[event]
486
+ extKeys[event] = binding
487
+ return extKeys
488
+
489
+ def __GetRawExtensionKeys(self,extensionName):
490
+ """Return dict {configurable extensionName event : keybinding list}.
491
+
492
+ Events come from default config extension_cfgBindings section.
493
+ Keybindings list come from the splitting of GetOption, which
494
+ tries user config before default config.
495
+ """
496
+ keysName = extensionName+'_cfgBindings'
497
+ extKeys = {}
498
+ if self.defaultCfg['extensions'].has_section(keysName):
499
+ eventNames = self.defaultCfg['extensions'].GetOptionList(keysName)
500
+ for eventName in eventNames:
501
+ binding = self.GetOption(
502
+ 'extensions', keysName, eventName, default='').split()
503
+ event = '<<' + eventName + '>>'
504
+ extKeys[event] = binding
505
+ return extKeys
506
+
507
+ def GetExtensionBindings(self, extensionName):
508
+ """Return dict {extensionName event : active or defined keybinding}.
509
+
510
+ Augment self.GetExtensionKeys(extensionName) with mapping of non-
511
+ configurable events (from default config) to GetOption splits,
512
+ as in self.__GetRawExtensionKeys.
513
+ """
514
+ bindsName = extensionName + '_bindings'
515
+ extBinds = self.GetExtensionKeys(extensionName)
516
+ #add the non-configurable bindings
517
+ if self.defaultCfg['extensions'].has_section(bindsName):
518
+ eventNames = self.defaultCfg['extensions'].GetOptionList(bindsName)
519
+ for eventName in eventNames:
520
+ binding = self.GetOption(
521
+ 'extensions', bindsName, eventName, default='').split()
522
+ event = '<<' + eventName + '>>'
523
+ extBinds[event] = binding
524
+
525
+ return extBinds
526
+
527
+ def GetKeyBinding(self, keySetName, eventStr):
528
+ """Return the keybinding list for keySetName eventStr.
529
+
530
+ keySetName - name of key binding set (config-keys section).
531
+ eventStr - virtual event, including brackets, as in '<<event>>'.
532
+ """
533
+ eventName = eventStr[2:-2] #trim off the angle brackets
534
+ binding = self.GetOption('keys', keySetName, eventName, default='',
535
+ warn_on_default=False).split()
536
+ return binding
537
+
538
+ def GetCurrentKeySet(self):
539
+ "Return CurrentKeys with 'darwin' modifications."
540
+ result = self.GetKeySet(self.CurrentKeys())
541
+
542
+ if sys.platform == "darwin":
543
+ # macOS (OS X) Tk variants do not support the "Alt"
544
+ # keyboard modifier. Replace it with "Option".
545
+ # TODO (Ned?): the "Option" modifier does not work properly
546
+ # for Cocoa Tk and XQuartz Tk so we should not use it
547
+ # in the default 'OSX' keyset.
548
+ for k, v in result.items():
549
+ v2 = [ x.replace('<Alt-', '<Option-') for x in v ]
550
+ if v != v2:
551
+ result[k] = v2
552
+
553
+ return result
554
+
555
+ def GetKeySet(self, keySetName):
556
+ """Return event-key dict for keySetName core plus active extensions.
557
+
558
+ If a binding defined in an extension is already in use, the
559
+ extension binding is disabled by being set to ''
560
+ """
561
+ keySet = self.GetCoreKeys(keySetName)
562
+ activeExtns = self.GetExtensions(active_only=1)
563
+ for extn in activeExtns:
564
+ extKeys = self.__GetRawExtensionKeys(extn)
565
+ if extKeys: #the extension defines keybindings
566
+ for event in extKeys:
567
+ if extKeys[event] in keySet.values():
568
+ #the binding is already in use
569
+ extKeys[event] = '' #disable this binding
570
+ keySet[event] = extKeys[event] #add binding
571
+ return keySet
572
+
573
+ def IsCoreBinding(self, virtualEvent):
574
+ """Return True if the virtual event is one of the core idle key events.
575
+
576
+ virtualEvent - string, name of the virtual event to test for,
577
+ without the enclosing '<< >>'
578
+ """
579
+ return ('<<'+virtualEvent+'>>') in self.GetCoreKeys()
580
+
581
+ # TODO make keyBindings a file or class attribute used for test above
582
+ # and copied in function below.
583
+
584
+ former_extension_events = { # Those with user-configurable keys.
585
+ '<<force-open-completions>>', '<<expand-word>>',
586
+ '<<force-open-calltip>>', '<<flash-paren>>', '<<format-paragraph>>',
587
+ '<<run-module>>', '<<check-module>>', '<<zoom-height>>',
588
+ '<<run-custom>>',
589
+ }
590
+
591
+ def GetCoreKeys(self, keySetName=None):
592
+ """Return dict of core virtual-key keybindings for keySetName.
593
+
594
+ The default keySetName None corresponds to the keyBindings base
595
+ dict. If keySetName is not None, bindings from the config
596
+ file(s) are loaded _over_ these defaults, so if there is a
597
+ problem getting any core binding there will be an 'ultimate last
598
+ resort fallback' to the CUA-ish bindings defined here.
599
+ """
600
+ keyBindings={
601
+ '<<copy>>': ['<Control-c>', '<Control-C>'],
602
+ '<<cut>>': ['<Control-x>', '<Control-X>'],
603
+ '<<paste>>': ['<Control-v>', '<Control-V>'],
604
+ '<<beginning-of-line>>': ['<Control-a>', '<Home>'],
605
+ '<<center-insert>>': ['<Control-l>'],
606
+ '<<close-all-windows>>': ['<Control-q>'],
607
+ '<<close-window>>': ['<Alt-F4>'],
608
+ '<<do-nothing>>': ['<Control-x>'],
609
+ '<<end-of-file>>': ['<Control-d>'],
610
+ '<<python-docs>>': ['<F1>'],
611
+ '<<python-context-help>>': ['<Shift-F1>'],
612
+ '<<history-next>>': ['<Alt-n>'],
613
+ '<<history-previous>>': ['<Alt-p>'],
614
+ '<<interrupt-execution>>': ['<Control-c>'],
615
+ '<<view-restart>>': ['<F6>'],
616
+ '<<restart-shell>>': ['<Control-F6>'],
617
+ '<<open-class-browser>>': ['<Alt-c>'],
618
+ '<<open-module>>': ['<Alt-m>'],
619
+ '<<open-new-window>>': ['<Control-n>'],
620
+ '<<open-window-from-file>>': ['<Control-o>'],
621
+ '<<plain-newline-and-indent>>': ['<Control-j>'],
622
+ '<<print-window>>': ['<Control-p>'],
623
+ '<<redo>>': ['<Control-y>'],
624
+ '<<remove-selection>>': ['<Escape>'],
625
+ '<<save-copy-of-window-as-file>>': ['<Alt-Shift-S>'],
626
+ '<<save-window-as-file>>': ['<Alt-s>'],
627
+ '<<save-window>>': ['<Control-s>'],
628
+ '<<select-all>>': ['<Alt-a>'],
629
+ '<<toggle-auto-coloring>>': ['<Control-slash>'],
630
+ '<<undo>>': ['<Control-z>'],
631
+ '<<find-again>>': ['<Control-g>', '<F3>'],
632
+ '<<find-in-files>>': ['<Alt-F3>'],
633
+ '<<find-selection>>': ['<Control-F3>'],
634
+ '<<find>>': ['<Control-f>'],
635
+ '<<replace>>': ['<Control-h>'],
636
+ '<<goto-line>>': ['<Alt-g>'],
637
+ '<<smart-backspace>>': ['<Key-BackSpace>'],
638
+ '<<newline-and-indent>>': ['<Key-Return>', '<Key-KP_Enter>'],
639
+ '<<smart-indent>>': ['<Key-Tab>'],
640
+ '<<indent-region>>': ['<Control-Key-bracketright>'],
641
+ '<<dedent-region>>': ['<Control-Key-bracketleft>'],
642
+ '<<comment-region>>': ['<Alt-Key-3>'],
643
+ '<<uncomment-region>>': ['<Alt-Key-4>'],
644
+ '<<tabify-region>>': ['<Alt-Key-5>'],
645
+ '<<untabify-region>>': ['<Alt-Key-6>'],
646
+ '<<toggle-tabs>>': ['<Alt-Key-t>'],
647
+ '<<change-indentwidth>>': ['<Alt-Key-u>'],
648
+ '<<del-word-left>>': ['<Control-Key-BackSpace>'],
649
+ '<<del-word-right>>': ['<Control-Key-Delete>'],
650
+ '<<force-open-completions>>': ['<Control-Key-space>'],
651
+ '<<expand-word>>': ['<Alt-Key-slash>'],
652
+ '<<force-open-calltip>>': ['<Control-Key-backslash>'],
653
+ '<<flash-paren>>': ['<Control-Key-0>'],
654
+ '<<format-paragraph>>': ['<Alt-Key-q>'],
655
+ '<<run-module>>': ['<Key-F5>'],
656
+ '<<run-custom>>': ['<Shift-Key-F5>'],
657
+ '<<check-module>>': ['<Alt-Key-x>'],
658
+ '<<zoom-height>>': ['<Alt-Key-2>'],
659
+ }
660
+
661
+ if keySetName:
662
+ if not (self.userCfg['keys'].has_section(keySetName) or
663
+ self.defaultCfg['keys'].has_section(keySetName)):
664
+ warning = (
665
+ '\n Warning: config.py - IdleConf.GetCoreKeys -\n'
666
+ ' key set %r is not defined, using default bindings.' %
667
+ (keySetName,)
668
+ )
669
+ _warn(warning, 'keys', keySetName)
670
+ else:
671
+ for event in keyBindings:
672
+ binding = self.GetKeyBinding(keySetName, event)
673
+ if binding:
674
+ keyBindings[event] = binding
675
+ # Otherwise return default in keyBindings.
676
+ elif event not in self.former_extension_events:
677
+ warning = (
678
+ '\n Warning: config.py - IdleConf.GetCoreKeys -\n'
679
+ ' problem retrieving key binding for event %r\n'
680
+ ' from key set %r.\n'
681
+ ' returning default value: %r' %
682
+ (event, keySetName, keyBindings[event])
683
+ )
684
+ _warn(warning, 'keys', keySetName, event)
685
+ return keyBindings
686
+
687
+ def GetExtraHelpSourceList(self, configSet):
688
+ """Return list of extra help sources from a given configSet.
689
+
690
+ Valid configSets are 'user' or 'default'. Return a list of tuples of
691
+ the form (menu_item , path_to_help_file , option), or return the empty
692
+ list. 'option' is the sequence number of the help resource. 'option'
693
+ values determine the position of the menu items on the Help menu,
694
+ therefore the returned list must be sorted by 'option'.
695
+
696
+ """
697
+ helpSources = []
698
+ if configSet == 'user':
699
+ cfgParser = self.userCfg['main']
700
+ elif configSet == 'default':
701
+ cfgParser = self.defaultCfg['main']
702
+ else:
703
+ raise InvalidConfigSet('Invalid configSet specified')
704
+ options=cfgParser.GetOptionList('HelpFiles')
705
+ for option in options:
706
+ value=cfgParser.Get('HelpFiles', option, default=';')
707
+ if value.find(';') == -1: #malformed config entry with no ';'
708
+ menuItem = '' #make these empty
709
+ helpPath = '' #so value won't be added to list
710
+ else: #config entry contains ';' as expected
711
+ value=value.split(';')
712
+ menuItem=value[0].strip()
713
+ helpPath=value[1].strip()
714
+ if menuItem and helpPath: #neither are empty strings
715
+ helpSources.append( (menuItem,helpPath,option) )
716
+ helpSources.sort(key=lambda x: x[2])
717
+ return helpSources
718
+
719
+ def GetAllExtraHelpSourcesList(self):
720
+ """Return a list of the details of all additional help sources.
721
+
722
+ Tuples in the list are those of GetExtraHelpSourceList.
723
+ """
724
+ allHelpSources = (self.GetExtraHelpSourceList('default') +
725
+ self.GetExtraHelpSourceList('user') )
726
+ return allHelpSources
727
+
728
+ def GetFont(self, root, configType, section):
729
+ """Retrieve a font from configuration (font, font-size, font-bold)
730
+ Intercept the special value 'TkFixedFont' and substitute
731
+ the actual font, factoring in some tweaks if needed for
732
+ appearance sakes.
733
+
734
+ The 'root' parameter can normally be any valid Tkinter widget.
735
+
736
+ Return a tuple (family, size, weight) suitable for passing
737
+ to tkinter.Font
738
+ """
739
+ family = self.GetOption(configType, section, 'font', default='courier')
740
+ size = self.GetOption(configType, section, 'font-size', type='int',
741
+ default='10')
742
+ bold = self.GetOption(configType, section, 'font-bold', default=0,
743
+ type='bool')
744
+ if (family == 'TkFixedFont'):
745
+ f = Font(name='TkFixedFont', exists=True, root=root)
746
+ actualFont = Font.actual(f)
747
+ family = actualFont['family']
748
+ size = actualFont['size']
749
+ if size <= 0:
750
+ size = 10 # if font in pixels, ignore actual size
751
+ bold = actualFont['weight'] == 'bold'
752
+ return (family, size, 'bold' if bold else 'normal')
753
+
754
+ def LoadCfgFiles(self):
755
+ "Load all configuration files."
756
+ for key in self.defaultCfg:
757
+ self.defaultCfg[key].Load()
758
+ self.userCfg[key].Load() #same keys
759
+
760
+ def SaveUserCfgFiles(self):
761
+ "Write all loaded user configuration files to disk."
762
+ for key in self.userCfg:
763
+ self.userCfg[key].Save()
764
+
765
+
766
+ idleConf = IdleConf()
767
+
768
+ _warned = set()
769
+ def _warn(msg, *key):
770
+ key = (msg,) + key
771
+ if key not in _warned:
772
+ try:
773
+ print(msg, file=sys.stderr)
774
+ except OSError:
775
+ pass
776
+ _warned.add(key)
777
+
778
+
779
+ class ConfigChanges(dict):
780
+ """Manage a user's proposed configuration option changes.
781
+
782
+ Names used across multiple methods:
783
+ page -- one of the 4 top-level dicts representing a
784
+ .idlerc/config-x.cfg file.
785
+ config_type -- name of a page.
786
+ section -- a section within a page/file.
787
+ option -- name of an option within a section.
788
+ value -- value for the option.
789
+
790
+ Methods
791
+ add_option: Add option and value to changes.
792
+ save_option: Save option and value to config parser.
793
+ save_all: Save all the changes to the config parser and file.
794
+ delete_section: If section exists,
795
+ delete from changes, userCfg, and file.
796
+ clear: Clear all changes by clearing each page.
797
+ """
798
+ def __init__(self):
799
+ "Create a page for each configuration file"
800
+ self.pages = [] # List of unhashable dicts.
801
+ for config_type in idleConf.config_types:
802
+ self[config_type] = {}
803
+ self.pages.append(self[config_type])
804
+
805
+ def add_option(self, config_type, section, item, value):
806
+ "Add item/value pair for config_type and section."
807
+ page = self[config_type]
808
+ value = str(value) # Make sure we use a string.
809
+ if section not in page:
810
+ page[section] = {}
811
+ page[section][item] = value
812
+
813
+ @staticmethod
814
+ def save_option(config_type, section, item, value):
815
+ """Return True if the configuration value was added or changed.
816
+
817
+ Helper for save_all.
818
+ """
819
+ if idleConf.defaultCfg[config_type].has_option(section, item):
820
+ if idleConf.defaultCfg[config_type].Get(section, item) == value:
821
+ # The setting equals a default setting, remove it from user cfg.
822
+ return idleConf.userCfg[config_type].RemoveOption(section, item)
823
+ # If we got here, set the option.
824
+ return idleConf.userCfg[config_type].SetOption(section, item, value)
825
+
826
+ def save_all(self):
827
+ """Save configuration changes to the user config file.
828
+
829
+ Clear self in preparation for additional changes.
830
+ Return changed for testing.
831
+ """
832
+ idleConf.userCfg['main'].Save()
833
+
834
+ changed = False
835
+ for config_type in self:
836
+ cfg_type_changed = False
837
+ page = self[config_type]
838
+ for section in page:
839
+ if section == 'HelpFiles': # Remove it for replacement.
840
+ idleConf.userCfg['main'].remove_section('HelpFiles')
841
+ cfg_type_changed = True
842
+ for item, value in page[section].items():
843
+ if self.save_option(config_type, section, item, value):
844
+ cfg_type_changed = True
845
+ if cfg_type_changed:
846
+ idleConf.userCfg[config_type].Save()
847
+ changed = True
848
+ for config_type in ['keys', 'highlight']:
849
+ # Save these even if unchanged!
850
+ idleConf.userCfg[config_type].Save()
851
+ self.clear()
852
+ # ConfigDialog caller must add the following call
853
+ # self.save_all_changed_extensions() # Uses a different mechanism.
854
+ return changed
855
+
856
+ def delete_section(self, config_type, section):
857
+ """Delete a section from self, userCfg, and file.
858
+
859
+ Used to delete custom themes and keysets.
860
+ """
861
+ if section in self[config_type]:
862
+ del self[config_type][section]
863
+ configpage = idleConf.userCfg[config_type]
864
+ configpage.remove_section(section)
865
+ configpage.Save()
866
+
867
+ def clear(self):
868
+ """Clear all 4 pages.
869
+
870
+ Called in save_all after saving to idleConf.
871
+ XXX Mark window *title* when there are changes; unmark here.
872
+ """
873
+ for page in self.pages:
874
+ page.clear()
875
+
876
+
877
+ # TODO Revise test output, write expanded unittest
878
+ def _dump(): # htest # (not really, but ignore in coverage)
879
+ from zlib import crc32
880
+ line, crc = 0, 0
881
+
882
+ def sprint(obj):
883
+ global line, crc
884
+ txt = str(obj)
885
+ line += 1
886
+ crc = crc32(txt.encode(encoding='utf-8'), crc)
887
+ print(txt)
888
+ #print('***', line, crc, '***') # Uncomment for diagnosis.
889
+
890
+ def dumpCfg(cfg):
891
+ print('\n', cfg, '\n') # Cfg has variable '0xnnnnnnnn' address.
892
+ for key in sorted(cfg.keys()):
893
+ sections = cfg[key].sections()
894
+ sprint(key)
895
+ sprint(sections)
896
+ for section in sections:
897
+ options = cfg[key].options(section)
898
+ sprint(section)
899
+ sprint(options)
900
+ for option in options:
901
+ sprint(option + ' = ' + cfg[key].Get(section, option))
902
+
903
+ dumpCfg(idleConf.defaultCfg)
904
+ dumpCfg(idleConf.userCfg)
905
+ print('\nlines = ', line, ', crc = ', crc, sep='')
906
+
907
+ if __name__ == '__main__':
908
+ from unittest import main
909
+ main('idlelib.idle_test.test_config', verbosity=2, exit=False)
910
+
911
+ # Run revised _dump() as htest?
parrot/lib/python3.10/idlelib/history.py ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Implement Idle Shell history mechanism with History class"
2
+
3
+ from idlelib.config import idleConf
4
+
5
+
6
+ class History:
7
+ ''' Implement Idle Shell history mechanism.
8
+
9
+ store - Store source statement (called from pyshell.resetoutput).
10
+ fetch - Fetch stored statement matching prefix already entered.
11
+ history_next - Bound to <<history-next>> event (default Alt-N).
12
+ history_prev - Bound to <<history-prev>> event (default Alt-P).
13
+ '''
14
+ def __init__(self, text):
15
+ '''Initialize data attributes and bind event methods.
16
+
17
+ .text - Idle wrapper of tk Text widget, with .bell().
18
+ .history - source statements, possibly with multiple lines.
19
+ .prefix - source already entered at prompt; filters history list.
20
+ .pointer - index into history.
21
+ .cyclic - wrap around history list (or not).
22
+ '''
23
+ self.text = text
24
+ self.history = []
25
+ self.prefix = None
26
+ self.pointer = None
27
+ self.cyclic = idleConf.GetOption("main", "History", "cyclic", 1, "bool")
28
+ text.bind("<<history-previous>>", self.history_prev)
29
+ text.bind("<<history-next>>", self.history_next)
30
+
31
+ def history_next(self, event):
32
+ "Fetch later statement; start with ealiest if cyclic."
33
+ self.fetch(reverse=False)
34
+ return "break"
35
+
36
+ def history_prev(self, event):
37
+ "Fetch earlier statement; start with most recent."
38
+ self.fetch(reverse=True)
39
+ return "break"
40
+
41
+ def fetch(self, reverse):
42
+ '''Fetch statement and replace current line in text widget.
43
+
44
+ Set prefix and pointer as needed for successive fetches.
45
+ Reset them to None, None when returning to the start line.
46
+ Sound bell when return to start line or cannot leave a line
47
+ because cyclic is False.
48
+ '''
49
+ nhist = len(self.history)
50
+ pointer = self.pointer
51
+ prefix = self.prefix
52
+ if pointer is not None and prefix is not None:
53
+ if self.text.compare("insert", "!=", "end-1c") or \
54
+ self.text.get("iomark", "end-1c") != self.history[pointer]:
55
+ pointer = prefix = None
56
+ self.text.mark_set("insert", "end-1c") # != after cursor move
57
+ if pointer is None or prefix is None:
58
+ prefix = self.text.get("iomark", "end-1c")
59
+ if reverse:
60
+ pointer = nhist # will be decremented
61
+ else:
62
+ if self.cyclic:
63
+ pointer = -1 # will be incremented
64
+ else: # abort history_next
65
+ self.text.bell()
66
+ return
67
+ nprefix = len(prefix)
68
+ while True:
69
+ pointer += -1 if reverse else 1
70
+ if pointer < 0 or pointer >= nhist:
71
+ self.text.bell()
72
+ if not self.cyclic and pointer < 0: # abort history_prev
73
+ return
74
+ else:
75
+ if self.text.get("iomark", "end-1c") != prefix:
76
+ self.text.delete("iomark", "end-1c")
77
+ self.text.insert("iomark", prefix, "stdin")
78
+ pointer = prefix = None
79
+ break
80
+ item = self.history[pointer]
81
+ if item[:nprefix] == prefix and len(item) > nprefix:
82
+ self.text.delete("iomark", "end-1c")
83
+ self.text.insert("iomark", item, "stdin")
84
+ break
85
+ self.text.see("insert")
86
+ self.text.tag_remove("sel", "1.0", "end")
87
+ self.pointer = pointer
88
+ self.prefix = prefix
89
+
90
+ def store(self, source):
91
+ "Store Shell input statement into history list."
92
+ source = source.strip()
93
+ if len(source) > 2:
94
+ # avoid duplicates
95
+ try:
96
+ self.history.remove(source)
97
+ except ValueError:
98
+ pass
99
+ self.history.append(source)
100
+ self.pointer = None
101
+ self.prefix = None
102
+
103
+
104
+ if __name__ == "__main__":
105
+ from unittest import main
106
+ main('idlelib.idle_test.test_history', verbosity=2, exit=False)
parrot/lib/python3.10/idlelib/idle_test/__init__.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''idlelib.idle_test is a private implementation of test.test_idle,
2
+ which tests the IDLE application as part of the stdlib test suite.
3
+ Run IDLE tests alone with "python -m test.test_idle".
4
+ Starting with Python 3.6, IDLE requires tcl/tk 8.5 or later.
5
+
6
+ This package and its contained modules are subject to change and
7
+ any direct use is at your own risk.
8
+ '''
9
+ from os.path import dirname
10
+
11
+ def load_tests(loader, standard_tests, pattern):
12
+ this_dir = dirname(__file__)
13
+ top_dir = dirname(dirname(this_dir))
14
+ package_tests = loader.discover(start_dir=this_dir, pattern='test*.py',
15
+ top_level_dir=top_dir)
16
+ standard_tests.addTests(package_tests)
17
+ return standard_tests
parrot/lib/python3.10/idlelib/idle_test/__pycache__/htest.cpython-310.pyc ADDED
Binary file (14.2 kB). View file
 
parrot/lib/python3.10/idlelib/idle_test/__pycache__/mock_idle.cpython-310.pyc ADDED
Binary file (2.89 kB). View file
 
parrot/lib/python3.10/idlelib/idle_test/__pycache__/mock_tk.cpython-310.pyc ADDED
Binary file (11.1 kB). View file
 
parrot/lib/python3.10/idlelib/idle_test/__pycache__/template.cpython-310.pyc ADDED
Binary file (1.32 kB). View file
 
parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_autocomplete_w.cpython-310.pyc ADDED
Binary file (1.58 kB). View file
 
parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_editmenu.cpython-310.pyc ADDED
Binary file (3.06 kB). View file
 
parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_editor.cpython-310.pyc ADDED
Binary file (6.19 kB). View file
 
parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_grep.cpython-310.pyc ADDED
Binary file (5 kB). View file
 
parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_parenmatch.cpython-310.pyc ADDED
Binary file (4.13 kB). View file
 
parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_pathbrowser.cpython-310.pyc ADDED
Binary file (3.57 kB). View file
 
parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_percolator.cpython-310.pyc ADDED
Binary file (4.85 kB). View file
 
parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_pyparse.cpython-310.pyc ADDED
Binary file (13.7 kB). View file
 
parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_pyshell.cpython-310.pyc ADDED
Binary file (5.72 kB). View file
 
parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_sidebar.cpython-310.pyc ADDED
Binary file (24.8 kB). View file
 
parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_stackviewer.cpython-310.pyc ADDED
Binary file (1.81 kB). View file
 
parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_statusbar.cpython-310.pyc ADDED
Binary file (1.84 kB). View file
 
parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_textview.cpython-310.pyc ADDED
Binary file (9.42 kB). View file
 
parrot/lib/python3.10/idlelib/idle_test/__pycache__/test_undo.cpython-310.pyc ADDED
Binary file (4.42 kB). View file